Moved NET management from Kernel

This commit is contained in:
Rémy GIBERT 2016-01-16 23:03:23 +01:00
parent 4e7e01eaf3
commit 089fd82dc0
2 changed files with 4 additions and 158 deletions

View File

@ -1,153 +0,0 @@
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

View File

@ -130,10 +130,10 @@ ZPQuickPtr4 .EQ $6
.DA S.ListDirCloseA
.DA 0
*--------------------------------------
.DA S.AddNetCfg $B0
.DA S.SetNetCfg
.DA S.GetNetCfgA
.DA S.ClrNetCfgA
.DA 0 $B0
.DA 0
.DA 0
.DA 0
.DA 0
.DA 0
@ -381,7 +381,6 @@ ENV.DRV.VALUE >PSTRING "${A2OSX}DRV/"
.INB SYS/KERNEL.S.BIN
.INB SYS/KERNEL.S.DRV
.INB SYS/KERNEL.S.LIB
.INB SYS/KERNEL.S.NET
.INB SYS/KERNEL.S.ENV
.INB SYS/KERNEL.S.TSK
.INB SYS/KERNEL.S.EVT