-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHLL69F.MAC
245 lines (223 loc) · 4.5 KB
/
HLL69F.MAC
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
; .SBTTL 6809 HIGH LEVEL LANGUAGE WITH FORMATTING
.NOCROSS DEFIF,IFXX,THEN,ELSE,BEGIN,LOC,FND,DEFEND,..END
.NOCROSS IF,ENDC,.,END,CONTINUE,ENDIF,..SRC$,..NST$
.NOCROSS $INDEN,$UNDEN
.IIF NDF,..STK$,..STK$ = 44.
.IIF NDF,..SRC$,..SRC$ = 41.
.DEFSTACK PC,..STK$
.DEFSTACK REGSAV,4.
; .SBTTL HLL69F
.MACRO HLL69F
.GETPOINTER PC,...1
.IIF NE,..STK$-...1,.ERROR ..STK$-...1 ; STACK INBALANCE
.ENDM
.IF DF,HLL69F
HLL69F ;CHECK AT START OF PASS 2, (HOPEFULLY)BEFORE MAC DIES.
.ENDC
HLL69F=1
..NST$ =0
; .SBTTL INDENT
.MACRO $INDEN
.PUSH REGSAV,...S1
.IF LT,..NST$
.ERROR ..NST$ ; STACK UNDERFLOW
..NST$ = 0
.ENDC
...S1 = ..NST$+1*3+..SRC$
.IIF GT,...S1-<9.*3+..SRC$>,...S1 = 9.*3+..SRC$
.LIST SRC(...S1,1)
.PRINT ..NST$(37,1,16,1,38'->')
..NST$ = ..NST$ + 1
.POP REGSAV,...S1
.ENDM
; .SBTTL UNDENT
.MACRO $UNDEN
.PUSH REGSAV,...S1
..NST$ = ..NST$ - 1
.IF LT,..NST$
.ERROR ..NST$ ; STACK UNDERFLOW
..NST$ = 0
.ENDC
...S1 = ..NST$*3+..SRC$
.IIF GT,...S1-<9.*3+..SRC$>,...S1 = 9.*3+..SRC$
.LIST SRC(...S1)
.PRINT ..NST$(37,1,16,1,38'<-')
.POP REGSAV,...S1
.ENDM
; .SBTTL IF
.MACRO DEFIF .1.,.2.
.NOCROSS .1.
.MACRO .1.
LOC
.2. .
.ENDM
.ENDM
.MACRO IF COND, .A, .B, .C, .D
.IF IDN,<.A>,<.OR.>
B'COND .
.IIF NB,<.B>,IF'.B
.IFF
IF'COND
.ENDC
.ENDM
; .SBTTL ENDIF
.MACRO ENDIF
FND
$UNDEN
.ENDM
.MACRO END ON COND
.IF NB,<COND>
COND'END
.IFF
.IF NB,<ON>
ON'END
.IFF
ENDC
.ENDC
.ENDC
.ENDM
; .SBTTL CONTINUE
.MACRO CONTINUE ON COND
.IF NB,<COND>
COND'CONT
.IFF
.IF NB,<ON>
ON'CONT
.IFF
.IF NE,..NST$
.PUSH REGSAV,...P1,...S1
.POP PC,...S1,...P1
.POP REGSAV,...S1,...P1
.ENDC
$UNDEN
.ENDC
.ENDC
.ENDM
; .SBTTL ELSE
.MACRO ELSE COND
.PUSH REGSAV,...P0,...S0,...P1,...S1
...P0 = .
.POP PC,...S1,...P1
...S0 = 0
.IF NB,<COND>
B'COND .
.IFF
BRA .
.ENDC
.PUSH PC,...P0,...S0,...P1,...S1
.POP REGSAV,...S1,...P1,...S0,...P0
.PRINT ..NST$-1(37,1,16,1,38'<>')
.PUSH REGSAV,...S1
...S1 = ..NST$-1*3+..SRC$
.IIF GT,...S1-<9.*3+..SRC$>,...S1 = 9.*3+..SRC$
.LIST SRC(...S1,/)
.POP REGSAV,...S1
FND
.PUSH REGSAV,...S1
...S1 = ..NST$*3+..SRC$
.IIF GT,...S1-<9.*3+..SRC$>,...S1 = 9.*3 + ..SRC$
.LIST SRC(...S1)
.POP REGSAV,...S1
.ENDM
; .SBTTL BEGIN
.MACRO BEGIN
LOC
.ENDM
.MACRO LOC
$INDEN
.PUSH REGSAV,...P0,...S0,...P1,...S1
...P0 = .
...S0 = 0
.PUSH PC,...P0,...S0
.POP REGSAV,...S1,...P1,...S0,...P0
.ENDM
.MACRO FND
.PUSH REGSAV,...P0,...S0,...P1,...S1
...P0 = .
.POP PC,...S1,...P1
. = ...P1+1
.IF EQ,...S1
...S0 = ...P0-...P1-2
.IIF GT,...S0-127.,.ERROR ...S0 ; BRANCH OUT OF RANGE
.IIF LT,...S0+128.,.ERROR ...S0 ; BRANCH OUT OF RANGE
.BYTE ...S0
.IFF
.WORD ...P0
.ENDC
. = ...P0
.POP REGSAV,...S1,...P1,...S0,...P0
.ENDM
; .SBTTL END
.MACRO DEFEND .1.,.2.,.3.
.NOCROSS .1.
.MACRO .1.
..END .2.,.3.
.ENDM
.ENDM
.MACRO ..END .1.,.2.
.PUSH REGSAV,...P0,...S0,...P1,...S1
.POP PC,...S0,...P0
.IF GE,.-...P0-127.
L'.1. ...P0
.IFF
.1. ...P0
.ENDC
.POP REGSAV,...S1,...P1,...S0,...P0
$UNDEN
.ENDM
DEFIF IFCC,BCS
DEFIF IFCS,BCC
DEFIF IFEQ,BNE
DEFIF IFNE,BEQ
DEFIF IFMI,BPL
DEFIF IFPL,BMI
DEFIF IFVC,BVS
DEFIF IFVS,BVC
DEFIF IFGE,BLT
DEFIF IFGT,BLE
DEFIF IFHI,BLS
DEFIF IFHS,BLO
DEFIF IFLE,BGT
DEFIF IFLO,BHS
DEFIF IFLS,BHI
DEFIF IFLT,BGE
DEFIF IFZ, BNE
DEFIF IFNZ,BEQ
DEFEND GEEND,BLT,BGE
DEFEND GTEND,BLE,BGT
DEFEND HIEND,BLS,BHI
DEFEND HSEND,BLO,BHS
DEFEND LEEND,BGT,BLE
DEFEND LOEND,BHS,BLO
DEFEND LSEND,BHI,BLS
DEFEND LTEND,BGE,BLT
DEFEND CCEND,BCS,BCC
DEFEND CSEND,BCC,BCS
DEFEND EQEND,BNE,BEQ
DEFEND NEEND,BEQ,BNE
DEFEND MIEND,BPL,BMI
DEFEND PLEND,BMI,BPL
DEFEND VCEND,BVS,BVC
DEFEND VSEND,BVC,BVS
DEFEND NZEND,BEQ,BNE
DEFEND ZEND, BNE,BEQ
DEFEND CCCONT,BCC,BCS
DEFEND CSCONT,BCS,BCC
DEFEND EQCONT,BEQ,BNE
DEFEND NECONT,BNE,BEQ
DEFEND MICONT,BMI,BPL
DEFEND PLCONT,BPL,BMI
DEFEND VCCONT,BVC,BVS
DEFEND VSCONT,BVS,BVC
DEFEND GECONT,BGE,BLT
DEFEND GTCONT,BGT,BLE
DEFEND HICONT,BHI,BLS
DEFEND HSCONT,BHS,BLO
DEFEND LECONT,BLE,BGT
DEFEND LOCONT,BLO,BHS
DEFEND LSCONT,BLS,BHI
DEFEND LTCONT,BLT,BGE
DEFEND NZCONT,BNE,BEQ
DEFEND ZCONT, BEQ,BNE
DEFEND LOOP, BRA