X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/49c326da841985a8aa48e8544173e5c045c6e0eb..1eefdc8e89a69963b1c1a084fe4ecec844997293:/fpgaboot.asm diff --git a/fpgaboot.asm b/fpgaboot.asm index a923657..4a1089f 100644 --- a/fpgaboot.asm +++ b/fpgaboot.asm @@ -1,11 +1,15 @@ SECTION "boot", HOME[$0] - ld a, $AA +boot: ld a, $AA ld [$FF51], A ; Poke the LEDs + + ld sp, $FFFE + + ld hl, signon + call puts ; Write a little bit to the RAM - ld H, $01 - ld L, $00 - ld A, $00 + ld hl, $0104 + xor a ld [HLI], A ld [HLI], A ld [HLI], A @@ -15,9 +19,6 @@ ld [HLI], A ld [HLI], A - ld a, $55 - ld [$FF51], A ; Poke the LEDs - ld A, $FF ld [HLI], A ld [HLI], A @@ -28,11 +29,48 @@ ld [HLI], A ld [HLI], A - ld H, $00 - ld L, $00 - ld [HL], $01 ; Select the GB boot rom - rst $00 ; Boot + ld c, $51 +.wait: ld a, [c] + cp $00 + jr nz, .wait + + ld h, a + ld l, a + ld [hl], $01 ; Select the GB boot rom + + ld a, $55 + ld [c], a + + ld hl, booting + call puts + + rst $00 ; Boot + +putc: + ld c, $53 + push af +.waitport: + ld a,[c] + cp $00 + jr nz,.waitport + pop af + ld [$FF52],a + ret + +puts: + ld a, [hli] + cp $00 + ret z + call putc + jr puts + +signon: + db $0D,$0A,$1B,"[1mFPGABoy Boot ROM",$1B,"[0m",$0D,$0A,0 +booting: + db "Booting...",$0D,$0A,0 + + SECTION "a", HOME[$100] nop ; Make sure we don't overflow. \ No newline at end of file