Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INCLUDE "src/includes/common.s"
- SECTION "init", ROM0
- test: MACRO
- ; select the ram bank
- ld a, \1
- ld [$4000], a
- ld a, 0
- ld hl, $a000
- ld bc, $2000
- call memset
- call WaitVBlank
- ; turn screen off
- xor a
- ldh [rLCDC], a
- ld a, $10
- ld [rLYC], a
- ld c, low(rSTAT)
- ld hl, $a000
- ; turn screen on
- ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINOFF | LCDCF_BG8000 | LCDCF_BG9800 | LCDCF_OBJ8 | LCDCF_OBJON | LCDCF_BGON
- ldh [rLCDC], a
- ; wait for some nops
- nops \1
- call RunTest
- ENDM
- Init::
- call TurnLcdOn
- ; enable sram
- ld a, $0a
- ld [$0000], a
- ; set ram bank select mode
- ld a, $01
- ld [$6000], a
- test 0
- test 1
- test 2
- test 3
- ; disable sram
- xor a
- ld [$0000], a
- ld hl, $9800
- print_string_literal "done!"
- jp Terminate
- RunTest::
- ; (456/4) * (154 + 2 extra lines) / 4 cycles = 4446
- REPT 4446
- ld a, [c] ; 2 cycles
- ld [hl+], a ; 2 cycles
- ENDR
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement