ld sp, $DFF0
+ ld c, $07
+ ld a, $04 ;start timer, 4.096KHz
+ ld [c], a
+
+ ld hl, $DF81
+ xor a
+ ld [hl], a
+
ld hl, signon
call puts
+
+ ei
call memtest
call insntest
call waitsw
+
+ di
jr main
signon:
db $0D,$0A,$1B,"[1mFPGABoy Diagnostic ROM",$1B,"[0m",$0D,$0A,0
+ section "fuq",HOME[$100]
+irqhand:
+ PUSH AF
+ PUSH BC
+ PUSH DE
+ PUSH HL
+
+ xor a
+ ld c, $0F ; ack the irq
+ ld [c], a
+
+ ld a, $41 ; print A
+ call putc
+
+ ld hl, $DF81
+ ld a, [hl]
+ ld b, 1
+ add b
+ ld c, $51
+ ld [c], a
+ ld [hl], a
+
+
+ POP HL
+ POP DE
+ POP BC
+ POP AF
+ RETI
+ db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
+ db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
+ db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
+
; Memory tester: writes h ^ l to all addresses from C000 to DF80.
memtest:
ld hl,memteststr