A2osX/SYS/PM.VEDRIVE.S.U1.txt
2022-04-19 20:24:34 +02:00

390 lines
6.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
U1.Init lda CONF.SLOT
asl
asl
asl
asl
sta Slotn0
tax
lda /PP.ID
sta PacketPagePTR+1,x
lda #PP.ID
sta PacketPagePTR,x
lda PacketPageDATA+1,x
cmp /CS8900A.DEVID
bne .9
lda PacketPageDATA,x
cmp #CS8900A.DEVID
beq .1
.9 sec
rts
.1 lda CONF.SLOT
pha
lda /PP.REVISION Get Revision# of ths chip...
sta PacketPagePTR+1,x
lda #PP.REVISION
sta PacketPagePTR,x
lda PacketPageDATA+1,x
pha
lda PacketPageDATA,x
pha
lda #U1.Name
pha
lda /U1.Name
pha
>LDYAI VEDRIVE.NICOK
jsr PrintFYA
ldx Slotn0
lda /PP.RxCTL
sta PacketPagePTR+1,x
lda #PP.RxCTL
sta PacketPagePTR,x
lda /PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
sta PacketPageDATA+1,x
lda #PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
sta PacketPageDATA,x
lda /PP.MAC
sta PacketPagePTR+1,x
lda #PP.MAC
sta PacketPagePTR,x
lda CONF.SRCMAC+1
sta PacketPageDATA+1,x
lda CONF.SRCMAC+0
sta PacketPageDATA,x
lda /PP.MAC+2
sta PacketPagePTR+1,x
lda #PP.MAC+2
sta PacketPagePTR,x
lda CONF.SRCMAC+3
sta PacketPageDATA+1,x
lda CONF.SRCMAC+2
sta PacketPageDATA,x
lda /PP.MAC+4
sta PacketPagePTR+1,x
lda #PP.MAC+4
sta PacketPagePTR,x
lda CONF.SRCMAC+5
sta PacketPageDATA+1,x
lda CONF.SRCMAC+4
sta PacketPageDATA,x
lda /PP.LineCTL
sta PacketPagePTR+1,x
lda #PP.LineCTL
sta PacketPagePTR,x
lda /PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.10BaseT
sta PacketPageDATA+1,x
lda #PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.10BaseT
sta PacketPageDATA,x
clc
rts
*--------------------------------------
U1.READ php
sei
ldx Slotn0
lda /PP.RxEvent
sta PacketPagePTR+1,x
lda #PP.RxEvent
sta PacketPagePTR,x
lda PacketPageDATA+1,x
ldy PacketPageDATA,x
and /PP.RxEvent.RxOK+PP.RxEvent.IA+PP.RxEvent.Brdcast+PP.RxEvent.Runt
beq U1.READWRITE.9
lda RTDATA+1,x discard RxStatus
lda RTDATA,x
lda RTDATA+1,x get RxLength
sta ZPBufCnt+1
eor #$ff
sta ZPnCnt+1
lda RTDATA,x
sta ZPBufCnt
eor #$ff
sta ZPnCnt
ldx Slotn0
lda ZPBufPtr+1
pha
ldy #0
.2 inc ZPnCnt
bne .3
inc ZPnCnt+1
beq .8
.3 lda RTDATA,x
sta (ZPBufPtr),y
iny
inc ZPnCnt
bne .4
inc ZPnCnt+1
beq .8
.4 lda RTDATA+1,x
sta (ZPBufPtr),y
iny
bne .2
inc ZPBufPtr+1
bra .2
.8 pla
sta ZPBufPtr+1
plp
clc
rts
*--------------------------------------
U1.READWRITE.9 plp
sec
rts
*--------------------------------------
U1.WRITE php
sei
ldx Slotn0
lda /PP.TxCMD.LID+PP.TxCMD.TxStartFULL
sta TxCMD+1,x
lda #PP.TxCMD.LID+PP.TxCMD.TxStartFULL
sta TxCMD,x
lda ZPBufCnt+1
sta TxLength+1,x
eor #$ff
sta ZPnCnt+1
lda ZPBufCnt
sta TxLength,x
eor #$ff
sta ZPnCnt
lda /PP.BusST
sta PacketPagePTR+1,x
lda #PP.BusST
sta PacketPagePTR,x
lda PacketPageDATA+1,x
ldy PacketPageDATA,x
bit /PP.BusST.Rdy4TxNOW
beq U1.READWRITE.9
ldx Slotn0
ldy #0
.1 inc ZPnCnt
bne .2
inc ZPnCnt+1
beq .8
.2 lda (ZPBufPtr),y
sta RTDATA,x
iny
inc ZPnCnt
bne .3
inc ZPnCnt+1
beq .8
.3 lda (ZPBufPtr),y
sta RTDATA+1,x
iny
bne .1
inc ZPBufPtr+1
bne .1
.8 plp
clc
rts
*--------------------------------------
U1.Name >PSTR "Uthernet V1"
*--------------------------------------
DRV.U1 .PH DRV.NIC.START
jmp DRV.U1.SendARP
jmp DRV.U1.SendUDP
DRV.U1.Rcvd php
sei
ldx DRV.BLK.Slotn0
lda /PP.RxEvent
sta PacketPagePTR+1,x
lda #PP.RxEvent
sta PacketPagePTR,x
lda PacketPageDATA+1,x
ldy PacketPageDATA,x
and /PP.RxEvent.RxOK+PP.RxEvent.IA+PP.RxEvent.Brdcast+PP.RxEvent.Runt
beq DRV.U1.9
lda RTDATA+1,x discard RxStatus
lda RTDATA,x
lda RTDATA+1,x get RxLength
sta DRV.FrameSize+1
eor #$ff
sta DRV.nCnt+1
lda RTDATA,x
sta DRV.FrameSize
eor #$ff
sta DRV.nCnt
>LDYAI DRV.InBuf
>STYA DRV.A1L
ldy #0
.2 inc DRV.nCnt
bne .3
inc DRV.nCnt+1
beq .8
.3 lda RTDATA,x
sta (DRV.A1L),y
iny
inc DRV.nCnt
bne .4
inc DRV.nCnt+1
beq .8
.4 lda RTDATA+1,x
sta (DRV.A1L),y
iny
bne .2
inc DRV.A1L+1
bra .2
.8 plp
clc
rts
*--------------------------------------
DRV.U1.9 plp
sec
rts
*--------------------------------------
DRV.U1.SendARP >LDYAI S.ARP
>STYA DRV.FrameSize
>LDYAI DRV.ARPBuf
bra DRV.U1.Send
*--------------------------------------
DRV.U1.SendUDP >STYA DRV.FrameSize
jsr DRV.BLK.IPUDPCheksum
>LDYAI DRV.UDPBuf
DRV.U1.Send >STYA DRV.A1L
php
sei
ldx DRV.BLK.Slotn0
lda /PP.TxCMD.LID+PP.TxCMD.TxStartFULL
sta TxCMD+1,x
lda #PP.TxCMD.LID+PP.TxCMD.TxStartFULL
sta TxCMD,x
lda DRV.FrameSize+1
sta TxLength+1,x
eor #$ff
sta DRV.nCnt+1
lda DRV.FrameSize
sta TxLength,x
eor #$ff
sta DRV.nCnt
lda /PP.BusST
sta PacketPagePTR+1,x
lda #PP.BusST
sta PacketPagePTR,x
lda PacketPageDATA+1,x
ldy PacketPageDATA,x
bit /PP.BusST.Rdy4TxNOW
beq DRV.U1.9
ldy #0
.1 inc DRV.nCnt
bne .2
inc DRV.nCnt+1
beq .8
.2 lda (DRV.A1L),y
sta RTDATA,x
iny
inc DRV.nCnt
bne .3
inc DRV.nCnt+1
beq .8
.3 lda (DRV.A1L),y
sta RTDATA+1,x
iny
bne .1
inc DRV.A1H
bra .1
.8 plp
clc
rts
*--------------------------------------
.EP
.LIST ON
DRV.U1.SIZE .EQ *-DRV.U1
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/sys/pm.vedrive.s.u1
LOAD usr/src/sys/pm.vedrive.s
ASM