ACOS:BugFix, added GET

This commit is contained in:
burniouf 2021-07-09 15:54:42 +02:00
parent 35bece276c
commit 9abe9054c3
9 changed files with 222 additions and 220 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,77 +2,26 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* ZPADDR=STR ID, New pSTR Value on stack
*--------------------------------------
CODE.STRSET jsr CODE.PULLWS save pSTR
ldx hStrings
jsr CODE.PUSHBI >PUSHB hSTRV
>LDYA ZPADDR
jsr CODE.PUSHIYA >PUSHW id
jsr CODE.PUSHWS >PUSHW str
ldx #SYS.StrVSet
jsr CODE.SYSCALL >SYSCALL StrVSet
rts
*--------------------------------------
* ZPADDR=pInt, Int16 on Stack
*--------------------------------------
CODE.INTSET >LDYA ZPADDR
jsr CODE.LDYAI
ldx #0
.1 lda CCODE.PULLWYA,x
jsr CODE.EmitByte
inx
cpx #CCODE.PULLWYA.LEN
bne .1
rts
*--------------------------------------
CODE.PULLWS ldx #0
.1 lda CCODE.PULLWS,x
jsr CODE.EmitByte
inx
cpx #CCODE.PULLWS.LEN
bne .1
rts
*--------------------------------------
CODE.PUSHWS ldx #0
.1 lda CCODE.PUSHWS,x
jsr CODE.EmitByte
inx
cpx #CCODE.PUSHWS.LEN
bne .1
rts
*--------------------------------------
CODE.PUSHBI lda #$A9 LDA #imm
CODE.PUSHYXI lda #$A9 LDA #imm
jsr CODE.EmitByte
txa
jsr CODE.EmitByte
jmp CODE.PUSHA
*--------------------------------------
CODE.PUSHIYA pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
pla
jsr CODE.EmitByte
jsr CODE.PUSHA
lda #$A9 LDA #imm
jsr CODE.EmitByte
tya
jsr CODE.EmitByte
jmp CODE.PUSHA
*--------------------------------------
CODE.PUSHA ldx #0
.1 lda CCODE.PUSHA,x
jsr CODE.EmitByte
inx
cpx #CCODE.PUSHA.LEN
bne .1
rts
*--------------------------------------
CODE.PUSHINT16 ldy #1
@ -98,31 +47,6 @@ CODE.LDYXI lda #$A0 LDY #imm
txa
jmp CODE.EmitByte
*--------------------------------------
CODE.LDYAI pha
lda #$A0 LDY #imm
jsr CODE.EmitByte
tya
jsr CODE.EmitByte
lda #$A9 LDA #imm
jsr CODE.EmitByte
pla
jmp CODE.EmitByte
*--------------------------------------
CODE.PUSHYA jsr CODE.PUSHA
lda #$98 tya
jsr CODE.EmitByte
*--------------------------------------
CODE.PUSHA ldx #0
.1 lda CCODE.PUSHA,x
jsr CODE.EmitByte
inx
cpx #CCODE.PUSHA.LEN
bne .1
rts
*--------------------------------------
CODE.JSRRT lda #$20 JSR
jsr CODE.EmitByte
lda J.RT,x

View File

@ -181,10 +181,20 @@ CORE.Compile jsr CORE.GetChar
tax
beq .4
jsr CODE.STRSET Store String in hSTRV
ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.StrSet.ID
jsr CODE.JSRRT Store String in hSTRV
bra .8
.4 jsr CODE.INTSET Store Int16 result in DATASEG
.4 ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.IntSet.ID
jsr CODE.JSRRT Store Int16 result in DATASEG
*--------------------------------------
.8 jsr CORE.GetCharNB
bcs .88
@ -257,6 +267,8 @@ CORE.FWREF >LDYA L.MSG.FWREF
*--------------------------------------
CORE.Run jsr CORE.Cleanup
>PUSHW L.MSG.RUN
lda ZPCodeBufPtr
sta ZPPtr1
@ -270,18 +282,59 @@ CORE.Run jsr CORE.Cleanup
lda ZPPtr1
sec
sbc ZPCodeBufPtr
sta ZPPtr2
pha
lda ZPPtr1+1
sbc ZPCodeBufPtr+1
sta ZPPtr2+1
>PUSHA
pla
>PUSHA Code Size
lda ZPDataBufPtr
sta ZPPtr1
lda ZPDataBufPtr+1
sta ZPPtr1+1
>LDA.G hDataBuf
>SYSCALL GetMemPtr
>STYA ZPDataBufPtr
>PUSHW L.MSG.RUN
>PUSHW ZPPtr2
>PUSHBI 2
lda ZPPtr1
sec
sbc ZPDataBufPtr
pha
eor #$ff
sta ZPPtr2
lda ZPPtr1+1
sbc ZPDataBufPtr+1
>PUSHA
eor #$ff
sta ZPPtr2+1
pla
>PUSHA Data Size
>PUSHBI 4
>SYSCALL PrintF
jmp (ZPCodeBufPtr)
lda #0
tay
.1 inc ZPPtr2
bne .2
inc ZPPtr2+1
beq .8
.2 sta (ZPDataBufPtr),y
iny
bne .1
inc ZPDataBufPtr+1
bra .1
.8 jmp (ZPCodeBufPtr)
*--------------------------------------
CORE.LookupOPS lda (ZPInputBufPtr)
jsr CORE.IsOPSChar
@ -373,7 +426,7 @@ CORE.Lookup clc
bcc .2 not last char in this keyword
jsr .10 next char in text...
bcc .4 valid....failed
bcc .6 valid....failed
.3 plp
bcc .8
@ -505,31 +558,13 @@ CORE.CreateOrGetVar
beq .1
lda STRID
sta ZPADDR
lda STRID+1
sta ZPADDR+1
inc STRID
bne .10
inc STRID+1
jsr CORE.GetStr
bra .10
.1 lda ZPDataBufPtr
sta ZPADDR
.1 jsr CORE.GetWord
.10 >STYA ZPADDR
clc
adc #2 Word
sta ZPDataBufPtr
lda ZPDataBufPtr+1
sta ZPADDR+1
adc #0
sta ZPDataBufPtr+1
.10 >PUSHB.G hVars
>PUSHB.G hVars
>PUSHW ZPSID
>PUSHWI ZPADDR
>PUSHWI 3 3 bytes : ADDR + TYPE
@ -608,6 +643,30 @@ CORE.GetVarType jsr CORE.GetChar
rts
*--------------------------------------
CORE.GetWord lda ZPDataBufPtr
tay
clc
adc #2 Word
sta ZPDataBufPtr
lda ZPDataBufPtr+1
bcc .8
inc ZPDataBufPtr+1
clc
.8 rts
*--------------------------------------
CORE.GetStr >LDYA STRID
inc STRID
bne .8
inc STRID+1
.8 clc
rts
*--------------------------------------
CORE.ToUpperCase
cmp #'a'
bcc .8

View File

@ -62,21 +62,19 @@ EXP.Eval.R lda EXP.AOPS
.21 jsr EXP.VARLookup
bcs .37
.22 ldy EXP.ADDR
ldy EXP.ADDR
ldx EXP.ADDR+1
jsr CODE.LDYXI
ldx EXP.TYPE
bne .23
bne .22
ldx #RT.IntGet.ID
jsr CODE.JSRRT
bra .40
.23 ldx #RT.StrGet.ID
jsr CODE.JSRRT
bra .23
.22 ldx #RT.StrGet.ID
.23 jsr CODE.JSRRT
bra .40
*--------------------------------------
.30 jsr CORE.IsDigit10
@ -108,8 +106,8 @@ EXP.Eval.R lda EXP.AOPS
inc pStack prev op has precedence
tay
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL go compute (arg1 op1 arg2)
jsr EXP.ComputeY go compute (arg1 op1 arg2)
bcs .90
.60 lda EXP.AOPS we must compute arg2 op2 arg3 before
>PUSHA
@ -122,9 +120,8 @@ EXP.Eval.R lda EXP.AOPS
tay
bmi .88 nothing to do
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL
bra .80
jsr EXP.ComputeY go compute (arg1 op1 arg2)
bcc .80
.90 lda #E.ESYN
@ -167,8 +164,9 @@ EXP.CreateStrConst
sta (ZPConstBufPtr),y
phy
>LDYA ZPConstBufPtr
jsr CODE.PUSHIYA
ldy ZPConstBufPtr
ldx ZPConstBufPtr+1
jsr CODE.PUSHYXI
pla
sec for \0
@ -234,50 +232,39 @@ EXP.VARLookup >LDA.G hVars
.99 rts
*--------------------------------------
.3 jsr CORE.NewVarKey
bcs .39
bcs .9
phy
pha KeyID
>PUSHYA SID
jsr CORE.GetVarType
stx EXP.TYPE
beq .11
beq .4
lda STRID
sta EXP.ADDR
jsr CORE.GetStr
bra .5
lda STRID+1
sta EXP.ADDR+1
.4 jsr CORE.GetWord
.5 >STYA EXP.ADDR
inc STRID
bne .10
inc STRID+1
bra .10
.11 lda ZPDataBufPtr
sta EXP.ADDR
clc
adc #2 Word
sta ZPDataBufPtr
lda ZPDataBufPtr+1
sta EXP.ADDR+1
adc #0
sta ZPDataBufPtr+1
.10 pla
>PUSHA
pla
>PUSHA
>PUSHWI EXP.ADDR
>PUSHWI 3 3 bytes : ADDR + TYPE
>SYSCALL SListAddData
rts
.39 inc pStack
rts
.9 inc pStack discard extra hVars
rts
*--------------------------------------
EXP.ComputeY lda EXP.TYPE
bne .1
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL
clc
rts
.1 sec
rts
*--------------------------------------
MAN

View File

@ -21,11 +21,34 @@ KW.FILL
KW.FLAG
KW.FOR
KW.FREE
KW.GET
lda #E.CSYN
sec
rts
*--------------------------------------
KW.GET jsr CORE.GetNextCharNB
bcs .9
jsr CORE.CreateOrGetVar
bcs .99
ldx #RT.GET.ID
jsr CODE.JSRRT
ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.StrSet.ID
jsr CODE.JSRRT
clc
rts
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
KW.GOSUB lda #$20 JSR abs
bra KW.GOTO1
*--------------------------------------
@ -191,7 +214,12 @@ KW.INPUT jsr CORE.GetNextCharNB
ldx #RT.INPUT.ID
jsr CODE.JSRRT
jsr CODE.STRSET
ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.StrSet.ID
jsr CODE.JSRRT
clc
rts
@ -212,7 +240,7 @@ KW.NEXT
KW.NIBBLE
KW.NOT
KW.ON
KW.NOCAR
KW.NOCAR >DEBUG
lda #E.CSYN
sec
rts

View File

@ -3,16 +3,25 @@ NEW
.LIST OFF
*--------------------------------------
RT.StrSet >PUSHB hStrings
txa
>PUSHA
tya
>PUSHA
* >PUSHW id
* >PUSHW str
ldy #4
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>SYSCALL StrVSet
inc pStack
inc pStack
rts
*--------------------------------------
RT.StrGet >PUSHB hStrings
RT.StrGet lda #0
sta (ZPStrBuf)
>PUSHB hStrings
txa
>PUSHA
tya
@ -35,7 +44,15 @@ RT.StrOut ldy #S.PS.hStdOut
inc pStack
rts
*--------------------------------------
RT.IntSet
RT.IntSet sty ZPADDR
stx ZPADDR+1
>PULLA
sta (ZPADDR)
>PULLA
ldy #1
sta (ZPADDR),y
rts
*--------------------------------------
RT.IntGet sty ZPADDR
stx ZPADDR+1
@ -75,13 +92,19 @@ RT.TIMEd.1 >PUSHW ZPStrBuf
>PUSHW ZPStrBuf
rts
*--------------------------------------
RT.GET >SYSCALL GetChar
sta (ZPStrBuf)
ldy #1
bra RT.INPUT.8
*--------------------------------------
RT.INPUT lda #0
sta (ZPStrBuf)
stz ZPPtr1
.1 >SYSCALL GetChar
bcs .9
bcs RT.INPUT.9
ldy ZPPtr1
@ -89,7 +112,7 @@ RT.INPUT lda #0
bcs .7
cmp #C.CR
beq .8
beq RT.INPUT.8
cmp #C.BS
bne .1
@ -110,13 +133,13 @@ RT.INPUT lda #0
inc ZPPtr1
bne .1
.8 lda #0
RT.INPUT.8 lda #0
sta (ZPStrBuf),y
>PUSHW ZPStrBuf
clc
.9 rts
RT.INPUT.9 rts
*--------------------------------------
RT.LEFTd >PULLW ZPPtr2 cnt
lda (pStack)

View File

@ -175,6 +175,8 @@ J.ACOS.FN .DA FN.BYTE
.DA FN.WIDTH
*--------------------------------------
J.RT
RT.GET.ID .EQ *-J.RT
.DA RT.GET
RT.INPUT.ID .EQ *-J.RT
.DA RT.INPUT
*--------------------------------------
@ -223,11 +225,6 @@ CS.RUN >PUSHW L.MSG.GREETINGS
jsr CS.RUN.ARGS
bcs CS.INIT.RTS
>LDYAI 256
>SYSCALL GetMem
bcs CS.INIT.RTS
>STYA.G InputBufPtr
jsr CORE.Init
bcs CS.INIT.RTS
@ -347,6 +344,14 @@ CS.RUN.FOpen >PUSHYA
>STA.G hFile
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA.G InputBufPtr
txa
>STA.G hInputBuf
.9 rts
*--------------------------------------
CS.RUN.FGetS >LDYA.G InputBufPtr
@ -367,13 +372,19 @@ CS.DOEVENT sec
CS.QUIT jsr CORE.Quit
CS.FClose >LDA.G hFile
beq .8
beq .1
>SYSCALL FClose
>STZ.G hFile
.8 clc
.1 >LDA.G hInputBuf
beq .8
>SYSCALL FreeMem
>STZ.G hInputBuf
.8
* clc
rts
*--------------------------------------
PrintDebugMsg >LDYA pStack
@ -450,40 +461,9 @@ CS.END
*--------------------------------------
* Pre-compiled code
*--------------------------------------
CCODE.PULLWS >PULLA
pha
>PULLA
pha
CCODE.PULLWS.LEN .EQ *-CCODE.PULLWS
*--------------------------------------
CCODE.PUSHWS pla
>PUSHA
pla
>PUSHA
CCODE.PUSHWS.LEN .EQ *-CCODE.PUSHWS
*--------------------------------------
CCODE.PUSHWYA >STYA ZPADDR
ldy #1
lda (ZPADDR),y
>PUSHA
lda (ZPADDR)
>PUSHA
CCODE.PUSHWYA.LEN .EQ *-CCODE.PUSHWYA
*--------------------------------------
CCODE.PULLWYA >STYA ZPADDR
>PULLA
sta (ZPADDR)
>PULLA
ldy #1
sta (ZPADDR),y
CCODE.PULLWYA.LEN .EQ *-CCODE.PULLWYA
*--------------------------------------
CCODE.PUSHA >PUSHA
CCODE.PUSHA.LEN .EQ *-CCODE.PUSHA
*--------------------------------------
CCODE.PULLA >PULLA
CCODE.PULLA.LEN .EQ *-CCODE.PULLA
*--------------------------------------
CCODE.TESTTRUE lda (pStack)
inc pStack
ora (pStack)
@ -507,7 +487,7 @@ MSG.TRACE .AZ "%05D>%s\r\n"
MSG.ERROR .AZ " %s^\r\n"
MSG.FWREF .AZ "***Resolving FWRefs..."
MSG.FWREFERR .AZ "***Unresolved FWRef : %s\r\n"
MSG.RUN .AZ "***Code size: %D, Running...\r\n"
MSG.RUN .AZ "***Code size: %D, Data Size: %D, Running...\r\n"
MSG.STR .AZ "%s"
MSG.INT16 .AZ "%I"
*--------------------------------------
@ -636,6 +616,7 @@ bDebug .BS 1
bTrace .BS 1
LineCounter .BS 2
hFile .BS 1
hInputBuf .BS 1
InputBufPtr .BS 2
hCodeBuf .BS 1
hConstBuf .BS 1

View File

@ -4,7 +4,7 @@ NEW
IO.D2.SeekTimeR .EQ 45 LIBBLKDEV Recalibration
IO.D2.SeekTimeF .EQ 55 LIBBLKDEV Track Formatter
IO.D2.SeekTimeB .EQ 55 LIBBLKDEV Boot Block
IO.D2.SeekTimeP .EQ 40 ProDOS.FX initial
IO.D2.SeekTimeP .EQ 45 ProDOS.FX initial
IO.D2.SeekTimeI .EQ 10 ProDOS.FX increment -> until > 128
*--------------------------------------
IO.D2.Ph0Off .EQ $C080