mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
Kernel 0.93
This commit is contained in:
parent
60ca03c83e
commit
d5bf836a5a
@ -11,12 +11,20 @@ NEW
|
||||
.INB INC/LIBTCPIP.I
|
||||
.INB INC/NET.TELNET.I
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 40 4 sec.
|
||||
TIMEOUT.MAX .EQ 100 10 sec.
|
||||
BUFSIZE .EQ 256
|
||||
*--------------------------------------
|
||||
ZPIPCfgPtr .EQ ZPBIN
|
||||
ZPBufPtr .EQ ZPBIN+2
|
||||
ZPBufLen .EQ ZPBIN+4
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPIPCfgPtr .BS 2
|
||||
ZPBufPtr .BS 2
|
||||
ZPBufLen .BS 2
|
||||
hBuf .BS 1
|
||||
hSocket .BS 1
|
||||
TimeOut .BS 1
|
||||
ZS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
@ -26,10 +34,10 @@ CS.START cld
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA #S.PS.F.EVENT S.PS.F
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Length To Relocate
|
||||
.DA DS.END-DS.START Data Segment to Allocate
|
||||
.DA #64 SS
|
||||
.DA #6 ZP
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data Segment Size
|
||||
.DA #64 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
@ -84,7 +92,8 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
jsr Init.Timeout
|
||||
lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.2 >PUSHW L.SA.REMOTE.AD
|
||||
lda #1
|
||||
@ -92,9 +101,10 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
>PUSHYA
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GETBYNAME
|
||||
bcc CS.RUN.HOSTOK
|
||||
|
||||
>SLEEP
|
||||
jsr Wait.Timeout
|
||||
bcc .2
|
||||
lda TimeOut
|
||||
bne .2
|
||||
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
@ -139,10 +149,10 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
||||
bcs .9
|
||||
|
||||
>STA.G hSocket
|
||||
pha
|
||||
sta hSocket
|
||||
|
||||
>PUSHW L.SA.LOCAL
|
||||
pla
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
||||
bcc .2
|
||||
|
||||
@ -153,7 +163,7 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
rts
|
||||
|
||||
.2 >PUSHW L.SA.REMOTE
|
||||
>LDA.G hSocket
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
||||
bcs .9
|
||||
|
||||
@ -165,12 +175,11 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
>SYSCALL getmem
|
||||
bcs .9
|
||||
>STYA ZPBufPtr
|
||||
txa
|
||||
>STA.G hBuf
|
||||
stx hBuf
|
||||
|
||||
CS.RUN.LOOP >SLEEP
|
||||
|
||||
>LDA.G hSocket
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.EOF
|
||||
bcs .99
|
||||
|
||||
@ -179,7 +188,7 @@ CS.RUN.LOOP >SLEEP
|
||||
|
||||
>PUSHWI BUFSIZE
|
||||
>PUSHW ZPBufPtr
|
||||
>LDA.G hSocket
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
|
||||
.99 bcs .9
|
||||
|
||||
@ -213,7 +222,7 @@ CS.RUN.LOOP >SLEEP
|
||||
|
||||
>PUSHW ZPBufLen
|
||||
>PUSHW ZPBufPtr
|
||||
>LDA.G hSocket
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Write
|
||||
|
||||
.9 bcs CS.RUN.SKTERR
|
||||
@ -247,21 +256,20 @@ CS.RUN.USER >LDYA L.MSG.USER
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .9 is it a TIMER event?
|
||||
|
||||
>LDA.G TimeOut
|
||||
lda TimeOut
|
||||
beq .9
|
||||
|
||||
dec
|
||||
sta (pData),y
|
||||
dec TimeOut
|
||||
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT >LDA.G hSocket
|
||||
CS.QUIT lda hSocket
|
||||
beq .1
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
||||
|
||||
.1 >LDA.G hBuf
|
||||
.1 lda hBuf
|
||||
beq .2
|
||||
|
||||
>SYSCALL freemem
|
||||
@ -273,17 +281,6 @@ CS.QUIT >LDA.G hSocket
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
Init.Timeout lda #TIMEOUT.MAX
|
||||
>STA.G TimeOut
|
||||
rts
|
||||
*--------------------------------------
|
||||
Wait.TimeOut sec
|
||||
>LDA.G TimeOut
|
||||
beq .9
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
LIBTCPIP .AZ "libtcpip"
|
||||
hLIBTCPIP .BS 1
|
||||
@ -310,9 +307,6 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
hBuf .BS 1
|
||||
hSocket .BS 1
|
||||
TimeOut .BS 1
|
||||
DS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
|
@ -86,6 +86,10 @@ A2osX.S.NIC .EQ $E2
|
||||
A2osX.S.CLK .EQ $E3
|
||||
A2osX.S.DISABLE .EQ $FF
|
||||
*--------------------------------------
|
||||
* NON BLOCKING Entry point (From libs)
|
||||
*--------------------------------------
|
||||
A2osX.SYSCALL2 .EQ $E200
|
||||
*--------------------------------------
|
||||
* ProDOS ERROR CODES : $00->$5F
|
||||
* Kernel ERROR CODES : $60->$7F
|
||||
* Lib ERROR CODES : $80->$BF
|
||||
@ -301,9 +305,6 @@ SYS.SListLookup .EQ $FA
|
||||
SYS.SListNew .EQ $FC
|
||||
SYS.SListFree .EQ $FE
|
||||
*--------------------------------------
|
||||
SYS.Kernel.JMP .EQ $E000
|
||||
SYS.GuiOSD.JMP .EQ $E200
|
||||
*--------------------------------------
|
||||
* MEM STRUCT
|
||||
*--------------------------------------
|
||||
S.MEM.F .EQ 0
|
||||
|
@ -16,10 +16,6 @@ AUTO 4,1
|
||||
.EM
|
||||
*--------------------------------------
|
||||
* SYSCALLs Macros
|
||||
*--------------------------------------
|
||||
.MA SLEEP
|
||||
jsr A2osX.SLEEP
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA SYSCALL
|
||||
ldx #SYS.]1
|
||||
@ -31,6 +27,20 @@ AUTO 4,1
|
||||
ldx #]2
|
||||
jsr A2osX.LIBCALL
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA ROMCALL
|
||||
ldx #ROM.]1
|
||||
jsr A2osX.ROMCALL
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA SLEEP
|
||||
jsr A2osX.SLEEP
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA SYSCALL2
|
||||
ldx #SYS.]1
|
||||
jsr A2osX.SYSCALL2
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA MLICALL
|
||||
ldx #]1
|
||||
@ -111,11 +121,6 @@ AUTO 4,1
|
||||
.FIN
|
||||
jsr GP.MLICall
|
||||
.EM
|
||||
*--------------------------------------
|
||||
.MA ROMCALL
|
||||
ldx #ROM.]1
|
||||
jsr A2osX.ROMCALL
|
||||
.EM
|
||||
*--------------------------------------
|
||||
* Global DATA Segment Access
|
||||
*--------------------------------------
|
||||
|
@ -124,7 +124,7 @@ LIB.UNLOAD clc
|
||||
MD5 >PULLW ZPDataPtr
|
||||
>PULLW ZPHashPtr
|
||||
>LDYA ZPDataPtr
|
||||
>SYSCALL strlen
|
||||
>SYSCALL2 strlen
|
||||
>STYA ZPDataLen
|
||||
|
||||
.1 jsr MD5Init
|
||||
@ -136,7 +136,7 @@ MD5 >PULLW ZPDataPtr
|
||||
jsr MD5Finalize.I
|
||||
|
||||
pla
|
||||
>SYSCALL FreeMem Free MD5 Context
|
||||
>SYSCALL2 FreeMem Free MD5 Context
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
@ -151,7 +151,7 @@ MD5 >PULLW ZPDataPtr
|
||||
* A = hMem To S.MD5
|
||||
*\--------------------------------------
|
||||
MD5Init >LDYAI S.MD5
|
||||
>SYSCALL getmem
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPCtxPtr
|
||||
@ -186,7 +186,7 @@ MD5Init >LDYAI S.MD5
|
||||
* `>hLIBCRYPT,LIBCRYPT.MD5Update`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
MD5Update >SYSCALL GetMemPtr get MD5 Context
|
||||
MD5Update >SYSCALL2 GetMemPtr get MD5 Context
|
||||
>STYA ZPCtxPtr
|
||||
>PULLW ZPDataPtr get DATA
|
||||
>PULLW ZPDataLen get LEN
|
||||
@ -274,14 +274,14 @@ MD5Update.I ldy #S.MD5.FINALIZED
|
||||
*\--------------------------------------
|
||||
MD5Finalize pha
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPCtxPtr get MD5 Context
|
||||
|
||||
>PULLW ZPHashPtr
|
||||
|
||||
jsr MD5Finalize.I
|
||||
pla
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
rts
|
||||
|
||||
MD5Finalize.I ldy #S.MD5.FINALIZED
|
||||
|
@ -154,7 +154,7 @@ AARP.IN bra .10
|
||||
AARP.IN.EXIT lda hFrameIn
|
||||
beq .8
|
||||
stz hFrameIn
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
|
@ -14,7 +14,7 @@ FRM.Send ldx #3
|
||||
FRM.Send.IOCTL >PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.WRITE
|
||||
lda ETKCFG+S.NETCFG.DevID
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -15,7 +15,7 @@ BUT.New >STYA ZPPtr1
|
||||
beq .1
|
||||
|
||||
ldy #S.BM.W
|
||||
>SYSCALL GetStkObjProp
|
||||
>SYSCALL2 GetStkObjProp
|
||||
|
||||
phy
|
||||
ldy #S.OBJ.W+1
|
||||
|
@ -325,7 +325,7 @@ DrawText >LDYA L.CB.Cache
|
||||
jsr GFXWrite.CB
|
||||
|
||||
lda CB.Cache+S.CB.SrcPtr
|
||||
>SYSCALL FreeStkObj
|
||||
>SYSCALL2 FreeStkObj
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
|
@ -6,19 +6,19 @@ FON.Init >PUSHWI 0 Aux type
|
||||
>PUSHBI $CC Type
|
||||
>PUSHBI O.RDONLY
|
||||
>LDYA L.SYSX7
|
||||
>SYSCALL LoadStkObj
|
||||
>SYSCALL2 LoadStkObj
|
||||
bcs .9
|
||||
sta hSYSFON
|
||||
|
||||
ldy #S.FON.PixH
|
||||
>SYSCALL GetStkObjProp
|
||||
>SYSCALL2 GetStkObjProp
|
||||
sty SYSFON.H
|
||||
|
||||
>PUSHWI 0 Aux type
|
||||
>PUSHBI $CC Type
|
||||
>PUSHBI O.RDONLY
|
||||
>LDYA L.SYSX7B
|
||||
>SYSCALL LoadStkObj
|
||||
>SYSCALL2 LoadStkObj
|
||||
bcs .9
|
||||
sta hSYSFONB
|
||||
|
||||
|
@ -5,7 +5,7 @@ AUTO 4,1
|
||||
MOU.Init
|
||||
.1 >PUSHBI 0
|
||||
>LDYA L.DEVNAME.MOUSE
|
||||
>SYSCALL open
|
||||
>SYSCALL2 open
|
||||
bcc .2
|
||||
|
||||
inc DEVNAME.MOUSE+8
|
||||
@ -42,7 +42,7 @@ MOU.Setup lda DCB.GFX+S.DCB.GFX.W+1
|
||||
>PUSHW L.MouseClamp
|
||||
>PUSHBI IOCTL.CONTROL
|
||||
lda hDevMouse
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
bcs .9
|
||||
|
||||
>LDYA L.CUR.SaveBuf
|
||||
@ -62,7 +62,7 @@ MOU.Quit lda hDevMouse
|
||||
>PUSHBI IOCTL.CLOSE
|
||||
>PUSHWI 0
|
||||
pla
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
@ -80,7 +80,7 @@ MOU.ReadMouse lda A2osX.ASCREEN GUI screen active ?
|
||||
>PUSHBI IOCTL.READ
|
||||
|
||||
pla
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
|
@ -4,7 +4,7 @@ AUTO 4,1
|
||||
*--------------------------------------
|
||||
WND.Init >PUSHBI 0
|
||||
>LDYA L.DEVNAME.GFX
|
||||
>SYSCALL open
|
||||
>SYSCALL2 open
|
||||
bcs .9
|
||||
|
||||
sta SCR+S.SCREEN.hDEV
|
||||
@ -17,7 +17,7 @@ WND.Init >PUSHBI 0
|
||||
>PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.STATUS
|
||||
lda SCR+S.SCREEN.hDEV
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -69,7 +69,7 @@ WND.Quit lda SCR+S.SCREEN.hDEV
|
||||
>PUSHBI IOCTL.CLOSE
|
||||
>PUSHWI 0
|
||||
pla
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
|
||||
.8
|
||||
clc
|
||||
@ -78,7 +78,7 @@ WND.Quit lda SCR+S.SCREEN.hDEV
|
||||
WND.New >STYA ZPPtr1
|
||||
|
||||
>LDYAI S.WND
|
||||
>SYSCALL getmem
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPWNDPtr
|
||||
|
@ -232,7 +232,7 @@ GFXWrite.CB >LDYA L.CB.Cache
|
||||
GFXWrite.YA >PUSHYA
|
||||
>PUSHBI IOCTL.WRITE
|
||||
lda SCR+S.SCREEN.hDEV
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
rts
|
||||
*--------------------------------------
|
||||
.INB USR/SRC/LIB/LIBGUI.S.BM
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*/--------------------------------------
|
||||
* # ARP.Clear
|
||||
@ -147,7 +146,7 @@ ARP.IN ldy #S.ARP.TPA+3
|
||||
ARP.IN.EXIT lda hFrameIn
|
||||
beq .8
|
||||
stz hFrameIn
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
CFG.SET >PULLW ZPTmpPtr1 IPCFG
|
||||
@ -43,7 +42,7 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG
|
||||
>PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.STATUS
|
||||
lda IPCFG+S.NETCFG.DevID
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
|
||||
ldx #11 IP/MASK/GW
|
||||
|
||||
@ -58,7 +57,7 @@ CFG.SET >PULLW ZPTmpPtr1 IPCFG
|
||||
>PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.CONTROL
|
||||
lda IPCFG+S.NETCFG.DevID
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
bcs .9
|
||||
|
||||
.5 lda hDNSSocket
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*/--------------------------------------
|
||||
* # DNS.Clear
|
||||
@ -139,7 +138,7 @@ DNS.CSTR2DNS lda (ZPPtrDNS)
|
||||
beq .9
|
||||
|
||||
>LDYA ZPPtrDNS
|
||||
>SYSCALL strlen
|
||||
>SYSCALL2 strlen
|
||||
|
||||
tax
|
||||
bne .9
|
||||
@ -219,7 +218,7 @@ DNS.ADD.I sta DNS.TmpCache
|
||||
jsr DNS.FIND.FREE
|
||||
|
||||
>LDYA ZPPtrDNS
|
||||
>SYSCALL strdup
|
||||
>SYSCALL2 strdup
|
||||
bcs .9
|
||||
txa
|
||||
ldy #S.DNSCACHE.hNAME
|
||||
@ -262,9 +261,9 @@ DNS.FIND.BY.NAME
|
||||
>PUSHW ZPPtrDNS
|
||||
ldy #S.DNSCACHE.hNAME
|
||||
lda (ZPCachePtr),y
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
|
||||
>SYSCALL StrCaseCmp
|
||||
>SYSCALL2 StrCaseCmp
|
||||
bcc .8
|
||||
|
||||
.6 lda ZPCachePtr
|
||||
@ -417,7 +416,7 @@ DNS.FREE ldy #S.DNSCACHE.hNAME
|
||||
lda (ZPCachePtr),y
|
||||
beq .1
|
||||
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
.1 lda #0
|
||||
sta (ZPCachePtr)
|
||||
rts
|
||||
@ -433,7 +432,7 @@ DNS.POLL lda hDNSSocket
|
||||
rts
|
||||
*--------------------------------------
|
||||
DNS.DecodeMsg sta hFrameIn
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPFrameInPtr
|
||||
|
||||
ldy #S.DNS.F
|
||||
@ -541,7 +540,7 @@ DNS.DecodeMsg sta hFrameIn
|
||||
jsr DNS.UPDATE.BY.ID
|
||||
|
||||
.9 lda hFrameIn
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
FRM.GetTargetSKT.TCPUDP
|
||||
@ -72,7 +71,7 @@ FRM.NewIP stx .8+1
|
||||
adc ZPDataOutLen+1
|
||||
sta ZPFrameOutLen+1
|
||||
|
||||
>SYSCALL getmem
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
|
||||
stx hFrameOut
|
||||
@ -252,7 +251,7 @@ FRM.SendIP ldx #3 Copy SRC.IP even if IP offload
|
||||
|
||||
lda hFrameOut
|
||||
beq .9
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
stz hFrameOut
|
||||
clc
|
||||
.9 rts
|
||||
@ -293,7 +292,7 @@ FRM.Retry ldx FRM.QUEUE.Tail
|
||||
beq .8 Queue is empty, exit...
|
||||
|
||||
lda FRM.QUEUE.hMem,x
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPFrameOutPtr
|
||||
|
||||
ldx FRM.QUEUE.Tail
|
||||
@ -320,7 +319,7 @@ FRM.Retry ldx FRM.QUEUE.Tail
|
||||
|
||||
.3 ldx FRM.QUEUE.Tail Success,or max retry, discard entry
|
||||
lda FRM.QUEUE.hMem,x
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
|
||||
ldx FRM.QUEUE.Tail
|
||||
inx
|
||||
@ -344,7 +343,7 @@ FRM.Send ldx #3
|
||||
FRM.Send.IOCTL >PUSHW L.IOCTL
|
||||
>PUSHBI IOCTL.WRITE
|
||||
lda IPCFG+S.NETCFG.DevID
|
||||
>SYSCALL IOCTL
|
||||
>SYSCALL2 IOCTL
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
HST.GetByName >PULLW ZPPtrDNS
|
||||
@ -23,7 +22,7 @@ HST.GetByName >PULLW ZPPtrDNS
|
||||
>PUSHW L.HST.SScanF
|
||||
>LDYA ZPPtrDNS
|
||||
|
||||
>SYSCALL SScanF
|
||||
>SYSCALL2 SScanF
|
||||
bcc .9
|
||||
jmp DNS.QUERY.I
|
||||
.9 rts
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
ICMP.IN ldy #S.ICMP.TYPE
|
||||
@ -47,7 +46,7 @@ ICMP.IN.ECHOREQ ldy #S.IP.DST+3
|
||||
|
||||
ICMP.IN.EXIT lda hFrameIn
|
||||
beq .8
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
stz hFrameIn
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
@ -76,7 +75,7 @@ ICMP.IN.ECHOREP jsr FRM.GetTargetSKT.RAW
|
||||
|
||||
.9 lda hFrameIn Q full, discard...
|
||||
stz hFrameIn
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
IP.IN ldy #S.IP.PROTOCOL
|
||||
@ -20,7 +19,7 @@ IP.IN ldy #S.IP.PROTOCOL
|
||||
|
||||
.9 lda hFrameIn
|
||||
beq .8
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*/--------------------------------------
|
||||
* # Socket
|
||||
@ -33,7 +32,7 @@ SKT.Socket.DSOCK
|
||||
stx FD.DSOCK+S.SOCKET.T save type
|
||||
sta FD.DSOCK+S.SOCKET.PROTO ICMP,UDP,TCP
|
||||
lda #0 Y = socket.size
|
||||
>SYSCALL GetMem0
|
||||
>SYSCALL2 GetMem0
|
||||
bcs .9
|
||||
>STYA ZPTmpPtr1
|
||||
|
||||
@ -57,7 +56,7 @@ SKT.Socket.STREAM
|
||||
stx FD.SSOCK+S.SOCKET.T save type
|
||||
sta FD.SSOCK+S.SOCKET.PROTO
|
||||
lda #0 Y = socket.size
|
||||
>SYSCALL GetMem0
|
||||
>SYSCALL2 GetMem0
|
||||
bcs .9
|
||||
>STYA ZPTmpPtr1
|
||||
|
||||
@ -84,7 +83,7 @@ SKT.Socket.FindFree
|
||||
bne .1
|
||||
|
||||
txa
|
||||
>SYSCALL freemem
|
||||
>SYSCALL2 freemem
|
||||
lda #E.OOH
|
||||
sec
|
||||
rts
|
||||
@ -107,7 +106,7 @@ SKT.Socket.FindFree
|
||||
* CC: A = hSOCKET
|
||||
* CS: A = EC
|
||||
*\--------------------------------------
|
||||
SKT.bind >SYSCALL GetMemPtr
|
||||
SKT.bind >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
jsr SKT.PullLocAddr
|
||||
|
||||
@ -127,7 +126,7 @@ SKT.bind >SYSCALL GetMemPtr
|
||||
beq .7
|
||||
|
||||
phx
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPTmpPtr1
|
||||
plx
|
||||
|
||||
@ -168,7 +167,7 @@ SKT.bind >SYSCALL GetMemPtr
|
||||
* CC: A = hSOCKET
|
||||
* CS: A = EC
|
||||
*\--------------------------------------
|
||||
SKT.connect >SYSCALL GetMemPtr
|
||||
SKT.connect >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
jsr SKT.PullRemAddr
|
||||
@ -207,7 +206,7 @@ SKT.connect.SEQPACKET
|
||||
* ## RETURN VALUE
|
||||
* CS: A = EC
|
||||
*\--------------------------------------
|
||||
SKT.listen >SYSCALL GetMemPtr
|
||||
SKT.listen >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldy #S.SOCKET.T
|
||||
@ -244,7 +243,7 @@ SKT.listen >SYSCALL GetMemPtr
|
||||
* ## RETURN VALUE
|
||||
* A = hSocket
|
||||
*\--------------------------------------
|
||||
SKT.Accept >SYSCALL GetMemPtr
|
||||
SKT.Accept >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldy #S.SOCKET.O
|
||||
@ -290,7 +289,7 @@ SKT.Accept >SYSCALL GetMemPtr
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
SKT.shutdown pha
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldy #S.SOCKET.O
|
||||
@ -329,7 +328,7 @@ SKT.shutdown.SEQPACKET
|
||||
txa
|
||||
tay
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
bra .1
|
||||
|
||||
.3 pla get hFD...
|
||||
@ -344,7 +343,7 @@ SKT.shutdown.SEQPACKET
|
||||
bne .4
|
||||
|
||||
.5 stz SKT.TABLE,x
|
||||
>SYSCALL freemem
|
||||
>SYSCALL2 freemem
|
||||
clc
|
||||
rts
|
||||
SKT.shutdown.STREAM
|
||||
@ -393,16 +392,128 @@ SKT.Read jsr SKT.PullhFDDataInPtrLen
|
||||
bcs .99 I/O error
|
||||
|
||||
tay
|
||||
bne .9 eof=true, exit with CC,Y,A = 0
|
||||
beq SKT.GetDataFromSktIn
|
||||
|
||||
jmp SKT.GetDataFromSktIn
|
||||
|
||||
.9 lda #0
|
||||
.9 lda #0 eof=true, exit with CC,Y,A = 0
|
||||
tay
|
||||
rts
|
||||
|
||||
.99 ora #0
|
||||
beq *
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
* In:
|
||||
* Src : hInMem/INTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
* Out:
|
||||
* Y,A = bytes read
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktIn
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
stz ZPTmpPtr3 Reset byte counter
|
||||
stz ZPTmpPtr3+1
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx Check if room left in dest buffer
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
eor SKT.Cache+S.SOCKET.TCP.INHEAD
|
||||
bne .3
|
||||
lda SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
eor SKT.Cache+S.SOCKET.TCP.INHEAD+1
|
||||
beq .7
|
||||
|
||||
.3 lda (ZPTmpPtr2)
|
||||
pha
|
||||
|
||||
inc SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
bne .4
|
||||
|
||||
inc SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
lda SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .4
|
||||
|
||||
stz SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
lda ZPTmpPtr1
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .5
|
||||
|
||||
.4 inc ZPTmpPtr2
|
||||
bne .5
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.5 pla get back data....
|
||||
|
||||
.6 sta (ZPDataInPtr),y
|
||||
iny
|
||||
bne .61
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.61 inc ZPTmpPtr3
|
||||
bne .1
|
||||
inc ZPTmpPtr3+1
|
||||
|
||||
bra .1
|
||||
|
||||
.7 pla discard byte counter HI
|
||||
|
||||
.8 >ADC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPTmpPtr3
|
||||
>SBC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPTmpPtr3
|
||||
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
|
||||
clc
|
||||
adc ZPTmpPtr3
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+2
|
||||
adc ZPTmpPtr3+1
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTACKNUM+2
|
||||
|
||||
bcc .80
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTACKNUM+1
|
||||
bne .80
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTACKNUM
|
||||
|
||||
.80 jsr SKT.StoreTCB
|
||||
|
||||
ldy #S.SOCKET.TCP.O
|
||||
lda (ZPPtrSKT),y
|
||||
ora #S.TCP.OPTIONS.ACK
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
* jsr TCP.OUT.I SKT.GetTCB already called, Try to ACK read DATA
|
||||
|
||||
>LDYA ZPTmpPtr3
|
||||
clc
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # Write (STREAM)
|
||||
@ -428,20 +539,84 @@ SKT.Write jsr SKT.PullhFDDataInPtrLen
|
||||
cpx ZPDataInLen
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTFREE+1
|
||||
sbc ZPDataInLen+1
|
||||
bcc .9 Not enough room in Q
|
||||
|
||||
jsr SKT.AddDataToSktOut will call SKT.GetTCB
|
||||
bcs SKT.AddDataToSktOut
|
||||
|
||||
jsr TCP.OUT.I SKT.GetTCB called, try to push, ignore error....
|
||||
lda #0 Not enough room in Q,no data transfered
|
||||
tay exit with CC,Y,A = 0
|
||||
clc
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktOut
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.Cache+S.SOCKET.TCP.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPDataInPtr),y
|
||||
sta (ZPTmpPtr2)
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.Cache+S.SOCKET.TCP.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTFREE,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTUSED,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataInLen
|
||||
jsr SKT.StoreTCB
|
||||
|
||||
* jsr TCP.OUT.I SKT.GetTCB called, try to push, ignore error....
|
||||
|
||||
>LDYA ZPDataInLen
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #0 no data transfered
|
||||
tay
|
||||
clc
|
||||
.99 rts
|
||||
*/--------------------------------------
|
||||
* # Recv (RAW,DGRAM,SEQPACKET)
|
||||
* # RecvFrom (RAW,DGRAM,SEQPACKET)
|
||||
@ -464,7 +639,7 @@ SKT.RecvFrom pha
|
||||
.HS 90 BCC
|
||||
SKT.Recv clc
|
||||
php
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldy #S.SOCKET.T
|
||||
@ -497,7 +672,7 @@ SKT.Recv clc
|
||||
bcc .9 Exit with CC and A=hFrame
|
||||
|
||||
pha
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPFrameInPtr
|
||||
|
||||
ldy #S.IP.SRC
|
||||
@ -615,7 +790,7 @@ SKT.Send.SEQPACKET
|
||||
* `>LIBCALL hLIBTCPIP,LIBTCPIP.GetSockOpt`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
SKT.getsockopt >SYSCALL GetMemPtr
|
||||
SKT.getsockopt >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
ldy #S.SOCKET.O
|
||||
lda (ZPPtrSKT),y
|
||||
@ -628,16 +803,15 @@ SKT.getsockopt >SYSCALL GetMemPtr
|
||||
* `int setsockopt(hFD fd, short int opts);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHWI opts`
|
||||
* `>PUSHBI opts`
|
||||
* `lda fd`
|
||||
* `>LIBCALL hLIBTCPIP,LIBTCPIP.SetSockOpt`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
SKT.setsockopt >SYSCALL GetMemPtr
|
||||
SKT.setsockopt >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
>PULLA
|
||||
ldy #S.SOCKET.O
|
||||
ora (ZPPtrSKT),y
|
||||
sta (ZPPtrSKT),y
|
||||
* clc
|
||||
rts
|
||||
@ -654,7 +828,7 @@ SKT.setsockopt >SYSCALL GetMemPtr
|
||||
* CC : A = 0 if some data, A = $ff if EOF
|
||||
* CS : A = Socket Error
|
||||
*\--------------------------------------
|
||||
SKT.EOF >SYSCALL GetMemPtr
|
||||
SKT.EOF >SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
SKT.EOF.I ldy #S.SOCKET.TCP.INUSED
|
||||
@ -715,7 +889,7 @@ SKT.GetTable >LDYA L.SKT.Table
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.PullhFDDataInPtrLen
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
>PULLW ZPDataInPtr !!!DataOut trashed when sending ACK in TCP.OUT
|
||||
>PULLW ZPDataInLen !!!use DataInPtr/Len
|
||||
@ -763,7 +937,7 @@ SKT.FindMatchingLocRem
|
||||
beq .8
|
||||
|
||||
phx
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
.DO IPDEBUG=1
|
||||
jsr SKT.Dump
|
||||
@ -892,7 +1066,7 @@ SKT.AddDataToSktIn
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
@ -969,190 +1143,6 @@ SKT.AddDataToSktIn
|
||||
.80 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From SKT.Read
|
||||
* In:
|
||||
* Src : hInMem/INTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
* Out:
|
||||
* Y,A = bytes read
|
||||
*--------------------------------------
|
||||
SKT.GetDataFromSktIn
|
||||
jsr SKT.GetTCB
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
sta ZPTmpPtr2+1
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
stz ZPTmpPtr3 Reset byte counter
|
||||
stz ZPTmpPtr3+1
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx Check if room left in dest buffer
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
eor SKT.Cache+S.SOCKET.TCP.INHEAD
|
||||
bne .3
|
||||
lda SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
eor SKT.Cache+S.SOCKET.TCP.INHEAD+1
|
||||
beq .7
|
||||
|
||||
.3 lda (ZPTmpPtr2)
|
||||
pha
|
||||
|
||||
inc SKT.Cache+S.SOCKET.TCP.INTAIL
|
||||
bne .4
|
||||
|
||||
inc SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
lda SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .4
|
||||
|
||||
stz SKT.Cache+S.SOCKET.TCP.INTAIL+1
|
||||
lda ZPTmpPtr1
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .5
|
||||
|
||||
.4 inc ZPTmpPtr2
|
||||
bne .5
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.5 pla get back data....
|
||||
|
||||
.6 sta (ZPDataInPtr),y
|
||||
iny
|
||||
bne .61
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.61 inc ZPTmpPtr3
|
||||
bne .1
|
||||
inc ZPTmpPtr3+1
|
||||
|
||||
bra .1
|
||||
|
||||
.7 pla discard byte counter HI
|
||||
|
||||
.8 >ADC16 SKT.Cache+S.SOCKET.TCP.INFREE,ZPTmpPtr3
|
||||
>SBC16 SKT.Cache+S.SOCKET.TCP.INUSED,ZPTmpPtr3
|
||||
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
|
||||
clc
|
||||
adc ZPTmpPtr3
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTACKNUM+3
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTACKNUM+2
|
||||
adc ZPTmpPtr3+1
|
||||
sta SKT.Cache+S.SOCKET.TCP.OUTACKNUM+2
|
||||
|
||||
bcc .80
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTACKNUM+1
|
||||
bne .80
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTACKNUM
|
||||
|
||||
.80 jsr SKT.StoreTCB
|
||||
|
||||
ldy #S.SOCKET.TCP.O
|
||||
lda (ZPPtrSKT),y
|
||||
ora #S.TCP.OPTIONS.ACK
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
jsr TCP.OUT.I SKT.GetTCB already called, Try to ACK read DATA
|
||||
|
||||
>LDYA ZPTmpPtr3
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* From SKT.Write.TCP
|
||||
* Src : ZPDataInPtr/ZPDataInLen
|
||||
* Dst : hOutMem/OUTHEAD
|
||||
*--------------------------------------
|
||||
SKT.AddDataToSktOut
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
clc
|
||||
adc SKT.Cache+S.SOCKET.TCP.OUTHEAD
|
||||
sta ZPTmpPtr2
|
||||
|
||||
lda ZPTmpPtr1+1
|
||||
adc SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
sta ZPTmpPtr2+1 Make ZPTmpPtr2=base+Tail
|
||||
|
||||
lda ZPDataInLen
|
||||
eor #$FF
|
||||
tax
|
||||
|
||||
lda ZPDataInLen+1
|
||||
eor #$FF
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
bne .2
|
||||
pla
|
||||
inc
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPDataInPtr),y
|
||||
sta (ZPTmpPtr2)
|
||||
iny
|
||||
bne .3
|
||||
inc ZPDataInPtr+1
|
||||
|
||||
.3 inc ZPTmpPtr2
|
||||
bne .4
|
||||
inc ZPTmpPtr2+1
|
||||
|
||||
.4 inc SKT.Cache+S.SOCKET.TCP.OUTHEAD
|
||||
bne .1
|
||||
inc SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
lda SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
stz SKT.Cache+S.SOCKET.TCP.OUTHEAD+1
|
||||
|
||||
lda ZPTmpPtr1 Dst Ptr=Buffer Base
|
||||
sta ZPTmpPtr2
|
||||
lda ZPTmpPtr1+1
|
||||
sta ZPTmpPtr2+1
|
||||
bra .1
|
||||
|
||||
.8 >SBC16 SKT.Cache+S.SOCKET.TCP.OUTFREE,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTUSED,ZPDataInLen
|
||||
>ADC16 SKT.Cache+S.SOCKET.TCP.OUTTOSEND,ZPDataInLen
|
||||
jmp SKT.StoreTCB
|
||||
*--------------------------------------
|
||||
* From TCP.OUT
|
||||
* Src : hOutMem/OUTTAIL
|
||||
* Dst : ZPDataOutPtr/ZPDataOutLen
|
||||
@ -1161,7 +1151,7 @@ SKT.GetDataFromSktOut
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPPtrSKT),y
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
|
||||
|
||||
lda ZPTmpPtr1
|
||||
@ -1282,7 +1272,7 @@ SKT.NewTCB ldx #S.SOCKET.TCP.INTAIL
|
||||
|
||||
>LDYAI K.TCP.WSIZE
|
||||
>STYA SKT.Cache+S.SOCKET.TCP.INFREE
|
||||
>SYSCALL getmem
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
txa
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
@ -1290,7 +1280,7 @@ SKT.NewTCB ldx #S.SOCKET.TCP.INTAIL
|
||||
|
||||
>LDYAI K.TCP.WSIZE
|
||||
>STYA SKT.Cache+S.SOCKET.TCP.OUTFREE
|
||||
>SYSCALL getmem
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
txa
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
@ -1305,6 +1295,14 @@ SKT.NewTCB ldx #S.SOCKET.TCP.INTAIL
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
SKT.GetTCB ldy #S.SOCKET.TCP.INTAIL
|
||||
.1 lda (ZPPtrSKT),y
|
||||
sta SKT.Cache,y
|
||||
iny
|
||||
cpy #S.SOCKET.TCP
|
||||
bne .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.StoreTCB.S ldy #S.SOCKET.TCP.S
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
@ -1317,14 +1315,6 @@ SKT.StoreTCB ldy #S.SOCKET.TCP.INTAIL
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.GetTCB ldy #S.SOCKET.TCP.INTAIL
|
||||
.1 lda (ZPPtrSKT),y
|
||||
sta SKT.Cache,y
|
||||
iny
|
||||
cpy #S.SOCKET.TCP
|
||||
bne .1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.SetFrameOutDstIP
|
||||
ldy #S.SOCKET.REM.ADDR
|
||||
ldx #4
|
||||
@ -1405,6 +1395,7 @@ SKT.CopyDataInToOut
|
||||
pla
|
||||
sta ZPDataInPtr+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBTCPIP.S.SKT
|
||||
LOAD USR/SRC/LIB/LIBTCPIP.S
|
||||
|
@ -1,16 +1,8 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
TCP.IN
|
||||
* ldy #S.TCP.OPTIONS
|
||||
* lda (ZPFrameInPtr),y
|
||||
* cmp #S.TCP.OPTIONS.ACK
|
||||
* bne .1
|
||||
* >DEBUG
|
||||
*.1
|
||||
jsr FRM.GetTargetSKT.TCPUDP
|
||||
TCP.IN jsr FRM.GetTargetSKT.TCPUDP
|
||||
|
||||
jsr SKT.FindMatchingLocRem
|
||||
bcs TCP.IN.JMP.CLOSED no socket, go discard
|
||||
@ -37,45 +29,53 @@ TCP.IN.RST lda SKT.TABLE,x
|
||||
TCP.IN.JMP.CLOSED
|
||||
lda hFrameIn
|
||||
stz hFrameIn
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
rts
|
||||
*--------------------------------------
|
||||
TCP.CLOSE ldx #0
|
||||
TCP.SENDCLOSE ldx #0
|
||||
|
||||
.1 phx
|
||||
lda SKT.TABLE,x
|
||||
beq .8
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPTmpPtr1
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldy #S.SOCKET.AF
|
||||
lda (ZPTmpPtr1),y
|
||||
lda (ZPPtrSKT),y
|
||||
cmp #AF.INET
|
||||
bne .8
|
||||
|
||||
iny #S.SOCKET.T
|
||||
|
||||
lda (ZPTmpPtr1),y
|
||||
lda (ZPPtrSKT),y
|
||||
cmp #S.SOCKET.T.SEQPACKET
|
||||
bcc .8
|
||||
|
||||
ldy #S.SOCKET.TCP.S
|
||||
lda (ZPTmpPtr1),y
|
||||
lda (ZPPtrSKT),y
|
||||
cmp #S.SOCKET.TCP.S.TIMEWT
|
||||
beq .4
|
||||
|
||||
cmp #S.SOCKET.TCP.S.ESTBLSH
|
||||
bne .8
|
||||
|
||||
ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPTmpPtr1),y
|
||||
>SYSCALL freemem
|
||||
jsr TCP.OUT
|
||||
|
||||
bra .8
|
||||
|
||||
.4 ldy #S.SOCKET.SQ.hInMem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL2 freemem
|
||||
|
||||
ldy #S.SOCKET.SQ.hOutMem
|
||||
lda (ZPTmpPtr1),y
|
||||
>SYSCALL freemem
|
||||
lda (ZPPtrSKT),y
|
||||
>SYSCALL2 freemem
|
||||
|
||||
plx
|
||||
phx
|
||||
lda SKT.TABLE,x
|
||||
>SYSCALL freemem
|
||||
>SYSCALL2 freemem
|
||||
|
||||
plx
|
||||
phx
|
||||
@ -437,7 +437,7 @@ TCP.OUT.I lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
|
||||
|
||||
ldy #S.SOCKET.TCP.O
|
||||
lda (ZPPtrSKT),y
|
||||
ora #S.TCP.OPTIONS.ACK
|
||||
ora #S.TCP.OPTIONS.ACK+S.TCP.OPTIONS.PSH
|
||||
jsr TCP.OUT.SendOptA.1
|
||||
|
||||
bcs TCP.OUT.9
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
UDP.IN jsr FRM.GetTargetSKT.TCPUDP
|
||||
@ -18,7 +17,7 @@ UDP.IN jsr FRM.GetTargetSKT.TCPUDP
|
||||
bcc .8
|
||||
|
||||
.9 lda hFrameIn Q full, discard...
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL2 FreeMem
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -1,6 +1,5 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
@ -223,9 +222,9 @@ PULSE and #S.EVT.F.T1SEC
|
||||
|
||||
jsr ARP.EXPIRE
|
||||
jsr DNS.EXPIRE
|
||||
jsr TCP.CLOSE
|
||||
|
||||
.1 jsr DNS.POLL
|
||||
.1 jsr TCP.SENDCLOSE
|
||||
jsr DNS.POLL
|
||||
jmp FRM.RETRY
|
||||
*--------------------------------------
|
||||
GetDynPort inc DYNPORT.LAST
|
||||
@ -293,7 +292,7 @@ FRM.Dump ldy #S.TCPUDP.DSTPORT
|
||||
|
||||
>PUSHBI 12
|
||||
>LDYA L.MSG.FRM.Dump
|
||||
>SYSCALL Printf
|
||||
>SYSCALL2 Printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.Dump ldy #S.SOCKET.REM.PORT+1
|
||||
@ -338,7 +337,7 @@ SKT.Dump ldy #S.SOCKET.REM.PORT+1
|
||||
|
||||
>PUSHBI 12
|
||||
>LDYA L.MSG.SKT.Dump
|
||||
>SYSCALL Printf
|
||||
>SYSCALL2 Printf
|
||||
rts
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
|
@ -108,7 +108,9 @@ CS.RUN ldy #S.PS.ARGC
|
||||
|
||||
>STA.G hFILE
|
||||
|
||||
CS.RUN.LOOP0 >LDYA L.ENV.TERM
|
||||
CS.RUN.LOOP0 >SLEEP
|
||||
|
||||
>LDYA L.ENV.TERM
|
||||
>SYSCALL UnSetEnv
|
||||
|
||||
.1 >PUSHWI TELNETOPTS.LEN
|
||||
@ -329,7 +331,7 @@ TELNETOPTS .DA #IAC,#WILL,#TELOPT.BINARY
|
||||
.DA #IAC,#WILL,#TELOPT.ECHO
|
||||
.DA #IAC,#WILL,#TELOPT.SGA
|
||||
.DA #IAC,#DO,#TELOPT.SGA
|
||||
.DA #IAC,#DO,#TELOPT.NAWS
|
||||
* .DA #IAC,#DO,#TELOPT.NAWS
|
||||
.DA #IAC,#DO,#TELOPT.TTYPE
|
||||
.DA #IAC,#DO,#TELOPT.LINEMODE
|
||||
TELNETOPTS.LEN .EQ *-TELNETOPTS
|
||||
|
@ -90,7 +90,7 @@ CS.RUN jsr Init.Timeout
|
||||
bne .1
|
||||
|
||||
>LDYA L.MSG.ABORT
|
||||
>SYSCALL printf
|
||||
>SYSCALL puts
|
||||
lda #3
|
||||
clc
|
||||
rts
|
||||
@ -135,7 +135,7 @@ CS.RUN.INIT ldx #3
|
||||
>STA.G hLineBuf
|
||||
|
||||
>LDYA L.MSG.INITOK
|
||||
>SYSCALL printf
|
||||
>SYSCALL puts
|
||||
|
||||
CS.RUN.LOOP >SLEEP
|
||||
jsr CS.RUN.SERVER
|
||||
@ -144,7 +144,7 @@ CS.RUN.LOOP >SLEEP
|
||||
bra CS.RUN.LOOP
|
||||
|
||||
.9 >LDYA L.MSG.SKTERR
|
||||
>SYSCALL printf
|
||||
>SYSCALL puts
|
||||
lda #E.SYN
|
||||
sec
|
||||
|
||||
|
@ -12,10 +12,16 @@ NEW
|
||||
.INB INC/NET.TELNET.I
|
||||
*--------------------------------------
|
||||
CONN.MAX .EQ 16
|
||||
TIMEOUT.MAX .EQ 30 30 sec.
|
||||
TIMEOUT.MAX .EQ 200 20 sec.
|
||||
*--------------------------------------
|
||||
ZPIPCfgPtr .EQ ZPBIN
|
||||
ZPSktPtr .EQ ZPBIN+2
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPIPCfgPtr .BS 2
|
||||
ZPSktPtr .BS 2
|
||||
TimeOut .BS 1
|
||||
ZS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
@ -57,7 +63,8 @@ CS.INIT >LDYA L.LIBTCPIP
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN jsr Init.Timeout
|
||||
CS.RUN lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
>LDYA L.MSG.TCPWAIT
|
||||
>SYSCALL puts
|
||||
@ -71,8 +78,8 @@ CS.RUN jsr Init.Timeout
|
||||
lda (ZPIPCfgPtr) Configured ?
|
||||
bmi CS.RUN.INIT
|
||||
|
||||
jsr Wait.Timeout
|
||||
bcs .99
|
||||
lda Timeout
|
||||
beq .99
|
||||
|
||||
ldy #S.PS.hStdIn
|
||||
lda (pPs),y
|
||||
@ -231,11 +238,10 @@ CS.RUN.CLIENT >SLEEP give some time for TCPIP SYN/ACK
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .9 is it a TIMER event?
|
||||
|
||||
>LDA.G TimeOut
|
||||
lda TimeOut
|
||||
beq .9
|
||||
|
||||
dec
|
||||
sta (pData),y
|
||||
dec TimeOut
|
||||
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
@ -267,16 +273,6 @@ CS.QUIT ldx #CONN.MAX
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
Init.Timeout lda #TIMEOUT.MAX
|
||||
>STA.G TimeOut
|
||||
rts
|
||||
*--------------------------------------
|
||||
Wait.TimeOut sec
|
||||
>LDA.G TimeOut
|
||||
beq .9
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
hLIBTCPIP .BS 1
|
||||
@ -305,7 +301,6 @@ SktIndex .BS 1
|
||||
hSrvSocket .BS 1
|
||||
hClientSocket .BS 1
|
||||
hClientFile .BS 1
|
||||
TimeOut .BS 1
|
||||
NodBuf .BS 11
|
||||
CmdBuf .BS 65
|
||||
DS.END
|
||||
|
@ -417,13 +417,6 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
K.GUIOSD.JMP sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
jsr X.GUIOSD
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.SYSCALL.Go bit K.SYSCALL.BANK,x Get Target BNK
|
||||
bpl K.SYSCALL.JMP 0, E000, no BNK change
|
||||
|
||||
@ -454,8 +447,16 @@ K.SYSCALL.GoB sta .7+1
|
||||
|
||||
.6 ldx #$ff SELF MODIFIED
|
||||
.7 lda #$ff SELF MODIFIED
|
||||
|
||||
K.SYSCALL.JMP jmp (K.SYSCALL,x)
|
||||
*--------------------------------------
|
||||
K.GUIOSD.JMP sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
jsr X.GUIOSD
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/SYS/KERNEL.S.JMP
|
||||
LOAD USR/SRC/SYS/KERNEL.S
|
||||
|
@ -519,13 +519,11 @@ K.FreeStkObj ldx #SYS.FreeMem
|
||||
sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
jsr MEM.Kernel.JMP
|
||||
jsr K.SYSCALL.JMP
|
||||
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
|
||||
MEM.Kernel.JMP jmp (SYS.Kernel.JMP,x)
|
||||
*/--------------------------------------
|
||||
* # LoadStkObj
|
||||
* Load a file in AUX memory (Stock Objects)
|
||||
|
@ -163,6 +163,10 @@ PS.CreateChild ldx #0
|
||||
dey
|
||||
sta (PS.NewPSPtr),y
|
||||
|
||||
lda #S.PS.F.NOHUP
|
||||
bit PS.Flags
|
||||
bne .80
|
||||
|
||||
ldy #S.PS.hStdIn
|
||||
|
||||
.81 lda (pPs),y
|
||||
@ -171,21 +175,27 @@ PS.CreateChild ldx #0
|
||||
cpy #S.PS.hStdErr+1
|
||||
bne .81
|
||||
|
||||
ldy #S.PS.hSID
|
||||
lda (pPs),y
|
||||
sta (PS.NewPSPtr),y
|
||||
|
||||
lda #S.PS.F.NOHUP
|
||||
bit PS.Flags
|
||||
bne .5
|
||||
|
||||
ldy #S.PS.PID
|
||||
lda (pPs),y
|
||||
|
||||
ldy #S.PS.PPID
|
||||
sta (PS.NewPSPtr),y
|
||||
bra .5
|
||||
|
||||
.5 lda #S.PS.F.HOLD
|
||||
.80 lda #1 /DEV/CONSOLE
|
||||
|
||||
ldy #S.PS.hStdIn
|
||||
|
||||
.83 sta (PS.NewPSPtr),y
|
||||
iny
|
||||
cpy #S.PS.hStdErr+1
|
||||
bne .83
|
||||
|
||||
.5 ldy #S.PS.hSID
|
||||
lda (pPs),y
|
||||
sta (PS.NewPSPtr),y
|
||||
|
||||
lda #S.PS.F.HOLD
|
||||
bit PS.Flags
|
||||
beq .82
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user