Add list of broken tests
[fpgaboy.git] / xm.asm
CommitLineData
2bcaaabf
JW
1 SECTION "wee",HOME[$0]
2 ; this all needs to be PIC!
bf3f2c5f
JW
3; xor a
4; ld hl, $FF60
5; ld [hli], a
6; ld [hli], a
7; ld [hli], a
8st: ld sp, $CFFF
2bcaaabf
JW
9nak:
10 ld a, $15 ; NAK
11 call putc+$FF80
12
13.ack: call getc+$FF80
bf3f2c5f
JW
14; cp $01 ;SOH
15; jr z,.soh
2bcaaabf
JW
16 cp $04 ;EOT
17 jr z, .eot
18 cp $18 ;CAN
19 jr z, .rst
bf3f2c5f 20 jr nak
2bcaaabf
JW
21
22.eot:
23 ld A, $06 ; Ack the EOT
24 call putc+$FF80
25.rst: rst $00
26
27.soh: call getc+$FF80 ; blk
28 call getc+$FF80 ; iblk
bf3f2c5f
JW
29 ld b, $00
30 ld hl, $C000
31.lp: bit 7, l
32 jr nz, .cksm
33 call getc+$FF80
2bcaaabf
JW
34 ld [hli], a
35 add b
36 ld b, a
bf3f2c5f 37 jr .lp
2bcaaabf
JW
38.cksm: call getc+$FF80
39 cp b
40 jr nz, .donak
41 ld hl, $C000
bf3f2c5f 42.lp2: ld a, [hli]
2bcaaabf
JW
43 ld [$FF63], A
44 bit 7, l
45 jr z,.lp2
bf3f2c5f 46.doack: ld A, $06 ; 06
2bcaaabf
JW
47 call putc+$FF80
48 jr .ack
49.donak: call getc+$FF80 ; Wait until the line clears, and then once
50 jr .donak ; that happens, getc will cause a NAK.
51
52getc:
53 xor d
bf3f2c5f 54 ;xor e ; Possibly not needed?
2bcaaabf
JW
55.dgetc:
56 dec de
57 xor a
58 cp d
59 jr z, .timeout
60 ld a, [$FF53]
61 and $02
62 jr z, .dgetc
63 ld a, [$FF52]
64 ret
65.timeout:
bf3f2c5f 66 ld hl, $D010
2bcaaabf
JW
67 ld a, [hl]
68 inc a
69 ld [hl], a
70 ld [$FF51], a
bf3f2c5f 71 pop hl
2bcaaabf
JW
72 jr nak
73
74putc:
75 ld c, $53
76 push af
77.waitport:
78 ld a,[c]
79 and $01
80 jr nz,.waitport
81 pop af
82 ld [$FF52],a
83 ret
84
bf3f2c5f
JW
85 section "a", HOME[$7E]
86 nop
This page took 0.049493 seconds and 4 git commands to generate.