From: cuz Date: Fri, 19 Dec 2003 23:04:30 +0000 (+0000) Subject: Changed chip register names, fixed a bug X-Git-Tag: V2.12.0~1019 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=290de026d15fb2417bc611b81fd1c488a2cca39b;p=cc65 Changed chip register names, fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@2789 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/cbm610/cbm610.inc b/libsrc/cbm610/cbm610.inc index 99fe2dc1e..3e979fd36 100644 --- a/libsrc/cbm610/cbm610.inc +++ b/libsrc/cbm610/cbm610.inc @@ -231,26 +231,37 @@ Env3 = $1C ; I/O $db00: CIA 6526 Inter Process Communication - +; ; IPCcia = $db00 -PortA = $00 -PortB = $01 -DDRA = $02 -DDRB = $03 -TimALo = $04 -TimAHi = $05 -TimBLo = $06 -TimBHi = $07 -TOD10 = $08 -TODsec = $09 -TODmin = $0A -TODhour = $0B -SerDataReg = $0C -IntCtrReg = $0D -CtrlA = $0E -CtrlB = $0F - +.struct CIA + PRA .byte + PRB .byte + DDRA .byte + DDRB .byte + .union + .struct + TALO .byte + TAHI .byte + .endstruct + TA .word + .endunion + .union + .struct + TBLO .byte + TBHI .byte + .endstruct + TB .word + .endunion + TOD10 .byte + TODSEC .byte + TODMIN .byte + TODHR .byte + SDR .byte + ICR .byte + CRA .byte + CRB .byte +.endstruct ; I/O $dc00: CIA 6526 @@ -261,7 +272,7 @@ CtrlB = $0F ; I/O $dd00: ACIA 6551 -; acia = $dd00 +; acia = $dd00 ADataReg = $00 AStatusReg = $01 @@ -272,23 +283,28 @@ ACtrlReg = $03 ; I/O $de00: Triport #1 6525 -; tpi1 = $de00 - -tpiPortA = $00 -tpiPortB = $01 -tpiPortC = $02 -tpiIntLatch = $02 -tpiDDRA = $03 -tpiDDRB = $04 -tpiDDRC = $05 -tpiIntMask = $05 -tpiCtrlReg = $06 -tpiActIntReg = $07 - +; tpi1 = $de00 + +.struct TPI + PRA .byte + PRB .byte + .union + PRC .byte + INT .byte + .endunion + DDRA .byte + DDRB .byte + .union + DDRC .byte + IMR .byte + .endunion + CR .byte + AIR .byte +.endstruct ; I/O $df00: Triport #2 6525 -; tpi2 = $df00 +; tpi2 = $df00 diff --git a/libsrc/cbm610/kiec.s b/libsrc/cbm610/kiec.s index 488eda922..94faffb1e 100644 --- a/libsrc/cbm610/kiec.s +++ b/libsrc/cbm610/kiec.s @@ -13,29 +13,28 @@ ; ------------------------------------------------------------------------- -; 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 @@ -47,23 +46,76 @@ talk_listen: 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 @@ -74,24 +126,25 @@ scatn: ldy #tpiPortA 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 @@ -106,7 +159,7 @@ CIOUT: pha rts ; ------------------------------------------------------------------------- -; UNTLK +; UNTALK/UNLISTEN UNTLK: lda #$5F bne LF2B1 @@ -116,61 +169,9 @@ LF2B1: jsr talk_listen 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 @@ -181,11 +182,11 @@ LF314: jsr SetTimB32ms 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 @@ -195,15 +196,14 @@ LF31A: ldy #tpiPortA 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 @@ -211,16 +211,16 @@ LF33F: lda (tpi1),y ; tpiPortA 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 @@ -234,12 +234,13 @@ LF35E: lda (tpi1),y ; tpiPortA 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 + diff --git a/libsrc/cbm610/kirq.s b/libsrc/cbm610/kirq.s index 71df859b3..592958676 100644 --- a/libsrc/cbm610/kirq.s +++ b/libsrc/cbm610/kirq.s @@ -61,7 +61,7 @@ k_irq: cld lda #$0F sta IndReg - ldy #tpiActIntReg + ldy #TPI::AIR lda (tpi1),y ; Interrupt Register 6525 beq noirq @@ -83,8 +83,8 @@ irq1: cmp #%00010000 ; interrupt from uart? ; ------------------------------------------------------------------------- ; Done -irqend: ldy #tpiActIntReg - sta (tpi1),y ; Clear interrupt +irqend: ldy #TPI::AIR + sta (tpi1),y ; Clear interrupt noirq: pla sta IndReg diff --git a/libsrc/cbm610/kscnkey.s b/libsrc/cbm610/kscnkey.s index ce9851731..c08754c91 100644 --- a/libsrc/cbm610/kscnkey.s +++ b/libsrc/cbm610/kscnkey.s @@ -17,9 +17,9 @@ sta NorKey lda #$00 sta KbdScanBuf - ldy #tpiPortB + ldy #TPI::PRB sta (tpi2),y - ldy #tpiPortA + ldy #TPI::PRA sta (tpi2),y jsr Poll and #$3F @@ -28,16 +28,16 @@ jmp NoKey L1: lda #$FF - ldy #tpiPortA + ldy #TPI::PRA sta (tpi2),y asl a - ldy #tpiPortB + ldy #TPI::PRB sta (tpi2),y jsr Poll pha sta ModKey ora #$30 - bne L3 ; Branch always + bne L3 ; Branch always L2: jsr Poll L3: ldx #$05 @@ -48,17 +48,17 @@ L4: lsr a dex bpl L4 sec - ldy #tpiPortB + ldy #TPI::PRB lda (tpi2),y rol a sta (tpi2),y - ldy #tpiPortA + ldy #TPI::PRA lda (tpi2),y rol a sta (tpi2),y bcs L2 pla - bcc NoKey ; Branch always + bcc NoKey ; Branch always L5: ldy KbdScanBuf sty NorKey @@ -98,9 +98,9 @@ L8: tax NoKey: ldy #$FF Done: sty LastIndex End: lda #$7F - ldy #tpiPortA + ldy #TPI::PRA sta (tpi2),y - ldy #tpiPortB + ldy #TPI::PRB lda #$FF sta (tpi2),y rts @@ -127,7 +127,7 @@ PutKey: sta KeyBuf,x ; Poll the keyboard port until it's stable .proc Poll - ldy #tpiPortC + ldy #TPI::PRC L1: lda (tpi2),y sta KeySave lda (tpi2),y