cscg22-gearboy

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

set_interrupts.s (784B)


      1        .include        "global.s"
      2
      3        .title  "Set interrupts"
      4        .module SetInterrupts
      5
      6        .globl _shadow_VDP_R0
      7        .globl _shadow_VDP_R1
      8
      9        .area   _HOME
     10
     11_set_interrupts::
     12        ld a, i
     13        di
     14        push af
     15
     16        ld a, (_shadow_VDP_R1)
     17        bit 0, l
     18        jr z, 1$
     19        or #.R1_IE
     20        jr 2$
     211$:
     22        and #~.R1_IE
     232$:
     24        ld (_shadow_VDP_R1), a
     25        out (.VDP_CMD), a
     26        ld a, #.VDP_R1
     27        out (.VDP_CMD), a
     28
     29        ld a, (_shadow_VDP_R0)
     30        bit 1, l
     31        jr z, 3$
     32        or #.R0_IE1
     33        jr 4$
     343$:
     35        and #~.R0_IE1
     364$:
     37        ld (_shadow_VDP_R0), a
     38        out (.VDP_CMD), a
     39        ld a, #.VDP_R0
     40        out (.VDP_CMD), a
     41
     42        pop af
     43        jp po, 5$
     44        ei
     455$:        
     46        ret