ACOS:Major update, CHTYP:added PAK support

This commit is contained in:
burniouf 2021-07-07 16:29:10 +02:00
parent 17359a35e1
commit 35bece276c
10 changed files with 369 additions and 301 deletions

Binary file not shown.

View File

@ -19,26 +19,6 @@ CODE.STRSET jsr CODE.PULLWS save pSTR
rts rts
*-------------------------------------- *--------------------------------------
* EXP.ADDR = STR ID
* output : str to ZPStrBuf
*--------------------------------------
CODE.STRGET ldx hStrings
jsr CODE.PUSHBI >PUSHB hSTRV
>LDYA EXP.ADDR
jsr CODE.PUSHIYA >PUSHW id
>LDYA ZPStrBuf
jsr CODE.PUSHIYA >PUSHW str
ldx #SYS.StrVGet
jsr CODE.SYSCALL >SYSCALL StrVGet
>LDYA ZPStrBuf
jsr CODE.PUSHYA
rts
*--------------------------------------
* ZPADDR=pInt, Int16 on Stack * ZPADDR=pInt, Int16 on Stack
*-------------------------------------- *--------------------------------------
CODE.INTSET >LDYA ZPADDR CODE.INTSET >LDYA ZPADDR
@ -54,22 +34,6 @@ CODE.INTSET >LDYA ZPADDR
rts rts
*-------------------------------------- *--------------------------------------
* EXP.ADDR=pInt
* output : Int16 on Stack
*--------------------------------------
CODE.INTGET >LDYA EXP.ADDR
jsr CODE.LDYAI
ldx #0
.1 lda CCODE.PUSHWYA,x
jsr CODE.EmitByte
inx
cpx #CCODE.PULLWYA.LEN
bne .1
rts
*--------------------------------------
CODE.PULLWS ldx #0 CODE.PULLWS ldx #0
.1 lda CCODE.PULLWS,x .1 lda CCODE.PULLWS,x
@ -77,7 +41,7 @@ CODE.PULLWS ldx #0
inx inx
cpx #CCODE.PULLWS.LEN cpx #CCODE.PULLWS.LEN
bne .1 bne .1
rts rts
*-------------------------------------- *--------------------------------------
CODE.PUSHWS ldx #0 CODE.PUSHWS ldx #0
@ -87,14 +51,14 @@ CODE.PUSHWS ldx #0
inx inx
cpx #CCODE.PUSHWS.LEN cpx #CCODE.PUSHWS.LEN
bne .1 bne .1
rts rts
*-------------------------------------- *--------------------------------------
CODE.PUSHBI lda #$A9 LDA #imm CODE.PUSHBI lda #$A9 LDA #imm
jsr CODE.EmitByte jsr CODE.EmitByte
txa txa
jsr CODE.EmitByte jsr CODE.EmitByte
jmp CODE.PUSHA jmp CODE.PUSHA
*-------------------------------------- *--------------------------------------
CODE.PUSHIYA pha CODE.PUSHIYA pha
@ -103,7 +67,7 @@ CODE.PUSHIYA pha
pla pla
jsr CODE.EmitByte jsr CODE.EmitByte
jsr CODE.PUSHA jsr CODE.PUSHA
lda #$A9 LDA #imm lda #$A9 LDA #imm
jsr CODE.EmitByte jsr CODE.EmitByte
tya tya
@ -114,16 +78,26 @@ CODE.PUSHINT16 ldy #1
.1 lda #$A9 LDA #imm .1 lda #$A9 LDA #imm
jsr CODE.EmitByte jsr CODE.EmitByte
lda (pStack),y lda (pStack),y
jsr CODE.EmitByte jsr CODE.EmitByte
jsr CODE.PUSHA jsr CODE.PUSHA
dey dey
bpl .1 bpl .1
rts rts
*-------------------------------------- *--------------------------------------
CODE.LDYXI lda #$A0 LDY #imm
jsr CODE.EmitByte
tya
jsr CODE.EmitByte
lda #$A2 LDX #imm
jsr CODE.EmitByte
txa
jmp CODE.EmitByte
*--------------------------------------
CODE.LDYAI pha CODE.LDYAI pha
lda #$A0 LDY #imm lda #$A0 LDY #imm
jsr CODE.EmitByte jsr CODE.EmitByte
@ -149,26 +123,6 @@ CODE.PUSHA ldx #0
rts rts
*-------------------------------------- *--------------------------------------
CODE.FPRINTSTR ldx #0
.1 lda CCODE.FPRINTSTR,x
jsr CODE.EmitByte
inx
cpx #CCODE.FPRINTSTR.LEN
bne .1
rts
*--------------------------------------
CODE.FPRINTINT ldx #0
.1 lda CCODE.FPRINTINT,x
jsr CODE.EmitByte
inx
cpx #CCODE.FPRINTINT.LEN
bne .1
rts
*--------------------------------------
CODE.JSRRT lda #$20 JSR CODE.JSRRT lda #$20 JSR
jsr CODE.EmitByte jsr CODE.EmitByte
lda J.RT,x lda J.RT,x
@ -189,7 +143,7 @@ CODE.FPUCALL lda #$A2 LDX #imm
*-------------------------------------- *--------------------------------------
CODE.FPRINTCRLF ldx #C.CR CODE.FPRINTCRLF ldx #C.CR
jsr CODE.PutChar jsr CODE.PutChar
ldx #C.LF ldx #C.LF
*-------------------------------------- *--------------------------------------
CODE.PutChar lda #$A9 LDA #imm CODE.PutChar lda #$A9 LDA #imm
jsr CODE.EmitByte jsr CODE.EmitByte

View File

@ -214,14 +214,17 @@ CORE.Compile jsr CORE.GetChar
*-------------------------------------- *--------------------------------------
CORE.KW.JMP jmp (J.ACOS.KW,x) CORE.KW.JMP jmp (J.ACOS.KW,x)
*-------------------------------------- *--------------------------------------
CORE.FWREF >LDA.G hFWRefBuf CORE.FWREF >LDYA L.MSG.FWREF
>SYSCALL PutS
>LDA.G hFWRefBuf
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
>STYA ZPInputBufPtr >STYA ZPInputBufPtr
.1 lda (ZPInputBufPtr) .1 lda (ZPInputBufPtr)
beq .8 beq .8
sta ZPPtr1+1 .2 sta ZPPtr1+1
jsr CORE.GetNextChar jsr CORE.GetNextChar
sta ZPPtr1 sta ZPPtr1
@ -237,7 +240,8 @@ CORE.FWREF >LDA.G hFWRefBuf
lda ZPADDR+1 lda ZPADDR+1
sta (ZPPtr1),y sta (ZPPtr1),y
bra .1 jsr CORE.GetNextChar skip \0
bcc .2
.8 clc .8 clc
rts rts
@ -246,13 +250,12 @@ CORE.FWREF >LDA.G hFWRefBuf
>PUSHW ZPInputBufPtr >PUSHW ZPInputBufPtr
>PUSHBI 2 >PUSHBI 2
>SYSCALL PrintF >SYSCALL PrintF
lda #E.CSYN
sec sec
rts rts
*-------------------------------------- *--------------------------------------
CORE.Run lda #$60 RTS CORE.Run jsr CORE.Cleanup
sta (ZPCodeBufPtr)
jsr CORE.Cleanup
lda ZPCodeBufPtr lda ZPCodeBufPtr
sta ZPPtr1 sta ZPPtr1
@ -277,7 +280,7 @@ CORE.Run lda #$60 RTS
>PUSHW ZPPtr2 >PUSHW ZPPtr2
>PUSHBI 2 >PUSHBI 2
>SYSCALL PrintF >SYSCALL PrintF
jmp (ZPCodeBufPtr) jmp (ZPCodeBufPtr)
*-------------------------------------- *--------------------------------------
CORE.LookupOPS lda (ZPInputBufPtr) CORE.LookupOPS lda (ZPInputBufPtr)

View File

@ -60,17 +60,22 @@ EXP.Eval.R lda EXP.AOPS
bra .40 bra .40
.21 jsr EXP.VARLookup .21 jsr EXP.VARLookup
bcc .22 bcs .37
.22 ldy EXP.ADDR
ldx EXP.ADDR+1
jsr CODE.LDYXI
.22 ldx EXP.TYPE ldx EXP.TYPE
bne .23 bne .23
jsr CODE.INTGET ldx #RT.IntGet.ID
jsr CODE.JSRRT
bra .40 bra .40
.23 jsr CODE.STRGET .23 ldx #RT.StrGet.ID
jsr CODE.JSRRT
bra .40 bra .40
*-------------------------------------- *--------------------------------------

View File

@ -3,45 +3,37 @@ NEW
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
FN.BYTE FN.BYTE
FN.CLOCK
FN.DATEd
FN.FLAG
FN.CHRd FN.CHRd
FN.CLOCK
lda #E.CSYN
sec
rts
*--------------------------------------
FN.DATEd ldx #RT.DATEd.ID
bra FN.TIMEd.1
FN.TIMEd ldx #RT.TIMEd.ID
FN.TIMEd.1 jsr CODE.JSRRT
lda #'$'
sta EXP.TYPE
clc
rts
lda #E.CSYN
sec
rts
*--------------------------------------
FN.FLAG
FN.INFO
FN.INSTR FN.INSTR
FN.KEY FN.KEY
lda #E.CSYN lda #E.CSYN
sec sec
rts rts
*-------------------------------------- *--------------------------------------
FN.LEN jsr CORE.CheckOP
bcs .99
jsr EXP.Eval
bcs .99
lda EXP.TYPE
beq .90
jsr CORE.CheckCP
bcs .99
ldx #0
.1 lda CCODE.LEN,x
jsr CODE.EmitByte
inx
cpx #CCODE.LEN.LEN
bne .1
stz EXP.TYPE
clc
rts
.90 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
FN.LEFTd jsr CORE.CheckOP FN.LEFTd jsr CORE.CheckOP
bcs .99 bcs .99
@ -63,13 +55,8 @@ FN.LEFTd jsr CORE.CheckOP
jsr CORE.CheckCP jsr CORE.CheckCP
bcs .99 bcs .99
ldx #0 ldx #RT.LEFTd.ID
jsr CODE.JSRRT
.1 lda CCODE.LEFT,x
jsr CODE.EmitByte
inx
cpx #CCODE.LEFT.LEN
bne .1
lda #'$' lda #'$'
sta EXP.TYPE sta EXP.TYPE
@ -77,6 +64,30 @@ FN.LEFTd jsr CORE.CheckOP
clc clc
rts rts
.90 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
FN.LEN jsr CORE.CheckOP
bcs .99
jsr EXP.Eval
bcs .99
lda EXP.TYPE
beq .90
jsr CORE.CheckCP
bcs .99
ldx #RT.LEN.ID
jsr CODE.JSRRT
stz EXP.TYPE
clc
rts
.90 lda #E.TMISMATCH .90 lda #E.TMISMATCH
sec sec
.99 rts .99 rts
@ -103,13 +114,8 @@ FN.STRd jsr CORE.CheckOP
jsr CORE.CheckCP jsr CORE.CheckCP
bcs .99 bcs .99
ldx #0 ldx #RT.STRd.ID
jsr CODE.JSRRT
.1 lda CCODE.STR,x
jsr CODE.EmitByte
inx
cpx #CCODE.STR.LEN
bne .1
lda #'$' lda #'$'
sta EXP.TYPE sta EXP.TYPE
@ -121,11 +127,6 @@ FN.STRd jsr CORE.CheckOP
sec sec
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
FN.TIMEd
lda #E.CSYN
sec
rts
*--------------------------------------
FN.VAL jsr CORE.CheckOP FN.VAL jsr CORE.CheckOP
bcs .99 bcs .99
@ -138,13 +139,8 @@ FN.VAL jsr CORE.CheckOP
jsr CORE.CheckCP jsr CORE.CheckCP
bcs .99 bcs .99
ldx #0 ldx #RT.VAL.ID
jsr CODE.JSRRT
.1 lda CCODE.VAL,x
jsr CODE.EmitByte
inx
cpx #CCODE.VAL.LEN
bne .1
stz EXP.TYPE stz EXP.TYPE

View File

@ -73,9 +73,6 @@ KW.IF jsr EXP.Eval
cpx #CCODE.TESTTRUE.LEN cpx #CCODE.TESTTRUE.LEN
bne .1 bne .1
lda #$4C JMP abs
jsr CODE.EmitByte
ldy pCCS ldy pCCS
dey dey
@ -187,12 +184,13 @@ KW.INFO
*-------------------------------------- *--------------------------------------
KW.INPUT jsr CORE.GetNextCharNB KW.INPUT jsr CORE.GetNextCharNB
bcs .9 bcs .9
jsr CORE.CreateOrGetVar jsr CORE.CreateOrGetVar
bcs .99 bcs .99
ldx #0 ldx #RT.INPUT.ID
jsr CODE.JSRRT jsr CODE.JSRRT
jsr CODE.STRSET jsr CODE.STRSET
clc clc
@ -256,13 +254,13 @@ KW.PRINT stz hOut reset to hStdOut
lda EXP.TYPE lda EXP.TYPE
beq .6 beq .6
jsr CODE.FPRINTSTR ldx #RT.StrOut.ID
bra .7 bra .7
.6 jsr CODE.FPRINTINT .6 ldx #RT.IntOut.ID
.7 jsr CODE.JSRRT
*-------------------------------------- *--------------------------------------
.7 jsr CORE.GetCharNB jsr CORE.GetCharNB
bcs .8 bcs .8
.70 jsr CORE.IsEndInst .70 jsr CORE.IsEndInst

View File

@ -2,23 +2,80 @@ NEW
AUTO 3,1 AUTO 3,1
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
RT.StrSet RT.StrSet >PUSHB hStrings
*--------------------------------------
RT.StrGet * >PUSHW id
*--------------------------------------
clc * >PUSHW str
>SYSCALL StrVSet
rts rts
*-------------------------------------- *--------------------------------------
RT.StrLeft RT.StrGet >PUSHB hStrings
txa
>PUSHA
tya
clc >PUSHA
>PUSHW ZPStrBuf
>SYSCALL StrVGet
>PUSHW ZPStrBuf
rts rts
*-------------------------------------- *--------------------------------------
RT.FileOpen RT.StrOut ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
ldy #2
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>SYSCALL fputs
inc pStack
inc pStack
rts
*-------------------------------------- *--------------------------------------
RT.Input lda #0 RT.IntSet
*--------------------------------------
RT.IntGet sty ZPADDR
stx ZPADDR+1
ldy #1
lda (ZPADDR),y
>PUSHA
lda (ZPADDR)
>PUSHA
rts
*--------------------------------------
RT.IntOut >PUSHW L.MSG.INT16
ldy #3
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>PUSHBI 2
>SYSCALL PrintF
inc pStack
inc pStack
rts
*--------------------------------------
RT.DATEd ldx #0
bra RT.TIMEd.1
RT.TIMEd ldx #2
RT.TIMEd.1 >PUSHW ZPStrBuf
>PUSHW L.FMT.DATE,x
>PUSHEA.G TimeBuf
>PUSHEA.G TimeBuf
>SYSCALL Time
>SYSCALL StrFTime
>PUSHW ZPStrBuf
rts
*--------------------------------------
RT.INPUT lda #0
sta (ZPStrBuf) sta (ZPStrBuf)
stz ZPPtr1 stz ZPPtr1
@ -61,6 +118,48 @@ RT.Input lda #0
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
RT.LEFTd >PULLW ZPPtr2 cnt
lda (pStack)
sta ZPPtr1
ldy #1
lda (pStack),y
sta ZPPtr1+1
ldy #0
.1 lda (ZPPtr1),y
beq .8
iny
cpy ZPPtr2
bne .1
lda #0
sta (ZPPtr1),y
.8 rts
*--------------------------------------
RT.LEN >PULLYA str
>SYSCALL strlen
>PUSHYA
rts
*--------------------------------------
RT.STRd >PULLYA int
pha
>PUSHW ZPStrBuf
>PUSHW L.MSG.INT16
pla
>PUSHYA
>PUSHBI 2
>SYSCALL sprintf
>PUSHW ZPStrBuf
rts
*--------------------------------------
RT.VAL >PULLYA str
>SYSCALL atoi
>PUSHYA
rts
*--------------------------------------
MAN MAN
SAVE usr/src/bin/acos.s.rt SAVE usr/src/bin/acos.s.rt
LOAD usr/src/bin/acos.s LOAD usr/src/bin/acos.s

View File

@ -81,10 +81,13 @@ L.MSG.COMPILING .DA MSG.COMPILING
L.MSG.DEBUG .DA MSG.DEBUG L.MSG.DEBUG .DA MSG.DEBUG
L.MSG.TRACE .DA MSG.TRACE L.MSG.TRACE .DA MSG.TRACE
L.MSG.ERROR .DA MSG.ERROR L.MSG.ERROR .DA MSG.ERROR
L.MSG.RUN .DA MSG.RUN L.MSG.FWREF .DA MSG.FWREF
L.MSG.FWREFERR .DA MSG.FWREFERR L.MSG.FWREFERR .DA MSG.FWREFERR
L.MSG.RUN .DA MSG.RUN
L.MSG.STR .DA MSG.STR L.MSG.STR .DA MSG.STR
L.MSG.INT16 .DA MSG.INT16 L.MSG.INT16 .DA MSG.INT16
L.FMT.DATE .DA FMT.DATE
L.FMT.TIME .DA FMT.TIME
*-------------------------------------- *--------------------------------------
L.ACOS.OPS .DA ACOS.OPS L.ACOS.OPS .DA ACOS.OPS
L.ACOS.KW .DA ACOS.KW L.ACOS.KW .DA ACOS.KW
@ -150,14 +153,15 @@ KWID.IF .EQ *-J.ACOS.KW
*-------------------------------------- *--------------------------------------
L.ACOS.FN .DA ACOS.FN L.ACOS.FN .DA ACOS.FN
J.ACOS.FN .DA FN.BYTE J.ACOS.FN .DA FN.BYTE
.DA FN.CHRd
.DA FN.CLOCK .DA FN.CLOCK
.DA FN.DATEd .DA FN.DATEd
.DA FN.FLAG .DA FN.FLAG
.DA FN.CHRd .DA FN.INFO
.DA FN.INSTR .DA FN.INSTR
.DA FN.KEY .DA FN.KEY
.DA FN.LEN
.DA FN.LEFTd .DA FN.LEFTd
.DA FN.LEN
.DA FN.MIDd .DA FN.MIDd
.DA FN.PDL .DA FN.PDL
.DA FN.PEEK .DA FN.PEEK
@ -169,7 +173,36 @@ J.ACOS.FN .DA FN.BYTE
.DA FN.VAL .DA FN.VAL
.DA FN.WHENd .DA FN.WHENd
.DA FN.WIDTH .DA FN.WIDTH
J.RT .DA RT.INPUT *--------------------------------------
J.RT
RT.INPUT.ID .EQ *-J.RT
.DA RT.INPUT
*--------------------------------------
RT.DATEd.ID .EQ *-J.RT
.DA RT.DATEd
RT.LEFTd.ID .EQ *-J.RT
.DA RT.LEFTd
RT.LEN.ID .EQ *-J.RT
.DA RT.LEN
RT.STRd.ID .EQ *-J.RT
.DA RT.STRd
RT.TIMEd.ID .EQ *-J.RT
.DA RT.TIMEd
RT.VAL.ID .EQ *-J.RT
.DA RT.VAL
*--------------------------------------
RT.StrSet.ID .EQ *-J.RT
.DA RT.StrSet
RT.StrGet.ID .EQ *-J.RT
.DA RT.StrGet
RT.StrOut.ID .EQ *-J.RT
.DA RT.StrOut
RT.IntSet.ID .EQ *-J.RT
.DA RT.IntSet
RT.IntGet.ID .EQ *-J.RT
.DA RT.IntGet
RT.IntOut.ID .EQ *-J.RT
.DA RT.IntOut
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
* Called once at process creation * Called once at process creation
@ -228,10 +261,16 @@ CS.RUN.LOOP >SLEEP
.4 cmp #MLI.E.EOF .4 cmp #MLI.E.EOF
bne .9 bne .9
lda #$60 RTS
sta (ZPCodeBufPtr)
lda #0
sta (ZPFWRefBufPtr)
jsr CS.FClose jsr CS.FClose
jsr CORE.FWREF jsr CORE.FWREF
bcs .9 bcs .99
jsr CORE.Run jsr CORE.Run
bcc .8 bcc .8
@ -244,7 +283,7 @@ CS.RUN.LOOP >SLEEP
.8 lda #0 Exit Code = Success .8 lda #0 Exit Code = Success
sec sec
rts .99 rts
*-------------------------------------- *--------------------------------------
CS.RUN.ARGS inc ArgIndex CS.RUN.ARGS inc ArgIndex
@ -399,6 +438,15 @@ PrintErrorMsg >LDA.G bTrace
>PUSHBI 2 >PUSHBI 2
>SYSCALL FPrintF >SYSCALL FPrintF
rts rts
*--------------------------------------
.INB usr/src/bin/acos.s.code
.INB usr/src/bin/acos.s.core
.INB usr/src/bin/acos.s.exp
.INB usr/src/bin/acos.s.fn
.INB usr/src/bin/acos.s.kw
.INB usr/src/bin/acos.s.rt
*--------------------------------------
CS.END
*-------------------------------------- *--------------------------------------
* Pre-compiled code * Pre-compiled code
*-------------------------------------- *--------------------------------------
@ -443,91 +491,9 @@ CCODE.TESTTRUE lda (pStack)
inc pStack inc pStack
plp plp
.1 bne .1+5 .1 bne .1+5
.HS 4C JMP abs
CCODE.TESTTRUE.LEN .EQ *-CCODE.TESTTRUE CCODE.TESTTRUE.LEN .EQ *-CCODE.TESTTRUE
*-------------------------------------- *--------------------------------------
CCODE.FPRINTSTR ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
ldy #2
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>SYSCALL fputs
inc pStack
inc pStack
CCODE.FPRINTSTR.LEN .EQ *-CCODE.FPRINTSTR
*--------------------------------------
CCODE.FPRINTINT >PUSHW L.MSG.INT16
ldy #3
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>PUSHBI 2
>SYSCALL PrintF
inc pStack
inc pStack
CCODE.FPRINTINT.LEN .EQ *-CCODE.FPRINTINT
*--------------------------------------
CCODE.LEN >PULLW ZPPtr1
ldy #$FF
.1 iny
lda (ZPPtr1),y
bne .1
>PUSHYA
CCODE.LEN.LEN .EQ *-CCODE.LEN
*--------------------------------------
CCODE.LEFT >PULLW ZPPtr2 cnt
lda (pStack)
sta ZPPtr1
ldy #1
lda (pStack),y
sta ZPPtr1+1
ldy #0
.1 lda (ZPPtr1),y
beq .8
iny
cpy ZPPtr2
bne .1
lda #0
sta (ZPPtr1),y
.8
CCODE.LEFT.LEN .EQ *-CCODE.LEFT
*--------------------------------------
CCODE.STR >PULLYA int
pha
>PUSHW ZPStrBuf
>PUSHW L.MSG.INT16
pla
>PUSHYA
>PUSHBI 2
>SYSCALL sprintf
>PUSHW ZPStrBuf
CCODE.STR.LEN .EQ *-CCODE.STR
*--------------------------------------
CCODE.VAL >PULLYA str
>SYSCALL atoi
>PUSHYA
CCODE.VAL.LEN .EQ *-CCODE.VAL
*--------------------------------------
.INB usr/src/bin/acos.s.code
.INB usr/src/bin/acos.s.core
.INB usr/src/bin/acos.s.exp
.INB usr/src/bin/acos.s.fn
.INB usr/src/bin/acos.s.kw
.INB usr/src/bin/acos.s.rt
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA * Initialized DATA
*-------------------------------------- *--------------------------------------
MSG.GREETINGS .AZ "\r\nACOS-Shell %d.%d\r\n\r\n" MSG.GREETINGS .AZ "\r\nACOS-Shell %d.%d\r\n\r\n"
@ -535,15 +501,19 @@ MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
.AS " -D : Debug Mode\r\n" .AS " -D : Debug Mode\r\n"
.AS " -T : Trace On" .AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n" MSG.ECHOCRLF .AZ "\r\n"
MSG.COMPILING .AZ "Compiling : %s...\r\n" MSG.COMPILING .AZ "***Compiling : %s...\r\n"
MSG.DEBUG .AZ "CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n" MSG.DEBUG .AZ "***CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
MSG.TRACE .AZ "%05D>%s\r\n" MSG.TRACE .AZ "%05D>%s\r\n"
MSG.ERROR .AZ " %s^\r\n" MSG.ERROR .AZ " %s^\r\n"
MSG.RUN .AZ "Success, Code size = %D Bytes\r\nResolving FWRefs...\r\n" MSG.FWREF .AZ "***Resolving FWRefs..."
MSG.FWREFERR .AZ "Unresolved FWRef : %s\r\n" MSG.FWREFERR .AZ "***Unresolved FWRef : %s\r\n"
MSG.RUN .AZ "***Code size: %D, Running...\r\n"
MSG.STR .AZ "%s" MSG.STR .AZ "%s"
MSG.INT16 .AZ "%I" MSG.INT16 .AZ "%I"
*-------------------------------------- *--------------------------------------
FMT.DATE .AZ "%d/%m/%Y"
FMT.TIME .AZ "%H:%M:%S"
*--------------------------------------
OptionList .AS "DdTt" OptionList .AS "DdTt"
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
*-------------------------------------- *--------------------------------------
@ -636,14 +606,15 @@ ACOS.KW .AT "ADDINT"
.HS 00 .HS 00
*-------------------------------------- *--------------------------------------
ACOS.FN .AT "BYTE" ACOS.FN .AT "BYTE"
.AT "CHR$"
.AT "CLOCK"
.AT "DATE$" .AT "DATE$"
.AT "FLAG" .AT "FLAG"
.AT "CHR$"
.AT "INFO" .AT "INFO"
.AT "INSTR" .AT "INSTR"
.AT "KEY" .AT "KEY"
.AT "LEN"
.AT "LEFT$" .AT "LEFT$"
.AT "LEN"
.AT "MID$" .AT "MID$"
.AT "PDL" .AT "PDL"
.AT "PEEK" .AT "PEEK"
@ -673,6 +644,7 @@ hLabels .BS 1
hVars .BS 1 hVars .BS 1
hStrBuf .BS 1 hStrBuf .BS 1
hFWRefBuf .BS 1 hFWRefBuf .BS 1
TimeBuf .BS S.TIME
DS.END .ED DS.END .ED
*-------------------------------------- *--------------------------------------
MAN MAN

View File

@ -14,11 +14,29 @@ X.ENTER.SUBDIR .EQ 0
X.COPY.TO.DEST .EQ 0 X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 0 X.DELETE.SOURCE .EQ 0
*-------------------------------------- *--------------------------------------
ZPPtr1 .EQ ZPBIN * Zero Page Segment, up to 32 bytes
ZPPtr2 .EQ ZPBIN+2 *--------------------------------------
ZPFileName .EQ ZPBIN+4 .DUMMY
ZPFileStat .EQ ZPBIN+6 .OR ZPBIN
ZPFullPath .EQ ZPBIN+8 ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
ZPFullPath .BS 2
ArgIndex .BS 1
HexFileType .BS 1
hSrcFullPath .BS 1
bPause .BS 1
bContinue .BS 1
bRecurse .BS 1
ZS.END .ED
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -26,11 +44,12 @@ CS.START cld
jmp (.1,x) jmp (.1,x)
.DA #$61 6502,Level 1 (65c02) .DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1 .DA #1 BIN Layout Version 1
.DA 0 .DA #0 S.PS.F.EVENT
.DA CS.END-CS.START CS .DA #0
.DA DS.END-DS.START DS .DA CS.END-CS.START Code Size (without Constants)
.DA #16 SS .DA DS.END-DS.START Data SegmentSize
.DA #10 ZP .DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
* Relocation Table * Relocation Table
@ -39,6 +58,7 @@ CS.START cld
.DA CS.RUN .DA CS.RUN
.DA CS.DOEVENT .DA CS.DOEVENT
.DA CS.QUIT .DA CS.QUIT
*--------------------------------------
L.MSG.USAGE .DA MSG.USAGE L.MSG.USAGE .DA MSG.USAGE
L.MSG.FILE .DA MSG.FILE L.MSG.FILE .DA MSG.FILE
L.MSG.OK .DA MSG.OK L.MSG.OK .DA MSG.OK
@ -49,7 +69,8 @@ L.PRODOS.FT.TXT .DA PRODOS.FT.TXT
CS.INIT clc CS.INIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN >INC.G ArgCount CS.RUN inc ArgIndex
lda ArgIndex
>SYSCALL ArgV >SYSCALL ArgV
bcs .7 bcs .7
@ -57,12 +78,14 @@ CS.RUN >INC.G ArgCount
lda (ZPPtr1) lda (ZPPtr1)
cmp #'-' cmp #'-'
bne .4 bne .4
ldy #1 ldy #1
lda (ZPPtr1),y lda (ZPPtr1),y
ldx #OptionVars-OptionList-1 ldx #OptionVars-OptionList-1
.2 cmp OptionList,x .2 cmp OptionList,x
beq .3 beq .3
dex dex
bne .2 bne .2
@ -75,10 +98,10 @@ CS.RUN >INC.G ArgCount
.3 ldy OptionVars,x .3 ldy OptionVars,x
lda #$80 lda #$80
sta (pData),y sta $0,y
bra CS.RUN bra CS.RUN
*-------------------------------------- *--------------------------------------
.4 >LDA.G HexFileType .4 lda HexFileType
bne .5 bne .5
jsr GetHexFileType jsr GetHexFileType
@ -96,15 +119,14 @@ CS.RUN >INC.G ArgCount
.7 >LDA.G hSrcBasePath .7 >LDA.G hSrcBasePath
beq .99 no src ? ERROR beq .99 no src ? ERROR
>LDA.G HexFileType lda HexFileType
beq .99 we also have a TYPE beq .99 we also have a TYPE
>LDYAI 256 >LDYAI 256
>SYSCALL GetMem >SYSCALL GetMem
bcs .99 bcs .99
>STYA ZPFullPath >STYA ZPFullPath
txa stx hSrcFullPath
>STA.G hSrcFullPath
*-------------------------------------- *--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y lda (pPS),y
@ -123,13 +145,13 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
cmp #$13 Ctrl-S cmp #$13 Ctrl-S
bne .1 bne .1
>LDA.G bPause lda bPause
eor #$ff eor #$ff
sta (pData),y sta bPause
bne CS.RUN.LOOP bne CS.RUN.LOOP
.1 >LDA.G bPause .1 bit bPause
bne CS.RUN.LOOP Pause... bmi CS.RUN.LOOP Pause...
*-------------------------------------- *--------------------------------------
jsr GetEntry jsr GetEntry
bcs CS.RUN.LEAVE bcs CS.RUN.LEAVE
@ -171,7 +193,7 @@ CS.RUN.LEAVE jsr LeaveSubDir
sec sec
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
CS.RUN.DIR >LDA.G bRecurse CS.RUN.DIR bit bRecurse
bpl .8 bpl .8
lda (ZPFileName) lda (ZPFileName)
@ -210,8 +232,7 @@ CS.RUN.FILE jsr FilterMatch
>PUSHW ZPFullPath >PUSHW ZPFullPath
ldy #HexFileType >PUSHB HexFileType
>PUSHB (pData),y
>SYSCALL ChTyp >SYSCALL ChTyp
jsr CS.RUN.CheckErr jsr CS.RUN.CheckErr
@ -220,6 +241,7 @@ CS.RUN.FILE jsr FilterMatch
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.CheckErr bcs .1 CS.RUN.CheckErr bcs .1
>LDYA L.MSG.OK >LDYA L.MSG.OK
>SYSCALL PutS >SYSCALL PutS
rts rts
@ -231,7 +253,8 @@ CS.RUN.CheckErr bcs .1
>PUSHA >PUSHA
>PUSHBI 1 >PUSHBI 1
>SYSCALL PrintF >SYSCALL PrintF
>LDA.G bContinue
lda bContinue
eor #$80 eor #$80
asl asl
pla pla
@ -254,12 +277,17 @@ CS.DOEVENT sec
*-------------------------------------- *--------------------------------------
CS.QUIT jsr LeaveSubDir CS.QUIT jsr LeaveSubDir
bcc CS.QUIT bcc CS.QUIT
>LDA.G hFilter >LDA.G hFilter
beq .1 beq .1
>SYSCALL FreeMem >SYSCALL FreeMem
.1 >LDA.G hSrcFullPath
.1 lda hSrcFullPath
beq .8 beq .8
>SYSCALL FreeMem >SYSCALL FreeMem
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
@ -271,69 +299,88 @@ GetHexFileType ldy #$ff
cpy #3 cpy #3
bne .9 bne .9
lda (ZPPtr1) lda (ZPPtr1)
cmp #'0' cmp #'0'
bne .1 bne .1
ldy #1 ldy #1
lda (ZPPtr1),y lda (ZPPtr1),y
jsr IsDigit16 jsr IsDigit16
bcs .9 bcs .9
asl asl
asl asl
asl asl
asl asl
>STA.G HexFileType sta HexFileType
ldy #2
iny
lda (ZPPtr1),y lda (ZPPtr1),y
jsr IsDigit16 jsr IsDigit16
bcs .9 bcs .9
>ORA.G HexFileType
sta (pData),y tsb HexFileType
clc * clc
rts rts
.1 ldx #0 .1 ldx #0
>LDYA L.PRODOS.FT.TXT >LDYA L.PRODOS.FT.TXT
>STYA ZPPtr2 >STYA ZPPtr2
.2 ldy #2 .2 ldy #2
.21 lda (ZPPtr1),y .21 lda (ZPPtr1),y
cmp #'a' cmp #'a'
bcc .4 bcc .4
cmp #'z'+1 cmp #'z'+1
bcs .4 bcs .4
eor #$20 eor #$20
.4 cmp (ZPPtr2),y .4 cmp (ZPPtr2),y
bne .5 bne .5
dey dey
bpl .21 bpl .21
lda PRODOS.FT.ID,x
>STA.G HexFileType lda PRODOS.FT.HEX,x
sta HexFileType
clc clc
rts rts
.5 clc .5 clc
lda ZPPtr2 lda ZPPtr2
adc #3 adc #3
sta ZPPtr2 sta ZPPtr2
lda ZPPtr2+1 bcc .6
adc #0
sta ZPPtr2+1 inc ZPPtr2+1
inx
cpx #PRODOS.FT.COUNT .6 inx
cpx #PRODOS.FT.TXT-PRODOS.FT.HEX
bne .2 bne .2
.9 sec .9 sec
rts rts
*--------------------------------------- *---------------------------------------
IsDigit16 cmp #'0' IsDigit16 cmp #'0'
bcc .9 bcc .9
cmp #'9'+1 cmp #'9'+1
bcc .8 bcc .8
cmp #'A' cmp #'A'
bcc .9 bcc .9
cmp #'F'+1 cmp #'F'+1
bcc .1 bcc .1
cmp #'a' cmp #'a'
bcc .9 bcc .9
cmp #'f'+1 cmp #'f'+1
bcs .9 bcs .9
@ -342,8 +389,10 @@ IsDigit16 cmp #'0'
* clc * clc
sbc #'A'-11 cc so A->10 (11-CC) sbc #'A'-11 cc so A->10 (11-CC)
clc clc
.8 and #$0F .8 and #$0F
rts rts
.9 sec .9 sec
rts rts
*-------------------------------------- *--------------------------------------
@ -362,27 +411,20 @@ MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n" MSG.ERR .AZ "[%h]\r\n"
MSG.FILE .AZ "CHTYP File:%S..." MSG.FILE .AZ "CHTYP File:%S..."
*-------------------------------------- *--------------------------------------
PRODOS.FT.COUNT .EQ 6 PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.ID .HS 0406FAFCFDFF
PRODOS.FT.TXT .AS "TXT" PRODOS.FT.TXT .AS "TXT"
.AS "BIN" .AS "BIN"
.AS "ASM" .AS "ASM"
.AS "BAS" .AS "BAS"
.AS "VAR" .AS "VAR"
.AS "PIX"
.AS "FON"
.AS "PAK"
.AS "SYS" .AS "SYS"
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START .INB usr/src/shared/x.fileenum.g
ArgCount .BS 1
hSrcFullPath .BS 1
bPause .BS 1
bContinue .BS 1
bRecurse .BS 1
HexFileType .BS 1
.INB usr/src/shared/x.fileenum.g
DS.END .ED DS.END .ED
*-------------------------------------- *--------------------------------------
MAN MAN

View File

@ -1176,13 +1176,12 @@ CIFS.BADCALL lda #MLI.E.BADCALL
rts rts
*-------------------------------------- *--------------------------------------
CS.END CS.END
PRODOS.FT.HEX .HS 0406FAFCFDE2CBCCCFFF PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.TXT .AZ "txt" PRODOS.FT.TXT .AZ "txt"
.AZ "bin" .AZ "bin"
.AZ "asm" .AZ "asm"
.AZ "bas" .AZ "bas"
.AZ "var" .AZ "var"
.AZ "atk"
.AZ "pix" .AZ "pix"
.AZ "fon" .AZ "fon"
.AZ "pak" .AZ "pak"