A2osX/SCMASM.30/SCMASM.S.PLINE.txt

103 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

NEW
AUTO 3,1
*--------------------------------------
* PARSE LINE RANGE
* START END CARRY
* <EOL> (PP) (HI.MEM) SET
* #<EOL> # # CLEAR
* #1,#2<EOL> #1 #2 CLEAR
* #, # (HI.MEM) CLEAR
* ,# (PP) # CLEAR
*---------------------------------
PARSE.LINE.RANGE
JSR SETUP.TEXT.POINTERS
JSR GNNB.AUC GET NEXT NON-BLANK CHAR
BCS .4 EOL, RETURN WITH CARRY SET
BEQ .1 COMMA, SO START AT PP
JSR SCAN.LINE.NUMBER
BCS .5
LDA LINE.START
STA SRCP
LDA LINE.START+1
STA SRCP+1
JSR GNNB.AUC GET NEXT NON-BLANK AFTER LINE NUMBER
BCS .2 EOL, SO ONLY THIS ONE LINE
BNE .5 NOT COMMA, SO ERROR
.1 JSR GNNB.AUC GET NEXT NON-BLANK AFTER COMMA
BCS .3 EOL, SO GO THRU HI.MEM
BEQ .3 COMMA, SAME AS EOL
JSR SCAN.LINE.NUMBER
BCS .5
.2 LDA LINE.END
STA ENDP
LDA LINE.END+1
STA ENDP+1
.3 CLC FLAG WE GOT AT LEAST ONE NUMBER
.4 RTS
.5 JMP SYNX
*---------------------------------
* SCAN INPUT LINE FOR DIGIT OR PERIOD
* IF FIND DIGIT, CONVERT LINE NUMBER
* AND SEARCH FOR IT
* IF FIND PERIOD, SEARCH FOR <CURLNO>
* IF NEITHER, RETURN WITH CARRY SET
*---------------------------------
SCAN.LINE.NUMBER
CMP #'. DOT: USE (CURLNO)
BEQ .1
EOR #$30
CMP #10
BCS .2 NOT DOT NOR DIGIT, EXIT CARRY SET
JSR DECN CONVERT THE NUMBER
JSR BACKUP.CHAR.PNTR
LDX #SYM.VALUE
.HS 2C SKIP OVER NEXT 2 BYTES
.1 LDX #CURLNO
JSR SERTXT FIND LINE
CLC SIGNAL GOOD NUMBER
.2 RTS
*--------------------------------
* LOAD PP --> SRCP, HI.MEM --> ENDP
*--------------------------------
SETUP.TEXT.POINTERS
LDA PP ASSUME PP THRU HI.MEM
STA SRCP
LDA PP+1
STA SRCP+1
LDA HI.MEM
STA ENDP
LDA HI.MEM+1
STA ENDP+1
RTS
*--------------------------------
CMP.SRCP.ENDP
LDA SRCP
CMP ENDP
LDA SRCP+1
SBC ENDP+1
RTS
*--------------------------------
* GET NEXT NON-BLANK CHARACTER
* AND CHECK FOR A, U, OR COMMA
* SET CARRY IF A, U, OR EOL
* SET EQ IF A, U, EOL, OR COMMA
*--------------------------------
GNNB.AUC
JSR GNNB NEXT NON-BLANK, CONV LOWER TO UPPER
BCS .1 EOL
CMP #'A
BEQ .1
CMP #'U
BEQ .1
CMP #',
CLC
RTS
.1 JSR BACKUP.CHAR.PNTR
SEC
RTS
*--------------------------------------
MAN
SAVE usr/src/scmasm.30/scmasm.s.pline
LOAD usr/src/scmasm.30/scmasm.s
ASM