cscg22-gearboy

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

set_tile_map_compat.s (779B)


      1        .include        "global.s"
      2
      3        .title  "VRAM utilities"
      4        .module VRAMUtils
      5
      6        .globl  .set_tile_map_xy
      7
      8        .area   _HOME
      9
     10; void set_tile_map(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) __z88dk_callee __preserves_regs(iyh, iyl);
     11_set_tile_map_compat::
     12        pop hl          ; HL = ret
     13        pop bc          ; BC = YX
     14        pop de          ; DE = WH
     15        ex (sp), hl     ; HL = data
     16        ex de, hl       ; HL = WH, DE = data
     17
     18        ld a, b
     19        ld b, d
     20
     21        add #.SCREEN_Y_OFS
     22        ld d, a
     23        xor a
     24        FAST_MOD8 d #28
     25        ld d, a
     26
     27        ld a, c
     28        add #.SCREEN_X_OFS
     29        and #0x1f
     30        ld c, e
     31        ld e, a         ; BC = data, DE = YX
     32
     33        jp .set_tile_map_xy_compat