A2osX/SCMASM.31/SCMASM.S.MCMDS.txt

267 lines
7.0 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
HELP
LDA #CMD.TBL
LDX /CMD.TBL
LDY #2
JSR HELP.1
JSR CRLF
LDA SCI.TBLADR
LDX SCI.TBLADR+1
LDY #4
*--------------------------------
HELP.1
STA .92+1
STX .92+2
STY .91+1
LDY #-1 POINT TO BEGINNING
LDX #10
LDA #$0D
.1 JSR CHO
BPL .2
JSR MON.PRBL2
TYA
CLC
.91 ADC #0
TAY
LDX #10
.2 INY
DEX
.92 LDA $5555,Y
BNE .1
.3 RTS
*--------------------------------
HILO JSR EXPR.DEFINED
LDA EXP.VALUE+3 MUST BE 0000XX00
ORA EXP.VALUE+2
ORA EXP.VALUE
BNE HL.RAER
LDX EXP.VALUE+1
RTS
*--------------------------------
HIMEM JSR HILO
DEX
CPX SYMBOL.BASE
BCC HL.RAER ...BELOW OR SAME AS LOMEM
CPX SCI.BUFFER.PAGES+2 Start of Exec Buffer
BCS HL.RAER ABOVE EXEC BUFFER
INX
STX SCI.HIMEM.PAGE
JMP NEW
*--------------------------------
HL.RAER JMP RAER
*--------------------------------
LOMEM JSR HILO
CPX #8
BCC HL.RAER ...BELOW $800
CPX SCI.HIMEM.PAGE
BCS HL.RAER ...ABOVE OR SAME AS HIMEM
STX SYMBOL.BASE
JMP NEW
*--------------------------------
* SET INCREMENT VALUE FOR AUTO-LINE-NUMBERING
*--------------------------------
INCREMENT
JSR SCAN.1.DECIMAL.NUMBER
DEX be sure there was a value
BMI SYNX1 ...no, not one
.1 LDA A0L,X GET VALUE
STA INCREMENT.VALUE,X
DEX
BPL .1
RTS
SYNX1 JMP SYNX
*--------------------------------
* AUTO & MANUAL COMMANDS
*--------------------------------
AUTO JSR SCAN.1.DECIMAL.NUMBER GET BASE, IF ANY
JSR SCAN.1.DECIMAL.NUMBER Get increment, if any
DEX Were there any parameters?
BMI .4 ...no, use current values
DEX ...yes, see if two parameters
DEX
BMI .2 ...no, only a starting line number
.1 LDA A1L,X ...yes, copy new increment
STA INCREMENT.VALUE,X
DEX
BPL .1
*---X=-1, form "previous" line number---
.2 SEC As written, this loop only works
.3 LDA A0L+1,X if all values are in page zero
SBC INCREMENT.VALUE+1,X because it uses negative
STA CURLNO+1,X indexing.
INX
BEQ .3
*---Set the AUTO flag------------
.4 SEC SET FLAG
.HS 90 "BCC", ALWAYS SKIP NEXT BYTE
MANUAL CLC CLEAR FLAG
ROR AUTOLN.FLAG
RTS
*--------------------------------
*
* EDIT COMMAND
*
*--------------------------------
EDIT
JSR GET.KEY.STRING
JSR PARSE.LINE.RANGE
.1 JSR GET.LINE.TO.WBUF
BCC .2
RTS Finished with range
.2 JSR FIND.KEY.IN.WBUF
BCC .1 Not there
JSR EDIT.ONE.LINE
JMP .1
*--------------------------------
DATE JSR SCAN.3.DECIMAL.NUMBERS Day, Month, Year
CPX #6
BCC SYNX1 NEED ALL THREE VALUES
LDA A1L MONTH
ASL
ASL
ASL
ASL
ASL M-MMM00000
ORA A0L M-MMMDDDDD
STA $BF90
LDA A2L YEAR
ROL YYYYYYYM
STA $BF91
RTS
*--------------------------------
TIME JSR SCAN.3.DECIMAL.NUMBERS Hour, Minute
CPX #4
BCC SYNX1 NEED BOTH VALUES
LDA A0L HOUR
STA $BF93
LDA A1L MINUTE
STA $BF92
RTS
*---------------------------------
* RENUMBER COMMAND
*
* UP TO THREE PARAMETERS
* 1: BASE NUMBER (DEFAULT = 1000)
* 2: INCREMENT (DEFAULT = 10)
* 3: STARTING LINE (DEFAULT = 0)
*---------------------------------
RENUMBER
JSR SCAN.3.DECIMAL.NUMBERS Base, Increment, Starting Line
.1 CPX #3 COPY DEFAULTS IF ANY NEEDED
BCS .2 NO MORE DEFAULTS NEEDED
LDA RENDTA,X
STA A0L,X
INX
BNE .1 ...ALWAYS
.2 LDX #A2L FIND STARTING LINE
JSR SERTXT
.3 LDA LINE.START TEST IF THRU YET
CMP HI.MEM
LDA LINE.START+1
SBC HI.MEM+1
BCS .4 FINISHED
LDY #0
LDA (LINE.START),Y GET LINE LENGTH
PHA SAVE FOR LATER
INY
LDA A0L STORE NEW LINE NUMBER IN LINE
STA (LINE.START),Y
ADC A1L ADD INCREMENT AS WE GO
STA A0L
INY
LDA A0H REST OF LINE NUMBER
STA (LINE.START),Y
ADC A1H ADD REST OF INCREMENT
BCS .5 YES, TOO BIG
STA A0H OK, AND CARRY CLEAR
PLA GET LINE SIZE
ADC LINE.START BUMP POINTER TO NEXT LINE
STA LINE.START
BCC .3
INC LINE.START+1
BNE .3 ...ALWAYS
.4 RTS FINISHED!
.5 LDY #QER3 RANGE ERROR
JMP HARD.ERROR
RENDTA .DA 1000 DEFAULT BASE
.DA #10 DEFAULT INCREMENT
*** .DA 0 DEFAULT STARTING LINE
*--------------------------------
* HIDE COMMAND
*--------------------------------
HIDE JSR MERGE MERGE IF ANY PREVIOUS HIDE
LDA #'H
STA PROMPT.FLAG NO, HIDE IT ALONE
INX NOW X=1
.1 LDA HI.MEM,X SAVE HI.MEM
STA HIDE.HIMEM,X
LDA PP,X
STA HI.MEM,X
DEX
BPL .1
RTS
*--------------------------------
* MERGE COMMAND
*--------------------------------
MERGE LDA PROMPT.FLAG
EOR #'H
BNE .1
STA PROMPT.FLAG CLEAR PROMPT CHAR
LDA HIDE.HIMEM RESTORE HI.MEM
STA HI.MEM
LDA HIDE.HIMEM+1
STA HI.MEM+1
.1 RTS
*--------------------------------
* NEW COMMAND
*--------------------------------
NEW JSR RESTORE RESTORE IF IN AN INCLUDE
JSR MERGE
JSR EMPTY.SOURCE.AREA
JMP HARD
*--------------------------------
* MEMORY COMMAND
* PRINT OUT BOUNDS ON SOURCE PROGRAM
* AND ON SYMBOL TABLE
*--------------------------------
MEMORY LDY #QSRCPRG "SOURCE PROGRAM: $"
LDX #PP
LDA #HI.MEM
JSR MEM.LINE
LDY #QSYMTBL " SYMBOL TABLE: $"
LDX #LO.MEM
LDA #EOT
MEM.LINE
PHA SAVE SECOND VALUE PNTR
TXA
PHA SAVE FIRST VALUE PNTR
JSR QT.OUT
PLA GET FIRST VALUE PNTR
JSR MEM.HEXVAL
JSR P.DASH
PLA GET SECOND VALUE PNTR
MEM.HEXVAL
TAX
LDA 1,X
JSR MON.PHEX
LDA 0,X
JMP MON.PHEX
*--------------------------------
RST JSR EXPR
LDY EXP.VALUE
LDA EXP.VALUE+1
*--------------------------------
SET.RESET.VECTOR
STY MON.RESET
STA MON.RESET+1
EOR #$A5
STA MON.RESET+2
RTS
*--------------------------------------
MAN
SAVE usr/src/scmasm.31/scmasm.s.mcmds
LOAD usr/src/scmasm.31/scmasm.s
ASM