7 section "vbl",HOME[$40]
10 section "lcdc",HOME[$48]
13 section "tmro",HOME[$50]
16 SECTION "b",HOME[$100]
20 ;Nintendo Logo ; $0104
21 DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
22 DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
23 DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
25 DB $00,$E7,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00
27 DB $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00
36 ld a, $04 ;start timer, 4.096KHz
66 db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
106 LD A,$fc ; $001d Setup BG palette
112 ld hl, $8000 ; Copy two tiles.
125 .vloop: call .vblwait
142 .stat1: ld a, [$FF41] ; STAT
146 .stat2: ld a, [$FF41]
189 .scydown: ld hl, $FF42
197 .scxdown: ld hl, $FF43
245 ; Memory tester: writes h ^ l to all addresses from C000 to DF80.
250 ld hl, $C000 ; Write loop
262 ld hl, $C000 ; Read loop
278 ld hl, testokstr ; Say we're OK
281 .memfail: ; Say we failed (sadface)
282 ; decrement hl the easy way
298 db "Testing memory from $C000 to $DF80...",0
302 db " Test failed at $",0
304 puthex: ; Put two hex nibbles to the serial console.
319 ; Wait for switches to be flipped on and off again.
343 db "Diagnostic ROM complete; flip switches to nonzero and then to zero to reset. Expect A.",$0D,$0A,0
345 ; Core instruction basic acceptance tests.
419 ld hl, .dinocausefail
420 ld c, $0F ; First, wait until an interrupt happens...
425 ei ; Now make sure that an IRQ didn't happen on EI/DI
432 ei ; Make sure that an IRQ does happen on EI/NOP/DI
452 db "Testing instructions... ",0
470 db "DI/EI does not cause interrupt",0
472 db "DI/NOP/EI cause interrupt",0
474 db " test failed.",$0D,$0A,0
478 ; Serial port manipulation functions.