mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-08 14:07:34 +00:00
115 lines
3.0 KiB
Plaintext
115 lines
3.0 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
* SET UP NEXT LINE TO ASSEMBLE
|
||
*--------------------------------
|
||
SETUP.NEXT.LINE
|
||
.1 BIT INFLAG
|
||
BVS .5 ...INSIDE .INBx
|
||
LDA SRCP CHECK IF AT END
|
||
CMP HI.MEM TOP OF SOURCE CODE
|
||
LDA SRCP+1
|
||
SBC HI.MEM+1
|
||
BCS .7 RETURN WITH CARRY SET
|
||
.5 LDA MACRO.LEVEL IN SKELETON OR BODY?
|
||
BEQ .2 BODY
|
||
LDY #0 SEE IF END OF SKELETON
|
||
>SYM LDA,SRCP
|
||
BNE .3 NO, STILL IN SKELETON
|
||
LDA (MACSTK),Y POP SKELETON OFF MACRO STACK
|
||
STA CALL.NUM+1
|
||
INY
|
||
LDA (MACSTK),Y
|
||
STA CALL.NUM
|
||
INY
|
||
LDA (MACSTK),Y
|
||
STA LF.ALL Real value of listing option
|
||
INY
|
||
LDA (MACSTK),Y
|
||
STA SRCP+1
|
||
INY
|
||
LDA (MACSTK),Y
|
||
STA SRCP
|
||
INY
|
||
LDA (MACSTK),Y (HIGH BYTE)
|
||
PHA
|
||
INY
|
||
LDA (MACSTK),Y (LOW BYTE)
|
||
STA MACSTK
|
||
PLA
|
||
STA MACSTK+1
|
||
DEC MACRO.LEVEL
|
||
JMP .1
|
||
*--------------------------------
|
||
.2 JSR GET.LINE.NUMBER BODY
|
||
.3 LDX #0
|
||
.4 JSR GET.NEXT.SOURCE.CHAR
|
||
BEQ .6 END OF LINE
|
||
STA WBUF,X PUT INTO WORKING BUFFER
|
||
INX
|
||
BNE .4 ...ALWAYS
|
||
.6 STA WBUF,X PUT ZERO ON END
|
||
CLC RETURN WITH CARRY CLEAR
|
||
.7 RTS
|
||
*--------------------------------
|
||
* GET NEXT CHARACTER FROM SOURCE LINE
|
||
* (IF INSIDE A MACRO SKELETON, EXPAND PARAMETERS)
|
||
*--------------------------------
|
||
GET.NEXT.SOURCE.CHAR
|
||
STX MACRO.SAVEX MUST PRESERVE X-REGISTER
|
||
LDY PARAM.PNTR
|
||
BNE .1 PRESENTLY EXPANDING A PARAMETER
|
||
LDA MACRO.LEVEL IN A SKELETON?
|
||
BNE .2 YES
|
||
JMP NTKN NO
|
||
*--------------------------------
|
||
.1 INC PARAM.PNTR
|
||
LDA (MACSTK),Y
|
||
BNE .8 ...NORMAL CHAR
|
||
STA PARAM.PNTR ...END OF PARAMETER
|
||
.2 JSR NTKN
|
||
BEQ .8 END OF LINE
|
||
CMP #$7F PARAMETER?
|
||
BNE .8 NO, NORMAL CHAR
|
||
*---MACRO PARAMETER--------------
|
||
JSR NTKN YES, GET PARAM #
|
||
LDY #6
|
||
CMP #'# ]# RETURNS NUMBER OF PARAMETERS (0-9)
|
||
BEQ .5 ...FOUND ]#
|
||
SEC
|
||
SBC #'1' CHANGE "1"..."9" TO 0...8
|
||
BEQ .4 ...]1
|
||
TAX ...]2 THRU ]9
|
||
.3 INY
|
||
LDA (MACSTK),Y SKIP OVER A PARAMETER
|
||
BNE .3
|
||
DEX
|
||
BNE .3
|
||
.4 INY
|
||
STY PARAM.PNTR
|
||
BNE .1 ...ALWAYS
|
||
*---NUMBER OF PARAMETERS---------
|
||
.5 CLC
|
||
LDA (MACSTK),Y
|
||
SBC MACSTK
|
||
TAY
|
||
LDX #10
|
||
.6 LDA (MACSTK),Y
|
||
BNE .7
|
||
DEX
|
||
DEY
|
||
CPY #7
|
||
BCS .6
|
||
LDX #0
|
||
.7 TXA
|
||
ORA #$30
|
||
*--------------------------------
|
||
.8 LDX MACRO.SAVEX RESTORE X-REG
|
||
CMP #0 SET "EQ" STATUS IF END OF LINE
|
||
RTS
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/scmasm.30/scmasm.s.asmnl
|
||
LOAD usr/src/scmasm.30/scmasm.s
|
||
ASM
|