1 section "end",HOME[1024]
8 section "vbl",HOME[$40]
11 section "lcdc",HOME[$48]
14 section "tmro",HOME[$50]
24 ld a, $04 ;start timer, 4.096KHz
54 db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
97 ld hl, $8000 ; Copy two tiles.
110 .vloop: call .vblwait
127 .stat1: ld a, [$FF41] ; STAT
131 .stat2: ld a, [$FF41]
174 .scydown: ld hl, $FF42
182 .scxdown: ld hl, $FF43
230 ; Memory tester: writes h ^ l to all addresses from C000 to DF80.
235 ld hl, $C000 ; Write loop
247 ld hl, $C000 ; Read loop
263 ld hl, testokstr ; Say we're OK
266 .memfail: ; Say we failed (sadface)
267 ; decrement hl the easy way
283 db "Testing memory from $C000 to $DF80...",0
287 db " Test failed at $",0
289 puthex: ; Put two hex nibbles to the serial console.
304 ; Wait for switches to be flipped on and off again.
328 db "Diagnostic ROM complete; flip switches to nonzero and then to zero to reset. Expect A.",$0D,$0A,0
330 ; Core instruction basic acceptance tests.
404 ld hl, .dinocausefail
405 ld c, $0F ; First, wait until an interrupt happens...
410 ei ; Now make sure that an IRQ didn't happen on EI/DI
417 ei ; Make sure that an IRQ does happen on EI/NOP/DI
437 db "Testing instructions... ",0
455 db "DI/EI does not cause interrupt",0
457 db "DI/NOP/EI cause interrupt",0
459 db " test failed.",$0D,$0A,0
463 ; Serial port manipulation functions.