mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-07 17:29:34 +00:00
Kernel 0.92
This commit is contained in:
parent
a4b457498f
commit
65e347ad36
|
@ -82,10 +82,11 @@ X = DevID
|
|||
Create a hDEV
|
||||
|
||||
## C
|
||||
`hDEV mkdev (S.FD * fd)`
|
||||
`hDEV mkdev (S.FD * fd, const char *devname)`
|
||||
|
||||
## ASM
|
||||
`>LDYA FD.DEV`
|
||||
`>PUSHW devname`
|
||||
`>LDYA fd`
|
||||
`>SYSCALL mkdev
|
||||
|
||||
## RETURN VALUE
|
||||
|
@ -1122,22 +1123,6 @@ CC : success
|
|||
X = hMem of Full Path
|
||||
CS : A = Error Code
|
||||
|
||||
# StrMatch
|
||||
Compare a String against pattern (e.g. '*test?.txt')
|
||||
|
||||
## C
|
||||
`int * strmatch ( char * s, const char * pattern );`
|
||||
|
||||
## ASM
|
||||
**In:**
|
||||
`>PUSHWI pattern`
|
||||
`>LDYAI s`
|
||||
`>SYSCALL strmatch`
|
||||
|
||||
## RETURN VALUE
|
||||
CC : match
|
||||
CS : no match
|
||||
|
||||
# StrLen
|
||||
Returns Length of C-String
|
||||
|
||||
|
|
Binary file not shown.
|
@ -149,9 +149,7 @@ CS.RUN >SYSCALL GetChar
|
|||
.11 pla
|
||||
>SYSCALL GetMemPtr
|
||||
|
||||
.12 >PUSHYA
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
.12 jsr StrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
|
|
|
@ -131,9 +131,7 @@ CS.RUN >SYSCALL GetChar
|
|||
.11 pla
|
||||
>SYSCALL GetMemPtr
|
||||
|
||||
.12 >PUSHYA
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
.12 jsr StrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
|
|
|
@ -232,9 +232,7 @@ CS.RUN >SYSCALL GetChar
|
|||
.11 pla
|
||||
>SYSCALL GetMemPtr
|
||||
|
||||
.12 >PUSHYA
|
||||
>LDYA ZPFileName
|
||||
>SYSCALL StrMatch
|
||||
.12 jsr StrMatch
|
||||
bcs CS.RUN.NEXT no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
|
@ -431,7 +429,7 @@ CS.RUN.FILE jsr CS.RUN.FILE.MSG
|
|||
ldy #hDstBasePath
|
||||
jsr CS.RUN.GetPathY
|
||||
|
||||
>SYSCALL StrMatch
|
||||
>SYSCALL StrCaseCmp
|
||||
bcs .3 not same dir, go copy/delete
|
||||
|
||||
jsr CS.RUN.Rename
|
||||
|
|
|
@ -13,6 +13,75 @@ X.MAX.RECURSE .EQ 8
|
|||
* hDstBasePath .BS 1 (optional)
|
||||
* STAT .BS S.STAT
|
||||
*--------------------------------------
|
||||
* Compare a ZPFileName against pattern in Y,A (e.g. '*test?.txt')
|
||||
* CC : match
|
||||
* CS : no match
|
||||
*--------------------------------------
|
||||
StrMatch >STYA ZPPtr2
|
||||
|
||||
lda (ZPPtr2) Get pattern 1st byte
|
||||
beq .8 Match always if empty
|
||||
|
||||
ldy #0
|
||||
|
||||
bra .21
|
||||
|
||||
.1 inc ZPPtr2 Make PTR2 (pattern) advance to next char
|
||||
bne .2
|
||||
inc ZPPtr2+1
|
||||
|
||||
.2 lda (ZPPtr2) get pattern char
|
||||
beq .41 end of pattern...
|
||||
|
||||
.21 cmp #'*'
|
||||
beq .5
|
||||
|
||||
.3 lda (ZPFileName) we must match ? or regular char, check if at end of string
|
||||
beq .9 no char left, exit with error
|
||||
|
||||
lda (ZPPtr2) get back pattern char
|
||||
cmp #'?'
|
||||
beq .4 no need to compare, any char will match
|
||||
cmp (ZPFileName),y Regular Char, compare with string at Y
|
||||
bne .9 no match, exit
|
||||
|
||||
.4 iny advance to next char to compare
|
||||
bra .1 continue if remaining char in pattern
|
||||
|
||||
.41 lda (ZPFileName),y end of pattern, but end of string ?
|
||||
|
||||
beq .8 yes, string matched entirely
|
||||
* no, remaining char in string, no match
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.5 inc ZPPtr2 Make PTR2 advance to next char
|
||||
bne .6
|
||||
inc ZPPtr2+1
|
||||
|
||||
.6 lda (ZPPtr2) we have '*', last char of pattern ?
|
||||
beq .8 yes, match everything, including empty string
|
||||
|
||||
lda (ZPPtr2) get next char of pattern
|
||||
cmp #'*' another '*' ?
|
||||
beq .5 yes, '**' = '*', go next char
|
||||
cmp #'?' '*?' ? we must match a least one char
|
||||
beq .3
|
||||
|
||||
.7 lda (ZPFileName),y we need at least one remaining char in string, check if at end of string
|
||||
beq .9 no chance to match ? or regular char
|
||||
|
||||
iny
|
||||
lda (ZPPtr2) get again char in pattern
|
||||
cmp (ZPFileName),y compare with char in string
|
||||
bne .7 not equal to next non wildcard in pattern
|
||||
|
||||
iny
|
||||
bra .1 go check remaining char in pattern...
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
InitSrcDirYA >SYSCALL RealPath
|
||||
bcc .10
|
||||
rts
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -201,7 +201,7 @@ SYS.StrToF .EQ $76
|
|||
SYS.StrToL .EQ $78
|
||||
* .EQ $7A
|
||||
SYS.RealPath .EQ $7C
|
||||
SYS.StrMatch .EQ $7E
|
||||
* .EQ $7E
|
||||
*--------------------------------------
|
||||
SYS.StrLen .EQ $80
|
||||
SYS.StrCpy .EQ $82
|
||||
|
|
|
@ -76,7 +76,7 @@ K.SYSCALL.JMP .DA 0 $00
|
|||
.DA K.StrToL
|
||||
.DA 0
|
||||
.DA K.RealPath
|
||||
.DA K.StrMatch
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Bank 2
|
||||
*--------------------------------------
|
||||
|
|
|
@ -448,84 +448,6 @@ K.RealPath.RemoveAtX
|
|||
|
||||
.8 plx
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # StrMatch
|
||||
* Compare a String against pattern (e.g. '*test?.txt')
|
||||
* ## C
|
||||
* `int * strmatch ( char * s, const char * pattern );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHWI pattern`
|
||||
* `>LDYAI s`
|
||||
* `>SYSCALL strmatch`
|
||||
* ## RETURN VALUE
|
||||
* CC : match
|
||||
* CS : no match
|
||||
*\--------------------------------------
|
||||
K.StrMatch jsr MEM.SPtr1PPtr2
|
||||
|
||||
lda (ZPPtr2) Get pattern 1st byte
|
||||
beq .8 Match always if empty
|
||||
|
||||
ldy #0
|
||||
|
||||
bra .21
|
||||
|
||||
.1 inc ZPPtr2 Make PTR2 (pattern) advance to next char
|
||||
bne .2
|
||||
inc ZPPtr2+1
|
||||
|
||||
.2 lda (ZPPtr2) get pattern char
|
||||
beq .41 end of pattern...
|
||||
|
||||
.21 cmp #'*'
|
||||
beq .5
|
||||
|
||||
.3 lda (ZPPtr1) we must match ? or regular char, check if at end of string
|
||||
beq .9 no char left, exit with error
|
||||
|
||||
lda (ZPPtr2) get back pattern char
|
||||
cmp #'?'
|
||||
beq .4 no need to compare, any char will match
|
||||
cmp (ZPPtr1),y Regular Char, compare with string at Y
|
||||
bne .9 no match, exit
|
||||
|
||||
.4 iny advance to next char to compare
|
||||
bra .1 continue if remaining char in pattern
|
||||
|
||||
.41 lda (ZPPtr1),y end of pattern, but end of string ?
|
||||
|
||||
beq .8 yes, string matched entirely
|
||||
* no, remaining char in string, no match
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.5 inc ZPPtr2 Make PTR2 advance to next char
|
||||
bne .6
|
||||
inc ZPPtr2+1
|
||||
|
||||
.6 lda (ZPPtr2) we have '*', last char of pattern ?
|
||||
beq .8 yes, match everything, including empty string
|
||||
|
||||
lda (ZPPtr2) get next char of pattern
|
||||
cmp #'*' another '*' ?
|
||||
beq .5 yes, '**' = '*', go next char
|
||||
cmp #'?' '*?' ? we must match a least one char
|
||||
beq .3
|
||||
|
||||
.7 lda (ZPPtr1),y we need at least one remaining char in string, check if at end of string
|
||||
beq .9 no chance to match ? or regular char
|
||||
|
||||
iny
|
||||
lda (ZPPtr2) get again char in pattern
|
||||
cmp (ZPPtr1),y compare with char in string
|
||||
bne .7 not equal to next non wildcard in pattern
|
||||
|
||||
iny
|
||||
bra .1 go check remaining char in pattern...
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/SYS/KERNEL.S.STDLIB
|
||||
|
|
|
@ -25,12 +25,16 @@ A2osX.MAIN .PH $1480
|
|||
.INB USR/SRC/SYS/KERNEL.S.CORE
|
||||
.INB USR/SRC/SYS/KERNEL.S.DRV
|
||||
.INB USR/SRC/SYS/KERNEL.S.TERM
|
||||
.LIST ON
|
||||
Mem.MLoMem .EQ *
|
||||
.LIST OFF
|
||||
.EP
|
||||
A2osX.AUX .PH $1000
|
||||
.INB USR/SRC/SYS/KERNEL.S.OSD
|
||||
.INB USR/SRC/SYS/KERNEL.S.SLIST
|
||||
.LIST ON
|
||||
Mem.XLoMem .EQ *
|
||||
.LIST OFF
|
||||
.EP
|
||||
A2osX.GP .PH $BD00
|
||||
.INB USR/SRC/SYS/KERNEL.S.GP
|
||||
|
@ -42,6 +46,7 @@ A2osX.D1 .PH $D000
|
|||
.INB USR/SRC/SYS/KERNEL.S.STDIO
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDLIB
|
||||
.INB USR/SRC/SYS/KERNEL.S.DEV
|
||||
.INB USR/SRC/SYS/KERNEL.S.FIO
|
||||
.EP
|
||||
A2osX.D2 .PH $D000
|
||||
.DA #RRAMWRAMBNK2
|
||||
|
@ -59,7 +64,6 @@ A2osX.E0 .PH $E000
|
|||
.INB USR/SRC/SYS/KERNEL.S.TERMLC
|
||||
********* TMP ***** go to A2osX.D1
|
||||
.INB USR/SRC/SYS/KERNEL.S.PFT
|
||||
.INB USR/SRC/SYS/KERNEL.S.FIO
|
||||
.INB USR/SRC/SYS/KERNEL.S.IO
|
||||
********* TMP ***** go to A2osX.D2
|
||||
.INB USR/SRC/SYS/KERNEL.S.MATH
|
||||
|
|
Loading…
Reference in New Issue
Block a user