; -------------------------------------------------------------------------
-; Talk senden
+; TALK subroutine
TALK: ora #$40
bne talk_listen
; -------------------------------------------------------------------------
-; Listen senden
+; LISTEN subroutine
-LISTEN:
- ora #$20
+LISTEN: ora #$20
talk_listen:
pha
lda #$3F
- ldy #tpiDDRA
+ ldy #TPI::DDRA
sta (tpi1),y
lda #$FF
- ldy #PortA
+ ldy #CIA::PRA
sta (cia),y
- ldy #DDRA
+ ldy #CIA::DDRA
sta (cia),y
lda #$FA
- ldy #tpiPortA
+ ldy #TPI::PRA
sta (tpi1),y
lda CTemp
bpl LF268
lda CTemp
and #$7F
sta CTemp
- ldy #tpiPortA
+ ldy #TPI::PRA
lda (tpi1),y
ora #$20
sta (tpi1),y
-LF268: lda (tpi1),y ; tpiPortA
+LF268: lda (tpi1),y ; TPI::PRA
and #$F7
sta (tpi1),y
pla
- jmp transfer_byte
+; jmp transfer_byte
+
+; -------------------------------------------------------------------------
+; Output A (without EOF flag)
+
+transfer_byte:
+ eor #$FF
+ ldy #CIA::PRA
+ sta (cia),y
+ ldy #TPI::PRA
+ lda (tpi1),y
+ ora #$12
+ sta (tpi1),y
+ lda (tpi1),y
+ and #%11000000
+ beq LF2D4
+ lda #$80
+ jsr UPDST
+ bne LF304 ; Branch always
+
+; Wait until NRFD is high
+
+LF2D4: lda (tpi1),y
+ bpl LF2D4
+ and #$EF
+ sta (tpi1),y
+
+LF2DE: jsr SetTimB32ms
+ bcc LF2E4 ; Branch always
+
+LF2E3: sec
+LF2E4: ldy #TPI::PRA
+ lda (tpi1),y
+ and #$40
+ bne LF2FC
+ ldy #CIA::ICR
+ lda (cia),y
+ and #$02
+ beq LF2E4
+ lda TimOut
+ bmi LF2DE
+ bcc LF2E3
+ lda #$01
+ jsr UPDST
+
+LF2FC: ldy #TPI::PRA
+ lda (tpi1),y
+ ora #$10
+ sta (tpi1),y
+
+LF304: lda #$FF
+ ldy #CIA::PRA
+ sta (cia),y
+ rts
; -------------------------------------------------------------------------
; Output secondary address after listen
SECOND: jsr transfer_byte
-scatn: ldy #tpiPortA
+scatn: ldy #TPI::PRA
lda (tpi1),y
ora #$08
sta (tpi1),y
TKSA: jsr transfer_byte
-LF283: ldy #tpiPortA
+LF283: ldy #TPI::PRA
lda (tpi1),y
and #$39
; A -> IEC control, data ready for input
set_listen:
- ldy #tpiPortA
+ ldy #TPI::PRA
sta (tpi1),y
lda #$C7
- ldy #tpiDDRA
+ ldy #TPI::DDRA
sta (tpi1),y
lda #$00
- ldy #DDRA
+ ldy #CIA::DDRA
sta (cia),y
jmp scatn
; -------------------------------------------------------------------------
+; CIOUT routine
CIOUT: pha
lda CTemp
rts
; -------------------------------------------------------------------------
-; UNTLK
+; UNTALK/UNLISTEN
UNTLK: lda #$5F
bne LF2B1
jmp set_listen
; -------------------------------------------------------------------------
-; Output A (without EOF flag)
+; ACPTR routine
-transfer_byte:
- eor #$FF
- ldy #PortA
- sta (cia),y
- ldy #tpiPortA
- lda (tpi1),y
- ora #$12
- sta (tpi1),y
- lda (tpi1),y
- and #%11000000
- beq LF2D4
- lda #$80
- jsr UPDST
- bne LF304 ; Branch always
-
-; Wait until NRFD is high
-
-LF2D4: lda (tpi1),y
- bpl LF2D4
- and #$EF
- sta (tpi1),y
-
-LF2DE: jsr SetTimB32ms
- bcc LF2E4 ; Branch always
-
-LF2E3: sec
-LF2E4: ldy #tpiPortA
- lda (tpi1),y
- and #$40
- bne LF2FC
- ldy #IntCtrReg
- lda (cia),y
- and #$02
- beq LF2E4
- lda TimOut
- bmi LF2DE
- bcc LF2E3
- lda #$01
- jsr UPDST
-
-LF2FC: ldy #tpiPortA
- lda (tpi1),y
- ora #$10
- sta (tpi1),y
-
-LF304: lda #$FF
- ldy #PortA
- sta (cia),y
- rts
-
-; -------------------------------------------------------------------------
-
-ACPTR: ldy #tpiPortA
+ACPTR: ldy #TPI::PRA
lda (tpi1),y
and #$B9
ora #$81
LF319: sec
-LF31A: ldy #tpiPortA
+LF31A: ldy #TPI::PRA
lda (tpi1),y
and #$10
beq LF33F
- ldy #IntCtrReg
+ ldy #CIA::ICR
lda (cia),y
and #$02
beq LF31A ; Loop if not timeout
bcc LF319
lda #$02
jsr UPDST
- ldy #tpiPortA
+ ldy #TPI::PRA
lda (tpi1),y
and #$3D
sta (tpi1),y
lda #$0D
rts
-; -------------------------------------------------------------------------
-LF33F: lda (tpi1),y ; tpiPortA
+LF33F: lda (tpi1),y ; TPI::PRA
and #$7F
sta (tpi1),y
and #$20
lda #$40
jsr UPDST
-LF350: ldy #PortA
+LF350: ldy #CIA::PRA
lda (cia),y
eor #$FF
pha
- ldy #tpiPortA
+ ldy #TPI::PRA
lda (tpi1),y
ora #$40
sta (tpi1),y
-LF35E: lda (tpi1),y ; tpiPortA
+LF35E: lda (tpi1),y ; TPI::PRA
and #$10
beq LF35E
lda (tpi1),y
SetTimB32ms:
lda #$FF ; 255*256*0,5 µs
- ldy #TimBHi
+ ldy #CIA::TBHI
sta (cia),y ; as high byte, low byte = 0
lda #$11
- ldy #CtrlB
+ ldy #CIA::CRB
sta (cia),y ; Start the timer
- ldy #IntCtrReg
+ ldy #CIA::ICR
lda (cia),y ; Clear the interrupt flag
clc
rts
+