Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-03-23 08:08:27 +01:00
parent a06c3ef2bc
commit 044e5b5c09
13 changed files with 126 additions and 206 deletions

View File

@ -15,8 +15,7 @@ NEW
ZS.START
SessionID .BS 1
ZPSessionPtr .BS 2
ZS.END
.ED
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------

View File

@ -12,8 +12,12 @@ NEW
.INB INC/NIC.8900A.I
.INB INC/ETH.I
*--------------------------------------
ZPArgPtr .EQ ZPBIN
DEVSLOT0x .EQ ZPBIN+2
.DUMMY
.OR ZPBIN
ZS.START
ZPArgPtr .BS 2
DEVSLOT0x .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -37,16 +41,18 @@ L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
L.SSCANF.MAC .DA SSCANF.MAC
L.MAC0 .DA DCB+S.DCB.NIC.MAC
L.MAC1 .DA DCB+S.DCB.NIC.MAC+1
L.MAC2 .DA DCB+S.DCB.NIC.MAC+2
L.MAC3 .DA DCB+S.DCB.NIC.MAC+3
L.MAC4 .DA DCB+S.DCB.NIC.MAC+4
L.MAC5 .DA DCB+S.DCB.NIC.MAC+5
.DA DCB+S.DCB.NIC.MAC+1
.DA DCB+S.DCB.NIC.MAC+2
.DA DCB+S.DCB.NIC.MAC+3
.DA DCB+S.DCB.NIC.MAC+4
.DA DCB+S.DCB.NIC.MAC+5
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ARGS
Dev.Detect >STYA ZPArgPtr
>LDYA L.MSG.DETECT
>SYSCALL PutS
ldx #$70
ldy #7
@ -76,6 +82,7 @@ Dev.Detect >STYA ARGS
lda #MLI.E.NODEV
sec
.99 rts
.3 stx DEVSLOTx0
sty DEVSLOT0x
lda /PP.REVISION Get Revision# of ths chip...
@ -114,9 +121,7 @@ Dev.Detect >STYA ARGS
* clc
.9 rts
*--------------------------------------
Dev.ParseArgs >LDYA ARGS
>STYA ZPArgPTR
lda (ZPArgPTR)
Dev.ParseArgs lda (ZPArgPTR)
bne .1
lda A2osX.RANDOM16
@ -129,25 +134,29 @@ Dev.ParseArgs >LDYA ARGS
clc
rts
.1 >PUSHW ZPArgPtr
.1 >LDYA ZPArgPtr
>SYSCALL puts
>PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC
ldx #10
ldx #0
.2 >PUSHW L.MAC0,x
dex
dex
bpl .2
inx
inx
cpx #12
bne .2
>PUSHBI 12 6 x byte PTRs
>SYSCALL sscanf
bcc .8
lda #E.SYN
sec
* sec
.8 rts
*--------------------------------------
CS.END
ARGS .BS 2
MSG.DETECT .AZ "UtherNet/CS8900A Driver."
MSG.DETECT.OK .AZ "UtherNet/CS8900A Installed As Device : %s\r\n"
MSG.DETECT.KO .AZ "Hardware Not Found."

View File

@ -4,13 +4,15 @@ NEW
*--------------------------------------
*--------------------------------------
FRM.Send ldx #3
.1 lda ZPFrameOutPtr,x Get Frame Ptr & Len
sta IOCTL+S.IOCTL.BUFPTR,x
dex
bpl .1
FRM.Send.IOCTL >PUSHW L.IOCTL
FRM.Send.IOCTL >PUSHB ETKCFG+S.NETCFG.DevID
>PUSHBI IOCTL.WRITE
lda ETKCFG+S.NETCFG.DevID
>PUSHW L.IOCTL
>SYSCALL2 IOCTL
rts
*--------------------------------------

View File

@ -40,10 +40,8 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG
lda #S.IOCTL.STATCODE.GETDCB
sta IOCTL+S.IOCTL.STATCODE
>PUSHW L.IOCTL
>PUSHBI IOCTL.STATUS
lda IPCFG+S.NETCFG.DevID
>SYSCALL2 IOCTL
ldx #IOCTL.STATUS
jsr CFG.SET.IOCTL
bcs .99
ldx #11 IP/MASK/GW
@ -56,10 +54,8 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG
lda #S.IOCTL.CTRLCODE.SETDCB
sta IOCTL+S.IOCTL.CTRLCODE
>PUSHW L.IOCTL
>PUSHBI IOCTL.CONTROL
lda IPCFG+S.NETCFG.DevID
>SYSCALL2 IOCTL
ldx #IOCTL.CONTROL
jsr CFG.SET.IOCTL
bcs .9
.5 lda hDNSSocket
@ -97,6 +93,13 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG
.8 clc
.9 rts
*--------------------------------------
CFG.SET.IOCTL >PUSHB IPCFG+S.NETCFG.DevID
txa
>PUSHA
>PUSHW L.IOCTL
>SYSCALL2 IOCTL
rts
*--------------------------------------
CFG.GET >LDYA L.IPCFG
clc
rts

View File

@ -332,9 +332,9 @@ FRM.Send ldx #3
dex
bpl .1
FRM.Send.IOCTL >PUSHW L.IOCTL
FRM.Send.IOCTL >PUSHB IPCFG+S.NETCFG.DevID
>PUSHBI IOCTL.WRITE
lda IPCFG+S.NETCFG.DevID
>PUSHW L.IOCTL
>SYSCALL2 IOCTL
rts
*--------------------------------------

View File

@ -5,7 +5,10 @@ NEW
HST.GetByName >PULLW ZPPtrDNS
>PULLW ZPPtrIP
ldx #3
>PUSHW ZPPtrDNS
>PUSHW L.HST.SScanF
ldx #0
.1 txa
clc
@ -16,12 +19,11 @@ HST.GetByName >PULLW ZPPtrDNS
>PUSHYA @IP[3][2][1][0]
dex
bpl .1
inx
cpx #4
bne .1
>PUSHBI 8 4 PTRs on stack
>PUSHW L.HST.SScanF
>LDYA ZPPtrDNS
>SYSCALL2 SScanF
bcc .9

View File

@ -1184,10 +1184,6 @@ SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1
* SKT.LOC.ADDR = Incoming Frame DST
*--------------------------------------
SKT.FindMatchingLocRem
.DO IPDEBUG=1
jsr FRM.Dump
.FIN
ldx #0
.1 lda SKT.TABLE,x
@ -1196,9 +1192,6 @@ SKT.FindMatchingLocRem
phx
>SYSCALL2 GetMemPtr
>STYA ZPPtrSKT
.DO IPDEBUG=1
jsr SKT.Dump
.FIN
plx
ldy #S.SOCKET.AF

View File

@ -122,9 +122,6 @@ TCP.IN.JMP.SYNRCVD
.9 rts
*--------------------------------------
TCP.IN.JMP.ESTBLSH
.DO IPDEBUG=1
jsr DEBUG.IPID
.FIN
jsr SKT.GetTCB
ldy #S.TCP.OPTIONS
@ -569,19 +566,6 @@ TCP.AddAYToSktCacheAtX
bne .8
inc SKT.Cache,x
.8 rts
*--------------------------------------
.DO IPDEBUG=1
DEBUG.IPID ldy #S.IP.IDENTIFICATION
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
>PUSHBI 2
>LDYA L.MSG.IPID
>SYSCALL PrintF
rts
.FIN
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBTCPIP.S.TCP

View File

@ -5,13 +5,6 @@ NEW
.OR $2000
*--------------------------------------
AUXPIPE .EQ 1
IPDEBUG .EQ 0
*--------------------------------------
.DO IPDEBUG=1
.TF lib/libtcpipd
.ELSE
.TF lib/libtcpip
.FIN
*--------------------------------------
.MA ADC16
clc
@ -156,11 +149,6 @@ J.SKT.send .DA SKT.send.RAW
.DA SKT.send.DGRAM
.DA SKT.send.SEQPACKET
.DA SKT.send.STREAM
.DO IPDEBUG=1
L.MSG.IPID .DA MSG.IPID
L.MSG.FRM.Dump .DA MSG.FRM.Dump
L.MSG.SKT.Dump .DA MSG.SKT.Dump
.FIN
.DA 0
*--------------------------------------
LIB.LOAD ldx RefCount
@ -258,90 +246,6 @@ GetDynPort inc DYNPORT.LAST
ldx DYNPORT.LAST+1
clc
rts
*--------------------------------------
.DO IPDEBUG=1
FRM.Dump ldy #S.TCPUDP.DSTPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.DST+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.TCPUDP.SRCPORT
lda (ZPFrameInPtr),y
>PUSHA
iny
lda (ZPFrameInPtr),y
>PUSHA
ldy #S.IP.SRC+3
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
dey
lda (ZPFrameInPtr),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.FRM.Dump
>SYSCALL2 Printf
rts
*--------------------------------------
SKT.Dump ldy #S.SOCKET.REM.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.REM.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.PORT+1
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
ldy #S.SOCKET.LOC.ADDR+3
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
dey
lda (ZPPtrSKT),y
>PUSHA
>PUSHBI 12
>LDYA L.MSG.SKT.Dump
>SYSCALL2 Printf
rts
.FIN
*--------------------------------------
.INB USR/SRC/LIB/LIBTCPIP.S.ARP
.INB USR/SRC/LIB/LIBTCPIP.S.CFG
@ -466,11 +370,6 @@ hFrameIn .BS 1
hFrameOut .BS 1
HST.SScanF .AZ "%d.%d.%d.%d"
IP.ID .BS 2
.DO IPDEBUG=1
MSG.IPID .AZ "IPID:%H\r\n"
MSG.FRM.Dump .AZ "->FRM:SRC=%d.%d.%d.%d:%D DST=%d.%d.%d.%d:%D\r\n"
MSG.SKT.Dump .AZ " ?SKT:LOC=%d.%d.%d.%d:%D REM=%d.%d.%d.%d:%D\r\n"
.FIN
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBTCPIP.S

View File

@ -103,9 +103,9 @@ CS.INIT.DEV >PUSHBI 0
lda #S.IOCTL.STATCODE.GETDCB
sta IOCTL+S.IOCTL.STATCODE
>PUSHB DevID
>PUSHW L.IOCTL
>PUSHBI IOCTL.STATUS
lda DevID
>SYSCALL IOCTL
rts
*--------------------------------------
@ -225,10 +225,10 @@ CS.INIT.CONF >LDYAI 64
* clc
rts
*--------------------------------------
CS.RUN >PUSHW L.IOCTL
CS.RUN >PUSHB DevID
>PUSHW L.IOCTL
>PUSHBI IOCTL.READ
lda DevID
>SYSCALL IOCTL
bcs .8 No Frame
@ -291,10 +291,9 @@ CS.QUIT ldx #0
.7 lda DevID
beq .8
pha
>PUSHA
>PUSHWZ
>PUSHBI IOCTL.CLOSE
pla
>SYSCALL IOCTL
.8 clc

View File

@ -48,16 +48,16 @@ K.SYSCALL .DA K.ChTyp $00 : STAT
.DA K.PrintF
.DA K.FPrintF
.DA K.SPrintF
.DA 0
.DA K.ScanF
.DA K.ScanF $50
.DA K.FScanF
.DA K.FScanF $50
.DA K.SScanF
.DA 0
.DA 0
.DA 0
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Bank 2
*--------------------------------------

View File

@ -351,26 +351,36 @@ MATH32.ACC322STR10
MATH32.Hex2ACC32
lda (ZPPtr2)
beq .9
jsr SHARED.IsHexDigit
bcs .9
jsr MATH32.A2ACC32
ldy #0
.1 iny
lda (ZPPtr2),y
beq .8
jsr SHARED.IsHexDigit
bcs .8
pha
ldx #4
.2 jsr MATH32.ACC32.T2
dex
bne .2
pla
ora ACC32
sta ACC32
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------

View File

@ -87,7 +87,7 @@ K.FPrintf ldx #2
*--------------------------------------
K.SPrintf ldx #3
*--------------------------------------
K.PrintF.1 jsr STDIO.GetFormat
K.PrintF.1 jsr STDIO.GetParams
sty STDIO.Exit.Cnt+1 Total bytes to POP
stz PrintF.Cnt
@ -170,7 +170,7 @@ K.PrintF.1 jsr STDIO.GetFormat
bra .20
.19 lda PrintFTBL2.OUT,x
.20 jsr PrintF.COut
.20 jsr PrintF.PutC
bcc .11
*--------------------------------------
.99 lda #E.BADARG
@ -223,7 +223,7 @@ PrintF.B jsr STDIO.GetStackByte
pha
lda #'0'/2
rol
jsr PrintF.COut
jsr PrintF.PutC
bcs .9
pla
dey
@ -294,7 +294,7 @@ PrintF.StrNum ldy #0
.2 lda A2osX.NumStrBuf,y
beq .8
iny
jsr PrintF.COut
jsr PrintF.PutC
bcc .2
.9 rts
@ -331,7 +331,7 @@ PrintF.SS ldy #$00 PSTR
lda (ZPPtr1),y
beq .2
jsr PrintF.COut
jsr PrintF.PutC
bcs .9
lda K.PrintF.PadL
@ -346,7 +346,7 @@ PrintF.SS ldy #$00 PSTR
.3 cpy K.PrintF.PadL
beq .8
lda K.PrintF.PadC
jsr PrintF.COut
jsr PrintF.PutC
bcs .9
iny
@ -356,27 +356,27 @@ PrintF.SS ldy #$00 PSTR
.9 rts
*--------------------------------------
PrintF.HH jsr STDIO.GetStackByte
bcs PrintF.COut.RTS
bcs PrintF.PutC.RTS
pha LO byte
jsr STDIO.GetStackByte
plx
bcs PrintF.COut.RTS
bcs PrintF.PutC.RTS
pha
txa
jsr PrintF.H.1
plx
bcs PrintF.COut.RTS
bcs PrintF.PutC.RTS
txa
bra PrintF.H.1
*--------------------------------------
PrintF.H jsr STDIO.GetStackByte
bcs PrintF.COut.RTS
bcs PrintF.PutC.RTS
PrintF.H.1 jsr MATH32.AToHexAX
jsr PrintF.COut
bcs PrintF.COut.RTS
jsr PrintF.PutC
bcs PrintF.PutC.RTS
txa
*--------------------------------------
PrintF.COut phy
PrintF.PutC phy
ldy PrintF.Cnt
sta (pIOBuf),y
ply
@ -392,7 +392,7 @@ PrintF.COut phy
.9 lda #E.BUF
sec
PrintF.COut.RTS rts
PrintF.PutC.RTS rts
*/--------------------------------------
* # ScanF (BLOCKING)
* # FScanF (BLOCKING)
@ -450,7 +450,7 @@ K.FScanF ldx #2
*--------------------------------------
K.SScanF ldx #3
*--------------------------------------
K.SScanF.1 jsr STDIO.GetFormat
K.SScanF.1 jsr STDIO.GetParams
sty STDIO.Exit.Cnt+1 Total bytes to POP
.1 jsr SHARED.GetCharPtr2 End Of format?
@ -461,20 +461,21 @@ K.SScanF.1 jsr STDIO.GetFormat
cmp #C.SPACE Space ?
beq .12
cmp (ZPPtr1) Same char in string?
bne .9
inc ZPPtr1
bne .1
inc ZPPtr1+1
bra .1
.12 inc ZPPtr1
bne .13
inc ZPPtr1+1
sta .11+1
jsr Scanf.GetC
bcs .9
.13 cmp (ZPPtr1) another one ?
.11 cmp #$ff Same char in string?
beq .1
bra .9
.12 jsr Scanf.GetC
bcs .9
cmp #C.SPACE another space ?
beq .12
bne .1
@ -570,24 +571,43 @@ K.SScanF.S ldy #$ff
K.SScanF.Fwd jmp SHARED.AddYToPtr1 Y=char count parsed
*--------------------------------------
Scanf.GetC lda PrintF.hFILE
beq .7
bra *
.7 lda (pIOBuf)
beq .9
inc pIOBuf
bne .8
inc pIOBuf+1
.8 clc
rts
.9 sec
rts
*--------------------------------------
* Y = Bytecount
* X = 3 : get format & buffer
* X = 2 : get format & hFile
* X = 1 : get format only
*--------------------------------------
STDIO.GetFormat lda (pStack) Bytecount
STDIO.GetParams lda (pStack) Bytecount
tay
sty STDIO.GetStackByte.ptr+1
iny
lda (pStack),y format LO
sta ZPPtr2
iny
lda (pStack),y format HI
sta ZPPtr2+1
iny
dex
beq .1
@ -597,20 +617,20 @@ STDIO.GetFormat lda (pStack) Bytecount
.3 stz PrintF.hFILE
iny
lda (pStack),y str LO
sta pIOBuf
iny
lda (pStack),y str HI
sta pIOBuf+1
iny
rts
.2 lda (pStack),y hFILE
.2 iny
lda (pStack),y hFILE
sta PrintF.hFILE
iny
.1 lda #K.IOBuf
sta pIOBuf
lda /K.IOBuf