cscg22-gearboy

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

sms_set_native_data.s (931B)


      1        .include        "global.s"
      2
      3        .title  "VRAM utilities"
      4        .module VRAMUtils
      5        .area   _HOME
      6
      7; void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) __z88dk_callee __preserves_regs(iyh,iyl);
      8_set_native_tile_data::
      9        pop de          ; pop ret address
     10        pop hl
     11
     12        add hl, hl
     13        add hl, hl
     14        add hl, hl
     15        add hl, hl
     16        add hl, hl
     17
     18        ld bc, #.VDP_VRAM
     19        add hl, bc
     20
     21        DISABLE_VBLANK_COPY        ; switch OFF copy shadow SAT
     22
     23        VDP_WRITE_CMD h, l
     24
     25        pop bc
     26        pop hl
     27        push de
     28
     29        ld e, c
     30        ld d, b
     31        
     32        ld c, #.VDP_DATA
     33        inc d
     34        inc e
     35        jr 2$
     36
     371$:
     38        ld b, #32
     393$:        
     40        outi
     41        jr nz, 3$
     422$:
     43        dec e
     44        jr  nz, 1$
     45
     46        dec d
     47        jr nz, 1$
     48        
     49        ENABLE_VBLANK_COPY         ; switch ON copy shadow SAT
     50
     51        ret