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
+; xor a
+; ld hl, $FF60
+; ld [hli], a
+; ld [hli], a
+; ld [hli], a
+st: ld sp, $CFFF
nak:
ld a, $15 ; NAK
call putc+$FF80
.ack: call getc+$FF80
- cp $01 ;SOH
- jr z,.soh
+; cp $01 ;SOH
+; jr z,.soh
cp $04 ;EOT
jr z, .eot
cp $18 ;CAN
jr z, .rst
- jr .donak
+ jr nak
.eot:
ld A, $06 ; Ack the EOT
.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 b, $00
+ ld hl, $C000
+.lp: bit 7, l
+ jr nz, .cksm
+ call getc+$FF80
ld [hli], a
add b
ld b, a
- bit 7, l
- jr z, .lp
+ jr .lp
.cksm: call getc+$FF80
cp b
jr nz, .donak
ld hl, $C000
-.lp2: jr z, .doack
- ld a, [hli]
+.lp2: ld a, [hli]
ld [$FF63], A
bit 7, l
jr z,.lp2
-.doack: ld A, $06
+.doack: ld A, $06 ; 06
call putc+$FF80
jr .ack
.donak: call getc+$FF80 ; Wait until the line clears, and then once
getc:
xor d
- xor e
+ ;xor e ; Possibly not needed?
.dgetc:
dec de
xor a
ld a, [$FF52]
ret
.timeout:
- ld hl, $D000
+ ld hl, $D010
ld a, [hl]
inc a
ld [hl], a
ld [$FF51], a
+ pop hl
jr nak
putc:
ld [$FF52],a
ret
- section "a", HOME[$7F]
- nop
\ No newline at end of file
+ section "a", HOME[$7E]
+ nop