cscg22-gearboy

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

init_tt.s (1022B)


      1        .include        "global.s"
      2
      3        .area   _HOME
      4
      5        ;; Initialize window tile table with B
      6.init_wtt::
      7        LDH     A,(.LCDC)
      8        AND     #LCDCF_WIN9C00
      9        JR      Z,.is98
     10        JR      .is9c
     11        ;; Initialize background tile table with B
     12.init_btt::
     13        LDH     A,(.LCDC)
     14        AND     #LCDCF_BG9C00
     15        JR      NZ,.is9c
     16.is98:
     17        LD      HL,#0x9800      ; HL = origin
     18        JR      .init_tt
     19.is9c:
     20        LD      HL,#0x9C00      ; HL = origin
     21
     22.init_tt::
     23        LD      DE,#0x0400      ; One whole GB Screen
     24
     25.init_vram::
     26        SRL     D
     27        RR      E
     28        JR      NC, 1$
     29
     30        WAIT_STAT
     31        LD      A, B
     32        LD      (HL+),A
     331$:
     34        LD      A, D
     35        OR      E
     36        RET     Z
     37        
     38        INC     D
     39        INC     E
     40        JR      2$
     413$:
     42        WAIT_STAT
     43        LD      A, B
     44        LD      (HL+),A
     45        LD      (HL+),A
     462$:
     47        DEC     E
     48        JR      NZ, 3$
     49        DEC     D
     50        JR      NZ, 3$
     51        
     52        RET