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
51 db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
94 ld hl, $8000 ; Copy two tiles.
107 .vloop: call .vblwait
124 .stat1: ld a, [$FF41] ; STAT
128 .stat2: ld a, [$FF41]
182 .scydown: ld hl, $FF42
190 .scxdown: ld hl, $FF43
238 ; Memory tester: writes h ^ l to all addresses from C000 to DF80.
243 ld hl, $C000 ; Write loop
255 ld hl, $C000 ; Read loop
271 ld hl, testokstr ; Say we're OK
274 .memfail: ; Say we failed (sadface)
275 ; decrement hl the easy way
291 db "Testing memory from $C000 to $DF80...",0
295 db " Test failed at $",0
297 puthex: ; Put two hex nibbles to the serial console.
312 ; Wait for switches to be flipped on and off again.
336 db "Diagnostic ROM complete; flip switches to nonzero and then to zero to reset. Expect A.",$0D,$0A,0
338 ; Core instruction basic acceptance tests.
412 ld hl, .dinocausefail
413 ld c, $0F ; First, wait until an interrupt happens...
418 ei ; Now make sure that an IRQ didn't happen on EI/DI
425 ei ; Make sure that an IRQ does happen on EI/NOP/DI
445 db "Testing instructions... ",0
463 db "DI/EI does not cause interrupt",0
465 db "DI/NOP/EI cause interrupt",0
467 db " test failed.",$0D,$0A,0
471 ; Serial port manipulation functions.