]> Joshua Wise's Git repositories - fpgaboy.git/commitdiff
Add nintendo logo to diag. Add xmodem loader. Add auxboot and binwire utilities.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Thu, 8 May 2008 00:12:16 +0000 (20:12 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Thu, 8 May 2008 00:12:16 +0000 (20:12 -0400)
auxboot.c [new file with mode: 0644]
binwire.c [new file with mode: 0644]
diag.asm
xm.asm [new file with mode: 0644]

diff --git a/auxboot.c b/auxboot.c
new file mode 100644 (file)
index 0000000..c5ce3af
--- /dev/null
+++ b/auxboot.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+void dowrite(char *s, int len)
+{
+  int i;
+  for (i=0; i<len; i++)
+  {
+    write(1, s+i, 1);
+  }
+}
+
+void main()
+{
+  char buf[259];
+  int sz;
+  buf[0] = 0x1B;
+  buf[1] = 'A';
+  buf[2] = buf[3] = buf[4] = 0;
+  dowrite(buf, 5);
+  buf[1] = 'P';
+  read(0, buf+2, 127);
+  dowrite(buf, 129);
+}
\ No newline at end of file
diff --git a/binwire.c b/binwire.c
new file mode 100644 (file)
index 0000000..9322ef1
--- /dev/null
+++ b/binwire.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+void dowrite(char *s, int len)
+{
+  int i;
+  for (i=0; i<len; i++)
+  {
+    write(1, s+i, 1);
+  }
+}
+
+void main()
+{
+  char buf[259];
+  int sz;
+  dowrite("\x1B" "A\x00\x00\x00...", 8);
+  fprintf(stderr, "Address sent\n");
+  while ((sz = read(0, buf+3, 128)) > 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
index d269b25c1e38b186b7e9f62a700fe7fb9de181e9..780f5c2b452df06e5da55f2c4d1d9cb932058dfb 100644 (file)
--- a/diag.asm
+++ b/diag.asm
@@ -1,6 +1,3 @@
-       section "end",HOME[1024]
-       nop
-
        SECTION "a",HOME[$00]
 
 start: jp main
        SECTION "a",HOME[$00]
 
 start: jp main
@@ -14,6 +11,19 @@ start: jp main
        section "tmro",HOME[$50]
        jp tmro
 
        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
 main:
        ld a, $FF
        ld c, $51
diff --git a/xm.asm b/xm.asm
new file mode 100644 (file)
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
This page took 0.038378 seconds and 4 git commands to generate.