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
*--------------------------------------
* 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
*--------------------------------------
CODE.INTSET >LDYA ZPADDR
@ -54,22 +34,6 @@ CODE.INTSET >LDYA ZPADDR
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
.1 lda CCODE.PULLWS,x
@ -77,7 +41,7 @@ CODE.PULLWS ldx #0
inx
cpx #CCODE.PULLWS.LEN
bne .1
rts
*--------------------------------------
CODE.PUSHWS ldx #0
@ -87,14 +51,14 @@ CODE.PUSHWS ldx #0
inx
cpx #CCODE.PUSHWS.LEN
bne .1
rts
*--------------------------------------
CODE.PUSHBI lda #$A9 LDA #imm
jsr CODE.EmitByte
txa
jsr CODE.EmitByte
jmp CODE.PUSHA
*--------------------------------------
CODE.PUSHIYA pha
@ -103,7 +67,7 @@ CODE.PUSHIYA pha
pla
jsr CODE.EmitByte
jsr CODE.PUSHA
lda #$A9 LDA #imm
jsr CODE.EmitByte
tya
@ -114,16 +78,26 @@ CODE.PUSHINT16 ldy #1
.1 lda #$A9 LDA #imm
jsr CODE.EmitByte
lda (pStack),y
jsr CODE.EmitByte
jsr CODE.PUSHA
dey
bpl .1
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
lda #$A0 LDY #imm
jsr CODE.EmitByte
@ -149,26 +123,6 @@ CODE.PUSHA ldx #0
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
jsr CODE.EmitByte
lda J.RT,x
@ -189,7 +143,7 @@ CODE.FPUCALL lda #$A2 LDX #imm
*--------------------------------------
CODE.FPRINTCRLF ldx #C.CR
jsr CODE.PutChar
ldx #C.LF
ldx #C.LF
*--------------------------------------
CODE.PutChar lda #$A9 LDA #imm
jsr CODE.EmitByte

View File

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

View File

@ -60,17 +60,22 @@ EXP.Eval.R lda EXP.AOPS
bra .40
.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
jsr CODE.INTGET
ldx #RT.IntGet.ID
jsr CODE.JSRRT
bra .40
.23 jsr CODE.STRGET
.23 ldx #RT.StrGet.ID
jsr CODE.JSRRT
bra .40
*--------------------------------------

View File

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

View File

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

View File

@ -2,23 +2,80 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
RT.StrSet
*--------------------------------------
RT.StrGet
*--------------------------------------
clc
RT.StrSet >PUSHB hStrings
* >PUSHW id
* >PUSHW str
>SYSCALL StrVSet
rts
*--------------------------------------
RT.StrLeft
clc
RT.StrGet >PUSHB hStrings
txa
>PUSHA
tya
>PUSHA
>PUSHW ZPStrBuf
>SYSCALL StrVGet
>PUSHW ZPStrBuf
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)
stz ZPPtr1
@ -61,6 +118,48 @@ RT.Input lda #0
.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
SAVE usr/src/bin/acos.s.rt
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.TRACE .DA MSG.TRACE
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.RUN .DA MSG.RUN
L.MSG.STR .DA MSG.STR
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.KW .DA ACOS.KW
@ -150,14 +153,15 @@ KWID.IF .EQ *-J.ACOS.KW
*--------------------------------------
L.ACOS.FN .DA ACOS.FN
J.ACOS.FN .DA FN.BYTE
.DA FN.CHRd
.DA FN.CLOCK
.DA FN.DATEd
.DA FN.FLAG
.DA FN.CHRd
.DA FN.INFO
.DA FN.INSTR
.DA FN.KEY
.DA FN.LEN
.DA FN.LEFTd
.DA FN.LEN
.DA FN.MIDd
.DA FN.PDL
.DA FN.PEEK
@ -169,7 +173,36 @@ J.ACOS.FN .DA FN.BYTE
.DA FN.VAL
.DA FN.WHENd
.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
*--------------------------------------
* Called once at process creation
@ -228,10 +261,16 @@ CS.RUN.LOOP >SLEEP
.4 cmp #MLI.E.EOF
bne .9
lda #$60 RTS
sta (ZPCodeBufPtr)
lda #0
sta (ZPFWRefBufPtr)
jsr CS.FClose
jsr CORE.FWREF
bcs .9
bcs .99
jsr CORE.Run
bcc .8
@ -244,7 +283,7 @@ CS.RUN.LOOP >SLEEP
.8 lda #0 Exit Code = Success
sec
rts
.99 rts
*--------------------------------------
CS.RUN.ARGS inc ArgIndex
@ -399,6 +438,15 @@ PrintErrorMsg >LDA.G bTrace
>PUSHBI 2
>SYSCALL FPrintF
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
*--------------------------------------
@ -443,91 +491,9 @@ CCODE.TESTTRUE lda (pStack)
inc pStack
plp
.1 bne .1+5
.HS 4C JMP abs
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
*--------------------------------------
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 " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n"
MSG.COMPILING .AZ "Compiling : %s...\r\n"
MSG.DEBUG .AZ "CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
MSG.COMPILING .AZ "***Compiling : %s...\r\n"
MSG.DEBUG .AZ "***CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
MSG.TRACE .AZ "%05D>%s\r\n"
MSG.ERROR .AZ " %s^\r\n"
MSG.RUN .AZ "Success, Code size = %D Bytes\r\nResolving FWRefs...\r\n"
MSG.FWREFERR .AZ "Unresolved FWRef : %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.STR .AZ "%s"
MSG.INT16 .AZ "%I"
*--------------------------------------
FMT.DATE .AZ "%d/%m/%Y"
FMT.TIME .AZ "%H:%M:%S"
*--------------------------------------
OptionList .AS "DdTt"
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
*--------------------------------------
@ -636,14 +606,15 @@ ACOS.KW .AT "ADDINT"
.HS 00
*--------------------------------------
ACOS.FN .AT "BYTE"
.AT "CHR$"
.AT "CLOCK"
.AT "DATE$"
.AT "FLAG"
.AT "CHR$"
.AT "INFO"
.AT "INSTR"
.AT "KEY"
.AT "LEN"
.AT "LEFT$"
.AT "LEN"
.AT "MID$"
.AT "PDL"
.AT "PEEK"
@ -673,6 +644,7 @@ hLabels .BS 1
hVars .BS 1
hStrBuf .BS 1
hFWRefBuf .BS 1
TimeBuf .BS S.TIME
DS.END .ED
*--------------------------------------
MAN

View File

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

View File

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