From: Joshua Wise Date: Thu, 8 May 2008 00:12:16 +0000 (-0400) Subject: Add nintendo logo to diag. Add xmodem loader. Add auxboot and binwire utilities. X-Git-Url: http://git.joshuawise.com/fpgaboy.git/commitdiff_plain/2bcaaabf0bbbb0232fe8ffe0a8943a14159852ab?ds=sidebyside Add nintendo logo to diag. Add xmodem loader. Add auxboot and binwire utilities. --- diff --git a/auxboot.c b/auxboot.c new file mode 100644 index 0000000..c5ce3af --- /dev/null +++ b/auxboot.c @@ -0,0 +1,23 @@ +#include + +void dowrite(char *s, int len) +{ + int i; + for (i=0; i + +void dowrite(char *s, int len) +{ + int i; + for (i=0; i 0) + { + buf[0] = 0x1B; + buf[1] = 'D'; + buf[2] = sz - 1; + dowrite(buf, sz + 3); + dowrite(".", 1); + fprintf(stderr, "Data sent\n"); + usleep(100000); + } +} \ No newline at end of file diff --git a/diag.asm b/diag.asm index d269b25..780f5c2 100644 --- a/diag.asm +++ b/diag.asm @@ -1,6 +1,3 @@ - section "end",HOME[1024] - nop - SECTION "a",HOME[$00] start: jp main @@ -14,6 +11,19 @@ start: jp main section "tmro",HOME[$50] jp tmro + SECTION "b",HOME[$100] +boot: jr main ; $0100 + nop ; $0102 + nop ; $0103 + ;Nintendo Logo ; $0104 + DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D + DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 + DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E + ;$0134 + DB $00,$E7,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00 + ;$0144 + DB $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00 + main: ld a, $FF ld c, $51 diff --git a/xm.asm b/xm.asm new file mode 100644 index 0000000..d4b5374 --- /dev/null +++ b/xm.asm @@ -0,0 +1,88 @@ + SECTION "wee",HOME[$0] + ; this all needs to be PIC! +st: + ld sp, $CFFF + xor a + ld hl, $FF60 + ld [hli], a + ld [hli], a + ld [hli], a +nak: + ld a, $15 ; NAK + call putc+$FF80 + +.ack: call getc+$FF80 + cp $01 ;SOH + jr z,.soh + cp $04 ;EOT + jr z, .eot + cp $18 ;CAN + jr z, .rst + jr .donak + +.eot: + ld A, $06 ; Ack the EOT + call putc+$FF80 +.rst: rst $00 + +.soh: call getc+$FF80 ; blk + call getc+$FF80 ; iblk + xor a + ld b, a + ld l, a + ld h, $C0 +.lp: call getc+$FF80 + ld [hli], a + add b + ld b, a + bit 7, l + jr z, .lp +.cksm: call getc+$FF80 + cp b + jr nz, .donak + ld hl, $C000 +.lp2: jr z, .doack + ld a, [hli] + ld [$FF63], A + bit 7, l + jr z,.lp2 +.doack: ld A, $06 + call putc+$FF80 + jr .ack +.donak: call getc+$FF80 ; Wait until the line clears, and then once + jr .donak ; that happens, getc will cause a NAK. + +getc: + xor d + xor e +.dgetc: + dec de + xor a + cp d + jr z, .timeout + ld a, [$FF53] + and $02 + jr z, .dgetc + ld a, [$FF52] + ret +.timeout: + ld hl, $D000 + ld a, [hl] + inc a + ld [hl], a + ld [$FF51], a + jr nak + +putc: + ld c, $53 + push af +.waitport: + ld a,[c] + and $01 + jr nz,.waitport + pop af + ld [$FF52],a + ret + + section "a", HOME[$7F] + nop \ No newline at end of file