New ethernet code
[fpgaboy.git] / ethertest.asm
CommitLineData
faa9ae6f
JW
1 SECTION "wee",HOME[$0]
2outlp: ; Read a packet out if one is waiting.
3 ld a, [$FF69]
4 ld h, a
5 call puthex+$D800
6 ld a, [$FF69]
7 ld l, a
8 call puthex+$D800
9rxlp: ld a, h
10 or l
11 jr z, tx
12 dec hl
13 ld a, [$FF69]
14 call puthex+$D800
15 jr rxlp
16tx: ld a, 13
17 call putc+$D800
18 ld a, 10
19 call putc+$D800
20 ld a, [$FF51]
21 ld [$D800+diqing], a
22 ld a, $0
23 ld [$FF69], a
24 ld a, $60
25 ld c, a
26 ld hl, $D800+bleep
27 ld [$FF69], a
28lp: ld a, [hli]
29 ld [$FF69], a
30 dec c
31 jr nz, lp
32 ld hl, $0000
33dl1: dec hl
34 ld a, [$FF68]
35 ld [$FF51], a
36 ld a, h
37 or l
38 jr nz, dl1
39 jr outlp
40bleep: db $FF, $FF, $FF, $FF, $FF, $FF
41 db $00, $12, $34, $56, $78, $90
42 db $08, $00
43
44 db $45, $00, $00, $2E, $00, $00, $00, $00, $80, $11
45 db $26, $bd
46 db $0A, $00, $00, $02
47 db $0A, $00, $00, $01
48
49 db $04, $00, $04, $00, $00, $1A, $00, $00
50
51diqing: db $01, $02, $03, $04, $05, $06, $07, $08
52
53putc:
54 push af
55.waitport:
56 ld a,[$FF53]
57 and $01
58 jr nz,.waitport
59 pop af
60 ld [$FF52],a
61 ret
62
63puthex: ; Put two hex nibbles to the serial console.
64 push bc
65 push hl
66 push af
67 swap a
68 and $0F
69 ld hl,hex+$D800
70 ld b,0
71 ld c,a
72 add hl,bc
73 ld a, [hl]
74 call putc+$D800
75 pop af
76 and $0F
77 ld hl,hex+$D800
78 ld c,a
79 add hl,bc
80 ld a, [hl]
81 call putc+$D800
82 pop hl
83 pop bc
84 ret
85hex: db "0123456789ABCDEF"
86
87 section "anus", HOME[$100]
88 nop
This page took 0.026315 seconds and 4 git commands to generate.