5 section "vbl",HOME[$40]
8 section "lcdc",HOME[$48]
11 section "tmro",HOME[$50]
14 SECTION "b",HOME[$100]
18 ;Nintendo Logo ; $0104
19 DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
20 DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
21 DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
23 DB $00,$E7,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00
25 DB $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00
34 ld a, $04 ;start timer, 4.096KHz
64 db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
104 LD A,$fc ; $001d Setup BG palette
110 ld hl, $8000 ; Copy two tiles.
123 .vloop: call .vblwait
140 .stat1: ld a, [$FF41] ; STAT
144 .stat2: ld a, [$FF41]
187 .scydown: ld hl, $FF42
195 .scxdown: ld hl, $FF43
243 ; Memory tester: writes h ^ l to all addresses from C000 to DF80.
248 ld hl, $C000 ; Write loop
260 ld hl, $C000 ; Read loop
276 ld hl, testokstr ; Say we're OK
279 .memfail: ; Say we failed (sadface)
280 ; decrement hl the easy way
296 db "Testing memory from $C000 to $DF80...",0
300 db " Test failed at $",0
302 puthex: ; Put two hex nibbles to the serial console.
317 ; Wait for switches to be flipped on and off again.
341 db "Diagnostic ROM complete; flip switches to nonzero and then to zero to reset. Expect A.",$0D,$0A,0
343 ; Core instruction basic acceptance tests.
417 ld hl, .dinocausefail
418 ld c, $0F ; First, wait until an interrupt happens...
423 ei ; Now make sure that an IRQ didn't happen on EI/DI
430 ei ; Make sure that an IRQ does happen on EI/NOP/DI
450 db "Testing instructions... ",0
468 db "DI/EI does not cause interrupt",0
470 db "DI/NOP/EI cause interrupt",0
472 db " test failed.",$0D,$0A,0
476 ; Serial port manipulation functions.