Take in account that the C64 Retro Replay clockport needs to be activated in order to work with the RR-Net Ethernet card.
This commit is contained in:
parent
32ae3317a6
commit
a980f40bf6
1 changed files with 59 additions and 49 deletions
|
@ -30,7 +30,7 @@
|
||||||
;
|
;
|
||||||
; Author: Adam Dunkels <adam@sics.se>, Oliver Schmidt <ol.sc@web.de>
|
; Author: Adam Dunkels <adam@sics.se>, Oliver Schmidt <ol.sc@web.de>
|
||||||
;
|
;
|
||||||
; $Id: cs8900a.S,v 1.3 2007/11/29 21:56:55 oliverschmidt Exp $
|
; $Id: cs8900a.S,v 1.4 2007/12/08 21:05:48 oliverschmidt Exp $
|
||||||
;
|
;
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
||||||
.byte fixup38-fixup37, fixup39-fixup38, fixup40-fixup39
|
.byte fixup38-fixup37, fixup39-fixup38, fixup40-fixup39
|
||||||
.byte fixup41-fixup40, fixup42-fixup41, fixup43-fixup42
|
.byte fixup41-fixup40, fixup42-fixup41, fixup43-fixup42
|
||||||
.byte fixup44-fixup43, fixup45-fixup44, fixup46-fixup45
|
.byte fixup44-fixup43, fixup45-fixup44, fixup46-fixup45
|
||||||
|
.byte fixup47-fixup46, fixup48-fixup47
|
||||||
|
|
||||||
fixups = * - fixup
|
fixups = * - fixup
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ fixups = * - fixup
|
||||||
rxtxreg := $FF00 ; High byte patched at runtime
|
rxtxreg := $FF00 ; High byte patched at runtime
|
||||||
txcmd := $FF04 ; High byte patched at runtime
|
txcmd := $FF04 ; High byte patched at runtime
|
||||||
txlen := $FF06 ; High byte patched at runtime
|
txlen := $FF06 ; High byte patched at runtime
|
||||||
|
isq := $FF08 ; High byte patched at runtime
|
||||||
packetpp := $FF0A ; High byte patched at runtime
|
packetpp := $FF0A ; High byte patched at runtime
|
||||||
ppdata := $FF0C ; High byte patched at runtime
|
ppdata := $FF0C ; High byte patched at runtime
|
||||||
|
|
||||||
|
@ -138,56 +140,64 @@ init:
|
||||||
inc ptr+1
|
inc ptr+1
|
||||||
bcs :- ; Always
|
bcs :- ; Always
|
||||||
|
|
||||||
|
: Activate C64 RR clockport in order to operate RR-Net
|
||||||
|
; - RR config register overlays CS8900A ISQ register
|
||||||
|
; - No need to distinguish as ISQ access doesn't hurt
|
||||||
|
:
|
||||||
|
fixup01:lda isq+1
|
||||||
|
ora #$01 ; Set clockport bit
|
||||||
|
fixup02:sta isq+1
|
||||||
|
|
||||||
; Turn on transmission and reception of frames
|
; Turn on transmission and reception of frames
|
||||||
; PACKETPP = $0112, PPDATA = $00C0
|
; PACKETPP = $0112, PPDATA = $00C0
|
||||||
: lda #$12
|
lda #$12
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup01:sta packetpp
|
fixup03:sta packetpp
|
||||||
fixup02:stx packetpp+1
|
fixup04:stx packetpp+1
|
||||||
lda #$C0
|
lda #$C0
|
||||||
ldx #$00
|
ldx #$00
|
||||||
fixup03:sta ppdata
|
fixup05:sta ppdata
|
||||||
fixup04:stx ppdata+1
|
fixup06:stx ppdata+1
|
||||||
|
|
||||||
; Accept valid unicast + broadcast frames
|
; Accept valid unicast + broadcast frames
|
||||||
; PACKETPP = $0104, PPDATA = $0D05
|
; PACKETPP = $0104, PPDATA = $0D05
|
||||||
lda #$04
|
lda #$04
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup05:sta packetpp
|
fixup07:sta packetpp
|
||||||
fixup06:stx packetpp+1
|
fixup08:stx packetpp+1
|
||||||
lda #$05
|
lda #$05
|
||||||
ldx #$0D
|
ldx #$0D
|
||||||
fixup07:sta ppdata
|
fixup09:sta ppdata
|
||||||
fixup08:stx ppdata+1
|
fixup10:stx ppdata+1
|
||||||
|
|
||||||
; Set MAC address
|
; Set MAC address
|
||||||
; PACKETPP = $0158, PPDATA = MAC[0], MAC[1]
|
; PACKETPP = $0158, PPDATA = MAC[0], MAC[1]
|
||||||
lda #$58
|
lda #$58
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup09:sta packetpp
|
fixup11:sta packetpp
|
||||||
fixup10:stx packetpp+1
|
fixup12:stx packetpp+1
|
||||||
lda mac
|
lda mac
|
||||||
ldx mac+1
|
ldx mac+1
|
||||||
fixup11:sta ppdata
|
fixup13:sta ppdata
|
||||||
fixup12:stx ppdata+1
|
fixup14:stx ppdata+1
|
||||||
; PACKETPP = $015A, PPDATA = MAC[2], MAC[3]
|
; PACKETPP = $015A, PPDATA = MAC[2], MAC[3]
|
||||||
lda #$5A
|
lda #$5A
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup13:sta packetpp
|
fixup15:sta packetpp
|
||||||
fixup14:stx packetpp+1
|
fixup16:stx packetpp+1
|
||||||
lda mac+2
|
lda mac+2
|
||||||
ldx mac+3
|
ldx mac+3
|
||||||
fixup15:sta ppdata
|
fixup17:sta ppdata
|
||||||
fixup16:stx ppdata+1
|
fixup18:stx ppdata+1
|
||||||
; PACKETPP = 0x015C, PPDATA = MAC[4], MAC[5]
|
; PACKETPP = 0x015C, PPDATA = MAC[4], MAC[5]
|
||||||
lda #$5C
|
lda #$5C
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup17:sta packetpp
|
fixup19:sta packetpp
|
||||||
fixup18:stx packetpp+1
|
fixup20:stx packetpp+1
|
||||||
lda mac+4
|
lda mac+4
|
||||||
ldx mac+5
|
ldx mac+5
|
||||||
fixup19:sta ppdata
|
fixup21:sta ppdata
|
||||||
fixup20:stx ppdata+1
|
fixup22:stx ppdata+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
@ -198,9 +208,9 @@ poll:
|
||||||
; PACKETPP = $0124, PPDATA & $0D00 ?
|
; PACKETPP = $0124, PPDATA & $0D00 ?
|
||||||
lda #$24
|
lda #$24
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup21:sta packetpp
|
fixup23:sta packetpp
|
||||||
fixup22:stx packetpp+1
|
fixup24:stx packetpp+1
|
||||||
fixup23:lda ppdata+1
|
fixup25:lda ppdata+1
|
||||||
and #$0D
|
and #$0D
|
||||||
bne :+
|
bne :+
|
||||||
|
|
||||||
|
@ -214,13 +224,13 @@ fixup23:lda ppdata+1
|
||||||
; Read receiver event and discard it
|
; Read receiver event and discard it
|
||||||
; RXTXREG
|
; RXTXREG
|
||||||
:
|
:
|
||||||
fixup24:ldx rxtxreg+1
|
fixup26:ldx rxtxreg+1
|
||||||
fixup25:lda rxtxreg
|
fixup27:lda rxtxreg
|
||||||
|
|
||||||
; Read frame length
|
; Read frame length
|
||||||
; cnt = len = RXTXREG
|
; cnt = len = RXTXREG
|
||||||
fixup26:ldx rxtxreg+1
|
fixup28:ldx rxtxreg+1
|
||||||
fixup27:lda rxtxreg
|
fixup29:lda rxtxreg
|
||||||
sta len
|
sta len
|
||||||
stx len+1
|
stx len+1
|
||||||
sta cnt
|
sta cnt
|
||||||
|
@ -245,11 +255,11 @@ fixup27:lda rxtxreg
|
||||||
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
||||||
lda #$02
|
lda #$02
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup28:sta packetpp
|
fixup30:sta packetpp
|
||||||
fixup29:stx packetpp+1
|
fixup31:stx packetpp+1
|
||||||
fixup30:lda ppdata
|
fixup32:lda ppdata
|
||||||
ora #$40
|
ora #$40
|
||||||
fixup31:sta ppdata
|
fixup33:sta ppdata
|
||||||
|
|
||||||
; No frame ready
|
; No frame ready
|
||||||
lda #$00
|
lda #$00
|
||||||
|
@ -264,10 +274,10 @@ fixup31:sta ppdata
|
||||||
ldx cnt+1
|
ldx cnt+1
|
||||||
ldy #$00
|
ldy #$00
|
||||||
read:
|
read:
|
||||||
fixup32:lda rxtxreg
|
fixup34:lda rxtxreg
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
iny
|
iny
|
||||||
fixup33:lda rxtxreg+1
|
fixup35:lda rxtxreg+1
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
iny
|
iny
|
||||||
bne :+
|
bne :+
|
||||||
|
@ -276,7 +286,7 @@ fixup33:lda rxtxreg+1
|
||||||
bne read
|
bne read
|
||||||
dex
|
dex
|
||||||
bpl read
|
bpl read
|
||||||
|
|
||||||
; Return frame length
|
; Return frame length
|
||||||
lda len
|
lda len
|
||||||
ldx len+1
|
ldx len+1
|
||||||
|
@ -292,12 +302,12 @@ send:
|
||||||
; Transmit command
|
; Transmit command
|
||||||
lda #$C0
|
lda #$C0
|
||||||
ldx #$00
|
ldx #$00
|
||||||
fixup34:sta txcmd
|
fixup36:sta txcmd
|
||||||
fixup35:stx txcmd+1
|
fixup37:stx txcmd+1
|
||||||
lda cnt
|
lda cnt
|
||||||
ldx cnt+1
|
ldx cnt+1
|
||||||
fixup36:sta txlen
|
fixup38:sta txlen
|
||||||
fixup37:stx txlen+1
|
fixup39:stx txlen+1
|
||||||
|
|
||||||
; Adjust odd frame length
|
; Adjust odd frame length
|
||||||
lsr
|
lsr
|
||||||
|
@ -313,9 +323,9 @@ fixup37:stx txlen+1
|
||||||
; PACKETPP = $0138, PPDATA & $0100 ?
|
; PACKETPP = $0138, PPDATA & $0100 ?
|
||||||
: lda #$38
|
: lda #$38
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup38:sta packetpp
|
fixup40:sta packetpp
|
||||||
fixup39:stx packetpp+1
|
fixup41:stx packetpp+1
|
||||||
fixup40:lda ppdata+1
|
fixup42:lda ppdata+1
|
||||||
and #$01
|
and #$01
|
||||||
bne :+
|
bne :+
|
||||||
|
|
||||||
|
@ -323,11 +333,11 @@ fixup40:lda ppdata+1
|
||||||
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
||||||
lda #$02
|
lda #$02
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup41:sta packetpp
|
fixup43:sta packetpp
|
||||||
fixup42:stx packetpp+1
|
fixup44:stx packetpp+1
|
||||||
fixup43:lda ppdata
|
fixup45:lda ppdata
|
||||||
ora #$40
|
ora #$40
|
||||||
fixup44:sta ppdata
|
fixup46:sta ppdata
|
||||||
|
|
||||||
; And try again
|
; And try again
|
||||||
dey
|
dey
|
||||||
|
@ -345,10 +355,10 @@ fixup44:sta ppdata
|
||||||
ldx cnt+1
|
ldx cnt+1
|
||||||
ldy #$00
|
ldy #$00
|
||||||
write: lda (ptr),y
|
write: lda (ptr),y
|
||||||
fixup45:sta rxtxreg
|
fixup47:sta rxtxreg
|
||||||
iny
|
iny
|
||||||
lda (ptr),y
|
lda (ptr),y
|
||||||
fixup46:sta rxtxreg+1
|
fixup48:sta rxtxreg+1
|
||||||
iny
|
iny
|
||||||
bne :+
|
bne :+
|
||||||
inc ptr+1
|
inc ptr+1
|
||||||
|
|
Loading…
Reference in a new issue