cscg22-gearboy

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

metasprites_hide.s (876B)


      1        .include    "global.s"
      2
      3        .title  "Metasprites"
      4        .module Metasprites
      5
      6        .globl  ___current_metasprite, ___render_shadow_OAM
      7
      8        .area   _CODE
      9
     10
     11; void __hide_metasprite(uint8_t id)
     12
     13___hide_metasprite::
     14        ldhl    sp, #2
     15        ld      a, (hl)
     16        cp      #40
     17        ret     nc
     18        
     19        add     a
     20        add     a
     21        ld      e, a
     22
     23        ld      hl, #___current_metasprite
     24        ld      a, (hl+)
     25        ld      h, (hl)
     26        ld      l, a
     27
     28        ld      bc, #3
     29
     30        ld      a, (___render_shadow_OAM)
     31        ld      d, a
     321$:
     33        ld      a, (hl+)
     34        cp      #0x80
     35        ret     z
     36
     37        add     hl, bc
     38
     39        xor     a
     40        ld      (de), a
     41
     42        inc     e
     43        inc     e
     44        inc     e
     45        inc     e
     46
     47        ld      a, e
     48        cp      #160
     49
     50        jr      c, 1$
     51
     52        ret