X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/31b9962d02cae0e935e392b688370504fd4125ff..efc8cc5dd78c9126c9e3ced9be2c99c6b962703a:/flashboot.asm diff --git a/flashboot.asm b/flashboot.asm new file mode 100644 index 0000000..3987ac3 --- /dev/null +++ b/flashboot.asm @@ -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