cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

msx_set_1bpp_data.s (1261B)


      1        .include        "global.s"
      2
      3        .title  "VRAM utilities"
      4        .module VRAMUtils
      5
      6        .ez80
      7
      8        .area   _HOME
      9
     10; void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) __z88dk_callee;
     11_set_tile_1bpp_data::
     12        pop af
     13        pop hl
     14        pop iy
     15        pop de
     16        pop bc
     17        push af
     18
     19        push ix
     20        ld ixl, c
     21
     22        add hl, hl
     23        add hl, hl
     24        add hl, hl
     25
     26        push hl
     27
     28        ld bc, #.VDP_COLORDATA0
     29        add hl, bc
     30        ex (sp), hl
     31
     32        ld bc, #.VDP_TILEDATA0
     33        add hl, bc
     34
     35        DISABLE_VBLANK_COPY        ; switch OFF copy shadow SAT
     36
     37        ld c, #.VDP_DATA
     38        inc iyh
     39        inc iyl
     40        jr 2$
     41
     421$:
     43        VDP_WRITE_CMD h, l
     44        ex de, hl
     45        ld b, #8
     463$:        
     47        outi
     48        jr nz, 3$
     49        ex de, hl
     50
     51        ld a, #8
     52        ADD_A_REG16 h, l
     53        ex (sp), hl
     54
     55        VDP_WRITE_CMD h, l
     56        ld b, #8
     57        ld a, ixl
     584$:        
     59        out (c), a
     60        inc hl
     61        dec b
     62        jr nz, 4$
     63
     64        ex (sp), hl
     652$:
     66        dec iyl
     67        jr  nz, 1$
     68
     69        dec iyh
     70        jr nz, 1$
     71
     72        ENABLE_VBLANK_COPY         ; switch ON copy shadow SAT
     73
     74        pop hl
     75        pop ix
     76
     77        ret