mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-10 16:29:28 +00:00
Kernel 0.93+
This commit is contained in:
parent
db84c9d78c
commit
4af39d70ad
Binary file not shown.
@ -113,7 +113,7 @@ CSH.Run.1 cmp #'#'
|
|||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
>LDYA ZPVarID X = Exp Type
|
>LDYA ZPVarID X = Exp Type
|
||||||
jsr CSH.SetVarValue
|
jsr CSH.SetVarValueFromStack
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.GetChar
|
jsr CSH.GetChar
|
||||||
@ -347,7 +347,7 @@ CSH.TYPE stx ZPVarType
|
|||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
.7 >LDYA ZPVarID
|
.7 >LDYA ZPVarID
|
||||||
jsr CSH.AddVarValue X= Type, Add value to this var
|
jsr CSH.AddVarValueFromStack X= Type, Add value to this var
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
jsr CSH.GetChar
|
jsr CSH.GetChar
|
||||||
@ -536,7 +536,7 @@ CSH.ExpEval ldx ZPPtr1
|
|||||||
bcs .1
|
bcs .1
|
||||||
|
|
||||||
ldx ZPPtr2 var type (could be 0=any)
|
ldx ZPPtr2 var type (could be 0=any)
|
||||||
jsr CSH.GetVarValue Y,A = VarID, Get value on stack
|
jsr CSH.GetVarValueOnStack Y,A = VarID, Get value on stack
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
stx ZPPtr2 store real var type
|
stx ZPPtr2 store real var type
|
||||||
@ -545,12 +545,13 @@ CSH.ExpEval ldx ZPPtr1
|
|||||||
.1 lda ZPPtr2 var type
|
.1 lda ZPPtr2 var type
|
||||||
jsr CSH.fCall X = function index
|
jsr CSH.fCall X = function index
|
||||||
bcs .99
|
bcs .99
|
||||||
stx ZPPtr2 store real var type
|
* stx ZPPtr2 store real var type
|
||||||
bra .11
|
bra .11
|
||||||
|
|
||||||
.2 jsr CSH.IsDigit10 number ?
|
.2 jsr CSH.IsDigit10 number ?
|
||||||
bcs .3
|
bcs .3
|
||||||
|
|
||||||
|
ldx ZPPtr2
|
||||||
jsr CSH.GetNumOnStack
|
jsr CSH.GetNumOnStack
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
@ -598,7 +599,8 @@ CSH.ExpEval ldx ZPPtr1
|
|||||||
jmp .10
|
jmp .10
|
||||||
|
|
||||||
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
||||||
.6 ldx ZPPtr2+1
|
.6 lda ZPPtr2 Var Type
|
||||||
|
ldx ZPPtr2+1 BOP
|
||||||
jsr CSH.Compute
|
jsr CSH.Compute
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
@ -609,6 +611,7 @@ CSH.ExpEval ldx ZPPtr1
|
|||||||
.8 ldx ZPPtr2+1
|
.8 ldx ZPPtr2+1
|
||||||
bmi .80
|
bmi .80
|
||||||
|
|
||||||
|
lda ZPPtr2 Var Type
|
||||||
jsr CSH.Compute
|
jsr CSH.Compute
|
||||||
bcc .80
|
bcc .80
|
||||||
bcs .99
|
bcs .99
|
||||||
@ -761,8 +764,7 @@ CSH.ZPPtr1AddAp1
|
|||||||
.1 rts
|
.1 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetNumOnStack
|
CSH.GetNumOnStack
|
||||||
lda ZPVarType
|
cpx #CSH.T.FLOAT
|
||||||
cmp #CSH.T.FLOAT
|
|
||||||
bcc .1
|
bcc .1
|
||||||
|
|
||||||
>PUSHWI ZPFileBufPtr
|
>PUSHWI ZPFileBufPtr
|
||||||
@ -776,7 +778,7 @@ CSH.GetNumOnStack
|
|||||||
>PUSHWI ZPFileBufPtr
|
>PUSHWI ZPFileBufPtr
|
||||||
>LDYA ZPFileBufPtr
|
>LDYA ZPFileBufPtr
|
||||||
|
|
||||||
ldx ZPVarType
|
phx
|
||||||
cpx #CSH.T.UCHAR
|
cpx #CSH.T.UCHAR
|
||||||
bcc .2
|
bcc .2
|
||||||
|
|
||||||
@ -784,10 +786,11 @@ CSH.GetNumOnStack
|
|||||||
bra .3
|
bra .3
|
||||||
|
|
||||||
.2 >SYSCALL StrToL
|
.2 >SYSCALL StrToL
|
||||||
.3 bcs .9
|
|
||||||
|
|
||||||
ldy ZPVarType
|
.3 plx
|
||||||
lda CSH.TYPESIZE,y
|
bcs .9
|
||||||
|
|
||||||
|
lda CSH.TYPESIZE,x
|
||||||
cmp #4
|
cmp #4
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
@ -809,7 +812,7 @@ CSH.GetNumOnStack
|
|||||||
.8 clc
|
.8 clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Input : ZPFileBufPtr, A = Var Type, Value on Stack
|
* Input : ZPFileBufPtr
|
||||||
* Output : Y,A = ZPVarID
|
* Output : Y,A = ZPVarID
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.AddVar >PUSHW ZPFileBufPtr
|
CSH.AddVar >PUSHW ZPFileBufPtr
|
||||||
@ -833,12 +836,14 @@ CSH.AddVar >PUSHW ZPFileBufPtr
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Y,A = VarID, X=Type
|
* Y,A = VarID, X=Type
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.AddVarValue sec
|
CSH.AddVarValueFromStack
|
||||||
|
sec
|
||||||
.HS 90 BCC
|
.HS 90 BCC
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Y,A = VarID, X=Type
|
* Y,A = VarID, X=Type
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.SetVarValue clc
|
CSH.SetVarValueFromStack
|
||||||
|
clc
|
||||||
php
|
php
|
||||||
|
|
||||||
pha
|
pha
|
||||||
@ -897,8 +902,9 @@ CSH.GetVar >PUSHW ZPFileBufPtr
|
|||||||
* Input : Y,A = VarID, X = Var Type (or 0)
|
* Input : Y,A = VarID, X = Var Type (or 0)
|
||||||
* Output : Value on Stack, X = Var Type
|
* Output : Value on Stack, X = Var Type
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetVarValue stx ZPVarType
|
CSH.GetVarValueOnStack
|
||||||
>DEBUG
|
stx ZPVarType
|
||||||
|
|
||||||
pha
|
pha
|
||||||
>PUSHWI 0 From Start
|
>PUSHWI 0 From Start
|
||||||
>PUSHWI 6 6 bytes
|
>PUSHWI 6 6 bytes
|
||||||
@ -968,8 +974,7 @@ CSH.IsValue0 cpx #CSH.T.FLOAT
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.Compute jmp (J.CSH.BOPS,x)
|
CSH.Compute jmp (J.CSH.BOPS,x)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.BOPS.ADD lda ZPVarType
|
CSH.BOPS.ADD cmp #CSH.T.FLOAT
|
||||||
cmp #CSH.T.FLOAT
|
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
|
||||||
@ -977,11 +982,11 @@ CSH.BOPS.ADD lda ZPVarType
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.8 >FPU FADD
|
.8 >FPU FADD
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
CSH.BOPS.SUB lda ZPVarType
|
CSH.BOPS.SUB cmp #CSH.T.FLOAT
|
||||||
cmp #CSH.T.FLOAT
|
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
|
||||||
@ -989,10 +994,10 @@ CSH.BOPS.SUB lda ZPVarType
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.8 >FPU FSUB
|
.8 >FPU FSUB
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
CSH.BOPS.MUL lda ZPVarType
|
CSH.BOPS.MUL cmp #CSH.T.FLOAT
|
||||||
cmp #CSH.T.FLOAT
|
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
|
||||||
@ -1000,10 +1005,10 @@ CSH.BOPS.MUL lda ZPVarType
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.8 >FPU FMULT
|
.8 >FPU FMULT
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
CSH.BOPS.DIV lda ZPVarType
|
CSH.BOPS.DIV cmp #CSH.T.FLOAT
|
||||||
cmp #CSH.T.FLOAT
|
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
|
||||||
@ -1011,6 +1016,7 @@ CSH.BOPS.DIV lda ZPVarType
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.8 >FPU FDIV
|
.8 >FPU FDIV
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
CSH.BOPS.MOD
|
CSH.BOPS.MOD
|
||||||
CSH.BOPS.SHL
|
CSH.BOPS.SHL
|
||||||
@ -1216,6 +1222,7 @@ EXEC.puts >PULLYA
|
|||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
EXEC.cos >FPU COS
|
EXEC.cos >FPU COS
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
EXEC.getchar >SYSCALL getchar
|
EXEC.getchar >SYSCALL getchar
|
||||||
|
@ -238,212 +238,6 @@ PrintF.Cnt .BS 2
|
|||||||
PrintF.hFILE .BS 1
|
PrintF.hFILE .BS 1
|
||||||
.ED
|
.ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* `int printf2 ( const char * format, ... );`
|
|
||||||
* `>PUSHWI format`
|
|
||||||
* `...`
|
|
||||||
* `>PUSHW IntValue`
|
|
||||||
* `>PUSHBI 2` #bytecount
|
|
||||||
* `>SYSCALL printf2`
|
|
||||||
*--------------------------------------
|
|
||||||
K.PrintF2 >LDYAI K.IOBuf
|
|
||||||
>STYA pIOBuf
|
|
||||||
|
|
||||||
ldy #S.PS.hStdOut
|
|
||||||
lda (pPs),y
|
|
||||||
sta PrintF.hFILE
|
|
||||||
|
|
||||||
lda (pStack) Bytecount
|
|
||||||
inc
|
|
||||||
tay
|
|
||||||
|
|
||||||
lda (pStack),y format LO
|
|
||||||
sta ZPPtr2
|
|
||||||
iny
|
|
||||||
lda (pStack),y format HI
|
|
||||||
sta ZPPtr2+1
|
|
||||||
|
|
||||||
bra K.PrintF2.1
|
|
||||||
|
|
||||||
K.FPrintf2 >LDYAI K.IOBuf
|
|
||||||
>STYA pIOBuf
|
|
||||||
|
|
||||||
lda (pStack) Bytecount
|
|
||||||
inc
|
|
||||||
tay
|
|
||||||
|
|
||||||
lda (pStack),y format LO
|
|
||||||
sta ZPPtr2
|
|
||||||
iny
|
|
||||||
lda (pStack),y format HI
|
|
||||||
sta ZPPtr2+1
|
|
||||||
|
|
||||||
iny
|
|
||||||
lda (pStack),y hFILE
|
|
||||||
sta PrintF.hFILE
|
|
||||||
|
|
||||||
bra K.PrintF2.1
|
|
||||||
|
|
||||||
K.SPrintf2 lda (pStack) Bytecount
|
|
||||||
inc
|
|
||||||
tay
|
|
||||||
|
|
||||||
lda (pStack),y format LO
|
|
||||||
sta ZPPtr2
|
|
||||||
iny
|
|
||||||
lda (pStack),y format HI
|
|
||||||
sta ZPPtr2+1
|
|
||||||
|
|
||||||
stz PrintF.hFILE
|
|
||||||
|
|
||||||
iny
|
|
||||||
lda (pStack),y str LO
|
|
||||||
sta pIOBuf
|
|
||||||
iny
|
|
||||||
lda (pStack),y str HI
|
|
||||||
sta pIOBuf+1
|
|
||||||
|
|
||||||
K.PrintF2.1 sty PrintF2.Exit.Cnt+1
|
|
||||||
|
|
||||||
stz PrintF.Cnt
|
|
||||||
stz PrintF.Cnt+1
|
|
||||||
|
|
||||||
lda pStack
|
|
||||||
sta pLocal
|
|
||||||
|
|
||||||
stz PrintF.LocalGetByte+1
|
|
||||||
|
|
||||||
.1 jsr SHARED.GetCharPtr2
|
|
||||||
bne .22
|
|
||||||
|
|
||||||
jmp .8 end of format..
|
|
||||||
|
|
||||||
.22 cmp #'%'
|
|
||||||
bne .10
|
|
||||||
|
|
||||||
stz K.PrintF.PadL
|
|
||||||
stz K.PrintF.PadC
|
|
||||||
|
|
||||||
lda (ZPPtr2)
|
|
||||||
beq .7 end of format... print % and exit
|
|
||||||
|
|
||||||
jsr ZP.IsDigit
|
|
||||||
bcs .6 no digit....go check specifier
|
|
||||||
|
|
||||||
cmp #'0' ...a 0...mmm... padding char?
|
|
||||||
bne .4
|
|
||||||
|
|
||||||
sta K.PrintF.PadC
|
|
||||||
|
|
||||||
jsr SHARED.NextCharPtr2 skip 0 ...
|
|
||||||
|
|
||||||
lda (ZPPtr2)
|
|
||||||
beq .7
|
|
||||||
|
|
||||||
jsr ZP.IsDigit
|
|
||||||
bcs .6 %0x ??????
|
|
||||||
|
|
||||||
.4 jsr MATH.Dec2ACC32
|
|
||||||
bcs .99
|
|
||||||
|
|
||||||
lda ACC32
|
|
||||||
sta K.PrintF.PadL
|
|
||||||
lda K.PrintF.PadC
|
|
||||||
bne .5
|
|
||||||
|
|
||||||
lda #C.SPACE
|
|
||||||
sta K.PrintF.PadC
|
|
||||||
|
|
||||||
.5 jsr SHARED.AddYToPtr2 skip all processed chars
|
|
||||||
|
|
||||||
lda (ZPPtr2)
|
|
||||||
beq .7
|
|
||||||
|
|
||||||
.6 ldx #PrintFTBL1.Cnt-1 do we have a %x command?
|
|
||||||
|
|
||||||
.61 cmp PrintFTBL1,x
|
|
||||||
beq .62
|
|
||||||
dex
|
|
||||||
bpl .61
|
|
||||||
|
|
||||||
bra .20 unknown ...
|
|
||||||
|
|
||||||
.62 jsr SHARED.NextCharPtr2
|
|
||||||
|
|
||||||
txa yes, jmp to it!
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
|
|
||||||
jsr PrintF.ESC
|
|
||||||
.11 bcc .1
|
|
||||||
bra .99
|
|
||||||
|
|
||||||
.7 lda #'%'
|
|
||||||
bra .20
|
|
||||||
*--------------------------------------
|
|
||||||
.10 cmp #'\'
|
|
||||||
bne .20
|
|
||||||
|
|
||||||
jsr SHARED.GetCharPtr2
|
|
||||||
beq .99
|
|
||||||
|
|
||||||
ldx #PrintFTBL2.Cnt-1
|
|
||||||
|
|
||||||
.12 cmp PrintFTBL2,x
|
|
||||||
beq .19
|
|
||||||
dex
|
|
||||||
bpl .12
|
|
||||||
|
|
||||||
cmp #'x' \xHH
|
|
||||||
bne .1
|
|
||||||
|
|
||||||
jsr MATH.Hex2ACC32
|
|
||||||
bcs .99
|
|
||||||
|
|
||||||
jsr SHARED.AddYToPtr2
|
|
||||||
|
|
||||||
.14 lda ACC32
|
|
||||||
bra .20
|
|
||||||
|
|
||||||
.19 lda PrintFTBL2.OUT,x
|
|
||||||
|
|
||||||
.20 jsr PrintF.COut
|
|
||||||
bcc .11
|
|
||||||
*--------------------------------------
|
|
||||||
.99 bra PrintF2.Exit
|
|
||||||
*--------------------------------------
|
|
||||||
.8 ldx PrintF.hFILE
|
|
||||||
beq .80 Writing to buffer, append \0
|
|
||||||
|
|
||||||
>PUSHW PrintF.Cnt Writing to File/dev...
|
|
||||||
>PUSHWI K.IOBuf
|
|
||||||
|
|
||||||
txa
|
|
||||||
jsr K.FWrite
|
|
||||||
bcc .81
|
|
||||||
|
|
||||||
tay
|
|
||||||
bne .99
|
|
||||||
|
|
||||||
>RET 4 0=BLOCKING
|
|
||||||
|
|
||||||
.80 ldy PrintF.Cnt A=0, Writing to buffer, append \0
|
|
||||||
sta (pIOBuf),y
|
|
||||||
|
|
||||||
.81 >LDYA PrintF.Cnt
|
|
||||||
* clc
|
|
||||||
*--------------------------------------
|
|
||||||
PrintF2.Exit php
|
|
||||||
pha
|
|
||||||
lda pStack
|
|
||||||
sec +Bytecount byte
|
|
||||||
PrintF2.Exit.Cnt
|
|
||||||
adc #$ff SELF MODIFIED
|
|
||||||
sta pStack
|
|
||||||
pla
|
|
||||||
plp
|
|
||||||
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
K.SPrintF stz PrintF.hFILE
|
K.SPrintF stz PrintF.hFILE
|
||||||
>STYA pIOBuf str
|
>STYA pIOBuf str
|
||||||
jsr K.PrintF.GetFormat
|
jsr K.PrintF.GetFormat
|
||||||
|
404
SYS/KERNEL.S.STDIO2.S.txt
Normal file
404
SYS/KERNEL.S.STDIO2.S.txt
Normal file
@ -0,0 +1,404 @@
|
|||||||
|
NEW
|
||||||
|
AUTO 3,1
|
||||||
|
*--------------------------------------
|
||||||
|
K.PrintF2 >LDYAI K.IOBuf
|
||||||
|
>STYA pIOBuf
|
||||||
|
|
||||||
|
ldy #S.PS.hStdOut
|
||||||
|
lda (pPs),y
|
||||||
|
sta PrintF.hFILE
|
||||||
|
|
||||||
|
lda (pStack) Bytecount
|
||||||
|
inc
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda (pStack),y format LO
|
||||||
|
sta ZPPtr2
|
||||||
|
iny
|
||||||
|
lda (pStack),y format HI
|
||||||
|
sta ZPPtr2+1
|
||||||
|
|
||||||
|
bra K.PrintF2.1
|
||||||
|
|
||||||
|
K.FPrintf2 >LDYAI K.IOBuf
|
||||||
|
>STYA pIOBuf
|
||||||
|
|
||||||
|
lda (pStack) Bytecount
|
||||||
|
inc
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda (pStack),y format LO
|
||||||
|
sta ZPPtr2
|
||||||
|
iny
|
||||||
|
lda (pStack),y format HI
|
||||||
|
sta ZPPtr2+1
|
||||||
|
|
||||||
|
iny
|
||||||
|
lda (pStack),y hFILE
|
||||||
|
sta PrintF.hFILE
|
||||||
|
|
||||||
|
bra K.PrintF2.1
|
||||||
|
|
||||||
|
K.SPrintf2 stz PrintF.hFILE
|
||||||
|
|
||||||
|
lda (pStack) Bytecount
|
||||||
|
inc
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda (pStack),y format LO
|
||||||
|
sta ZPPtr2
|
||||||
|
iny
|
||||||
|
lda (pStack),y format HI
|
||||||
|
sta ZPPtr2+1
|
||||||
|
|
||||||
|
iny
|
||||||
|
lda (pStack),y str LO
|
||||||
|
sta pIOBuf
|
||||||
|
iny
|
||||||
|
lda (pStack),y str HI
|
||||||
|
sta pIOBuf+1
|
||||||
|
*--------------------------------------
|
||||||
|
K.PrintF2.1 sty PrintF2.Exit.Cnt+1 Total bytes to POP
|
||||||
|
|
||||||
|
stz PrintF.Cnt
|
||||||
|
stz PrintF.Cnt+1
|
||||||
|
|
||||||
|
.1 jsr SHARED.GetCharPtr2
|
||||||
|
bne .22
|
||||||
|
|
||||||
|
jmp .8 end of format..
|
||||||
|
|
||||||
|
.22 cmp #'%'
|
||||||
|
bne .10
|
||||||
|
|
||||||
|
stz K.PrintF.PadL
|
||||||
|
stz K.PrintF.PadC
|
||||||
|
|
||||||
|
lda (ZPPtr2)
|
||||||
|
beq .7 end of format... print % and exit
|
||||||
|
|
||||||
|
jsr ZP.IsDigit
|
||||||
|
bcs .6 no digit....go check specifier
|
||||||
|
|
||||||
|
cmp #'0' ...a 0...mmm... padding char?
|
||||||
|
bne .4
|
||||||
|
|
||||||
|
sta K.PrintF.PadC
|
||||||
|
|
||||||
|
jsr SHARED.NextCharPtr2 skip 0 ...
|
||||||
|
|
||||||
|
lda (ZPPtr2)
|
||||||
|
beq .7
|
||||||
|
|
||||||
|
jsr ZP.IsDigit
|
||||||
|
bcs .6 %0x ??????
|
||||||
|
|
||||||
|
.4 jsr MATH.Dec2ACC32
|
||||||
|
bcs .99
|
||||||
|
|
||||||
|
lda ACC32
|
||||||
|
sta K.PrintF.PadL
|
||||||
|
lda K.PrintF.PadC
|
||||||
|
bne .5
|
||||||
|
|
||||||
|
lda #C.SPACE
|
||||||
|
sta K.PrintF.PadC
|
||||||
|
|
||||||
|
.5 jsr SHARED.AddYToPtr2 skip all processed chars
|
||||||
|
|
||||||
|
lda (ZPPtr2)
|
||||||
|
beq .7
|
||||||
|
|
||||||
|
.6 ldx #PrintFTBL1.Cnt-1 do we have a %x command?
|
||||||
|
|
||||||
|
.61 cmp PrintFTBL1,x
|
||||||
|
beq .62
|
||||||
|
dex
|
||||||
|
bpl .61
|
||||||
|
|
||||||
|
bra .20 unknown ...
|
||||||
|
|
||||||
|
.62 jsr SHARED.NextCharPtr2
|
||||||
|
|
||||||
|
txa yes, jmp to it!
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
|
||||||
|
jsr PrintF2.ESC
|
||||||
|
.11 bcc .1
|
||||||
|
bra .99
|
||||||
|
|
||||||
|
.7 lda #'%'
|
||||||
|
bra .20
|
||||||
|
*--------------------------------------
|
||||||
|
.10 cmp #'\'
|
||||||
|
bne .20
|
||||||
|
|
||||||
|
jsr SHARED.GetCharPtr2
|
||||||
|
beq .99
|
||||||
|
|
||||||
|
ldx #PrintFTBL2.Cnt-1
|
||||||
|
|
||||||
|
.12 cmp PrintFTBL2,x
|
||||||
|
beq .19
|
||||||
|
dex
|
||||||
|
bpl .12
|
||||||
|
|
||||||
|
cmp #'x' \xHH
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
jsr MATH.Hex2ACC32
|
||||||
|
bcs .99
|
||||||
|
|
||||||
|
jsr SHARED.AddYToPtr2
|
||||||
|
|
||||||
|
.14 lda ACC32
|
||||||
|
bra .20
|
||||||
|
|
||||||
|
.19 lda PrintFTBL2.OUT,x
|
||||||
|
|
||||||
|
.20 jsr PrintF.COut
|
||||||
|
bcc .11
|
||||||
|
*--------------------------------------
|
||||||
|
.99 bra PrintF2.Exit
|
||||||
|
*--------------------------------------
|
||||||
|
.8 ldx PrintF.hFILE
|
||||||
|
beq .80 Writing to buffer, append \0
|
||||||
|
|
||||||
|
>PUSHW PrintF.Cnt Writing to File/dev...
|
||||||
|
>PUSHWI K.IOBuf
|
||||||
|
|
||||||
|
txa
|
||||||
|
jsr K.FWrite
|
||||||
|
bcc .81
|
||||||
|
|
||||||
|
tay
|
||||||
|
bne .99
|
||||||
|
|
||||||
|
>RET 4 0=BLOCKING
|
||||||
|
|
||||||
|
.80 ldy PrintF.Cnt A=0, Writing to buffer, append \0
|
||||||
|
sta (pIOBuf),y
|
||||||
|
|
||||||
|
.81 >LDYA PrintF.Cnt
|
||||||
|
* clc
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.Exit php
|
||||||
|
pha
|
||||||
|
lda pStack
|
||||||
|
sec +Bytecount byte
|
||||||
|
PrintF2.Exit.Cnt
|
||||||
|
adc #$ff SELF MODIFIED
|
||||||
|
sta pStack
|
||||||
|
pla
|
||||||
|
plp
|
||||||
|
PrintF2.Exit.RTS
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.LocalGetByte
|
||||||
|
lda (pStack)
|
||||||
|
beq .9
|
||||||
|
|
||||||
|
tay
|
||||||
|
dec
|
||||||
|
sta (pStack)
|
||||||
|
lda (pStack),y
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.9 lda #E.STACK
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.ESC jmp (.1,x)
|
||||||
|
.1 .DA PrintF2.B
|
||||||
|
.DA PrintF2.D,PrintF2.DD,PrintF2.U
|
||||||
|
.DA PrintF2.E,PrintF2.F
|
||||||
|
.DA PrintF2.H,PrintF2.HH
|
||||||
|
.DA PrintF2.I,PrintF2.II,PrintF2.L
|
||||||
|
.DA PrintF2.S,PrintF2.SS
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.B jsr PrintF2.LocalGetByte
|
||||||
|
bcs PrintF2.B.RTS
|
||||||
|
|
||||||
|
ldy #8
|
||||||
|
|
||||||
|
.1 asl
|
||||||
|
pha
|
||||||
|
lda #'0'/2
|
||||||
|
rol
|
||||||
|
jsr PrintF.COut
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
pla
|
||||||
|
dey
|
||||||
|
bne .1
|
||||||
|
rts
|
||||||
|
|
||||||
|
.9 ply
|
||||||
|
PrintF2.B.RTS
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.I sec signed short
|
||||||
|
.HS 90 BCC
|
||||||
|
PrintF2.D clc unsigned short (BYTE)
|
||||||
|
|
||||||
|
ldy #1
|
||||||
|
bra PrintF2.NUM
|
||||||
|
|
||||||
|
PrintF2.II sec signed int
|
||||||
|
.HS 90 BCC
|
||||||
|
PrintF2.DD clc unsigned int (WORD)
|
||||||
|
|
||||||
|
ldy #2
|
||||||
|
bra PrintF2.NUM
|
||||||
|
|
||||||
|
PrintF2.L sec signed long
|
||||||
|
.HS 90 BCC
|
||||||
|
PrintF2.U clc unsigned long (DWORD)
|
||||||
|
|
||||||
|
ldy #4
|
||||||
|
|
||||||
|
PrintF2.NUM ror ACC32.Sign
|
||||||
|
|
||||||
|
jsr MATH.ACC32ZERO
|
||||||
|
|
||||||
|
.1 jsr PrintF2.LocalGetByte
|
||||||
|
bcs PrintF2.B.RTS
|
||||||
|
|
||||||
|
sta ACC32-1,y
|
||||||
|
dey
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
ldx K.PrintF.PadL
|
||||||
|
ldy K.PrintF.PadC
|
||||||
|
rol ACC32.Sign
|
||||||
|
jsr MATH.ACC322STR10
|
||||||
|
bra PrintF2.StrNum
|
||||||
|
*--------------------------------------
|
||||||
|
* EXP(8) 1(s) 1significants(31)
|
||||||
|
* http://apple2.org.za/gswv/a2zine/GS.WorldView/Resources/GS.TECH.INFO/AppleSoft/
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.E sec Force "E+12"
|
||||||
|
.HS 90 BCC
|
||||||
|
PrintF2.F clc
|
||||||
|
|
||||||
|
lda (pStack) get current stack Ptr
|
||||||
|
sec at least 5 bytes remaining ?
|
||||||
|
sbc #5
|
||||||
|
bcc PrintF2.StrNum.Err
|
||||||
|
sta (pStack)
|
||||||
|
|
||||||
|
* sec
|
||||||
|
adc pStack
|
||||||
|
ldy pStack+1 A,Y = float
|
||||||
|
|
||||||
|
ldx #FPU.SETFAC
|
||||||
|
jsr GP.ROMCALL
|
||||||
|
|
||||||
|
ldy #A2osX.NumStrBuf+1 FOUT.1 will do a DEY
|
||||||
|
ldx #FPU.FOUT
|
||||||
|
jsr GP.ROMCALL
|
||||||
|
|
||||||
|
PrintF2.StrNum ldy #0
|
||||||
|
|
||||||
|
.2 lda A2osX.NumStrBuf,y
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
iny
|
||||||
|
|
||||||
|
jsr PrintF.COut
|
||||||
|
bcc .2
|
||||||
|
|
||||||
|
.9 rts
|
||||||
|
|
||||||
|
.8 clc
|
||||||
|
rts
|
||||||
|
PrintF2.StrNum.Err
|
||||||
|
lda #E.STACK
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.S ldy #$ff CSTR
|
||||||
|
.HS 2C bit abs
|
||||||
|
PrintF2.SS ldy #$00 PSTR
|
||||||
|
|
||||||
|
sty .1+1
|
||||||
|
|
||||||
|
jsr PrintF2.LocalGetByte
|
||||||
|
bcs .9
|
||||||
|
sta ZPPtr1+1
|
||||||
|
|
||||||
|
jsr PrintF2.LocalGetByte
|
||||||
|
bcs .9
|
||||||
|
sta ZPPtr1
|
||||||
|
|
||||||
|
lda (ZPPtr1) if CSTR:last char=0, if PSTR:len=0
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
ldy .1+1
|
||||||
|
|
||||||
|
.1 lda #$ff Self Modified
|
||||||
|
bne .11 CSTR
|
||||||
|
|
||||||
|
tya PSTR
|
||||||
|
cmp (ZPPtr1) len check
|
||||||
|
beq .2
|
||||||
|
|
||||||
|
.11 iny
|
||||||
|
|
||||||
|
lda (ZPPtr1),y
|
||||||
|
beq .2
|
||||||
|
|
||||||
|
jsr PrintF.COut
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
lda K.PrintF.PadL
|
||||||
|
beq .1
|
||||||
|
|
||||||
|
cpy K.PrintF.PadL
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
.8 clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.2 lda K.PrintF.PadL
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
.3 cpy K.PrintF.PadL
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
lda K.PrintF.PadC
|
||||||
|
jsr PrintF.COut
|
||||||
|
bcs .9
|
||||||
|
iny
|
||||||
|
bne .3
|
||||||
|
|
||||||
|
* clc
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.HH jsr PrintF2.LocalGetByte
|
||||||
|
bcs PrintF2.COut.RTS
|
||||||
|
pha LO byte
|
||||||
|
jsr PrintF2.H
|
||||||
|
plx
|
||||||
|
bcs PrintF2.COut.RTS
|
||||||
|
txa
|
||||||
|
bra PrintF2.H.1
|
||||||
|
*--------------------------------------
|
||||||
|
PrintF2.H jsr PrintF2.LocalGetByte
|
||||||
|
bcs PrintF2.COut.RTS
|
||||||
|
|
||||||
|
PrintF2.H.1 jsr MATH.AToHexAX
|
||||||
|
jsr PrintF.COut
|
||||||
|
bcs PrintF2.COut.RTS
|
||||||
|
txa
|
||||||
|
|
||||||
|
jmp PrintF.COut
|
||||||
|
PrintF2.COut.RTS
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
MAN
|
||||||
|
SAVE USR/SRC/SYS/KERNEL.S.STDIO2
|
||||||
|
LOAD USR/SRC/SYS/KERNEL.S
|
||||||
|
ASM
|
@ -49,6 +49,9 @@ A2osX.D1 .PH $D000
|
|||||||
.INB USR/SRC/SYS/KERNEL.S.UNISTD
|
.INB USR/SRC/SYS/KERNEL.S.UNISTD
|
||||||
.INB USR/SRC/SYS/KERNEL.S.STDIO
|
.INB USR/SRC/SYS/KERNEL.S.STDIO
|
||||||
.INB USR/SRC/SYS/KERNEL.S.STDLIB
|
.INB USR/SRC/SYS/KERNEL.S.STDLIB
|
||||||
|
.INB USR/SRC/SYS/KERNEL.S.DEV
|
||||||
|
.INB USR/SRC/SYS/KERNEL.S.FIO
|
||||||
|
.INB USR/SRC/SYS/KERNEL.S.PFT
|
||||||
.EP
|
.EP
|
||||||
A2osX.D2 .PH $D000
|
A2osX.D2 .PH $D000
|
||||||
.DA #RRAMWRAMBNK2
|
.DA #RRAMWRAMBNK2
|
||||||
@ -66,12 +69,10 @@ A2osX.E0 .PH $E000
|
|||||||
.INB USR/SRC/SYS/KERNEL.S.MATH
|
.INB USR/SRC/SYS/KERNEL.S.MATH
|
||||||
.INB USR/SRC/SYS/KERNEL.S.TERMLC
|
.INB USR/SRC/SYS/KERNEL.S.TERMLC
|
||||||
.INB USR/SRC/SYS/KERNEL.S.SHARED
|
.INB USR/SRC/SYS/KERNEL.S.SHARED
|
||||||
|
.INB USR/SRC/SYS/KERNEL.S.STDIO2
|
||||||
********* TMP ***** go to A2osX.D1
|
********* TMP ***** go to A2osX.D1
|
||||||
.INB USR/SRC/SYS/KERNEL.S.IO
|
.INB USR/SRC/SYS/KERNEL.S.IO
|
||||||
.INB USR/SRC/SYS/KERNEL.S.PIPE
|
.INB USR/SRC/SYS/KERNEL.S.PIPE
|
||||||
.INB USR/SRC/SYS/KERNEL.S.DEV
|
|
||||||
.INB USR/SRC/SYS/KERNEL.S.FIO
|
|
||||||
.INB USR/SRC/SYS/KERNEL.S.PFT
|
|
||||||
********* TMP ***** go to A2osX.D2
|
********* TMP ***** go to A2osX.D2
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PWD.bDirty .BS 1
|
PWD.bDirty .BS 1
|
||||||
|
Loading…
Reference in New Issue
Block a user