mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-19 05:30:35 +00:00
Moved *TYPE, *SPOOL, *EXEC to auxmem.oscli.s (from hostfs).
This commit is contained in:
parent
b7dafc24b5
commit
2c5aec9a44
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
113
auxmem.hostfs.s
113
auxmem.hostfs.s
@ -310,15 +310,6 @@ FSCCOMMAND ASC 'CHDIR'
|
||||
ASC 'COPY'
|
||||
DB $80
|
||||
DW FSCCOPY-1 ; COPY <listspec> <*objspec*>, LPTR=>params
|
||||
ASC 'TYPE'
|
||||
DB $80
|
||||
DW FSCTYPE-1 ; TYPE <*objspec*>, LPTR=>params
|
||||
ASC 'SPOOL'
|
||||
DB $80
|
||||
DW FSCSPOOL-1 ; SPOOL <*objspec*>, LPTR=>params
|
||||
ASC 'XEXEC'
|
||||
DB $80
|
||||
DW FSCEXEC-1 ; EXEC <*objspec*>, LPTR=>params
|
||||
*
|
||||
DB $FF ; Terminator
|
||||
|
||||
@ -847,110 +838,6 @@ DESTROY JSR PARSLPTR ; Copy filename->MOSFILE
|
||||
FSCTITLE RTS
|
||||
|
||||
|
||||
* Handle *TYPE command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
FSCTYPE JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :SYNTAX ; No filename
|
||||
PLY
|
||||
PLX
|
||||
LDA #$40 ; Open for input
|
||||
JSR FINDHND ; Try to open file
|
||||
CMP #$00 ; Was file opened?
|
||||
BEQ :NOTFOUND
|
||||
TAY ; File handle in Y
|
||||
:L1 JSR BGETHND ; Read a byte
|
||||
BCS :CLOSE ; EOF
|
||||
JSR OSWRCH ; Print the character
|
||||
LDA ESCFLAG
|
||||
BMI :ESC
|
||||
BRA :L1
|
||||
:CLOSE LDA #$00
|
||||
JSR FINDHND ; Close file
|
||||
:DONE RTS
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: TYPE <*objspec*>'
|
||||
BRK
|
||||
:NOTFOUND BRK
|
||||
DB $D6
|
||||
ASC 'Not found'
|
||||
BRK
|
||||
:ESC LDA #$00 ; Close file
|
||||
JSR FINDHND
|
||||
BRK
|
||||
DB $11
|
||||
ASC 'Escape'
|
||||
BRK
|
||||
|
||||
|
||||
* Handle *SPOOL command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
FSCSPOOL JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :CLOSE ; No filename - stop spooling
|
||||
PLY
|
||||
PLX
|
||||
LDA FXSPOOL
|
||||
BNE :NOTTWICE
|
||||
LDA #$80 ; Open for writing
|
||||
JSR FINDHND ; Try to open file
|
||||
STA FXSPOOL ; Store SPOOL file handle
|
||||
RTS
|
||||
:CLOSE PLY ; Fix the stack
|
||||
PLX
|
||||
LDY FXSPOOL
|
||||
CPY #$00
|
||||
BEQ :DONE
|
||||
LDA #$00
|
||||
JSR FINDHND ; Close file
|
||||
STZ FXSPOOL
|
||||
:DONE RTS
|
||||
:NOTTWICE BRK
|
||||
DB $D6
|
||||
ASC 'Already spooling'
|
||||
BRK
|
||||
|
||||
|
||||
* Handle *EXEC command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
FSCEXEC JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :SYNTAX ; No filename
|
||||
PLY
|
||||
PLX
|
||||
LDA #$40 ; Open for input
|
||||
JSR FINDHND ; Try to open file
|
||||
CMP #$00 ; Was file opened?
|
||||
BEQ :NOTFOUND
|
||||
STA FXEXEC ; Store EXEC file handle
|
||||
RTS
|
||||
RTS
|
||||
:SYNTAX PLY ; Fix the stack
|
||||
PLX
|
||||
BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: EXEC <*objspec*>'
|
||||
BRK
|
||||
:NOTFOUND STZ FXEXEC
|
||||
BRK
|
||||
DB $D6
|
||||
ASC 'Not found'
|
||||
BRK
|
||||
|
||||
|
||||
* Parse filename pointed to by XY
|
||||
* Write filename to MOSFILE in main memory
|
||||
* Returns length in A with EQ/NE set
|
||||
|
114
auxmem.oscli.s
114
auxmem.oscli.s
@ -69,8 +69,16 @@ CMDTABLE ASC 'CAT' ; Must be first command so matches '*.'
|
||||
ASC 'ECHO'
|
||||
DB $80
|
||||
DW ECHO-1 ; ECHO -> (LPTR)=>params
|
||||
ASC 'TYPE'
|
||||
DB $80
|
||||
DW TYPE-1 ; TYPE -> (LPTR)=>params
|
||||
ASC 'SPOOL'
|
||||
DB $80
|
||||
DW SPOOL-1 ; EXEC -> (LPTR)=>params
|
||||
ASC 'EXEC'
|
||||
DB $80
|
||||
DW EXEC-1 ; EXEC -> (LPTR)=>params
|
||||
* DUMP <file>
|
||||
* TYPE <file>
|
||||
* BUILD <file>
|
||||
* terminator
|
||||
DB $FF
|
||||
@ -512,6 +520,110 @@ ECHOLP1 JSR GSREAD
|
||||
JMP ECHOLP1
|
||||
|
||||
|
||||
* Handle *TYPE command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
TYPE JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :SYNTAX ; No filename
|
||||
PLY
|
||||
PLX
|
||||
LDA #$40 ; Open for input
|
||||
JSR FINDHND ; Try to open file
|
||||
CMP #$00 ; Was file opened?
|
||||
BEQ :NOTFOUND
|
||||
TAY ; File handle in Y
|
||||
:L1 JSR BGETHND ; Read a byte
|
||||
BCS :CLOSE ; EOF
|
||||
JSR OSWRCH ; Print the character
|
||||
LDA ESCFLAG
|
||||
BMI :ESC
|
||||
BRA :L1
|
||||
:CLOSE LDA #$00
|
||||
JSR FINDHND ; Close file
|
||||
:DONE RTS
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: TYPE <*objspec*>'
|
||||
BRK
|
||||
:NOTFOUND BRK
|
||||
DB $D6
|
||||
ASC 'Not found'
|
||||
BRK
|
||||
:ESC LDA #$00 ; Close file
|
||||
JSR FINDHND
|
||||
BRK
|
||||
DB $11
|
||||
ASC 'Escape'
|
||||
BRK
|
||||
|
||||
|
||||
* Handle *SPOOL command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
SPOOL JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :CLOSE ; No filename - stop spooling
|
||||
PLY
|
||||
PLX
|
||||
LDA FXSPOOL
|
||||
BNE :NOTTWICE
|
||||
LDA #$80 ; Open for writing
|
||||
JSR FINDHND ; Try to open file
|
||||
STA FXSPOOL ; Store SPOOL file handle
|
||||
RTS
|
||||
:CLOSE PLY ; Fix the stack
|
||||
PLX
|
||||
LDY FXSPOOL
|
||||
CPY #$00
|
||||
BEQ :DONE
|
||||
LDA #$00
|
||||
JSR FINDHND ; Close file
|
||||
STZ FXSPOOL
|
||||
:DONE RTS
|
||||
:NOTTWICE BRK
|
||||
DB $D6
|
||||
ASC 'Already spooling'
|
||||
BRK
|
||||
|
||||
|
||||
* Handle *EXEC command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
EXEC JSR LPTRtoXY
|
||||
PHX
|
||||
PHY
|
||||
JSR XYtoLPTR
|
||||
JSR PARSLPTR ; Just for error handling
|
||||
BEQ :SYNTAX ; No filename
|
||||
PLY
|
||||
PLX
|
||||
LDA #$40 ; Open for input
|
||||
JSR FINDHND ; Try to open file
|
||||
CMP #$00 ; Was file opened?
|
||||
BEQ :NOTFOUND
|
||||
STA FXEXEC ; Store EXEC file handle
|
||||
RTS
|
||||
RTS
|
||||
:SYNTAX PLY ; Fix the stack
|
||||
PLX
|
||||
BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: EXEC <*objspec*>'
|
||||
BRK
|
||||
:NOTFOUND STZ FXEXEC
|
||||
BRK
|
||||
DB $D6
|
||||
ASC 'Not found'
|
||||
BRK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user