mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-27 00:29:29 +00:00
Kernel version 0.8 : Code reorg to save few bytes!
This commit is contained in:
parent
83a75b7fef
commit
7021210871
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
|
@ -405,14 +405,9 @@ LoadFile >PUSHWI 0 Aux type
|
||||||
sec
|
sec
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
SaveFile >PUSHWI 0 Aux type
|
SaveFile ldy #hBuffer
|
||||||
>PUSHBI 4 S.FILEINFO.TYPE.TXT
|
|
||||||
>PUSHBI SYS.FOPEN.X+SYS.FOPEN.W
|
|
||||||
ldy #hFileName
|
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
|
|
||||||
>SYSCALL SYS.GetMemPtrA
|
>SYSCALL SYS.GetMemPtrA
|
||||||
|
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
|
|
||||||
ldy #FileLen+1
|
ldy #FileLen+1
|
||||||
|
@ -420,9 +415,14 @@ SaveFile >PUSHWI 0 Aux type
|
||||||
dey
|
dey
|
||||||
>PUSHB (pData),y
|
>PUSHB (pData),y
|
||||||
|
|
||||||
ldy #hBuffer
|
>PUSHWI 0 Aux type
|
||||||
|
>PUSHBI 4 S.FILEINFO.TYPE.TXT
|
||||||
|
>PUSHBI SYS.FOPEN.X+SYS.FOPEN.W
|
||||||
|
ldy #hFileName
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
|
|
||||||
>SYSCALL SYS.GetMemPtrA
|
>SYSCALL SYS.GetMemPtrA
|
||||||
|
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
|
|
||||||
>SYSCALL SYS.SaveFile
|
>SYSCALL SYS.SaveFile
|
||||||
|
|
|
@ -215,6 +215,13 @@ AUTO 6
|
||||||
sta ]1+1
|
sta ]1+1
|
||||||
inc pStack
|
inc pStack
|
||||||
.EM
|
.EM
|
||||||
|
*--------------------------------------
|
||||||
|
.MA POP
|
||||||
|
lda pStack
|
||||||
|
clc
|
||||||
|
adc ]1
|
||||||
|
sta pStack
|
||||||
|
.EM
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* General WORD Manipulation Macros
|
* General WORD Manipulation Macros
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
|
|
@ -5,11 +5,11 @@ INC 1
|
||||||
AUTO 6
|
AUTO 6
|
||||||
.LIST OFF
|
.LIST OFF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
*
|
* PULLW PString to scan (ex: "192.168.1.5")
|
||||||
|
* PULLW PString pattern (ex: "%d.%d.%d.%d")
|
||||||
|
* PULLW PTR to target buffer
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.SScanF >PULLW ZPQuickPtr1 get PString to scan (ex: "192.168.1.5")
|
K.SScanF jsr PullPtr1Ptr2Ptr3
|
||||||
>PULLW ZPQuickPtr2 get PString pattern (ex: "%d.%d.%d.%d")
|
|
||||||
>PULLW ZPQuickPtr3 get target buffer
|
|
||||||
|
|
||||||
ldy #0 Y = PTR in pattern
|
ldy #0 Y = PTR in pattern
|
||||||
|
|
||||||
|
@ -261,8 +261,8 @@ PrintF.A >PULLW HEXBUF
|
||||||
.4 jsr K.COutA
|
.4 jsr K.COutA
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PrintF.BB >PULLYA
|
PrintF.BB >PULLA
|
||||||
phy
|
pha
|
||||||
jsr PrintF.B
|
jsr PrintF.B
|
||||||
pla
|
pla
|
||||||
bra PrintF.B.1
|
bra PrintF.B.1
|
||||||
|
@ -308,9 +308,9 @@ PrintF.E >PULLW ZPQuickPtr2
|
||||||
PrintF.F >PULLW ZPQuickPtr2
|
PrintF.F >PULLW ZPQuickPtr2
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PrintF.HH >PULLYA
|
PrintF.HH >PULLA
|
||||||
phy
|
pha
|
||||||
jsr PrintF.H.1
|
jsr PrintF.H
|
||||||
pla
|
pla
|
||||||
bra PrintF.H.1
|
bra PrintF.H.1
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
|
|
@ -64,15 +64,13 @@ K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
||||||
lda K.FileSearch.hSrch Discard Expanded hSrch list
|
lda K.FileSearch.hSrch Discard Expanded hSrch list
|
||||||
jsr K.FreeMemA
|
jsr K.FreeMemA
|
||||||
|
|
||||||
>LDYAI KrnBuf256
|
bra K.GetFullPathYA.NewStr
|
||||||
>SYSCALL SYS.NewPStrYA
|
|
||||||
.99 rts
|
|
||||||
|
|
||||||
.98 lda K.FileSearch.hSrch Discard Expanded hSrch list
|
.98 lda K.FileSearch.hSrch Discard Expanded hSrch list
|
||||||
jsr K.FreeMemA
|
jsr K.FreeMemA
|
||||||
lda #SYSMGR.ERRFNF
|
lda #SYSMGR.ERRFNF
|
||||||
sec
|
sec
|
||||||
rts
|
.99 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.FileSearch.hSrch .BS 1
|
K.FileSearch.hSrch .BS 1
|
||||||
K.FileSearch.Index .BS 1
|
K.FileSearch.Index .BS 1
|
||||||
|
@ -86,7 +84,7 @@ K.FileSearch.Index .BS 1
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
K.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
||||||
lda (ZPQuickPtr3)
|
lda (ZPQuickPtr3)
|
||||||
beq .9
|
beq K.GetFullPathYA.9
|
||||||
|
|
||||||
stz KrnBuf256
|
stz KrnBuf256
|
||||||
|
|
||||||
|
@ -105,12 +103,13 @@ K.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
||||||
.1 >PUSHW ZPQuickPtr3
|
.1 >PUSHW ZPQuickPtr3
|
||||||
>PUSHWI KrnBuf256
|
>PUSHWI KrnBuf256
|
||||||
>SYSCALL SYS.PStrCat
|
>SYSCALL SYS.PStrCat
|
||||||
|
K.GetFullPathYA.NewStr
|
||||||
>LDYAI KrnBuf256
|
>LDYAI KrnBuf256
|
||||||
>SYSCALL SYS.NewPStrYA
|
>SYSCALL SYS.NewPStrYA
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 sec
|
K.GetFullPathYA.9
|
||||||
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* K.LoadFile
|
* K.LoadFile
|
||||||
|
@ -186,25 +185,18 @@ K.LoadFile.Seek >PUSHWI 0
|
||||||
>PUSHB K.LoadFile.hFile
|
>PUSHB K.LoadFile.hFile
|
||||||
jmp K.FSEEK
|
jmp K.FSEEK
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* PULLW = SrcPtr
|
|
||||||
* PULLW = SrcLen
|
|
||||||
* PULLW = PATH (Handled by....
|
* PULLW = PATH (Handled by....
|
||||||
* PULLB = MODE ...
|
* PULLB = MODE ...
|
||||||
* PULLB = TYPE ...
|
* PULLB = TYPE ...
|
||||||
* PULLW = AUXTYPE ...FOPEN)
|
* PULLW = AUXTYPE ...FOPEN)
|
||||||
|
* PULLW = SrcLen
|
||||||
|
* PULLW = SrcPtr
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.SaveFile >PULLW K.LoadFile.Mem
|
K.SaveFile jsr K.FOPEN
|
||||||
>PULLW K.LoadFile.Len
|
|
||||||
|
|
||||||
jsr K.FOPEN
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta K.LoadFile.hFile
|
sta K.LoadFile.hFile
|
||||||
|
|
||||||
>PUSHW K.LoadFile.Mem
|
|
||||||
|
|
||||||
>PUSHW K.LoadFile.Len
|
|
||||||
|
|
||||||
>PUSHB K.LoadFile.hFile
|
>PUSHB K.LoadFile.hFile
|
||||||
jsr K.FWRITE
|
jsr K.FWRITE
|
||||||
bcs .99
|
bcs .99
|
||||||
|
@ -218,8 +210,12 @@ K.SaveFile >PULLW K.LoadFile.Mem
|
||||||
jsr K.FCLOSEA
|
jsr K.FCLOSEA
|
||||||
pla
|
pla
|
||||||
sec
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
.9 rts
|
|
||||||
|
.9 >POP 4 Discard SrcPtr & SrcLen
|
||||||
|
sec
|
||||||
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.LoadFile.hFile .BS 1
|
K.LoadFile.hFile .BS 1
|
||||||
K.LoadFile.hMem .BS 1
|
K.LoadFile.hMem .BS 1
|
||||||
|
|
|
@ -12,8 +12,8 @@ AUTO 6
|
||||||
* Y,A = PTR to String
|
* Y,A = PTR to String
|
||||||
* X = hMem (PSTRING)
|
* X = hMem (PSTRING)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.NewPStrYA >STYA ZPQuickPtr1
|
K.NewPStrYA >STYA ZPQuickPtr2
|
||||||
lda (ZPQuickPtr1)
|
lda (ZPQuickPtr2)
|
||||||
inc
|
inc
|
||||||
tay
|
tay
|
||||||
lda #0 Y,A = len of new string
|
lda #0 Y,A = len of new string
|
||||||
|
@ -22,11 +22,11 @@ K.NewPStrYA >STYA ZPQuickPtr1
|
||||||
jsr K.GetMem
|
jsr K.GetMem
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
>STYA ZPQuickPtr2
|
>STYA ZPQuickPtr1
|
||||||
|
|
||||||
jsr K.PStrCpyPtr1Ptr2
|
jsr K.PStrCpyPtr2Ptr1
|
||||||
|
|
||||||
>LDYA ZPQuickPtr2
|
>LDYA ZPQuickPtr1
|
||||||
|
|
||||||
clc
|
clc
|
||||||
.9 rts
|
.9 rts
|
||||||
|
@ -38,17 +38,16 @@ K.NewPStrYA >STYA ZPQuickPtr1
|
||||||
* OUT:
|
* OUT:
|
||||||
* DST = SRC (PSTRING)
|
* DST = SRC (PSTRING)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.PStrCpy >PULLW ZPQuickPtr2 save DST
|
K.PStrCpy jsr PullPtr1Ptr2
|
||||||
>PULLW ZPQuickPtr1 save SRC
|
|
||||||
|
|
||||||
K.PStrCpyPtr1Ptr2
|
K.PStrCpyPtr2Ptr1
|
||||||
lda (ZPQuickPtr1)
|
lda (ZPQuickPtr2)
|
||||||
sta (ZPQuickPtr2)
|
sta (ZPQuickPtr1)
|
||||||
tay
|
tay
|
||||||
beq .2
|
beq .2
|
||||||
|
|
||||||
.1 lda (ZPQuickPtr1),y
|
.1 lda (ZPQuickPtr2),y
|
||||||
sta (ZPQuickPtr2),y
|
sta (ZPQuickPtr1),y
|
||||||
dey
|
dey
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
|
@ -62,13 +61,12 @@ K.PStrCpyPtr1Ptr2
|
||||||
* OUT:
|
* OUT:
|
||||||
* DST = DST+SRC (PSTRING)
|
* DST = DST+SRC (PSTRING)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.PStrCat >PULLW ZPQuickPtr2 save DST
|
K.PStrCat jsr PullPtr1Ptr2
|
||||||
>PULLW ZPQuickPtr1 save SRC
|
|
||||||
|
|
||||||
lda (ZPQuickPtr1)
|
|
||||||
tax
|
|
||||||
|
|
||||||
lda (ZPQuickPtr2)
|
lda (ZPQuickPtr2)
|
||||||
|
tax
|
||||||
|
|
||||||
|
lda (ZPQuickPtr1)
|
||||||
tay
|
tay
|
||||||
|
|
||||||
.1 cpy #255
|
.1 cpy #255
|
||||||
|
@ -76,17 +74,17 @@ K.PStrCat >PULLW ZPQuickPtr2 save DST
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
inc ZPQuickPtr1
|
inc ZPQuickPtr2
|
||||||
bne .2
|
bne .2
|
||||||
inc ZPQuickPtr1+1
|
inc ZPQuickPtr1+1
|
||||||
|
|
||||||
.2 lda (ZPQuickPtr1)
|
.2 lda (ZPQuickPtr2)
|
||||||
sta (ZPQuickPtr2),y
|
sta (ZPQuickPtr1),y
|
||||||
dex
|
dex
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.8 tya
|
.8 tya
|
||||||
sta (ZPQuickPtr2)
|
sta (ZPQuickPtr1)
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -98,62 +96,61 @@ K.PStrCat >PULLW ZPQuickPtr2 save DST
|
||||||
* cc = match
|
* cc = match
|
||||||
* cs = no match
|
* cs = no match
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.PStrMatch >PULLW ZPQuickPtr2 pull String
|
K.PStrMatch jsr PullPtr1Ptr2
|
||||||
>PULLW ZPQuickPtr1 pull Pattern
|
|
||||||
|
|
||||||
lda (ZPQuickPTR1) Keep Pattern Length in X
|
lda (ZPQuickPTR2) Keep Pattern Length in X
|
||||||
tax
|
tax
|
||||||
beq .8 Match always if empty
|
beq .8 Match always if empty
|
||||||
ldy #0
|
ldy #0
|
||||||
|
|
||||||
.1 inc ZPQuickPTR1 Make PTR1 advance to next char
|
.1 inc ZPQuickPTR2 Make PTR1 advance to next char
|
||||||
bne .2
|
bne .2
|
||||||
inc ZPQuickPTR1+1
|
inc ZPQuickPTR2+1
|
||||||
|
|
||||||
.2 lda (ZPQuickPTR1) get pattern char
|
.2 lda (ZPQuickPTR2) get pattern char
|
||||||
cmp #'*'
|
cmp #'*'
|
||||||
beq .5
|
beq .5
|
||||||
|
|
||||||
.3 tya we must match ? or regular char
|
.3 tya we must match ? or regular char
|
||||||
cmp (ZPQuickPTR2) check if at end of string
|
cmp (ZPQuickPTR1) check if at end of string
|
||||||
beq .9 yes, no char left, exit with error
|
beq .9 yes, no char left, exit with error
|
||||||
|
|
||||||
iny advance to next char to compare
|
iny advance to next char to compare
|
||||||
|
|
||||||
lda (ZPQuickPTR1) get back pattern char
|
lda (ZPQuickPTR2) get back pattern char
|
||||||
cmp #'?'
|
cmp #'?'
|
||||||
beq .4 no need to compare, any char will match
|
beq .4 no need to compare, any char will match
|
||||||
cmp (ZPQuickPTR2),y Regular Char, compare with string at Y
|
cmp (ZPQuickPTR1),y Regular Char, compare with string at Y
|
||||||
bne .9 no match, exit
|
bne .9 no match, exit
|
||||||
|
|
||||||
.4 dex char matched, check if end of pattern
|
.4 dex char matched, check if end of pattern
|
||||||
bne .1 continue if remaining char in pattern
|
bne .1 continue if remaining char in pattern
|
||||||
|
|
||||||
tya end of pattern, but end of string ?
|
tya end of pattern, but end of string ?
|
||||||
cmp (ZPQuickPTR2) end of string ?
|
cmp (ZPQuickPTR1) end of string ?
|
||||||
beq .8 yes, string matched entirely
|
beq .8 yes, string matched entirely
|
||||||
bra .9 no, remaining char in string, no match
|
bra .9 no, remaining char in string, no match
|
||||||
|
|
||||||
.5 dex we have '*', last char of pattern ?
|
.5 dex we have '*', last char of pattern ?
|
||||||
beq .8 yes, match everything, including empty string
|
beq .8 yes, match everything, including empty string
|
||||||
|
|
||||||
inc ZPQuickPTR1 Make PTR1 advance to next char
|
inc ZPQuickPTR2 Make PTR1 advance to next char
|
||||||
bne .6
|
bne .6
|
||||||
inc ZPQuickPTR1+1
|
inc ZPQuickPTR2+1
|
||||||
|
|
||||||
.6 lda (ZPQuickPTR1) get next char of pattern
|
.6 lda (ZPQuickPTR2) get next char of pattern
|
||||||
cmp #'*' another '*' ?
|
cmp #'*' another '*' ?
|
||||||
beq .5 yes, '**' = '*', go next char
|
beq .5 yes, '**' = '*', go next char
|
||||||
cmp #'?' '*?' ??? we must match a least one char
|
cmp #'?' '*?' ??? we must match a least one char
|
||||||
beq .3
|
beq .3
|
||||||
|
|
||||||
.7 tya we need at least one remaining char in string,
|
.7 tya we need at least one remaining char in string,
|
||||||
cmp (ZPQuickPTR2) check if at end of string
|
cmp (ZPQuickPTR1) check if at end of string
|
||||||
beq .9 no chance to match ? or regular char
|
beq .9 no chance to match ? or regular char
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (ZPQuickPTR1) get again char in pattern
|
lda (ZPQuickPTR2) get again char in pattern
|
||||||
cmp (ZPQuickPTR2),y compare with char in string
|
cmp (ZPQuickPTR1),y compare with char in string
|
||||||
bne .7 not equal to next non wildcard in pattern
|
bne .7 not equal to next non wildcard in pattern
|
||||||
|
|
||||||
bra .4 go check remaining char in pattern...
|
bra .4 go check remaining char in pattern...
|
||||||
|
@ -220,9 +217,7 @@ K.PStrUprLwr .AS "azAZ"
|
||||||
* %Y Year four digits 2001
|
* %Y Year four digits 2001
|
||||||
* PULLW = Dst PSTR Buffer
|
* PULLW = Dst PSTR Buffer
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.PStrFTime >PULLW ZPQuickPtr1
|
K.PStrFTime jsr PullPtr1Ptr2Ptr3
|
||||||
>PULLW ZPQuickPtr2
|
|
||||||
>PULLW ZPQuickPtr3
|
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta (ZPQuickPtr3) Reset target PSTR length
|
sta (ZPQuickPtr3) Reset target PSTR length
|
||||||
|
|
|
@ -28,8 +28,7 @@ K.TimeYA >STYA ZPQuickPtr2
|
||||||
* PULLW = Src PDATE/TIME (DWORD)
|
* PULLW = Src PDATE/TIME (DWORD)
|
||||||
* PULLW = Dst PTR To S.TIME
|
* PULLW = Dst PTR To S.TIME
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.PTime2Time >PULLW ZPQuickPtr1
|
K.PTime2Time jsr PullPtr1Ptr2
|
||||||
>PULLW ZPQuickPtr2
|
|
||||||
|
|
||||||
K.PTime2Time.1 ldy #1
|
K.PTime2Time.1 ldy #1
|
||||||
lda (ZPQuickPtr1),y Get Year
|
lda (ZPQuickPtr1),y Get Year
|
||||||
|
@ -165,8 +164,7 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
|
||||||
* PULLW = Src CTIME DWORD
|
* PULLW = Src CTIME DWORD
|
||||||
* PULLW = Dst PTR To S.TIME
|
* PULLW = Dst PTR To S.TIME
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.CTime2Time >PULLW ZPQuickPtr1
|
K.CTime2Time jsr PullPtr1Ptr2
|
||||||
>PULLW ZPQuickPtr2
|
|
||||||
|
|
||||||
ldy #3
|
ldy #3
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,16 @@ A2osX.E000 .EQ *
|
||||||
.INB SYS/KERNEL.S.IRQ
|
.INB SYS/KERNEL.S.IRQ
|
||||||
.INB SYS/KERNEL.S.MEM
|
.INB SYS/KERNEL.S.MEM
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
PullPtr1Ptr2Ptr3
|
||||||
|
sec
|
||||||
|
.HS 90 bcc
|
||||||
|
PullPtr1Ptr2 clc
|
||||||
|
>PULLW ZPQuickPtr1
|
||||||
|
>PULLW ZPQuickPtr2
|
||||||
|
bcc .9
|
||||||
|
>PULLW ZPQuickPtr3
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
* Make sure KERNEL.S.D01 is the last one
|
* Make sure KERNEL.S.D01 is the last one
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB SYS/KERNEL.S.D01
|
.INB SYS/KERNEL.S.D01
|
||||||
|
|
Loading…
Reference in New Issue
Block a user