Fix bug with *INFO on filename without wildcard.

This commit is contained in:
Bobbi Webber-Manners 2021-09-12 02:05:17 -04:00
parent a18eeeabae
commit 052e46f98a
19 changed files with 538 additions and 492 deletions

Binary file not shown.

View File

@ -194,3 +194,5 @@ MAINZP MAC

View File

@ -468,3 +468,5 @@ OSWORDM ASC 'OSWORD($'
OSBM2 ASC ').'
DB $00

View File

@ -26,9 +26,9 @@
* 12-Sep-2021 COPY calls new VDU entry point.
OLDCHAR EQU OSKBD1 ; *TEMP* ; character under cursor
COPYCHAR EQU OSKBD2 ; *TEMP* ; character under copy cursor
FLASHER EQU BYTEVARBASE+193 ; flash counter for cursor
OLDCHAR EQU OSKBD1 ; *TEMP* ; character under cursor
COPYCHAR EQU OSKBD2 ; *TEMP* ; character under copy cursor
FLASHER EQU BYTEVARBASE+193 ; flash counter for cursor
FXEXEC EQU BYTEVARBASE+198
FXSPOOL EQU BYTEVARBASE+199
@ -448,3 +448,5 @@ BYTE76 LDX #$00 ; Update LEDs and return X=SHIFT

View File

@ -693,7 +693,7 @@ DESTRET >>> ENTAUX
JSR CHKERROR
LDA #$00
RTS
* Parse filename pointed to by XY
* Write filename to MOSFILE in main memory
* Returns length in A
@ -926,3 +926,5 @@ ERROR2E DW $C800

View File

@ -7,8 +7,8 @@
* BBC Micro 'virtual machine' in Apple //e aux memory
***********************************************************
ZP1 EQU $90 ; $90-$9f are spare Econet space
; so safe to use
ZP1 EQU $90 ; $90-$9f are spare Econet space
; so safe to use
ZP2 EQU $92
ZP3 EQU $94
@ -16,11 +16,11 @@ ZP3 EQU $94
** TO DO: will be moved to VDU space
*COL EQU $96 ; Cursor column
*ROW EQU $97 ; Cursor row
STRTBCKL EQU $9D ; *TO DO* don't need to preserve
STRTBCKL EQU $9D ; *TO DO* don't need to preserve
STRTBCKH EQU $9E
MOSSHIM
ORG AUXMOS ; MOS shim implementation
ORG AUXMOS ; MOS shim implementation
*
* Shim code to service Acorn MOS entry points using
@ -30,23 +30,23 @@ MOSSHIM
*
* Initially executing at $3000 until copied to $D000
MOSINIT LDX #$FF ; Initialize Alt SP to $1FF
MOSINIT LDX #$FF ; Initialize Alt SP to $1FF
TXS
STA $C005 ; Make sure we are writing aux
STA $C000 ; Make sure 80STORE is off
STA $C005 ; Make sure we are writing aux
STA $C000 ; Make sure 80STORE is off
LDA $C08B ; LC RAM Rd/Wt, 1st 4K bank
LDA $C08B ; LC RAM Rd/Wt, 1st 4K bank
LDA $C08B
:MODBRA BRA :RELOC ; NOPped out on first run
:MODBRA BRA :RELOC ; NOPped out on first run
BRA :NORELOC
LDA #$EA ; NOP opcode
LDA #$EA ; NOP opcode
STA :MODBRA
STA :MODBRA+1
:RELOC LDA #<AUXMOS1 ; Relocate MOS shim
:RELOC LDA #<AUXMOS1 ; Relocate MOS shim
STA A1L
LDA #>AUXMOS1
STA A1H
@ -105,30 +105,30 @@ MOSINIT LDX #$FF ; Initialize Alt SP to $1FF
:S7 BRA :L2
:NORELOC
:S8 STA $C00D ; 80 col on
STA $C003 ; Alt charset off
STA $C055 ; PAGE2
JMP MOSHIGH ; Ensure executing in high memory here
:S8 STA $C00D ; 80 col on
STA $C003 ; Alt charset off
STA $C055 ; PAGE2
JMP MOSHIGH ; Ensure executing in high memory here
MOSHIGH SEI
LDX #$FF
TXS ; Initialise stack
INX ; X=$00
TXS ; Initialise stack
INX ; X=$00
TXA
:SCLR STA $0000,X ; Clear Kernel memory
:SCLR STA $0000,X ; Clear Kernel memory
STA $0200,X
STA $0300,X
INX
BNE :SCLR
LDX #ENDVEC-DEFVEC-1
:INITPG2 LDA DEFVEC,X ; Set up vectors
:INITPG2 LDA DEFVEC,X ; Set up vectors
STA $200,X
DEX
BPL :INITPG2
JSR KBDINIT ; Returns A=startup MODE
JSR VDUINIT ; Initialise VDU driver
JSR KBDINIT ; Returns A=startup MODE
JSR VDUINIT ; Initialise VDU driver
JSR PRHELLO
LDA #7
JSR OSWRCH
@ -138,33 +138,33 @@ MOSHIGH SEI
* OSBYTE $8E - Enter language ROM
*
BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
LDA #$00
STA FAULT+0
LDA #$80
STA FAULT+1
LDY #$09
JSR PRERRLP ; Print ROM name with PRERR to set
STY FAULT+0 ; FAULT pointing to version string
JSR OSNEWL
JSR OSNEWL
PLP ; Get entry type back
LDA #$01
JMP AUXADDR
BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
LDA #$00
STA FAULT+0
LDA #$80
STA FAULT+1
LDY #$09
JSR PRERRLP ; Print ROM name with PRERR to set
STY FAULT+0 ; FAULT pointing to version string
JSR OSNEWL
JSR OSNEWL
PLP ; Get entry type back
LDA #$01
JMP AUXADDR
* OSBYTE $8F - Issue service call
* X=service call, Y=parameter
*
BYTE8F
SERVICEX TXA
SERVICE LDX #$0F
BIT $8006
BPL :SERVSKIP ; No service entry
JSR $8003 ; Call service entry
TAX
BEQ :SERVDONE
:SERVSKIP LDX #$FF
:SERVDONE RTS
SERVICEX TXA
SERVICE LDX #$0F
BIT $8006
BPL :SERVSKIP ; No service entry
JSR $8003 ; Call service entry
TAX
BEQ :SERVDONE
:SERVSKIP LDX #$FF
:SERVDONE RTS
PRHELLO LDA #<HELLO
@ -172,11 +172,13 @@ PRHELLO LDA #<HELLO
JSR PRSTR
JMP OSNEWL
BYTE00XX BEQ BYTE00A ; OSBYTE 0,0 - generate error
LDX #$0A ; $00 = identify Host
RTS ; %000x1xxx host type, 'A'pple
BYTE00XX BEQ BYTE00A ; OSBYTE 0,0 - generate error
LDX #$0A ; $00 = identify Host
RTS ; %000x1xxx host type, 'A'pple
BYTE00A BRK
DB $F7
HELLO ASC 'Applecorn MOS 2021-09-11 snapshot'
DB $00 ; Unify MOS messages
DB $00 ; Unify MOS messages

View File

@ -132,7 +132,7 @@ PRDECXY LDA #' '
PRDECPAD STA OSPAD
STX OSNUM+0
STY OSNUM+1
:PRDEC16 LDY #$08 ; Five digits (5-1)*2
:PRDEC16 LDY #$08 ; Five digits (5-1)*2
:LP1 LDX #$FF
SEC
:LP2 LDA OSNUM+0
@ -496,3 +496,5 @@ AUXBLK ASC '**ENDOFCODE**'

View File

@ -16,28 +16,28 @@
* $E0-$EE Internal MOS workspace
* $EF-$FF MOS API workspace
FSFLAG1 EQU $E2
FSFLAG2 EQU $E3
GSFLAG EQU $E4 ; $E4 GSREAD processing flags
GSCHAR EQU $E5 ; $E5 GSREAD accumulator
OSTEXT EQU $E6 ; $E6 => text string $E6 OSNUM+0
MAXLEN EQU OSTEXT+2 ; $E8 $E8 OSNUM+2
MINCHAR EQU OSTEXT+3 ; $E9 $E9 OSNUM+3
MAXCHAR EQU OSTEXT+4 ; $EA $EA OSPAD
OSTEMP EQU $EB ; $EB
OSKBD1 EQU $EC ; $EC kbd ws
OSKBD2 EQU OSKBD1+1 ; $ED kbd ws
OSKBD3 EQU OSKBD1+2 ; $EE kbd ws
OSAREG EQU $EF ; $EF A register
OSXREG EQU OSAREG+1 ; $F0 X register
OSYREG EQU OSXREG+1 ; $F1 Y register
OSCTRL EQU OSXREG ; $F0 (XY)=>control block
OSLPTR EQU $F2 ; $F2 => command line
FSFLAG1 EQU $E2
FSFLAG2 EQU $E3
GSFLAG EQU $E4 ; $E4 GSREAD processing flags
GSCHAR EQU $E5 ; $E5 GSREAD accumulator
OSTEXT EQU $E6 ; $E6 => text string $E6 OSNUM+0
MAXLEN EQU OSTEXT+2 ; $E8 $E8 OSNUM+2
MINCHAR EQU OSTEXT+3 ; $E9 $E9 OSNUM+3
MAXCHAR EQU OSTEXT+4 ; $EA $EA OSPAD
OSTEMP EQU $EB ; $EB
OSKBD1 EQU $EC ; $EC kbd ws
OSKBD2 EQU OSKBD1+1 ; $ED kbd ws
OSKBD3 EQU OSKBD1+2 ; $EE kbd ws
OSAREG EQU $EF ; $EF A register
OSXREG EQU OSAREG+1 ; $F0 X register
OSYREG EQU OSXREG+1 ; $F1 Y register
OSCTRL EQU OSXREG ; $F0 (XY)=>control block
OSLPTR EQU $F2 ; $F2 => command line
*
OSINTWS EQU $FA ; $FA IRQ ZP pointer, use when IRQs off
OSINTA EQU $FC ; $FC IRQ register A store
FAULT EQU $FD ; $FD Error message pointer
ESCFLAG EQU $FF ; $FF Escape status
OSINTWS EQU $FA ; $FA IRQ ZP pointer, use when IRQs off
OSINTA EQU $FC ; $FC IRQ register A store
FAULT EQU $FD ; $FD Error message pointer
ESCFLAG EQU $FF ; $FF Escape status
* $0200-$0235 Vectors
@ -45,24 +45,26 @@ ESCFLAG EQU $FF ; $FF Escape status
* $0290-$02ED
* $02EE-$02FF MOS control block
USERV EQU $200 ; USER vector
BRKV EQU $202 ; BRK vector
CLIV EQU $208 ; OSCLI vector
BYTEV EQU $20A ; OSBYTE vector
WORDV EQU $20C ; OSWORD vector
WRCHV EQU $20E ; OSWRCH vector
RDCHV EQU $210 ; OSRDCH vector
FILEV EQU $212 ; OSFILE vector
ARGSV EQU $214 ; OSARGS vector
BGETV EQU $216 ; OSBGET vector
BPUTV EQU $218 ; OSBPUT vector
GBPBV EQU $21A ; OSGBPB vector
FINDV EQU $21C ; OSFIND vector
FSCV EQU $21E ; FSCV misc file ops
USERV EQU $200 ; USER vector
BRKV EQU $202 ; BRK vector
CLIV EQU $208 ; OSCLI vector
BYTEV EQU $20A ; OSBYTE vector
WORDV EQU $20C ; OSWORD vector
WRCHV EQU $20E ; OSWRCH vector
RDCHV EQU $210 ; OSRDCH vector
FILEV EQU $212 ; OSFILE vector
ARGSV EQU $214 ; OSARGS vector
BGETV EQU $216 ; OSBGET vector
BPUTV EQU $218 ; OSBPUT vector
GBPBV EQU $21A ; OSGBPB vector
FINDV EQU $21C ; OSFIND vector
FSCV EQU $21E ; FSCV misc file ops
BYTEVARBASE EQU $190 ; Base of OSBYTE variables
OSFILECB EQU $2EE ; OSFILE control block
BYTEVARBASE EQU $190 ; Base of OSBYTE variables
OSFILECB EQU $2EE ; OSFILE control block
* $0300-$03DF
* $03E0-$03FF Used for interfacing with ProDOS XFER

View File

@ -14,75 +14,75 @@
***************
* Table structure is: { string, byte OR $80, destword-1 } $00
* fsc commands
CMDTABLE ASC 'CAT' ; Must be first command so matches '*.'
DB $85
DW STARFSC-1 ; CAT -> FSC 5, XY=>params
ASC 'RUN'
DB $84
DW STARFSC-1 ; RUN -> FSC 4, XY=>params
ASC 'EX'
DB $89
DW STARFSC-1 ; EX -> FSC 9, XY=>params
ASC 'INFO'
DB $8A
DW STARFSC-1 ; INFO -> FSC 10, XY=>params
ASC 'RENAME'
DB $8C
DW STARFSC-1 ; RENAME -> FSC 12, XY=>params
CMDTABLE ASC 'CAT' ; Must be first command so matches '*.'
DB $85
DW STARFSC-1 ; CAT -> FSC 5, XY=>params
ASC 'RUN'
DB $84
DW STARFSC-1 ; RUN -> FSC 4, XY=>params
ASC 'EX'
DB $89
DW STARFSC-1 ; EX -> FSC 9, XY=>params
ASC 'INFO'
DB $8A
DW STARFSC-1 ; INFO -> FSC 10, XY=>params
ASC 'RENAME'
DB $8C
DW STARFSC-1 ; RENAME -> FSC 12, XY=>params
* osfile commands
ASC 'LOAD'
DB $FF
DW STARLOAD-1 ; LOAD -> OSFILE FF, CBLK=>filename
ASC 'SAVE'
DB $FF
DW STARSAVE-1 ; SAVE -> OSFILE 00, CBLK=>filename
ASC 'DELETE'
DB $86
DW STARFILE-1 ; DELETE -> OSFILE 06, CBLK=>filename
ASC 'MKDIR'
DB $88
DW STARFILE-1 ; MKDIR -> OSFILE 08, CBLK=>filename
ASC 'CDIR'
DB $88
DW STARFILE-1 ; CDIR -> OSFILE 08, CBLK=>filename
ASC 'LOAD'
DB $FF
DW STARLOAD-1 ; LOAD -> OSFILE FF, CBLK=>filename
ASC 'SAVE'
DB $FF
DW STARSAVE-1 ; SAVE -> OSFILE 00, CBLK=>filename
ASC 'DELETE'
DB $86
DW STARFILE-1 ; DELETE -> OSFILE 06, CBLK=>filename
ASC 'MKDIR'
DB $88
DW STARFILE-1 ; MKDIR -> OSFILE 08, CBLK=>filename
ASC 'CDIR'
DB $88
DW STARFILE-1 ; CDIR -> OSFILE 08, CBLK=>filename
* osbyte commands
ASC 'FX'
DB $80
DW STARFX-1 ; FX -> OSBYTE A,X,Y (LPTR)=>params
ASC 'OPT'
DB $8B
DW STARBYTE-1 ; OPT -> OSBYTE &8B,X,Y XY=>params
ASC 'FX'
DB $80
DW STARFX-1 ; FX -> OSBYTE A,X,Y (LPTR)=>params
ASC 'OPT'
DB $8B
DW STARBYTE-1 ; OPT -> OSBYTE &8B,X,Y XY=>params
* others
ASC 'QUIT'
DB $80
DW STARQUIT-1 ; QUIT -> (LPTR)=>params
ASC 'HELP'
DB $FF
DW STARHELP-1 ; HELP -> XY=>params
ASC 'BASIC'
DB $80
DW STARBASIC-1 ; BASIC -> (LPTR)=>params
ASC 'KEY'
DB $80
DW STARKEY-1 ; KEY -> (LPTR)=>params
ASC 'ECHO'
DB $80
DW ECHO-1 ; ECHO -> (LPTR)=>params
ASC 'QUIT'
DB $80
DW STARQUIT-1 ; QUIT -> (LPTR)=>params
ASC 'HELP'
DB $FF
DW STARHELP-1 ; HELP -> XY=>params
ASC 'BASIC'
DB $80
DW STARBASIC-1 ; BASIC -> (LPTR)=>params
ASC 'KEY'
DB $80
DW STARKEY-1 ; KEY -> (LPTR)=>params
ASC 'ECHO'
DB $80
DW ECHO-1 ; ECHO -> (LPTR)=>params
* DUMP <file>
* TYPE <file>
* BUILD <file>
* terminator
DB $FF
DB $FF
* *HELP TABLE
*************
HLPTABLE ASC 'MOS'
DB $80
DW HELPMOS-1 ; *HELP MOS
ASC 'HOSTFS'
DB $80
DW HELPHOSTFS-1 ; *HELP HOSTFS
DB $FF
HLPTABLE ASC 'MOS'
DB $80
DW HELPMOS-1 ; *HELP MOS
ASC 'HOSTFS'
DB $80
DW HELPHOSTFS-1 ; *HELP HOSTFS
DB $FF
* Command table lookup
@ -92,402 +92,402 @@ HLPTABLE ASC 'MOS'
* A<>0 no match
*
* Search command table
CLILOOKUP STX OSTEXT+0 ; Start of command table
STY OSTEXT+1
LDX #0 ; (ZP,X)=>command table
CLILP4 LDY #0 ; Start of command line
CLILP5 LDA (OSTEXT,X)
BMI CLIMATCH ; End of table string
EOR (OSLPTR),Y
AND #$DF ; Force upper case match
BNE CLINOMATCH
JSR CLISTEP ; Step to next table char
INY ; Step to next command char
BNE CLILP5 ; Loop to check
CLILOOKUP STX OSTEXT+0 ; Start of command table
STY OSTEXT+1
LDX #0 ; (ZP,X)=>command table
CLILP4 LDY #0 ; Start of command line
CLILP5 LDA (OSTEXT,X)
BMI CLIMATCH ; End of table string
EOR (OSLPTR),Y
AND #$DF ; Force upper case match
BNE CLINOMATCH
JSR CLISTEP ; Step to next table char
INY ; Step to next command char
BNE CLILP5 ; Loop to check
CLINOMATCH LDA (OSLPTR),Y
CMP #'.' ; Abbreviation?
BEQ CLIDOT
CLINEXT JSR CLISTEP ; No match, step to next entry
BPL CLINEXT
CLINEXT2 JSR CLISTEP ; Step past byte, address
JSR CLISTEP
JSR CLISTEP
BPL CLILP4 ; Loop to check next
RTS ; Exit, A>$7F
CLINOMATCH LDA (OSLPTR),Y
CMP #'.' ; Abbreviation?
BEQ CLIDOT
CLINEXT JSR CLISTEP ; No match, step to next entry
BPL CLINEXT
CLINEXT2 JSR CLISTEP ; Step past byte, address
JSR CLISTEP
JSR CLISTEP
BPL CLILP4 ; Loop to check next
RTS ; Exit, A>$7F
CLIDOT LDA (OSTEXT,X)
BMI CLINEXT2 ; Dot after full word, no match
CLIDOT2 JSR CLISTEP ; Step to command address
BPL CLIDOT2
INY ; Step past dot
BNE CLIMATCH2 ; Jump to this command
CLIDOT LDA (OSTEXT,X)
BMI CLINEXT2 ; Dot after full word, no match
CLIDOT2 JSR CLISTEP ; Step to command address
BPL CLIDOT2
INY ; Step past dot
BNE CLIMATCH2 ; Jump to this command
CLIMATCH LDA (OSLPTR),Y
CMP #'.'
BEQ CLINEXT ; Longer abbreviation, eg 'CAT.'
CMP #'A'
BCS CLINEXT ; More letters, eg 'HELPER'
CLIMATCH2 JSR CLIMATCH3 ; Call the routine
LDA #0
RTS ; Return A=0 to claim
CLIMATCH LDA (OSLPTR),Y
CMP #'.'
BEQ CLINEXT ; Longer abbreviation, eg 'CAT.'
CMP #'A'
BCS CLINEXT ; More letters, eg 'HELPER'
CLIMATCH2 JSR CLIMATCH3 ; Call the routine
LDA #0
RTS ; Return A=0 to claim
CLIMATCH3 JSR SKIPSPC ; (OSLPTR),Y=>parameters
LDA (OSTEXT,X) ; Command byte
PHA
JSR CLISTEP ; Address low byte
STA OSTEMP
JSR CLISTEP ; Address high byte
PLX ; Get command byte
PHA ; Push address high
LDA OSTEMP
PHA ; Push address low
TXA ; Command byte
PHA
ASL A ; Drop bit 7
BEQ CLICALL ; If $80 don't convert LPTR
JSR LPTRtoXY ; XY=>parameters
CLICALL PLA ; A=command parameter
RTS ; Call command routine
CLIMATCH3 JSR SKIPSPC ; (OSLPTR),Y=>parameters
LDA (OSTEXT,X) ; Command byte
PHA
JSR CLISTEP ; Address low byte
STA OSTEMP
JSR CLISTEP ; Address high byte
PLX ; Get command byte
PHA ; Push address high
LDA OSTEMP
PHA ; Push address low
TXA ; Command byte
PHA
ASL A ; Drop bit 7
BEQ CLICALL ; If $80 don't convert LPTR
JSR LPTRtoXY ; XY=>parameters
CLICALL PLA ; A=command parameter
RTS ; Call command routine
CLISTEP INC OSTEXT+0,X ; Point to next table byte
BNE CLISTEP2
INC OSTEXT+1,X
CLISTEP2 LDA (OSTEXT,X) ; Get next byte
RTS
CLISTEP INC OSTEXT+0,X ; Point to next table byte
BNE CLISTEP2
INC OSTEXT+1,X
CLISTEP2 LDA (OSTEXT,X) ; Get next byte
RTS
* OSCLI HANDLER
* On entry, XY=>command string
* On exit, AXY corrupted or error generated
*
CLIHND JSR XYtoLPTR ; LPTR=>command line
CLILP1 LDA (OSLPTR),Y
CMP #$0D
BEQ CLI2
INY
BNE CLILP1
CLIEXIT1 RTS ; No terminating <cr>
CLI2 LDY #$FF
CLILP2 JSR SKIPSPC1 ; Skip leading spaces
CMP #'*' ; Skip leading stars
BEQ CLILP2
CMP #$0D
BEQ CLIEXIT1 ; Null string
CMP #'|'
BEQ CLIEXIT1 ; Comment
CMP #'/'
BEQ CLISLASH
JSR LPTRtoXY ; Add Y to LPTR
JSR XYtoLPTR ; LPTR=>start of actual command
LDX #<CMDTABLE ; XY=>command table
LDY #>CMDTABLE
JSR CLILOOKUP ; Look for command
BNE CLIUNKNOWN ; No match
CLIDONE RTS
CLIHND JSR XYtoLPTR ; LPTR=>command line
CLILP1 LDA (OSLPTR),Y
CMP #$0D
BEQ CLI2
INY
BNE CLILP1
CLIEXIT1 RTS ; No terminating <cr>
CLI2 LDY #$FF
CLILP2 JSR SKIPSPC1 ; Skip leading spaces
CMP #'*' ; Skip leading stars
BEQ CLILP2
CMP #$0D
BEQ CLIEXIT1 ; Null string
CMP #'|'
BEQ CLIEXIT1 ; Comment
CMP #'/'
BEQ CLISLASH
JSR LPTRtoXY ; Add Y to LPTR
JSR XYtoLPTR ; LPTR=>start of actual command
LDX #<CMDTABLE ; XY=>command table
LDY #>CMDTABLE
JSR CLILOOKUP ; Look for command
BNE CLIUNKNOWN ; No match
CLIDONE RTS
CLISLASH JSR SKIPSPC1
BEQ CLIDONE ; */<cr>
LDA #$02
BNE STARFSC2 ; FSC 2 = */filename
CLISLASH JSR SKIPSPC1
BEQ CLIDONE ; */<cr>
LDA #$02
BNE STARFSC2 ; FSC 2 = */filename
CLIUNKNOWN LDA #$04
JSR SERVICE ; Offer to sideways ROM(s)
BEQ CLIDONE ; Claimed
LDA #$03 ; FSC 3 = unknown command
STARFSC2 PHA
JSR LPTRtoXY ; XY=>command
PLA
STARFSC AND #$7F ; A=command, XY=>parameters
JSR CALLFSCV ; Hand on to filing system
TAX
BEQ CLIDONE ; A=0, FSC call implemented
ERRBADCMD BRK
DB $FE
ASC 'Bad command'
ERRBADNUM BRK
DB $FC
ASC 'Bad number'
ERRBADADD BRK
DB $FC
ASC 'Bad address'
BRK
CLIUNKNOWN LDA #$04
JSR SERVICE ; Offer to sideways ROM(s)
BEQ CLIDONE ; Claimed
LDA #$03 ; FSC 3 = unknown command
STARFSC2 PHA
JSR LPTRtoXY ; XY=>command
PLA
STARFSC AND #$7F ; A=command, XY=>parameters
JSR CALLFSCV ; Hand on to filing system
TAX
BEQ CLIDONE ; A=0, FSC call implemented
ERRBADCMD BRK
DB $FE
ASC 'Bad command'
ERRBADNUM BRK
DB $FC
ASC 'Bad number'
ERRBADADD BRK
DB $FC
ASC 'Bad address'
BRK
* *FX num(,num(,num))
*********************
STARFX JSR SCANDEC
BRA STARBYTE1
STARFX JSR SCANDEC
BRA STARBYTE1
* Commands passed to OSBYTE
***************************
STARBYTE JSR XYtoLPTR
STARBYTE1 STA OSAREG ; Save OSBYTE number
LDA #$00 ; Default X and Y
STA OSXREG
STA OSYREG
JSR SKIPCOMMA ; Step past any comma/spaces
BEQ STARBYTE2 ; End of line, do it
JSR SCANDEC ; Scan for X param
STA OSXREG ; Store it
JSR SKIPCOMMA ; Step past any comma/spaces
BEQ STARBYTE2 ; End of line, do it
JSR SCANDEC ; Scan for Y param
STA OSYREG ; Store it
JSR SKIPSPC
BNE ERRBADCMD ; More params, error
STARBYTE2 LDY OSYREG
LDX OSXREG
LDA OSAREG
JSR OSBYTE
BVS ERRBADCMD
RTS
STARBYTE JSR XYtoLPTR
STARBYTE1 STA OSAREG ; Save OSBYTE number
LDA #$00 ; Default X and Y
STA OSXREG
STA OSYREG
JSR SKIPCOMMA ; Step past any comma/spaces
BEQ STARBYTE2 ; End of line, do it
JSR SCANDEC ; Scan for X param
STA OSXREG ; Store it
JSR SKIPCOMMA ; Step past any comma/spaces
BEQ STARBYTE2 ; End of line, do it
JSR SCANDEC ; Scan for Y param
STA OSYREG ; Store it
JSR SKIPSPC
BNE ERRBADCMD ; More params, error
STARBYTE2 LDY OSYREG
LDX OSXREG
LDA OSAREG
JSR OSBYTE
BVS ERRBADCMD
RTS
* Scan decimal number
SCANDEC JSR SKIPSPC
JSR SCANDIGIT ; Check first digit
BCS ERRBADNUM ; Doesn't start with a digit
SCANDECLP STA OSTEMP ; Store as current number
JSR SCANDIGIT ; Check next digit
BCS SCANDECOK ; No more digits
PHA
LDA OSTEMP
CMP #26
BCS ERRBADNUM ; num>25, num*25>255
ASL A ; num*2
ASL A ; num*4
ADC OSTEMP ; num*4+num = num*5
ASL A ; num*10
STA OSTEMP
PLA
ADC OSTEMP ; num=num*10+digit
BCC SCANDECLP
BCS ERRBADNUM ; Overflowed
SCANDEC JSR SKIPSPC
JSR SCANDIGIT ; Check first digit
BCS ERRBADNUM ; Doesn't start with a digit
SCANDECLP STA OSTEMP ; Store as current number
JSR SCANDIGIT ; Check next digit
BCS SCANDECOK ; No more digits
PHA
LDA OSTEMP
CMP #26
BCS ERRBADNUM ; num>25, num*25>255
ASL A ; num*2
ASL A ; num*4
ADC OSTEMP ; num*4+num = num*5
ASL A ; num*10
STA OSTEMP
PLA
ADC OSTEMP ; num=num*10+digit
BCC SCANDECLP
BCS ERRBADNUM ; Overflowed
SCANDECOK LDA OSTEMP ; Return A=number
SCANDIG2 SEC
RTS
SCANDECOK LDA OSTEMP ; Return A=number
SCANDIG2 SEC
RTS
SCANDIGIT LDA (OSLPTR),Y
CMP #'0'
BCC SCANDIG2 ; <'0'
CMP #'9'+1
BCS SCANDIG2 ; >'9'
INY
AND #$0F
RTS
SCANDIGIT LDA (OSLPTR),Y
CMP #'0'
BCC SCANDIG2 ; <'0'
CMP #'9'+1
BCS SCANDIG2 ; >'9'
INY
AND #$0F
RTS
HEXDIGIT JSR SCANDIGIT
BCC HEXDIGIT2 ; Decimal digit
AND #$DF
CMP #'A'
BCC SCANDIG2 ; Bad hex character
CMP #'G'
BCS HEXDIGIT2 ; Bad hex character
SBC #$36 ; Convert 'A'-'F' to $0A-$0F
INY
CLC
HEXDIGIT2 RTS
HEXDIGIT JSR SCANDIGIT
BCC HEXDIGIT2 ; Decimal digit
AND #$DF
CMP #'A'
BCC SCANDIG2 ; Bad hex character
CMP #'G'
BCS HEXDIGIT2 ; Bad hex character
SBC #$36 ; Convert 'A'-'F' to $0A-$0F
INY
CLC
HEXDIGIT2 RTS
* Scan hex address
* (OSLPTR),Y=>first character
* $200,X = 4-byte accumulator
SCANHEX JSR HEXDIGIT ; Get first digit
BCS ERRBADADD1 ; Not a hex character
STA $200,X ; Store first digit
LDA #0
STA $201,X ; Clear rest of accumulator
STA $202,X
STA $203,X
SCANHEXLP1 JSR HEXDIGIT ; Get next digit
BCS SKIPSPC ; Done, exit by skipping spaces
STY OSTEMP
LDY #4 ; Four bits to rotate
SCANHEXLP2 ASL $200,X ; Multiple accumulator by 16
ROL $201,X
ROL $202,X
ROL $203,X
BCS ERRBADADD1 ; Overflowed
DEY
BNE SCANHEXLP2 ; Loop for four bits
ORA $200,X ; Add in current digit
STA $200,X
LDY OSTEMP ; Get Y back
BNE SCANHEXLP1
ERRBADADD1 JMP ERRBADADD
SCANHEX JSR HEXDIGIT ; Get first digit
BCS ERRBADADD1 ; Not a hex character
STA $200,X ; Store first digit
LDA #0
STA $201,X ; Clear rest of accumulator
STA $202,X
STA $203,X
SCANHEXLP1 JSR HEXDIGIT ; Get next digit
BCS SKIPSPC ; Done, exit by skipping spaces
STY OSTEMP
LDY #4 ; Four bits to rotate
SCANHEXLP2 ASL $200,X ; Multiple accumulator by 16
ROL $201,X
ROL $202,X
ROL $203,X
BCS ERRBADADD1 ; Overflowed
DEY
BNE SCANHEXLP2 ; Loop for four bits
ORA $200,X ; Add in current digit
STA $200,X
LDY OSTEMP ; Get Y back
BNE SCANHEXLP1
ERRBADADD1 JMP ERRBADADD
SKIPCOMMA LDA (OSLPTR),Y
CMP #$2C
BNE SKIPSPC ; Drop through
SKIPCOMMA LDA (OSLPTR),Y
CMP #$2C
BNE SKIPSPC ; Drop through
*
* Skip spaces
SKIPSPC1 INY ; Step past a character
SKIPSPC LDA (OSLPTR),Y
CMP #' '
BEQ SKIPSPC1
CMP #$0D ; Return EQ=<cr>
RTS
SKIPSPC1 INY ; Step past a character
SKIPSPC LDA (OSLPTR),Y
CMP #' '
BEQ SKIPSPC1
CMP #$0D ; Return EQ=<cr>
RTS
* Skip a string
SKIPWORD CLC
JSR GSINIT
SKIPWORDLP JSR GSREAD
BCC SKIPWORDLP
RTS
SKIPWORD CLC
JSR GSINIT
SKIPWORDLP JSR GSREAD
BCC SKIPWORDLP
RTS
* Convert (LPTR),Y to XY
LPTRtoXY CLC
TYA
ADC OSLPTR+0
TAX
LDA #0
ADC OSLPTR+1
TAY
RTS
LPTRtoXY CLC
TYA
ADC OSLPTR+0
TAX
LDA #0
ADC OSLPTR+1
TAY
RTS
* Convert XY to (LPTR),Y
XYtoLPTR STX OSLPTR+0
STY OSLPTR+1
LDY #0
RTS
XYtoLPTR STX OSLPTR+0
STY OSLPTR+1
LDY #0
RTS
* Print *HELP text
STARHELP JSR XYtoLPTR ; (OSLPTR),Y=>parameters
JSR PRHELLO ; Unify version message
LDX #<HLPTABLE ; XY=>command table
LDY #>HLPTABLE
JSR CLILOOKUP ; Look for *HELP subject
LDA $8006 ; Does ROM have service entry?
BMI STARHELP6 ; Yes, send service call
JSR OSNEWL
LDA #$09 ; Language name
LDY #$80 ; *TO DO* make this and BYTE8E
JSR PRSTR ; use same code
JSR OSNEWL
STARHELP6 LDY #0 ; (OSLPTR),Y=>parameters
LDA #9
JMP SERVICE ; Pass to sideways ROM(s)
STARHELP JSR XYtoLPTR ; (OSLPTR),Y=>parameters
JSR PRHELLO ; Unify version message
LDX #<HLPTABLE ; XY=>command table
LDY #>HLPTABLE
JSR CLILOOKUP ; Look for *HELP subject
LDA $8006 ; Does ROM have service entry?
BMI STARHELP6 ; Yes, send service call
JSR OSNEWL
LDA #$09 ; Language name
LDY #$80 ; *TO DO* make this and BYTE8E
JSR PRSTR ; use same code
JSR OSNEWL
STARHELP6 LDY #0 ; (OSLPTR),Y=>parameters
LDA #9
JMP SERVICE ; Pass to sideways ROM(s)
HELPHOSTFS LDX #<FSCCOMMAND ; *HELP HOSTFS
LDY #>FSCCOMMAND
BNE HELPLIST
HELPMOS LDX #<CMDTABLE ; *HELP MOS
LDY #>CMDTABLE
HELPHOSTFS LDX #<FSCCOMMAND ; *HELP HOSTFS
LDY #>FSCCOMMAND
BNE HELPLIST
HELPMOS LDX #<CMDTABLE ; *HELP MOS
LDY #>CMDTABLE
HELPLIST STX OSTEXT+0 ; Start of command table
STY OSTEXT+1
LDX #0
HELPLP1 LDA #32
JSR OSWRCH
JSR OSWRCH
HELPLP2 LDY #10
HELPLP3 LDA (OSTEXT,X)
BMI HELPLP4
JSR OSWRCH
DEY
JSR CLISTEP
BPL HELPLP3
HELPLP4 LDA #32
JSR OSWRCH
DEY
BNE HELPLP4
JSR CLISTEP
JSR CLISTEP
JSR CLISTEP
BPL HELPLP2
STARHELP4 LDA #$08
JSR OSWRCH
JSR OSWRCH
JMP FORCENL
HELPLIST STX OSTEXT+0 ; Start of command table
STY OSTEXT+1
LDX #0
HELPLP1 LDA #32
JSR OSWRCH
JSR OSWRCH
HELPLP2 LDY #10
HELPLP3 LDA (OSTEXT,X)
BMI HELPLP4
JSR OSWRCH
DEY
JSR CLISTEP
BPL HELPLP3
HELPLP4 LDA #32
JSR OSWRCH
DEY
BNE HELPLP4
JSR CLISTEP
JSR CLISTEP
JSR CLISTEP
BPL HELPLP2
STARHELP4 LDA #$08
JSR OSWRCH
JSR OSWRCH
JMP FORCENL
* Handle *QUIT command
STARQUIT >>> XF2MAIN,QUIT
STARQUIT >>> XF2MAIN,QUIT
STARSAVE LDA #$00 ; Set A=0 - SAVE
STARLOAD PHA ; Entered with A=$FF - LOAD
JSR XYtoLPTR ; OSLPTR=>filename
JSR SKIPWORD ; Step past filename
BNE STARLDSV3 ; filename followed by addr
STARSAVE LDA #$00 ; Set A=0 - SAVE
STARLOAD PHA ; Entered with A=$FF - LOAD
JSR XYtoLPTR ; OSLPTR=>filename
JSR SKIPWORD ; Step past filename
BNE STARLDSV3 ; filename followed by addr
*
* filename followed by no address, must be *LOAD name
STARLDSV1 LDA #$FF ; $FF=load to file's address
STARLOAD2 STA OSFILECB+6
PLA
BEQ ERRBADADD2 ; *save name <no addr>
LDA #$7F ; Will become A=$FF
JMP STARLDSVGO ; Do the load
STARLDSV1 LDA #$FF ; $FF=load to file's address
STARLOAD2 STA OSFILECB+6
PLA
BEQ ERRBADADD2 ; *save name <no addr>
LDA #$7F ; Will become A=$FF
JMP STARLDSVGO ; Do the load
* At least one address specified
STARLDSV3 LDX #OSFILECB+2-$200 ; X=>load
JSR SCANHEX
BNE STARSAVE3 ; Another address
LDA #$00 ; $00=load to supplied address
BEQ STARLOAD2 ; Only one address, must be *LOAD
STARLDSV3 LDX #OSFILECB+2-$200 ; X=>load
JSR SCANHEX
BNE STARSAVE3 ; Another address
LDA #$00 ; $00=load to supplied address
BEQ STARLOAD2 ; Only one address, must be *LOAD
* More than one address, must be *SAVE
STARSAVE3 PLA
BNE ERRBADADD2 ; Can't be *LOAD
LDX #3
STARSAVE4 LDA OSFILECB+2,X ; Get load
STA OSFILECB+6,X ; copy to exec
STA OSFILECB+10,X ; and to start
DEX
BPL STARSAVE4
LDA (OSLPTR),Y
CMP #'+'
PHP
BNE STARSAVE5 ; Not start+length
JSR SKIPSPC1 ; Step past '+' and spaces
STARSAVE5 LDX #OSFILECB+14-$200
JSR SCANHEX ; Get end or length
PLP
BNE STARSAVE7 ; Not +length
LDX #0
CLC
STARSAVE6 LDA OSFILECB+10,X ; end=start+length
ADC OSFILECB+14,X
STA OSFILECB+14,X
INX
TXA
AND #3
BNE STARSAVE6
STARSAVE3 PLA
BNE ERRBADADD2 ; Can't be *LOAD
LDX #3
STARSAVE4 LDA OSFILECB+2,X ; Get load
STA OSFILECB+6,X ; copy to exec
STA OSFILECB+10,X ; and to start
DEX
BPL STARSAVE4
LDA (OSLPTR),Y
CMP #'+'
PHP
BNE STARSAVE5 ; Not start+length
JSR SKIPSPC1 ; Step past '+' and spaces
STARSAVE5 LDX #OSFILECB+14-$200
JSR SCANHEX ; Get end or length
PLP
BNE STARSAVE7 ; Not +length
LDX #0
CLC
STARSAVE6 LDA OSFILECB+10,X ; end=start+length
ADC OSFILECB+14,X
STA OSFILECB+14,X
INX
TXA
AND #3
BNE STARSAVE6
* load =start
* exec =start
* start=start
* end =end or start+length
STARSAVE7 JSR SKIPSPC
BEQ STARSAVE10 ; No more, do it
LDX #OSFILECB+6-$200
JSR SCANHEX ; Get exec
BEQ STARSAVE10 ; No more, do it
LDX #OSFILECB+2-$200
JSR SCANHEX ; Get load
BEQ STARSAVE10 ; No more, do it
ERRBADADD2 JMP ERRBADADD ; Too many parameters
STARSAVE7 JSR SKIPSPC
BEQ STARSAVE10 ; No more, do it
LDX #OSFILECB+6-$200
JSR SCANHEX ; Get exec
BEQ STARSAVE10 ; No more, do it
LDX #OSFILECB+2-$200
JSR SCANHEX ; Get load
BEQ STARSAVE10 ; No more, do it
ERRBADADD2 JMP ERRBADADD ; Too many parameters
STARSAVE10 LDA #$80 ; Will become $00 - SAVE
STARLDSVGO LDX OSLPTR+0
LDY OSLPTR+1 ; Continue through...
STARSAVE10 LDA #$80 ; Will become $00 - SAVE
STARLDSVGO LDX OSLPTR+0
LDY OSLPTR+1 ; Continue through...
*
* Commands passed to OSFILE
***************************
STARFILE EOR #$80
STX OSFILECB+0
STY OSFILECB+1
LDX #<OSFILECB
LDY #>OSFILECB
JSR OSFILE
TAX
BNE STARDONE
JMP ERRNOTFND
STARFILE EOR #$80
STX OSFILECB+0
STY OSFILECB+1
LDX #<OSFILECB
LDY #>OSFILECB
JSR OSFILE
TAX
BNE STARDONE
JMP ERRNOTFND
STARBASIC
STARKEY
STARDONE RTS
STARDONE RTS
* *ECHO <GSTRANS string>
@ -497,20 +497,20 @@ ECHO
* CLC
* JSR ECHO0
* PLY
SEC
ECHO0 JSR GSINIT
SEC
ECHO0 JSR GSINIT
* PHP
* PLA
* JSR OUTHEX
ECHOLP1 JSR GSREAD
BCS STARDONE
ECHOLP1 JSR GSREAD
BCS STARDONE
* BCS ECHO3
* CMP #$20
* BCC ECHO2
* CMP #$7F
* BCS ECHO2
JSR OSWRCH
JMP ECHOLP1
JSR OSWRCH
JMP ECHOLP1
*ECHO2 PHA
* LDA #'<'
* JSR OSWRCH
@ -524,3 +524,5 @@ ECHOLP1 JSR GSREAD
* PLA
* JSR OUTHEX
* JMP OSNEWL

View File

@ -619,3 +619,5 @@ BYTEA0 LDY #79 ; Read VDU variable $09,$0A
LDX #23
RTS
* TEST

View File

@ -58,3 +58,5 @@ GEOFCMD EQU $D1

View File

@ -104,3 +104,5 @@ RESET TSX

View File

@ -130,6 +130,8 @@ CANTOPEN ASC "Unable to open ROM file"

View File

@ -108,3 +108,5 @@ QUITPL HEX 04 ; Number of parameters

View File

@ -136,6 +136,8 @@ ROM8 STR "USERROM2.ROM"

View File

@ -157,3 +157,5 @@ FILEREFS DB $00,$00,$00,$00

View File

@ -284,3 +284,5 @@ PREFIX DS 65 ; Buffer for ProDOS prefix

View File

@ -701,6 +701,7 @@ CATARG DB $00
* Handle *INFO
INFO JSR PREPATH ; Preprocess pathname
SEC
JSR WILDCARD ; Handle any wildcards
JSR EXISTS ; Check matches something
CMP #$00
@ -708,10 +709,6 @@ INFO JSR PREPATH ; Preprocess pathname
LDA #$46 ; Not found (TO DO: err code?)
BRA CATEXIT
** BUG: If the last segment is a literal with no wildcard, then
** the directory block is never loaded into memory, so printing
** it does not go well ;)
INFOREENTRY
JSR WILDNEXT2 ; Start of new block
BCS INFOEXIT ; No more matches
@ -729,7 +726,7 @@ INFOEXIT CMP #$4C ; EOF
LDA #$00 ; EOF is not an error
INFOCLS JSR CLSDIR ; Be sure to close it!
BRA CATEXIT
* Set prefix. Used by *CHDIR to change directory
SETPFX >>> ENTMAIN
@ -778,6 +775,7 @@ DRVINFO >>> ENTMAIN
SETPERM >>> ENTMAIN
JSR PREPATH ; Preprocess pathname
BCS :SYNERR
CLC
JSR WILDCARD ; Handle any wildcards
BCS :NONE
STZ :LFLAG
@ -844,6 +842,7 @@ SETPERM >>> ENTMAIN
MULTIDEL >>> ENTMAIN
JSR PREPATH ; Preprocess pathname
BCS :SYNERR
CLC
JSR WILDCARD ; Handle any wildcards
BCS :NONE
BRA :MAINLOOP
@ -881,3 +880,5 @@ MAINRDMEM STA A1L
LDA (A1L)
MAINRDEXIT >>> XF2AUX,NULLRTS ; Back to an RTS

View File

@ -5,7 +5,8 @@
* Performs wildcard matching for operations that only require the
* first match. <*obj-spec*> in Acorn ADFS terminology.
WILDONE JSR WILDCARD
WILDONE CLC
JSR WILDCARD
JSR CLSDIR
RTS
@ -13,8 +14,13 @@ WILDONE JSR WILDCARD
* by '/'), and for each segment see if it contains wildcard chars.
* If so, pass it to SRCHBLK to expand the wildcard. If not, just
* append the segment as it is. Uses MFTEMP to build up the path.
* On entry: SEC to force leaf noden lookup even if no wildcard,
* CLC otherwise
* Returns with carry set if wildcard match fails, clear otherwise
WILDCARD STZ :LAST
WILDCARD STZ :ALWAYS ; Set :ALWAYS if carry set
BCC :NORMAL
DEC :ALWAYS
:NORMAL STZ :LAST
LDX #$00 ; Start with first char
STX MFTEMP ; Clear MFTEMP (len=0)
PHX
@ -32,7 +38,11 @@ WILDCARD STZ :LAST
BEQ :L1 ; ... go again
:S1 JSR HASWILD ; See if it has '*'/'#'/'?'
BCS :WILD ; It does
JSR APPSEG ; Not wild: Append SEGBUF to MFTEMP
LDA :ALWAYS ; Always do leaf-node lookup?
BEQ :S2
LDA :LAST ; If it is the last segment do ..
BNE :WILD ; .. wildcard lookup anyhow (for *INFO)
:S2 JSR APPSEG ; Not wild: Append SEGBUF to MFTEMP
BRA :NEXT
:WILD LDX #<MFTEMP ; Invoke SRCHBLK to look for pattern
LDY #>MFTEMP ; in the directory path MFTEMP
@ -52,6 +62,7 @@ WILDCARD STZ :LAST
SEC
RTS
:LAST DB $00 ; Flag for last segment
:ALWAYS DB $00 ; Flag to always lookup leafnode
* Obtain subsequent wildcard matches
* WILDCARD must have been called first
@ -369,3 +380,5 @@ MATCHBUF DS 65 ; For storing match results (Pascal str)