Kernel 0.92

This commit is contained in:
Rémy GIBERT 2019-01-14 07:11:50 +00:00
parent 8fa59957fe
commit c6f0b1fa51
13 changed files with 62 additions and 513 deletions

Binary file not shown.

View File

@ -22,7 +22,7 @@ DEV.Bind >PUSHBI 0
sec
rts
.1 ldy #S.IPCFG.hFD
.1 ldy #S.IPCFG.DevID
sta (pIPCFG),y
>PUSHW L.DEVNAME

View File

@ -7,7 +7,7 @@ DHCP.INIT lda (pIPCFG)
and #S.IPCFG.STATUS.OK
bne .99 Already Configured, exit
ldy #S.IPCFG.hFD
ldy #S.IPCFG.DevID
lda (pIPCFG),y
beq .98
@ -138,7 +138,7 @@ DHCP.RUN.OK lda #S.IPCFG.STATUS.OK
sta IPCFG
>PUSHW L.IPCFG
>LIBCALL hLIBTCPIP,LIBTCPIP.SET.IPCFG
>LIBCALL hLIBTCPIP,LIBTCPIP.SETCFG
ldx #3

View File

@ -48,7 +48,7 @@ CFG.EtcFiles >LDYAI 256
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTS
>LIBCALL hLIBTCPIP,LIBTCPIP.Set.IPCFG
>LIBCALL hLIBTCPIP,LIBTCPIP.SETCFG
lda CFG.hBuf1
>SYSCALL freemem

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/DEV/IPCONFIG2
.TF BIN/IPCONFIG2
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -24,7 +24,6 @@ ZS.START
ZPPtr1 .BS 2
pIPCFG .BS 2
pFD .BS 2
pDEV .BS 2
ZPIPCfgPtr .BS 2
ZPFrameBase .BS 2
ZPFramePtr .BS 2
@ -158,10 +157,10 @@ CS.RUN.STATUS >PUSHBI 0
>LDYA L.MSG0
>SYSCALL printf
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
>LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG
>STYA pIPCFG
ldy #S.IPCFG.hFD
ldy #S.IPCFG.DevID
lda (pIPCFG),y
bne .1
@ -169,12 +168,15 @@ CS.RUN.STATUS >PUSHBI 0
>SYSCALL puts
jmp CS.RUN.DONE
.1 >STA.G FD.ETH
>SYSCALL GetMemPtr
>STYA pFD
.1 tax
lda Dev.Table,x
sta pFD
lda Dev.Table+1,x
sta pFD+1
>PUSHEA.G DIB
>LDA.G FD.ETH
ldy #S.IPCFG.DevID
lda (pIPCFG),y
>SYSCALL GetDevStatus
>LEA.G DCB.NIC
@ -184,7 +186,8 @@ CS.RUN.STATUS >PUSHBI 0
>PUSHEA.G IOCTL
>PUSHBI IOCTL.STATUS
>LDA.G FD.ETH
ldy #S.IPCFG.DevID
lda (pIPCFG),y
>SYSCALL IOCTL
CS.RUN.DUMP >LDYA L.MSG0.L
@ -201,18 +204,17 @@ CS.RUN.DUMP >LDYA L.MSG0.L
>PUSHEA.G DIB+S.DIB.IDS
>LDA.G FD.ETH
ldx #$ff
.11 inx
cmp Dev.Table.hFD,x
bne .11
lda Dev.Table.hPath,x
>SYSCALL GetMemPtr
lda pFD
clc
adc #S.FD.DEV
tay
lda pFD+1
adc /S.FD.DEV
>PUSHYA
>PUSHB.G FD.ETH
ldy #S.IPCFG.DevID
lda (pIPCFG),y
>PUSHA
>PUSHBI 11
>LDYA L.MSG1.DEV
>SYSCALL printf
@ -395,7 +397,7 @@ Wait.TimeOut ldy #TimeOut
.INB USR/SRC/SBIN/IPCONFIG.S.ETC
*--------------------------------------
CS.END
LIBTCPIP .AZ "libtcpip"
LIBTCPIP .AZ "libtcpip2"
*--------------------------------------
OptionList >PSTR "DESdes"
OptionVars .DA #bDHCP,#bETC,#bSet,#bDHCP,#bETC,#bSet
@ -524,7 +526,6 @@ ArgCount .BS 1
bDHCP .BS 1
bETC .BS 1
bSet .BS 1
FD.ETH .BS 1
IOCTL .BS S.IOCTL
DIB .BS S.DIB
DCB.NIC .BS S.DCB.NIC

View File

@ -20,10 +20,10 @@ K.DYNPORT.END .EQ 65535
K.TCP.MSS .EQ K.ETH.FRAME.LEN-20-20-14
K.TCP.WSIZE .EQ 2048
*--------------------------------------
LIBTCPIP.SET.IPCFG .EQ 4
LIBTCPIP.GET.IPCFG .EQ 6
LIBTCPIP.SETCFG .EQ 4
LIBTCPIP.GETCFG .EQ 6
LIBTCPIP.POLL .EQ 8
LIBTCPIP.INCOMING .EQ 8
LIBTCPIP.PULSE .EQ 10
LIBTCPIP.ARP.Clear .EQ 12
@ -79,7 +79,7 @@ S.IPCFG.STATUS.ROFFER .EQ %00000010 OFFER Received
S.IPCFG.STATUS.SREQ .EQ %00000100 REQUEST Sent
S.IPCFG.STATUS.RACK .EQ %00001000 ACK Received
S.IPCFG.STATUS.OK .EQ %10000000 Fully configured (static or DHCP)
S.IPCFG.hFD .EQ 1
S.IPCFG.DevID .EQ 1
S.IPCFG.MAC .EQ 2
S.IPCFG.DHCPSRVR .EQ 8
S.IPCFG.IP .EQ 12

View File

@ -50,15 +50,15 @@ CS.START cld
*--------------------------------------
.DA 0
*--------------------------------------
LIB.LOAD clc
rts
LIB.LOAD
*--------------------------------------
LIB.UNLOAD clc
rts
LIB.UNLOAD
*--------------------------------------
SETCFG
*--------------------------------------
GETCFG
clc
rts
*--------------------------------------
INCOMING sta hFrameIn
>PULLW ZPIOCTL

View File

@ -172,7 +172,7 @@ ARP.IN.REQ ldy #S.ARP.SPA+3
>PUSHWI S.ARP
>PUSHW L.ARP.REP
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL write
bra ARP.IN.EXIT
@ -238,7 +238,7 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
>PUSHWI S.ARP
>PUSHW L.ARP.REQ
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL write
bcs .99

View File

@ -3,434 +3,7 @@ PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
* PULLW = PTR to S.IPCFG
*--------------------------------------
CFG.Init >PUSHBI 0
>LDYA L.DEVNAME
>SYSCALL open
bcc .1
inc DEVNAME+8
lda DEVNAME+8
cmp #'8'
bne CFG.Init
>LDYA L.MSG.DEV.KO
>SYSCALL puts
lda #MLI.E.NODEV
.9 sec
rts
.1 sta IPCFG+S.IPCFG.hFD
>PUSHW L.DEVNAME
>PUSHBI 2
>LDYA L.MSG.DEV.OK
>SYSCALL printf
CFG.EtcFiles >LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPTmpPtr1
stx CFG.hBuf1
>LDYA L.HOSTNAME
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTNAME
lda IPCFG+S.IPCFG.HOSTNAME
bne .4
ldy #$ff
.2 iny
lda CFG.DefaultHost,y
sta IPCFG+S.IPCFG.HOSTNAME,y
bne .2
.3 lda A2osX.TIMER16
jsr CFG.A2CharAX
sta IPCFG+S.IPCFG.HOSTNAME+6
stx IPCFG+S.IPCFG.HOSTNAME+7
lda A2osX.TIMER16+1
jsr CFG.A2CharAX
sta IPCFG+S.IPCFG.HOSTNAME+8
stx IPCFG+S.IPCFG.HOSTNAME+9
.4 >LDYA L.TCPIP.CONF
jsr CFG.Read.PrintF
jsr CFG.Read.TCPIP.CONF
lda IPCFG+S.IPCFG.IP
beq .5
lda #S.IPCFG.STATUS.OK
sta IPCFG+S.IPCFG.STATUS
.5 >LDYA L.HOSTS
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTS
jsr SET.IPCFG.I
lda CFG.hBuf1
>SYSCALL freemem
.9 rts
*--------------------------------------
CFG.Read.PrintF >PUSHYA
>PUSHBI 2
>LDYA L.MSG.CFG
>SYSCALL printf
rts
*--------------------------------------
CFG.Read.HOSTNAME
>LDYA L.HOSTNAME
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
.1 jsr CFG.Read.GetS
bcs .8
lda (ZPTmpPtr1)
beq .1 empty line...
cmp #'#
beq .1 comment...
ldy #0
.2 lda (ZPTmpPtr1),y
sta IPCFG+S.IPCFG.HOSTNAME,y
beq .8 end of name
iny
cpy #15
bne .2
.8 clc
.HS B0 BCS
.9 sec
jmp CFG.Read.Close
*--------------------------------------
CFG.Read.TCPIP.CONF
>LDYA L.TCPIP.CONF
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
.1 jsr CFG.Read.GetS
bcs .8
lda (ZPTmpPtr1)
beq .1 empty line...
cmp #'#
beq .1 comment...
ldy #$ff
.2 iny
lda (ZPTmpPtr1),y
beq .3
cmp #' '
bne .2
.3 lda L.CFG.Keywords
sta ZPTmpPtr2
lda L.CFG.Keywords+1
sta ZPTmpPtr2+1
ldx #0
.4 phy save keyword len
tya
cmp (ZPTmpPtr2)
bne .6
.5 lda (ZPTmpPtr2),y
dey
cmp (ZPTmpPtr1),y
bne .6
tya
bne .5
ply discard keyword len
jsr .80
bra .1
.6 lda (ZPTmpPtr2)
sec
adc ZPTmpPtr2
sta ZPTmpPtr2
bcc .7
inc ZPTmpPtr2+1
.7 inx
inx
ply reset keyword len
lda (ZPTmpPtr2)
bne .4
bra .1
.8 clc
.HS B0 BCS
.9 sec
jmp CFG.Read.Close
.80 jmp (J.CFG.Keywords,x)
*--------------------------------------
CFG.Read.address
ldx #S.IPCFG.IP+3
bra CFG.Read.IP
CFG.Read.netmask
ldx #S.IPCFG.MASK+3
bra CFG.Read.IP
CFG.Read.gateway
ldx #S.IPCFG.GW+3
bra CFG.Read.IP
CFG.Read.nameserver
ldx #S.IPCFG.DNS1+3
lda IPCFG,x
beq CFG.Read.IP
ldx #S.IPCFG.DNS2+3
CFG.Read.IP ldy #3
.1 txa
clc
adc L.IPCFG
pha
lda L.IPCFG+1
adc #0
>PUSHA @IP[3][2][1][0]
pla
>PUSHA
dex
dey
bpl .1
>PUSHBI 8 4 PTRs on stack
>PUSHW L.HST.SScanF
lda (ZPTmpPtr2)
sec
adc ZPTmpPtr1
tay
lda ZPTmpPtr1+1
adc #0
>SYSCALL SScanF
rts
CFG.Read.dnsdomain
lda (ZPTmpPtr2)
sec
adc ZPTmpPtr1
sta ZPTmpPtr1
bcc .1
inc ZPTmpPtr1+1
.1 ldy #$ff
.2 iny
lda (ZPTmpPtr1),y
sta IPCFG+S.IPCFG.DOMAIN,y
beq .8
cpy #K.DNS.MAXLEN
bne .2
lda #0
sta IPCFG+S.IPCFG.DOMAIN,y
.8 rts
*--------------------------------------
CFG.Read.HOSTS stz CFG.hBuf2
stz CFG.hBuf3
>LDYA L.HOSTS
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPTmpPtr2
stx CFG.hBuf2
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPTmpPtr3
stx CFG.hBuf3
.1 jsr CFG.Read.GetS
bcs .8
lda (ZPTmpPtr1)
beq .1 empty line...
cmp #'#
beq .1 comment...
jsr CFG.Read.HOSTS.Scan
bcs .1
cmp #5
bcc .1 less than 5 parameters, ignore
beq .2 no alias
>LDYA ZPTmpPtr3
jsr CFG.DNS.Add
.2 >LDYA ZPTmpPtr2
jsr CFG.DNS.Add
bra .1
.8 clc
.HS B0 BCS
.9 sec
php
pha
lda CFG.hBuf3
beq .90
>SYSCALL freemem
.90 lda CFG.hBuf2
beq .91
>SYSCALL freemem
.91 jmp CFG.Read.Close2
*--------------------------------------
CFG.Read.HOSTS.Scan
>PUSHW ZPTmpPtr3
>PUSHW ZPTmpPtr2
ldx #3
.2 txa
clc
adc L.CFG.IP
tay
lda L.CFG.IP+1
adc #0
>PUSHYA @IP[3][2][1][0]
dex
bpl .2
>PUSHBI 12 6 PTRs on stack
>PUSHW L.CFG.HOSTS.SScanF
>LDYA ZPTmpPtr1
>SYSCALL SScanF
rts
*--------------------------------------
CFG.DNS.ADD >STYA ZPTmpPtr1
>PUSHW ZPTmpPtr1
ldy #3
.1 lda CFG.IP,y
>PUSHA
dey
bpl .1
>PUSHBI 6
>LDYA L.MSG.DNS.ADD
>SYSCALL printf
>LDYA L.CFG.IP
>PUSHYA
>PUSHW ZPTmpPtr1
jsr DNS.Add
*--------------------------------------
CFG.Read.Result bcc .1
>PUSHA
>PUSHBI 1
>LDYA L.MSG.CFG.KO
>SYSCALL printf
sec
rts
.1 >LDYA L.MSG.CFG.OK
>SYSCALL puts
rts
*--------------------------------------
CFG.Read.Open stz CFG.hCfgFile
stz CFG.hCfgPath
>SYSCALL ExpandStr
bcs .9
stx CFG.hCfgPath
pha
>PUSHWI 0
>PUSHBI S.FI.T.TXT
>PUSHBI O.RDONLY
pla
>SYSCALL fopen
bcs .9
sta CFG.hCfgFile
* clc
.9 rts
*--------------------------------------
CFG.Read.Close php
pha
CFG.Read.Close2
lda CFG.hCfgPath
beq .1
>SYSCALL FreeMem
.1 lda CFG.hCfgFile
beq .8
>SYSCALL fclose
.8 pla
plp
rts
*--------------------------------------
CFG.Read.GetS >PUSHWI 255
>PUSHW ZPTmpPtr1
lda CFG.hCfgFile
>SYSCALL fgets
* bcs .9
* >LDYA ZPTmpPtr1
* >SYSCALL puts
.9 rts
*--------------------------------------
CFG.A2CharAX pha
lsr
lsr
lsr
lsr
ora #$30
cmp #'9'+1
bcc .1
adc #6
.1 tax
pla
and #$0F
ora #$30
cmp #'9'+1
bcc .8
adc #6
.8 rts
*--------------------------------------
SET.IPCFG >PULLW ZPTmpPtr1 IPCFG
CFG.SET >PULLW ZPTmpPtr1 IPCFG
ldy #0
@ -440,14 +13,14 @@ SET.IPCFG >PULLW ZPTmpPtr1 IPCFG
cpy #S.IPCFG
bne .1
SET.IPCFG.I >LDYA L.DCB.NIC
CFG.SET.I >LDYA L.DCB.NIC
>STYA IOCTL+S.IOCTL.BUFPTR
lda #S.IOCTL.STATCODE.GETDCB
sta IOCTL+S.IOCTL.STATCODE
>PUSHW L.IOCTL
>PUSHBI IOCTL.STATUS
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL IOCTL
bcs *
@ -487,7 +60,7 @@ SET.IPCFG.I >LDYA L.DCB.NIC
>PUSHW L.IOCTL
>PUSHBI IOCTL.CONTROL
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL IOCTL
bcs .9
@ -516,11 +89,7 @@ SET.IPCFG.I >LDYA L.DCB.NIC
.8 clc
.9 rts
*--------------------------------------
* grab a copy on the fly for lib function
* OUT :
* Y,A = PTR to S.IPCFG
*--------------------------------------
GET.IPCFG >LDYA L.IPCFG
CFG.GET >LDYA L.IPCFG
clc
rts
*--------------------------------------

View File

@ -336,7 +336,7 @@ FRM.Retry ldx FRM.QUEUE.Tail
*--------------------------------------
FRM.Send >PUSHW ZPFrameOutLen
>PUSHW ZPFrameOutPtr
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL write
rts

View File

@ -4,7 +4,7 @@ AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF LIB/LIBTCPIP
.TF LIB/LIBTCPIP2
*--------------------------------------
IPDEBUG .EQ 0
*--------------------------------------
@ -75,10 +75,10 @@ CS.START cld
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
.DA SET.IPCFG
.DA GET.IPCFG
.DA CFG.SET
.DA CFG.GET
.DA POLL
.DA INCOMING
.DA PULSE
.DA ARP.CLEAR
@ -116,14 +116,6 @@ CS.START cld
.DA SKT.GetTable
*--------------------------------------
L.IPCFG .DA IPCFG
L.CFG.IP .DA CFG.IP
L.CFG.HOSTS.SScanF .DA CFG.HOSTS.SScanF
L.CFG.Keywords .DA CFG.Keywords
J.CFG.Keywords .DA CFG.Read.address
.DA CFG.Read.netmask
.DA CFG.Read.gateway
.DA CFG.Read.nameserver
.DA CFG.Read.dnsdomain
L.ARP.REQ .DA ARP.REQ
L.ARP.REP .DA ARP.REP
L.SA.LOCAL .DA SA.LOCAL
@ -170,16 +162,13 @@ L.MSG.SKT.Dump .DA MSG.SKT.Dump
*--------------------------------------
LIB.LOAD ldx RefCount
bne .8
sta FD.DSOCK+S.FD.DSOCK.IOHANDLER
sta FD.SSOCK+S.FD.SSOCK.IOHANDLER
jsr ARP.CLEAR
jsr DNS.CLEAR
jsr CFG.Init
bcs .9
.8 inc RefCount
clc
@ -188,28 +177,18 @@ LIB.LOAD ldx RefCount
LIB.UNLOAD dec RefCount
bne LIB.UNLOAD.8
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
beq LIB.UNLOAD.8
>PUSHWI 0
>PUSHBI IOCTL.CLOSE
lda IPCFG+S.IPCFG.hFD
lda IPCFG+S.IPCFG.DevID
>SYSCALL IOCTL
LIB.UNLOAD.8 clc
rts
*--------------------------------------
POLL lda IPCFG+S.IPCFG.hFD
beq .99
pha
>PUSHW L.IOCTL
>PUSHBI IOCTL.READ
pla
>SYSCALL IOCTL
bcs .99 No Frame
sta hFrameIn
INCOMING sta hFrameIn
ldx #3
.10 lda IOCTL+S.IOCTL.BUFPTR,x Get Frame Ptr & Len

View File

@ -77,10 +77,10 @@ CS.RUN >PUSHBI 0
>LDYA L.MSG.DEV.OK
>SYSCALL printf
* >LDYA L.LIBTCPIP
* >SYSCALL LoadLib
* bcs .2
* sta hLIBTCPIP
>LDYA L.LIBTCPIP
>SYSCALL LoadLib
bcs .2
sta hLIBTCPIP
.2 >LDYA L.LIBETALK
>SYSCALL LoadLib
@ -101,11 +101,11 @@ CS.RUN.LOOP >SLEEP
ldx hLIBTCPIP
beq .1
* >PUSHW L.IOCTL
* lda hFrameIn
>PUSHW L.IOCTL
lda hFrameIn
* >LIBCALL hLIBTCPIP,LIBTCPIP.INCOMING
* bcc CS.RUN.LOOP
>LIBCALL hLIBTCPIP,LIBTCPIP.INCOMING
bcc CS.RUN.LOOP
.1 ldx hLIBETALK
beq .9
@ -125,7 +125,7 @@ CS.DOEVENT lda (pEvent)
ldx hLIBTCPIP
beq .1
* >LIBCALL hLIBTCPIP,LIBTCPIP.PULSE
>LIBCALL hLIBTCPIP,LIBTCPIP.PULSE
.1 ldx hLIBETALK
beq .9
@ -158,7 +158,7 @@ CS.END
DEVNAME .AZ "/DEV/ETH1"
MSG.DEV.KO .AZ "No Device Found, exiting."
MSG.DEV.OK .AZ "Bound To Device : %s\r\n"
LIBTCPIP .AZ "libtcpip"
LIBTCPIP .AZ "libtcpip2"
LIBETALK .AZ "libetalk"
hFD .BS 1
hLIBTCPIP .BS 1