forked from CorshamTech/6502-Tiny-BASIC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IL.inc
234 lines (234 loc) · 2.78 KB
/
IL.inc
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
nolist
;=====================================================
; IL.inc
; These are macros for IL instructions
;
XINIT macro
db 0
endm
;
DONE macro
db 1
endm
;
PRS macro
db 2
endm
;
PRN macro
db 3
endm
;
SPC macro
db 4
endm
;
NLINE macro
db 5
endm
;
; My NXT is a bit different in that it takes one
; parameter, which is an address. If the BASIC
; program is currently running then move to the
; next line and continue execution. However, if
; in direct mode, jump to the specified IL label.
;
NXT macro addr
db 6
dw addr
endm
;
XFER macro
db 7
endm
;
SAV macro
db 8
endm
;
RSTR macro
db 9
endm
;
CMPR macro
db 10
endm
;
INNUM macro
db 11
endm
;
FIN macro
db 12
endm
;
; ERR is followed by an error number. The error
; code is printed along with the line number.
; Control is passed to the statement set with
; the ERRGOTO statement.
;
ERR macro ecode
db 13
dw ecode
endm
;
ADD macro
db 14
endm
;
SUB macro
db 15
endm
;
NEG macro
db 16
endm
;
MUL macro
db 17
endm
;
DIV macro
db 18
endm
;
STORE macro
db 19
endm
;
IND macro
db 20
endm
;
LST macro
db 21
endm
;
INIT macro
db 22
endm
;
GETLINE macro
db 23
endm
;
INSERT macro
db 24
endm
;
RTN macro
db 25
endm
;
EXIT macro
db 26
endm
;
LIT macro value
db 27
dw value
endm
;
CALL macro addr
db 28
dw addr
endm
;
; IJMP will set the IL PC to the specified value.
;
IJMP macro addr
db 29
dw addr
endm
;
VINIT macro
db 30
endm
;
; ERRGOTO sets the point in the code where the IL
; interpreter will go after any error.
;
ERRGOTO macro addr
db 31
dw addr
endm
;
TST macro addr,string
db 32
db (addr-*)-1
db string,0
endm
;
TSTV macro addr
db 33
db (addr-*)-1
endm
;
TSTL macro addr
db 34
db (addr-*)-1
endm
;
TSTN macro addr
db 35
db (addr-*)-1
endm
;
; FREE returns the amount of free RAM on top of
; the stack. This is the amount of room the user
; program has available.
;
FREE macro
db 36
endm
;
; RANDOM takes the top item off the stack and
; replaces it with a random number that is
; MOD the initial value. Ie, if the TOS is
; 42 then RANDOM returns a value from 0 to 41.
;
RANDOM macro
db 37
endm
;
; ABS will replace the top of stack with the
; absolute value.
;
ABS macro
db 38
endm
;
; OPENREAD opens a file for reading, as in getting
; statements from it.
;
OPENREAD macro
db 39
endm
;
; OPENWRITE opens a file for writing, as in saving
; the current program to it.
;
OPENWRITE macro
db 40
endm
;
; DCLOSE closes any open disk file.
;
DCLOSE macro
db 41
endm
;
; DGETLINE gets one line from the disk file and puts it
; into LINBUFF.
;
DGETLINE macro
db 42
endm
;
; DLIST saves the program to an open disk file.
;
DLIST macro
db 43
endm
;
list