A2osX/SCMASM.30/SCMASM.S.OUTPUT.txt

251 lines
6.7 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
* ERROR PRINTER
*---------------------------------
FIRM.ERROR
SEC SIGNAL FIRM ERROR
.HS 24 SKIP NEXT BYTE
SOFT.ERROR
CLC SIGNAL SOFT ERROR
LDA PASS SEE IF IN ASSEMBLY
BMI HARD.ERROR ...NO
PHP SAVE CLC/SEC STATUS
LDA RDROM
JSR PRINT.ERROR.MESSAGE
>INCD ERROR.COUNT
JSR SPC
JSR LIST.SOURCE.AT.MARGIN
JSR CRLF
PLP GET SOFT/FIRM STATUS
BCS JMP.SOFT ...FIRM, ABORT ASSEMBLY
JMP ASM2 ...SOFT, CONTINUE ASSEMBLY
HARD.ERROR
JSR PRINT.ERROR.MESSAGE
JMP.SOFT
JSR RESTORE.IF.IN.INBX
JMP SOFT
*--------------------------------
RESTORE.IF.IN.INBX
BIT INFLAG
BVC .1
JSR RESTORE
.1 RTS
*--------------------------------
P.EXP.VALUE.DASH
JSR CHECK.IF.LISTING
JSR P.EXP.VALUE
P.DASH LDA #'-'
.HS 2C
P.RETURN
LDA #$0D
.HS 2C
SPC LDA #' ' ONE SPACE
CHO PHA
ORA #$80 CHAR OUT
JSR MY.COUT SEND THE CHARACTER
PLA
RTS
*---------------------------------
* PRINT A <RETURN>
* IF IN "SLOW" MODE, DELAY FIRST
* CHECK KEYBOARD FOR PAUSE OR ABORT
*--------------------------------
CRLF BIT FLAG.SPEED CHECK SLOW/FAST SPEED
BPL .1 FAST
LDA #0 SLOW
JSR MON.DELAY
.1 JSR CHECK.KEYBOARD.FOR.ABORT
BCC P.RETURN ...NO KEYPRESS
BEQ JMP.SOFT ...ABORT
.2 JSR CHECK.KEYBOARD.FOR.ABORT
BCC .2 WAIT FOR KEYPRESS
BNE P.RETURN ...CONTINUE
BEQ JMP.SOFT ...ABORT
*--------------------------------
* RETURN .CC. AND .NE. IF NO KEYPRESS
* RETURN .CS. AND .EQ. IF <RETURN> TYPED
* RETURN .CS. AND .NE. IF ANY OTHER KEY
*--------------------------------
CHECK.KEYBOARD.FOR.ABORT
CLC
LDA $C000
BPL .1
STA $C010
CMP #$8D
SEC
.1 RTS
*--------------------------------
* PRINT ERROR MESSAGE
*--------------------------------
PRINT.ERROR.MESSAGE
TYA SAVE ERROR #
TAX IN X-REG
LDY #QSTARS "*** "
JSR QT.OUT
TXA
TAY
JSR QT.OUT
LDY #QERROR
JMP QT.OUT
*--------------------------------
* PRINT LOCATION COUNTER AND DASH
*--------------------------------
P.ORIGIN
JSR CHECK.IF.LISTING
P.ORIGIN.REGARDLESS
LDX #7 assume col. 7 after 6-digit origin
LDY #2
LDA ORGN+2 If > $FFFF, print 3 bytes
BNE .1 ...orgn > $FFFF, print 3 bytes
DEY ...orgn <$10000, print 2 bytes
LDX #5 will end up in col. 5
.1 STX EMIT.COLUMN
.2 LDA ORGN,Y HIGH BYTE FIRST
JSR MON.PHEX
DEY
BPL .2
JMP P.DASH PRINT "-"
*--------------------------------
P.EMITTED.BYTE
JSR CHECK.IF.LISTING
LDY EMIT.COLUMN
BEQ .2 ...AT BEGINNING OF LINE
LDY EMIT.MARGIN
LDA ORGN+2
BNE .1
DEY
DEY
.1 CPY EMIT.COLUMN
BCS .3 ...STILL ROOM ON THIS LINE
BIT LF.XTRA.BYTES
BMI .4
JSR CRLF.WITH.PAGING
.2 JSR P.ORIGIN
.3 LDY EMIT.COLUMN
INY MAKE ROOM FOR NEXT BYTE
INY
INY
STY EMIT.COLUMN
JSR SPC
LDA OBJ.BYTE
JMP MON.PHEX
.4 RTS
*--------------------------------
P.MARGIN
SEC
LDA EMIT.MARGIN
SBC EMIT.COLUMN
TAX
LDA ORGN+2
BEQ .1
INX
INX
.1 JMP MON.PRBL2
*--------------------------------
P.EXP.VALUE
LDY #3 EXP.VALUE IS 4 BYTES
.1 LDA EXP.VALUE,Y TRIM LEADING ZERO BYTES
BNE .2 ...FIRST NON-ZERO BYTE
DEY
BNE .1 ...STILL NOT LAST BYTE
.2 TYA
ASL
ADC #3
STA EMIT.COLUMN
.3 LDA EXP.VALUE,Y PRINT REST OF EXP.VALUE
JSR MON.PHEX
DEY
BPL .3
RTS
*--------------------------------
CHECK.IF.LISTING
LDA PASS
BEQ .1 ...NO LISTING IN PASS 1
LDA LF.ALL
BPL .2 ...YES, LIST
.1 PLA POP RETURN
PLA
.2 RTS
*--------------------------------
LIST.LINE.BOTH.PASSES
LDA PASS
BEQ .1 DEFINITE IN PASS 1
LDA LF.ALL
BPL .2 ...ALREADY DID CRLF
.1 JSR CRLF.WITH.PAGING
.2 JSR P.ORIGIN.REGARDLESS
JMP LIST.SOURCE.REGARDLESS
*---------------------------------
* CONVERT LINE NUMBER
* (CURRENT.LINE.NUMBER) = NUMBER TO USE
*---------------------------------
CONVERT.LINE.NUMBER.BOTH
LDA #$C0 PRINT FLAG ON, STORE FLAG ON
.HS 2C SKIP NEXT 2 BYTES
CONVERT.LINE.NUMBER.STORE
LDA #$80 PRINT FLAG OFF, STORE FLAG ON
.HS 2C SKIP NEXT 2 BYTES
CONVERT.LINE.NUMBER.PRINT
LDA #$40 PRINT FLAG ON, STORE FLAG OFF
PHA
LDX #3 CONVERT 4 DIGITS
LDA CURRENT.LINE.NUMBER
CMP #10000
LDA CURRENT.LINE.NUMBER+1
SBC /10000
BCC .1 4 DIGITS WILL DO IT
INX 5 DIGITS
.1 PLA
*--------------------------------
* CONVERT (CURRENT.LINE.NUMBER)
* (X) = ONE LESS THAN NUMBER OF DIGITS
* (A) = FLAGS: BIT 7 = 1 MEANS TO STORE AT WBUF,Y
* BIT 6 = 1 MEANS TO PRINT
*--------------------------------
CONVERT.LINE.NUMBER
STA CONV.CTRL
.5 LDA #$B0 SET DIGIT TO ASCII ZERO
.1 PHA PUSH DIGIT ON STACK
SEC SUBTRACT CURRENT DIVISOR
LDA CURRENT.LINE.NUMBER
SBC PLNTBL,X
PHA SAVE BYTE ON STACK
LDA CURRENT.LINE.NUMBER+1
SBC PLNTBH,X
BCC .2 LESS THAN DIVISOR
STA CURRENT.LINE.NUMBER+1
PLA GET LOW BYTE OFF STACK
STA CURRENT.LINE.NUMBER
PLA GET DIGIT FROM STACK
ADC #0 INCREMENT DIGIT
BNE .1 ...ALWAYS
.2 PLA DISCARD BYTE FROM STACK
PLA GET DIGIT FROM STACK
BIT CONV.CTRL
BVC .3 NO PRINT
JSR MON.COUT PRINT CHARACTER
.3 BIT CONV.CTRL TEST BUFFER STORAGE FLAG
BPL .4 OFF, DO NOT STORE IN BUFFER
STA WBUF,Y
INY
.4 DEX NEXT DIGIT
BPL .5
RTS RETURN
*---------------------------------
PLNTBL .DA #1
.DA #10
.DA #100
.DA #1000
.DA #10000
PLNTBH .DA /1
.DA /10
.DA /100
.DA /1000
.DA /10000
*--------------------------------------
MAN
SAVE usr/src/scmasm.30/scmasm.s.output
LOAD usr/src/scmasm.30/scmasm.s
ASM