A2osX/SYS/KERNEL.S.NET.txt
2015-03-15 23:00:40 +01:00

155 lines
2.6 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.

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
*--------------------------------------
* S.AddNetCfg
* in :
* PULLB = ProtocolID
* PULLW = PTR to NetCfg Struct
* out :
* A =
* cc,cs
*--------------------------------------
S.AddNetCfg lda NetCfgCnt
cmp #K.NETCFG.MAX
beq .9
asl
sta NetCfgIdx
tax
>PULLB NetCfgTbl,x save PROTOID
>PULLW ZPQuickPtr1
>PUSHWI K.NETCFG.SIZE
>PUSHBI 0
jsr S.GetMem
bcs .99
>STYA ZPQuickPtr2
txa
ldx NetCfgIdx
sta NetCfgTbl+1,x
ldy #K.NETCFG.SIZE
.1 dey
lda (ZPQuickPtr1),y
sta (ZPQuickPtr2),y
tya
bne .1
lda NetCfgCnt
inc NetCfgCnt
clc
rts
.9 >PULLA discard parameters
>PULLA
>PULLA
sec
.99 rts
*--------------------------------------
* S.SetNetCfg
* in :
* PULLB = ProtocolID
* PULLW = PTR to NetConfig
* out :
*--------------------------------------
S.SetNetCfg >PULLA
pha
>PULLW ZPQuickPtr1
pla
ldx NetCfgCnt
beq .9
ldy #0
.1 cmp NetCfgTbl,y
beq .2
iny
iny
dex
bne .1
.9 sec
rts
.2 lda NetCfgTbl+1,y
jsr S.GetMemPtrA
>STYA ZPQuickPtr2
ldy #K.NETCFG.SIZE
.3 dey
lda (ZPQuickPtr1),y
sta (ZPQuickPtr2),y
tya
bne .3
clc
rts
*--------------------------------------
* S.GetNetCfgA
* in :
* A = ProtocolID
* out :
* Y,A = PTR to NetConfig
*--------------------------------------
S.GetNetCfgA ldx NetCfgCnt
beq .9
ldy #0
.1 cmp NetCfgTbl,y
beq .2
iny
iny
dex
bne .1
.9 sec
rts
.2 lda NetCfgTbl+1,y
jsr S.GetMemPtrA
clc
rts
*--------------------------------------
* S.ClrNetCfgA
* in :
* A = ProtocolID
* out :
* cc,cs
*--------------------------------------
S.ClrNetCfgA ldx NetCfgCnt
beq .9
ldy #0
.1 cmp NetCfgTbl,y
beq .2
iny
iny
dex
bne .1
.9 sec
rts
.2 lda NetCfgTbl+1,y
jsr S.FreeMemA X,Y unmodified
cpy #K.NETCFG.MAX*2-2 last slot?
beq .4
.3 lda NetCfgTbl+2,y
sta NetCfgTbl,y
lda NetCfgTbl+3,y
sta NetCfgTbl+1,y
iny
iny
cpy #K.NETCFG.MAX*2-2 last slot?
bne .3
.4 lda #0
sta NetCfgTbl+1,y
sta NetCfgTbl,y
clc
rts
*--------------------------------------
NetCfgCnt .HS 00
NetCfgIdx .BS 1
NetCfgTbl .BS K.NETCFG.MAX*2
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.NET
LOAD SYS/KERNEL.S
ASM