mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.9.1 : STDLIB : AToL, StrToL....etc...(wip)
This commit is contained in:
parent
a6ac9584d8
commit
33a96ed69a
@ -469,7 +469,7 @@ Read bytes from file
|
|||||||
+ A = hFILE
|
+ A = hFILE
|
||||||
|
|
||||||
# FSeek
|
# FSeek
|
||||||
+ Set the file-position indicator for hFILE
|
Set the file-position indicator for hFILE
|
||||||
|
|
||||||
## In:
|
## In:
|
||||||
+ PUSHW = Ptr to Offset (DWORD)
|
+ PUSHW = Ptr to Offset (DWORD)
|
||||||
@ -477,7 +477,7 @@ Read bytes from file
|
|||||||
+ PUSHB = hFILE
|
+ PUSHB = hFILE
|
||||||
|
|
||||||
# FEOF.A
|
# FEOF.A
|
||||||
+ Test the end-of-file indicator for hFILE
|
Test the end-of-file indicator for hFILE
|
||||||
|
|
||||||
## In:
|
## In:
|
||||||
+ A = hFILE
|
+ A = hFILE
|
||||||
@ -489,7 +489,7 @@ Read bytes from file
|
|||||||
+ CS :
|
+ CS :
|
||||||
|
|
||||||
# FTell
|
# FTell
|
||||||
+ Return the current value of the file-position indicator
|
Return the current value of the file-position indicator
|
||||||
|
|
||||||
## In:
|
## In:
|
||||||
+ PUSHW = Ptr to Offset (DWORD)
|
+ PUSHW = Ptr to Offset (DWORD)
|
||||||
@ -537,7 +537,6 @@ FPrintF.YA :
|
|||||||
+ CC : success
|
+ CC : success
|
||||||
+ CS : error code from Output
|
+ CS : error code from Output
|
||||||
+ Specifiers :
|
+ Specifiers :
|
||||||
+ %a : pull 2 bytes to Print Access right String 'drwxrwxrwx'
|
|
||||||
+ %b : pull 1 byte to Print BIN
|
+ %b : pull 1 byte to Print BIN
|
||||||
+ %B : pull 2 bytes to Print BIN
|
+ %B : pull 2 bytes to Print BIN
|
||||||
+ %d : pull 1 byte unsigned DEC 0..255
|
+ %d : pull 1 byte unsigned DEC 0..255
|
||||||
@ -574,7 +573,7 @@ Convert String to 40 bits Float
|
|||||||
|
|
||||||
## In:
|
## In:
|
||||||
+ PUSHW PTR to target buffer (5 Bytes)
|
+ PUSHW PTR to target buffer (5 Bytes)
|
||||||
+ PUSHW Source String (PSTR)
|
+ PUSHW Source String (C-Sring)
|
||||||
|
|
||||||
## Out:
|
## Out:
|
||||||
|
|
||||||
@ -596,6 +595,38 @@ Convert String to 32 bits int
|
|||||||
|
|
||||||
## Out:
|
## Out:
|
||||||
|
|
||||||
|
# StrToF
|
||||||
|
Convert String to 40 bits Float
|
||||||
|
|
||||||
|
## In:
|
||||||
|
+ PUSHW PTR to target buffer FLOAT (5 bytes)
|
||||||
|
+ PUSHW PTR to EndPtr
|
||||||
|
+ PUSHW Source String (C-Sring)
|
||||||
|
|
||||||
|
## Out:
|
||||||
|
|
||||||
|
# StrToL
|
||||||
|
Convert String to 32 bits int
|
||||||
|
|
||||||
|
## In:
|
||||||
|
+ PUSHB Base
|
||||||
|
+ PUSHW PTR to target buffer DWORD
|
||||||
|
+ PUSHW PTR to EndPtr
|
||||||
|
+ PUSHW Source String (C-Sring)
|
||||||
|
|
||||||
|
## Out:
|
||||||
|
|
||||||
|
# StrToUL
|
||||||
|
Convert String to 32 bits unsigned int
|
||||||
|
|
||||||
|
## In:
|
||||||
|
+ PUSHB Base
|
||||||
|
+ PUSHW PTR to target buffer DWORD
|
||||||
|
+ PUSHW PTR to EndPtr
|
||||||
|
+ PUSHW Source String (C-Sring)
|
||||||
|
|
||||||
|
## Out:
|
||||||
|
|
||||||
# RealPath.YA
|
# RealPath.YA
|
||||||
Return the canonicalized absolute pathname
|
Return the canonicalized absolute pathname
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
69
BIN/LS.S.txt
69
BIN/LS.S.txt
@ -238,12 +238,8 @@ CS.RUN.DIR >LDA.G bAllmostAll
|
|||||||
|
|
||||||
.4 jsr CS.RUN.PUSHDATES
|
.4 jsr CS.RUN.PUSHDATES
|
||||||
|
|
||||||
ldy #S.STAT.MODE+1
|
jsr Mod2CSTR
|
||||||
lda (ZPFileStat),y
|
>PUSHEA.G MOD File Mod
|
||||||
>PUSHA
|
|
||||||
dey
|
|
||||||
lda (ZPFileStat),y
|
|
||||||
>PUSHA File Mode
|
|
||||||
|
|
||||||
>PUSHW ZPFileName
|
>PUSHW ZPFileName
|
||||||
>LDYA L.MSG.DIREXT
|
>LDYA L.MSG.DIREXT
|
||||||
@ -295,12 +291,8 @@ CS.RUN.FILE ldy #bLong
|
|||||||
adc #0
|
adc #0
|
||||||
>PUSHYA File Size
|
>PUSHYA File Size
|
||||||
|
|
||||||
ldy #S.STAT.MODE+1
|
jsr Mod2CSTR
|
||||||
lda (ZPFileStat),y
|
>PUSHEA.G MOD File Mod
|
||||||
>PUSHA
|
|
||||||
dey
|
|
||||||
lda (ZPFileStat),y
|
|
||||||
>PUSHA File Mode
|
|
||||||
|
|
||||||
ldy #S.STAT.P.AUXTYPE+1
|
ldy #S.STAT.P.AUXTYPE+1
|
||||||
lda (ZPFileStat),y
|
lda (ZPFileStat),y
|
||||||
@ -457,6 +449,52 @@ FileType2PSTR ldy #0
|
|||||||
adc #0
|
adc #0
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
Mod2CSTR ldy #S.STAT.MODE+1
|
||||||
|
lda (ZPFileStat),y
|
||||||
|
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
tax
|
||||||
|
lda TYPES,x
|
||||||
|
>STA.G MOD
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
|
||||||
|
ldy #S.STAT.MODE
|
||||||
|
lda (ZPFileStat),y
|
||||||
|
|
||||||
|
ldy #MOD+1
|
||||||
|
|
||||||
|
.1 lsr
|
||||||
|
pha
|
||||||
|
|
||||||
|
lda #'-'
|
||||||
|
bcc .2
|
||||||
|
lda ACCESS,x
|
||||||
|
|
||||||
|
.2 sta (pData),y
|
||||||
|
iny
|
||||||
|
|
||||||
|
pla
|
||||||
|
|
||||||
|
inx
|
||||||
|
cpx #8
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
.3 ldy #S.STAT.MODE+1
|
||||||
|
lda (ZPFileStat),y
|
||||||
|
lsr
|
||||||
|
lda #'-'
|
||||||
|
|
||||||
|
bcc .4
|
||||||
|
lda ACCESS,x
|
||||||
|
|
||||||
|
.4 >STA.G MOD+9
|
||||||
|
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
.INB /A2OSX.SRC/BIN/X.FILEENUM.S
|
.INB /A2OSX.SRC/BIN/X.FILEENUM.S
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.END
|
CS.END
|
||||||
@ -467,9 +505,9 @@ OptionVars .DA #bAllmostAll,#bLong,#bRecurse,#bAllmostAll,#bLong,#bRecurse
|
|||||||
MSG.DEVEXT >CSTR "%15s S%d,D%d Blocks Used:%5D Total:%5D\r\n"
|
MSG.DEVEXT >CSTR "%15s S%d,D%d Blocks Used:%5D Total:%5D\r\n"
|
||||||
MSG.DIR >CSTR "\e[32m%s/\e[0m"
|
MSG.DIR >CSTR "\e[32m%s/\e[0m"
|
||||||
MSG.ENTER >CSTR "Directory:%s\r\n"
|
MSG.ENTER >CSTR "Directory:%s\r\n"
|
||||||
MSG.DIREXT >CSTR "\e[32m%16s\e[0m <dir> %a %s %s\r\n"
|
MSG.DIREXT >CSTR "\e[32m%16s\e[0m <dir> %s %s %s\r\n"
|
||||||
MSG.FILE >CSTR "%19s"
|
MSG.FILE >CSTR "%19s"
|
||||||
MSG.FILEEXT >CSTR "%15s %S $%H %a %10u %s %s\r\n"
|
MSG.FILEEXT >CSTR "%15s %S $%H %s %10u %s %s\r\n"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PRODOS.FT.HEX .HS 0406FAFCFDE2FF
|
PRODOS.FT.HEX .HS 0406FAFCFDE2FF
|
||||||
PRODOS.FT.TXT >PSTR "TXT"
|
PRODOS.FT.TXT >PSTR "TXT"
|
||||||
@ -483,12 +521,15 @@ PRODOS.FT.DFLT >PSTR "$ "
|
|||||||
MSG.NODATE >CSTR " <No-Date> "
|
MSG.NODATE >CSTR " <No-Date> "
|
||||||
FMT.DateTime >CSTR "%d-%b-%y %H:%M"
|
FMT.DateTime >CSTR "%d-%b-%y %H:%M"
|
||||||
HEXDIGIT .AS '0123456789ABCDEF'
|
HEXDIGIT .AS '0123456789ABCDEF'
|
||||||
|
TYPES .AS "-dbclssp"
|
||||||
|
ACCESS .AS "rwxrwxrwx"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DUMMY
|
.DUMMY
|
||||||
.OR 0
|
.OR 0
|
||||||
DS.START
|
DS.START
|
||||||
ArgCount .BS 1
|
ArgCount .BS 1
|
||||||
|
|
||||||
|
MOD .BS 11 drwxrwxrwx0
|
||||||
TIME.Create .BS 20
|
TIME.Create .BS 20
|
||||||
TIME.Mod .BS 20
|
TIME.Mod .BS 20
|
||||||
|
|
||||||
|
@ -48,8 +48,11 @@ K.GetDevByName.YA
|
|||||||
|
|
||||||
.2 iny
|
.2 iny
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
ora (ZPPtr2),y
|
cmp (ZPPtr2),y
|
||||||
bne .3 Both char are 0, match!
|
bne .3
|
||||||
|
|
||||||
|
ora (ZPPtr2),y Both char are 0 ?
|
||||||
|
bne .2 no....loop
|
||||||
|
|
||||||
lda ZPPtr2
|
lda ZPPtr2
|
||||||
sec
|
sec
|
||||||
@ -60,11 +63,7 @@ K.GetDevByName.YA
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.3 lda (ZPPtr1),y
|
.3 lda ZPPtr2
|
||||||
cmp (ZPPtr2),y
|
|
||||||
beq .2
|
|
||||||
|
|
||||||
lda ZPPtr2
|
|
||||||
clc
|
clc
|
||||||
adc #S.DEV
|
adc #S.DEV
|
||||||
sta ZPPtr2
|
sta ZPPtr2
|
||||||
|
@ -125,6 +125,9 @@ K.ExpandStr.YA stz K.ExpandStr.hPStr Reset Intermediate string...
|
|||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
K.ExpandStrValidChar
|
K.ExpandStrValidChar
|
||||||
|
cmp #'_'
|
||||||
|
beq .8
|
||||||
|
|
||||||
cmp #'0'
|
cmp #'0'
|
||||||
bcc .9
|
bcc .9
|
||||||
cmp #'9'+1
|
cmp #'9'+1
|
||||||
@ -133,13 +136,13 @@ K.ExpandStrValidChar
|
|||||||
cmp #'A'
|
cmp #'A'
|
||||||
bcc .9
|
bcc .9
|
||||||
cmp #'Z'+1
|
cmp #'Z'+1
|
||||||
bcc .8
|
|
||||||
|
|
||||||
cmp #'_'
|
* bcc .8
|
||||||
bne .9
|
rts
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -32,7 +32,6 @@ PFT.CheckPathSTK
|
|||||||
lda (pStack),y read PTR.HI on top of stack
|
lda (pStack),y read PTR.HI on top of stack
|
||||||
ply
|
ply
|
||||||
PFT.CheckPathYA
|
PFT.CheckPathYA
|
||||||
stx S.PFT.SYSCALL save #SYSCALL
|
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
>LDYAI FltMgr.Table
|
>LDYAI FltMgr.Table
|
||||||
@ -62,27 +61,21 @@ PFT.CheckPathYA
|
|||||||
jsr K.GetMemPtr.A
|
jsr K.GetMemPtr.A
|
||||||
>STYA .7+1
|
>STYA .7+1
|
||||||
|
|
||||||
lda S.PFT.SYSCALL getback #SYSCALL
|
|
||||||
sec
|
|
||||||
sbc #SYS.FOpen-4 0=Lib.load, 2=Lib.Unload
|
|
||||||
tax
|
|
||||||
|
|
||||||
pla discard JSR return @
|
pla discard JSR return @
|
||||||
pla
|
pla
|
||||||
|
|
||||||
>LDYA ZPPtr1 restore passed params
|
>LDYA ZPPtr1 restore passed params
|
||||||
.7 jmp $ffff
|
.7 jmp $ffff X unmodified
|
||||||
|
|
||||||
|
|
||||||
.8 lda ZPPtr2
|
.8 lda ZPPtr2
|
||||||
clc
|
clc
|
||||||
adc (ZPPtr2) Add STR len
|
adc (ZPPtr2) Add STR len
|
||||||
adc #S.PFT
|
adc #S.PFT
|
||||||
sta ZPPtr2
|
sta ZPPtr2
|
||||||
bcc .1
|
bcc .1
|
||||||
|
|
||||||
.9 >LDYA ZPPtr1 restore passed params
|
.9 >LDYA ZPPtr1 restore passed params
|
||||||
ldx S.PFT.SYSCALL
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* PFT.Check___
|
* PFT.Check___
|
||||||
@ -92,34 +85,26 @@ PFT.CheckPathYA
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PFT.CheckNodeSTK
|
PFT.CheckNodeSTK
|
||||||
lda (pStack) read hFILE on top of stack
|
lda (pStack) read hFILE on top of stack
|
||||||
PFT.CheckNodeA stx S.PFT.SYSCALL save #SYSCALL
|
PFT.CheckNodeA sta .9+1 save hFILE
|
||||||
sta S.PFT.hFILE
|
|
||||||
jsr K.GetMemPtr.A X = unmidified
|
jsr K.GetMemPtr.A X = unmodified
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
lda (ZPPtr1)
|
lda (ZPPtr1)
|
||||||
beq .9 Handler is 0, back to kernel....
|
beq .9 Handler is 0, back to kernel....
|
||||||
|
|
||||||
jsr K.GetMemPtr.A
|
jsr K.GetMemPtr.A
|
||||||
>STYA .1+1
|
>STYA .1+1
|
||||||
|
|
||||||
lda S.PFT.SYSCALL getback #SYSCALL
|
|
||||||
sec
|
|
||||||
sbc #SYS.FOpen-4 0=Lib.load, 2=Lib.Unload
|
|
||||||
tax
|
|
||||||
|
|
||||||
pla discard JSR return @
|
pla discard JSR return @
|
||||||
pla
|
pla
|
||||||
|
|
||||||
lda S.PFT.hFILE restore passed params
|
lda .9+1 restore passed hFILE
|
||||||
.1 jmp $ffff
|
.1 jmp $ffff
|
||||||
|
|
||||||
|
|
||||||
.9 lda S.PFT.hFILE
|
.9 lda #$ff Self Modified
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.PFT.hFILE .BS 1
|
|
||||||
S.PFT.SYSCALL .BS 1
|
|
||||||
*--------------------------------------
|
|
||||||
MAN
|
MAN
|
||||||
SAVE /A2OSX.SRC/SYS/KERNEL.S.PFT
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.PFT
|
||||||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||||||
|
@ -447,7 +447,7 @@ K.FFlush.A jsr PFT.CheckNodeA
|
|||||||
rts
|
rts
|
||||||
*/-------------------------------------
|
*/-------------------------------------
|
||||||
* # FSeek
|
* # FSeek
|
||||||
* Set the file-position indicator for hFILE
|
* Set the file-position indicator for hFILE
|
||||||
* ## In:
|
* ## In:
|
||||||
* PUSHW = Ptr to Offset (DWORD)
|
* PUSHW = Ptr to Offset (DWORD)
|
||||||
* PUSHB = From
|
* PUSHB = From
|
||||||
@ -511,7 +511,7 @@ K.FSeek jsr PFT.CheckNodeSTK
|
|||||||
rts
|
rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
* # FEOF.A
|
* # FEOF.A
|
||||||
* Test the end-of-file indicator for hFILE
|
* Test the end-of-file indicator for hFILE
|
||||||
* ## In:
|
* ## In:
|
||||||
* A = hFILE
|
* A = hFILE
|
||||||
* ## Out:
|
* ## Out:
|
||||||
@ -550,7 +550,7 @@ K.FEOF.A jsr PFT.CheckNodeA
|
|||||||
K.FEOF.A.MARK .BS 3
|
K.FEOF.A.MARK .BS 3
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
* # FTell
|
* # FTell
|
||||||
* Return the current value of the file-position indicator
|
* Return the current value of the file-position indicator
|
||||||
* ## In:
|
* ## In:
|
||||||
* PUSHW = Ptr to Offset (DWORD)
|
* PUSHW = Ptr to Offset (DWORD)
|
||||||
* PUSHB = hFILE
|
* PUSHB = hFILE
|
||||||
@ -659,7 +659,7 @@ K.SScanF jsr PullPtr1Ptr2Ptr3
|
|||||||
|
|
||||||
stz ASCBUF
|
stz ASCBUF
|
||||||
.20 lda (ZPPtr1)
|
.20 lda (ZPPtr1)
|
||||||
jsr K.SScanF.IsDigit
|
jsr STDIO.IsDigit
|
||||||
bcs .21
|
bcs .21
|
||||||
phx
|
phx
|
||||||
inc ASCBUF
|
inc ASCBUF
|
||||||
@ -669,7 +669,14 @@ K.SScanF jsr PullPtr1Ptr2Ptr3
|
|||||||
jsr K.SScanF.IncPtr1
|
jsr K.SScanF.IncPtr1
|
||||||
bne .20 end of string ?
|
bne .20 end of string ?
|
||||||
|
|
||||||
.21 jsr DEC2HEX
|
.21
|
||||||
|
|
||||||
|
|
||||||
|
* jsr DEC2HEX AToF MIGRATION
|
||||||
|
|
||||||
|
bra *
|
||||||
|
|
||||||
|
|
||||||
lda HEXBUF
|
lda HEXBUF
|
||||||
sta (ZPPtr3)
|
sta (ZPPtr3)
|
||||||
inc ZPPtr3
|
inc ZPPtr3
|
||||||
@ -700,15 +707,6 @@ K.SScanF.IncPtr1
|
|||||||
bne .1
|
bne .1
|
||||||
inc ZPPtr1+1 never Zero
|
inc ZPPtr1+1 never Zero
|
||||||
.1 rts
|
.1 rts
|
||||||
*--------------------------------------
|
|
||||||
K.SScanF.IsDigit
|
|
||||||
cmp #'0'
|
|
||||||
bcc .1
|
|
||||||
cmp #'9'+1
|
|
||||||
bcs .1
|
|
||||||
rts
|
|
||||||
.1 sec
|
|
||||||
rts
|
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
* # PrintF.YA/SPrintF.YA/FPrintF.YA
|
* # PrintF.YA/SPrintF.YA/FPrintF.YA
|
||||||
* Prints C-Style String
|
* Prints C-Style String
|
||||||
@ -725,7 +723,6 @@ K.SScanF.IsDigit
|
|||||||
* CC : success
|
* CC : success
|
||||||
* CS : error code from Output
|
* CS : error code from Output
|
||||||
* Specifiers :
|
* Specifiers :
|
||||||
* %a : pull 2 bytes to Print Access right String 'drwxrwxrwx'
|
|
||||||
* %b : pull 1 byte to Print BIN
|
* %b : pull 1 byte to Print BIN
|
||||||
* %B : pull 2 bytes to Print BIN
|
* %B : pull 2 bytes to Print BIN
|
||||||
* %d : pull 1 byte unsigned DEC 0..255
|
* %d : pull 1 byte unsigned DEC 0..255
|
||||||
@ -792,13 +789,12 @@ K.PrintF.YA >STYA ZPPtr1
|
|||||||
ldx PADLEN PADLEN is not nul, so this 0 is second digit
|
ldx PADLEN PADLEN is not nul, so this 0 is second digit
|
||||||
bne .5
|
bne .5
|
||||||
|
|
||||||
lda #'0'
|
* lda #'0'
|
||||||
sta PADCHAR no, this is the first 0, so make it PADCHAR
|
sta PADCHAR no, this is the first 0, so make it PADCHAR
|
||||||
bra .2
|
bra .2
|
||||||
|
|
||||||
.4 bcc .99 less than '0'....error
|
.4 jsr STDIO.IsDigit
|
||||||
cmp #'9'+1
|
bcs .99
|
||||||
bcs .99 more than '9' ....error
|
|
||||||
|
|
||||||
.5 and #$0F we have a digit
|
.5 and #$0F we have a digit
|
||||||
pha save it...
|
pha save it...
|
||||||
@ -845,13 +841,12 @@ K.PrintF.YA >STYA ZPPtr1
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PrintFESC jmp (PrintFJMP,x)
|
PrintFESC jmp (PrintFJMP,x)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PrintFTBL1 .AS "abBdDuefhHiILnNsS"
|
PrintFTBL1 .AS "bBdDuefhHiILnNsS"
|
||||||
PrintFTBL2 .AS "befnr\%"
|
PrintFTBL2 .AS "befnr\%"
|
||||||
PrintFTBL2.OUT .HS 08.1B.0C.0A.0D \b\e\f\n\r
|
PrintFTBL2.OUT .HS 08.1B.0C.0A.0D \b\e\f\n\r
|
||||||
.DA #'\' \\
|
.DA #'\' \\
|
||||||
.DA #'%' \%
|
.DA #'%' \%
|
||||||
PrintFJMP .DA PrintF.A
|
PrintFJMP .DA PrintF.B,PrintF.BB
|
||||||
.DA PrintF.B,PrintF.BB
|
|
||||||
.DA PrintF.D,PrintF.DD,PrintF.U
|
.DA PrintF.D,PrintF.DD,PrintF.U
|
||||||
.DA PrintF.E,PrintF.F
|
.DA PrintF.E,PrintF.F
|
||||||
.DA PrintF.H,PrintF.HH
|
.DA PrintF.H,PrintF.HH
|
||||||
@ -859,41 +854,6 @@ PrintFJMP .DA PrintF.A
|
|||||||
.DA PrintF.N,PrintF.NN
|
.DA PrintF.N,PrintF.NN
|
||||||
.DA PrintF.S,PrintF.SS
|
.DA PrintF.S,PrintF.SS
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PrintF.A >PULLW HEXBUF
|
|
||||||
|
|
||||||
lda HEXBUF+1
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
tax
|
|
||||||
lda TYPES,x
|
|
||||||
jsr Printf.Cout
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
ldx #0
|
|
||||||
|
|
||||||
.1 lda #'-'
|
|
||||||
lsr HEXBUF
|
|
||||||
bcc .2
|
|
||||||
lda ACCESS,x
|
|
||||||
|
|
||||||
.2 jsr Printf.Cout
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
inx
|
|
||||||
cpx #8
|
|
||||||
bne .1
|
|
||||||
|
|
||||||
.3 lda #'-'
|
|
||||||
lsr HEXBUF+1
|
|
||||||
bcc .4
|
|
||||||
lda ACCESS,x
|
|
||||||
|
|
||||||
.4 jmp Printf.Cout
|
|
||||||
|
|
||||||
.9 rts
|
|
||||||
*--------------------------------------
|
|
||||||
PrintF.BB >PULLA
|
PrintF.BB >PULLA
|
||||||
pha
|
pha
|
||||||
jsr PrintF.B
|
jsr PrintF.B
|
||||||
@ -1152,8 +1112,13 @@ STDIO.IOERR lda #MLI.ERR.IO
|
|||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
TYPES .AS "-dbclssp"
|
STDIO.IsDigit cmp #'0'
|
||||||
ACCESS .AS "rwxrwxrwx"
|
bcc .1
|
||||||
|
cmp #'9'+1
|
||||||
|
rts
|
||||||
|
.1 sec
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
SIGN .BS 1
|
SIGN .BS 1
|
||||||
PADLEN .BS 1
|
PADLEN .BS 1
|
||||||
PADCHAR .BS 1
|
PADCHAR .BS 1
|
||||||
|
@ -20,7 +20,15 @@ K.AToF
|
|||||||
* ## Out:
|
* ## Out:
|
||||||
* Y,A = Int
|
* Y,A = Int
|
||||||
*\--------------------------------------
|
*\--------------------------------------
|
||||||
K.AToI.YA
|
K.AToI.YA >STYA ZPPtr1
|
||||||
|
lda #10 base 10
|
||||||
|
sec signed
|
||||||
|
|
||||||
|
jsr STDLIB.Dec2Hex
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>LDYA HEXBUF
|
||||||
|
.9 rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
* # AToL
|
* # AToL
|
||||||
* Convert String to 32 bits int
|
* Convert String to 32 bits int
|
||||||
@ -29,33 +37,13 @@ K.AToI.YA
|
|||||||
* PUSHW Source String (C-Sring)
|
* PUSHW Source String (C-Sring)
|
||||||
* ## Out:
|
* ## Out:
|
||||||
*\--------------------------------------
|
*\--------------------------------------
|
||||||
K.AToL jsr PullPtr1Ptr2 PSTR in Ptr1,buffer in Ptr2
|
K.AToL jsr PullPtr1Ptr2 C-String in Ptr1, Dst buffer in Ptr2
|
||||||
|
|
||||||
stz ASCBUF
|
lda #10 base 10
|
||||||
|
sec signed
|
||||||
ldx #0
|
|
||||||
|
|
||||||
lda (ZPPtr1)
|
|
||||||
beq .2
|
|
||||||
|
|
||||||
ldy #$ff
|
jsr STDLIB.Dec2Hex
|
||||||
|
bcs .9
|
||||||
.1 iny
|
|
||||||
lda (ZPPtr1),y
|
|
||||||
beq .2
|
|
||||||
|
|
||||||
cmp #'0'
|
|
||||||
bcc .2
|
|
||||||
cmp #'9'+1
|
|
||||||
bcs .2
|
|
||||||
|
|
||||||
sta ASCBUF,x
|
|
||||||
inx
|
|
||||||
cpx #10
|
|
||||||
bne .1
|
|
||||||
|
|
||||||
.2 stz ASCBUF,x
|
|
||||||
jsr DEC2HEX
|
|
||||||
|
|
||||||
ldy #3
|
ldy #3
|
||||||
|
|
||||||
@ -64,21 +52,55 @@ K.AToL jsr PullPtr1Ptr2 PSTR in Ptr1,buffer in Ptr2
|
|||||||
dey
|
dey
|
||||||
bpl .3
|
bpl .3
|
||||||
|
|
||||||
clc
|
.9 rts
|
||||||
rts
|
*/--------------------------------------
|
||||||
|
* # StrToF
|
||||||
|
* Convert String to 40 bits Float
|
||||||
|
* ## In:
|
||||||
|
* PUSHW PTR to target buffer FLOAT (5 bytes)
|
||||||
|
* PUSHW PTR to EndPtr
|
||||||
|
* PUSHW Source String (C-Sring)
|
||||||
|
* ## Out:
|
||||||
|
*\--------------------------------------
|
||||||
|
K.StrToF
|
||||||
|
*/--------------------------------------
|
||||||
|
* # StrToL
|
||||||
|
* Convert String to 32 bits int
|
||||||
|
* ## In:
|
||||||
|
* PUSHB Base
|
||||||
|
* PUSHW PTR to target buffer DWORD
|
||||||
|
* PUSHW PTR to EndPtr
|
||||||
|
* PUSHW Source String (C-Sring)
|
||||||
|
* ## Out:
|
||||||
|
*\--------------------------------------
|
||||||
|
K.StrToL
|
||||||
|
*/--------------------------------------
|
||||||
|
* # StrToUL
|
||||||
|
* Convert String to 32 bits unsigned int
|
||||||
|
* ## In:
|
||||||
|
* PUSHB Base
|
||||||
|
* PUSHW PTR to target buffer DWORD
|
||||||
|
* PUSHW PTR to EndPtr
|
||||||
|
* PUSHW Source String (C-Sring)
|
||||||
|
* ## Out:
|
||||||
|
*\--------------------------------------
|
||||||
|
K.StrToUL
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Convert ASCBUF decimal to HEXBUF
|
* Convert ZPPtr1 to HEXBUF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DEC2HEX stz HEXBUF
|
STDLIB.Dec2Hex stz HEXBUF
|
||||||
stz HEXBUF+1
|
stz HEXBUF+1
|
||||||
stz HEXBUF+2
|
stz HEXBUF+2
|
||||||
stz HEXBUF+3
|
stz HEXBUF+3
|
||||||
|
|
||||||
ldx #$ff
|
ldy #$ff
|
||||||
|
|
||||||
.1 inx
|
.1 iny
|
||||||
lda ASCBUF,x
|
lda (ZPPtr1),y
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
jsr STDIO.IsDigit
|
||||||
|
bcs .8
|
||||||
|
|
||||||
lda HEXBUF+3 save HEXBUF for 4+1
|
lda HEXBUF+3 save HEXBUF for 4+1
|
||||||
pha
|
pha
|
||||||
@ -90,11 +112,12 @@ DEC2HEX stz HEXBUF
|
|||||||
pha
|
pha
|
||||||
|
|
||||||
jsr HEXBUF.ROL HEXBUF * 2 -> HEXBUF
|
jsr HEXBUF.ROL HEXBUF * 2 -> HEXBUF
|
||||||
* bcs .9 overflow!!!
|
bcs .9 overflow!!!
|
||||||
|
|
||||||
jsr HEXBUF.ROL HEXBUF * 4 -> HEXBUF
|
jsr HEXBUF.ROL HEXBUF * 4 -> HEXBUF
|
||||||
* bcs .9 overflow!!!
|
bcs .9 overflow!!!
|
||||||
|
|
||||||
|
* clc
|
||||||
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
||||||
adc HEXBUF
|
adc HEXBUF
|
||||||
sta HEXBUF
|
sta HEXBUF
|
||||||
@ -107,12 +130,12 @@ DEC2HEX stz HEXBUF
|
|||||||
pla
|
pla
|
||||||
adc HEXBUF+3
|
adc HEXBUF+3
|
||||||
sta HEXBUF+3
|
sta HEXBUF+3
|
||||||
* bcs .99 overflow!!!
|
bcs .99 overflow!!!
|
||||||
|
|
||||||
jsr HEXBUF.ROL HEXBUF * 10 -> HEXBUF
|
jsr HEXBUF.ROL HEXBUF * 10 -> HEXBUF
|
||||||
* bcs .99 overflow!!!
|
bcs .99 overflow!!!
|
||||||
|
|
||||||
lda ASCBUF,x
|
lda (ZPPtr1),y
|
||||||
and #$0F
|
and #$0F
|
||||||
|
|
||||||
adc HEXBUF
|
adc HEXBUF
|
||||||
@ -123,15 +146,16 @@ DEC2HEX stz HEXBUF
|
|||||||
inc HEXBUF+2
|
inc HEXBUF+2
|
||||||
bne .1
|
bne .1
|
||||||
inc HEXBUF+3
|
inc HEXBUF+3
|
||||||
bra .1
|
bne .1 overflow!!!
|
||||||
|
|
||||||
.8 rts
|
.9 pla discard saved HEXBUF
|
||||||
|
pla
|
||||||
*.9 pla discard saved HEXBUF
|
pla
|
||||||
* pla
|
pla
|
||||||
* pla
|
.99 rts
|
||||||
* pla
|
|
||||||
*.99 rts
|
.8 clc
|
||||||
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
HEXBUF.ROL asl HEXBUF
|
HEXBUF.ROL asl HEXBUF
|
||||||
rol HEXBUF+1
|
rol HEXBUF+1
|
||||||
|
Loading…
Reference in New Issue
Block a user