mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-27 18:30:51 +00:00
Kernel 0.9.1 : TCPIP, code Cleaning and 0.9.1 compliance
This commit is contained in:
parent
17746d588c
commit
b9ac24c39e
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -52,7 +52,7 @@ CS.RUN ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
bne CS.RUN.ADD
|
||||
jmp CS.RUN.DUMP
|
||||
|
||||
*--------------------------------------
|
||||
CS.RUN.ADD cmp #2
|
||||
beq .1
|
||||
jmp .9
|
||||
@ -82,7 +82,7 @@ CS.RUN.ADD cmp #2
|
||||
.9 lda #K.E.SYN
|
||||
sec
|
||||
.99 rts
|
||||
|
||||
*--------------------------------------
|
||||
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GetCache
|
||||
>STYA ZPPTR1
|
||||
>LDYA L.MSG0
|
||||
|
@ -24,7 +24,8 @@ CS.START cld
|
||||
.DA 0
|
||||
.DA CS.END-CS.START Code Length To Relocate
|
||||
.DA DS.END-DS.START Data Segment to Allocate
|
||||
.DA 0
|
||||
.DA #16 SS
|
||||
.DA #4 ZP
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
|
@ -27,7 +27,7 @@ A2osX.ATKCALL .EQ $BD06
|
||||
A2osX.ROMCALL .EQ $BD09
|
||||
A2osX.BADCALL .EQ $BD0C
|
||||
*--------------------------------------
|
||||
A2osx.SLEEP .EQ $BD10
|
||||
A2osX.SLEEP .EQ $BD10
|
||||
*--------------------------------------
|
||||
* $BEE0->$BEEF : Public Variables
|
||||
*--------------------------------------
|
||||
|
@ -166,8 +166,7 @@ ARP.IN.REQ ldy #S.ARP.SPA+3
|
||||
bpl .2
|
||||
|
||||
>LDYA L.ARP.REP
|
||||
ldx #DEVMGR.WRITEBLOCK
|
||||
jsr NetDevJmp
|
||||
jsr FRM.Send.YA
|
||||
bra ARP.IN.EXIT
|
||||
|
||||
ARP.IN.REP lda #K.ARP.TTL
|
||||
@ -222,9 +221,7 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
|
||||
bpl .4
|
||||
|
||||
>LDYA L.ARP.REQ
|
||||
ldx #DEVMGR.WRITEBLOCK
|
||||
jsr NetDevJmp
|
||||
|
||||
jsr FRM.Send.YA
|
||||
bcs .99
|
||||
|
||||
lda #K.ARP.PENDING.TTL
|
||||
|
@ -34,12 +34,7 @@ SET.IPCFG >PULLW ZPTmpPtr1
|
||||
bpl .3
|
||||
|
||||
lda IPCFG+S.IPCFG.HDEV
|
||||
|
||||
>SYSCALL GetDevByID.A
|
||||
>STYA NetDevJmp+1
|
||||
|
||||
ldx #DEVMGR.STATUS
|
||||
jsr NetDevJmp
|
||||
>SYSCALL GetDevStatus.A
|
||||
|
||||
>STYA ZPTmpPtr2
|
||||
ldy #S.DSTAT.NIC.FLAGS
|
||||
@ -48,9 +43,10 @@ SET.IPCFG >PULLW ZPTmpPtr1
|
||||
and #S.DSTAT.NIC.FLAGS.ARPOFFLOAD
|
||||
beq .4
|
||||
|
||||
>LDYA ZPTmpPtr1
|
||||
ldx #DEVMGR.CONTROL
|
||||
jsr NetDevJmp
|
||||
>PUSHB IPCFG+S.IPCFG.HDEV
|
||||
>PUSHBI DEVMGR.CONTROL
|
||||
>PUSHW ZPTmpPtr1
|
||||
>SYSCALL IOCTL
|
||||
|
||||
.4 lda hDNSSocket1
|
||||
beq .41
|
||||
|
@ -131,7 +131,7 @@ DNS.REQUEST lda hDNSSocket1
|
||||
*\--------------------------------------
|
||||
DNS.Add >PULLW ZPPtrDNS Get host string
|
||||
>PULLW ZPPtrIP Get host IP address
|
||||
|
||||
|
||||
ldy #3
|
||||
|
||||
.1 lda (ZPPtrIP),y
|
||||
@ -164,6 +164,7 @@ DNS.ADD.I sta DNS.TmpCache
|
||||
sta (ZPCachePtr)
|
||||
|
||||
ldy #S.DNSCACHE.ID
|
||||
|
||||
.3 lda DNS.TmpCache,y
|
||||
sta (ZPCachePtr),y
|
||||
iny
|
||||
@ -271,7 +272,8 @@ DNS.FIND.FREE >LDYA L.DNS.CACHE
|
||||
|
||||
.1 lda (ZPCachePtr)
|
||||
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
|
||||
ldx #3
|
||||
@ -319,6 +321,8 @@ DNS.EXPIRE >LDYA L.DNS.CACHE
|
||||
|
||||
.1 lda (ZPCachePtr)
|
||||
beq .7 empty DNS cache entry?
|
||||
bit #S.DNSCACHE.STATUS.STATIC
|
||||
bne .7
|
||||
|
||||
ldy #S.DNSCACHE.TTL
|
||||
ldx #4
|
||||
|
@ -224,8 +224,8 @@ FRM.SendIP ldx #3 Copy SRC.IP even if IP offload
|
||||
bcs FRM.Queue
|
||||
|
||||
.6 >LDYA ZPFrameOutPtr
|
||||
ldx #DEVMGR.WRITEBLOCK
|
||||
jsr NetDevJmp
|
||||
jsr FRM.Send.YA
|
||||
|
||||
bcs FRM.Queue
|
||||
|
||||
lda hFrameOut
|
||||
@ -274,9 +274,8 @@ FRM.Retry ldx FRM.QUEUE.Tail
|
||||
jsr IP.SetDestMAC Err is ARP or higher, retry getting MAC
|
||||
bcs .2 still error getting dest MAC
|
||||
|
||||
.1 >LDYA ZPFrameOutPtr try sending again to DRV
|
||||
ldx #DEVMGR.WRITEBLOCK
|
||||
jsr NetDevJmp
|
||||
.1 >LDYA ZPFrameOutPtr
|
||||
jsr FRM.Send.YA try sending again to DRV
|
||||
bcc .3
|
||||
|
||||
.2 ldx FRM.QUEUE.Tail save error...
|
||||
@ -298,6 +297,14 @@ FRM.Retry ldx FRM.QUEUE.Tail
|
||||
|
||||
.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
|
||||
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.FRM
|
||||
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
||||
|
@ -6,7 +6,34 @@ AUTO 4,1
|
||||
HST.GetByName >PULLW ZPPtrDNS
|
||||
>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
|
||||
jmp DNS.QUERY.I
|
||||
.9 rts
|
||||
@ -18,102 +45,6 @@ HST.GetByAddr >PULLW ZPPtrIP
|
||||
sec
|
||||
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
|
||||
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.HST
|
||||
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
||||
|
@ -94,6 +94,7 @@ L.DNS.MSG .DA DNS.MSG
|
||||
L.ARP.CACHE .DA ARP.CACHE
|
||||
L.DNS.CACHE .DA DNS.CACHE
|
||||
L.SKT.Template .DA SKT.Template
|
||||
L.HST.SSScanF .DA HST.SSScanF
|
||||
L.TmpByte .DA TmpByte
|
||||
L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
|
||||
.DA TCP.IN.JMP.LISTEN
|
||||
@ -108,8 +109,9 @@ L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
|
||||
.DA TCP.IN.JMP.TIMEWT
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
LIB.LOAD ldx bFirstLoad
|
||||
LIB.LOAD ldx RefCount
|
||||
bne .8
|
||||
|
||||
sta NODE.SSOCK+S.NODE.HANDLER
|
||||
jsr ARP.CLEAR
|
||||
jsr DNS.CLEAR
|
||||
@ -120,12 +122,14 @@ LIB.LOAD ldx bFirstLoad
|
||||
|
||||
stx hSocketTable
|
||||
|
||||
inc bFirstLoad
|
||||
|
||||
.8 clc
|
||||
.8 inc RefCount
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
LIB.UNLOAD lda hSocketTable
|
||||
LIB.UNLOAD dec RefCount
|
||||
bne .8
|
||||
|
||||
lda hSocketTable
|
||||
beq .8
|
||||
|
||||
>SYSCALL FreeMem.A
|
||||
@ -133,8 +137,10 @@ LIB.UNLOAD lda hSocketTable
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
POLL ldx #DEVMGR.READBLOCK
|
||||
jsr NetDevJmp
|
||||
POLL >PUSHB IPCFG+S.IPCFG.HDEV
|
||||
>PUSHBI DEVMGR.READBLOCK
|
||||
>PUSHW 0
|
||||
>SYSCALL IOCTL
|
||||
bcs .99 No Frame
|
||||
|
||||
stx hFrameIn
|
||||
@ -201,8 +207,6 @@ GetDynPort inc DYNPORT.LAST
|
||||
ldx DYNPORT.LAST+1
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
NetDevJmp jmp *
|
||||
*--------------------------------------
|
||||
.INB /A2OSX.SRC/LIB/LIBTCPIP.S.ARP
|
||||
.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.Retry .BS K.FRMQUEUE.SIZE
|
||||
*--------------------------------------
|
||||
bFirstLoad .DA #0
|
||||
RefCount .DA #0
|
||||
hSocketTable .BS 1
|
||||
DevFlags .BS 1
|
||||
DYNPORT.LAST .DA K.DYNPORT.START
|
||||
@ -285,8 +289,7 @@ TmpOffset .BS 2
|
||||
hFrameIn .BS 1
|
||||
hFrameOut .BS 1
|
||||
bTextMode .BS 1
|
||||
HST.DecStr .BS 4
|
||||
HST.IP .BS 5
|
||||
HST.SSScanF .AZ "%d.%d.%d.%d"
|
||||
IP.ID .BS 2
|
||||
IP.CHECKSUM .BS 4
|
||||
NODE.SSOCK .BS 1 S.NODE.HANDLER
|
||||
|
16
README.md
16
README.md
@ -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 |
|
||||
| KCONFIG | Working | Kernel Configuration Utility | 0.9.1 |
|
||||
| ---- | ------ | ------- | ----- |
|
||||
| TCPIPD | Working | Socket API.ARP,IP,ICMP,UDP & TCP ok | 0.9 |
|
||||
| DHCPCLNT| Working | rewritten to use new Socket API | 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.1 |
|
||||
| TELNETD | 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 |
|
||||
| NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.9 |
|
||||
| ---- | ------ | ------- | ----- |
|
||||
| ARP | Working | dump ARP cache, setup a static ARP entry | 0.9 |
|
||||
| PING | Working | | 0.9 |
|
||||
| DNSINFO | Working | dump DNS cache, setup a static DNS entry | 0.9 |
|
||||
| IPCONFIG | Working | renamed from NETINFO | 0.9 |
|
||||
| NETSTAT | Working | | 0.9 |
|
||||
| ARP | Working | dump ARP cache, setup a static ARP entry | 0.9.1 |
|
||||
| PING | Working | | 0.9.1 |
|
||||
| DNSINFO | Working | dump DNS cache, setup a static DNS entry | 0.9.1 |
|
||||
| IPCONFIG | Working | renamed from NETINFO | 0.9.1 |
|
||||
| NETSTAT | Working | | 0.9.1 |
|
||||
|
||||
## BIN,External DEV Shell commands:
|
||||
| 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 |
|
||||
| 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
|
||||
|
||||
|
@ -20,7 +20,7 @@ CORE.Run lda CORE.PSCount
|
||||
|
||||
ldy #S.PS.CPID
|
||||
lda (pPs),y
|
||||
jsr CORE.GetPSStatus.A
|
||||
jsr CORE.GetPS.A
|
||||
bcc .8 yes, still running....
|
||||
|
||||
lda (pPs) get S.PS.F again
|
||||
@ -338,15 +338,20 @@ CORE.PSFree.A sta .1+1 Save PS ID
|
||||
* X unmodofied
|
||||
*--------------------------------------
|
||||
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
|
||||
lda PS.TABLE.hMem-1,y
|
||||
beq *
|
||||
jmp K.GetMemPtr.A
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CORE.GetPSStatus.A
|
||||
ldy CORE.PSCount
|
||||
CORE.GetPS.A ldy CORE.PSCount
|
||||
beq .9
|
||||
|
||||
.1 cmp PS.Table.PID-1,y
|
||||
|
@ -104,9 +104,9 @@ K.IrqHAuxLC.3 pla Must keep Carry
|
||||
lda $103,x get IRQ pushed P
|
||||
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
|
||||
lda /CORE.PSSleep with RTS=PC IRQ-1
|
||||
lda /A2osX.SLEEP with RTS=PC IRQ-1
|
||||
sta $103,x
|
||||
|
||||
lda #$A0+'S
|
||||
|
@ -682,13 +682,6 @@ K.SScanF.YA >STYA ZPPtr2 String to Scan
|
||||
rts
|
||||
|
||||
.4 jsr .5
|
||||
|
||||
tya
|
||||
clc
|
||||
adc ZPPtr2
|
||||
sta ZPPtr2
|
||||
bcc .1
|
||||
inc ZPPtr2+1
|
||||
|
||||
bra .1
|
||||
|
||||
@ -696,8 +689,8 @@ K.SScanF.YA >STYA ZPPtr2 String to Scan
|
||||
rts
|
||||
*--------------------------------------
|
||||
.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)
|
||||
*--------------------------------------
|
||||
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.DD
|
||||
K.SScanF.L
|
||||
K.SScanF.U pha Save Byte count
|
||||
K.SScanF.U pha Save VAL size
|
||||
|
||||
jsr STDLIB.Dec2Hex
|
||||
|
||||
pla
|
||||
phy
|
||||
tay
|
||||
tya Y=char count parsed
|
||||
clc
|
||||
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
|
||||
sta (ZPPtr3),y
|
||||
bpl .1
|
||||
|
||||
ply
|
||||
bpl .2
|
||||
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user