Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-09-06 14:27:37 +02:00
parent aaf4748f8f
commit 9fd9e6af69
8 changed files with 85 additions and 42 deletions

View File

@ -1001,25 +1001,51 @@ CS : no match
# StrUpr/StrLwr
Convert string to UPPERCASE/lowercase
**In:**
Y,A = PTR to String (CSTR)
**Out:**
## C
`int strupr ( char * str);`
`int strlwr ( char * str);`
## ASM
**In:**
`>LDYAI str`
`>SYSCALL strupr`
`>SYSCALL strlwr`
**Out:**
Uppercased/lowercased String in Buffer
Y,A = str
# StrCmp
Compare 2 strings
**In:**
PUSHW = Ptr to String1 (CSTR)
PUSHW = Ptr to String2 (CSTR)
**Out:**
DST = SRC
# StrICmp
Compare 2 strings
## C
`int strcmp(const char *s1, const char *s2);`
## ASM
**In:**
PUSHW = Ptr to String1 (CSTR)
PUSHW = Ptr to String2 (CSTR)
`>PUSHWI s2`
`>LDYAI s1`
`>SYSCALL strcmp`
**Out:**
CC : match
CS : no match
CC, Y,A=0
CS, Y,A > 0 or < 0
# StrCaseCmp
Compare 2 strings, ignoring case
## C
`int strcasecmp(const char *s1, const char *s2);`
## ASM
**In:**
`>PUSHWI s2`
`>LDYAI s1`
`>SYSCALL strcasecmp`
**Out:**
CC : match
CS : no match
CC, Y,A=0
CS, Y,A > 0 or < 0

Binary file not shown.

Binary file not shown.

View File

@ -166,7 +166,7 @@ SYS.StrMatch .EQ $86
SYS.StrUpr .EQ $88
SYS.StrLwr .EQ $8A
SYS.StrCmp .EQ $8C
SYS.StrICmp .EQ $8E
SYS.StrCaseCmp .EQ $8E
SYS.Time .EQ $90
SYS.CTime2Time .EQ $92

View File

@ -194,13 +194,12 @@ DNS.FIND.BY.NAME
.1 lda (ZPCachePtr)
beq .6 empty DNS cache entry?
>PUSHW ZPPtrDNS
ldy #S.DNSCACHE.hNAME
lda (ZPCachePtr),y
>SYSCALL GetMemPtr
>PUSHYA
>PUSHW ZPPtrDNS
>SYSCALL StrICmp
>SYSCALL StrCaseCmp
bcc .8
.6 lda ZPCachePtr

View File

@ -87,7 +87,7 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.StrUpr
.DA K.StrLwr
.DA K.StrCmp
.DA K.StrICmp
.DA K.StrCaseCmp
.DA K.Time $90
.DA K.CTime2Time

View File

@ -15,7 +15,6 @@ AUTO 4,1
*--------------------------------------
K.FStat jsr PFT.CheckNodeA
jsr K.GetMemPtr
bcs .9
>STYA pFD
@ -26,13 +25,13 @@ K.FStat jsr PFT.CheckNodeA
lda /S.FD.REG
adc pFD+1
jsr K.Stat.I
bcs .99
bcs .9
ldy #S.FD.DIR.REF
ldy #S.FD.REG.REF
lda (pFD),y
sta K.MLI.PARAMS+1
>MLICALL MLIGETEOF
bcs .99
bcs .9
ldy #S.STAT.SIZE+3
lda #0
@ -46,9 +45,7 @@ K.FStat jsr PFT.CheckNodeA
dex
bpl .1
.99 rts
.9 >RET 2
.9 rts
*/--------------------------------------
* # Stat
* Return information about a file

View File

@ -164,10 +164,17 @@ K.StrMatch >STYA ZPPtr1 s
*/--------------------------------------
* # StrUpr/StrLwr
* Convert string to UPPERCASE/lowercase
* **In:**
* Y,A = PTR to String (CSTR)
* **Out:**
* ## C
* `int strupr ( char * str);`
* `int strlwr ( char * str);`
* ## ASM
* **In:**
* `>LDYAI str`
* `>SYSCALL strupr`
* `>SYSCALL strlwr`
* **Out:**
* Uppercased/lowercased String in Buffer
* Y,A = str
*\--------------------------------------
K.StrUpr ldx #0
.HS 2C bit abs
@ -201,37 +208,51 @@ K.StrLwr ldx #2
*/--------------------------------------
* # StrCmp
* Compare 2 strings
* ## C
* `int strcmp(const char *s1, const char *s2);`
* ## ASM
* **In:**
* PUSHW = Ptr to String1 (CSTR)
* PUSHW = Ptr to String2 (CSTR)
* `>PUSHWI s2`
* `>LDYAI s1`
* `>SYSCALL strcmp`
* **Out:**
* DST = SRC
* CC : match
* CS : no match
* CC, Y,A=0
* CS, Y,A > 0 or < 0
*\--------------------------------------
K.StrCmp sec
.HS 90 BCC
*/--------------------------------------
* # StrICmp
* Compare 2 strings
* # StrCaseCmp
* Compare 2 strings, ignoring case
* ## C
* `int strcasecmp(const char *s1, const char *s2);`
* ## ASM
* **In:**
* PUSHW = Ptr to String1 (CSTR)
* PUSHW = Ptr to String2 (CSTR)
* `>PUSHWI s2`
* `>LDYAI s1`
* `>SYSCALL strcasecmp`
* **Out:**
* CC : match
* CS : no match
* CC, Y,A=0
* CS, Y,A > 0 or < 0
*\--------------------------------------
K.StrICmp clc
jsr MEM.PullP1P2
K.StrCaseCmp clc
>STYA ZPPtr1 s1
>PULLW ZPPtr2 s2
ldy #0
.1 lda (ZPPtr1),y
beq .7
jsr K.StrICmp.toUpper
jsr K.StrCaseCmp.toUpper
sta .2+1
lda (ZPPtr2),y
beq .9
jsr K.StrICmp.toUpper
jsr K.StrCaseCmp.toUpper
.2 eor #$ff SELF MODIFIED
bne .9
@ -258,17 +279,17 @@ K.StrICmp clc
sec
rts
*--------------------------------------
K.StrICmp.toUpper
K.StrCaseCmp.toUpper
bcs .9
php
cmp #'a'
bcc .1
bcc .9
cmp #'z'+1
bcs .1
eor #$20
.1 plp
.1 clc
.9 rts
*--------------------------------------
MAN