;
REG_LCDC equ $ff40
REG_STAT equ $ff41
REG_SCY equ $ff42
REG_SCX equ $ff43
REG_LY equ $ff44
REG_LYC equ $ff45
REG_BGP equ $ff47
REG_OBP0 equ $ff48
REG_OBP1 equ $ff49
REG_WY equ $ff4a
REG_WX equ $ff4b
LCDC_BGON equ $01
LCDC_OBJON equ $02
LCDC_OBJ16 equ $04
LCDC_BGMAP_9C00 equ $08
LCDC_CHAR_8000 equ $10
LCDC_WON equ $20
LCDC_WMAP_9C00 equ $40
LCDC_DISPON equ $80
section "hdr", ROM0[$100]
nop
jp main
rept $150 - $104
db 0
endr
section "text", ROM0
main:
ldh a, [REG_LY]
cp a, 144
jr c, main
;
xor a, a
ldh [REG_LCDC], a
ld hl, $8000 ;
ld de, tile0
ld c, tiles_end - tile0
.copytile:
ld a, [de]
ld [hl+], a
inc de
dec c
jr nz, .copytile
ld hl, $9800 ;
ld b, 18
.fillscr:
ld c, 32
.fillrow:
ld a, b
add a, c
and a, 1
ld [hl+], a
dec c
jr nz, .fillrow
dec b
jr nz, .fillscr
;
ld a, $e4 ;
ldh [REG_BGP], a
;
xor a, a
ldh [REG_SCY], a
ldh [REG_SCX], a
;
ld a, LCDC_DISPON | LCDC_CHAR_8000 | LCDC_BGON
ldh [REG_LCDC], a
di
.end: halt
nop
jp .end
section "data", ROM0
;
tile0: db $55,$00
db $aa,$00
db $55,$00
db $aa,$00
db $55,$00
db $aa,$00
db $55,$00
db $aa,$00
tile1: db $ff,$aa
db $ff,$55
db $ff,$aa
db $ff,$55
db $ff,$aa
db $ff,$55
db $ff,$aa
db $ff,$55
tiles_end: