]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - flashboot.asm
Fix POP AF test (from blargg's CPU tests)
[fpgaboy.git] / flashboot.asm
diff --git a/flashboot.asm b/flashboot.asm
new file mode 100644 (file)
index 0000000..3987ac3
--- /dev/null
@@ -0,0 +1,80 @@
+       SECTION "wee",HOME[$0]
+       ld sp, $CFFF
+
+       ld hl, loading+$D800
+       call puts+$D800
+
+       ld a, $FF       ; Put the thing in read array mode.
+       ld [$FF65], a
+
+       xor a
+       ld d, a
+       ld e, a
+       
+loop:  ld a, $04
+       cp d
+       jr z,done
+       
+       xor c
+ifl:   ld a, d                 ; Set up for the flash read.
+       ld [$FF60], a
+       ld a, e
+       ld [$FF61], a
+       ld a, c
+       ld [$FF62], a
+       ld a, [$FF65]
+       ld b, a
+       ld a, d                 ; Set up for the flash read.
+       ld [$FF60], a
+       ld a, e
+       ld [$FF61], a
+       ld a, c
+       ld [$FF62], a
+       ld a, b
+       ld [$FF63], a
+       inc c
+       jr nz, ifl
+       
+       ld a, $2E       ;.
+       call putc+$D800
+       
+       inc de
+       jr loop
+done:  
+       ld hl, booting+$D800
+       call puts+$D800
+       
+       xor a
+       ld h, a
+       ld l, a
+       ld [hl], $01    ; Select the GB boot rom
+
+       rst $00         ; Boot
+
+putc:
+       push bc
+       ld c, $53
+       push af
+.waitport:
+       ld a,[c]
+       and $01
+       jr nz,.waitport
+       pop af
+       ld [$FF52],a
+       pop bc
+       ret
+
+loading:
+       db "Loading...",0
+booting:
+       db $0D,$0A,"Booting...",$0D,$0A,0
+
+puts:
+       ld a, [hli]
+       cp $00
+       ret z
+       call putc+$D800
+       jr puts
+
+       section "a", HOME[$FF]
+       nop
This page took 0.024297 seconds and 4 git commands to generate.