mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-01 14:29:40 +00:00
Kernel 0.9.2
This commit is contained in:
parent
c7a0656f45
commit
aad4c9a8b8
@ -203,7 +203,7 @@ Load a file in memory
|
||||
# open
|
||||
|
||||
## C
|
||||
`int open(const char *pathname, int flags);`
|
||||
`hFD open(const char *pathname, int flags);`
|
||||
|
||||
## ASM
|
||||
**In:**
|
||||
@ -977,13 +977,19 @@ Copy string
|
||||
Y,A = destination
|
||||
|
||||
# StrMatch
|
||||
Compare a String against pattern
|
||||
Compare a String against pattern (e.g. '*test?.txt')
|
||||
|
||||
## C
|
||||
`int * strmatch ( char * s, const char * pattern );`
|
||||
|
||||
## ASM
|
||||
**In:**
|
||||
PUSHW = PTR to Pattern (e.g. '*test?.txt')
|
||||
PUSHW = PTR to Src String
|
||||
`>PUSHWI pattern`
|
||||
`>LDYAI s`
|
||||
`>SYSCALL strmatch`
|
||||
**Out:**
|
||||
CC : match
|
||||
CS : no match
|
||||
CC : match
|
||||
CS : no match
|
||||
|
||||
# StrUpr/StrLwr
|
||||
Convert string to UPPERCASE/lowercase
|
||||
|
@ -57,7 +57,7 @@
|
||||
**In:**
|
||||
PUSHW = PTR to S.SOCKET template
|
||||
**Out:**
|
||||
YA = PTR to new S.SOCKET
|
||||
Y,A = PTR to new S.SOCKET
|
||||
X = hSocket
|
||||
|
||||
# SKT.Close
|
||||
@ -93,50 +93,6 @@
|
||||
**Out:**
|
||||
A = hFile
|
||||
|
||||
# SKT.Write (DGRAM,STREAM,RAW)
|
||||
Send block of data
|
||||
**In:**
|
||||
PUSHB = hSocket
|
||||
PUSHW = pBuf
|
||||
PUSHW = len
|
||||
**Out:**
|
||||
|
||||
# SKT.ReadFrame (DGRAM,RAW)
|
||||
**In:**
|
||||
A = hSocket
|
||||
**Out:**
|
||||
A = hFrame
|
||||
|
||||
# SKT.PutC (STREAM)
|
||||
Write a Char To Stream
|
||||
**In:**
|
||||
PUSHB = hSocket
|
||||
PUSHB = Char
|
||||
**Out:**
|
||||
|
||||
# SKT.PutS (STREAM)
|
||||
Write Line in pBuf
|
||||
**In:**
|
||||
PUSHB = hSocket
|
||||
PUSHW = PSTR
|
||||
**Out:**
|
||||
|
||||
# SKT.GetC.A (STREAM)
|
||||
Read a Char From Stream in A
|
||||
**In:**
|
||||
A = hSocket
|
||||
**Out:**
|
||||
A = char
|
||||
|
||||
# SKT.GetS (STREAM)
|
||||
Read a CR terminated Line in pBuf
|
||||
**In:**
|
||||
PUSHB = hSocket
|
||||
PUSHW = pBuf
|
||||
PUSHW = len
|
||||
**Out:**
|
||||
Y,A = bytes read
|
||||
|
||||
# SKT.Read (STREAM)
|
||||
Read data in pBuf
|
||||
**In:**
|
||||
@ -145,3 +101,23 @@
|
||||
PUSHW = len
|
||||
**Out:**
|
||||
Y,A = bytes transfered
|
||||
|
||||
# SKT.Write (STREAM)
|
||||
Send block of data
|
||||
**In:**
|
||||
PUSHB = hSocket
|
||||
PUSHW = pBuf
|
||||
PUSHW = len
|
||||
**Out:**
|
||||
|
||||
# SKT.Rcvd (DGRAM,RAW)
|
||||
**In:**
|
||||
A = hSocket
|
||||
**Out:**
|
||||
A = hFrame
|
||||
|
||||
# SKT.Send (DGRAM,RAW)
|
||||
**In:**
|
||||
A = hSocket
|
||||
**Out:**
|
||||
A = hFrame
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -137,7 +137,7 @@ CS.RUN >SYSCALL GetChar
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHW ZPFileName
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
|
@ -125,7 +125,7 @@ CS.RUN >SYSCALL GetChar
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHW ZPFileName
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
|
@ -18,6 +18,7 @@ hDstFileName .BS 1
|
||||
hDstFullPath .BS 1
|
||||
hDstFile .BS 1
|
||||
bCopy .BS 1
|
||||
hCopyBuf .BS 1
|
||||
CopyRC .BS 1
|
||||
|
||||
.FIN
|
||||
|
@ -228,7 +228,7 @@ CS.RUN >SYSCALL GetChar
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHW ZPFileName
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
bcs CS.RUN.NEXT no match, skip....
|
||||
|
||||
@ -427,7 +427,6 @@ CS.RUN.FILE jsr CS.RUN.FILE.MSG
|
||||
ldy #hDstBasePath
|
||||
jsr CS.RUN.GetPathY
|
||||
|
||||
>PUSHYA
|
||||
>SYSCALL StrMatch
|
||||
bcs .3 not same dir, go copy/delete
|
||||
|
||||
@ -606,13 +605,14 @@ CS.RUN.Open phy Save Filename
|
||||
>SYSCALL FOpen
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.Copy stz .90+1
|
||||
CS.RUN.Copy >STZ.G hCopyBuf
|
||||
>LDYAI X.COPY.BUF.SIZE
|
||||
>SYSCALL getmem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr1
|
||||
stx .90+1
|
||||
txa
|
||||
>STA.G hCopyBuf
|
||||
|
||||
>PUSHWI X.COPY.BUF.SIZE Bytes To Read
|
||||
>PUSHW ZPPtr1 Dst Ptr
|
||||
@ -624,15 +624,13 @@ CS.RUN.Copy stz .90+1
|
||||
lda #0
|
||||
bra .9
|
||||
|
||||
.1 >STYA ZPPtr2
|
||||
|
||||
>PUSHW ZPPtr2 Bytes To Write
|
||||
.1 >PUSHYA Bytes To Write
|
||||
>PUSHW ZPPtr1 Src Ptr
|
||||
>LDA.G hDstFile
|
||||
>SYSCALL FWrite
|
||||
bcs .9
|
||||
|
||||
lda .90+1
|
||||
>LDA.G hCopyBuf
|
||||
>SYSCALL FreeMem
|
||||
|
||||
ldy #bQuiet
|
||||
@ -649,14 +647,14 @@ CS.RUN.Copy stz .90+1
|
||||
.9 ldy #CopyRC
|
||||
sta (pData),y
|
||||
|
||||
.90 lda #$00
|
||||
>LDA.G hCopyBuf
|
||||
beq CS.RUN.CopyEnd
|
||||
>SYSCALL FreeMem
|
||||
*--------------------------------------
|
||||
CS.RUN.CopyEnd >LDA.G hSrcFile
|
||||
>SYSCALL fclose
|
||||
|
||||
ldy #hDstFile
|
||||
>LDA.G hDstFile
|
||||
lda (pData),y
|
||||
>SYSCALL fclose
|
||||
|
||||
@ -677,7 +675,7 @@ CS.RUN.CheckErr bcs .1
|
||||
|
||||
>LDYA L.MSG.OK
|
||||
>SYSCALL puts
|
||||
rts
|
||||
.8 rts
|
||||
|
||||
.1 ldy #RC
|
||||
sta (pData),y
|
||||
@ -693,15 +691,11 @@ CS.RUN.CheckErr bcs .1
|
||||
>LDYA L.MSG.ERR
|
||||
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
rts
|
||||
|
||||
.2 jsr CS.RUN.CR
|
||||
pla
|
||||
sec
|
||||
.9 rts
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.BuildFilePath
|
||||
|
@ -352,7 +352,7 @@ SKT.Read.I jsr SKT.Get.I
|
||||
|
||||
ldy #S.SOCKET.TCP.STATUS
|
||||
lda (ZPPtrSKT),y
|
||||
cmp #S.SOCKET.TCP.STATUS.ESTBLSH
|
||||
cmp #S.SOCKET.TCP.STATUS.FINWT2
|
||||
bcc .92 Not yet established...no data
|
||||
bne .91 closing...IO err
|
||||
|
||||
|
@ -286,37 +286,18 @@ TCP.IN.JMP.LASTACK
|
||||
TCP.IN.JMP.FINWT1
|
||||
ldy #S.TCP.OPTIONS only accept ACK packet
|
||||
lda (ZPFrameInPtr),y
|
||||
cmp #S.TCP.OPTIONS.ACK
|
||||
bne .1
|
||||
bit #S.TCP.OPTIONS.ACK
|
||||
beq TCP.IN.JMP.FINWT2.1
|
||||
|
||||
ldy #S.SOCKET.TCP.STATUS
|
||||
lda #S.SOCKET.TCP.STATUS.FINWT2
|
||||
sta (ZPPtrSKT),y
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 cmp #S.TCP.OPTIONS.FIN
|
||||
bne .8
|
||||
|
||||
ldy #S.SOCKET.TCP.OPTIONS
|
||||
lda (ZPPtrSKT),y
|
||||
ora #S.TCP.OPTIONS.ACK
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
jsr TCP.OUT FINWT1, Ack the FIN
|
||||
bcs .9
|
||||
|
||||
ldy #S.SOCKET.TCP.STATUS
|
||||
lda #S.SOCKET.TCP.STATUS.CLOSING
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
TCP.IN.JMP.FINWT2
|
||||
ldy #S.TCP.OPTIONS only accept FIN packet
|
||||
lda (ZPFrameInPtr),y
|
||||
cmp #S.TCP.OPTIONS.FIN
|
||||
TCP.IN.JMP.FINWT2.1
|
||||
bit #S.TCP.OPTIONS.FIN
|
||||
bne .8
|
||||
|
||||
ldy #S.SOCKET.TCP.OPTIONS
|
||||
@ -433,6 +414,7 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTTOSEND+1
|
||||
|
||||
ldy #S.SOCKET.TCP.OPTIONS
|
||||
lda (ZPPtrSKT),y
|
||||
ora #S.TCP.OPTIONS.ACK
|
||||
jsr TCP.OUT.SendOptA.1
|
||||
|
||||
bcs TCP.OUT.9
|
||||
@ -464,6 +446,8 @@ TCP.OUT.SendOptA
|
||||
TCP.OUT.SendOptA.1
|
||||
ldy #S.TCP.OPTIONS
|
||||
sta (ZPFrameOutPtr),y
|
||||
bit #S.TCP.OPTIONS.ACK
|
||||
beq .10
|
||||
|
||||
ldx #3
|
||||
ldy #S.TCP.ACKNUM+3
|
||||
@ -474,7 +458,7 @@ TCP.OUT.SendOptA.1
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldx #3
|
||||
.10 ldx #3
|
||||
ldy #S.TCP.SEQNUM+3
|
||||
|
||||
.2 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
|
||||
|
@ -84,15 +84,20 @@ K.StrCpy clc
|
||||
.8 rts
|
||||
*/--------------------------------------
|
||||
* # StrMatch
|
||||
* Compare a String against pattern
|
||||
* Compare a String against pattern (e.g. '*test?.txt')
|
||||
* ## C
|
||||
* `int * strmatch ( char * s, const char * pattern );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* PUSHW = PTR to Pattern (e.g. '*test?.txt')
|
||||
* PUSHW = PTR to Src String
|
||||
* `>PUSHWI pattern`
|
||||
* `>LDYAI s`
|
||||
* `>SYSCALL strmatch`
|
||||
* **Out:**
|
||||
* CC : match
|
||||
* CS : no match
|
||||
* CC : match
|
||||
* CS : no match
|
||||
*\--------------------------------------
|
||||
K.StrMatch jsr MEM.PullP1P2
|
||||
K.StrMatch >STYA ZPPtr1 s
|
||||
>PULLW ZPPtr2 pattern
|
||||
|
||||
lda (ZPPtr2) Get pattern 1st byte
|
||||
beq .8 Match always if empty
|
||||
|
Loading…
x
Reference in New Issue
Block a user