cscg22-gearboy

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

msx_metasprites.s (1516B)


      1        .include    "global.s"
      2
      3        .title  "Metasprites"
      4        .module Metasprites
      5
      6        .area   _DATA
      7
      8___current_metasprite:: 
      9        .ds     0x02
     10___current_base_tile::
     11        .ds     0x01
     12
     13        .area   _CODE
     14
     15; uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) __z88dk_callee __preserves_regs(iyh,iyl);
     16
     17___move_metasprite::
     18        ld      hl, #4
     19        add     hl, sp
     20
     21        ld      b, (hl)
     22        dec     hl
     23        ld      c, (hl)
     24        dec     hl
     25        ld      e, (hl)
     26
     27        ld      hl, (___current_metasprite)
     28
     29        ld      a, (___render_shadow_OAM)
     30        ld      d, a
     311$:
     32        ld      a, (hl)         ; dy
     33        inc     hl
     34        cp      #0x80
     35        jp      z, 2$
     36        add     b        
     37        ld      b, a
     38        cp      #0xD0
     39        jp      nz, 3$
     40        ld      a, #0xC0
     413$:
     42        ld      (de), a
     43        inc     e
     44
     45        ld      a, (hl)         ; dx
     46        inc     hl
     47        add     c
     48        ld      c, a
     49        ld      (de), a
     50        inc     e
     51
     52        ld      a, (___current_base_tile)
     53        add     (hl)            ; tile
     54        inc     hl
     55        ld      (de), a
     56        inc     e
     57
     58        ld      a, (hl)
     59        inc     hl
     60        ld      (de), a
     61        inc     e
     62
     63        jp      1$
     642$:
     65        pop     hl
     66        pop     bc
     67        inc     sp
     68        push    hl
     69        ld      a, e
     70        srl     a
     71        srl     a
     72        sub     c
     73        ld      l, a
     74        ret
     75
     76___render_shadow_OAM::
     77        .db     #>_shadow_OAM