mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-01 14:50:10 +00:00
154 lines
2.6 KiB
Plaintext
154 lines
2.6 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* 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
|