A2osX/LIB/LIBETALK.S.FRM.txt
2023-10-18 07:41:12 +02:00

160 lines
2.7 KiB
Plaintext
Raw Permalink 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
*--------------------------------------
FRM.NewDDP >STYA ZPDataOutLen
lda ZPDataOutLen
clc
adc #S.DDP2
sta ZPFrameOutLen
tay
lda ZPDataOutLen+1
adc /S.DDP2
sta ZPFrameOutLen+1
bne .10
cpy #60
bcs .10
ldy #60
.10 >SYSCALL2 GetMem
bcs .9
>STYA ZPFrameOutPtr
stx hFrameOut
lda ZPFrameOutLen
sec
sbc #S.ETH.802.2.LLC
ldy #S.ETH.802.3.LENGTH+1
sta (ZPFrameOutPtr),y
lda ZPFrameOutLen+1
sbc /S.ETH.802.2.LLC
dey
sta (ZPFrameOutPtr),y
ldx #DDP.LLC.L-1
ldy #S.ETH.802.2.LLC+DDP.LLC.L-1
.1 lda DDP.LLC,x
sta (ZPFrameOutPtr),y
dey
dex
bpl .1
lda ZPFrameOutLen
sec
sbc #S.ETH.SNAP
ldy #S.DDP2.DATALEN+1
sta (ZPFrameOutPtr),y
lda ZPFrameOutLen+1
sbc /S.ETH.SNAP
dey
sta (ZPFrameOutPtr),y
ldy #S.DDP2.CHECKSUM
lda #0
sta (ZPFrameOutPtr),y
iny
sta (ZPFrameOutPtr),y
lda hFrameOut
clc
.9 rts
*--------------------------------------
FRM.SendDDP ldy #S.DDP2.SRC.NET
lda ETKCFG+S.ETKCFG.NetID+1
sta (ZPFrameOutPtr),y
iny
lda ETKCFG+S.ETKCFG.NetID
sta (ZPFrameOutPtr),y
ldy #S.DDP2.SRC.NOD
lda ETKCFG+S.ETKCFG.NodID
sta (ZPFrameOutPtr),y
ldy #S.DDP2.DST.NOD
lda (ZPFrameOutPtr),y
beq .10 DST.NOD = 0 : any router
cmp #$FF Broadcast
bne FRM.SendAARP
.10 ldy #S.DDP2.DST.NET
lda (ZPFrameOutPtr),y
iny
ora (ZPFrameOutPtr),y
bne .2
ldy #5
.1 lda MAC.BROADCAST,y
sta (ZPFrameOutPtr),y
dey
bpl .1
bra FRM.Send
.2 ldy #5
.3 lda ETKCFG+S.ETKCFG.MCAddress+1,y
sta (ZPFrameOutPtr),y
dey
bpl .3
bra FRM.Send
FRM.SendAARP >DEBUG
*--------------------------------------
FRM.Send ldx #3
.1 lda ZPFrameOutPtr,x Get Frame Ptr & Len
sta IOCTL+S.IOCTL.BUFPTR,x
dex
bpl .1
lda IOCTL+S.IOCTL.BYTECNT+1
bne FRM.Send.IOCTL
lda #60
cmp IOCTL+S.IOCTL.BYTECNT
bcc FRM.Send.IOCTL
sta IOCTL+S.IOCTL.BYTECNT
FRM.Send.IOCTL >PUSHB ETKCFG+S.NETCFG.DevID
>PUSHBI IOCTL.WRITE
>PUSHW L.IOCTL
>SYSCALL2 IOCTL
rts
*--------------------------------------
FRM.DiscardIn lda hFrameIn
beq .8
stz hFrameIn
>SYSCALL2 FreeMem
.8 clc
rts
*--------------------------------------
FRM.DiscardOut lda hFrameOut
beq .8
stz hFrameOut
>SYSCALL2 FreeMem
.8 sec
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.frm
LOAD usr/src/lib/libetalk.s
ASM