Kernel 0.9.1 : TCPIP, code Cleaning and 0.9.1 compliance

This commit is contained in:
Rémy GIBERT 2018-05-24 17:21:38 +02:00
parent 17746d588c
commit b9ac24c39e
16 changed files with 105 additions and 165 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -52,7 +52,7 @@ CS.RUN ldy #S.PS.ARGC
lda (pPs),y lda (pPs),y
bne CS.RUN.ADD bne CS.RUN.ADD
jmp CS.RUN.DUMP jmp CS.RUN.DUMP
*--------------------------------------
CS.RUN.ADD cmp #2 CS.RUN.ADD cmp #2
beq .1 beq .1
jmp .9 jmp .9
@ -82,7 +82,7 @@ CS.RUN.ADD cmp #2
.9 lda #K.E.SYN .9 lda #K.E.SYN
sec sec
.99 rts .99 rts
*--------------------------------------
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GetCache CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GetCache
>STYA ZPPTR1 >STYA ZPPTR1
>LDYA L.MSG0 >LDYA L.MSG0

View File

@ -24,7 +24,8 @@ CS.START cld
.DA 0 .DA 0
.DA CS.END-CS.START Code Length To Relocate .DA CS.END-CS.START Code Length To Relocate
.DA DS.END-DS.START Data Segment to Allocate .DA DS.END-DS.START Data Segment to Allocate
.DA 0 .DA #16 SS
.DA #4 ZP
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
.1 .DA CS.INIT .1 .DA CS.INIT

View File

@ -27,7 +27,7 @@ A2osX.ATKCALL .EQ $BD06
A2osX.ROMCALL .EQ $BD09 A2osX.ROMCALL .EQ $BD09
A2osX.BADCALL .EQ $BD0C A2osX.BADCALL .EQ $BD0C
*-------------------------------------- *--------------------------------------
A2osx.SLEEP .EQ $BD10 A2osX.SLEEP .EQ $BD10
*-------------------------------------- *--------------------------------------
* $BEE0->$BEEF : Public Variables * $BEE0->$BEEF : Public Variables
*-------------------------------------- *--------------------------------------

View File

@ -166,8 +166,7 @@ ARP.IN.REQ ldy #S.ARP.SPA+3
bpl .2 bpl .2
>LDYA L.ARP.REP >LDYA L.ARP.REP
ldx #DEVMGR.WRITEBLOCK jsr FRM.Send.YA
jsr NetDevJmp
bra ARP.IN.EXIT bra ARP.IN.EXIT
ARP.IN.REP lda #K.ARP.TTL ARP.IN.REP lda #K.ARP.TTL
@ -222,9 +221,7 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
bpl .4 bpl .4
>LDYA L.ARP.REQ >LDYA L.ARP.REQ
ldx #DEVMGR.WRITEBLOCK jsr FRM.Send.YA
jsr NetDevJmp
bcs .99 bcs .99
lda #K.ARP.PENDING.TTL lda #K.ARP.PENDING.TTL

View File

@ -34,12 +34,7 @@ SET.IPCFG >PULLW ZPTmpPtr1
bpl .3 bpl .3
lda IPCFG+S.IPCFG.HDEV lda IPCFG+S.IPCFG.HDEV
>SYSCALL GetDevStatus.A
>SYSCALL GetDevByID.A
>STYA NetDevJmp+1
ldx #DEVMGR.STATUS
jsr NetDevJmp
>STYA ZPTmpPtr2 >STYA ZPTmpPtr2
ldy #S.DSTAT.NIC.FLAGS ldy #S.DSTAT.NIC.FLAGS
@ -48,9 +43,10 @@ SET.IPCFG >PULLW ZPTmpPtr1
and #S.DSTAT.NIC.FLAGS.ARPOFFLOAD and #S.DSTAT.NIC.FLAGS.ARPOFFLOAD
beq .4 beq .4
>LDYA ZPTmpPtr1 >PUSHB IPCFG+S.IPCFG.HDEV
ldx #DEVMGR.CONTROL >PUSHBI DEVMGR.CONTROL
jsr NetDevJmp >PUSHW ZPTmpPtr1
>SYSCALL IOCTL
.4 lda hDNSSocket1 .4 lda hDNSSocket1
beq .41 beq .41

View File

@ -131,7 +131,7 @@ DNS.REQUEST lda hDNSSocket1
*\-------------------------------------- *\--------------------------------------
DNS.Add >PULLW ZPPtrDNS Get host string DNS.Add >PULLW ZPPtrDNS Get host string
>PULLW ZPPtrIP Get host IP address >PULLW ZPPtrIP Get host IP address
ldy #3 ldy #3
.1 lda (ZPPtrIP),y .1 lda (ZPPtrIP),y
@ -164,6 +164,7 @@ DNS.ADD.I sta DNS.TmpCache
sta (ZPCachePtr) sta (ZPCachePtr)
ldy #S.DNSCACHE.ID ldy #S.DNSCACHE.ID
.3 lda DNS.TmpCache,y .3 lda DNS.TmpCache,y
sta (ZPCachePtr),y sta (ZPCachePtr),y
iny iny
@ -271,7 +272,8 @@ DNS.FIND.FREE >LDYA L.DNS.CACHE
.1 lda (ZPCachePtr) .1 lda (ZPCachePtr)
beq .8 empty DNS cache entry? beq .8 empty DNS cache entry?
bpl .6 pending.....skip bit #S.DNSCACHE.STATUS.STATIC+S.DNSCACHE.STATUS.PENDING
bne .6 Static/Pending.....skip
ldy #S.DNSCACHE.TTL ldy #S.DNSCACHE.TTL
ldx #3 ldx #3
@ -319,6 +321,8 @@ DNS.EXPIRE >LDYA L.DNS.CACHE
.1 lda (ZPCachePtr) .1 lda (ZPCachePtr)
beq .7 empty DNS cache entry? beq .7 empty DNS cache entry?
bit #S.DNSCACHE.STATUS.STATIC
bne .7
ldy #S.DNSCACHE.TTL ldy #S.DNSCACHE.TTL
ldx #4 ldx #4

View File

@ -224,8 +224,8 @@ FRM.SendIP ldx #3 Copy SRC.IP even if IP offload
bcs FRM.Queue bcs FRM.Queue
.6 >LDYA ZPFrameOutPtr .6 >LDYA ZPFrameOutPtr
ldx #DEVMGR.WRITEBLOCK jsr FRM.Send.YA
jsr NetDevJmp
bcs FRM.Queue bcs FRM.Queue
lda hFrameOut lda hFrameOut
@ -274,9 +274,8 @@ FRM.Retry ldx FRM.QUEUE.Tail
jsr IP.SetDestMAC Err is ARP or higher, retry getting MAC jsr IP.SetDestMAC Err is ARP or higher, retry getting MAC
bcs .2 still error getting dest MAC bcs .2 still error getting dest MAC
.1 >LDYA ZPFrameOutPtr try sending again to DRV .1 >LDYA ZPFrameOutPtr
ldx #DEVMGR.WRITEBLOCK jsr FRM.Send.YA try sending again to DRV
jsr NetDevJmp
bcc .3 bcc .3
.2 ldx FRM.QUEUE.Tail save error... .2 ldx FRM.QUEUE.Tail save error...
@ -298,6 +297,14 @@ FRM.Retry ldx FRM.QUEUE.Tail
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
FRM.Send.YA pha
>PUSHB IPCFG+S.IPCFG.HDEV
>PUSHBI DEVMGR.WRITEBLOCK
pla
>PUSHYA
>SYSCALL IOCTL try sending again to DRV
rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.FRM SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.FRM
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S LOAD /A2OSX.SRC/LIB/LIBTCPIP.S

View File

@ -6,7 +6,34 @@ AUTO 4,1
HST.GetByName >PULLW ZPPtrDNS HST.GetByName >PULLW ZPPtrDNS
>PULLW ZPPtrIP >PULLW ZPPtrIP
jsr HST.ScanIP lda ZPPtrIP
clc
adc #3
tay
lda ZPPtrIP+1
adc #0
>PUSHYA
lda ZPPtrIP
clc
adc #2
tay
lda ZPPtrIP+1
adc #0
>PUSHYA
>LDYA ZPPtrIP
iny
bne .1
inc
.1 >PUSHYA
>PUSHW ZPPtrIP
>PUSHW L.HST.SSScanF
>LDYA ZPPtrDNS
>SYSCALL SScanF.YA
bcc .9 bcc .9
jmp DNS.QUERY.I jmp DNS.QUERY.I
.9 rts .9 rts
@ -18,102 +45,6 @@ HST.GetByAddr >PULLW ZPPtrIP
sec sec
rts rts
*-------------------------------------- *--------------------------------------
HST.ScanIP stz HST.IP
lda (ZPPtrDNS)
beq .9
ldy #$ff
.1 ldx #0
stx HST.DecStr
.2 iny
lda (ZPPtrDNS),y
beq .4
cmp #'.'
beq .3
cmp #'0'
bcc .9
cmp #'9'+1
bcs .9
cpx #3
beq .9
inx
sta HST.DecStr,x
bra .2
.3 stx HST.DecStr
phy
jsr HST.Dec2Hex
ply
bcc .1
rts
.4 txa
beq .5
stx HST.DecStr
jsr HST.Dec2Hex
bcs .9
.5 ldx HST.IP
cpx #4
bne .9
ldy #3
.6 lda HST.IP,x
sta (ZPPtrIP),y
dex
dey
bpl .6
clc
rts
.9 sec
rts
*--------------------------------------
HST.Dec2Hex ldy HST.DecStr
beq .9
ldx HST.IP
cpx #4
beq .9
inx
lda HST.DecStr+1
and #$0f
sta HST.IP,x
ldy #1
.1 cpy HST.DecStr
beq .8
iny
lda HST.IP,x
asl HST.IP,x
bcs .9
asl HST.IP,x
bcs .9
adc HST.IP,x
bcs .9
asl
bcs .9
sta HST.IP,x
lda HST.DecStr,y
and #$0f
adc HST.IP,x
sta HST.IP,x
bcc .1
.9 sec
rts
.8 stx HST.IP
clc
rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.HST SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.HST
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S LOAD /A2OSX.SRC/LIB/LIBTCPIP.S

View File

@ -94,6 +94,7 @@ L.DNS.MSG .DA DNS.MSG
L.ARP.CACHE .DA ARP.CACHE L.ARP.CACHE .DA ARP.CACHE
L.DNS.CACHE .DA DNS.CACHE L.DNS.CACHE .DA DNS.CACHE
L.SKT.Template .DA SKT.Template L.SKT.Template .DA SKT.Template
L.HST.SSScanF .DA HST.SSScanF
L.TmpByte .DA TmpByte L.TmpByte .DA TmpByte
L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
.DA TCP.IN.JMP.LISTEN .DA TCP.IN.JMP.LISTEN
@ -108,8 +109,9 @@ L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
.DA TCP.IN.JMP.TIMEWT .DA TCP.IN.JMP.TIMEWT
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
LIB.LOAD ldx bFirstLoad LIB.LOAD ldx RefCount
bne .8 bne .8
sta NODE.SSOCK+S.NODE.HANDLER sta NODE.SSOCK+S.NODE.HANDLER
jsr ARP.CLEAR jsr ARP.CLEAR
jsr DNS.CLEAR jsr DNS.CLEAR
@ -120,12 +122,14 @@ LIB.LOAD ldx bFirstLoad
stx hSocketTable stx hSocketTable
inc bFirstLoad .8 inc RefCount
clc
.8 clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
LIB.UNLOAD lda hSocketTable LIB.UNLOAD dec RefCount
bne .8
lda hSocketTable
beq .8 beq .8
>SYSCALL FreeMem.A >SYSCALL FreeMem.A
@ -133,8 +137,10 @@ LIB.UNLOAD lda hSocketTable
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
POLL ldx #DEVMGR.READBLOCK POLL >PUSHB IPCFG+S.IPCFG.HDEV
jsr NetDevJmp >PUSHBI DEVMGR.READBLOCK
>PUSHW 0
>SYSCALL IOCTL
bcs .99 No Frame bcs .99 No Frame
stx hFrameIn stx hFrameIn
@ -201,8 +207,6 @@ GetDynPort inc DYNPORT.LAST
ldx DYNPORT.LAST+1 ldx DYNPORT.LAST+1
clc clc
rts rts
*--------------------------------------
NetDevJmp jmp *
*-------------------------------------- *--------------------------------------
.INB /A2OSX.SRC/LIB/LIBTCPIP.S.ARP .INB /A2OSX.SRC/LIB/LIBTCPIP.S.ARP
.INB /A2OSX.SRC/LIB/LIBTCPIP.S.CFG .INB /A2OSX.SRC/LIB/LIBTCPIP.S.CFG
@ -268,7 +272,7 @@ FRM.QUEUE.hMem .BS K.FRMQUEUE.SIZE
FRM.QUEUE.State .BS K.FRMQUEUE.SIZE FRM.QUEUE.State .BS K.FRMQUEUE.SIZE
FRM.QUEUE.Retry .BS K.FRMQUEUE.SIZE FRM.QUEUE.Retry .BS K.FRMQUEUE.SIZE
*-------------------------------------- *--------------------------------------
bFirstLoad .DA #0 RefCount .DA #0
hSocketTable .BS 1 hSocketTable .BS 1
DevFlags .BS 1 DevFlags .BS 1
DYNPORT.LAST .DA K.DYNPORT.START DYNPORT.LAST .DA K.DYNPORT.START
@ -285,8 +289,7 @@ TmpOffset .BS 2
hFrameIn .BS 1 hFrameIn .BS 1
hFrameOut .BS 1 hFrameOut .BS 1
bTextMode .BS 1 bTextMode .BS 1
HST.DecStr .BS 4 HST.SSScanF .AZ "%d.%d.%d.%d"
HST.IP .BS 5
IP.ID .BS 2 IP.ID .BS 2
IP.CHECKSUM .BS 4 IP.CHECKSUM .BS 4
NODE.SSOCK .BS 1 S.NODE.HANDLER NODE.SSOCK .BS 1 S.NODE.HANDLER

View File

@ -161,8 +161,8 @@ OApple+1,OApple+2,OApple+3 to switch between screens : Kernel Log, text, DHGR.
| SHELL | Working | (See Internal Shell commands) | 0.9.1 | | SHELL | Working | (See Internal Shell commands) | 0.9.1 |
| KCONFIG | Working | Kernel Configuration Utility | 0.9.1 | | KCONFIG | Working | Kernel Configuration Utility | 0.9.1 |
| ---- | ------ | ------- | ----- | | ---- | ------ | ------- | ----- |
| TCPIPD | Working | Socket API.ARP,IP,ICMP,UDP & TCP ok | 0.9 | | TCPIPD | Working | Socket API.ARP,IP,ICMP,UDP & TCP ok | 0.9.1 |
| DHCPCLNT| Working | rewritten to use new Socket API | 0.9 | | DHCPCLNT| Working | rewritten to use new Socket API | 0.9.1 |
| TELNETD | In Progress | | 0.9 | | TELNETD | In Progress | | 0.9 |
| HTTPD | In Progress | | 0.9 | | HTTPD | In Progress | | 0.9 |
@ -253,11 +253,11 @@ note : '$VAR' does NOT expand Variable
| EDIT | Working | still missing : find/replace | 0.9.1 | | EDIT | Working | still missing : find/replace | 0.9.1 |
| NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.9 | | NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.9 |
| ---- | ------ | ------- | ----- | | ---- | ------ | ------- | ----- |
| ARP | Working | dump ARP cache, setup a static ARP entry | 0.9 | | ARP | Working | dump ARP cache, setup a static ARP entry | 0.9.1 |
| PING | Working | | 0.9 | | PING | Working | | 0.9.1 |
| DNSINFO | Working | dump DNS cache, setup a static DNS entry | 0.9 | | DNSINFO | Working | dump DNS cache, setup a static DNS entry | 0.9.1 |
| IPCONFIG | Working | renamed from NETINFO | 0.9 | | IPCONFIG | Working | renamed from NETINFO | 0.9.1 |
| NETSTAT | Working | | 0.9 | | NETSTAT | Working | | 0.9.1 |
## BIN,External DEV Shell commands: ## BIN,External DEV Shell commands:
| Name | Status | Comment | K.Ver | | Name | Status | Comment | K.Ver |
@ -265,7 +265,7 @@ note : '$VAR' does NOT expand Variable
| ASM | In Progress | S-C MASM based multi CPU assembler | 0.9.1 | | ASM | In Progress | S-C MASM based multi CPU assembler | 0.9.1 |
| MEMDUMP | Working | | 0.9.1 | | MEMDUMP | Working | | 0.9.1 |
| ---- | ------ | ------- | ----- | | ---- | ------ | ------- | ----- |
| RPCDUMP | Working | tool based on UDP socket API, renamed from RPCINFO | 0.9 | | RPCDUMP | Working | tool based on UDP socket API, renamed from RPCINFO | 0.9.1 |
## Misc ## Misc

View File

@ -20,7 +20,7 @@ CORE.Run lda CORE.PSCount
ldy #S.PS.CPID ldy #S.PS.CPID
lda (pPs),y lda (pPs),y
jsr CORE.GetPSStatus.A jsr CORE.GetPS.A
bcc .8 yes, still running.... bcc .8 yes, still running....
lda (pPs) get S.PS.F again lda (pPs) get S.PS.F again
@ -338,15 +338,20 @@ CORE.PSFree.A sta .1+1 Save PS ID
* X unmodofied * X unmodofied
*-------------------------------------- *--------------------------------------
CORE.GetPSByID.A CORE.GetPSByID.A
jsr CORE.GetPSStatus.A tay
bne .1
>LDYAI CORE.S.PS0 Select PS0
clc
rts
.1 jsr CORE.GetPS.A
bcs .9 bcs .9
lda PS.TABLE.hMem-1,y lda PS.TABLE.hMem-1,y
beq * beq *
jmp K.GetMemPtr.A jmp K.GetMemPtr.A
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CORE.GetPSStatus.A CORE.GetPS.A ldy CORE.PSCount
ldy CORE.PSCount
beq .9 beq .9
.1 cmp PS.Table.PID-1,y .1 cmp PS.Table.PID-1,y

View File

@ -104,9 +104,9 @@ K.IrqHAuxLC.3 pla Must keep Carry
lda $103,x get IRQ pushed P lda $103,x get IRQ pushed P
sta $101,x down 2 bytes sta $101,x down 2 bytes
lda #CORE.PSSleep make a RTI like "jsr CORE.Sleep" lda #A2osX.SLEEP make a RTI like "jsr A2osX.SLEEP"
sta $102,x sta $102,x
lda /CORE.PSSleep with RTS=PC IRQ-1 lda /A2osX.SLEEP with RTS=PC IRQ-1
sta $103,x sta $103,x
lda #$A0+'S lda #$A0+'S

View File

@ -682,13 +682,6 @@ K.SScanF.YA >STYA ZPPtr2 String to Scan
rts rts
.4 jsr .5 .4 jsr .5
tya
clc
adc ZPPtr2
sta ZPPtr2
bcc .1
inc ZPPtr2+1
bra .1 bra .1
@ -696,8 +689,8 @@ K.SScanF.YA >STYA ZPPtr2 String to Scan
rts rts
*-------------------------------------- *--------------------------------------
.5 >PULLW ZPPtr3 get VAR Ptr .5 >PULLW ZPPtr3 get VAR Ptr
lda K.SScanFTBL+1,x Get VAR Byte count lda K.SScanFTBL+1,x Get VAR size
jmp (K.SScanFJMP,x) jmp (K.SScanFJMP,x)
*-------------------------------------- *--------------------------------------
K.SScanFTBL .DA #'i,#1,#'d,#1,#'I,#2,#'D,#2,#'l,#4,#'u,#4 K.SScanFTBL .DA #'i,#1,#'d,#1,#'I,#2,#'D,#2,#'l,#4,#'u,#4
@ -713,20 +706,23 @@ K.SScanF.D
K.SScanF.II K.SScanF.II
K.SScanF.DD K.SScanF.DD
K.SScanF.L K.SScanF.L
K.SScanF.U pha Save Byte count K.SScanF.U pha Save VAL size
jsr STDLIB.Dec2Hex jsr STDLIB.Dec2Hex
pla tya Y=char count parsed
phy clc
tay adc ZPPtr2
sta ZPPtr2
bcc .1
inc ZPPtr2+1
.1 lda STDLIB.32-1,y .1 ply get back VAL size
.2 lda STDLIB.32-1,y
dey dey
sta (ZPPtr3),y sta (ZPPtr3),y
bpl .1 bpl .2
ply
.9 rts .9 rts
*/-------------------------------------- */--------------------------------------