-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathnewii4
116 lines (116 loc) · 2.25 KB
/
newii4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.PAGE 'NEWII4 11/03/80'
; NEW LOCATOR FOR MACHINE CODE
; SYNTAX
; N 1111 2222 3333 4444 5555 W
; 1111=START ADR
; 2222=END ADR
; 3333=OFFSET
; 4444=LOWER LIMIT
; 5555=UPPER LIMIT
; W=ADJUSTING A .WORD TABLE
;
NEWLOC JSR PARM3 ;TMP0=OFF,TMP2=SA,TMP10=EA
STA NEWLC ;SAVE OFFSET LO
STX NEWLC+1 ;SAVE OFFSET HI
JSR SRDAE ;GET LOWER LIMIT
STA MSAL ;SAVE IN MSAL
STX MSAL+1
JSR SRDAE ;GET UPPER LIMIT
STA EAL ;SAVE IN EAL
STX EAL+1
JSR RDT
CMP #$0D ;MORE COMMING
BEQ NEW050 ;NO
JSR RDT ;READ MORE
CMP #'W ;A .WORD TABLE ?
BNE NEW050 ;NO
INC PTCH ;YES SET .WORD TABLE FLAG
NEW050 JSR T2T2 ;TMP0=SA,TMP2=XX,TMP10=EA
NEW100 LDX WRAP ;WRAP $FFFF
BNE NEWSTR ;YES - GOTO START
JSR DCT10 ;SA>EA ?
BCC NEWSTR ;YES
NEW200 LDY PTCH ;DOING .WORD TABLE ?
BNE NEW500 ;YES
JSR R0BYY ;NO - GET OP CODE
JSR DSET ;DIGEST OP CODE
TAX
LDA MNEML,X ;A BAD OP CODE ?
BNE NEW300 ;NO
NEWERR JSR DISSPC ;YES - SHOW IT
NEWSTR JMP STRT
NEW300 LDY LENGTH
CPY #2 ;3 BYTE INSTRUCTION ?
BNE NEW900 ;NO
BEQ NEW600 ;ALWAYS
NEW500 STY LENGTH ;FIX FOR .WORD
NEW600 DEY ;INDEX TO LO BYTE
SEC ;DOUBLE BYTE CMP
JSR R0BYY
TAX ;SAVE IN X
SBC MSAL ;TEST LOWER LIMIT
INY ;HI BYTE
JSR R0BYY
SBC MSAL+1
BCC NEW900 ;TO LOW SKIP
DEY ;TEST UPER LIMIT
JSR R0BYY
STA TEMPX
LDA EAL
SBC TEMPX
INY
JSR R0BYY
STA TEMPX
LDA EAL+1
SBC TEMPX
BCC NEW900 ;TO HI SKIP
DEY ;LO BYTE AGAIN
CLC
TXA ;IN RANGE ADJUST
ADC NEWLC ;ADJUST LO
JSR PUTBYY ;SAVE LO
INY ;POINT TO HI BYTE
JSR R0BYY ;GET HI BYTE
ADC NEWLC+1 ;ADJUST HI BYTE
JSR PUTBYY ;SAVE ABS HI
NEW900 JSR INCTMP ;BUMP TMP0
DEY ;MOVED TO NEXT INSTR ?
BPL NEW900 ;NO
BMI NEW100 ;YES - ADJUST ON
.SKIP 3
; GET START ADR END ADR AND NEW ADR
; TMP0=NA,TMP2=SA,TMP10=EA
;
PARM3 JSR SKADR ;SKIP SPACES GET SA A AND X
STA TMP2
STX TMP2+1
JSR SRDAE
STA TMP10
STX TMP10+1
.SKIP 3
; SKIP ONE CHAR READ ADR INTO TMP0
;
SDTMP0 JSR RDOC ;SKIP A CHAR
RDTMP0 JSR RDOA ;READ ADR
RDT100 STA TMP0
STX TMP0+1
RTS
.SKIP 3
; SKIP SPACES READ ADR INTO TMP0
SKTMP0 JSR SKADR
BCS RDT100 ;ALWAYS
.SKIP 3
; READ ADR INTO TMP2
;
RDTMP2 JSR RDOA
BCS SKT111 ;ALWAYS
.SKIP 3
; SKIP SPACE READ ADR INTO TMP2
SKTMP2 JSR SRDAE ;SKIP SPACE READ ADR
SKT111 STA TMP2
STX TMP2+1
RTS
JSR T0T10 ;TMP0=XX,TMP2=SA,TMP10=EA
JMP SRDAE ;GET TMP0=NA,TMP2=SA,TMP10=EA
.SKIP 5
.END