mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-31 23:09:33 +00:00
126 lines
3.6 KiB
Plaintext
126 lines
3.6 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
EXEC.ERR.FILE.BUSY JMP ERR.FILE.BUSY
|
||
EXEC.ERR.MISMATCH JMP TYPERR
|
||
*--------------------------------
|
||
EXEC
|
||
JSR GET.REFNUM.OF.OPEN.FILE
|
||
BCS .1 ...NOT CURRENTLY OPEN
|
||
*---File is in use---------------
|
||
BIT EXEC.FILE.CLOSING.FLAG
|
||
BPL EXEC.ERR.FILE.BUSY
|
||
*---Restarting same EXEC file----
|
||
STA MISC.PARMS+1 REFNUM
|
||
LDA #0 "REWIND" THE FILE
|
||
STA MISC.PARMS+2
|
||
STA MISC.PARMS+3
|
||
STA MISC.PARMS+4
|
||
JSR MLI.CE SET MARK
|
||
BCS CLOSE.EXEC.SAVING.ERROR
|
||
BCC .2 ...ALWAYS, RESTART
|
||
*--------------------------------
|
||
.1 JSR CLOSE.EXEC.FILE STOP ANY EXEC IN PROGRESS
|
||
BCS .3 ...ERROR
|
||
*---Check file type--------------
|
||
LDA GET.SET.PARMS+4 FILE TYPE MUST BE TXT
|
||
CMP #$04 TXT FILETYPE CODE
|
||
BNE EXEC.ERR.MISMATCH
|
||
*---Open the file----------------
|
||
LDA #0
|
||
STA LEVEL LEVEL
|
||
STA MISC.PARMS+2 BUFFER ADDRESS
|
||
LDA EXEC.BUFFER.BASE
|
||
STA MISC.PARMS+3 BUFFER ADDRESS HI
|
||
STA OPEN.PARMS+4 "
|
||
JSR MLI.C8 OPEN
|
||
BCS .3 ...ERROR
|
||
LDA OPEN.PARMS+5 REFNUM OF FILE
|
||
STA EXEC.REFNUM
|
||
*---Fill other param blocks------
|
||
.2 LDX GET.SET.PARMS+5 RECORD LENGTH
|
||
STX VAL.L
|
||
LDX GET.SET.PARMS+6
|
||
STX VAL.L+1
|
||
LDX #2 POINT AT EXEC FILE NAME
|
||
JSR SAVE.FILENAME.IN.TABLE
|
||
*---Switch EXEC on now-----------
|
||
LDA #$FF MARK EXEC ACTIVE
|
||
STA F.EXEC
|
||
LDA KSWL
|
||
STA VDOSIO+2
|
||
LDA KSWH
|
||
STA VDOSIO+3
|
||
LDA #READ.EXEC.FILE
|
||
STA KSWL
|
||
LDA /READ.EXEC.FILE
|
||
STA KSWH
|
||
CLC
|
||
.3 RTS
|
||
*--------------------------------
|
||
CLOSE.EXEC.SAVING.ERROR
|
||
PHA SAVE ERROR CODE
|
||
JSR CLOSE.EXEC.FILE CLOSE THE FILE
|
||
PLA GET ERROR CODE
|
||
SEC SIGNAL ERROR
|
||
RTS
|
||
*--------------------------------
|
||
* CLOSE EXEC FILE
|
||
*--------------------------------
|
||
CLOSE.EXEC.FILE
|
||
CLC
|
||
LDA F.EXEC
|
||
BPL .1 ...NO EXEC IN PROGRESS
|
||
LDA VDOSIO+2 RESTORE INPUT HOOK
|
||
STA KSWL
|
||
LDA VDOSIO+3
|
||
STA KSWH
|
||
LDA #$FF
|
||
STA EXEC.FILE.CLOSING.FLAG
|
||
LDX #2
|
||
LDA EXEC.REFNUM
|
||
JSR CLOSE.ONE.FILE CLOSE THE FILE
|
||
.1 RTS
|
||
*--------------------------------
|
||
* "EXEC" INPUT HOOK
|
||
*--------------------------------
|
||
READ.EXEC.FILE
|
||
STA (BASL),Y STOP BLINKING ON SCREEN
|
||
JSR SAVE.REGS SAVE A,X,Y
|
||
*---Check for CTRL-C Abort-------
|
||
LDA KEYBOARD
|
||
CMP #$83 CONTROL-C?
|
||
BNE .2 ...NO
|
||
JSR CLOSE.EXEC.FILE ...YES
|
||
STA STROBE
|
||
*---End of Data------------------
|
||
.1 JSR RESTORE.REGS
|
||
JMP ABORT.EXIT
|
||
*---Set up EXEC char input-------
|
||
.2 LDA EXEC.REFNUM REFNUM
|
||
STA READ.WRITE.PARMS+1
|
||
LDA #EXEC.INPUT.CHAR
|
||
STA READ.WRITE.PARMS+2
|
||
LDA /EXEC.INPUT.CHAR
|
||
STA READ.WRITE.PARMS+3
|
||
LDA #1 READ JUST ONE BYTE
|
||
STA READ.WRITE.PARMS+4
|
||
LDA #0
|
||
STA READ.WRITE.PARMS+5
|
||
JSR MLI.CA READ
|
||
BCS .3 ...ERROR OR END OF DATA
|
||
JSR RESTORE.REGS
|
||
LDA EXEC.INPUT.CHAR
|
||
ORA #$80
|
||
RTS
|
||
*--------------------------------
|
||
.3 JSR CLOSE.EXEC.SAVING.ERROR CLOSE EXEC FILE
|
||
CMP #$05 END OF DATA?
|
||
BEQ .1 ...YES
|
||
JMP ERROR.HANDLER
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/scmasm.31/sci.s.exec
|
||
LOAD usr/src/scmasm.31/scmasm.s
|
||
ASM
|