Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | - | 1 | ;; cbm emulation |
2 | |||
3 | ;;CBMP0 .EQU $7F00 |
||
4 | |||
5 | ; sezione COMMON -- questo permette di includere il file in piu' file |
||
6 | |||
7 | DPCBM: .SECTION page0, ref_only, common |
||
8 | |||
9 | .ABSOLUTE ;; inizia sempre da $00 |
||
10 | .ORG 0x00 |
||
11 | |||
12 | ;;MAXLF .EQU $10 ; max. logical files |
||
13 | MAXLF .EQU 11 ; max. logical files |
||
14 | MAXVIEC .EQU 8 ; max. virtual iec device # |
||
15 | .DS 16 |
||
16 | |||
17 | subflg .DB ; ($10) |
||
18 | .DB ; ($11) |
||
19 | .DB ; ($12) |
||
20 | .DB ; ($13) |
||
21 | lineno .DW ; ($14-$15) line number used by editor |
||
22 | tmppt .DB ; ($16) |
||
23 | tcnt .DB ; ($17) temp. counter/index |
||
24 | .DW ; ($18-$19) |
||
25 | .DW ; ($1A-$1B) |
||
26 | .DW ; ($1C-$1D) |
||
27 | .DW ; ($1E-$1F) |
||
28 | .DB ; ($20) |
||
29 | |||
30 | ; basic/p-code virtual machine work area |
||
31 | .DW ; ($21-$22) |
||
32 | .DW ; ($23-$24) |
||
33 | .DW ; ($25-$26) |
||
34 | .DW ; ($27-$28) |
||
35 | .DW ; ($29-$2A) |
||
36 | .DW ; ($2B-$2C) |
||
37 | .DW ; ($2D-$2E) |
||
38 | arytab .DW ; ($2F-$30) |
||
39 | strend .DW ; ($31-$32) |
||
40 | freetop .DW ; ($33-$34) |
||
41 | freespc .DW ; ($35-$36) |
||
42 | memsiz .DW ; ($37-$38) |
||
43 | curline .DW ; ($39-$3A) current line number in execution |
||
44 | oldline .DW ; ($3B-$3C) previous line number in execution |
||
45 | oldtxt .DW ; ($3D-$3E) saved pointer to text in basic execution |
||
46 | datlin .DW ; ($3F-$40) |
||
47 | datptr .DW ; ($41-$42) |
||
48 | inpptr .DW ; ($43-$44) |
||
49 | varnam .DW ; ($45-$46) |
||
50 | varpnt .DW ; ($47-$48) |
||
51 | forpnt .DW ; ($49-$4A) basic |
||
52 | opptr .DW ; ($4B-$4C) basic |
||
53 | opmask .DB ; ($4D) |
||
54 | defpnt .DW ; ($4E-$4F) |
||
55 | dscpnt .DW ; ($50-$51) |
||
56 | dsclen .DB ; ($52) |
||
57 | prompt .DB ; ($53) prompt flag/CMD channel - editor/basic ($13) |
||
58 | |||
59 | ; equates for p-code virtual machine |
||
60 | prtrap .EQU oldline ; ($3B) p-code trap errors flag |
||
61 | pcstack .EQU oldline+1 ; ($3C-$3D) p-code save stack |
||
62 | prterr .EQU oldtxt+1 ; ($3E) p-code run time error number |
||
63 | psrline .EQU datlin ; ($3F-$40) pascal source line number |
||
64 | prseed .EQU datptr ; ($41-$42) p-code random generator |
||
65 | pbrkcnt .EQU inpptr ; ($43) p-code counter for break check |
||
66 | tmpy .EQU inpptr+1 ; ($44) p-code temp. for save Y |
||
67 | inqidx .EQU varnam ; ($45) p-code index to input buffer |
||
68 | inqcnt .EQU varnam+1 ; ($46) p-code input buffer counter |
||
69 | tmpv1 .EQU varpnt ; ($47) p-code temp. |
||
70 | tmpv2 .EQU varpnt+1 ; ($48) p-code temp. |
||
71 | tmpa .EQU forpnt ; ($49) p-code temp. save A |
||
72 | tmpwa .EQU forpnt+1 ; ($4A) p-code tmp. save byte to write |
||
73 | tmpx .EQU opptr ; ($4B) p-code tmp. save X when print |
||
74 | pcterr .EQU opptr+1 ; ($4C) p-code compiler error flag |
||
75 | tmpdsk .EQU opmask ; ($4D) p-code default temp. disk unit |
||
76 | defprn .EQU defpnt ; ($4E) p-code default printer #device |
||
77 | pcdbg .EQU defpnt+1 ; ($4F) p-code debug run after error |
||
78 | pcptr .EQU dscpnt ; ($50-$51) pointer to p-code (debug) |
||
79 | autolf .EQU dsclen ; ($52) p-code auto line feed flag |
||
80 | |||
81 | tmpwrk .DS 4 ; ($54-$57) temp. area editor/virtual iec |
||
82 | tmpb0 .DB ; ($58) |
||
83 | argbits .DB ; ($59) FAC #1 guard bits |
||
84 | tmpb2 .DB ; ($5A) tmp. byte - used by fpu |
||
85 | txtlen .DB ; ($5B) tmp. word length of text to insert in buffer |
||
86 | tmpb1 .DB ; ($5C) tmp. byte used by editor and float point unit |
||
87 | tmpval .DW ; ($5D-$5E) temp. word used by editor/fpu |
||
88 | tlnptr .DW ; ($5F-$60) temp. line text pointer used by editor/fpu |
||
89 | facexp .DB ; ($61) FAC #1 exponent |
||
90 | facm .DS 4 ; ($62-$65) FAC #1 mantissa |
||
91 | facsgn .DB ; ($66) FAC #1 sign |
||
92 | sercnt .DB ; ($67) FAC #1 series evaluation |
||
93 | facov .DB ; ($68) FAC #1 overflow |
||
94 | argexp .DB ; ($69) FAC #2 exponent |
||
95 | argm .DS 4 ; ($6A-$6D) FAC #2 mantissa |
||
96 | argsgn .DB ; ($6E) FAC #2 sign |
||
97 | arisgn .DB ; ($6F) FAC #1 & #2 sign comparison |
||
98 | facbits .DB ; ($70) FAC #1 guard bits |
||
99 | fbufpt .DW ; ($71-$72) FAC series evaluation pointer |
||
100 | fbufpt2 .DB ; ($73) FAC series evaluation bank (progr. bank) |
||
101 | |||
102 | ; tmp. variables (equates) used by float point unit |
||
103 | factmp .EQU tmpwrk ; ($54-$57) used by fpu mult/div |
||
104 | cprmsk .EQU tmpb2 ; ($5A) used by trigs. funcs. |
||
105 | faclsb .EQU txtlen ; ($5B) used by float point unit |
||
106 | dccnt .EQU tmpval ; ($5D) digit count after decimal dot |
||
107 | expval .EQU tmpval+1 ; ($5E) exponent value when convert |
||
108 | dotfg .EQU tlnptr ; ($5F) flag decimal dot when convert |
||
109 | expsgn .EQU tlnptr+1 ; ($60) flag exponent sign when conver |
||
110 | sgnfg .EQU sercnt ; ($67) flag: minus sign when convert |
||
111 | decidx .EQU fbufpt ; ($71) string index when convert |
||
112 | s2fer .EQU fbufpt+1 ; ($72) string to float flag error |
||
113 | decidx2 .EQU fbufpt+2 ; ($73) used when convert float to str |
||
114 | |||
115 | s2fstk .DW ; ($74-$75) save stack when string to float conversion |
||
116 | longp LP ; ($76-$77-$78) temp. long pointer |
||
117 | s2fptr .DB ; ($79) flag trap overflow err. string to float conv. |
||
118 | |||
119 | txtp .DW ; ($7A-$7B) current pointer to text |
||
120 | pcdsk .DB ; ($7C) flag for pascal compiler |
||
121 | ; <7> : compile in memory |
||
122 | |||
123 | iecrp LP ; ($7D) iec: pointer to read buffer for include file |
||
124 | iecalt .DB ; ($80) iec: flag read from include file |
||
125 | iectp LP ; ($81) iec: pointer to read main text buffer |
||
126 | iecndx .DB ; ($84) iec: index main text buffer |
||
127 | ieceof .DB ; ($85) iec: end of file flag main text buffer |
||
128 | iecwp LP ; ($86) iec: pointer to write buffer |
||
129 | iecfg .DB ; ($89) iec: flag main text buffer |
||
130 | iecndx2 .DW ; ($8A) iec: index buffer include file |
||
131 | iecbuf .DB ; ($8C) iec: byte buffer |
||
132 | svbnk .DB ; ($8D) save vbnk when run pascal compiler |
||
133 | ieceof2 .DB ; ($8E) iec: flag eof include file |
||
134 | vxflag .DB ; ($8F) flag valid text in x-bank |
||
135 | kstat .DB ; ($90) CBM emulated IEC status |
||
136 | errno .DB ; ($91) saved error number |
||
137 | keyfg .DB ; ($92) keyboard flag: KbdFlag |
||
138 | keyctl .DB ; ($93) flag control key from get key |
||
139 | keysh .DB ; ($94) flag keyboard: KbdShift |
||
140 | keytg .DB ; ($95) flag keyboard: KbdToggle |
||
141 | basic .DB ; ($96) flag current 'basic' mode |
||
142 | ; <7>: flag basic mode |
||
143 | ; <6>: flag pascal compiler running |
||
144 | runf .DB ; ($97) flag current run mode |
||
145 | ldtnd .DB ; ($98) number of open files |
||
146 | dfltn .DB ; ($99) default input device |
||
147 | dflto .DB ; ($9A) default output device |
||
148 | skpbk .DB ; ($9B) skip blank flag |
||
149 | w2sf .DB ; ($9C) integer to string flag conversion |
||
150 | msgflg .DB ; ($9D) flag message |
||
151 | autof .DB ; ($9E) flag auto-increment line numbering |
||
152 | wauto .DW ; ($9F-$A0) auto-increment for line numbering |
||
153 | tbnk .DB ; ($A1) bank that hold basic/pascal text |
||
154 | vbnk .DB ; ($A2) bank that hold basic var/pascal pcode-stack |
||
155 | cbnk .DB ; ($A3) compiler bank/temp. bank for exchange |
||
156 | jbnk .DB ; ($A4) bank for obj, when compiling (3 bank max.) |
||
157 | xbnk .DB ; ($A5) exchange bank for text buffer |
||
158 | dbnk .DB ; ($A6) bank for ram disk (jbnk + 3) |
||
159 | botmem .DW ; ($A7-$A8) start of memory on the text bank |
||
160 | topmem .DW ; ($A9-$AA) top of memory on the text bank |
||
161 | txtbeg .DW ; ($AB-$AC) begin of text buffer |
||
162 | txtend .DW ; ($AD-$AE) end of text buffer + 1 |
||
163 | txttop .DW ; ($AF-$B0) top of memory + 1 reserved to text buffer |
||
164 | varbeg .DW ; ($B1-$B2) start of basic var/pcode |
||
165 | vartop .DW ; ($B3-$B4) top of basic var/pcode + 1 |
||
166 | xtop .DW ; ($B5-$B6) top of text + 1 in x-bank |
||
167 | fnlen .DB ; ($B7) length of current filename |
||
168 | lacur .DB ; ($B8) current logical file number |
||
169 | sacur .DB ; ($B9) current secondary address |
||
170 | facur .DB ; ($BA) current device number |
||
171 | fnadr .DW ; ($BB-$BC) pointer to current filename |
||
172 | fnadr2 .DB ; ($BD) - bank that hold file name |
||
173 | objdsk .DB ; ($BE) compiler: option '1' specified |
||
174 | truedsk .DB ; ($BF) true disk for load pascal soource file |
||
175 | curstk .DW ; ($C0-$C1) current stack when in edit mode |
||
176 | pcodef .DB ; ($C2) flag p-code present for execution |
||
177 | |||
178 | latb .DS MAXLF ; logical files table |
||
179 | fatb .DS MAXLF ; devices numbers table |
||
180 | satb .DS MAXLF ; secondary addresses table |
||
181 | |||
182 | ;============================================================= |
||
183 | |||
184 | cmdlin .DW ; command line ptr for pscal program |
||
185 | fpcflag .DB ; fpc flags (new style) |
||
186 | ; <7>: new style compiler |
||
187 | ; <6>: no save exec. file |
||
188 | ; <5>: save obj. file |
||
189 | |||
190 | .RELATIVE |
||
191 | .ENDS |
||
192 | |||
193 | ; basic work area starting at $FF00 of bank that hold text buffer |
||
194 | CBMHIM: .SECTION ref_only, common |
||
195 | .ABSOLUTE |
||
196 | .ORG $FF00 |
||
197 | ; .ORG 0 |
||
198 | |||
199 | TBUFMAX .EQU $A2 ; size of input buffer |
||
200 | VALIDSGN .EQU $AA55 ; valid signature |
||
201 | |||
202 | cbmwork .DS 4 ; first 4 bytes free for insert text line |
||
203 | TXTBUF .DS TBUFMAX ; input buffer for text insertion |
||
204 | NUMSTR .DS 32 ; room for numeric string |
||
205 | |||
206 | TMPPTR .DW ; temp. pointer |
||
207 | .DW |
||
208 | .DW |
||
209 | .DW |
||
210 | .DW |
||
211 | GFNAME .DS 32 ; global file name |
||
212 | .DS 8 |
||
213 | |||
214 | ;;.ORG $FFF8 |
||
215 | TXTEND2 .DW ; saved text end + 1 |
||
216 | TXTVSGN .DW ; valid text buffer signature |
||
217 | XTOP2 .DW ; saved text end + 1 in exchange bank |
||
218 | XBVSGN .DW ; valid x-bank buffer signature |
||
219 | |||
220 | .RELATIVE |
||
221 | .ENDS |
||
222 | |||
223 | .COMMENT @ |
||
224 | cbmwork .EQU $FF00 ; first 4 bytes free for insert text line |
||
225 | TXTBUF .EQU $FF04 ; input buffer for text insertion |
||
226 | NUMSTR .EQU $FFA6 ; room for numeric string |
||
227 | |||
228 | TMPPTR .EQU $FFC6 ; temp. pointer |
||
229 | |||
230 | TXTEND2 .EQU $FFF8 ; saved text end + 1 |
||
231 | TXTVSGN .EQU $FFFA ; valid text buffer signature |
||
232 | XTOP2 .EQU $FFFC ; saved text end + 1 in exchange bank |
||
233 | XBVSGN .EQU $FFFE ; valid x-bank buffer signature |
||
234 | @ |
||
235 | |||
236 | ; basic/pascal work area starting at $FF00 of bank that hold variables/p-code |
||
237 | CBMHIV: .SECTION common, ref_only |
||
238 | .ABSOLUTE |
||
239 | .ORG $FF00 |
||
240 | ; .ORG 0 |
||
241 | |||
242 | QINSIZ .EQU $5A ; input buffer max. 90 chars. |
||
243 | NUMSIZ .EQU $20 ; size of numeric buffer for conversion |
||
244 | MAX2LF .EQU ((MAXLF + 1) * 2) ; size of p-code logical files table |
||
245 | MAXFNLEN .EQU 19 ; max. length of file name '@x:yyyyyyyyyyyyyyyy' |
||
246 | |||
247 | MINBUF .DS QINSIZ |
||
248 | MNUMSTR .DS NUMSIZ |
||
249 | MTMPW0 .DW |
||
250 | MTMPW1 .DW |
||
251 | MTMPB0 .DB |
||
252 | MFNAME .DS 16 ; file name buffer |
||
253 | MTMPNAM .DS 15 ; tmp. file name |
||
254 | MPOW10 .DS 10 ; power of 10 table |
||
255 | MTRUE .DS 6 |
||
256 | MFALSE .DS 6 |
||
257 | MSTDF0 .DS 4 ; descriptor for file #0 (consolle) |
||
258 | MSTDF1 .DS 4 ; descriptor for file #1 (disk command chann.) |
||
259 | MSTDF2 .DS 4 ; descriptor for file #2 (used by compiler) |
||
260 | MMSET .DS 16 ; set variables |
||
261 | MFILET .DS MAX2LF ; table of logical files: #0 consolle, #1 disk |
||
262 | FAC1TMP .DS 5 ; these 3 used by float routines |
||
263 | FAC2TMP .DS 5 |
||
264 | FAC3TMP .DS 5 |
||
265 | FAC4TMP .DS 5 ; free to use |
||
266 | MTPTR .DW ; used by new/dispose |
||
267 | MTMPW2 .DW |
||
268 | |||
269 | .RELATIVE |
||
270 | .ENDS |
||
271 | |||
272 | .COMMENT @ |
||
273 | MINBUF .EQU $FF00 |
||
274 | MNUMSTR .EQU $FF5A |
||
275 | MTMPW0 .EQU $FF7A |
||
276 | MTMPW1 .EQU $FF7C |
||
277 | MTMPB0 .EQU $FF7E |
||
278 | MFNAME .EQU $FF7F ; file name buffer |
||
279 | MTMPNAM .EQU $FF8F ; tmp. file name |
||
280 | MPOW10 .EQU $FF9E ; power of 10 table |
||
281 | MTRUE .EQU $FFA8 |
||
282 | MFALSE .EQU $FFAE |
||
283 | MSTDF0 .EQU $FFB4 ; descriptor for file #0 (consolle) |
||
284 | MSTDF1 .EQU $FFB8 ; descriptor for file #1 (disk command chann.) |
||
285 | MSTDF2 .EQU $FFBC ; descriptor for file #2 (used by compiler) |
||
286 | MMSET .EQU $FFC0 ; set variables |
||
287 | MFILET .EQU $FFD0 ; table of logical files: #0 consolle, #1 disk |
||
288 | FAC1TMP .EQU $FFE8 ; these 3 used by float routines |
||
289 | FAC2TMP .EQU $FFED |
||
290 | FAC3TMP .EQU $FFF2 |
||
291 | FAC4TMP .EQU $FFF7 ; free to use |
||
292 | MTPTR .EQU $FFFC ; used by new/dispose |
||
293 | MTMPW2 .EQU $FFFE |
||
294 | @ |
||
295 | |||
296 | ; temp. file names in x-bank |
||
297 | PASSRC .EQU $FF00 |
||
298 | OBJDST .EQU $FF20 |
||
299 | EXEDST .EQU $FF40 |
||
300 | OBJDEL .EQU $FF60 |