-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathbdefine
347 lines (347 loc) · 11 KB
/
bdefine
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
.PAG 'BDEFINE'
; PAGE ZERO STORAGE DEFINITIONS
*=0
;
E6509 *=*+1 ;EXECUTION BANK
I6509 *=*+1 ;INDIRECTION BANK
;
USRPOK *=*+3 ;SET UP ORGIN BY INIT
TMHOUR *=*+1 ;FOR TI$ CALCULATIONS
TMMIN *=*+1
TMSEC *=*+1
TMTEN *=*+1
;
FORM *=*+PTRSIZ ;FORMAT POINTER
;
INTEGR ;ONE-BYTE INTEGER FROM QINT
CHARAC *=*+1 ;A DELIMITING CHAR
ENDCHR *=*+1 ;OTHER DELIMITING CHAR
COUNT *=*+1 ;GENERAL COUNTER
XCNT *=*+1 ;DOS LOOP COUNTER
.SKI 4
; FLAGS
; DIMFLG, VALTYP AND INTFLG MUST BE
; CONSECUTIVE LOCATIONS.
DIMFLG *=*+1 ;IN GETTING A POINTER TO A VARIABLE
; IT IS IMPORTANT TO REMEMBER WHETHER
; IT IS BEING DONE FOR DIM OR NOT.
VALTYP *=*+1 ;THE TYPE INDICATOR 0=NUMERIC, 1=STRING
INTFLG *=*+1 ;TELLS IF INTEGER
;
GARBFL ;WHETHER TO DO GARBAGE COLLECTION
DORES *=*+1 ;WHETHER CAN OR CAN'T CRUNCH RES'D WORD.
; TURNED ON WHEN DATA BEING SCANNED BY
; CRUNCH SO UNQUOTED STRS WON'T BE CRUNCHED.
;
SUBFLG *=*+1 ;FLAG WHETHER SUB'D VARIABLE ALLOWED.
; FOR AND USER-DEFINED FUNCTION POINTER
; FETCHING TURN THIS ON BEFORE CALLING
; PTRGET SO ARRAYS WON'T BE DETECTED.
; STKINI AND PTRGET CLEAR IT.
; ALSO DISALLOWS INTEGERS THERE.
;
INPFLG *=*+1 ;FLAGS WHETHER WE ARE DOING INPUT OR READ.
;
DSDESC *=*+STRSIZ ;DISK STATUS STRING
CHANNL *=*+1 ;HOLDS CHANNEL NUMBER
POKER
LINNUM *=*+2 ;LOCATION TO STORE LINE #
.SKI 4
; POINTERS TO TEMPORARY STRING DESCRIPTORS.
; TEMP DESCRIPTORS ARE LOCATED IN THE STRING BANK
; HENCE, BANK OF STRBNK IS ASSUMED FOR TEMPPT,LASTPT
TEMPPT *=*+1 ;TEMPPST RELATIVE OFFSET TO 1ST FREE TEMP DESCR
LASTPT *=*+2 ;POINTER TO LAST-USED STR TEMPORARY
TEMPST *=*+2 ;POINTER TO STORAGE FOR 3 TEMPORARY DESCRIPTORS.
;
INDEX
INDEX1 *=*+PTRSIZ ;DIRECT CELLS FOR 1ST INDEXING USAGE
INDEX2 *=*+PTRSIZ ;DIRECT CELLS FOR 2ND INDEXING USAGE
;
;
RESHO *=*+1 ;RESULT OF MULTIPLIER AND DIVIDER
RESMOH *=*+1
ADDEND ;TEMP USED BY UMULT
RESMO *=*+1
RESLO *=*+1
*=*+1 ;OVERFLOW PREVIOUS CELLS
.SKI 4
; POINTERS INTO DYNAMIC DATA STRUCTURES
; ALL ARE 2-BYTE OFFSETS INTO FIXED BANKS
; THE FOLLOWING ALWAYS MARK THE BEGINNING OF AN AREA:
; TXTTAB, VARTAB
; ARYTAB, MEMTOP
; THESE WILL HAVE UNCHANGEABLE VALUES IN VERSIONS
; WHERE THE AREAS THEY MARK ARE EQUAL TO THE "BOTTOM"
; (OR "TOP" FOR MEMTOP) OF A BANK.
; ADDITIONAL VARIABLES:
; TXTEND, VAREND, ARYEND
; ARE USED TO MARK THE END OF AN AREA, WHEN THE START
; OF THE "NEXT" AREA IS IN A DIFFERENT BANK (I.E.,
; THE END ISN'T BORDERED BY ANOTHER AREA.)
;
; HIGHST IS USED TO STORE THE OFFSET VALUE FROM A BASIC
; STARTUP CALL TO GET THE TOP OF MEMORY.
;
; THE LIMIT OF GROWTH IN AN AREA MUST ALSO BE KEPT.
; IN THE DIFFERENT VERSIONS, THE FOLLOWING ARE USED:
;
; 64K: MEMTOP (ALL)
; 128K: BUFFPT (TEXT)
; MEMTOP (DATA)
; 192K: BUFFPT (TEXT)
; HIGHST (ARRAYS)
; MEMTOP (VARS,STRS)
; 256K: BUFFPT (TEXT)
; HIGHST (VARS)
; HIGHST (ARRAYS)
; MEMTOP (STRS)
;
TXTTAB *=*+2 ;POINTER TO BEGINNING OF TEXT AND
; DOESN'T CHANGE AFTER BEING SETUP
; BY INIT
;
TXTEND *=*+2 ;POINTER TO END OF TEXT (EXCEPT 64K)
;
VARTAB *=*+2 ;POINTER TO START OF SIMPLE VARIABLE SPACE.
;
VAREND *=*+2 ;POINTER TO END OF SIMPLE VARS (256K ONLY)
;
ARYTAB *=*+2 ;POINTER TO START OF ARRAY TABLE
;
ARYEND *=*+2 ;POINTER END OF ARRAYS (192K, 256K ONLY)
;
STREND *=*+2 ;END OF STORAGE IN USE.
;
FRETOP *=*+2 ;TOP OF STR FREE SPACE
FRESPC *=*+2 ;POINTER TO NEW STR
MEMTOP *=*+PTRSIZ ;HIGHEST LOCATION IN MEMORY
.SKI 4
; LINE NUMBERS AND TEXTUAL POINTERS
CURLIN *=*+2 ;CURRENT LINE NUMBER
OLDLIN *=*+2 ;OLD LINE NUMBER (SETUP BY STOP OR
; END IN A PROGRAM)
OLDTXT *=*+PTRSIZ ;OLD TEXT POINTER
;
DATLIN *=*+2 ;DATA LINE NUMBER
DATPTR *=*+2 ;POINTER TO DATA. INITIALIZED TO POINT
; AT THE ZERO INFRONT OF (TXTTAB) BY
; CLR COMMAND.
; UPDATED BY EXECUTION OF A READ.
INPPTR *=*+2 ;REMEMBERS WHERE INPUT IS COMING FROM.
.SKI 4
; STUFF USED IN EVALUATIONS
;
VARNAM *=*+2 ;VARIABLE'S NAME
;
FDECPT ;POINTER INTO POWER OF TENS TABLE.
VARPNT *=*+PTRSIZ ;POINTER TO VARIABLE IN MEMORY
;
FORPNT ;A VARIABLE'S POINTER FOR FOR LOOPS
; AND LET STATEMENTS (3 BYTES).
LSTPNT *=*+PTRSIZ ;POINTER TO LIST STRING (3 BYTES).
;
VARTXT ;SAVE CURRENT TXTPTR ON READ.
OPPTR *=*+PTRSIZ ;POINTER TO CURRENT OP'S ENTRY IN OPTAB.
;
OPMASK *=*+1 ;MASK CREATED BY CURRENT OPERATION.
.SKIP 2
; TEMPORARY FLOATING RESULT REGISTERS (5BYTES EACH):
; TEMPF1,TEMPF2,TEMPF3
;
TEMPF3 ;TEMP FLOAT REG
GRBPNT ;POINTER USED IN GARBAGE COLLECTION.
DEFPNT *=*+PTRSIZ ;POINTER USED IN FUNCTION DEFINITION.
;
DSCPNT *=*+PTRSIZ ;POINTER TO A STRING DESCRIPTOR.
;
JMPER *=*+2 ;THREE BYTES LONG
OLDOV *=*+1 ;THE OLD OVERFLOW.
;
TEMPF1 ;TEMP FLOAT REG
PTARG1=TEMPF1 ;MULTIPLY DEF'D FOR USE BY INSTR$
PTARG2=TEMPF1+3
STR1=TEMPF1+6
STR2=TEMPF1+10
TMPPOS=TEMPF1+14
POSITN=TEMPF1+15
MATCH=TEMPF1+16
ARYPNT ;POINTER USED IN ARRAY BUILDING.
HIGHDS *=*+PTRSIZ ;DESTINATION OF HIGHEST ELEMENT IN BLT.
HIGHTR *=*+PTRSIZ ;SOURCE OF HIGHEST ELEMENT TO MOVE.
;
TEMPF2 ;TEMP FLOAT REG (5BYTES)
LOWDS *=*+1 ;LOCATION OF LAST BYTE TRANSFERED (3 BYTES).
DECCNT *=*+1 ;NUMBER OF PLACES BEFORE DECIMAL POINT.
TENEXP *=*+1 ;BASE TEN EXPONENT
;
GRBTOP ;POINTER USED IN GARBAGE COLLECTION.(3 BYTES)
LOWTR *=*+1 ;LAST THING TO MOVE IN BLT (3 BYTES).
DPTFLG *=*+1 ;HAS A DPT BEEN INPUT
EXPSGN *=*+1 ;SIGN OF EXPONENT
.SKI 4
; THE FLOATING ACCUMULATOR
DSCTMP *=*+1 ;TEMPORARY DESCRIPTORS ARE BUILT HERE.
;DSCTMP OVERLAPS UP TO FACMOH.
FAC
FACEXP *=*+1
FACHO *=*+1 ;MOST SIGNIFICANT BYTE OF MANTISSA.
FACMOH *=*+1
INDICE ;USED BY QINT.
FACMO *=*+1
FACLO *=*+1
FACSGN *=*+1
DEGREE ;COUNT USED BY POLYNOMIALS.
SGNFLG *=*+1
BITS *=*+1 ;CELL FOR SHIFTR TO USE.
.SKI 4
; THE FLOATING ARGUMENT (UNPACKED)
T1=* ;TEMPORARIES --USES FP BUFFER
T2=T1+1
T3=T1+2
T4=T1+3
;
ARGEXP *=*+1
ARGHO *=*+1
ARGMOH *=*+1
ARGMO *=*+1
ARGLO *=*+1
ARGSGN *=*+1
STRNG1
ARISGN *=*+1 ;A SIGN REFLECTING THE RESULT
FACOV *=*+1 ;OVERFLOW BYTE OF THE FAC
*=*+1
.SKI 4
STRNG2 ;-> TO STR OR DESC
POLYPT ;-> TO POLYNOMIAL COEFFICIENTS
CURTOL ;ABSOLUTE LINEAR INDEX IS FORMED HERE
FBUFPT *=*+PTRSIZ ;-> INTO FBUFFR USED BY FOUT
TXTPTR *=*+PTRSIZ ;POINTER TO CURRENT TERM
BUFFPT *=*+PTRSIZ ;^INPUT BUFFER
;
NOZE ;USING'S LEADING ZERO COUNTER
PARSTS *=*+1 ;DOS STD PARSER WORD
POINT ;USING'S POINTER TO DECIMAL POINT
PARSTX *=*+1 ;DOS AUX PARSER WORD
;
SEEDPT *=*+2
ERRNUM *=*+1
.PAG
; STRING AREA AVAILABLE FOR COPY. THIS AREA IS USED
; BY FOUT AS A BUFFER AND MUST HAVE DOSSPC CONTIGUOUS
; BYTES.
;
; IN ADDITION THIS AREA IS USED TO STORE TEMPORARIES
; USED BY THE DOS INTERFACE ROUTINES. NOTE, DECLARATION
; ORDER OF LOCATIONS DOSOFL-DOSSA MUST BE PRESERVED.
;
* =$200
FBUFFR
VSPBUF ;BUFFER USED TO INTERFACE WITH VSP
*=*+16 ;RESERVE 16 BYTES FOR FILENAME 1
DOSF1L *=*+1 ;DOS FILE NAME 1 LENGTH
DOSDS1 *=*+1 ;DOS DISK DRIVE 1
DOSF1A *=*+2 ;DOS FILE NAME 1 ADDRESS
DOSF1B *=*+1 ;DOS FILE NAME 1 BANK
;
DOSF2L *=*+1 ;DOS FILE NAME 2 LENGTH
DOSDS2 *=*+1 ;DOS DISK DRIVE 2
DOSF2A *=*+2 ;DOS FILE NAME 2 ADDRESS
DOSF2B *=*+1 ;DOS FILE NAME 2 BANK
;
DOSBNK *=*+1 ;DOS BANK NUMBER
DOSOFL *=*+2 ;DOS LOW OFFSET (BSAVE,BLOAD)
DOSOFH *=*+2 ;DOS HIGH OFFSET (BSAVE)
;
DOSLA *=*+1 ;DOS LOGICAL ADDRESS
DOSFA *=*+1 ;DOS PHYSICAL ADDRESS
DOSSA *=*+1 ;DOS SECONDARY ADDRESS
DOSRCL *=*+1 ;DOS RECORD LENGTH
;
DOSDID *=*+2 ;DOS DISK IDENTIFIER (2 CHARS)
DIDCHK *=*+1 ;DOS DID FLAG
;
DOSSTR *=*+1 ;DOS OUTPUT STRING BUFFER
DOSSPC=*-FBUFFR ;SPACED USED BY DOS ROUTINES
.SKI 4
* =*+46
;
;
TRMPOS ;CURSOR COLUMN ON CRT
ANDMSK *=*+1 ;MASK USED BY WAIT
EORMSK *=*+1 ;MASK USED BY WAIT
;
DFBANK *=*+1 ;DEFAULT BANK NUMBER
DOLU *=*+1 ;DEFAULT OUTPUT LU (0=> NOT STD OUTPUT) KEEPS DS + DIR OK
;
DOMASK
TANSGN *=*+1 ;USED IN DETERMINING SIGN OF TAN
;
LDAABS *=*+1 ;LDA ABS ROUTINE (SEE INITAT)
TTTEMP ;TEMPORARY STORE
LDAADR *=*+2 ;MODIFIABLE ADDRESS
*=*+1 ;RETURN OPCODE
.SKI 3
;
;DECLARATIONS FOR PRINT USING
;
HULP *=*+1 ;COUNTER
BNR *=*+1 ;POINTER TO BEGIN NO
ENR *=*+1 ;POINTER TO END NO
DOLR *=*+1 ;DOLLAR FLAG
FLAG *=*+1 ;COMMA FLAG
SWE *=*+1 ;COUNTER
USGN *=*+1 ;SIGN EXPONENT
UEXP *=*+1 ;POINTER TO EXPONENT
VN *=*+1 ;# DIGITS BEFORE DECIMAL POINT
CHSN *=*+1 ;JUSTIFY FLAG
VF *=*+1 ;# POS BEFORE DEC POINT (FIELD)
NF *=*+1 ;# POS AFTER DEC POINT (FIELD)
POSP *=*+1 ;+/- FLAG (FIELD)
FESP *=*+1 ;EXPONENT FLAG (FIELD)
ETOF *=*+1 ;SWITCH
CFORM *=*+1 ;CHAR COUNTER (FIELD)
SNO *=*+1 ;SIGN NO
BLFD *=*+1 ;BLANK/STAR FLAG
BEGFD *=*+1 ;POINTER TO BEGIN OF FIELD
LFOR *=*+1 ;LENGTH OF FOR]AT
ENDFD *=*+1 ;POINTER TO END OF FIELD
PUCHRS
PUFILL *=*+1 ;PRINT USING FILL SYMBOL
PUCOMA *=*+1 ;PRINT USING COMMA SYMBOL
PUDOT *=*+1 ;PRINT USING DECIMAL POINT SYMBOL
PUMONY *=*+1 ;PRINT USING MONETARY SYMBOL
*=$280
; BASIC INDIRECTS
;
IERROR *=*+2 ;ERROR ROUTINE, OUTPUT ERR IN .X
IMAIN *=*+2 ;INTERPRETER MAIN LOOP
ICRNCH *=*+2 ;TOKENIZATION ROUTINE
IQPLOP *=*+2 ;TOKEN OUTPUT EXPANDER ROUTINE
IGONE *=*+2 ;DISPATCHER
IEVAL *=*+2 ;EVAL ROUTINE
IFRMEV *=*+2 ;FRMEVL ROUTINE
ICHRGO *=*+2 ;CHRGOT ROUTINE
ICHRGE *=*+2 ;CHRGET ROUTINE
ADRAY1 *=*+2 ;CONVERT FLOAT -> INTEGER
ADRAY2 *=*+2 ;CONVERT INTEGER -> FLOAT
.SKI 2
; ERROR TRAPPING DECLARATIONS
;
TRAPNO *=*+2 ;ERROR TRAP VECTOR
ERRLIN *=*+2 ;HOLDS LINE # OF LAST ERROR
ERRTXT *=*+2 ;TEXT POINTER AT TIME OF ERROR
OLDSTK *=*+1 ;STACK POINTER BEFORE EXECUTION OF LAST INSTRUCTION
TMPTRP *=*+1 ;USED TO SAVE HI BYTE OF TRAP LINE >TRAP & <RESUME
DSPTMP *=*+1 ;TEMPORARY FOR DISPOSE
OLDTOK *=*+1 ; " " "
TMPDES *=*+6 ;TEMPORARY FOR INSTR$
;
HIGHST *=*+2 ;MAX OFFSET FOR ANY USER BANK
;
;
MSIISM *=*+1 ;USED TO SAVE LENGTH OF STRING TO BE ADDED IN GARB COLLECT
NEWSYS= $FF6C
;
.SKI 4
.END