mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-03 18:30:20 +00:00
Kernel 0.9.1 : BugFix in AtoF, LoadFile, reviewed FTell/FSeek API
This commit is contained in:
parent
4cae83f359
commit
a6ac9584d8
@ -313,7 +313,7 @@ return a hFile for a given Device Name
|
||||
+ A = hFILE
|
||||
|
||||
# MKFIFO
|
||||
return a S.FILE to a new FIFO
|
||||
return a hFILE to a new FIFO
|
||||
|
||||
## IN:
|
||||
|
||||
@ -469,22 +469,15 @@ Read bytes from file
|
||||
+ A = hFILE
|
||||
|
||||
# FSeek
|
||||
+ Set the file-position indicator for hFILE
|
||||
|
||||
## In:
|
||||
+ PUSHW = OffsetHi
|
||||
+ PUSHW = OffsetLo
|
||||
+ PUSHW = Ptr to Offset (DWORD)
|
||||
+ PUSHB = From
|
||||
+ PUSHB = hFILE
|
||||
|
||||
# FTell.A
|
||||
|
||||
## In:
|
||||
+ A = hFILE
|
||||
|
||||
## Out:
|
||||
+ Y,A,X = Offset
|
||||
|
||||
# FEOF.A
|
||||
+ Test the end-of-file indicator for hFILE
|
||||
|
||||
## In:
|
||||
+ A = hFILE
|
||||
@ -495,6 +488,16 @@ Read bytes from file
|
||||
+ A =0 NOT EOF
|
||||
+ CS :
|
||||
|
||||
# FTell
|
||||
+ Return the current value of the file-position indicator
|
||||
|
||||
## In:
|
||||
+ PUSHW = Ptr to Offset (DWORD)
|
||||
+ PUSHB = hFILE
|
||||
|
||||
## Out:
|
||||
+ Offset = Offset
|
||||
|
||||
# Remove.YA
|
||||
|
||||
# Rename
|
||||
@ -670,7 +673,7 @@ Convert string to UPPERCASE/lowercase
|
||||
+ PUSHW = Dst PTR To S.TIME
|
||||
+ PUSHW = Src PTR to ProDOS DATE/TIME (DWORD)
|
||||
|
||||
# K.CTime2Time
|
||||
# CTime2Time
|
||||
+ Convert CTIME to S.TIME
|
||||
|
||||
## In :
|
||||
|
@ -25,7 +25,7 @@
|
||||
+ PUSHW PTR to MAC
|
||||
+ PUSHW PTR to IP
|
||||
|
||||
# ARP.GetC.Ache
|
||||
# ARP.GetCAche
|
||||
+ Return a Ptr to ARP Cache Table
|
||||
|
||||
## In:
|
||||
@ -58,7 +58,7 @@
|
||||
+ PUSHW = PTR to IP
|
||||
+ PUSHW = hostname PSTR to Add
|
||||
|
||||
# DNS.GetC.Ache
|
||||
# DNS.GetCAche
|
||||
+ Return a Ptr to DNS Cache Table
|
||||
|
||||
## In:
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -91,9 +91,6 @@ InitSrcDirYA >SYSCALL RealPath.YA
|
||||
txa
|
||||
>STA.G hFilter
|
||||
|
||||
>LDYA ZPPtr2
|
||||
jsr DEBUG.YA
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr2)
|
||||
|
||||
|
@ -569,7 +569,7 @@ Cmd.Exec.SLEEP lda (ZPPtr2)
|
||||
|
||||
>PUSHEA.G Sleep
|
||||
>PUSHW ZPPtr2
|
||||
>SYSCALL AToI.YA
|
||||
>SYSCALL AToL
|
||||
|
||||
bcs .9
|
||||
|
||||
|
@ -14,34 +14,21 @@ AUTO 6
|
||||
* Y,A = File Length
|
||||
* X = hMem of Loaded File
|
||||
*\--------------------------------------
|
||||
K.LoadFile lda (pStack) read PTR.LO on top of stack
|
||||
pha
|
||||
ldy #1
|
||||
lda (pStack),y read PTR.HI on top of stack
|
||||
pha
|
||||
>PUSHWI K.S.STAT
|
||||
pla
|
||||
ply
|
||||
>PUSHYA
|
||||
jsr K.Stat
|
||||
bcs .10
|
||||
K.LoadFile jsr K.FOpen
|
||||
bcs .9
|
||||
sta K.LoadFile.hFile
|
||||
|
||||
lda K.S.STAT+S.STAT.SIZE+3
|
||||
ora K.S.STAT+S.STAT.SIZE+2
|
||||
bne .11
|
||||
|
||||
>LDYA K.S.STAT+S.STAT.SIZE push len
|
||||
jsr K.LoadFile.GetLen
|
||||
bcs .99
|
||||
|
||||
>LDYA K.LoadFile.FSize
|
||||
jsr K.GetMem.YA
|
||||
bcs .10
|
||||
bcs .99
|
||||
>STYA K.LoadFile.Mem
|
||||
stx .8+1
|
||||
|
||||
jsr K.FOpen
|
||||
bcs .9
|
||||
sta K.LoadFile.hFile
|
||||
|
||||
|
||||
>PUSHW K.LoadFile.Mem
|
||||
>PUSHW K.S.STAT+S.STAT.SIZE
|
||||
>PUSHW K.LoadFile.FSize
|
||||
>PUSHB K.LoadFile.hFile
|
||||
jsr K.FRead
|
||||
bcs .97
|
||||
@ -56,13 +43,6 @@ K.LoadFile lda (pStack) read PTR.LO on top of stack
|
||||
.8 ldx #$ff Self Modified
|
||||
clc
|
||||
.9 rts
|
||||
|
||||
.11 lda #SYSMGR.ERRFTB
|
||||
.10 pha
|
||||
>POP 6
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
||||
.97 pha
|
||||
lda .8+1
|
||||
@ -76,8 +56,45 @@ K.LoadFile lda (pStack) read PTR.LO on top of stack
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.LoadFile.GetLen
|
||||
stz K.LoadFile.FPos
|
||||
stz K.LoadFile.FPos+1
|
||||
stz K.LoadFile.FPos+2
|
||||
stz K.LoadFile.FPos+3
|
||||
|
||||
>PUSHWI K.LoadFile.FPos
|
||||
>PUSHBI SYS.FSeek.END
|
||||
>PUSHB K.LoadFile.hFile
|
||||
jsr K.FSeek
|
||||
bcs .99
|
||||
|
||||
>PUSHWI K.LoadFile.FPos
|
||||
>PUSHB K.LoadFile.hFile
|
||||
jsr K.FTell
|
||||
bcs .99
|
||||
|
||||
lda K.LoadFile.FPos+2
|
||||
ora K.LoadFile.FPos+3
|
||||
bne .98 too big!
|
||||
|
||||
>LDYA K.LoadFile.FPos
|
||||
>STYA K.LoadFile.FSize
|
||||
|
||||
stz K.LoadFile.FPos
|
||||
stz K.LoadFile.FPos+1
|
||||
|
||||
>PUSHWI K.LoadFile.FPos
|
||||
>PUSHBI SYS.FSeek.SET
|
||||
>PUSHB K.LoadFile.hFile
|
||||
jmp K.FSeek
|
||||
|
||||
.98 lda #SYSMGR.ERRFTB
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
K.LoadFile.hFile .BS 1
|
||||
K.LoadFile.Mem .BS 2
|
||||
K.LoadFile.FPos .BS 4
|
||||
K.LoadFile.Mem .BS 2
|
||||
K.LoadFile.FSize .BS 2
|
||||
*/--------------------------------------
|
||||
* # SaveFile
|
||||
* ## In:
|
||||
|
@ -41,7 +41,7 @@ K.SYSCALL.JMP .DA 0 $00
|
||||
.DA K.FWrite
|
||||
.DA K.FFlush.A
|
||||
.DA K.FSeek
|
||||
.DA K.FTell.A
|
||||
.DA K.FTell
|
||||
.DA K.FEOF.A
|
||||
|
||||
.DA K.Remove.YA $40
|
||||
|
@ -103,9 +103,7 @@ PS.CreateChild ldx #0
|
||||
plx
|
||||
sta PS.Table.hMem,x
|
||||
|
||||
lda CORE.LastPSID Set Ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
ldy #S.PS.PID
|
||||
lda CORE.LastPSID
|
||||
@ -123,9 +121,7 @@ PS.CreateChild ldx #0
|
||||
jsr K.NewStr.YA
|
||||
bcs .9
|
||||
|
||||
lda CORE.LastPSID Set Ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
txa
|
||||
ldy #S.PS.hPREFIX
|
||||
@ -210,9 +206,7 @@ PS.CmdLine2Args >STYA ZPPtr1
|
||||
ldy #S.PS.hARGS
|
||||
sta (ZPPtr3),y
|
||||
|
||||
lda CORE.LastPSID Set Ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
stz PS.CmdLine2Args.bInQuote
|
||||
|
||||
@ -282,6 +276,9 @@ PS.Init jsr BIN.Load.YA Y,A=filename full path
|
||||
ldy #S.PS.hCS
|
||||
sta (ZPPtr3),y save CS hMem in S.PS
|
||||
|
||||
jsr K.GetMemByID.A
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
ldy #H.BIN.EXE.DS.SIZE+1
|
||||
lda (ZPPtr4),y Load DS.SIZE HI
|
||||
tax
|
||||
@ -307,9 +304,7 @@ PS.Init jsr BIN.Load.YA Y,A=filename full path
|
||||
ldy #S.PS.hDS
|
||||
sta (ZPPtr3),y save DS hMem in S.PS
|
||||
|
||||
lda CORE.LastPSID Set Ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
.2 ldy #H.BIN.EXE.SS.SIZE
|
||||
lda (ZPPtr4),y Load SS.SIZE
|
||||
@ -335,9 +330,7 @@ PS.Init jsr BIN.Load.YA Y,A=filename full path
|
||||
ldy #S.PS.hSS
|
||||
sta (ZPPtr3),y save SS hMem in S.PS
|
||||
|
||||
lda CORE.LastPSID Set Ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
@ -357,9 +350,7 @@ PS.DupEnv.A jsr K.GetMemPtr.A
|
||||
|
||||
>STYA ZPPtr2
|
||||
|
||||
lda CORE.LastPSID Set this copy ownership
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
jsr PS.SetMemOwnership Set Ownership
|
||||
|
||||
ldy #0
|
||||
|
||||
@ -387,6 +378,12 @@ PS.DupEnv.A jsr K.GetMemPtr.A
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
PS.SetMemOwnership
|
||||
lda CORE.LastPSID
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMEMMGR),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.GetPSStatus.A jsr CORE.GetPSByID.A
|
||||
bcs .9
|
||||
>STYA ZPPtr1
|
||||
|
@ -3,6 +3,16 @@ PREFIX /A2OSX.BUILD
|
||||
LOMEM $A00
|
||||
INC 1
|
||||
AUTO 6
|
||||
*--------------------------------------
|
||||
* # FStat
|
||||
* Return information about a hfile
|
||||
* ## In :
|
||||
* PUSHW = PTR to S.STAT buffer
|
||||
* PUSHB = hFile
|
||||
* ## Out :
|
||||
*--------------------------------------
|
||||
*jsr PFT.CheckNodeSTK
|
||||
|
||||
*/--------------------------------------
|
||||
* # Stat
|
||||
* Return information about a file
|
||||
@ -158,7 +168,7 @@ K.MkNod.YA jsr K.GetDevByName.YA Ptr1=NAME
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # MKFIFO
|
||||
* return a S.FILE to a new FIFO
|
||||
* return a hFILE to a new FIFO
|
||||
* ## IN:
|
||||
* ## OUT:
|
||||
* CC = OK, CS = ERROR
|
||||
|
@ -280,7 +280,7 @@ K.FOpen.10 >LDYAI S.NODE.REG
|
||||
bcs K.FOpen.9
|
||||
|
||||
>STYA ZPPtr1
|
||||
stx hFILE
|
||||
stx .8+1
|
||||
|
||||
jsr STDIO.SetIOBUF
|
||||
bcs .98
|
||||
@ -327,12 +327,12 @@ K.FOpen.10 >LDYAI S.NODE.REG
|
||||
.30 ldy #S.NODE.T
|
||||
lda #S.NODE.T.REG
|
||||
sta (ZPPtr1),y
|
||||
lda hFILE
|
||||
.8 lda #$ff Self Modified
|
||||
clc
|
||||
rts CC
|
||||
|
||||
.98 pha save MLI error
|
||||
lda hFILE
|
||||
lda .8+1
|
||||
jsr K.FClose.A.1
|
||||
pla get back MLI error
|
||||
sec
|
||||
@ -341,7 +341,6 @@ K.FOpen.10 >LDYAI S.NODE.REG
|
||||
K.FOpen.MODE .BS 1
|
||||
K.FOpen.TYPE .BS 1
|
||||
K.FOpen.AUXTYPE .BS 2
|
||||
hFILE .BS 1
|
||||
*/--------------------------------------
|
||||
* # FClose.A
|
||||
* Close a file
|
||||
@ -448,9 +447,9 @@ K.FFlush.A jsr PFT.CheckNodeA
|
||||
rts
|
||||
*/-------------------------------------
|
||||
* # FSeek
|
||||
* Set the file-position indicator for hFILE
|
||||
* ## In:
|
||||
* PUSHW = OffsetHi
|
||||
* PUSHW = OffsetLo
|
||||
* PUSHW = Ptr to Offset (DWORD)
|
||||
* PUSHB = From
|
||||
* PUSHB = hFILE
|
||||
*\-------------------------------------
|
||||
@ -459,39 +458,44 @@ K.FSeek jsr PFT.CheckNodeSTK
|
||||
jsr STDIO.GetRefNum
|
||||
>PULLA FROM
|
||||
tax
|
||||
>PULLW K.FSeek.OFFSET
|
||||
>PULLW K.FSeek.OFFSET+2
|
||||
|
||||
cpx #SYS.FSeek.SET
|
||||
|
||||
bne .1
|
||||
stz K.MLI.PARAMS+2
|
||||
>PULLW ZPPtr1
|
||||
cpx #SYS.FSeek.END+1
|
||||
bcs .98
|
||||
txa
|
||||
asl
|
||||
tax
|
||||
|
||||
jmp (.1,x)
|
||||
|
||||
.1 .DA .10
|
||||
.DA .20
|
||||
.DA .30
|
||||
* K.FSeek.SET
|
||||
.10 stz K.MLI.PARAMS+2
|
||||
stz K.MLI.PARAMS+3
|
||||
stz K.MLI.PARAMS+4
|
||||
bra .8
|
||||
|
||||
.1 cpx #SYS.FSeek.CUR
|
||||
bne .2
|
||||
>MLICALL MLIGETMARK
|
||||
* K.FSeek.CUR
|
||||
.20 >MLICALL MLIGETMARK
|
||||
bcc .8
|
||||
rts
|
||||
|
||||
.2 cpx #SYS.FSeek.END
|
||||
bne .98
|
||||
>MLICALL MLIGETEOF
|
||||
* K.FSeek.END
|
||||
.30 >MLICALL MLIGETEOF
|
||||
bcs .9
|
||||
|
||||
.8 ldx #0
|
||||
ldy #3
|
||||
.8 ldy #0
|
||||
ldx #3 3 bytes, 24 bits!!!
|
||||
|
||||
clc
|
||||
|
||||
.81 lda K.MLI.PARAMS+2,x
|
||||
adc K.FSeek.OFFSET,x
|
||||
sta K.MLI.PARAMS+2,x
|
||||
.81 lda K.MLI.PARAMS+2,y
|
||||
adc (ZPPtr1),y
|
||||
sta K.MLI.PARAMS+2,y
|
||||
|
||||
inx
|
||||
dey
|
||||
iny
|
||||
dex
|
||||
bne .81
|
||||
|
||||
bcs .99 Offset out of range!
|
||||
@ -505,24 +509,9 @@ K.FSeek jsr PFT.CheckNodeSTK
|
||||
.99 lda #SYSMGR.ERRFTB
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.FSeek.OFFSET .BS 4
|
||||
*/--------------------------------------
|
||||
* # FTell.A
|
||||
* ## In:
|
||||
* A = hFILE
|
||||
* ## Out:
|
||||
* Y,A,X = Offset
|
||||
*\--------------------------------------
|
||||
K.FTell.A jsr PFT.CheckNodeA
|
||||
K.FTell.A.1 jsr STDIO.GetRefNum
|
||||
>MLICALL MLIGETMARK
|
||||
bcs .9
|
||||
>LDYA K.MLI.PARAMS+2
|
||||
ldx K.MLI.PARAMS+4
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* # FEOF.A
|
||||
* Test the end-of-file indicator for hFILE
|
||||
* ## In:
|
||||
* A = hFILE
|
||||
* ## Out:
|
||||
@ -533,27 +522,62 @@ K.FTell.A.1 jsr STDIO.GetRefNum
|
||||
*\--------------------------------------
|
||||
K.FEOF.A jsr PFT.CheckNodeA
|
||||
jsr STDIO.GetRefNum
|
||||
jsr K.FTell.A.1
|
||||
|
||||
>MLICALL MLIGETMARK
|
||||
bcs .9
|
||||
>STYA K.FEOF.A.MARK
|
||||
stx K.FEOF.A.MARK+2
|
||||
|
||||
ldy #2
|
||||
|
||||
.1 lda K.MLI.PARAMS+2,y
|
||||
sta K.FEOF.A.MARK,y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
>MLICALL MLIGETEOF
|
||||
bcs .9
|
||||
|
||||
sec
|
||||
lda K.MLI.PARAMS+2
|
||||
sbc K.FEOF.A.MARK
|
||||
ldy #2
|
||||
|
||||
.2 lda K.MLI.PARAMS+2,y
|
||||
eor K.FEOF.A.MARK,y
|
||||
bne .8
|
||||
lda K.MLI.PARAMS+3
|
||||
sbc K.FEOF.A.MARK+1
|
||||
bne .8
|
||||
lda K.MLI.PARAMS+4
|
||||
sbc K.FEOF.A.MARK+2
|
||||
dey
|
||||
bpl .2
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
|
||||
K.FEOF.A.MARK .BS 3
|
||||
*/--------------------------------------
|
||||
* # FTell
|
||||
* Return the current value of the file-position indicator
|
||||
* ## In:
|
||||
* PUSHW = Ptr to Offset (DWORD)
|
||||
* PUSHB = hFILE
|
||||
* ## Out:
|
||||
* Offset = Offset
|
||||
*\--------------------------------------
|
||||
K.FTell jsr PFT.CheckNodeSTK
|
||||
>PULLA
|
||||
jsr STDIO.GetRefNum
|
||||
>PULLW ZPPtr1
|
||||
>MLICALL MLIGETMARK
|
||||
bcs .9
|
||||
|
||||
ldy #3
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr1),y
|
||||
|
||||
dey
|
||||
|
||||
.1 lda K.MLI.PARAMS+2,y
|
||||
sta (ZPPtr1),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* # Remove.YA
|
||||
*\--------------------------------------
|
||||
K.Remove.YA jsr PFT.CheckPathYA
|
||||
|
@ -8,7 +8,7 @@ AUTO 6
|
||||
* Convert String to 40 bits Float
|
||||
* ## In:
|
||||
* PUSHW PTR to target buffer (5 Bytes)
|
||||
* PUSHW Source String (PSTR)
|
||||
* PUSHW Source String (C-Sring)
|
||||
* ## Out:
|
||||
*\--------------------------------------
|
||||
K.AToF
|
||||
@ -67,6 +67,78 @@ K.AToL jsr PullPtr1Ptr2 PSTR in Ptr1,buffer in Ptr2
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert ASCBUF decimal to HEXBUF
|
||||
*--------------------------------------
|
||||
DEC2HEX stz HEXBUF
|
||||
stz HEXBUF+1
|
||||
stz HEXBUF+2
|
||||
stz HEXBUF+3
|
||||
|
||||
ldx #$ff
|
||||
|
||||
.1 inx
|
||||
lda ASCBUF,x
|
||||
beq .8
|
||||
|
||||
lda HEXBUF+3 save HEXBUF for 4+1
|
||||
pha
|
||||
lda HEXBUF+2
|
||||
pha
|
||||
lda HEXBUF+1
|
||||
pha
|
||||
lda HEXBUF
|
||||
pha
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 2 -> HEXBUF
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 4 -> HEXBUF
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
pla
|
||||
adc HEXBUF+1
|
||||
sta HEXBUF+1
|
||||
pla
|
||||
adc HEXBUF+2
|
||||
sta HEXBUF+2
|
||||
pla
|
||||
adc HEXBUF+3
|
||||
sta HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 10 -> HEXBUF
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
lda ASCBUF,x
|
||||
and #$0F
|
||||
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
bcc .1
|
||||
inc HEXBUF+1
|
||||
bne .1
|
||||
inc HEXBUF+2
|
||||
bne .1
|
||||
inc HEXBUF+3
|
||||
bra .1
|
||||
|
||||
.8 rts
|
||||
|
||||
*.9 pla discard saved HEXBUF
|
||||
* pla
|
||||
* pla
|
||||
* pla
|
||||
*.99 rts
|
||||
*--------------------------------------
|
||||
HEXBUF.ROL asl HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert HEXBUF to ASCBUF decimal padded with 0
|
||||
*--------------------------------------
|
||||
HEX2DEC ldx #4
|
||||
@ -116,80 +188,6 @@ HEX2DEC ldx #4
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert ASCBUF decimal to HEXBUF
|
||||
*--------------------------------------
|
||||
DEC2HEX stz HEXBUF
|
||||
stz HEXBUF+1
|
||||
stz HEXBUF+2
|
||||
stz HEXBUF+3
|
||||
|
||||
lda ASCBUF
|
||||
beq .8
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda HEXBUF+3 save HEXBUF for 4+1
|
||||
pha
|
||||
lda HEXBUF+2
|
||||
pha
|
||||
lda HEXBUF+1
|
||||
pha
|
||||
lda HEXBUF
|
||||
pha
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 2 -> HEXBUF
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 4 -> HEXBUF
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
pla
|
||||
adc HEXBUF+1
|
||||
sta HEXBUF+1
|
||||
pla
|
||||
adc HEXBUF+2
|
||||
sta HEXBUF+2
|
||||
pla
|
||||
adc HEXBUF+3
|
||||
sta HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
jsr HEXBUF.ROL HEXBUF * 10 -> HEXBUF
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
inx
|
||||
lda ASCBUF,x
|
||||
and #$0F
|
||||
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
bcc .2
|
||||
inc HEXBUF+1
|
||||
bne .2
|
||||
inc HEXBUF+2
|
||||
bne .2
|
||||
inc HEXBUF+3
|
||||
|
||||
.2 cpx ASCBUF
|
||||
bne .1
|
||||
|
||||
.8 rts
|
||||
|
||||
*.9 pla discard saved HEXBUF
|
||||
* pla
|
||||
* pla
|
||||
* pla
|
||||
*.99 rts
|
||||
*--------------------------------------
|
||||
HEXBUF.ROL asl HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
HEXBUF .BS 4 32 bits max
|
||||
BCDBUF .BS 5 5, enough to handle 10 digits (32bits)
|
||||
ASCBUF .BS 12 LEN + sign + 10 digits ($FFFFFFFF=4.294.967.295)
|
||||
|
@ -161,7 +161,7 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
|
||||
clc
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # K.CTime2Time
|
||||
* # CTime2Time
|
||||
* Convert CTIME to S.TIME
|
||||
* ## In :
|
||||
* PUSHW = Dst PTR To S.TIME
|
||||
|
Loading…
Reference in New Issue
Block a user