5 section "vbl",HOME[$40]
8 section "lcdc",HOME[$48]
11 section "tmro",HOME[$50]
23 ld a, $04 ;start timer, 4.096KHz
48 db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
92 ; Memory tester: writes h ^ l to all addresses from C000 to DF80.
97 ld hl, $C001 ; Write loop
109 ld hl, $C001 ; Read loop
125 ld hl, testokstr ; Say we're OK
128 .memfail: ; Say we failed (sadface)
129 ; decrement hl the easy way
145 db "Testing memory from $C000 to $DF80...",0
149 db " Test failed at $",0
151 puthex: ; Put two hex nibbles to the serial console.
166 ; Wait for switches to be flipped on and off again.
190 db "Diagnostic ROM complete; flip switches to nonzero and then to zero to reset. Expect A.",$0D,$0A,0
192 ; Core instruction basic acceptance tests.
266 ld hl, .dinocausefail
267 ld c, $0F ; First, wait until an interrupt happens...
272 ei ; Now make sure that an IRQ didn't happen on EI/DI
279 ei ; Make sure that an IRQ does happen on EI/NOP/DI
299 db "Testing instructions... ",0
317 db "DI/EI does not cause interrupt",0
319 db "DI/NOP/EI cause interrupt",0
321 db " test failed.",$0D,$0A,0
325 ; Serial port manipulation functions.