OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [trunk/] [src/] [sys09bug/] [sys09atl.lst] - Blame information for rev 223

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 218 davidgb
Assembler release DWC_2.0 version 2.11
2
May 6, 2004 (c) Motorola (free ware)
3
0001                          NAM SYS09BUG FOR ATLYS
4
0000                          INCLUDE "opt_atl.asm"
5
0001                         *
6
0002                         ***************************************************
7
0003                         *   OPTION SWITCHES
8
0004                         ***************************************************
9
0005                         *
10
0006                         *
11
0007                         ** THE CONTROL PORT CAN ONLY BE ONE OF THESE
12
0008                         ** NOTE THAT THE ACIA WILL ALWAYS BE PRESET
13
0009                         ** FOR LOADING AND SAVING S1 RECORDS
14
0010                         *
15
0011                         *SWTOPT EQU $FF SWTP ACIA SERIAL CONTROL PORT
16
0012                         *ADSOPT EQU $FF ADS6809 & DG640 VIDEO DISPAY
17
0013                         *B3SOPT EQU $FF B3-SPARTAN2 FPGA VIDEO & PS2 KEYBOARD
18
0014                         *B5XOPT EQU $FF B5-X300 FPGA VIDEO & PS2 KEYBOARD
19
0015                         *S3SOPT EQU $FF SPARTAN3 STARTER FPGA VIDEO & PS2 KEYBOARD
20
0016                         *S3EOPT EQU $FF SPARTAN3E STARTER
21
0017                         *XESOPT EQU $FF XESS XSA-3S100 & XST-3.0
22
0018 00FF                    ATLOPT EQU $FF Digilent Atlys
23
0019                         *
24
0002                          END
25
0000                          INCLUDE "sys09equ.asm"
26
0001                         *
27
0002                         ***************************************************
28
0003                         *   MEMORY MAP EQUATES                            *
29
0004                         ***************************************************
30
0005 E000                    MONIO  EQU $E000  I/O SPACE
31
0006                                IFD B3SOPT
32
0007                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
33
0008                         EXTCMD EQU $00    EXTENDED OFFSET
34
0009                                ENDIF B3SOPT
35
0009                                ENDIF B3SOPT
36
0010                                IFD S3EOPT
37
0011                         MONRAM EQU $7FC0
38
0012                                ELSE
39
0013 DFC0                    MONRAM EQU $DFC0  STACK SPACE
40
0014                                ENDIF S3EOPT
41
0015 F800                    MONROM EQU $F800  START OF ROM
42
0016                                IFD S3SOPT
43
0017                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
44
0018                         EXTCMD EQU $00    EXTENDED OFFSET
45
0019                                ENDIF S3SOPT
46
0019                                ENDIF S3SOPT
47
0020                                IFD XESOPT
48
0021                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
49
0022                         EXTCMD EQU $00    EXTENDED OFFSET
50
0023                                ENDIF XESOPT
51
0023                                ENDIF XESOPT
52 221 davidgb
0024                                IFD ATLOPT
53
0025 F000                    MONEXT EQU $F000  START OF EXTENDED COMMANDS
54
0026 0000                    EXTCMD EQU $00    EXTENDED OFFSET
55
0027                                ENDIF ATLOPT
56
0028                                IFD DE270OPT
57
0029                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
58
0030                         EXTCMD EQU $00    EXTENDED OFFSET
59
0031                                ENDIF DE270OPT
60
0031                                ENDIF DE270OPT
61
0032                         **************************************************
62
0033                         **************************************************
63
0034
64
0035                                 IFD SWTOPT
65
0036                         *
66
0037                         * SOUTH WEST TECHNICAL PRODUCTS COMPUTER
67
0038                         *
68
0039                         ACIAOPT EQU $FF ACIA AT PORT 0
69
0040                         DMAFOPT EQU $FF DMAF2 8" FLOPPY DISK BOOT
70
0041                         MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
71
0042                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
72
0043                                 ENDIF
73
0043                                 ENDIF
74 218 davidgb
0044                         *
75 221 davidgb
0045                                 IFD ADSOPT
76
0046                         *
77
0047                         * ACKERMAN DIGITAL ADS6809
78
0048                         *
79
0049                         DG640OPT  EQU $FF DG640 VDU AT $E800
80
0050                         *RTCOPT  EQU $FF REAL TIME CLOCK
81
0051                         PRTOPT  EQU $FF PRINTER DRIVERS
82
0052                         MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
83
0053                                 ENDIF ADSOPT
84
0053                                 ENDIF ADSOPT
85 218 davidgb
0054                         *
86 221 davidgb
0055                                 IFD B3SOPT
87
0056                         *
88
0057                         * BURCHED SPARTAN 2 B3+
89
0058                         *
90
0059                         ACIAOPT EQU $FF ACIA AT PORT 0
91
0060                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
92
0061                         VDUOPT  EQU $FF VDU AT $E030
93
0062                         IDEOPT  EQU $FF IDE AT $E100
94
0063                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
95
0064                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
96
0065                                 ENDIF B3SOPT
97
0065                                 ENDIF B3SOPT
98 218 davidgb
0066                         *
99 221 davidgb
0067                                 IFD B5XOPT
100
0068                         *
101
0069                         * BURCHED SPARTAN 2 B5-X300
102
0070                         *
103
0071                         ACIAOPT EQU $FF ACIA AT PORT 0
104
0072                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
105
0073                         VDUOPT  EQU $FF VDU AT $E030
106
0074                         CF8OPT  EQU $FF COMPACT FLASH AT $E040
107
0075                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
108
0076                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
109
0077                                 ENDIF B5XOPT
110
0077                                 ENDIF B5XOPT
111 218 davidgb
0078                         *
112 221 davidgb
0079                                 IFD S3SOPT
113
0080                         *
114
0081                         * DIGILENT SPARTAN 3 STARTER
115
0082                         *
116
0083                         ACIAOPT EQU $FF ACIA AT PORT 0
117
0084                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
118
0085                         VDUOPT  EQU $FF VDU AT $E030
119
0086                         CF8OPT  EQU $FF COMPACT FLASH AT $E040
120
0087                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
121
0088                         EXTOPT  EQU $FF EXTENDED COMMANDS
122
0089                                 ENDIF S3SOPT
123
0089                                 ENDIF S3SOPT
124 218 davidgb
0090                         *
125 221 davidgb
0091                                 IFD S3EOPT
126
0092                         *
127
0093                         * DIGILENT SPARTAN 3E STARTER
128
0094                         *
129
0095                         ACIAOPT EQU $FF ACIA AT PORT 0
130
0096                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
131
0097                         VDUOPT  EQU $FF VDU AT $E030
132
0098                         TRAOPT  EQU $FF PIA TRACE TIMER
133
0099                                 ENDIF S3EOPT
134
0099                                 ENDIF S3EOPT
135 218 davidgb
0100                         *
136 221 davidgb
0101                                 IFD XESOPT
137
0102                         *
138
0103                         * XESS SPARTAN 3 XSA-3S1000 & XST-3.0
139
0104                         *
140
0105                         ACIAOPT EQU $FF ACIA AT PORT 0
141
0106                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
142
0107                         VDUOPT  EQU $FF VDU AT $E030
143
0108                         IDEOPT  EQU $FF IDE AT $E100
144
0109                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
145
0110                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
146
0111                         EXTOPT  EQU $FF EXTENDED COMMANDS
147
0112                                 ENDIF XESOPT
148
0112                                 ENDIF XESOPT
149 218 davidgb
0113                         *
150 221 davidgb
0114                                 IFD ATLOPT
151
0115                         *
152
0116                         * Digilent Atlys SPARTAN6
153
0117                         *
154
0118 00FF                    ACIAOPT EQU $FF ACIA AT PORT 0
155
0119 00FF                    PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
156
0120 00FF                    VDUOPT  EQU $FF VDU AT $E030
157
0121 00FF                    IDEOPT  EQU $FF IDE AT $E100
158
0122 00FF                    DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
159
0123 00FF                    HFCOPT  EQU $FF HARDWARE FLOW CONTROL
160
0124 00FF                    EXTOPT  EQU $FF EXTENDED COMMANDS
161
0125                                 ENDIF ATLOPT
162
0126                         *
163
0127                                 IFD DE270OPT
164 218 davidgb
0128                         *
165 221 davidgb
0129                         * TERASIC CYCLONE 2 DE2-70
166 218 davidgb
0130                         *
167 221 davidgb
0131                         ACIAOPT EQU $FF ACIA AT PORT 0
168
0132                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
169
0133                         VDUOPT  EQU $FF VDU AT $E030
170
0134                         CF8OPT  EQU $FF COMPACT FLASH AT $E040
171
0135                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
172
0136                         EXTOPT  EQU $FF EXTENDED COMMANDS
173
0137                                 ENDIF DE270OPT
174
0137                                 ENDIF DE270OPT
175
0138                         *
176 218 davidgb
0139                         *
177 221 davidgb
0140                                 IFD   ACIAOPT
178
0141                         *
179
0142                         ***************************************************
180
0143                         *   SERIAL PORT                                   *
181
0144                         ***************************************************
182
0145                         *
183
0146                         ** ACIA SITS ON PORT 0
184
0147                         *
185
0148 E000                    ACIAS   EQU   MONIO+$00   CONTROL PORT
186
0149                         *
187
0150                                 ENDIF ACIAOPT
188
0151                                 IFD   MFDCOPT
189
0152                         *
190
0153                         ***************************************************
191
0154                         *   MINIFLOPPY DRIVE                              *
192
0155                         ***************************************************
193
0156                         *
194
0157                         ** FLOPPY DISK CONTROLLER SITS ON PORT 1
195
0158                         *
196
0159                         DRVFDC  EQU   MONIO+$14
197
0160                         CMDFDC  EQU   MONIO+$18
198
0161                         SECFDC  EQU   MONIO+$1A
199
0162                         DATFDC  EQU   MONIO+$1B
200
0163                                 ENDIF MFDCOPT
201
0163                                 ENDIF MFDCOPT
202
0164                                 IFD PS2OPT
203
0165                         *
204
0166                         ***************************************************
205
0167                         *   VDU8 PS/2 KEYBOARD PORT                       *
206
0168                         ***************************************************
207
0169                         *
208
0170                         ** KEYBOARD SITS ON PORT 2
209 218 davidgb
0171                         *
210 221 davidgb
0172 E020                    PS2KBD  EQU   MONIO+$20   PS/2 KEYBOARD PORT
211
0173                                 ENDIF PS2OPT
212
0174                                 IFD VDUOPT
213
0175                         *
214
0176                         ***************************************************
215
0177                         *   VDU8 DISPLAY DRIVER EQUATES                   *
216 218 davidgb
0178                         ***************************************************
217 221 davidgb
0179                         *
218
0180                         ** VDU8 DISPLAY SITS ON PORT 3
219 218 davidgb
0181                         *
220 221 davidgb
0182 E030                    VDU     EQU   MONIO+$30
221
0183 0000                    VDUCHR  EQU   0        CHARACTER REGISTER
222
0184 0001                    VDUATT  EQU   1        ATTRIBUTE REGISTER
223
0185 0002                    VDUCOL  EQU   2        CURSOR COLUMN
224
0186 0003                    VDUROW  EQU   3        CURSOR ROW
225
0187 0004                    VDUOFF  EQU   4        ROW OFFSET
226
0188                         *
227
0189 0050                    LINLEN  EQU   80       LENGTH OF A LINE
228
0190 0019                    NUMLIN  EQU   25       NUMBER OF LINES
229
0191                                 ENDIF VDUOPT
230
0192                         *
231
0193                                    IFD CF8OPT
232
0194                         *
233
0195                         ***************************************************
234
0196                         *   COMPACT FLASH EQUATES 8 BIT TRANSFER          *
235
0197                         ***************************************************
236
0198                         *
237
0199                         ** COMPACT FLASH SITS AT PORT 4
238
0200                         *
239
0201                         CF_BASE    EQU MONIO+$40
240
0202                         CF_DATA    EQU CF_BASE+0
241
0203                         CF_ERROR   EQU CF_BASE+1 ; read error
242
0204                         CF_FEATURE EQU CF_BASE+1 ; write feature
243
0205                         CF_SECCNT  EQU CF_BASE+2
244
0206                         CF_SECNUM  EQU CF_BASE+3
245
0207                         CF_CYLLO   EQU CF_BASE+4
246
0208                         CF_CYLHI   EQU CF_BASE+5
247
0209                         CF_HEAD    EQU CF_BASE+6
248
0210                         CF_STATUS  EQU CF_BASE+7 ; read status
249
0211                         CF_COMAND  EQU CF_BASE+7 ; write command
250 218 davidgb
0212                         *
251 221 davidgb
0213                         * Command Equates
252
0214                         *
253
0215                         CMDREAD    EQU $20 ; Read Single sector
254
0216                         CMDWRITE   EQU $30 ; Write Single sector
255
0217                         CMDFEATURE EQU $EF
256
0218                         FEAT8BIT   EQU $01 ; enable 8 bit transfers
257
0219                         HEADLBA    EQU $E0
258 218 davidgb
0220                         *
259 221 davidgb
0221                         * Status bit equates
260
0222                         *
261
0223                         BUSY       EQU $80
262
0224                         DRDY       EQU $40
263
0225                         DRQ        EQU $08
264
0226                         ERR        EQU $01
265
0227                         *
266
0228                                    ENDIF CF8OPT
267
0228                                    ENDIF CF8OPT
268
0229                         *
269
0230                                    IFD IDEOPT
270
0231                         *
271
0232                         ***************************************************
272
0233                         *   COMPACT FLASH EQUATES 16 BIT TRANSFER (XESS)  *
273
0234                         ***************************************************
274 218 davidgb
0235                         *
275 221 davidgb
0236                         ** COMPACT FLASH SITS AT PORT 4
276
0237                         *
277
0238 E100                    CF_BASE    EQU MONIO+$0100
278
0239 E100                    CF_DATA    EQU CF_BASE+0
279
0240 E102                    CF_ERROR   EQU CF_BASE+2 ; read error
280
0241 E102                    CF_FEATURE EQU CF_BASE+2 ; write feature
281
0242 E104                    CF_SECCNT  EQU CF_BASE+4
282
0243 E106                    CF_SECNUM  EQU CF_BASE+6
283
0244 E108                    CF_CYLLO   EQU CF_BASE+8
284
0245 E10A                    CF_CYLHI   EQU CF_BASE+10
285
0246 E10C                    CF_HEAD    EQU CF_BASE+12
286
0247 E10E                    CF_STATUS  EQU CF_BASE+14 ; read status
287
0248 E10E                    CF_COMAND  EQU CF_BASE+14 ; write command
288
0249 E11E                    CF_AUX     EQU CF_BASE+30
289 218 davidgb
0250                         *
290 221 davidgb
0251                         * Command Equates
291 218 davidgb
0252                         *
292 221 davidgb
0253 0020                    CMDREAD    EQU $20 ; Read Single sector
293
0254 0030                    CMDWRITE   EQU $30 ; Write Single sector
294
0255 0006                    AUXRESET   EQU $06 ; Reset IDE
295
0256 0002                    AUXRSTREL  EQU $02 ; Reset release IRQ masked
296
0257 00E0                    HEADLBA    EQU $E0
297 218 davidgb
0258                         *
298 221 davidgb
0259                         * Status bit equates
299 218 davidgb
0260                         *
300 221 davidgb
0261 0080                    BUSY       EQU $80
301
0262 0040                    DRDY       EQU $40
302
0263 0008                    DRQ        EQU $08
303
0264 0001                    ERR        EQU $01
304
0265                         *
305
0266                                    ENDIF CF8OPT
306 218 davidgb
0267                         *
307 221 davidgb
0268                                 IFD RTCOPT
308
0269                         *
309
0270                         **************************************************
310
0271                         * MM58167A REAL TIME CLOCK MEMORY MAP:
311
0272                         **************************************************
312
0273                         *
313
0274                         ** REAL TIME CLOCK SITS ON PORT 4 AND PORT 5
314
0275                         *
315
0276                         CLOCK  EQU MONIO+$40 CLOCK BASE ADDRESS AND REGISTERS
316
0277                         *
317
0278                         * COUNTER AND COMPARITOR REGISTERS:
318
0279                         *
319
0280                         * Both the Clock Counter and Clock Comparitor
320
0281                         * consist of 8 registers for holding the time.
321
0282                         * The register offsets from the Counter and
322
0283                         * Comparitor registers are listed above.
323
0284                         *
324
0285                         COUNTR EQU CLOCK+0
325
0286                         CMPRAM EQU CLOCK+8 COMPARITOR REGISTERS
326
0287                         *
327
0288                         * CLOCK REGISTER OFFSETS:
328
0289                         * These register offsets are used for the CLOCK
329
0290                         * and comparitor ram CMPRAM.
330
0291                         *
331
0292                         S10000 EQU 0 TEN THOUNSANDTHS OF SECONDS
332
0293                         S100   EQU 1 HUNDRETHS AND TENTHS OF SECONDS
333
0294                         SECOND EQU 2
334
0295                         MINUIT EQU 3
335
0296                         HOUR   EQU 4
336
0297                         WKDAY  EQU 5
337
0298                         MTHDAY EQU 6
338
0299                         MONTH  EQU 7
339
0300                         *
340
0301                         * INTERRUPT OUTPUT REGISTERS:
341
0302                         *
342
0303                         * An interrupt output may be generated at the
343
0304                         * following rates by setting the appropriate bit
344
0305                         * in the Interrupt Control Register (CINTCR).
345
0306                         * The Interrupt Status Register (CINTSR) must be
346
0307                         * read to clear the interrupt and will return
347
0308                         * the source of the interrupt.
348
0309                         *
349
0310                         * 1/Month      Bit 7
350
0311                         * 1/Week       Bit 6
351
0312                         * 1/Day        Bit 5
352
0313                         * 1/Hour       Bit 4
353
0314                         * 1/Minuite    Bit 3
354
0315                         * 1/Second     Bit 2
355
0316                         * 10/Second    Bit 1
356
0317                         * Comparitor   Bit 0
357
0318                         *
358
0319                         CINTSR  EQU CLOCK+16 INTERRUPT STATUS REGISTER
359
0320                         CINTCR  EQU CLOCK+17 INTERRUPT CONTROL REGISTER
360
0321                         *
361
0322                         * COUNTER AND RAM RESETS; GO COMMAND.
362
0323                         *
363
0324                         * The counter and comparitor may be reset
364
0325                         * by writing $FF into CTRRES and CMPRES
365
0326                         * respectivly.
366
0327                         * A write to the Go command register (GOCMND)
367
0328                         * will reset the 1/1000ths, 1/100ths and 1/10ths
368
0329                         * of a second counter.
369
0330                         *
370
0331                         CTRRES EQU CLOCK+18 COUNTER RESET
371
0332                         CMPRES EQU CLOCK+19 COMPARITOR RAM RESET
372
0333                         GOCMND EQU CLOCK+21 GO COMMAND
373
0334                         *
374
0335                         * CLOCK STATUS REGISTER.
375
0336                         *
376
0337                         * The counter takes 61 usec. to rollover for
377
0338                         * every 1KHz clock pulse. If the Status bit is
378
0339                         * set after reading the counter, the counter
379
0340                         * should be re-read to ensure the time is correct.
380
0341                         *
381
0342                         CLKSTA EQU CLOCK+20 STATUS BIT
382
0343                         SBYINT EQU CLOCK+22 STANDBY INTERRUPT
383
0344                         TSTMOD EQU CLOCK+31 TEST MODE REGISTER
384
0345                                ENDIF RTCOPT
385
0345                                ENDIF RTCOPT
386
0346                         *
387
0347                                IFD TRAOPT
388
0348                         *
389
0349                         **************************************************
390
0350                         * PIA INTERRUPT TIMER
391
0351                         **************************************************
392
0352                         *
393
0353                         ** PIA INTERRUPT TIMER SITS ON PORT 7
394
0354                         *
395
0355                         ** PIA TIMER FOR SINGLE STEP / TRACE
396
0356                         *
397
0357                         * TADATA = Output = Timer preset register
398
0358                         * TACTRL - CA1 = input = rising edge = NMI
399
0359                         *        - CA2 = Output = Timer Reset (Active High)
400
0360                         * TBDATA = Input = Timer read back register
401
0361                         * TBCTRL - CB1 = input = rising edge = FIRQ
402
0362                         *        - CB2 = output = strobe low on write to TBDATA = Timer Preset
403
0363                         *
404
0364                         * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
405
0365                         * CRA1 = 1 CA1 Rising edge IRQ
406
0366                         * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
407
0367                         * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
408
0368                         * CRA4 = 1 ] CA2 = Set/Reset output
409
0369                         * CRA5 = 1 ]
410
0370                         * CRA6 = X CA2 Input Interrupt Flag
411
0371                         * CRA7 = X CA1 Interrupt Flag
412 218 davidgb
0372                         *
413 221 davidgb
0373                         * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
414
0374                         * CRB1 = 1 CB1 Rising edge IRQ
415
0375                         * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
416
0376                         * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
417
0377                         * CRB4 = 1 ] CB2 = Set/Reset output
418
0378                         * CRB5 = 1 ]
419
0379                         * CRB6 = X CB2 Input Interrupt Flag
420
0380                         * CRB7 = X CB1 Interrupt Flag
421 218 davidgb
0381                         *
422 221 davidgb
0382                         * DDRA = 0 TADATA = Input, DDRA = 1 TADATA = Output
423
0383                         * DDRB = 0 TBDATA = Input, DDRB = 1 TBDATA = Output
424 218 davidgb
0384                         *
425 221 davidgb
0385                         TADATA EQU MONIO+$70 Timer preset port
426
0386                         TACTRL EQU MONIO+$71
427
0387                         TBDATA EQU MONIO+$72 Timer read back port
428
0388                         TBCTRL EQU MONIO+$73
429 218 davidgb
0389                         *
430 221 davidgb
0390                         TRADEL EQU 13  Number of E cycles for RTI (May need to be fudged)
431
0391                         *
432
0392                                ENDIF TRAOPT
433
0392                                ENDIF TRAOPT
434
0393                                IFD ADSOPT
435
0394                         *
436
0395                         ***************************************************
437
0396                         *   SERIAL PORT FOR DG640                         *
438
0397                         ***************************************************
439 218 davidgb
0398                         *
440 221 davidgb
0399                         ** SET UP FOR ACKERMAN DIGITAL ADS6809
441
0400                         ** THE ADS6809 S100 BOAD HAS AN ON BOARD ACIA
442
0401                         *
443
0402                         ACIAS   EQU   MONIO+$400   CONTROL PORT
444 218 davidgb
0403                         *
445 221 davidgb
0404                                 ENDIF ADSOPT
446
0404                                 ENDIF ADSOPT
447
0405                                 IFD PRTOPT
448
0406                         *
449
0407                         ***************************************************
450
0408                         * PRINTER INTERFACE                               *
451
0409                         ***************************************************
452
0410                         *
453
0411                         PADATA EQU MONIO+$404
454
0412                         PACTRL EQU MONIO+$405
455
0413                         PBDATA EQU MONIO+$406
456
0414                         PBCTRL EQU MONIO+$407
457
0415                         *
458
0416                         ** CB1  ACK.  I/P
459
0417                         ** CB2  STB.  O/P
460
0418                         ** PB0 - PB7   DATA 1 - 8   O/P
461
0419                         ** PORT A BIT ASSIGNMENT
462
0420                         *
463
0421                         PBUSY  EQU $80 I/P
464
0422                         PEMPTY EQU $40 I/P
465
0423                         SELECT EQU $20 I/P
466
0424                         PERROR EQU $10 I/P
467
0425                         PRESET EQU %00000100 O/P PA3 = 0
468
0426                         AUTOFD EQU %00001000 O/P PA2 = 0
469
0427                         DIRMSK EQU %00001100
470
0428                                ENDIF PRTOPT
471
0428                                ENDIF PRTOPT
472
0429                                IFD DG640OPT
473
0430                         *
474
0431                         ***************************************************
475
0432                         *   DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES  *
476
0433                         ***************************************************
477
0434                         *
478
0435                         ** VIDEO DISPLAY DEFINITIONS
479
0436                         *
480
0437                         SCREEN  EQU   MONIO+$0800 START OF SCREEN MEMORY
481
0438                         LINLEN  EQU   64          LENGTH OF A LINE
482
0439                         NUMLIN  EQU   16          NUMBER OF LINES
483
0440                         SCNLEN  EQU   $400        LENGTH OF SCREEN
484
0441                                 ENDIF DG640OPT
485
0441                                 ENDIF DG640OPT
486
0442                         *
487
0443                                 IFD   DMAFOPT
488
0444                         *
489
0445                         ***************************************************
490
0446                         *   DMAF2 8" DRIVE                                *
491
0447                         ***************************************************
492
0448                         *
493
0449                         ADDREG  EQU   $F000  ADDRESS REGISTER
494
0450                         CNTREG  EQU   $F002  COUNT REGISTER
495
0451                         CCREG   EQU   $F010  CHANNEL CONTROL REGISTER
496
0452                         PRIREG  EQU   $F014  DMA PRIORITY REGISTER
497
0453                         AAAREG  EQU   $F015  ???
498
0454                         BBBREG  EQU   $F016  ???
499
0455                         COMREG  EQU   $F020  1791 COMMAND REGISTER
500
0456                         SECREG  EQU   $F022  SECTOR REGISTER
501
0457                         DRVREG  EQU   $F024  DRIVE SELECT LATCH
502
0458                         CCCREG  EQU   $F040  ???
503
0459                                 ENDIF DMAFOPT
504
0459                                 ENDIF DMAFOPT
505
0460                                 IFD DATOPT
506
0461                         **************************************************
507
0462                         * DYNAMIC ADDRESS TRANSLATION REGISTERS          *
508
0463                         **************************************************
509
0464                         *
510
0465 FFF0                    IC11    EQU  $FFF0  DAT RAM CHIP
511
0466 55AA                    TSTPAT  EQU  $55AA  TEST PATTERN
512
0467                                 ENDIF DATOPT
513
0468                         *
514 218 davidgb
0003                                 END
515 221 davidgb
0000                          INCLUDE "sys09ide.asm"
516 218 davidgb
0001                         *
517
0002                         ** SYS09BUG MONITOR EXTENSIONS
518
0003                         *
519 221 davidgb
0004                         * FOR SYS09BUG ON THE XESS XSA-3S100 / XST-3.0
520 218 davidgb
0005                         * WITH I/O MAPPED AT $XE000
521 221 davidgb
0006                         * 16 BIT IDE MAPPED AT $E100
522
0007                         * AND ROM MAPPED AT $XF000
523
0008                         *
524 218 davidgb
0009                         *
525
 
526
 
527 221 davidgb
sys09ide.asm                                                                      page   2
528
0011                         *
529
0012                         ***************************************************
530
0013                         * Serial PROM register
531
0014                         ***************************************************
532
0015                         *
533
0016                         ** CONFIGURATION PROM DEFINITIONS
534
0017                         *
535
0018 E0C0                    PROMREG EQU MONIO+$C0
536
0019 0001                    PCLKHI  EQU $01     Toggle PROM Clock High
537
0020 0000                    PCLKLO  EQU $00     Toggle PROM Clock Low
538
0021 0002                    PRSTHI  EQU $02     Toggle PROM Reset High
539
0022 0000                    PRSTLO  EQU $00     Toggle PROM Reset Low
540
0023 AA55                    SYNCHI  EQU $AA55   Synch Pattern High Word
541
0024 FF00                    SYNCLO  EQU $FF00   Synch Pattern Low Word
542
0025                         *
543 218 davidgb
0026                         *
544 221 davidgb
0027                         ***************************************************
545
0028                         *   START OF ROM                                  *
546
0029                         ***************************************************
547
0030                         *
548
0031 F800                    MONITV EQU MONROM+0  FDB MONITOR
549
0032 F802                    NXTCMV EQU MONROM+2  FDB NEXTCMD
550
0033 F804                    INCHV  EQU MONROM+4  FDB INCH
551
0034 F806                    INCHEV EQU MONROM+6  FDB INCHE
552
0035 F808                    INCHKV EQU MONROM+8  FDB INCHEK
553
0036 F80A                    OUTCHV EQU MONROM+10 FDB OUTCH
554
0037 F80C                    PDATAV EQU MONROM+12 FDB PDATA
555
0038 F80E                    PCRLFV EQU MONROM+14 FDB PCRLF
556
0039 F810                    PSTRGV EQU MONROM+16 FDB PSTRNG
557
0040 F812                    LRAV   EQU MONROM+18 FDB LRA
558
0041                         *
559
0042                         * Condition code flags
560
0043                         *
561
0044 0001                    CFLAG   EQU $01     CARRY FLAG
562
0045 0002                    VFLAG   EQU $02     OVERFLOW FLAG
563
0046 0004                    ZFLAG   EQU $04     ZERO FLAG
564
0047 0008                    NFLAG   EQU $08     NEGATIVE FLAG
565
0048 0010                    IFLAG   EQU $10     IRQ MASK CC
566
0049 0020                    HFLAG   EQU $20     HALF CARRY
567
0050 0040                    FFLAG   EQU $40     FIRQ MASK CC
568
0051 0080                    EFLAG   EQU $80     ENTIRE FLAG
569
0052                         *
570
0053                         * Serial Port
571
0054                         *
572
0055 E000                    ACIAC1  EQU ACIAS
573
0056 E001                    ACIAD1  EQU ACIAS+1
574
0057 04E2                    DELCON  EQU 1250    Delay (Processor clock in MHz * 50)
575
0058                         *
576
0059                         * XMODEM Control characters
577
0060                         *
578
0061 0001                    SOH     EQU $01
579
0062 0004                    EOT     EQU $04
580
0063 0006                    ACK     EQU $06
581
0064 0015                    NAK     EQU $15
582
0065 0018                    CAN     EQU $18
583
0066                         *
584
0067                         * Some Disk Constants
585
0068                         *
586
0069 0100                    RMAXTRK EQU 256
587
0070 00FF                    RMAXSEC EQU 255
588
0071 FE01                    RTOTSEC EQU RMAXTRK*RMAXSEC-RMAXSEC
589
0072                         *
590
0073                         * RAM SPACE
591
0074                         *
592
0075                         * PUT THIS DOWN THE BOTTOM OF MEMORY
593
0076                         *
594
0077 0100                            ORG  $0100
595
0078 0100                    DRVNUM  RMB 1
596
0079 0101                    TRACK   RMB 1
597
0080 0102                    SECTOR  RMB 1
598
0081 0103                    CHKSUM  RMB 1
599
0082 0104                    BLKNUM  RMB 1 Xmodem block number
600
0083 0105                    BYTCNT  RMB 1 Xmodem byte count
601
0084 0106                    XSTATE  RMB 2 Xmodem State Vector
602
0085 0108                    DELCNT  RMB 3  $00,$00,$00 Xmodem Poll timer
603
0086 010B                    MAXTRK  RMB 1
604
0087 010C                    MAXSEC  RMB 1
605
0088 0200                            ORG  $0200
606
0089                         *
607
0090                         * SECTOR BUFFER
608
0091                         *
609
0092 0200                    BUFFER  RMB  256
610
0093                         *
611
0094                         ****************************************
612
0095                         *
613
0096                         * START OF EXTENSION COMMANDS
614
0097                         *
615
0098                         ****************************************
616
0099                         *
617
0100 F000                            ORG MONEXT
618
0101 F000 F0 02                      FDB NEXTEXT   Jump to next extended command
619
0102                         *
620
0103                         ***** NEXTCMD *****
621
0104                         *
622
0105 F002 AD 9F F8 06        NEXTEXT JSR [INCHEV]  GET ONE CHAR. FROM TERMINAL
623
0106 F006 84 7F                      ANDA #$7F STRIP PARITY FROM CHAR.
624
0107 F008 1F 89                      TFR  A,B
625
0108 F00A 86 20                      LDA  #$20
626
0109 F00C AD 9F F8 0A                JSR [OUTCHV] PRNT SPACE
627
0110 F010 C1 60                      CMPB #$60
628
0111 F012 2F 02                      BLE NXTEX0
629
0112 F014 C0 20                      SUBB #$20
630
0113                         *
631
0114                         ***** DO TABLE LOOKUP *****
632
0115                         *   FOR COMMAND FUNCTIONS
633
0116                         *
634
0117 F016 8E F0 2C           NXTEX0  LDX #EXTTAB    POINT TO JUMP TABLE
635
0118 F019 E1 80              NXTEX1  CMPB ,X+       DOES COMMAND MATCH TABLE ENTRY ?
636
0119 F01B 27 0D                      BEQ  JMPEXT    BRANCH IF MATCH FOUND
637
0120 F01D 30 02                      LEAX 2,X       POINT TO NEXT ENTRY IN TABLE
638
0121 F01F 8C F0 35                   CMPX #EXTEND   REACHED END OF TABLE YET ?
639
0122 F022 26 F5                      BNE  NXTEX1    IF NOT END, CHECK NEXT ENTRY
640
0123 F024 8E F0 35                   LDX  #MSGWHAT  POINT TO MSG "WHAT?"
641
0124 F027 16 02 29                   LBRA PDATA1    PRINT MSG AND RETURN
642
0125 F02A 6E 94              JMPEXT  JMP  [,X]      JUMP TO COMMAND ROUTINE
643
0126                         *
644
0127                         * EXTENDED COMMAND JUMP TABLE
645
0128                         *
646
0129 F02C                    EXTTAB EQU *
647
0130 F02C 42                        FCC 'B'   BOOT FLEX
648
0131 F02D F0 3E                     FDB UBSUB
649
0132 F02F 46                        FCC 'F'   FORMAT IDE DISK
650
0133 F030 F0 EA                     FDB UFSUB
651
0134 F032 58                        FCC 'X'   XMODEM ROM DISK UPLOAD
652
0135 F033 F2 BC                     FDB UXSUB
653
0136                         *
654
0137 F035                    EXTEND EQU *
655
0138                         *
656
0139 F035 57 48 41 54 20 3F  MSGWHAT FCC "WHAT ?"
657
0140 F03B 0A 0D 04                   FCB $0A,$0D,$04
658
0141                         *
659
0142                         * GO TO FLEX RESIDENT IN MEMORY
660
0143                         *
661
0144 F03E 8E CD 00           UBSUB   LDX #$CD00
662
0145 F041 AF 4A                      STX 10,U
663
0146 F043 1F 34                      TFR  U,S
664
0147 F045 3B                         RTI
665
0148                         *
666
0149                         * recieve char from remote drive.
667
0150                         * timeout if no response for approx 1s.
668
0151                         * Entry: no parameters
669
0152                         * Exit:  (A) = recieved char, (C)=1 if valid char, (C)=0 if timeout.
670
0153                         *
671
0154 F046 34 30              RCHAR   PSHS    X,Y
672
0155                         *
673
0156 F048 8E 03 E8                   LDX     #1000         1000x inner loop
674
0157 F04B 10 8E 04 E2        RCHAR1  LDY     #DELCON       delay constant for inner loop (approx 1ms).
675
0158 F04F B6 E0 00           RCHAR2  LDA     ACIAC1        test for recieved char
676
0159 F052 47                         ASRA
677
0160 F053 25 0A                      BCS     RCHAR3        get character
678
0161 F055 31 3F                      LEAY    -1,Y          else, continue to count delay
679
0162 F057 26 F6                      BNE     RCHAR2
680
0163 F059 30 1F                      LEAX    -1,X
681
0164 F05B 26 EE                      BNE     RCHAR1
682
0165 F05D 35 B0                      PULS    X,Y,PC        return with error if timed out
683
0166                         *
684
0167 F05F B6 E0 01           RCHAR3  LDA     ACIAD1        return data (carry bit still set)
685
0168 F062 35 B0                      PULS    X,Y,PC
686
0169                         *
687 218 davidgb
0170                         *
688 221 davidgb
0171                         * transmit char to remote drive.
689
0172                         * timeout if no response for approx 1s. (allows for use of hardware flow control)
690
0173                         * Entry: (A) = char to transmit
691
0174                         * Exit:  (A) = recieved char, (C)=1 if valid char, (C)=0 if timeout.
692
0175                         *
693
0176 F064 34 30              SCHAR   PSHS    X,Y
694
0177 F066 34 02                      PSHS    A
695
0178                         *
696
0179 F068 8E 03 E8                   LDX     #1000         1000x inner loop
697
0180 F06B 10 8E 04 E2        SCHAR1  LDY     #DELCON       delay constant for inner loop (approx 1ms).
698
0181 F06F B6 E0 00           SCHAR2  LDA     ACIAC1        test for space in transmit FIFO
699
0182 F072 47                         ASRA
700
0183 F073 47                         ASRA
701
0184 F074 25 0C                      BCS     SCHAR3        send character
702
0185 F076 31 3F                      LEAY    -1,Y          else, continue to count delay
703
0186 F078 26 F5                      BNE     SCHAR2
704
0187 F07A 30 1F                      LEAX    -1,X
705
0188 F07C 26 ED                      BNE     SCHAR1
706
0189 F07E 35 02                      PULS    A
707
0190 F080 35 B0                      PULS    X,Y,PC        return with error if timed out
708
0191                         *
709
0192 F082 35 02              SCHAR3  PULS    A
710
0193 F084 B7 E0 01                   STA     ACIAD1        send data (carry bit still set)
711
0194 F087 35 B0                      PULS    X,Y,PC
712
0195                         *
713
0196                         ** 'UF' Format IDE Drive to FLEX standard.
714
0197                         *
715
0198 F089 0A 0D              DISFOS  FCB $0A,$0D
716
0199 F08B 46 6F 72 6D 61 74          FCC 'Formating IDE disk... '
717 218 davidgb
          69 6E 67 20 49 44
718
          45 20 64 69 73 6B
719
          2E 2E 2E 20
720 221 davidgb
0200 F0A1 0A 0D                      FCB $0A,$0D
721
0201 F0A3 44 72 69 76 65 20          FCC 'Drive Number ?'
722 218 davidgb
          4E 75 6D 62 65 72
723
          20 3F
724 221 davidgb
0202 F0B1 04                         FCB 4
725
0203 F0B2 0A 0D 04           MESS6   FCB $0A,$0D,4
726
0204 F0B5 49 44 45 20 64 72          FCC 'IDE drive not allocated! '
727 218 davidgb
          69 76 65 20 6E 6F
728
          74 20 61 6C 6C 6F
729
          63 61 74 65 64 21
730
          20
731 221 davidgb
0205 F0CE 04                    FCB 4
732
0206 F0CF 0A 0D              UFMSG1  FCB $0A,$0D
733
0207 F0D1 46 6F 72 6D 61 74          FCC 'Format Complete'
734 218 davidgb
          20 43 6F 6D 70 6C
735
          65 74 65
736 221 davidgb
0208 F0E0 04                         FCB 4
737
0209 F0E1 49 44 45 44 49 53  VOLMSG  FCC 'IDEDISK '
738 218 davidgb
          4B 20
739 221 davidgb
0210 F0E9 04                         FCB 4
740
0211                         *
741
0212 F0EA BD F4 BD           UFSUB   JSR  INITDR
742
0213 F0ED 8E F0 89                   LDX #DISFOS
743
0214 F0F0 BD F2 53                   JSR PDATA1
744
0215 F0F3 17 FF 50           UFSUB1  LBSR RCHAR
745
0216 F0F6 24 FB                      BCC  UFSUB1
746
0217 F0F8 17 FF 69                   LBSR SCHAR
747
0218 F0FB 81 30                      CMPA #'0'
748
0219 F0FD 10 25 00 EF                LBLO UFEXIT
749
0220 F101 81 33                      CMPA #'3'
750
0221 F103 10 22 00 E9                LBHI  UFEXIT
751
0222 F107 80 30                      SUBA #'0'
752
0223 F109 1F 89                      TFR  A,B
753
0224 F10B F7 01 00                   STB DRVNUM
754
0225 F10E 8E 00 FD                   LDX #DRVNUM-3
755
0226 F111 BD F5 3A                   JSR DRVSEL
756
0227                         *
757
0228                         * set up free chain
758
0229                         *
759
0230 F114 8E 02 00                   LDX #BUFFER clear out buffer
760
0231 F117 4F                         CLRA
761
0232 F118 5F                         CLRB
762
0233 F119 A7 80              DFL1    STA 0,X+
763
0234 F11B 5A                         DECB
764
0235 F11C 26 FB                      BNE DFL1
765
0236                         *
766
0237 F11E 7F 01 01                   CLR TRACK
767
0238 F121 86 01                      LDA #1
768
0239 F123 B7 01 02                   STA SECTOR
769
0240 F126 8E 02 00           DFL2    LDX #BUFFER
770
0241 F129 B6 01 01                   LDA TRACK
771
0242 F12C A7 84                      STA 0,X
772
0243 F12E B6 01 02                   LDA SECTOR
773
0244 F131 4C                         INCA
774
0245 F132 81 00                      CMPA #RMAXSEC+1 last sector on track?
775
0246 F134 26 04                      BNE DFL3
776
0247 F136 6C 84                      INC 0,X
777
0248 F138 86 01                      LDA #1
778
0249 F13A A7 01              DFL3    STA 1,X
779
0250 F13C B6 01 01                   LDA TRACK
780
0251 F13F F6 01 02                   LDB SECTOR
781
0252 F142 BD F5 15                   JSR WRITSC
782
0253 F145 7C 01 02                   INC SECTOR
783
0254 F148 B6 01 02                   LDA SECTOR
784
0255 F14B 81 00                      CMPA #RMAXSEC+1
785
0256 F14D 26 D7                      BNE DFL2
786
0257 F14F 86 01                      LDA #1
787
0258 F151 B7 01 02                   STA  SECTOR
788
0259 F154 7C 01 01                   INC TRACK
789
0260 F157 B6 01 01                   LDA TRACK
790
0261 F15A 81 00                      CMPA #RMAXTRK
791
0262 F15C 26 C8                      BNE DFL2
792
0263                         * break free chain at last track/sector
793
0264 F15E 8E 02 00                   LDX  #BUFFER
794
0265 F161 86 FF                      LDA  #RMAXTRK-1
795
0266 F163 C6 FF                      LDB  #RMAXSEC
796
0267 F165 BD F4 F1                   JSR  READSC
797
0268 F168 8E 02 00                   LDX  #BUFFER
798
0269 F16B 6F 84                      CLR  0,X
799
0270 F16D 6F 01                      CLR  1,X
800
0271 F16F 86 FF                      LDA  #RMAXTRK-1
801
0272 F171 C6 FF                      LDB  #RMAXSEC
802
0273 F173 BD F5 15                   JSR  WRITSC
803
0274                         * set up sector structure, SIR, directory etc
804
0275 F176 8E 02 00                   LDX  #BUFFER
805
0276 F179 4F                         CLRA
806
0277 F17A C6 FF                      LDB  #RMAXSEC
807
0278 F17C BD F4 F1                   JSR  READSC
808
0279 F17F 8E 02 00                   LDX  #BUFFER
809
0280 F182 6F 84                      CLR  0,X break end of directory chain
810
0281 F184 6F 01                      CLR  1,X
811
0282 F186 4F                         CLRA
812
0283 F187 C6 FF                      LDB  #RMAXSEC
813
0284 F189 BD F5 15                   JSR  WRITSC
814
0285                         *
815
0286 F18C 8E 02 00                   LDX  #BUFFER
816
0287 F18F 4F                         CLRA
817
0288 F190 C6 03                      LDB  #3 set up SIR
818
0289 F192 BD F4 F1                   JSR  READSC
819
0290 F195 8E 02 00                   LDX  #BUFFER
820
0291 F198 6F 84                      CLR  0,X break forward link
821
0292 F19A 6F 01                      CLR  1,X
822
0293                         *
823
0294 F19C 34 20                      PSHS Y
824
0295 F19E 10 8E F0 E1                LDY  #VOLMSG
825
0296 F1A2 C6 10                      LDB  #16
826
0297 F1A4 A6 A0              DFL4    LDA  ,Y+
827
0298 F1A6 A7 85                      STA  B,X
828
0299 F1A8 5C                         INCB
829
0300 F1A9 C1 18                      CMPB #24
830
0301 F1AB 26 F7                      BNE  DFL4
831
0302 F1AD 35 20                      PULS Y
832
0303                         *
833
0304 F1AF 4F                         CLRA
834
0305 F1B0 F6 01 00                   LDB  DRVNUM volume number
835
0306 F1B3 ED 88 1B                   STD  27,X
836
0307                         *
837
0308 F1B6 CC 01 01                   LDD  #$0101 first trk/sec  01-01
838
0309 F1B9 ED 88 1D                   STD  29,X
839
0310 F1BC 86 FF                      LDA  #RMAXTRK-1
840
0311 F1BE C6 FF                      LDB  #RMAXSEC
841
0312 F1C0 ED 88 1F                   STD  31,X
842
0313 F1C3 ED 88 26                   STD  38,X
843
0314 F1C6 CC FE 01                   LDD  #RTOTSEC total DATA sectors (2912-14)
844
0315 F1C9 ED 88 21                   STD  33,X
845
0316                         *
846
0317 F1CC 86 01                      LDA #01 month   set default creation date (SYS09's birthday!)
847
0318 F1CE A7 88 23                   STA 35,X
848
0319 F1D1 86 07                      LDA #07 day
849
0320 F1D3 A7 88 24                   STA 36,X
850
0321 F1D6 86 07                      LDA #07 year
851
0322 F1D8 A7 88 25                   STA 37,X
852
0323                         *
853
0324 F1DB 4F                 RF3     CLRA
854
0325 F1DC C6 03                      LDB  #3
855
0326 F1DE BD F5 15                   JSR  WRITSC
856
0327                         *
857
0328                         * Not sure what this is about
858
0329                         * put bootstrap on track 0 sector 1
859
0330                         *
860
0331                         *        LDX #BUFFER
861
0332                         *        CLRA
862
0333                         *        LDB #1
863
0334                         *        JSR READSC
864
0335                         *        LDX #BUFFER
865
0336                         *        LDA #$AA set the init flag
866
0337                         *        STA 0,X
867
0338                         *        LDA  #$55
868
0339                         *        STA 1,X
869
0340                         *        CLRA
870
0341                         *        LDB #1
871
0342                         *        JSR WRITSC
872
0343                         *
873
0344                         *  Write Boot sector
874
0345                         *
875
0346 F1E1 8E F7 00                   LDX  #BOOT
876
0347 F1E4 4F                         CLRA         TRACK 0
877
0348 F1E5 C6 01                      LDB  #$01    SECTOR 1
878
0349 F1E7 B7 01 01                   STA  TRACK
879
0350 F1EA F7 01 02                   STB  SECTOR
880
0351 F1ED 17 03 25                   LBSR WRITSC
881
0352                         *
882
0353 F1F0 8E F0 CF           UFEXIT  LDX #UFMSG1
883
0354 F1F3 7E F2 53                   JMP PDATA1
884
0355                         *
885
0356                         * ACIA INPUT TEST
886
0357                         *
887
0358 F1F6 B6 E0 00           INTEST  LDA ACIAC1
888
0359 F1F9 85 01                      BITA #$01
889
0360 F1FB 39                         RTS
890
0361                         *
891
0362                         * RESET ACIA
892
0363                         *
893
0364 F1FC 86 03              ACIRST  LDA #$03 master reset
894
0365 F1FE B7 E0 00                   STA  ACIAC1
895
0366 F201 86 11                      LDA #$11
896
0367 F203 B7 E0 00                   STA ACIAC1
897
0368 F206 39                         RTS
898
0369                         *
899
0370                         * ACIA INPUT
900
0371                         *
901
0372 F207 86 10              INTER   LDA  #16
902
0373 F209 B7 01 08                   STA  DELCNT+0
903
0374 F20C 7F 01 09                   CLR  DELCNT+1
904
0375 F20F 7F 01 0A                   CLR  DELCNT+2
905
0376 F212 B6 E0 00           INTER0  LDA  ACIAC1
906
0377 F215 85 01                      BITA #$01
907
0378 F217 26 08                      BNE  INTER1
908
0379 F219 85 78                      BITA #$78
909
0380 F21B 27 0A                      BEQ  INTER2
910
0381 F21D 8D DD                      BSR  ACIRST
911
0382 F21F 20 E6                      BRA  INTER
912
0383                         *
913
0384 F221 B6 E0 01           INTER1  LDA  ACIAD1
914
0385 F224 1C FD                      ANDCC #$FF-VFLAG
915
0386 F226 39                         RTS
916
0387                         *
917
0388 F227 7A 01 0A           INTER2  DEC  DELCNT+2
918
0389 F22A 26 E6                      BNE  INTER0
919
0390 F22C 7A 01 09                   DEC  DELCNT+1
920
0391 F22F 26 E1                      BNE  INTER0
921
0392 F231 7A 01 08                   DEC  DELCNT+0
922
0393 F234 26 DC                      BNE  INTER0
923
0394 F236 4F                         CLRA
924
0395 F237 1A 02                      ORCC #VFLAG
925
0396 F239 39                         RTS
926
0397                         *
927
0398                         * ACIA OUTPUT
928
0399                         *
929
0400 F23A 34 02              OUTTER  PSHS A
930
0401                         *
931
0402 F23C B6 E0 00           OUTTE1  LDA ACIAC1
932
0403 F23F 85 02                      BITA #$02
933
0404 F241 26 08                      BNE  OUTTE2
934
0405 F243 85 78                      BITA #$78
935
0406 F245 27 F5                      BEQ  OUTTE1
936
0407 F247 8D B3                      BSR  ACIRST
937
0408 F249 20 F1                      BRA  OUTTE1
938
0409                         *
939
0410 F24B 35 02              OUTTE2  PULS A
940
0411 F24D B7 E0 01                   STA ACIAD1
941
0412 F250 39                         RTS
942
0413                         *
943
0414                         * Print Data
944
0415                         *
945
0416 F251 8D E7              PDATA0  BSR  OUTTER
946
0417 F253 A6 80              PDATA1  LDA  ,X+
947
0418 F255 81 04                      CMPA #$04
948
0419 F257 26 F8                      BNE  PDATA0
949
0420 F259 39                         RTS
950
0421                         *
951 218 davidgb
0422                         *
952 221 davidgb
0423                         ** 'UX' Xmodem IDE Disk upload
953
0424                         *
954
0425 F25A 0D 0A              UXMES0  FCB $0D,$0A
955
0426 F25C 58 6D 6F 64 65 6D          FCC 'Xmodem IDE Disk Upload'
956 218 davidgb
          20 49 44 45 20 44
957
          69 73 6B 20 55 70
958
          6C 6F 61 64
959 221 davidgb
0427 F272 04                         FCB 4
960
0428 F273 0D 0A              UXMES1  FCB $0D,$0A
961
0429 F275 55 70 6C 6F 61 64          FCC 'Upload Complete'
962 218 davidgb
          20 43 6F 6D 70 6C
963
          65 74 65
964 221 davidgb
0430 F284 04                         FCB 4
965
0431 F285 0D 0A              UXMES2  FCB $0D,$0A
966
0432 F287 55 70 6C 6F 61 64          FCC 'Upload Error'
967 218 davidgb
          20 45 72 72 6F 72
968 221 davidgb
0433 F293 04                         FCB 4
969
0434 F294 0D 0A              UXMSG3  FCB $0D,$0A
970
0435 F296 44 72 69 76 65 20          FCC 'Drive Number :'
971 218 davidgb
          4E 75 6D 62 65 72
972
          20 3A
973 221 davidgb
0436 F2A4 04                         FCB 4
974
0437 F2A5 0D 0A              UXMSG4  FCB $0D,$0A
975
0438 F2A7 41 72 65 20 59 6F          FCC 'Are You Sure ? (Y/N)'
976 218 davidgb
          75 20 53 75 72 65
977
          20 3F 20 28 59 2F
978
          4E 29
979 221 davidgb
0439 F2BB 04                         FCB 4
980
0440                         *
981
0441                         * Print Banner
982
0442                         *
983
0443 F2BC 8E F2 5A           UXSUB   LDX #UXMES0
984
0444 F2BF 17 FF 91                   LBSR PDATA1
985
0445                         *
986
0446                         * Prompt for Disk drive number (0 to 3)
987
0447                         *
988
0448 F2C2 8E F2 94                   LDX #UXMSG3
989
0449 F2C5 17 FF 8B                   LBSR PDATA1
990
0450 F2C8 17 FF 3C           UXSUB1  LBSR INTER
991
0451 F2CB 29 FB                      BVS  UXSUB1
992
0452 F2CD 17 FF 6A                   LBSR OUTTER
993
0453 F2D0 81 30                      CMPA #'0
994
0454 F2D2 10 25 01 2E                LBLO UXEXIT
995
0455 F2D6 81 33                      CMPA #'3
996
0456 F2D8 10 22 01 28                LBHI UXEXIT
997
0457 F2DC 80 30                      SUBA #'0
998
0458 F2DE B7 01 00                   STA  DRVNUM
999
0459                         *
1000
0460                         * Report selected drive
1001
0461                         *
1002
0462 F2E1 8E F2 94                   LDX #UXMSG3
1003
0463 F2E4 17 FF 6C                   LBSR PDATA1
1004
0464 F2E7 B6 01 00                   LDA  DRVNUM
1005
0465 F2EA 8B 30                      ADDA #'0
1006
0466 F2EC 17 FF 4B                   LBSR OUTTER
1007
0467                         *
1008
0468                         * Ask for confirmation (Y/N)
1009
0469                         *
1010
0470 F2EF 8E F2 A5                   LDX #UXMSG4
1011
0471 F2F2 17 FF 5E                   LBSR PDATA1
1012
0472 F2F5 17 FF 0F           UXSUB2  LBSR INTER
1013
0473 F2F8 29 FB                      BVS  UXSUB2
1014
0474 F2FA 17 FF 3D                   LBSR OUTTER
1015
0475 F2FD 84 5F                      ANDA #$5F
1016
0476 F2FF 81 4E                      CMPA #'N
1017
0477 F301 10 27 00 FF                LBEQ UXEXIT
1018
0478 F305 81 59                      CMPA #'Y
1019
0479 F307 26 B3                      BNE  UXSUB
1020
0480                         *
1021
0481                         * We have confirmation ... now load the disk image
1022
0482                         *
1023
0483 F309 17 01 B1                   LBSR INITDR
1024
0484 F30C CE F4 2D                   LDU  #XSTST
1025
0485 F30F FF 01 06                   STU  XSTATE
1026
0486 F312 86 01                      LDA  #1
1027
0487 F314 B7 01 04                   STA  BLKNUM
1028
0488                         *
1029
0489                         * Sector1
1030
0490                         *
1031
0491 F317 8E 02 00                   LDX  #BUFFER
1032
0492                         *
1033
0493 F31A 4F                         CLRA         TRACK 0
1034
0494 F31B C6 01                      LDB  #$01    SECTOR 1
1035
0495 F31D B7 01 01                   STA  TRACK
1036
0496 F320 F7 01 02                   STB  SECTOR
1037
0497                         *
1038
0498 F323 17 00 EA                   LBSR XREAD
1039
0499 F326 10 25 00 E0                LBCS UXERR
1040
0500 F32A 17 01 87                   LBSR XACK
1041
0501 F32D 17 00 E0                   LBSR XREAD
1042
0502 F330 10 25 00 D6                LBCS UXERR
1043
0503                         *
1044
0504 F334 8E 02 00                   LDX  #BUFFER
1045
0505 F337 B6 01 01                   LDA  TRACK
1046
0506 F33A F6 01 02                   LDB  SECTOR
1047
0507 F33D 17 01 D5                   LBSR WRITSC
1048
0508 F340 17 01 71                   LBSR XACK
1049
0509                         *
1050
0510                         * Sector 2
1051
0511                         *
1052
0512 F343 8E 02 00                   LDX  #BUFFER
1053
0513                         *
1054
0514 F346 B6 01 01                   LDA  TRACK
1055
0515 F349 F6 01 02                   LDB  SECTOR
1056
0516 F34C 5C                         INCB
1057
0517 F34D B7 01 01                   STA  TRACK
1058
0518 F350 F7 01 02                   STB  SECTOR
1059
0519                         *
1060
0520 F353 17 00 BA                   LBSR XREAD
1061
0521 F356 10 25 00 B0                LBCS UXERR
1062
0522 F35A 17 01 57                   LBSR XACK
1063
0523 F35D 17 00 B0                   LBSR XREAD
1064
0524 F360 10 25 00 A6                LBCS UXERR
1065
0525                         *
1066
0526 F364 8E 02 00                   LDX  #BUFFER
1067
0527 F367 B6 01 01                   LDA  TRACK
1068
0528 F36A F6 01 02                   LDB  SECTOR
1069
0529 F36D 17 01 A5                   LBSR WRITSC
1070
0530                         *
1071
0531 F370 17 01 41                   LBSR XACK
1072
0532                         *
1073
0533                         * Sector 3 - SIR
1074
0534                         *
1075
0535 F373 8E 02 00                   LDX  #BUFFER
1076
0536                         *
1077
0537 F376 B6 01 01                   LDA  TRACK
1078
0538 F379 F6 01 02                   LDB  SECTOR
1079
0539 F37C 5C                         INCB
1080
0540 F37D B7 01 01                   STA  TRACK
1081
0541 F380 F7 01 02                   STB  SECTOR
1082
0542                         *
1083
0543 F383 17 00 8A                   LBSR XREAD
1084
0544 F386 10 25 00 80                LBCS UXERR
1085
0545 F38A 17 01 27                   LBSR XACK
1086
0546 F38D 17 00 80                   LBSR XREAD
1087
0547 F390 10 25 00 76                LBCS UXERR
1088
0548                         *
1089
0549 F394 8E 02 00                   LDX  #BUFFER
1090
0550 F397 A6 88 26                   LDA  38,X
1091
0551 F39A 4C                         INCA
1092
0552 F39B B7 01 0B                   STA  MAXTRK
1093
0553 F39E E6 88 27                   LDB  39,X
1094
0554 F3A1 5C                         INCB
1095
0555 F3A2 F7 01 0C                   STB  MAXSEC
1096
0556 F3A5 B6 01 01                   LDA  TRACK
1097
0557 F3A8 F6 01 02                   LDB  SECTOR
1098
0558 F3AB 17 01 67                   LBSR WRITSC
1099
0559                         *
1100
0560 F3AE 17 01 03                   LBSR XACK
1101
0561                         *
1102
0562                         * Sector 4 to Last Track & Sector
1103
0563                         *
1104 218 davidgb
0564                         *
1105 221 davidgb
0565 F3B1 B6 01 01                   LDA  TRACK
1106
0566 F3B4 F6 01 02                   LDB  SECTOR
1107
0567 F3B7 5C                         INCB
1108
0568                         *
1109
0569 F3B8 8E 02 00           UXLOOP  LDX  #BUFFER
1110
0570 F3BB B7 01 01                   STA  TRACK
1111
0571 F3BE F7 01 02                   STB  SECTOR
1112
0572                         *
1113
0573 F3C1 17 00 4C                   LBSR XREAD
1114
0574 F3C4 10 25 00 42                LBCS UXERR
1115
0575 F3C8 17 00 E9                   LBSR XACK
1116
0576 F3CB 17 00 42                   LBSR XREAD
1117
0577 F3CE 10 25 00 38                LBCS UXERR
1118
0578                         *
1119
0579 F3D2 8E 02 00                   LDX  #BUFFER
1120
0580 F3D5 B6 01 01                   LDA  TRACK
1121
0581 F3D8 F6 01 02                   LDB  SECTOR
1122
0582 F3DB 17 01 37                   LBSR WRITSC
1123
0583 F3DE 17 00 D3                   LBSR XACK
1124
0584                         *
1125
0585 F3E1 B6 01 01                   LDA  TRACK
1126
0586 F3E4 F6 01 02                   LDB  SECTOR
1127
0587 F3E7 5C                         INCB
1128
0588 F3E8 F1 01 0C                   CMPB MAXSEC
1129
0589 F3EB 26 CB                      BNE  UXLOOP
1130
0590 F3ED C6 01                      LDB  #1
1131
0591 F3EF 4C                         INCA
1132
0592 F3F0 B1 01 0B                   CMPA MAXTRK
1133
0593 F3F3 26 C3                      BNE  UXLOOP
1134
0594                         *
1135 218 davidgb
0595                         *
1136 221 davidgb
0596                         *  Write Boot sector
1137
0597                         *
1138
0598 F3F5 8E F7 00                   LDX  #BOOT
1139
0599 F3F8 4F                         CLRA         TRACK 0
1140
0600 F3F9 C6 01                      LDB  #$01    SECTOR 1
1141
0601 F3FB B7 01 01                   STA  TRACK
1142
0602 F3FE F7 01 02                   STB  SECTOR
1143
0603 F401 17 01 11                   LBSR WRITSC
1144
0604                         *
1145
0605 F404 8E F2 73           UXEXIT  LDX  #UXMES1
1146
0606 F407 7E F2 53                   JMP  PDATA1
1147
0607                         *
1148
0608 F40A 8E F2 85           UXERR   LDX  #UXMES2
1149
0609 F40D 16 FE 43                   LBRA PDATA1
1150
0610                         *
1151
0611                         * Get a Byte using XModem protocol
1152
0612                         * Carry clear => no errors
1153
0613                         * Carry set   => errors
1154
0614                         *
1155
0615 F410 34 40              XREAD   PSHS U
1156
0616 F412 FE 01 06                   LDU  XSTATE
1157
0617                         *
1158
0618 F415 17 FD EF           XBYTE0  LBSR INTER
1159
0619 F418 28 0A                      BVC  XBYTE1
1160
0620 F41A 86 15                      LDA  #NAK
1161
0621 F41C 17 FE 1B                   LBSR OUTTER
1162
0622 F41F CE F4 2D                   LDU  #XSTST
1163
0623 F422 20 F1                      BRA  XBYTE0
1164
0624                         *
1165
0625 F424 AD C4              XBYTE1  JSR  ,U
1166
0626 F426 26 ED                      BNE  XBYTE0
1167
0627 F428 FF 01 06                   STU  XSTATE
1168
0628 F42B 35 C0                      PULS U,PC
1169
0629                         *
1170
0630                         * START - LOOK FOR SOH (START OF HEADER) = $01
1171
0631                         *
1172
0632 F42D 81 01              XSTST   CMPA #SOH
1173
0633 F42F 26 06                      BNE  XSTST1
1174
0634 F431 CE F4 4D                   LDU  #XSTBL
1175
0635 F434 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, no valid data (no exit)
1176
0636 F436 39                         RTS
1177
0637                         *
1178
0638 F437 81 04              XSTST1  CMPA #EOT
1179
0639 F439 26 08                      BNE  XSTST2
1180
0640 F43B 86 06                      LDA  #ACK
1181
0641 F43D 17 FD FA                   LBSR OUTTER
1182
0642 F440 1A 05                      ORCC  #CFLAG+ZFLAG  Set (c)=1 abort & exit
1183
0643 F442 39                         RTS
1184
0644                         *
1185
0645 F443 81 18              XSTST2  CMPA #CAN
1186
0646 F445 26 03                      BNE  XSTST3
1187
0647 F447 1A 05                      ORCC  #CFLAG+ZFLAG  Set (c)=1 abort & exit
1188
0648 F449 39                         RTS
1189
0649                         *
1190
0650 F44A 1C FA              XSTST3  ANDCC #$FF-CFLAG-ZFLAG
1191
0651 F44C 39                         RTS
1192
0652                         *
1193
0653                         * Got SOH
1194
0654                         * Now get block number
1195
0655                         *
1196
0656 F44D B1 01 04           XSTBL   CMPA BLKNUM
1197
0657 F450 26 06                      BNE  XSTBLE
1198
0658 F452 CE F4 63                   LDU  #XSTCOM
1199
0659 F455 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, No valid data (no exit)
1200
0660 F457 39                         RTS
1201
0661                         *
1202
0662                         * Error in block number
1203
0663                         *
1204
0664 F458 86 15              XSTBLE  LDA  #NAK
1205
0665 F45A 17 FD DD                   LBSR OUTTER
1206
0666 F45D CE F4 2D                   LDU  #XSTST
1207
0667 F460 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, No valid data (no exit)
1208
0668 F462 39                         RTS
1209
0669                         *
1210
0670                         * Get complement of block number
1211
0671                         *
1212
0672 F463 43                 XSTCOM  COMA
1213
0673 F464 B1 01 04                   CMPA BLKNUM
1214
0674 F467 26 EF                      BNE  XSTBLE
1215
0675 F469 7F 01 03                   CLR  CHKSUM
1216
0676 F46C 86 80                      LDA  #128
1217
0677 F46E B7 01 05                   STA  BYTCNT
1218
0678 F471 CE F4 77                   LDU  #XSTDA
1219
0679 F474 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, No valid data (no exit)
1220
0680 F476 39                         RTS
1221
0681                         *
1222
0682                         * Get data bytes
1223
0683                         *
1224
0684 F477 34 02              XSTDA   PSHS A
1225
0685 F479 BB 01 03                   ADDA CHKSUM
1226
0686 F47C B7 01 03                   STA  CHKSUM
1227
0687 F47F 35 02                      PULS A
1228
0688 F481 7A 01 05                   DEC  BYTCNT
1229
0689 F484 26 03                      BNE  XSTDA1
1230
0690 F486 CE F4 8E                   LDU  #XSTCK
1231
0691 F489 A7 80              XSTDA1  STA  ,X+
1232
0692 F48B 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, no valid data (no exit)
1233
0693 F48D 39                         RTS
1234
0694                         *
1235
0695                         * Byte count reached zero
1236
0696                         * Check checksum byte
1237
0697                         *
1238
0698 F48E B1 01 03           XSTCK   CMPA CHKSUM
1239
0699 F491 26 0B                      BNE  XSTCK1 retry if wrong checksum
1240
0700                         *
1241
0701                         * Checksum OK ...
1242
0702                         * increment block number
1243
0703                         * Don't send ACK until data written to CF
1244
0704                         *
1245
0705 F493 7C 01 04                   INC  BLKNUM
1246
0706 F496 CE F4 2D                   LDU  #XSTST
1247
0707 F499 1C FE                      ANDCC #$FF-CFLAG No abort
1248
0708 F49B 1A 04                      ORCC #ZFLAG      Valid data (exit)
1249
0709 F49D 39                         RTS
1250
0710                         *
1251
0711                         * Checksum Error detected ...
1252
0712                         * Reset Sector counter in ACCB to last 128 byte boundary
1253
0713                         * and send NAK
1254
0714                         *
1255
0715 F49E 34 04              XSTCK1  PSHS B
1256
0716 F4A0 1F 10                      TFR  X,D
1257
0717 F4A2 5A                         DECB
1258
0718 F4A3 C4 80                      ANDB #128
1259
0719 F4A5 1F 01                      TFR  D,X
1260
0720 F4A7 35 04                      PULS B
1261
0721 F4A9 86 15                      LDA  #NAK
1262
0722 F4AB 17 FD 8C           XSTCK2  LBSR OUTTER
1263
0723 F4AE CE F4 2D                   LDU  #XSTST
1264
0724 F4B1 1C FA                      ANDCC #$FF-CFLAG-ZFLAG No abort, no valid data (no exit)
1265
0725 F4B3 39                         RTS
1266
0726                         *
1267
0727                         * Acknowledge Data Received
1268
0728                         *
1269
0729 F4B4 34 02              XACK    PSHS A
1270
0730 F4B6 86 06                      LDA  #ACK
1271
0731 F4B8 17 FD 7F                   LBSR OUTTER
1272
0732 F4BB 35 82                      PULS A,PC
1273
0733                         *
1274 218 davidgb
0734                         *
1275 221 davidgb
0735                         ** FLEX 9 IDE DISK DRIVERS
1276
0736                         *
1277
0737                         * FOR SYS09BUG 1.2 ON THE XSA-3S1000
1278
0738                         * WITH I/O MAPPED AT $XE000
1279
0739                         * AND ROM MAPPED AT $XF000
1280
0740                         *
1281 218 davidgb
0741                         *
1282 221 davidgb
0742                         * INITIALIZE CF CARD FOR 8 BIT LBA MODE
1283
0743                         *
1284
0744 F4BD CC 00 06           INITDR LDD #AUXRESET
1285
0745 F4C0 FD E1 1E                  STD CF_AUX
1286
0746 F4C3 CC 00 02                  LDD #AUXRSTREL
1287
0747 F4C6 FD E1 1E                  STD CF_AUX
1288
0748 F4C9 CC 00 E0                  LDD  #HEADLBA
1289
0749 F4CC FD E1 0C                  STD  CF_HEAD
1290
0750 F4CF 16 02 D6                  LBRA WTRDY
1291
0751                         *
1292
0752                         * RESTORE DISK DRIVER (SEEK TRACK 00)
1293
0753                         *
1294
0754 F4D2 8D 66              RESTR1 BSR   DRVSEL
1295
0755 F4D4 4F                        CLRA           ; Track 0
1296
0756 F4D5 C6 01                     LDB   #$01     ; Sector 1
1297
0757                         *
1298
0758                         * Seek track and sector
1299
0759                         * A holds track number (0 - ??)
1300
0760                         * B holds sector number (1 - ??)
1301
0761                         * Sector numbers starts from 1
1302
0762                         * subtract 1 to start from sector 0 on CF
1303
0763                         *
1304
0764 F4D7 34 02              SEEKTS PSHS A
1305
0765 F4D9 4F                        CLRA
1306
0766 F4DA 5A                        DECB
1307
0767 F4DB FD E1 06                  STD  CF_SECNUM
1308
0768 F4DE E6 E4                     LDB ,S
1309
0769 F4E0 FD E1 08                  STD  CF_CYLLO
1310
0770 F4E3 F6 01 00                  LDB  DRVNUM
1311
0771 F4E6 FD E1 0A                  STD  CF_CYLHI
1312
0772 F4E9 C6 01                     LDB  #$01
1313
0773 F4EB FD E1 04                  STD  CF_SECCNT
1314
0774 F4EE 5F                        CLRB
1315
0775 F4EF 35 82                     PULS A,PC
1316
0776                         *
1317
0777                         * READ SECTORS FROM CF
1318
0778                         *
1319 218 davidgb
0779                         *
1320 221 davidgb
0780 F4F1 8D E4              READSC BSR  SEEKTS
1321
0781 F4F3 CC 00 20                  LDD  #CMDREAD ; IDE READ MULTIPLE
1322
0782 F4F6 FD E1 0E                  STD  CF_COMAND
1323
0783 F4F9 17 02 AC                  LBSR  WTRDY
1324
0784                         *
1325
0785                         * READ LOOP
1326
0786                         *
1327
0787 F4FC 34 20                     PSHS Y
1328
0788 F4FE 10 8E 01 00               LDY #256
1329
0789 F502 17 02 B2           RDLP1  LBSR  WTDRQ
1330
0790 F505 FC E1 00                  LDD  CF_DATA
1331
0791 F508 E7 80                     STB  ,X+
1332
0792 F50A 31 3F                     LEAY -1,Y
1333
0793 F50C 26 F4                     BNE  RDLP1
1334
0794 F50E 35 20                     PULS Y
1335
0795                         *
1336
0796 F510 17 02 95                  LBSR  WTRDY
1337
0797 F513 5F                        CLRB
1338
0798 F514 39                        RTS
1339
0799                         *
1340
0800                         * WRITE SECTOR TO CF
1341
0801                         *
1342
0802 F515 8D C0              WRITSC BSR  SEEKTS   ; SEEK TRACK & SECTOR
1343
0803 F517 CC 00 30                  LDD  #CMDWRITE ; IDE WRITE MULTIPLE
1344
0804 F51A FD E1 0E                  STD  CF_COMAND
1345
0805 F51D 17 02 88                  LBSR  WTRDY
1346
0806                         *
1347
0807                         * WRITE LOOP
1348
0808                         *
1349
0809 F520 34 20                     PSHS Y
1350
0810 F522 10 8E 01 00               LDY #256
1351
0811 F526 4F                        CLRA
1352
0812 F527 17 02 8D           WRTLP1 LBSR  WTDRQ
1353
0813 F52A E6 80                     LDB  ,X+
1354
0814 F52C FD E1 00                  STD  CF_DATA
1355
0815 F52F 31 3F                     LEAY -1,Y
1356
0816 F531 26 F4                     BNE  WRTLP1
1357
0817 F533 35 20                     PULS Y
1358
0818                         *
1359
0819 F535 17 02 70                  LBSR  WTRDY
1360
0820 F538 5F                        CLRB
1361
0821 F539 39                        RTS
1362
0822                         *
1363
0823                         * DRIVE SELECT DISK DRIVER
1364
0824                         *
1365
0825 F53A A6 03              DRVSEL LDA   3,X       GET DRIVE # FROM FCB
1366
0826 F53C 81 03                     CMPA  #3
1367
0827 F53E 23 01                     BLS   DRVS2     IF > 3, SET IT TO 0
1368
0828 F540 4F                        CLRA
1369
0829 F541 B7 01 00           DRVS2  STA   DRVNUM
1370
0830 F544 5F                        CLRB            ; SET Z, CLEAR C
1371
0831 F545 39                        RTS
1372
0832                         *
1373
0833                         * CHECK DRIVE READY DISK DRIVER
1374
0834                         *
1375
0835 F546 A6 03              CHKDRV LDA  3,X
1376
0836 F548 5F                        CLRB             ; CLEAR C, SET Z
1377
0837 F549 39                        RTS
1378
0838                         *******************************************************
1379
0839                         *
1380
0840                         * Bootstrap FLEX Loader
1381
0841                         *
1382
0842                         * SBUG1.8 loads the bootstap loader at $C000
1383
0843                         * however the Flex adaption manual has the
1384
0844                         * bootstrap loader residing at $C100
1385
0845                         * Bootstrap Loader is position independent code
1386
0846                         *
1387
0847                         ******************************************************
1388
0848                         *
1389
0849                         * Equates
1390
0850                         *
1391
0851 C0FF                    BSSTACK EQU $C0FF
1392
0852 C300                    SCTBUF  EQU $C300
1393
0853                         *
1394
0854                         * Start of Utility
1395
0855                         *
1396
0856 F700                            ORG MONEXT+$0700
1397
0857 F700 20 0B              BOOT    BRA BLOAD0
1398
0858 F702 00 00 00                   FCB 0,0,0
1399
0859 F705 00                 TRK     FCB 0        File start track
1400
0860 F706 00                 SCT     FCB 0        File start sector
1401
0861 F707 00                 DNS     FCB 0        Density Flag (not used)
1402
0862 F708 C0 00              TADR    FDB $C000    Transfer address
1403
0863 F70A 00 00              LADR    FDB 0        Load Address
1404
0864 F70C 00                 DRNUM   FCB 0        Drive number 0
1405
0865                         *
1406
0866 F70D 10 CE C0 FF        BLOAD0  LDS  #BSSTACK   Set up Bootstrap stack
1407
0867 F711 EC 8C F1                   LDD  TRK,PCR    Set up start track and sector
1408
0868 F714 FD C3 00                   STD  SCTBUF
1409
0869 F717 10 8E C4 00                LDY  #SCTBUF+256
1410
0870                         *
1411
0871                         * Perform actual file load
1412
0872                         *
1413
0873 F71B 8D 35              BLOAD1  BSR GETCH    Get acharcater
1414
0874 F71D 81 02                      CMPA #$02    Data record hearder ?
1415
0875 F71F 27 10                      BEQ  BLOAD2   Skip, is so
1416
0876 F721 81 16                      CMPA #$16    Xfr address hearder ?
1417
0877 F723 26 F6                      BNE BLOAD1    Loop if neither
1418
0878                         *
1419
0879                         * Get transfer address
1420
0880                         *
1421
0881 F725 8D 2B                      BSR  GETCH
1422
0882 F727 A7 8C DE                   STA  TADR,PCR
1423
0883 F72A 8D 26                      BSR  GETCH
1424
0884 F72C A7 8C DA                   STA  TADR+1,PCR
1425
0885 F72F 20 EA                      BRA  BLOAD1
1426
0886                         *
1427
0887                         * Load data record
1428
0888                         *
1429
0889 F731 8D 1F              BLOAD2 BSR  GETCH  Get load address
1430
0890 F733 A7 8C D4                  STA  LADR,PCR
1431
0891 F736 8D 1A                     BSR  GETCH
1432
0892 F738 A7 8C D0                  STA  LADR+1,PCR
1433
0893 F73B 8D 15                     BSR  GETCH  Get Bytes count
1434
0894 F73D 1F 89                     TFR  A,B
1435
0895 F73F 5D                        TSTB
1436
0896 F740 27 D9                     BEQ  BLOAD1 Loop if count = 0
1437
0897 F742 AE 8C C5                  LDX  LADR,PCR  Get load address
1438
0898 F745 34 14              BLOAD3 PSHS B,X
1439
0899 F747 8D 09                     BSR  GETCH  Get data character
1440
0900 F749 35 14                     PULS B,X
1441
0901 F74B A7 80                     STA  ,X+    Store at load address
1442
0902 F74D 5A                        DECB
1443
0903 F74E 26 F5                     BNE  BLOAD3  Loop until count = 0
1444
0904 F750 20 C9                     BRA  BLOAD1
1445
0905                         *
1446
0906                         * Get Character routine
1447
0907                         * Reads a sector if needed
1448
0908                         *
1449
0909 F752 10 8C C4 00        GETCH  CMPY #SCTBUF+256 out of data ?
1450
0910 F756 26 0F                     BNE  GETCH4      Go read Character if not
1451
0911 F758 8E C3 00           GETCH2 LDX  #SCTBUF     Point to buffer
1452
0912 F75B EC 84                     LDD  0,X         Get forward Link
1453
0913 F75D 27 0B                     BEQ  GOFLEX      if zero, file is loaded
1454
0914 F75F 8D 26                     BSR  READ        Read next sector
1455
0915 F761 26 9D                     BNE  BOOT        start over if error
1456
0916 F763 10 8E C3 04               LDY  #SCTBUF+4   Point past link
1457
0917 F767 A6 A0              GETCH4 LDA  ,Y+         Else, get a character
1458
0918 F769 39                        RTS
1459
0919                         *
1460
0920                         * File is loaded, Jump to it
1461
0921                         *
1462
0922 F76A 6E 9C 9B           GOFLEX JMP  [TADR,PCR]      Jump to transfer address
1463
0923
1464
0924                         *
1465
0925                         ** FLEX 9 IDE DISK DRIVERS
1466
0926                         *
1467
0927                         * Seek track and sector
1468
0928                         * A holds track number (0 - ??)
1469
0929                         * B holds sector number (1 - ??)
1470
0930                         * Sector numbers starts from 1
1471
0931                         * subtract 1 to start from sector 0 on CF
1472
0932                         *
1473
0933 F76D 34 02              SEEK   PSHS A
1474
0934 F76F 4F                        CLRA
1475
0935 F770 5A                        DECB
1476
0936 F771 FD E1 06                  STD  CF_SECNUM
1477
0937 F774 E6 E4                     LDB  ,S
1478
0938 F776 FD E1 08                  STD  CF_CYLLO
1479
0939 F779 E6 8C 90                  LDB  DRNUM,PCR
1480
0940 F77C FD E1 0A                  STD  CF_CYLHI
1481
0941 F77F C6 01                     LDB  #$01
1482
0942 F781 FD E1 04                  STD  CF_SECCNT
1483
0943 F784 5F                        CLRB
1484
0944 F785 35 82                     PULS A,PC
1485
0945                         *
1486
0946                         * READ SECTORS FROM CF
1487
0947                         *
1488 218 davidgb
0948                         *
1489 221 davidgb
0949 F787 8D E4              READ   BSR  SEEK
1490
0950 F789 CC 00 20                  LDD  #CMDREAD ; IDE READ MULTIPLE
1491
0951 F78C FD E1 0E                  STD  CF_COMAND
1492
0952 F78F 8D 17                     BSR  WTRDY
1493
0953                         *
1494
0954                         * READ LOOP
1495
0955                         *
1496
0956 F791 34 20                     PSHS Y
1497
0957 F793 10 8E 01 00               LDY #256
1498
0958 F797 8D 1E              READ1  BSR  WTDRQ
1499
0959 F799 FC E1 00                  LDD  CF_DATA
1500
0960 F79C E7 80                     STB  ,X+
1501
0961 F79E 31 3F                     LEAY -1,Y
1502
0962 F7A0 26 F5                     BNE  READ1
1503
0963 F7A2 35 20                     PULS Y
1504
0964                         *
1505
0965 F7A4 8D 02                     BSR  WTRDY
1506
0966 F7A6 5F                        CLRB
1507
0967 F7A7 39                        RTS
1508
0968                         *
1509
0969                         * WAIT UNTIL READY
1510
0970                         *
1511
0971 F7A8 FC E1 0E           WTRDY   LDD  CF_STATUS
1512
0972 F7AB C5 80                      BITB #BUSY
1513
0973 F7AD 26 F9                      BNE  WTRDY
1514
0974 F7AF FC E1 0E                   LDD  CF_STATUS
1515
0975 F7B2 C5 40                      BITB #DRDY
1516
0976 F7B4 27 F2                      BEQ  WTRDY
1517
0977 F7B6 39                         RTS
1518
0978                         *
1519
0979                         * WAIT FOR DATA REQUEST
1520
0980                         *
1521
0981 F7B7 FC E1 0E           WTDRQ   LDD  CF_STATUS
1522
0982 F7BA C5 08                      BITB #DRQ
1523
0983 F7BC 27 F9                      BEQ  WTDRQ
1524
0984 F7BE 39                         RTS
1525
0985                         *
1526 218 davidgb
0004                                END
1527
0000                          INCLUDE "sys09bug.asm"
1528
0001                         * NAM SYS09BUG12 SYSTEM09 MONITOR
1529
0002                          OPT l
1530
 
1531
 
1532
sys09bug.asm                                                                      page   3
1533
0004                         *
1534
0005                         * MONITOR PROGRAM FOR THE SOUTHWEST TECHNICAL
1535
0006                         * PRODUCTS MP-09 CPU BOARD AS COMMENTED BY....
1536
0007                         *
1537
0008                         * ALLEN CLARK            WALLACE WATSON
1538
0009                         * 2502 REGAL OAKS LANE   4815 EAST 97th AVE.
1539
0010                         * LUTZ, FLA. 33549       TEMPLE TERRACE, FLA. 33617
1540
0011                         * PH. 813-977-0347       PH. 813-985-1359
1541
0012                         *
1542
0013                         * MODIFIED TO SBUG09 VER 1.8 BY:  RANDY JARRETT
1543
0014                         *                                 2561 NANTUCKET DR APT. E
1544
0015                         *                                 ATLANTA, GA  30345
1545
0016                         *                                 PH. 404-320-1043
1546
0017                         *
1547
0018                         * MODIFIED TO SYS09BUG VER 1.0
1548
0019                         * FOR:     SYSTEM09 FPGA SYSTEM
1549
0020                         * BY:      JOHN KENT
1550
0021                         * DATE:    21ST NOVEMBER 2006
1551
0022                         * REMOVED: DISK BOOTS
1552
0023                         *          MEMORY TEST
1553
0024                         * ADDED:   ADM3A VDU DRIVER
1554
0025                         *
1555
0026                         * MODIFIED TO SYS09BUG VER 1.1
1556
0027                         * BY:      JOHN KENT
1557
0028                         * DATE:    7TH JANUARY 2007
1558
0029                         * ADDED:   'U' USER EXTENTION COMMANDS AT $F000
1559
0030                         *          CONDITIONAL ASSEMBLY OF FLOPPY BOOTS
1560
0031                         *          AND REALTIME CLOCK
1561
0032                         *
1562
0033                         * MODIFIED TO SYS09BUG VER 1.2
1563
0034                         * BY:      JOHN KENT
1564
0035                         * DATE:    21ST MAY 2007
1565
0036                         * ADDED:   COMPACT FLASH BOOT TO FPGA VERSION
1566
0037                         *          REMOVED PORT REDIRECTION ON PUNCH & LOAD
1567
0038                         *
1568
0039                         * Modified to SYS09BUG VER 1.3
1569
0040                         * BY:      JOHN KENT
1570
0041                         * DATE:    8TH JAN 2008
1571
0042                         * ADDED:   CONDITIONALS FOR SPARTAN3E STARTER BOARD
1572
0043                         *          WITH ONLY 32K OF RAM
1573
0044                         *
1574
0045                         * Modified to SYS09BUG VER 1.4
1575
0046                         * BY:      JOHN KENT
1576
0047                         * DATE:    3RD FEB 2008
1577
0048                         * ADDED:   CONDITIONALS FOR XESS BOARD WITH IDE
1578
0049                         *          SEPERATE CONDITIONAL FOR S3 STARTER AND B5-X300
1579
0050                         *          16 BIT IDE DISK BOOT STRAP ROUTINE
1580
0051                         *
1581
0052                         * Modified to SYS09BUG VER 1.5
1582
0053                         * BY:      JOHN KENT
1583
0054                         * DATE:    7TH SEP 2008
1584
0055                         * ADDED:   ADDED "B3-S2+" STRING
1585
0056                         *
1586
0057                         * Modified to SYS09BUG VER 1.6
1587
0058                         * BY:      JOHN KENT
1588
0059                         * DATE:    2ND DEC 2008
1589
0060                         * ADDED:   ADDED HARDWARE FLOW CONTROL
1590
0061                         *
1591
0062                         * CHANGED: SEPARARTED OPTIONS EQUATES AND BODY INTO SEPARATE FILES
1592
0063                         *
1593
0064                         * Modified to SYS09BUG VER 1.7
1594
0065                         * BY:     JOHN KENT
1595
0066                         * DATE:   16TH OCT 2010
1596
0067                         * ADDED:  "DE2-70" STRING
1597
0068                         *
1598
0069                         *       *** COMMANDS ***
1599
0070                         *
1600
0071                         * CONTROL A   = ALTER THE "A" ACCUMULATOR
1601
0072                         * CONTROL B   = ALTER THE "B" ACCUMULATOR
1602
0073                         * CONTROL C   = ALTER THE CONDITION CODE REGISTER
1603
0074                         * CONTROL D   = ALTER THE DIRECT PAGE REGISTER
1604
0075                         * CONTROL P   = ALTER THE PROGRAM COUNTER
1605
0076                         * CONTROL U   = ALTER USER STACK POINTER
1606
0077                         * CONTROL X   = ALTER "X" INDEX REGISTER
1607
0078                         * CONTROL Y   = ALTER "Y" INDEX REGISTER
1608
0079                         * B hhhh      = SET BREAKPOINT AT LOCATION $hhhh
1609
0080                         * D           = 5.25" MINIFLOPPY BOOT
1610
0081                         * E ssss-eeee = EXAMINE MEMORY
1611
0082                         *               FROM STARTING ADDRESS ssss
1612
0083                         *               TO ENDING ADDRESS eeee.
1613
0084                         * G           = CONTINUE EXECUTION FROM BREAKPOINT OR SWI
1614
0085                         * L           = LOAD TAPE
1615
0086                         * M hhhh      = EXAMINE AND CHANGE MEMORY LOCATION hhhh
1616
0087                         * P ssss-eeee = PUNCH TAPE, START ssss TO END eeee ADDR.
1617
0088                         * R           = DISPLAY REGISTER CONTENTS
1618
0089                         * S           = DISPLAY STACK FROM ssss TO $DFC0
1619
0090                         * U           = 8" DMAF2 FLOPPY BOOT
1620
0091                         * U           = USER EXTENSION COMMANDS AT $F000
1621
0092                         * X           = REMOVE ALL BREAKPOINTS
1622
0093                         *
1623
0094                         *
1624
0095                         ***************************************************
1625
0096                         *   SYS09BUG VARIABLE SPACE
1626
0097                         ***************************************************
1627
0098                         *
1628
0099 DFC0                            ORG   MONRAM
1629
0100 DFC0                    STACK   EQU   *         ; TOP OF INTERNAL STACK
1630
0101 DFC0                    NMI     RMB   2         ; USER NMI VECTOR
1631
0102 DFC2                    SWI3    RMB   2         ; SOFTWARE INTERRUPT VECTOR #3
1632
0103 DFC4                    SWI2    RMB   2         ; SOFTWARE INTERRUPT VECTOR #2
1633
0104 DFC6                    FIRQ    RMB   2         ; FAST INTERRUPT VECTOR
1634
0105 DFC8                    IRQ     RMB   2         ; INTERRUPT VECTOR
1635
0106 DFCA                    SWI     RMB   2         ; SOFTWARE INTERRUPT VECTOR
1636
0107 DFCC                    SVCVO   RMB   2         ; SUPERVISOR CALL VECTOR ORGIN
1637
0108 DFCE                    SVCVL   RMB   2         ; SUPERVISOR CALL VECTOR LIMIT
1638
0109                                 IFD DATOPT
1639 221 davidgb
0110 DFD0                    LRARAM  RMB  16         ; LRA ADDRESSES
1640 218 davidgb
0111                                 ENDIF DATOPT
1641 221 davidgb
0112 DFE0                    CPORT   RMB   2         ; RE-VECTORABLE CONTROL PORT
1642
0113 DFE2                    ECHO    RMB   1         ; ECHO FLAG
1643
0114 DFE3                    BPTBL   RMB  24         ; BREAKPOINT TABLE BASE ADDR
1644 218 davidgb
0115                                 IFD  TRAOPT
1645
0116                         NMISAV  RMB   2         ; NMI Jump Vector Backup
1646
0117                         TRACNT  RMB   2         ; Trace Count
1647
0118                                 ENDIF TRAOPT
1648
0118                                 ENDIF TRAOPT
1649
0119                                 IFD VDUOPT
1650
0120                         *
1651
0121                         **************************************************
1652
0122                         *   VDU8 DISPLAY DRIVER VARIABLES                                    *
1653
0123                         **************************************************
1654
0124                         *
1655
0125                         **** ALWAYS KEEP COLADX AND ROWADX TOGETHER ******
1656 221 davidgb
0126 DFFB                    COLADX  RMB   1         ; CURSOR COLUMN
1657
0127 DFFC                    ROWADX  RMB   1         ; CURSOR ROW
1658 218 davidgb
0128                         **************************************************
1659
0129                         *
1660 221 davidgb
0130 DFFD                    NEWROW  RMB   1         ; NEW ROW TEMP FOR ESCAPE
1661
0131 DFFE                    ESCFLG  RMB   1         ; ESCAPE SEQUENCE ACTIVE
1662 218 davidgb
0132                                 ENDIF VDUOPT
1663
0133                                 IFD DG640OPT
1664
0134                         *
1665
0135                         ***************************************************
1666
0136                         *   DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES  *
1667
0137                         ***************************************************
1668
0138                         *
1669
0139                         ***** ALWAYS KEEP THESE TWO BYTES TOGETHER *****
1670
0140                         COLADX  RMB   1        ; CURSOR COLUMN
1671
0141                         ROWADX  RMB   1        ; CURSOR ROW
1672
0142                         *************************************************
1673
0143                         CURSOR  RMB   2        ; ABSOLUTE SCREEN ADDRESS
1674
0144                         NEWROW  RMB   1        ; NEW ROW TEMP FOR ESCAPE
1675
0145                         ESCFLG  RMB   1        ; ESCAPE SEQUENCE ACTIVE
1676
0146                                 ENDIF DG640OPT
1677
0146                                 ENDIF DG640OPT
1678
0147                         *
1679
0148                         *
1680
0149                         ***************************************************
1681
0150                         *   START OF ROM                                  *
1682
0151                         ***************************************************
1683
0152                         *
1684
0153 F800                            ORG   MONROM
1685
0154 F800 F8 14                      FDB   MONITOR
1686 221 davidgb
0155 F802 F8 61                      FDB   NEXTCMD
1687
0156 F804 FC A1                      FDB   INCH
1688
0157 F806 FC 9B                      FDB   INCHE
1689
0158 F808 FC C5                      FDB   INCHEK
1690
0159 F80A FC E0                      FDB   OUTCH
1691
0160 F80C FB 8F                      FDB   PDATA
1692
0161 F80E FB 1E                      FDB   PCRLF
1693
0162 F810 FB 1A                      FDB   PSTRNG
1694
0163 F812 FA 2E                      FDB   LRA
1695 218 davidgb
0164                         *
1696
0165                                 IFD   ADSOPT
1697
0166                                 FDB   PCHK     ; CHECK FOR PRINTER INPUT
1698
0167                                 FDB   PINIZ    ; INITIATE PRINTER
1699
0168                                 FDB   POUTCH   ; OUTPUT CH. TO PRINTER
1700
0169                                 FDB   VINIZ
1701
0170                                 FDB   VOUTCH
1702
0171                                 FDB   ACINIZ
1703
0172                                 FDB   AOUTCH
1704
0173                                 ENDIF ADSOPT
1705
0173                                 ENDIF ADSOPT
1706
0174                         *
1707
0175                         * MONITOR
1708
0176                         *
1709
0177                         * VECTOR ADDRESS STRING IS.....
1710
0178                         * $F8A1-$F8A1-$F8A1-$F8A1-$F8A1-$FAB0-$FFFF-$FFFF
1711
0179                         *
1712 221 davidgb
0180 F814 8E FE 74           MONITOR LDX   #RAMVEC  ; POINT TO VECTOR ADDR. STRING
1713 218 davidgb
0181 F817 10 8E DF C0                LDY   #STACK   ; POINT TO RAM VECTOR LOCATION
1714
0182 F81B C6 10                      LDB   #$10     ; BYTES TO MOVE = 16
1715
0183 F81D A6 80              LOOPA   LDA   ,X+      ; GET VECTOR BYTE
1716
0184 F81F A7 A0                      STA   ,Y+      ; PUT VECTORS IN RAM / $DFC0-$DFCF
1717
0185 F821 5A                         DECB           ; SUBTRACT 1 FROM NUMBER OF BYTES TO MOVE
1718
0186 F822 26 F9                      BNE   LOOPA    ; CONTINUE UNTIL ALL VECTORS MOVED
1719
0187                         *
1720
0188                         * CONTENTS     FROM         TO      FUNCTION
1721
0189                         *  $F8A1       $FE40      $DFC0     USER-V
1722
0190                         *  $F8A1       $FE42      $DFC2     SWI3-V
1723
0191                         *  $F8A1       $FE44      $DFC4     SWI2-V
1724
0192                         *  $F8A1       $FE46      $DFC6     FIRQ-V
1725
0193                         *  $F8A1       $FE48      $DFC8     IRQ-V
1726
0194                         *  $FAB0       $FE4A      $DFCA     SWI-V
1727
0195                         *  $FFFF       $FE4C      $DFCC     SVC-VO
1728
0196                         *  $FFFF       $FE4E      $DFCE     SVC-VL
1729
0197                         *
1730 221 davidgb
0198 F824 8E E0 00                   LDX   #ACIAS
1731
0199 F827 BF DF E0                   STX   CPORT    ; STORE ADDR. IN RAM
1732
0200 F82A 17 01 5B                   LBSR  XBKPNT   ; CLEAR OUTSTANDING BREAKPOINTS
1733 218 davidgb
0201 F82D C6 0C                      LDB   #12      ; CLEAR 12 BYTES ON STACK
1734
0202 F82F 6F E2              CLRSTK  CLR   ,-S
1735
0203 F831 5A                         DECB
1736
0204 F832 26 FB                      BNE   CLRSTK
1737
0205 F834 30 8C DD                   LEAX  MONITOR,PCR  ; SET PC TO SBUG-E ENTRY
1738
0206 F837 AF 6A                      STX   10,S    ; ON STACK
1739
0207 F839 86 D0                      LDA   #$D0    ; PRESET CONDITION CODES ON STACK
1740
0208 F83B A7 E4                      STA   ,S
1741
0209 F83D 1F 43                      TFR   S,U
1742 221 davidgb
0210 F83F 17 04 B5                   LBSR  IOINIZ  ; INITIALIZE CONTROL PORT
1743
0211 F842 8E FE 84                   LDX   #MSG1   ; POINT TO MONITOR MESSAGE
1744
0212 F845 17 03 47                   LBSR  PDATA   ; PRINT MSG
1745 218 davidgb
0213                         *
1746
0214                                 IFD   DATOPT
1747 221 davidgb
0215 F848 8E DF D0                   LDX   #LRARAM ; POINT TO LRA RAM STORAGE AREA
1748
0216 F84B 4F                         CLRA  START   ; TOTAL AT ZERO
1749
0217 F84C C6 0D                      LDB   #13     ; TOTAL UP ALL ACTIVE RAM MEMORY
1750
0218 F84E 6D 85              FNDREL  TST   B,X     ; TEST FOR RAM AT NEXT LOC.
1751
0219 F850 27 03                      BEQ   RELPAS  ; IF NO RAM GO TO NEXT LOC.
1752
0220 F852 8B 04                      ADDA  #4      ; ELSE ADD 4K TO TOTAL
1753
0221 F854 19                         DAA           ; ADJ. TOTAL FOR DECIMAL
1754
0222 F855 5A                 RELPAS  DECB          ; SUB. 1 FROM LOCS. TO TEST
1755
0223 F856 2A F6                      BPL   FNDREL  ; PRINT TOTAL OF RAM
1756
0224 F858 17 04 0C                   LBSR  OUT2H   ; OUTPUT HEX BYTE AS ASCII
1757
0225 F85B 8E FE A3                   LDX   #MSG2   ; POINT TO MSG 'K' CR/LF + 3 NULS
1758
0226 F85E 17 03 2E                   LBSR  PDATA   ; PRINT MSG
1759 218 davidgb
0227                                 ENDIF DATOPT
1760
0228                         *
1761
0229                                 IFD   TRAOPT
1762
0230                                 LBSR  TRAINZ
1763
0231                                 ENDIF TRAOPT
1764
0231                                 ENDIF TRAOPT
1765
0232                         *
1766
0233                         ***** NEXTCMD *****
1767
0234                         *
1768 221 davidgb
0235 F861 8E FE AA           NEXTCMD LDX  #MSG3   ; POINT TO MSG ">"
1769
0236 F864 17 02 B3                   LBSR PSTRNG  ; PRINT MSG
1770
0237 F867 17 04 37                   LBSR INCH    ; GET ONE CHAR. FROM TERMINAL
1771
0238 F86A 84 7F                      ANDA #$7F    ; STRIP PARITY FROM CHAR.
1772
0239 F86C 81 0D                      CMPA #$0D    ; IS IT CARRIAGE RETURN ?
1773
0240 F86E 27 F1                      BEQ  NEXTCMD ; IF CR THEN GET ANOTHER CHAR.
1774
0241 F870 1F 89                      TFR  A,B     ; PUT CHAR. IN "B" ACCUM.
1775
0242 F872 81 20                      CMPA #$20    ; IS IT CONTROL OR DATA CHAR ?
1776
0243 F874 2C 09                      BGE  PRTCMD  ; IF CMD CHAR IS DATA, PRNT IT
1777
0244 F876 86 5E                      LDA  #'^     ; ELSE CNTRL CHAR CMD SO...
1778
0245 F878 17 04 65                   LBSR OUTCH   ; PRINT "^"
1779
0246 F87B 1F 98                      TFR  B,A     ; RECALL CNTRL CMD CHAR
1780
0247 F87D 8B 40                      ADDA #$40    ; CONVERT IT TO ASCII LETTER
1781
0248 F87F 17 04 5E           PRTCMD  LBSR OUTCH   ; PRNT CMD CHAR
1782
0249 F882 17 04 59                   LBSR OUT1S   ; PRNT SPACE
1783
0250 F885 C1 60                      CMPB #$60
1784
0251 F887 2F 02                      BLE  NXTCH0
1785
0252 F889 C0 20                      SUBB #$20
1786 218 davidgb
0253                         *
1787
0254                         ***** DO TABLE LOOKUP *****
1788
0255                         *   FOR COMMAND FUNCTIONS
1789
0256                         *
1790 221 davidgb
0257 F88B 8E FE 3B           NXTCH0  LDX  #JMPTAB ; POINT TO JUMP TABLE
1791
0258 F88E E1 80              NXTCHR  CMPB ,X+     ; DOES COMMAND MATCH TABLE ENTRY ?
1792
0259 F890 27 0F                      BEQ  JMPCMD  ; BRANCH IF MATCH FOUND
1793
0260 F892 30 02                      LEAX 2,X     ; POINT TO NEXT ENTRY IN TABLE
1794
0261 F894 8C FE 74                   CMPX #TABEND ; REACHED END OF TABLE YET ?
1795
0262 F897 26 F5                      BNE  NXTCHR  ; IF NOT END, CHECK NEXT ENTRY
1796
0263 F899 8E FE AC                   LDX  #MSG4   ; POINT TO MSG "WHAT?"
1797
0264 F89C 17 02 F0                   LBSR PDATA   ; PRINT MSG
1798
0265 F89F 20 C0                      BRA  NEXTCMD ; IF NO MATCH, PRMPT FOR NEW CMD
1799
0266 F8A1 AD 94              JMPCMD  JSR  [,X]    ; JUMP TO COMMAND ROUTINE
1800
0267 F8A3 20 BC                      BRA  NEXTCMD ; PROMPT FOR NEW COMMAND
1801 218 davidgb
0268                         *
1802
0269                         * "G" GO OR CONTINUE
1803
0270                         *
1804 221 davidgb
0271 F8A5 1F 34              GO      TFR  U,S
1805
0272 F8A7 3B                 RTI     RTI
1806 218 davidgb
0273                         *
1807
0274                         ***** "M" MEMORY EXAMINE AND CHANGE *****
1808
0275                         *
1809 221 davidgb
0276 F8A8 17 03 6B           MEMCHG  LBSR IN1ADR  ; INPUT ADDRESS
1810
0277 F8AB 29 2D                      BVS  CHRTN   ; IF NOT HEX, RETURN
1811
0278 F8AD 1F 12                      TFR  X,Y     ; SAVE ADDR IN "Y"
1812
0279 F8AF 8E FE B2           MEMC2   LDX  #MSG5   ; POINT TO MSG " - "
1813
0280 F8B2 17 02 65                   LBSR PSTRNG  ; PRINT MSG
1814
0281 F8B5 1F 21                      TFR  Y,X     ; FETCH ADDRESS
1815
0282 F8B7 17 03 A5                   LBSR OUT4H   ; PRINT ADDR IN HEX
1816
0283 F8BA 17 04 21                   LBSR OUT1S   ; OUTPUT SPACE
1817
0284 F8BD A6 A4                      LDA  ,Y      ; GET CONTENTS OF CURRENT ADDR.
1818
0285 F8BF 17 03 A5                   LBSR OUT2H   ; OUTPUT CONTENTS IN ASCII
1819
0286 F8C2 17 04 19                   LBSR OUT1S   ; OUTPUT SPACE
1820
0287 F8C5 17 03 5E                   LBSR BYTE    ; LOOP WAITING FOR OPERATOR INPUT
1821
0288 F8C8 28 11                      BVC  CHANGE  ; IF VALID HEX GO CHANGE MEM. LOC.
1822
0289 F8CA 81 08                      CMPA #8      ; IS IT A BACKSPACE (CNTRL H)?
1823
0290 F8CC 27 E1                      BEQ  MEMC2   ; PROMPT OPERATOR AGAIN
1824
0291 F8CE 81 18                      CMPA #$18    ; IS IT A CANCEL (CNTRL X)?
1825
0292 F8D0 27 DD                      BEQ  MEMC2   ; PROMPT OPERATOR AGAIN
1826
0293 F8D2 81 5E                      CMPA #'^     ; IS IT AN UP ARROW?
1827
0294 F8D4 27 17                      BEQ  BACK    ; DISPLAY PREVIOUS BYTE
1828
0295 F8D6 81 0D                      CMPA #$D     ; IS IT A CR?
1829
0296 F8D8 26 0F                      BNE  FORWRD  ; DISPLAY NEXT BYTE
1830
0297 F8DA 39                 CHRTN   RTS          ; EXIT ROUTINE
1831 218 davidgb
0298                         *
1832
0299                         *
1833 221 davidgb
0300 F8DB A7 A4              CHANGE  STA  ,Y      ; CHANGE BYTE IN MEMORY
1834
0301 F8DD A1 A4                      CMPA ,Y      ; DID MEMORY BYTE CHANGE?
1835
0302 F8DF 27 08                      BEQ  FORWRD  ; $F972
1836
0303 F8E1 17 03 FA                   LBSR OUT1S   ; OUTPUT SPACE
1837
0304 F8E4 86 3F                      LDA  #'?     ; LOAD QUESTION MARK
1838
0305 F8E6 17 03 F7                   LBSR OUTCH   ; PRINT IT
1839
0306 F8E9 31 21              FORWRD  LEAY 1,Y     ; POINT TO NEXT HIGHER MEM LOCATION
1840
0307 F8EB 20 C2                      BRA  MEMC2   ; PRINT LOCATION & CONTENTS
1841
0308 F8ED 31 3F              BACK    LEAY -1,Y    ; POINT TO LAST MEM LOCATION
1842
0309 F8EF 20 BE                      BRA  MEMC2   ; PRINT LOCATION & CONTENTS
1843 218 davidgb
0310                         *
1844
0311                         * "S" DISPLAY STACK
1845
0312                         * HEX-ASCII DISPLAY OF CURRENT STACK CONTENTS FROM
1846
0313                         ** CURRENT STACK POINTER TO INTERNAL STACK LIMIT.
1847
0314                         *
1848 221 davidgb
0315 F8F1 17 02 A2           DISSTK  LBSR PRTSP   ; PRINT CURRENT STACK POINTER
1849
0316 F8F4 1F 32                      TFR  U,Y
1850
0317 F8F6 8E DF C0                   LDX  #STACK  ; LOAD INTERNAL STACK AS UPPER LIMIT
1851
0318 F8F9 30 1F                      LEAX -1,X    ; POINT TO CURRENT STACK
1852
0319 F8FB 20 05                      BRA  MDUMP1  ; ENTER MEMORY DUMP OF STACK CONTENTS
1853 218 davidgb
0320                         *
1854
0321                         * "E" DUMP MEMORY FOR EXAMINE IN HEX AND ASCII
1855
0322                         * AFTER CALLING 'IN2ADR' LOWER ADDRESS IN Y-REG.
1856
0323                         *                        UPPER ADDRESS IN X-REG.
1857
0324                         * IF HEX ADDRESSES ARE INVALID (V)=1.
1858
0325                         *
1859 221 davidgb
0326 F8FD 17 03 0B           MEMDUMP LBSR IN2ADR  ; INPUT ADDRESS BOUNDRIES
1860
0327 F900 29 06                      BVS  EDPRTN  ; NEW COMMAND IF ILLEGAL HEX
1861
0328 F902 34 20              MDUMP1  PSHS Y       ; COMPARE LOWER TO UPPER BOUNDS
1862
0329 F904 AC E1                      CMPX ,S++    ; LOWER BOUNDS > UPPER BOUNDS?
1863
0330 F906 24 01                      BCC  AJDUMP  ; IF NOT, DUMP HEX AND ASCII
1864
0331 F908 39                 EDPRTN  RTS          ;
1865 218 davidgb
0332                         *
1866
0333                         * ADJUST LOWER AND UPPER ADDRESS LIMITS
1867
0334                         * TO EVEN 16 BYTE BOUNDRIES.
1868
0335                         *
1869
0336                         * IF LOWER ADDR = $4532
1870
0337                         * LOWER BOUNDS WILL BE ADJUSTED TO = $4530.
1871
0338                         *
1872
0339                         * IF UPPER ADDR = $4567
1873
0340                         * UPPER BOUNDS WILL BE ADJUSTED TO = $4570.
1874
0341                         *
1875
0342                         * ENTER WITH LOWER ADDRESS IN X-REG.
1876
0343                         *           -UPPER ADDRESS ON TOP OF STACK.
1877
0344                         *
1878 221 davidgb
0345 F909 1F 10              AJDUMP  TFR  X,D     ; GET UPPER ADDR IN D-REG
1879
0346 F90B C3 00 10                   ADDD #$10    ; ADD 16 TO UPPER ADDRESS
1880
0347 F90E C4 F0                      ANDB #$F0    ; MASK TO EVEN 16 BYTE BOUNDRY
1881
0348 F910 34 06                      PSHS A,B     ; SAVE ON STACK AS UPPER DUMP LIMIT
1882
0349 F912 1F 20                      TFR  Y,D     ; $F9A5 GET LOWER ADDRESS IN D-REG
1883
0350 F914 C4 F0                      ANDB #$F0    ; MASK TO EVEN 16 BYTE BOUNDRY
1884
0351 F916 1F 01                      TFR  D,X     ; PUT IN X-REG AS LOWER DUMP LIMIT
1885
0352 F918 AC E4              NXTLIN  CMPX ,S      ; COMPARE LOWER TO UPPER LIMIT
1886
0353 F91A 27 05                      BEQ  SKPDMP  ; IF EQUAL SKIP HEX-ASCII DUMP
1887
0354 F91C 17 03 A6                   LBSR INCHEK  ; CHECK FOR INPUT FROM KEYBOARD
1888
0355 F91F 27 03                      BEQ  EDUMP
1889
0356 F921 32 62              SKPDMP  LEAS 2,S     ; READJUST STACK IF NOT DUMPING
1890
0357 F923 39                         RTS          ;
1891 218 davidgb
0358                         *
1892
0359                         * PRINT 16 HEX BYTES FOLLOWED BY 16 ASCII CHARACTERS
1893
0360                         * FOR EACH LINE THROUGHOUT ADDRESS LIMITS.
1894
0361                         *
1895 221 davidgb
0362 F924 34 10              EDUMP   PSHS X       ; PUSH LOWER ADDR LIMIT ON STACK
1896
0363 F926 8E FE B2                   LDX  #MSG5   ; POINT TO MSG " - "
1897
0364 F929 17 01 EE                   LBSR PSTRNG  ; PRINT MSG
1898
0365 F92C AE E4                      LDX  ,S      ; LOAD LOWER ADDR FROM TOP OF STACK
1899
0366 F92E 17 03 2E                   LBSR OUT4H   ; PRINT THE ADDRESS
1900
0367 F931 17 03 A8                   LBSR OUT2S   ; 2 SPACES
1901
0368 F934 C6 10                      LDB  #$10    ; LOAD COUNT OF 16 BYTES TO DUMP
1902
0369 F936 A6 80              ELOOP   LDA  ,X+     ; GET FROM MEMORY HEX BYTE TO PRINT
1903
0370 F938 17 03 2C                   LBSR OUT2H   ; OUTPUT HEX BYTE AS ASCII
1904
0371 F93B 17 03 A0                   LBSR OUT1S   ; OUTPUT SPACE
1905
0372 F93E 5A                         DECB         ; $F9D1 DECREMENT BYTE COUNT
1906
0373 F93F 26 F5                      BNE  ELOOP   ; CONTINUE TIL 16 HEX BYTES PRINTED
1907 218 davidgb
0374                         *
1908
0375                         * PRINT 16 ASCII CHARACTERS
1909
0376                         * IF NOT PRINTABLE OR NOT VALID
1910
0377                         * ASCII PRINT A PERIOD (.)
1911 221 davidgb
0378 F941 17 03 98                   LBSR OUT2S   ; 2 SPACES
1912
0379 F944 AE E1                      LDX  ,S++    ; GET LOW LIMIT FRM STACK - ADJ STACK
1913
0380 F946 C6 10                      LDB  #$10    ; SET ASCII CHAR TO PRINT = 16
1914
0381 F948 A6 80              EDPASC  LDA  ,X+     ; GET CHARACTER FROM MEMORY
1915
0382 F94A 81 20                      CMPA #$20    ; IF LESS THAN $20, NON-PRINTABLE?
1916
0383 F94C 25 04                      BCS  PERIOD  ; IF SO, PRINT PERIOD INSTEAD
1917
0384 F94E 81 7E                      CMPA #$7E    ; IS IT VALID ASCII?
1918
0385 F950 23 02                      BLS  PRASC   ; IF SO PRINT IT
1919
0386 F952 86 2E              PERIOD  LDA  #'.     ; LOAD A PERIOD (.)
1920
0387 F954 17 03 89           PRASC   LBSR OUTCH   ; PRINT ASCII CHARACTER
1921
0388 F957 5A                         DECB         ; DECREMENT COUNT
1922
0389 F958 26 EE                      BNE  EDPASC
1923
0390 F95A 20 BC                      BRA  NXTLIN
1924 218 davidgb
0391                         *
1925
0392                         ***** "B" SET BREAKPOINT *****
1926
0393                         *
1927 221 davidgb
0394 F95C 17 02 B7           BRKPNT  LBSR IN1ADR  ; GET BREAKPOINT ADDRESS
1928
0395 F95F 29 1E                      BVS  EXITBP  ; EXIT IF INVALID HEX ADDR.
1929
0396 F961 8C DF C0                   CMPX #STACK  ; ADDRESS ILLEGAL IF >=$DFC0
1930
0397 F964 24 1A                      BCC  BPERR   ; IF ERROR PRINT (?), EXIT
1931
0398 F966 34 10                      PSHS X       ; $FA82 PUSH BP ADDRESS ON STACK
1932
0399 F968 8E FF FF                   LDX  #$FFFF  ; LOAD DUMMY ADDR TO TEST BP TABLE
1933
0400 F96B 8D 55                      BSR BPTEST   ; TEST BP TABLE FOR FREE SPACE
1934
0401 F96D 35 10                      PULS X       ; POP BP ADDRESS FROM STACK
1935
0402 F96F 27 0F                      BEQ  BPERR   ; (Z) SET, OUT OF BP TABLE SPACE
1936
0403 F971 A6 84                      LDA  ,X      ; GET DATA AT BREAKPOINT ADDRESS
1937
0404 F973 81 3F                      CMPA #$3F    ; IS IT A SWI?
1938
0405 F975 27 09                      BEQ  BPERR   ; IF SWI ALREADY, INDICATE ERROR
1939
0406 F977 A7 A0                      STA  ,Y+     ; SAVE DATA BYTE IN BP TABLE
1940
0407 F979 AF A4                      STX  ,Y      ; SAVE BP ADDRESS IN BP TABLE
1941
0408 F97B 86 3F                      LDA  #$3F    ; LOAD A SWI ($3F)
1942
0409 F97D A7 84                      STA  ,X      ; SAVE SWI AT BREAKPOINT ADDRESS
1943
0410 F97F 39                 EXITBP  RTS ;
1944 218 davidgb
0411                         *
1945
0412                         *  INDICATE ERROR SETTING BREAKPOINT
1946
0413                         *
1947 221 davidgb
0414 F980 17 03 5B           BPERR   LBSR OUT1S   ; OUTPUT SPACE
1948
0415 F983 86 3F                      LDA  #'?     ; LOAD (?), INDICATE BREAKPOINT ERROR
1949
0416 F985 16 03 58                   LBRA OUTCH   ; PRINT "?"
1950 218 davidgb
0417                         *
1951
0418                         *** "X" CLEAR OUTSTANDING BREAKPOINTS ***
1952
0419                         *
1953 221 davidgb
0420 F988 10 8E DF E3        XBKPNT  LDY  #BPTBL  ; POINT TO BREAKPOINT TABLE
1954
0421 F98C C6 08                      LDB  #8      ; LOAD BREAKPOINT COUNTER
1955
0422 F98E 8D 18              XBPLP   BSR  RPLSWI  ; REMOVE USED ENTRY IN BP TABLE
1956
0423 F990 5A                         DECB  $FAAC  ; DECREMENT BP COUNTER
1957
0424 F991 26 FB                      BNE  XBPLP   ; END OF BREAKPOINT TABLE?
1958
0425 F993 39                         RTS
1959 218 davidgb
0426                         *
1960
0427                         ***** SWI ENTRY POINT *****
1961
0428                         *
1962 221 davidgb
0429 F994 1F 43              SWIE    TFR  S,U     ; TRANSFER STACK TO USER POINTER
1963
0430 F996 AE 4A                      LDX  10,U    ; LOAD PC FROM STACK INTO X-REG
1964
0431 F998 30 1F                      LEAX -1,X    ; ADJUST ADDR DOWN 1 BYTE.
1965
0432 F99A 8D 26                      BSR  BPTEST  ; FIND BREAKPOINT IN BP TABLE
1966
0433 F99C 27 04                      BEQ  REGPR   ; IF FOUND, REPLACE DATA AT BP ADDR
1967
0434 F99E AF 4A                      STX  10,U    ; SAVE BREAKPOINT ADDR IN STACK
1968
0435 F9A0 8D 06                      BSR  RPLSWI  ; GO REPLACE SWI WITH ORIGINAL DATA
1969
0436 F9A2 17 02 48           REGPR   LBSR REGSTR  ; GO PRINT REGISTERS
1970 218 davidgb
0437                         *
1971
0438                                 IFD TRAOPT
1972
0439                                 LDX #0
1973
0440                                 STX TRACNT
1974
0441                                 ENDIF TRAOPT
1975
0441                                 ENDIF TRAOPT
1976
0442                         *
1977 221 davidgb
0443 F9A5 16 FE B9                   LBRA NEXTCMD ; GET NEXT COMMAND
1978 218 davidgb
0444                         *
1979 221 davidgb
0445 F9A8 AE 21              RPLSWI  LDX  1,Y     ; LOAD BP ADDRESS FROM BP TABLE
1980
0446 F9AA 8C DF C0                   CMPX #STACK  ; COMPARE TO TOP AVAILABLE USER MEMORY
1981
0447 F9AD 24 0A                      BCC  FFSTBL  ; GO RESET TABLE ENTRY TO $FF'S
1982
0448 F9AF A6 84                      LDA  ,X      ; GET DATA FROM BP ADDRESS
1983
0449 F9B1 81 3F                      CMPA #$3F    ; IS IT SWI?
1984
0450 F9B3 26 04                      BNE  FFSTBL  ; IF NOT, RESET TABLE ENTRY TO $FF'S
1985
0451 F9B5 A6 A4                      LDA  ,Y      ; GET ORIGINAL DATA FROM BP TABLE
1986
0452 F9B7 A7 84                      STA  ,X      ; $FAD3 RESTORE DATA AT BP ADDRESS
1987
0453 F9B9 86 FF              FFSTBL  LDA  #$FF    ; LOAD $FF IN A-ACC
1988
0454 F9BB A7 A0                      STA  ,Y+     ; RESET BREAKPOINT TABLE DATA TO $FF'S
1989
0455 F9BD A7 A0                      STA  ,Y+     ; RESET BREAKPOINT TABLE ADDR TO $FF'S
1990
0456 F9BF A7 A0                      STA  ,Y+
1991
0457 F9C1 39                         RTS
1992 218 davidgb
0458                         *
1993
0459                         ** SEARCH BREAKPOINT TABLE FOR MATCH **
1994
0460                         *
1995 221 davidgb
0461 F9C2 10 8E DF E3        BPTEST  LDY  #BPTBL  ; POINT TO BREAKPOINT TABLE
1996
0462 F9C6 C6 08                      LDB  #8      ; LOAD BREAKPOINT COUNTER
1997
0463 F9C8 A6 A0              FNDBP   LDA  ,Y+     ; LOAD DATA BYTE
1998
0464 F9CA AC A1                      CMPX ,Y++    ; COMPARE ADDRESS, IS IT SAME?
1999
0465 F9CC 27 04                      BEQ  BPADJ   ; IF SO, ADJUST POINTER FOR TABLE ENTRY
2000
0466 F9CE 5A                         DECB         ; IF NOT, DECREMENT BREAKPOINT COUNTER
2001
0467 F9CF 26 F7                      BNE  FNDBP   ; AND LOOK FOR NEXT POSSIBLE MATCH
2002
0468 F9D1 39                         RTS          ;
2003 218 davidgb
0469                         *
2004
0470                         *
2005 221 davidgb
0471 F9D2 31 3D              BPADJ   LEAY -3,Y    ; MOVE POINTER TO BEGIN OF BP ENTRY
2006
0472 F9D4 39                         RTS
2007 218 davidgb
0473                         *
2008
0474                                 IFD TRAOPT
2009
0475                         *
2010
0476                         ** TRACE from address AAAA BB bytes
2011
0477                         *
2012
0478                         TRACE   LBSR ALTPC1  ; SET UP NEW PC
2013
0479                                 BVS  TREXIT  ; ADDRESS ERROR, EXIT
2014
0480                                 LBSR OUT1S
2015
0481                                 LBSR IN1ADR  ; Fetch Byte Count
2016
0482                                 BVS TREXIT   ; Byte Count error, EXIT
2017
0483                                 STX TRACNT
2018
0484                         *
2019
0485                                 LDX NMI      ; Save NMI Vector
2020
0486                                 STX NMISAV
2021
0487                                 LDX #NMIE    ; Set up NMI for Tracing
2022
0488                                 STX NMI
2023
0489                                 LBSR TRAINZ  ; Initialise Hardware
2024
0490                                 BRA TRACEG   ; Start Trace
2025
0491                         TREXIT  RTS
2026
0492                         *
2027
0493                         * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
2028
0494                         * CRA1 = 1 CA1 Rising edge IRQ
2029
0495                         * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
2030
0496                         * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
2031
0497                         * CRA4 = 1 ] CA2 = Set/Reset output
2032
0498                         * CRA5 = 1 ]
2033
0499                         * CRA6 = X CA2 Input Interrupt Flag
2034
0500                         * CRA7 = X CA1 Interrupt Flag
2035
0501                         *
2036
0502                         * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
2037
0503                         * CRB1 = 1 CB1 Rising edge IRQ
2038
0504                         * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
2039
0505                         * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
2040
0506                         * CRB4 = 1 ] CB2 = Set/Reset output
2041
0507                         * CRB5 = 1 ]
2042
0508                         * CRB6 = X CB2 Input Interrupt Flag
2043
0509                         * CRB7 = X CB1 Interrupt Flag
2044
0510                         *
2045
0511                         *
2046
0512                         ** TRACE NMI ENTRY POINT
2047
0513                         *
2048
0514                         NMIE    TFR  S,U
2049
0515                                 LDA  #$36    ; Disable Interrupt, CA2 Low
2050
0516                                 STA  TACTRL
2051
0517                                 LDA  TADATA  ; Clear Interrupt flag by reading data port
2052
0518                         *
2053
0519                                 LBSR REGSTR  ; DUMP REGISTERS
2054
0520                         *
2055
0521                                 LDX  10,U    ; TEST IF NEXT INSTRUCTION IS A SWI
2056
0522                                 LDA  ,X
2057
0523                                 CMPA #$3F
2058
0524                                 BEQ  TRACEX  ; EXIT ON SWI
2059
0525                         *
2060
0526                                 LDX  TRACNT  ; CHECK IF TRACE COUNT EXPIRED
2061
0527                                 BEQ  TRACEX  ; YES, GO BACK TO THE MONITOR
2062
0528                                 LEAX -1,X    ; ECREMENT TRACE COUNT
2063
0529                                 STX  TRACNT
2064
0530                         *
2065
0531                         **  TRACE GO (RESUME SINGLE STEP)
2066
0532                         *
2067
0533                         TRACEG  TFR  U,S     ; SET UP PROGRAM STACK POINTER
2068
0534                                 LDA  #TRADEL ; SET UP TIMER DELAY (NUMB CYCLES FOR RTI+1)
2069
0535                                 STA  TADATA
2070
0536                                 LDA  #$36    ; LOAD STROBE LOW
2071
0537                                 STA  TACTRL
2072
0538                                 LDA  TADATA  ; CLEAR INTERRUPT
2073
0539                                 LDA  #$36    ; RELEASE RESET
2074
0540                                 STA  TBCTRL
2075
0541                                 LDA  #$3F    ; RELEASE LOAD, ENABLE CA1 NMI, CA1 RISING EDGE
2076
0542                                 STA  TACTRL
2077
0543                                 RTI          ; GO EXECUTE INSTRUCTION
2078
0544                         *
2079
0545                         TRACEX  LDX NMISAV   ; Restore NMI vector
2080
0546                                 STX NMI
2081
0547                                 LBRA NEXTCMD ; Jump back to the command loop.
2082
0548                         *
2083
0549                         ** TRACE HARDWARE INITIALISATION
2084
0550                         *
2085
0551                         TRAINZ  LDA #$32     ; SELECT DDRA, CA2 LOW, NMI DISABLED
2086
0552                                 STA TACTRL
2087
0553                                 LDA #$3A     ; SELECT DDRB, CB2 HIGH, FIRQ DISABLED
2088
0554                                 STA TBCTRL
2089
0555                                 LDA #$FF     ; PORTA = OUTPUT
2090
0556                                 STA TADATA
2091
0557                                 LDA #$00     ; PORTB = INPUT
2092
0558                                 STA TBDATA
2093
0559                                 LDA #$36     ; SELECT OUTPUT REGISTER A, CA2 LOW
2094
0560                                 STA TACTRL
2095
0561                                 LDA #$3E     ; SELECT OUTPUT REGISTER B, CB2 HIGH
2096
0562                                 STA TBCTRL
2097
0563                                 RTS
2098
0564                         *
2099
0565                                 ENDIF TRAOPT
2100
0565                                 ENDIF TRAOPT
2101
0566                                 IFD  MFDCOPT
2102
0567                         *
2103
0568                         ** "U" MINI DISK BOOT
2104
0569                         *
2105
0570                         MINBOOT TST  CMDFDC
2106
0571                                 CLR  DRVFDC
2107
0572                                 LDX  #$0000
2108
0573                         LOOP    LEAX $01,X
2109
0574                                 CMPX #$0000
2110
0575                                 BNE  LOOP
2111
0576                                 LDA  #$0F
2112
0577                                 STA  CMDFDC
2113
0578                                 BSR  DELAY
2114
0579                         LOOP1   LDB  CMDFDC
2115
0580                                 BITB #$01
2116
0581                                 BNE  LOOP1
2117
0582                                 LDA  #$01
2118
0583                                 STA  SECFDC
2119
0584                                 BSR  DELAY
2120
0585                                 LDA  #$8C
2121
0586                                 STA  CMDFDC
2122
0587                                 BSR  DELAY
2123
0588                                 LDX  #$C000
2124
0589                                 BRA  LOOP3
2125
0590                         LOOP2   BITB #$02
2126
0591                                 BEQ  LOOP3
2127
0592                                 LDA  DATFDC
2128
0593                                 STA ,X+
2129
0594                         LOOP3   LDB  CMDFDC
2130
0595                                 BITB #$01
2131
0596                                 BNE  LOOP2
2132
0597                                 BITB #$2C
2133
0598                                 BEQ  LOOP4
2134
0599                                 RTS
2135
0600                         *
2136
0601                         LOOP4   LDX  #$C000
2137
0602                                 STX  $0A,U
2138
0603                                 TFR  U,S
2139
0604                                 RTI
2140
0605                         *
2141
0606                         DELAY   LDB  #$04
2142
0607                         LOOP5   DECB
2143
0608                                 BNE  LOOP5
2144
0609                                 RTS
2145
0610                                 ENDIF MFDCOPT
2146
0610                                 ENDIF MFDCOPT
2147
0611                         *
2148
0612                                 IFD  DMAFOPT
2149
0613                         *
2150
0614                         *** "D" DISK BOOT FOR DMAF2 ***
2151
0615                         *
2152
0616                         DBOOT   LDA  #$DE
2153
0617                                 STA  DRVREG
2154
0618                                 LDA  #$FF
2155
0619                                 STA  PRIREG  ; $FAF8
2156
0620                                 STA  CCREG
2157
0621                                 STA  AAAREG
2158
0622                                 STA  BBBREG
2159
0623                                 TST  CCREG
2160
0624                                 LDA  #$D8
2161
0625                                 STA  COMREG
2162
0626                                 LBSR DLY
2163
0627                         DBOOT0  LDA  COMREG
2164
0628                                 BMI  DBOOT0
2165
0629                                 LDA  #$09
2166
0630                                 STA  COMREG
2167
0631                                 LBSR DLY
2168
0632                         *
2169
0633                         DISKWT  LDA  COMREG  ; FETCH DRIVE STATUS
2170
0634                                 BITA #1      ; TEST BUSY BIT
2171
0635                                 BNE  DISKWT  ; LOOP UNTIL NOT BUSY
2172
0636                         *
2173
0637                                 BITA #$10
2174
0638                                 BNE  DBOOT
2175
0639                         *
2176
0640                                 LDX  #$C000  ; LOGICAL ADDR. = $C000
2177
0641                                 BSR LRA      ; GET 20 BIT PHYSICAL ADDR. OF LOG. ADDR.
2178
0642                                 ORA  #$10
2179
0643                                 STA  CCCREG
2180
0644                                 TFR  X,D
2181
0645                                 COMA  ;
2182
0646                                 COMB  ;
2183
0647                                 STD  ADDREG
2184
0648                                 LDX  #$FEFF  ; LOAD DMA BYTE COUNT = $100
2185
0649                                 STX  CNTREG  ; STORE IN COUNT REGISTER
2186
0650                                 LDA  #$FF    ; LOAD THE CHANNEL REGISTER
2187
0651                                 STA  CCREG
2188
0652                                 LDA  #$FE    ; SET CHANNEL 0
2189
0653                                 STA  PRIREG
2190
0654                                 LDA  #1      ; SET SECTOR TO "1"
2191
0655                                 STA  SECREG  ; ISSUE COMMAND
2192
0656                                 LDA  #$8C    ; SET SINGLE SECTOR READ
2193
0657                                 STA  COMREG  ; ISSUE COMMAND
2194
0658                                 BSR  DLY
2195
0659                         *
2196
0660                         * THE FOLLOWING CODE TESTS THE STATUS OF THE
2197
0661                         * CHANNEL CONTROL REGISTER. IF "D7" IS NOT
2198
0662                         * ZERO THEN IT WILL LOOP WAITING FOR "D7"
2199
0663                         * TO GO TO ZERO. IF AFTER 65,536 TRIES IT
2200
0664                         * IS STILL A ONE THE BOOT OPERATION WILL
2201
0665                         * BE STARTED OVER FROM THE BEGINING.
2202
0666                         *
2203
0667                                 CLRB         ;
2204
0668                         DBOOT1  PSHS B       ; $FB55
2205
0669                                 CLRB         ;
2206
0670                         DBOOT2  TST  CCREG
2207
0671                                 BPL  DBOOT3
2208
0672                                 DECB  ;
2209
0673                                 BNE  DBOOT2
2210
0674                                 PULS B
2211
0675                                 DECB
2212
0676                                 BNE  DBOOT1
2213
0677                                 BRA  DBOOT
2214
0678                         DBOOT3  PULS B
2215
0679                                 LDA  COMREG
2216
0680                                 BITA #$1C
2217
0681                                 BEQ  DBOOT4
2218
0682                                 RTS  ;
2219
0683                         *
2220
0684                         *
2221
0685                         DBOOT4  LDB  #$DE
2222
0686                                 STB  DRVREG
2223
0687                                 LDX  #$C000
2224
0688                                 STX  10,U
2225
0689                                 TFR  U,S     ; $FB7B
2226
0690                                 RTI  ;
2227
0691                                 ENDIF DMAFOPT
2228
0691                                 ENDIF DMAFOPT
2229
0692                         *
2230
0693                                 IFD CF8OPT
2231
0694                         *
2232
0695                         * COMPACT FLASH BOOT
2233
0696                         *
2234
0697                         CFBOOT  BSR  WAITRDY
2235
0698                                 LDA  #HEADLBA
2236
0699                                 STA  CF_HEAD
2237
0700                                 BSR  WAITRDY
2238
0701                                 LDA  #FEAT8BIT
2239
0702                                 STA  CF_FEATURE
2240
0703                                 LDA  #CMDFEATURE
2241
0704                                 STA  CF_COMAND
2242
0705                                 BSR  WAITRDY
2243
0706                         *
2244
0707                         * READ SECTORS FROM CF
2245
0708                         *
2246
0709                         CFREAD  LDA  #$01
2247
0710                                 STA  CF_SECCNT
2248
0711                                 CLRA
2249
0712                                 STA  CF_SECNUM
2250
0713                                 STA  CF_CYLLO
2251
0714                                 STA  CF_CYLHI
2252
0715                         *
2253
0716                                 LDA  #CMDREAD ; IDE READ MULTIPLE
2254
0717                                 STA  CF_COMAND
2255
0718                                 BSR  WAITRDY
2256
0719                                 LDX  #$C000
2257
0720                         *
2258
0721                         * READ LOOP
2259
0722                         *
2260
0723                         RDLOOP  BSR  WAITDRQ
2261
0724                                 LDA  CF_DATA
2262
0725                                 STA  ,X+
2263
0726                                 CMPX #$C200
2264
0727                                 BNE  RDLOOP
2265
0728                         *
2266
0729                                 LDX  #$C000
2267
0730                                 STX  $0A,U
2268
0731                                 TFR  U,S
2269
0732                                 RTI
2270
0733                         *
2271
0734                         * WAIT UNTIL READY
2272
0735                         *
2273
0736                         WAITRDY LDA  CF_STATUS
2274
0737                                 BITA #BUSY
2275
0738                                 BNE  WAITRDY
2276
0739                                 LDA  CF_STATUS
2277
0740                                 BITA #DRDY
2278
0741                                 BEQ  WAITRDY
2279
0742                                 RTS
2280
0743                         *
2281
0744                         * WAIT FOR DATA REQUEST
2282
0745                         *
2283
0746                         WAITDRQ LDA  CF_STATUS
2284
0747                                 BITA #DRQ
2285
0748                                 BEQ  WAITDRQ
2286
0749                                 RTS
2287
0750                                 ENDIF CF8OPT
2288
0750                                 ENDIF CF8OPT
2289
0751                         *
2290
0752                                 IFD IDEOPT
2291
0753                         *
2292
0754                         * XESS 16 BIT IDE BOOT
2293
0755                         *
2294 221 davidgb
0756 F9D5 CC 00 06           IDEBOOT LDD  #AUXRESET
2295
0757 F9D8 FD E1 1E                   STD  CF_AUX
2296
0758 F9DB CC 00 02                   LDD #AUXRSTREL
2297
0759 F9DE FD E1 1E                   STD CF_AUX
2298
0760 F9E1 CC 00 E0                   LDD  #HEADLBA
2299
0761 F9E4 FD E1 0C                   STD  CF_HEAD
2300
0762 F9E7 8D 2E                      BSR  WAITRDY
2301 218 davidgb
0763                         *
2302
0764                         * READ SECTORS FROM CF
2303
0765                         *
2304 221 davidgb
0766 F9E9 CC 00 01                   LDD  #$01
2305
0767 F9EC FD E1 04                   STD  CF_SECCNT
2306
0768 F9EF 5F                         CLRB
2307
0769 F9F0 FD E1 06                   STD  CF_SECNUM
2308
0770 F9F3 FD E1 08                   STD  CF_CYLLO
2309
0771 F9F6 FD E1 0A                   STD  CF_CYLHI
2310 218 davidgb
0772                         *
2311 221 davidgb
0773 F9F9 C6 20                      LDB  #CMDREAD ; IDE READ MULTIPLE
2312
0774 F9FB FD E1 0E                   STD  CF_COMAND
2313
0775 F9FE 8D 17                      BSR  WAITRDY
2314
0776 FA00 8E C0 00                   LDX  #$C000
2315 218 davidgb
0777                         *
2316
0778                         * READ LOOP
2317
0779                         *
2318 221 davidgb
0780 FA03 8D 21              RDLOOP  BSR  WAITDRQ
2319
0781 FA05 FC E1 00                   LDD  CF_DATA
2320
0782 FA08 E7 80                      STB  ,X+
2321
0783 FA0A 8C C1 00                   CMPX #$C100
2322
0784 FA0D 26 F4                      BNE  RDLOOP
2323 218 davidgb
0785                         *
2324 221 davidgb
0786 FA0F 8E C0 00                   LDX  #$C000
2325
0787 FA12 AF 4A                      STX  $0A,U
2326
0788 FA14 1F 34                      TFR  U,S
2327
0789 FA16 3B                         RTI
2328 218 davidgb
0790                         *
2329
0791                         * WAIT UNTIL READY
2330
0792                         *
2331 221 davidgb
0793 FA17 FC E1 0E           WAITRDY LDD  CF_STATUS
2332
0794 FA1A C5 80                      BITB #BUSY
2333
0795 FA1C 26 F9                      BNE  WAITRDY
2334
0796 FA1E FC E1 0E                   LDD  CF_STATUS
2335
0797 FA21 C5 40                      BITB #DRDY
2336
0798 FA23 27 F2                      BEQ  WAITRDY
2337
0799 FA25 39                         RTS
2338 218 davidgb
0800                         *
2339
0801                         * WAIT FOR DATA REQUEST
2340
0802                         *
2341 221 davidgb
0803 FA26 FC E1 0E           WAITDRQ LDD  CF_STATUS
2342
0804 FA29 C5 08                      BITB #DRQ
2343
0805 FA2B 27 F9                      BEQ  WAITDRQ
2344
0806 FA2D 39                         RTS
2345 218 davidgb
0807                                 ENDIF IDEOPT
2346
0808                         *
2347
0809                                 IFD RTCOPT
2348
0810                         *
2349
0811                         * CLOCK INTER FACE UTILITY
2350
0812                         *
2351
0813                         * TIME   
2352
0814                         * If no argument is specified, the current time
2353
0815                         * will be displayed.
2354
0816                         *
2355
0817                         * READ A REGISTER FROM THE COUNTER.
2356
0818                         * The X Index rgister points to the register
2357
0819                         * to be read. The Status Register is checked
2358
0820                         * before and after the register is read before
2359
0821                         * returning a value in accumulator A
2360
0822                         *
2361
0823                         RDCLK  TST CLKSTA
2362
0824                                BNE RDCLK
2363
0825                         RDCLK1 LDA 0,X
2364
0826                                TST CLKSTA
2365
0827                                BNE RDCLK1
2366
0828                                RTS
2367
0829                         *
2368
0830                         * MAIN PROGRAM:
2369
0831                         *
2370
0832                         TIMSET LDX #COUNTR    ; POINT TO TIMER
2371
0833                               LBSR BYTE       ; READ HOURS
2372
0834                               BVS  SHOWTM     ; NO ARG, DISP TIME
2373
0835                               STA HOUR,X
2374
0836                               LBSR OUT1S
2375
0837                               LBSR BYTE       ; READ MINUITES
2376
0838                               BVS  SHOWTM
2377
0839                               STA MINUIT,X
2378
0840                               LBSR OUT1S
2379
0841                               LBSR BYTE       ; SECONDS.
2380
0842                               BVS SHOWTM
2381
0843                               STA SECOND,X
2382
0844                         *
2383
0845                         * DISPLAY CURRENT TIME
2384
0846                         *
2385
0847                         SHOWTM LBSR PCRLF
2386
0848                                LDX #COUNTR+HOUR
2387
0849                                LDB #3
2388
0850                         SHOWLP BSR RDCLK
2389
0851                                LBSR OUT2H
2390
0852                                LDA #':
2391
0853                                LBSR OUTCH
2392
0854                                LEAX -1,X
2393
0855                                DECB
2394
0856                                BNE SHOWLP
2395
0857                                RTS
2396
0858                         *
2397
0859                         * INITIATE CLOCK.
2398
0860                         * MASK INTERRUPTS.
2399
0861                         *
2400
0862                         CLKINZ CLR CINTCR     ; MASK ALL INTERRUPTS
2401
0863                                TST CINTSR     ; CLEAR ANY INTERRUPTS
2402
0864                                RTS
2403
0865                                ENDIF RTCOPT
2404
0865                                ENDIF RTCOPT
2405
0866                                IFD DATOPT
2406
0867                         *
2407
0868                         ***** LRA LOAD REAL ADDRESS *****
2408
0869                         *
2409
0870                         * THE FOLLOWING CODE LOADS THE 20-BIT
2410
0871                         * PHYSICAL ADDRESS OF A MEMORY BYTE
2411
0872                         * INTO THE "A" AND "X" REGISTERS. THIS
2412
0873                         * ROUTINE IS ENTERED WITH THE LOGICAL
2413
0874                         * ADDRESS OF A MEMORY BYTE IN THE "IX"
2414
0875                         * REGISTER. EXIT IS MADE WITH THE HIGH-
2415
0876                         * ORDER FOUR BITS OF THE 20-BIT PHYSICAL
2416
0877                         * ADDRESS IN THE "A" REGISTER, AND THE
2417
0878                         * LOW-ORDER 16-BITS OF THE 20-BIT
2418
0879                         * PHYSICAL ADDRESS IN THE "IX" REGISTER.
2419
0880                         * ALL OTHER REGISTERS ARE PRESERVED.
2420
0881                         * THIS ROUTINE IS REQUIRED SINCE THE
2421
0882                         * DMAF1 AND DMAF2 DISK CONTROLLERS MUST
2422
0883                         * PRESENT PHYSICAL ADDRESSES ON THE
2423
0884                         * SYSTEM BUS.
2424
0885                         *
2425 221 davidgb
0886 FA2E 34 36              LRA     PSHS A,B,X,Y  ; PUSH REGISTERS ON STACK
2426
0887 FA30 A6 62                      LDA  2,S      ; GET MSB LOGICAL ADDR FRM X REG ON STACK
2427
0888 FA32 44                         LSRA          ;
2428
0889 FA33 44                         LSRA          ; ADJ FOR INDEXED INTO
2429
0890 FA34 44                         LSRA          ; CORRESPONDING LOCATION
2430
0891 FA35 44                         LSRA          ; IN LRA TABLE
2431
0892 FA36 10 8E DF D0                LDY  #LRARAM  ; LOAD LRA TABLE BASE ADDRESS
2432
0893 FA3A E6 A6                      LDB  A,Y      ; GET PHYSICAL ADDR. DATA FROM LRA TABLE
2433
0894 FA3C 54                         LSRB          ; ADJ. REAL ADDR. TO REFLECT EXTENDED
2434
0895 FA3D 54                         LSRB          ; PHYSICAL ADDRESS.
2435
0896 FA3E 54                         LSRB          ; EXTENDED MS 4-BITS ARE RETURNED
2436
0897 FA3F 54                         LSRB          ; IN THE "A" ACCUMULATOR
2437
0898 FA40 E7 E4                      STB  ,S       ; MS 4 BITS IN A ACCUM. STORED ON STACK
2438
0899 FA42 E6 A6                      LDB  A,Y      ; LOAD REAL ADDRESS DATA FROM LRA TABLE
2439
0900 FA44 53                         COMB          ; COMP TO ADJ FOR PHYSICAL ADDR. IN X REG
2440
0901 FA45 58                         ASLB          ; ADJ DATA FOR RELOCATION IN X REG
2441
0902 FA46 58                         ASLB          ;
2442
0903 FA47 58                         ASLB          ; $FB97
2443
0904 FA48 58                         ASLB          ;
2444
0905 FA49 A6 62                      LDA  2,S      ; GET MS BYTE OF LOGICAL ADDR.
2445
0906 FA4B 84 0F                      ANDA #$0F     ; MASK MS NIBBLE OF LOGICAL ADDRESS
2446
0907 FA4D A7 62                      STA  2,S      ; SAVE IT IN X REG ON STACK
2447
0908 FA4F EA 62                      ORB  2,S      ; SET MS BYTE IN X REG TO ADJ PHY ADDR.
2448 218 davidgb
0909                         *
2449
0910                         * PLUS LS NIBBLE OF LOGICAL ADDRESS
2450
0911                         *
2451 221 davidgb
0912 FA51 E7 62                      STB  2,S      ; SAVE AS LS 16 BITS OF PHY ADDR IN X REG ON STACK
2452
0913 FA53 35 B6                      PULS A,B,X,Y,PC ; POP REGS. FROM STACK
2453 218 davidgb
0914                                 ENDIF DATOPT
2454
0915                         *
2455
0916                         * DELAY LOOP
2456
0917                         *
2457 221 davidgb
0918 FA55 34 04              DLY     PSHS B        ; SAVE CONTENTS OF "B"
2458
0919 FA57 C6 20                      LDB  #$20     ; GET LOOP DELAY VALUE
2459
0920 FA59 5A                 SUB1    DECB          ; SUBTRACT ONE FROM VALUE
2460
0921 FA5A 26 FD                      BNE  SUB1     ; LOOP UNTIL ZERO
2461
0922 FA5C 35 84                      PULS B,PC     ; RESTORE CONTENTS OF "B"
2462 218 davidgb
0923                         * RTS  ;
2463
0924                         *
2464
0925                         ***** "L" LOAD MIKBUG TAPE *****
2465
0926                         *
2466 221 davidgb
0927 FA5E BD FC F9           LOAD    JSR  ACINIZ
2467
0928 FA61 86 11                      LDA  #$11     ; LOAD 'DC1' CASS. READ ON CODE
2468
0929 FA63 17 02 7A                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL PORT
2469
0930 FA66 7F DF E2                   CLR  ECHO     ; TURN OFF ECHO FLAG
2470
0931 FA69 17 02 2A           LOAD1   LBSR ECHON    ; INPUT 8 BIT BYTE WITH NO ECHO
2471
0932 FA6C 81 53              LOAD2   CMPA #'S      ; IS IT AN "S", START CHARACTER ?
2472
0933 FA6E 26 F9                      BNE  LOAD1    ; IF NOT, DISCARD AND GET NEXT CHAR.
2473
0934 FA70 17 02 23                   LBSR ECHON
2474
0935 FA73 81 39                      CMPA #'9      ; IS IT A "9" , END OF FILE CHAR ?
2475
0936 FA75 27 3D                      BEQ  LOAD21   ; IF SO, EXIT LOAD
2476
0937 FA77 81 31                      CMPA #'1      ; IS IT A "1" , FILE LOAD CHAR ?
2477
0938 FA79 26 F1                      BNE  LOAD2    ; IF NOT, LOOK FOR START CHAR.
2478
0939 FA7B 17 01 A8                   LBSR BYTE     ; INPUT BYTE COUNT
2479
0940 FA7E 34 02                      PSHS A        ; PUSH COUNT ON STACK
2480
0941 FA80 29 26                      BVS  LODERR   ; (V) C-CODE SET, ILLEGAL HEX
2481
0942 FA82 17 01 91                   LBSR IN1ADR   ; INPUT LOAD ADDRESS
2482
0943 FA85 29 21                      BVS  LODERR   ; (V) C-CODE SET, ADDR NOT HEX
2483
0944 FA87 34 10                      PSHS X        ; PUSH ADDR ON STACK
2484
0945 FA89 E6 E0                      LDB  ,S+      ; LOAD MSB OF ADDR AS CHECKSUM BYTE
2485
0946 FA8B EB E0                      ADDB ,S+      ; ADD LSB OF ADDR TO CHECKSUM
2486
0947 FA8D EB E4                      ADDB ,S       ; ADD BYTE COUNT BYTE TO CHECKSUM
2487
0948 FA8F 6A E4                      DEC  ,S       ; $FC37 DECREMENT BYTE COUNT 2 TO BYPASS
2488
0949 FA91 6A E4                      DEC  ,S       ; ADDRESS BYTES.
2489
0950 FA93 34 04              LOAD10  PSHS B        ; PUSH CHECKSUM ON STACK
2490
0951 FA95 17 01 8E                   LBSR BYTE     ; INPUT DATA BYTE (2 HEX CHAR)
2491
0952 FA98 35 04                      PULS B        ; POP CHECKSUM FROM STACK
2492
0953 FA9A 29 0C                      BVS  LODERR   ; (V) SET, DATA BYTE NOT HEX
2493
0954 FA9C 34 02                      PSHS A        ; PUSH DATA BYTE ON STACK
2494
0955 FA9E EB E0                      ADDB ,S+      ; ADD DATA TO CHECKSUM, AUTO INC STACK
2495
0956 FAA0 6A E4                      DEC  ,S       ; DECREMENT BYTE COUNT 1
2496
0957 FAA2 27 05                      BEQ  LOAD16   ; IF BYTE COUNT ZERO, TEST CHECKSUM
2497
0958 FAA4 A7 80                      STA  ,X+      ; SAVE DATA BYTE IN MEMORY
2498
0959 FAA6 20 EB                      BRA  LOAD10   ; GET NEXT DATA BYTE
2499
0960 FAA8 5F                 LODERR  CLRB          ; ERROR CONDITION, ZERO CHECKSUM  ;
2500
0961 FAA9 35 02              LOAD16  PULS A        ; ADJUST STACK (REMOVE BYTE COUNT)
2501
0962 FAAB C1 FF                      CMPB #$FF     ; CHECKSUM OK?
2502
0963 FAAD 27 BA                      BEQ  LOAD1    ; IF SO, LOAD NEXT LINE
2503
0964 FAAF 86 3F                      LDA  #'?      ; LOAD (?) ERROR INDICATOR
2504
0965 FAB1 17 02 2C                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL
2505
0966 FAB4 73 DF E2           LOAD21  COM  ECHO     ; TURN ECHO ON
2506
0967 FAB7 86 13                      LDA  #$13     ; $FC5F LOAD 'DC3' CASS. READ OFF CODE
2507
0968 FAB9 16 02 24                   LBRA OUTCH    ; OUTPUT IT
2508 218 davidgb
0969                         *
2509
0970                         ***** "P" PUNCH MIKBUG TAPE *****
2510
0971                         *
2511 221 davidgb
0972 FABC 6F E2              PUNCH   CLR  ,-S      ; CLEAR RESERVED BYTE ON STACK
2512
0973 FABE 17 01 4A                   LBSR IN2ADR   ; GET BEGIN AND END ADDRESS
2513
0974 FAC1 34 30                      PSHS X,Y      ; SAVE ADDRESSES ON STACK
2514
0975 FAC3 29 4D                      BVS  PUNEXT   ; (V) C-CODE SET, EXIT PUNCH
2515
0976 FAC5 AC 62                      CMPX 2,S      ; COMPARE BEGIN TO END ADDR
2516
0977 FAC7 25 49                      BCS  PUNEXT   ; IF BEGIN GREATER THAN END, EXIT PUNCH
2517
0978 FAC9 30 01                      LEAX 1,X      ; INCREMENT END ADDRESS
2518
0979 FACB AF E4                      STX  ,S       ; STORE END ADDR ON STACK
2519
0980 FACD BD FC F9                   JSR  ACINIZ
2520
0981 FAD0 86 12                      LDA  #$12     ; LOAD 'DC2' PUNCH ON CODE
2521
0982 FAD2 17 02 0B                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL
2522
0983 FAD5 EC E4              PUNCH2  LDD  ,S       ; LOAD END ADDR IN D-ACC
2523
0984 FAD7 A3 62                      SUBD 2,S      ; SUBTRACT BEGIN FROM END
2524
0985 FAD9 27 06                      BEQ  PUNCH3   ; SAME, PUNCH 32 BYTES DEFAULT
2525
0986 FADB 10 83 00 20                CMPD #$20     ; LESS THAN 32 BYTES?
2526
0987 FADF 23 02                      BLS  PUNCH4   ; PUNCH THAT MANY BYTES
2527
0988 FAE1 C6 20              PUNCH3  LDB  #$20     ; LOAD BYTE COUNT OF 32.
2528
0989 FAE3 E7 64              PUNCH4  STB  4,S      ; STORE ON STACK AS BYTE COUNT
2529
0990 FAE5 8E FE F3                   LDX  #MSG20   ; POINT TO MSG "S1"
2530
0991 FAE8 17 00 2F                   LBSR PSTRNG   ; PRINT MSG
2531
0992 FAEB CB 03                      ADDB #3       ; ADD 3 BYTES TO BYTE COUNT
2532
0993 FAED 1F 98                      TFR  B,A      ; GET BYTE COUNT IN A-ACC TO PUNCH
2533
0994 FAEF 17 01 75                   LBSR OUT2H    ; OUTPUT BYTE COUNT
2534
0995 FAF2 AE 62                      LDX  2,S      ; LOAD BEGIN ADDRESS
2535
0996 FAF4 17 01 68                   LBSR OUT4H    ; PUNCH ADDRESS
2536
0997 FAF7 EB 62                      ADDB 2,S      ; ADD ADDR MSB TO CHECKSUM
2537
0998 FAF9 EB 63                      ADDB 3,S      ; ADD ADDR LSB TO CHECKSUM
2538
0999 FAFB EB 84              PUNCHL  ADDB ,X       ; ADD DATA BYTE TO CHECKSUM
2539
1000 FAFD A6 80                      LDA  ,X+      ; LOAD DATA BYTE TO PUNCH
2540
1001 FAFF 17 01 65                   LBSR OUT2H    ; OUTPUT DATA BYTE
2541
1002 FB02 6A 64                      DEC  4,S      ; DECREMENT BYTE COUNT
2542
1003 FB04 26 F5                      BNE  PUNCHL   ; NOT DONE, PUNCH NEXT BYTE
2543
1004 FB06 53                         COMB  1's     ; COMPLIMENT CHECKSUM BYTE
2544
1005 FB07 1F 98                      TFR  B,A      ; GET IT IN A-ACC TO PUNCH
2545
1006 FB09 17 01 5B                   LBSR OUT2H    ; OUTPUT CHECKSUM BYTE
2546
1007 FB0C AF 62                      STX  2,S      ; SAVE X-REG IN STACK AS NEW PUNCH ADDR
2547
1008 FB0E AC E4                      CMPX ,S       ; COMPARE IT TO END ADDR
2548
1009 FB10 26 C3                      BNE  PUNCH2   ; $FCB5 PUNCH NOT DONE, CONT.
2549
1010 FB12 86 14              PUNEXT  LDA  #$14     ; LOAD 'DC4' PUNCH OFF CODE
2550
1011 FB14 17 01 C9                   LBSR OUTCH    ; OUTPUT IT
2551
1012 FB17 32 65                      LEAS 5,S      ; READJUST STACK POINTER
2552
1013 FB19 39                         RTS  ;
2553 218 davidgb
1014                         *
2554
1015                         * PRINT STRING PRECEEDED BY A CR & LF.
2555
1016                         *
2556 221 davidgb
1017 FB1A 8D 02              PSTRNG  BSR  PCRLF    ; PRINT CR/LF
2557
1018 FB1C 20 71                      BRA  PDATA    ; PRINT STRING POINTED TO BY IX
2558 218 davidgb
1019                         *
2559
1020                         * PCRLF
2560
1021                         *
2561 221 davidgb
1022 FB1E 34 10              PCRLF   PSHS X        ; SAVE IX
2562
1023 FB20 8E FE A4                   LDX  #MSG2+1  ; POINT TO MSG CR/LF + 3 NULS
2563
1024 FB23 17 00 69                   LBSR PDATA    ; PRINT MSG
2564
1025 FB26 35 90                      PULS X,PC     ; RESTORE IX & RETURN
2565 218 davidgb
1026                         *
2566
1027                         * LONG BRANCHES TO COMMON ROUTINES
2567
1028                         *
2568 221 davidgb
1029 FB28 16 01 B3           JOUT1S  LBRA OUT1S
2569
1030 FB2B 16 00 F8           JBYTE   LBRA BYTE
2570
1031 FB2E 16 00 E5           JIN1ADR LBRA IN1ADR
2571 218 davidgb
1032                         *
2572
1033                         * ALTER "PC" PROGRAM COUNTER
2573
1034                         *
2574 221 davidgb
1035 FB31 17 00 91           ALTRPC  LBSR  PRTPC   ; $FCF5 PRINT MSG " PC = "
2575
1036 FB34 8D F2              ALTPC1  BSR  JOUT1S   ; OUTPUT SPACE
2576
1037 FB36 8D F6                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "PC"
2577
1038 FB38 29 02                      BVS  ALTPCD   ; EXIT IF INVALID HEX
2578
1039 FB3A AF 4A                      STX  10,U     ; POKE IN NEW CONTENTS
2579
1040 FB3C 39                 ALTPCD  RTS           ;
2580 218 davidgb
1041                         *
2581
1042                         * ALTER "U" USER STACK POINTER
2582
1043                         *
2583 221 davidgb
1044 FB3D 8D 61              ALTRU   BSR  PRTUS    ; $FCCA PRINT MSG " US = "
2584
1045 FB3F 8D E7                      BSR  JOUT1S   ; OUTPUT SPACE
2585
1046 FB41 8D EB                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "US"
2586
1047 FB43 29 02                      BVS  ALTUD    ; EXIT IF INVALID HEX
2587
1048 FB45 AF 48                      STX  8,U      ; POKE IN NEW CONTENTS
2588
1049 FB47 39                 ALTUD   RTS           ;
2589 218 davidgb
1050                         *
2590
1051                         * ALTER "Y" INDEX REGISTER
2591
1052                         *
2592 221 davidgb
1053 FB48 8D 72              ALTRY   BSR  PRTIY    ; PRINT MSG " IY = "
2593
1054 FB4A 8D DC                      BSR  JOUT1S   ; OUTPUT SPACE
2594
1055 FB4C 8D E0                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "IY"
2595
1056 FB4E 29 02                      BVS  ALTYD    ; EXIT IF INVALID HEX
2596
1057 FB50 AF 46                      STX  6,U      ; $F8F0 POKE IN NEW CONTENTS
2597
1058 FB52 39                 ALTYD   RTS           ;
2598 218 davidgb
1059                         *
2599
1060                         * ALTER "X" INDEX REGISTER
2600
1061                         *
2601 221 davidgb
1062 FB53 8D 5E              ALTRX   BSR  PRTIX    ; $FCE0 PRINT MSG " IX = "
2602
1063 FB55 8D D1                      BSR  JOUT1S   ; OUTPUT SPACE
2603
1064 FB57 8D D5                      BSR  JIN1ADR
2604
1065 FB59 29 02                      BVS  ALTXD
2605
1066 FB5B AF 44                      STX  4,U
2606
1067 FB5D 39                 ALTXD   RTS ;
2607 218 davidgb
1068                         *
2608
1069                         * ALTER "DP" DIRECT PAGE REGISTER
2609
1070                         *
2610 221 davidgb
1071 FB5E 8D 49              ALTRDP  BSR  PRTDP    ; $FCD5 PRINT MSG " DP = "
2611
1072 FB60 8D C6                      BSR  JOUT1S   ; OUTPUT SPACE
2612
1073 FB62 8D C7                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
2613
1074 FB64 29 02                      BVS  ALTDPD
2614
1075 FB66 A7 43                      STA  3,U
2615
1076 FB68 39                 ALTDPD  RTS ;
2616 218 davidgb
1077                         *
2617
1078                         * ALTER "B" ACCUMULATOR
2618
1079                         *
2619 221 davidgb
1080 FB69 8D 6C              ALTRB   BSR  PRTB     ; $FD09 PRINT MSG " B = "
2620
1081 FB6B 8D BB                      BSR  JOUT1S   ; OUTPUT SPACE
2621
1082 FB6D 8D BC                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
2622
1083 FB6F 29 02                      BVS  ALTBD
2623
1084 FB71 A7 42                      STA  2,U
2624
1085 FB73 39                 ALTBD   RTS           ; $F91C
2625 218 davidgb
1086                         *
2626
1087                         * ALTER "A" ACCUMULATOR
2627
1088                         *
2628 221 davidgb
1089 FB74 8D 58              ALTRA   BSR  PRTA     ; $FCFF RINT MSG " A = "
2629
1090 FB76 8D B0                      BSR  JOUT1S   ; OUTPUT SPACE
2630
1091 FB78 8D B1                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
2631
1092 FB7A 29 02                      BVS  ALTAD
2632
1093 FB7C A7 41                      STA  1,U
2633
1094 FB7E 39                 ALTAD   RTS ;
2634 218 davidgb
1095                         *
2635
1096                         * ALTER "CC" REGISTER
2636
1097                         *
2637 221 davidgb
1098 FB7F 8D 5F              ALTRCC  BSR  PRTCC    ; $FD13 PRINT MSG " CC: "
2638
1099 FB81 8D A5                      BSR  JOUT1S   ; OUTPUT SPACE
2639
1100 FB83 8D A6                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
2640
1101 FB85 29 04                      BVS  ALTCCD
2641
1102 FB87 8A 80                      ORA  #$80     ; SETS "E" FLAG IN PRINT LIST
2642
1103 FB89 A7 C4                      STA  ,U
2643
1104 FB8B 39                 ALTCCD  RTS ;
2644 218 davidgb
1105                         *
2645
1106                         * PDATA
2646
1107                         *
2647 221 davidgb
1108 FB8C 17 01 51           PRINT   LBSR OUTCH
2648
1109 FB8F A6 80              PDATA   LDA  ,X+      ; GET 1st CHAR. TO PRINT
2649
1110 FB91 81 04                      CMPA #4       ; IS IT EOT?
2650
1111 FB93 26 F7                      BNE  PRINT    ; IF NOT EOT PRINT IT
2651
1112 FB95 39                         RTS  ;
2652 218 davidgb
1113                         *
2653
1114                         * PRINT REGISTERS
2654
1115                         *
2655 221 davidgb
1116 FB96 8E FE B6           PRTSP   LDX  #MSG10   ; POINT TO MSG "SP="
2656
1117 FB99 8D F4                      BSR  PDATA    ; PRINT MSG
2657
1118 FB9B 1F 31                      TFR  U,X
2658
1119 FB9D 16 00 BF           JOUT4H  LBRA OUT4H
2659 218 davidgb
1120                         *
2660 221 davidgb
1121 FBA0 8E FE C2           PRTUS   LDX  #MSG12   ; POINT TO MSG "US="
2661
1122 FBA3 8D EA                      BSR  PDATA    ; PRINT MSG
2662
1123 FBA5 AE 48                      LDX  8,U
2663
1124 FBA7 20 F4                      BRA  JOUT4H
2664 218 davidgb
1125                         *
2665 221 davidgb
1126 FBA9 8E FE D4           PRTDP   LDX   #MSG15  ; POINT TO MSG "DP="
2666
1127 FBAC 8D E1                      BSR  PDATA    ; PRINT MSG
2667
1128 FBAE A6 43                      LDA  3,U
2668
1129 FBB0 16 00 B4           JOUT2H  LBRA OUT2H    ; OUTPUT HEX BYTE AS ASCII
2669 218 davidgb
1130                         *
2670 221 davidgb
1131 FBB3 8E FE CE           PRTIX   LDX  #MSG14   ; POINT TO MSG "IX="
2671
1132 FBB6 8D D7                      BSR  PDATA    ; PRINT MSG
2672
1133 FBB8 AE 44                      LDX  4,U      ; $FCE6
2673
1134 FBBA 20 E1                      BRA  JOUT4H
2674 218 davidgb
1135                         *
2675 221 davidgb
1136 FBBC 8E FE C8           PRTIY   LDX  #MSG13   ; POINT TO MSG "IY="
2676
1137 FBBF 8D CE                      BSR  PDATA    ; PRINT MSG
2677
1138 FBC1 AE 46                      LDX  6,U
2678
1139 FBC3 20 D8                      BRA  JOUT4H
2679 218 davidgb
1140                         *
2680 221 davidgb
1141 FBC5 8E FE BC           PRTPC   LDX  #MSG11   ; POINT TO MSG "PC="
2681
1142 FBC8 8D C5                      BSR  PDATA    ; PRINT MSG
2682
1143 FBCA AE 4A                      LDX  10,U
2683
1144 FBCC 20 CF                      BRA  JOUT4H
2684 218 davidgb
1145                         *
2685 221 davidgb
1146 FBCE 8E FE DA           PRTA    LDX  #MSG16   ; POINT TO MSG "A="
2686
1147 FBD1 8D BC                      BSR  PDATA    ; PRINT MSG
2687
1148 FBD3 A6 41                      LDA  1,U
2688
1149 FBD5 20 D9                      BRA  JOUT2H   ; OUTPUT HEX BYTE AS ASCII
2689 218 davidgb
1150                         *
2690 221 davidgb
1151 FBD7 8E FE DF           PRTB    LDX  #MSG17   ; POINT TO MSG "B="
2691
1152 FBDA 8D B3                      BSR  PDATA    ; PRINT MSG
2692
1153 FBDC A6 42                      LDA  2,U
2693
1154 FBDE 20 D0                      BRA  JOUT2H   ; OUTPUT HEX BYTE AS ASCII
2694 218 davidgb
1155                         *
2695 221 davidgb
1156 FBE0 8E FE E4           PRTCC   LDX  #MSG18   ; POINT TO MSG "CC:"
2696
1157 FBE3 8D AA                      BSR  PDATA    ; PRINT MSG
2697
1158 FBE5 A6 C4                      LDA  ,U
2698
1159 FBE7 8E FE EB                   LDX  #MSG19   ; POINT TO MSG "EFHINZVC"
2699
1160 FBEA 16 00 90                   LBRA BIASCI   ; OUTPUT IN BINARY/ASCII FORMAT
2700 218 davidgb
1161                         *
2701
1162                         * "R" DISPLAY REGISTERS
2702
1163                         *
2703 221 davidgb
1164 FBED 8E FE B2           REGSTR  LDX  #MSG5    ; POINT TO MSG " - "
2704
1165 FBF0 17 FF 27                   LBSR PSTRNG   ; PRINT MSG
2705
1166 FBF3 8D A1                      BSR  PRTSP    ; $FCBF
2706
1167 FBF5 8D A9                      BSR  PRTUS    ; $FCCA
2707
1168 FBF7 8D B0                      BSR  PRTDP    ; $FCD5
2708
1169 FBF9 8D B8                      BSR  PRTIX    ; $FCE0
2709
1170 FBFB 8D BF                      BSR  PRTIY    ; $FCEB
2710
1171 FBFD 8E FE B2                   LDX  #MSG5    ; POINT TO MSG " - "
2711
1172 FC00 17 FF 17                   LBSR PSTRNG   ; PRINT MSG
2712
1173 FC03 8D C0                      BSR  PRTPC    ; $FCF5
2713
1174 FC05 8D C7                      BSR  PRTA     ; $FCFF
2714
1175 FC07 8D CE                      BSR  PRTB     ; $FD09
2715
1176 FC09 20 D5                      BRA  PRTCC    ; $FD13
2716 218 davidgb
1177                         *
2717
1178                         * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
2718
1179                         * OPERATOR TO INPUT TWO VALID HEX ADDRESSES.
2719
1180                         * THE FIRST ADDRESS INPUT IS RETURNED IN "IY".
2720
1181                         * THE SECOND IS RETURNED IN "IX". THE "V" BIT
2721
1182                         * IN THE C-CODE REG. IS SET IF AN INVALID HEX
2722
1183                         * ADDRESS IS INPUT.
2723
1184                         *
2724 221 davidgb
1185 FC0B 8D 09              IN2ADR  BSR  IN1ADR   ; GET FIRST ADDRESS
2725
1186 FC0D 29 4D                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
2726
1187 FC0F 1F 12                      TFR  X,Y      ; SAVE FIRST ADDR. IN "IY"
2727
1188 FC11 86 2D                      LDA  #'-
2728
1189 FC13 17 00 CA                   LBSR OUTCH    ; PRINT " - "
2729 218 davidgb
1190                         *
2730
1191                         * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
2731
1192                         * OPERATOR TO INPUT ONE VALID HEX ADDRESS. THE
2732
1193                         * ADDRESS IS RETURNED IN THE "X" REGISTER.
2733
1194                         *
2734 221 davidgb
1195 FC16 8D 0E              IN1ADR  BSR  BYTE     ; INPUT BYTE (2 HEX CHAR)
2735
1196 FC18 29 42                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
2736
1197 FC1A 1F 01                      TFR  D,X
2737
1198 FC1C 8D 08                      BSR  BYTE     ; INPUT BYTE (2 HEX CHAR)
2738
1199 FC1E 29 3C                      BVS  NOTHEX
2739
1200 FC20 34 10                      PSHS X
2740
1201 FC22 A7 61                      STA  1,S
2741
1202 FC24 35 90                      PULS X,PC
2742 218 davidgb
1203                         *
2743
1204                         ***** INPUT BYTE (2 HEX CHAR.) *****
2744
1205                         *
2745 221 davidgb
1206 FC26 8D 11              BYTE    BSR  INHEX    ; GET HEX LEFT
2746
1207 FC28 29 32                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
2747
1208 FC2A 48                         ASLA          ;
2748
1209 FC2B 48                         ASLA          ;
2749
1210 FC2C 48                         ASLA          ; SHIFT INTO LEFT NIBBLE
2750
1211 FC2D 48                         ASLA          ;
2751
1212 FC2E 1F 89                      TFR  A,B      ; PUT HEXL IN "B"
2752
1213 FC30 8D 07                      BSR  INHEX    ; GET HEX RIGHT
2753
1214 FC32 29 28                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
2754
1215 FC34 34 04                      PSHS B        ; PUSH HEXL ON STACK
2755
1216 FC36 AB E0                      ADDA ,S+      ; ADD HEXL TO HEXR AND ADJ. STK
2756
1217 FC38 39                         RTS           ; RETURN WITH HEX L&R IN "A"
2757 218 davidgb
1218                         *
2758
1219                         *
2759 221 davidgb
1220 FC39 8D 5B              INHEX   BSR  ECHON    ; INPUT ASCII CHAR.
2760
1221 FC3B 81 30                      CMPA #'0      ; IS IT > OR = "0" ?
2761
1222 FC3D 25 1D                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
2762
1223 FC3F 81 39                      CMPA #'9      ; IS IT < OR = "9" ?
2763
1224 FC41 22 03                      BHI  INHEXA   ; IF > MAYBE IT'S ALPHA
2764
1225 FC43 80 30                      SUBA #$30     ; ASCII ADJ. NUMERIC
2765
1226 FC45 39                         RTS           ;
2766 218 davidgb
1227                         *
2767
1228                         *
2768 221 davidgb
1229 FC46 81 41              INHEXA  CMPA #'A      ; IS IT > OR = "A"
2769
1230 FC48 25 12                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
2770
1231 FC4A 81 46                      CMPA #'F      ; IS IT < OR = "F" ?
2771
1232 FC4C 22 03                      BHI  INHEXL   ; IF > IT AIN'T HEX
2772
1233 FC4E 80 37                      SUBA #'A-10   ; ($37) ASCII ADJ. ALPHA
2773
1234 FC50 39                         RTS           ;
2774 218 davidgb
1235                         *
2775 221 davidgb
1236 FC51 81 61              INHEXL  CMPA #'a      ; IS IT > OR = "a"
2776
1237 FC53 25 07                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
2777
1238 FC55 81 66                      CMPA #'f      ; IS IT < "f"
2778
1239 FC57 22 03                      BHI  NOTHEX   ; IF > IT AIN'T HEX
2779
1240 FC59 80 57                      SUBA #'a-10   ; ($57) ADJUST TO LOWER CASE
2780
1241 FC5B 39                         RTS           ;
2781 218 davidgb
1242                         *
2782
1243                         *
2783 221 davidgb
1244 FC5C 1A 02              NOTHEX  ORCC #2       ; SET (V) FLAG IN C-CODES REGISTER
2784
1245 FC5E 39                         RTS           ;
2785 218 davidgb
1246                         *
2786
1247                         *
2787 221 davidgb
1248 FC5F 34 10              OUT4H   PSHS X        ; PUSH X-REG. ON THE STACK
2788
1249 FC61 35 02                      PULS A        ; POP MS BYTE OF X-REG INTO A-ACC.
2789
1250 FC63 8D 02                      BSR  OUTHL    ; OUTPUT HEX LEFT
2790
1251 FC65 35 02                      PULS A        ; POP LS BYTE OF X-REG INTO A-ACC.
2791
1252 FC67                    OUTHL   EQU *
2792
1253 FC67 34 02              OUT2H   PSHS A        ; SAVE IT BACK ON STACK
2793
1254 FC69 44                         LSRA          ; CONVERT UPPER HEX NIBBLE TO ASCII
2794
1255 FC6A 44                         LSRA          ;
2795
1256 FC6B 44                         LSRA          ;
2796
1257 FC6C 44                         LSRA          ;
2797
1258 FC6D 8D 04                      BSR  XASCII   ; PRINT HEX NIBBLE AS ASCII
2798
1259 FC6F 35 02              OUTHR   PULS A        ; CONVERT LOWER HEX NIBBLE TO ASCII
2799
1260 FC71 84 0F                      ANDA #$0F     ; STRIP LEFT NIBBLE
2800
1261 FC73 8B 30              XASCII  ADDA #$30     ; ASCII ADJ
2801
1262 FC75 81 39                      CMPA #$39     ; IS IT < OR = "9" ?
2802
1263 FC77 2F 02                      BLE  OUTC     ; IF LESS, OUTPUT IT
2803
1264 FC79 8B 07                      ADDA #7       ; IF > MAKE ASCII LETTER
2804
1265 FC7B 20 63              OUTC    BRA  OUTCH    ; OUTPUT CHAR
2805 218 davidgb
1266                         *
2806
1267                         * BINARY / ASCII --- THIS ROUTINE
2807
1268                         * OUTPUTS A BYTE IN ENHANCED
2808
1269                         * BINARY FORMAT. THE ENHANCEMENT
2809
1270                         * IS DONE BY SUBSTITUTING ASCII
2810
1271                         * LETTERS FOR THE ONES IN THE BYTE.
2811
1272                         * THE ASCII ENHANCEMENT LETTERS
2812
1273                         * ARE OBTAINED FROM THE STRING
2813
1274                         * POINTED TO BY THE INDEX REG. "X".
2814
1275                         *
2815 221 davidgb
1276 FC7D 34 02              BIASCI  PSHS A        ; SAVE "A" ON STACK
2816
1277 FC7F C6 08                      LDB  #8       ; PRESET LOOP# TO BITS PER BYTE
2817
1278 FC81 A6 80              OUTBA   LDA  ,X+      ; GET LETTER FROM STRING
2818
1279 FC83 68 E4                      ASL  ,S       ; TEST BYTE FOR "1" IN B7
2819
1280 FC85 25 02                      BCS  PRTBA    ; IF ONE PRINT LETTER
2820
1281 FC87 86 2D                      LDA  #'-      ; IF ZERO PRINT "-"
2821
1282 FC89 8D 55              PRTBA   BSR  OUTCH    ; PRINT IT
2822
1283 FC8B 8D 51                      BSR  OUT1S    ; PRINT SPACE
2823
1284 FC8D 5A                         DECB          ; SUB 1 FROM #BITS YET TO PRINT
2824
1285 FC8E 26 F1                      BNE  OUTBA
2825
1286 FC90 35 82                      PULS A,PC
2826 218 davidgb
1287                         *
2827
1288                                 IFD EXTOPT
2828
1289                         *
2829
1290                         * EXTENDED USER COMMANDS
2830
1291                         *
2831 221 davidgb
1292 FC92 6E 9F F0 00        USRCMD  JMP [MONEXT+EXTCMD]
2832 218 davidgb
1293                                 ENDIF EXTOPT
2833
1294                         *
2834
1295                         *
2835 221 davidgb
1296 FC96 7D DF E2           ECHON   TST  ECHO     ; IS ECHO REQUIRED ?
2836
1297 FC99 27 06                      BEQ  INCH     ; ECHO NOT REQ. IF CLEAR
2837 218 davidgb
1298                         *
2838
1299                         * INCHE
2839
1300                         *
2840
1301                         * GETS CHARACTER FROM TERMINAL AND
2841
1302                         * ECHOS SAME. THE CHARACTER IS RETURNED
2842
1303                         * IN THE "A" ACCUMULATOR WITH THE PARITY
2843
1304                         * BIT MASKED OFF. ALL OTHER REGISTERS
2844
1305                         * ARE PRESERVED.
2845
1306                         *
2846 221 davidgb
1307 FC9B 8D 04              INCHE   BSR  INCH     ; GET CHAR FROM TERMINAL
2847
1308 FC9D 84 7F                      ANDA #$7F     ; STRIP PARITY FROM CHAR.
2848
1309 FC9F 20 3F                      BRA  OUTCH    ; ECHO CHAR TO TERMINAL
2849 218 davidgb
1310                         *
2850
1311                         * INCH
2851
1312                         *
2852
1313                         * GET CHARACTER FROM TERMINAL. RETURN
2853
1314                         * CHARACTER IN "A" ACCUMULATOR AND PRESERVE
2854
1315                         * ALL OTHER REGISTERS. THE INPUT CHARACTER
2855
1316                         * IS 8 BITS AND IS NOT ECHOED.
2856
1317                         *
2857
1318                         *
2858 221 davidgb
1319 FCA1 34 10              INCH    PSHS X        ; SAVE IX
2859 218 davidgb
1320                                 IFD  HFCOPT
2860 221 davidgb
1321 FCA3 86 11                      LDA  #$11     ; SET RTS* LOW, REQUEST FAR END TO TX
2861
1322 FCA5 A7 9F DF E0                STA  [CPORT]
2862 218 davidgb
1323                                 ENDIF HFCOPT
2863 221 davidgb
1324 FCA9 BE DF E0           GETSTA  LDX  CPORT    ; POINT TO TERMINAL PORT
2864
1325 FCAC A6 84                      LDA  ,X       ; FETCH PORT STATUS
2865
1326 FCAE 85 01                      BITA #1       ; TEST READY BIT, RDRF ?
2866 218 davidgb
1327                                 IFD  PS2OPT
2867 221 davidgb
1328 FCB0 26 09                      BNE  GETST1
2868
1329 FCB2 8E E0 20                   LDX  #PS2KBD
2869
1330 FCB5 A6 84                      LDA  ,X
2870
1331 FCB7 85 01                      BITA #1
2871 218 davidgb
1332                                 ENDIF PS2OPT
2872 221 davidgb
1333 FCB9 27 EE                      BEQ  GETSTA   ; IF NOT RDY, THEN TRY AGAIN
2873
1334 FCBB                    GETST1  EQU  *
2874 218 davidgb
1335                                 IFD  HFCOPT
2875 221 davidgb
1336 FCBB 86 51                      LDA  #$51     ; SET RTS* HIGH, STOP FAR END FROM TXING, UNTIL NEXT INPUT
2876
1337 FCBD A7 9F DF E0                STA  [CPORT]
2877 218 davidgb
1338                                 ENDIF HFCOPT
2878 221 davidgb
1339 FCC1 A6 01                      LDA  1,X      ; FETCH CHAR
2879
1340 FCC3 35 90                      PULS X,PC     ; RESTORE IX
2880 218 davidgb
1341                         *
2881
1342                         * INCHEK
2882
1343                         *
2883
1344                         * CHECK FOR A CHARACTER AVAILABLE FROM
2884
1345                         * THE TERMINAL. THE SERIAL PORT IS CHECKED
2885
1346                         * FOR READ READY. ALL REGISTERS ARE
2886
1347                         * PRESERVED, AND THE "Z" BIT WILL BE
2887
1348                         * CLEAR IF A CHARACTER CAN BE READ.
2888
1349                         *
2889
1350                         *
2890 221 davidgb
1351 FCC5 34 02              INCHEK  PSHS A        ; SAVE A ACCUM
2891 218 davidgb
1352                                 IFD  HFCOPT
2892 221 davidgb
1353 FCC7 86 11                      LDA  #$11     ; SET RTS* LOW, REQUEST FAR END TO TX
2893
1354 FCC9 A7 9F DF E0                STA  [CPORT]
2894 218 davidgb
1355                                 ENDIF HFCOPT
2895 221 davidgb
1356 FCCD A6 9F DF E0                LDA  [CPORT]  ; FETCH PORT STATUS
2896
1357 FCD1 85 01                      BITA #1       ; TEST READY BIT, RDRF ?
2897 218 davidgb
1358                                 IFD  PS2OPT
2898 221 davidgb
1359 FCD3 26 05                      BNE  INCHEK1
2899
1360 FCD5 B6 E0 20                   LDA  PS2KBD
2900
1361 FCD8 85 01                      BITA #1       ; TEST READY BIT< RDRF ?
2901 218 davidgb
1362                                 ENDIF PS2OPT
2902 221 davidgb
1363 FCDA 35 82              INCHEK1 PULS A,PC     ; RESTORE A ACCUM.
2903 218 davidgb
1364                         *
2904 221 davidgb
1365 FCDC 8D 00              OUT2S   BSR  OUT1S    ; OUTPUT 2 SPACES
2905
1366 FCDE 86 20              OUT1S   LDA  #$20     ; OUTPUT 1 SPACE
2906 218 davidgb
1367                         *
2907
1368                         *
2908
1369                         * OUTCH
2909
1370                         *
2910
1371                         * OUTPUT CHARACTER TO TERMINAL.
2911
1372                         * THE CHAR. TO BE OUTPUT IS
2912
1373                         * PASSED IN THE A REGISTER.
2913
1374                         * ALL REGISTERS ARE PRESERVED.
2914
1375                         *
2915
1376                         OUTCH   IFD   VDUOPT
2916 221 davidgb
1377 FCE0 8D 49                      BSR   VOUTCH
2917 218 davidgb
1378                                 ENDIF VDUOPT
2918
1379                                 IFD   DG640OPT
2919
1380                                 BSR   VOUTCH
2920
1381                                 ENDIF DG640OPT
2921
1381                                 ENDIF DG640OPT
2922 221 davidgb
1382 FCE2 34 12              AOUTCH  PSHS A,X      ; SAVE A ACCUM AND IX
2923
1383 FCE4 BE DF E0                   LDX  CPORT    ; GET ADDR. OF TERMINAL
2924
1384 FCE7 A6 84              FETSTA  LDA  ,X       ; FETCH PORT STATUS
2925
1385 FCE9 85 02                      BITA #2       ; TEST TDRE, OK TO XMIT ?
2926
1386 FCEB 27 FA                      BEQ  FETSTA   ; IF NOT LOOP UNTIL RDY
2927
1387 FCED 85 08                      BITA #8       ; CLEAR TO SEND ?
2928
1388 FCEF 26 F6                      BNE  FETSTA   ; NO, LOOP UNTIL CLEAR
2929
1389 FCF1 35 02                      PULS A        ; GET CHAR. FOR XMIT
2930
1390 FCF3 A7 01                      STA  1,X      ; XMIT CHAR.
2931
1391 FCF5 35 90                      PULS X,PC     ; RESTORE IX
2932 218 davidgb
1392                         *
2933
1393                         * IO INITIALIZATION
2934
1394                         *
2935 221 davidgb
1395 FCF7                    IOINIZ  EQU  *
2936 218 davidgb
1396                                 IFD  VDUOPT
2937 221 davidgb
1397 FCF7 8D 13                      BSR  VINIZ
2938 218 davidgb
1398                                 ENDIF VDUOPT
2939
1399                                 IFD  DG640OPT
2940
1400                                 BSR  VINIZ
2941
1401                                 ENDIF DG640OPT
2942
1401                                 ENDIF DG640OPT
2943 221 davidgb
1402 FCF9 BE DF E0           ACINIZ  LDX  CPORT    ; POINT TO CONTROL PORT ADDRESS
2944
1403 FCFC 86 03                      LDA  #3       ; RESET ACIA PORT CODE
2945
1404 FCFE A7 84                      STA  ,X       ; STORE IN CONTROL REGISTER
2946
1405 FD00 86 51                      LDA  #$51     ; SET 8 DATA, 2 STOP AN 0 PARITY RTS* HIGH
2947
1406 FD02 A7 84                      STA  ,X       ; STORE IN CONTROL REGISTER
2948
1407 FD04 6D 01                      TST  1,X      ; ANYTHING IN DATA REGISTER?
2949
1408 FD06 86 FF                      LDA  #$FF     ; TURN ON ECHO FLAG
2950
1409 FD08 B7 DF E2                   STA  ECHO
2951
1410 FD0B 39                         RTS
2952 218 davidgb
1411                         *
2953
1412                                 IFD VDUOPT
2954
1413                         *
2955
1414                         ***************************************************
2956
1415                         *      VDU8 ADM3A REGISTER-MAPPED EMULATOR        *
2957
1416                         *                                                 *
2958
1417                         *      80 x 25 Characters
2959
1418                         *
2960
1419                         ***************************************************
2961
1420                         *
2962
1421                         ***************************************************
2963
1422                         *               INITIALIZE EMULATOR               *
2964
1423                         ***************************************************
2965
1424                         *
2966 221 davidgb
1425 FD0C 8E E0 30           VINIZ   LDX  #VDU
2967
1426 FD0F CC 00 00                   LDD  #0
2968
1427 FD12 FD DF FB                   STD  COLADX   ; AND ROWADX
2969
1428 FD15 A7 02                      STA  VDUCOL,X
2970
1429 FD17 E7 03                      STB  VDUROW,X
2971
1430 FD19 E7 04                      STB  VDUOFF,X
2972
1431 FD1B FD DF FD                   STD  NEWROW   ; AND ESCFLG
2973
1432 FD1E C6 02                      LDB  #$02
2974
1433 FD20 E7 01                      STB  VDUATT,X
2975
1434 FD22 7F DF FE                   CLR  ESCFLG
2976
1435 FD25 86 1B                      LDA  #$1B     ; SEND ESCAPE
2977
1436 FD27 8D 02                      BSR  VOUTCH
2978
1437 FD29 86 59                      LDA  #'Y      ; CLEAR TO END OF SCREEN
2979 218 davidgb
1438                         *
2980
1439                         ** VIDEO OUTPUT ROUTINE
2981
1440                         *
2982 221 davidgb
1441 FD2B 34 16              VOUTCH  PSHS A,B,X    ; SAVE REGISTERS
2983
1442 FD2D 8E E0 30                   LDX  #VDU     ; POINT TO VDU REGISTERS
2984 218 davidgb
1443                         *
2985
1444                         ** CHECK FOR ESCAPE SEQUENCE
2986
1445                         *
2987 221 davidgb
1446 FD30 7D DF FE                   TST  ESCFLG   ; ESCAPE ACTIVE?
2988
1447 FD33 27 04                      BEQ  SOROU1   ; BRANCH IF NOT
2989
1448 FD35 8D 60                      BSR  ESCAPE   ; ELSE DO ESCAPE
2990
1449 FD37 20 0D                      BRA  RETURN   ; AND RETURN
2991 218 davidgb
1450                         *
2992
1451                         ** CHECK FOR CONTROL CHARACTERS
2993
1452                         *
2994 221 davidgb
1453 FD39 81 20              SOROU1  CMPA #$20     ; CONTROL CODES?
2995
1454 FD3B 24 04                      BHS  SOROU2
2996
1455 FD3D 8D 09                      BSR  CONTRL   ; BRANCH IF SO
2997
1456 FD3F 20 05                      BRA  RETURN
2998 218 davidgb
1457                         *
2999
1458                         ** OUTPUT TEXT CHARACTER
3000
1459                         *
3001 221 davidgb
1460 FD41 A7 84              SOROU2  STA  VDUCHR,X ; DISPLAY CHARACTER
3002
1461 FD43 17 00 AF                   LBSR NEWCOL   ; UPDATE COLUMN
3003 218 davidgb
1462                         *
3004
1463                         ** DISPLAY CURSOR AND RETURN
3005
1464                         *
3006 221 davidgb
1465 FD46 35 96              RETURN  PULS A,B,X,PC ; RESTORE REGISTERS AND RETURN
3007 218 davidgb
1466                         *
3008
1467                         ***************************************************
3009
1468                         *              CONTROL CODE HANDLERS              *
3010
1469                         ***************************************************
3011
1470                         *
3012 221 davidgb
1471 FD48 81 08              CONTRL  CMPA #$08     ; CTRL H - BACKSPACE ?
3013
1472 FD4A 27 34                      BEQ  BACKSP
3014
1473 FD4C 81 1B                      CMPA #$1B     ; ESCAPE SEQUENCE?
3015
1474 FD4E 27 5A                      BEQ  SETESC
3016
1475 FD50 81 1A                      CMPA #$1A     ; CTRL Z - Clear Screen
3017
1476 FD52 10 27 00 7C                LBEQ CLRSCR
3018
1477 FD56 81 16                      CMPA #$16     ; CTRL ^ - Home
3019
1478 FD58 27 38                      BEQ  HOME
3020
1479 FD5A 81 0D                      CMPA #$0D     ; CTRL M - RETURN?
3021
1480 FD5C 10 27 00 89                LBEQ CRETN
3022
1481 FD60 81 0C                      CMPA #$0C     ; CTRL L - CHAR RIGHT
3023
1482 FD62 27 24                      BEQ  CHRIGHT
3024
1483 FD64 81 0B                      CMPA #$0B     ; CTRL K - MOVE UP ONE LINE
3025
1484 FD66 27 0F                      BEQ  LINEUP
3026
1485 FD68 81 0A                      CMPA #$0A     ; CTRL J - LINE FEED
3027
1486 FD6A 26 45                      BNE  RETESC   ; NONE OF THESE, RETURN
3028 218 davidgb
1487                         *
3029
1488                         ***************************************** LINE FEED
3030
1489                         *
3031 221 davidgb
1490 FD6C FC DF FB           LINEFD  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
3032
1491 FD6F 5C                         INCB          ; BUMP ROW
3033
1492 FD70 C1 19                      CMPB #NUMLIN  ; SCROLL TIME?
3034
1493 FD72 26 79                      BNE  NEWCUR   ; POSITION CURSOR IF NOT
3035
1494 FD74 16 00 8F                   LBRA SCROLL   ; ELSE SCROLL IT
3036 218 davidgb
1495                         *
3037
1496                         ***************************************** LINE FEED
3038
1497                         *
3039 221 davidgb
1498 FD77 FC DF FB           LINEUP  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
3040
1499 FD7A 5D                         TSTB          ; AT TOP OF SCREEN ?
3041
1500 FD7B 27 34                      BEQ  RETESC   ; Yes, Ignore
3042
1501 FD7D 5A                         DECB          ; No, Decrement ROW
3043
1502 FD7E 20 6D                      BRA  NEWCUR   ; POSITION CURSOR
3044 218 davidgb
1503                         *
3045
1504                         *********************************** BACK SPACE
3046
1505                         *
3047 221 davidgb
1506 FD80 B6 DF FB           BACKSP  LDA  COLADX
3048
1507 FD83 27 2C                      BEQ  RETESC   ; RETURN
3049
1508 FD85 4A                         DECA
3050
1509 FD86 20 62                      BRA  POSCOL   ; POSITION CURSOR
3051 218 davidgb
1510                         *
3052
1511                         *********************************** CURSOR RIGHT
3053
1512                         *
3054 221 davidgb
1513 FD88 B6 DF FB           CHRIGHT LDA  COLADX
3055
1514 FD8B 4C                         INCA
3056
1515 FD8C 81 50                      CMPA #LINLEN
3057
1516 FD8E 27 21                      BEQ  RETESC
3058
1517 FD90 20 58                      BRA  POSCOL
3059 218 davidgb
1518                         *
3060
1519                         *********************************** CURSOR RIGHT
3061
1520                         *
3062 221 davidgb
1521 FD92 CC 00 00           HOME    LDD  #0       ; HOME - POSITION TOP OF SCREEN
3063
1522 FD95 20 56                      BRA  NEWCUR
3064 218 davidgb
1523                         *
3065
1524                         ***************************************************
3066
1525                         *                 ESCAPE HANDLERS                 *
3067
1526                         ***************************************************
3068
1527                         *
3069 221 davidgb
1528 FD97 F6 DF FE           ESCAPE  LDB  ESCFLG   ; GET FLAG
3070
1529 FD9A C1 3D                      CMPB #'=      ; SETTING CURSOR?
3071
1530 FD9C 27 14                      BEQ  ESCCUR   ; BRANCH IF SO
3072
1531 FD9E 81 59                      CMPA #'Y      ; CLEAR TO END OF SCREEN?
3073
1532 FDA0 27 6E                      BEQ  ESCCLS
3074
1533 FDA2 81 54                      CMPA #'T      ; CLEAR TO END OF LINE?
3075
1534 FDA4 27 31                      BEQ  ESCCLL
3076
1535 FDA6 81 3D                      CMPA #'=      ; STARTING CURSOR SET?
3077
1536 FDA8 26 04                      BNE  CLRESC   ; BRANCH IF NOT
3078 218 davidgb
1537                         *
3079
1538                         ***************************** START ESCAPE SEQUENCE
3080
1539                         *
3081 221 davidgb
1540 FDAA B7 DF FE           SETESC  STA  ESCFLG   ; ELSE START CURSORING
3082
1541 FDAD 39                         RTS           ; AND RETURN
3083 218 davidgb
1542                         *
3084 221 davidgb
1543 FDAE 7F DF FE           CLRESC  CLR  ESCFLG   ; NO OTHERS SUPPORTED
3085
1544 FDB1 39                 RETESC  RTS           ; SO RETURN
3086 218 davidgb
1545                         *
3087
1546                         ********************************* SET SCREEN CURSOR
3088
1547                         *
3089 221 davidgb
1548 FDB2 7D DF FD           ESCCUR  TST  NEWROW   ; ROW SET?
3090
1549 FDB5 26 04                      BNE  ESCCU1   ; BRANCH IF SO
3091
1550 FDB7 B7 DF FD                   STA  NEWROW   ; ELSE SET NEW ROW
3092
1551 FDBA 39                         RTS           ; AND RETURN
3093 218 davidgb
1552                         *
3094 221 davidgb
1553 FDBB 7F DF FE           ESCCU1  CLR  ESCFLG
3095
1554 FDBE 80 20                      SUBA #$20     ; ADJUST COLUMN ADDRESS
3096
1555 FDC0 81 4F                      CMPA #LINLEN-1 ;CHECK FOR ACCEPTABLE COLUM
3097
1556 FDC2 22 ED                      BHI  RETESC   ; NOT OK, DO NOTHING
3098 218 davidgb
1557                         *
3099 221 davidgb
1558 FDC4 F6 DF FD           ESCCU2  LDB  NEWROW
3100
1559 FDC7 7F DF FD                   CLR  NEWROW
3101
1560 FDCA C0 20                      SUBB #$20     ; ADJUST TO ROW ADDRESS
3102
1561 FDCC C1 18                      CMPB #NUMLIN-1 ; CHECK FOR ACCEPTABLE ROW
3103
1562 FDCE 22 E1                      BHI  RETESC   ; ELSE RETURN DOING NOTHING
3104
1563 FDD0 20 1B                      BRA  NEWCUR   ; GO SET NEW CURSOR IF SO
3105 218 davidgb
1564                         *
3106
1565                         ****************** CLEAR FROM CURSOR TO END OF LINE
3107
1566                         *
3108 221 davidgb
1567 FDD2 CC 00 00           CLRSCR  LDD  #0       ; CLEAR FROM TOP OF SCREEN
3109
1568 FDD5 8D 16                      BSR  NEWCUR
3110
1569 FDD7 B6 DF FB           ESCCLL  LDA  COLADX
3111
1570 FDDA C6 20                      LDB  #$20     ; AND CLEAR CHAR
3112
1571 FDDC E7 84              ESCCL1  STB  VDUCHR,X ; DISPLAY TEXT
3113
1572 FDDE 4C                         INCA
3114
1573 FDDF A7 02                 STA  VDUCOL,X
3115
1574 FDE1 81 50                      CMPA #LINLEN  ; UNTIL END OF LINE
3116
1575 FDE3 26 F7                      BNE  ESCCL1
3117
1576 FDE5 7F DF FE                   CLR  ESCFLG
3118
1577 FDE8 39                         RTS
3119 218 davidgb
1578                         *
3120
1579                         *********************************** CARRIAGE RETURN
3121
1580                         *
3122 221 davidgb
1581 FDE9 4F                 CRETN   CLRA          ; SET COLUMN ZERO
3123
1582 FDEA F6 DF FC           POSCOL  LDB  ROWADX   ; GET CURRENT ROW
3124 218 davidgb
1583                         *
3125
1584                         *********** GENERATE NEW CURSOR POSITION AND RETURN
3126
1585                         *
3127 221 davidgb
1586 FDED FD DF FB           NEWCUR  STD  COLADX   ; SAVE NEW ROW AND COLUMN
3128
1587 FDF0 A7 02                 STA  VDUCOL,X ; SET NEW COLUMN
3129
1588 FDF2 E7 03                      STB  VDUROW,X ; SET NEW ROW
3130
1589 FDF4 39                         RTS           ; AND RETURN
3131 218 davidgb
1590                         *
3132
1591                         ********************* UPDATE CURRENT COLUMN AND ROW
3133
1592                         *
3134 221 davidgb
1593 FDF5 FC DF FB           NEWCOL  LDD  COLADX   ; GET ROW AND COLUMN
3135
1594 FDF8 4C                         INCA          ; BUMP COLUMN
3136
1595 FDF9 81 50                      CMPA #LINLEN  ; ROLL?
3137
1596 FDFB 26 F0                      BNE  NEWCUR   ; BRANCH IF NOT
3138
1597 FDFD 4F                         CLRA          ; ELSE RESET TO ZERO
3139
1598 FDFE 5C                         INCB          ; AND BUMP ROW
3140
1599 FDFF C1 19                      CMPB #NUMLIN
3141
1600 FE01 26 EA                      BNE  NEWCUR
3142
1601 FE03 5A                         DECB          ; BOTTOM ROW
3143
1602 FE04 8D E7                      BSR  NEWCUR
3144 218 davidgb
1603                         *
3145
1604                         ********************************* SCROLL THE SCREEN
3146
1605                         *
3147 221 davidgb
1606 FE06 E6 04              SCROLL  LDB  VDUOFF,X
3148
1607 FE08 5C                         INCB
3149
1608 FE09 C1 19                      CMPB #NUMLIN
3150
1609 FE0B 25 01                      BLO  SCROL1
3151
1610 FE0D 5F                         CLRB
3152
1611 FE0E E7 04              SCROL1  STB  VDUOFF,X
3153 218 davidgb
1612                         *
3154
1613                         **************** CLEAR FROM CURSOR TO END OF SCREEN
3155
1614                         *
3156 221 davidgb
1615 FE10 F6 DF FB           ESCCLS  LDB  COLADX   ; GET CURSOR
3157
1616 FE13 86 20                      LDA  #$20     ; GET A SPACE
3158
1617 FE15 F7 DF FB           ESCCLS1    STB  COLADX
3159
1618 FE18 E7 02                      STB  VDUCOL,X
3160
1619 FE1A A7 84                      STA  VDUCHR,X
3161
1620 FE1C 5C                         INCB
3162
1621 FE1D C1 50                      CMPB #LINLEN
3163
1622 FE1F 26 F4                      BNE  ESCCLS1
3164 218 davidgb
1623                         *
3165 221 davidgb
1624 FE21 F6 DF FC                   LDB  ROWADX
3166
1625 FE24 5C                         INCB
3167
1626 FE25 C1 19                      CMPB #NUMLIN
3168
1627 FE27 27 08                      BEQ  ESCCLS2
3169
1628 FE29 F7 DF FC                   STB  ROWADX
3170
1629 FE2C E7 03                      STB  VDUROW,X
3171
1630 FE2E 5F                         CLRB
3172
1631 FE2F 20 E4                      BRA  ESCCLS1
3173 218 davidgb
1632                         *
3174 221 davidgb
1633 FE31 5F                 ESCCLS2 CLRB
3175
1634 FE32 F7 DF FB                   STB  COLADX
3176
1635 FE35 E7 02                      STB  VDUCOL,X
3177
1636 FE37 F7 DF FE                   STB  ESCFLG
3178
1637 FE3A 39                         RTS
3179 218 davidgb
1638                                 ENDIF VDUOPT
3180
1639                         *
3181
1640                                 IFD DG640OPT
3182
1641                         ***************************************************
3183
1642                         *      TELEVIDEO-TYPE MEMORY-MAPPED EMULATOR      *
3184
1643                         *                                                 *
3185
1644                         * FOR HARD-WIRED MEMORY-MAPPED DISPLAYS USING THE *
3186
1645                         * HIGH ORDER BIT OF EACH BYTE FOR  REVERSE  VIDEO *
3187
1646                         * CURSORING  (SUCH  AS THE THOMAS INSTRUMENTATION *
3188
1647                         * 16x64 BOARD).                                   *
3189
1648                         ***************************************************
3190
1649                         *
3191
1650                         ***************************************************
3192
1651                         *               INITIALIZE EMULATOR               *
3193
1652                         ***************************************************
3194
1653                         *
3195
1654                         VINIZ   LDX  #0
3196
1655                                 STX  COLADX   ; AND ROWADX
3197
1656                                 STX  NEWROW   ; AND ESCFLG
3198
1657                                 LDX  #SCREEN  ; POINT TO SCREEN
3199
1658                                 STX  CURSOR   ; SET PROGRAM CURSOR
3200
1659                                 LDA  #$1B     ; SEND ESCAPE
3201
1660                                 BSR  VOUTCH
3202
1661                                 LDA  #'Y      ; CLEAR TO END OF SCREEN
3203
1662                         *
3204
1663                         ** VIDEO OUTPUT ROUTINE
3205
1664                         *
3206
1665                         VOUTCH  PSHS A,B,X    ; SAVE REGISTERS
3207
1666                         *
3208
1667                         ** CLEAR CURSOR
3209
1668                         *
3210
1669                                 LDX  CURSOR
3211
1670                                 LDB  0,X
3212
1671                                 ANDB #$7F
3213
1672                                 STB  0,X
3214
1673                         *
3215
1674                         ** CHECK FOR ESCAPE SEQUENCE
3216
1675                         *
3217
1676                                 TST  ESCFLG   ; ESCAPE ACTIVE?
3218
1677                                 BEQ  SOROU1   ; BRANCH IF NOT
3219
1678                                 BSR  ESCAPE   ; ELSE DO ESCAPE
3220
1679                                 BRA  RETURN   ; AND RETURN
3221
1680                         *
3222
1681                         ** CHECK FOR CONTROL CHARACTERS
3223
1682                         *
3224
1683                         SOROU1  CMPA #$20     ; CONTROL CODES?
3225
1684                                 BHS  SOROU2
3226
1685                                 BSR  CONTRL   ; BRANCH IF SO
3227
1686                                 BRA  RETURN
3228
1687                         *
3229
1688                         ** OUTPUT TEXT CHARACTER
3230
1689                         *
3231
1690                         SOROU2  LDX  CURSOR   ; ELSE GET CURSOR
3232
1691                                 STA  0,X      ; DISPLAY CHARACTER
3233
1692                                 LBSR NEWCOL   ; UPDATE COLUMN
3234
1693                         *
3235
1694                         ** DISPLAY CURSOR AND RETURN
3236
1695                         *
3237
1696                         RETURN  LDX  CURSOR   ; AND DISPLAY IT
3238
1697                                 LDB  ,X
3239
1698                                 ORB  #$80     ; WITH REVID
3240
1699                                 STB  ,X
3241
1700                                 PULS A,B,X,PC ; RESTORE REGISTERS AND RETURN
3242
1701                         *
3243
1702                         ***************************************************
3244
1703                         *              CONTROL CODE HANDLERS              *
3245
1704                         ***************************************************
3246
1705                         *
3247
1706                         CONTRL  CMPA #$08     ; CTRL H - BACKSPACE ?
3248
1707                                 LBEQ BACKSP
3249
1708                                 CMPA #$1B     ; ESCAPE SEQUENCE?
3250
1709                                 LBEQ SETESC
3251
1710                                 CMPA #$D      ; CTRL M - RETURN?
3252
1711                                 LBEQ CRETN
3253
1712                                 CMPA #$0A     ; CTRL J - LINE FEED
3254
1713                                 BNE  RETESC   ; NONE OF THESE, RETURN
3255
1714                         *
3256
1715                         ***************************************** LINE FEED
3257
1716                         *
3258
1717                         LINEFD  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
3259
1718                                 INCB          ; BUMP ROW
3260
1719                                 CMPB #NUMLIN  ; SCROLL TIME?
3261
1720                                 LBNE NEWCUR   ; POSITION CURSOR IF NOT
3262
1721                                 LBRA SCROLL   ; ELSE SCROLL IT
3263
1722                         *
3264
1723                         ***************************************** LINE FEED
3265
1724                         *
3266
1725                         LINEUP  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
3267
1726                                 TSTB          ; AT TOP OF SCREEN ?
3268
1727                                 BEQ  RETESC   ; YES, RETURN
3269
1728                                 DECB          ; NO, DECREMENT ROW
3270
1729                                 LBRA NEWCUR   ; POSITION CURSOR
3271
1730                         *
3272
1731                         *********************************** BACK SPACE
3273
1732                         *
3274
1733                         BACKSP  LDA  COLADX    ; GET CURRENT COLUMN AND ROW
3275
1734                                 BEQ  RETESC    ; IF AT TOP LEFT CORNER RETURN
3276
1735                                 DECA           ; OTHERWISE BACK STEP ONE CHARACTER
3277
1736                                 LBRA POSCOL    ; POSITION CURSOR
3278
1737                         *
3279
1738                         *********************************** CURSOR RIGHT
3280
1739                         *
3281
1740                         CHRIGHT LDA  COLADX    ; GET CURRENT COLUMN AND ROW
3282
1741                                 INCA           ; MOVE RIGHT ONE CHARACTER
3283
1742                                 CMPA #LINLEN   ; ARE WE AT THE END OF THE LINE ?
3284
1743                                 BEQ  RETESC    ; YES, RETURN
3285
1744                                 LBRA POSCOL    ; NO, POSITION CURSOR
3286
1745                         *
3287
1746                         ***************************************************
3288
1747                         *                 ESCAPE HANDLERS                 *
3289
1748                         ***************************************************
3290
1749                         *
3291
1750                         ESCAPE  LDB  ESCFLG   ; ARE WE IN AN ESCAPE SEQUENCE ?
3292
1751                                 CMPB #'=      ; ARE WE SETTING CURSOR?
3293
1752                                 BEQ  ESCCUR   ; YES BRANCH TO SET CURSOR
3294
1753                                 CMPA #'Y      ; CLEAR TO END OF SCREEN?
3295
1754                                 LBEQ ESCCLS   ; YES, CLEAR SCREEN
3296
1755                                 CMPA #'T      ; CLEAR TO END OF LINE?
3297
1756                                 BEQ  ESCCLL   ; YES, CLEAR LINE
3298
1757                                 CMPA #'E      ; INSERT LINE?
3299
1758                                 BEQ  ESCINL
3300
1759                                 CMPA #'R      ; DELETE LINE?
3301
1760                                 BEQ  ESCDLL
3302
1761                                 CMPA #'=      ; STARTING CURSOR SET?
3303
1762                                 BNE  CLRESC   ; BRANCH IF NOT
3304
1763                         *
3305
1764                         ***************************** START ESCAPE SEQUENCE
3306
1765                         *
3307
1766                         SETESC  STA  ESCFLG   ; ELSE START CURSORING
3308
1767                                 RTS           ; AND RETURN
3309
1768                         *
3310
1769                         CLRESC  CLR  ESCFLG   ; NO OTHERS SUPPORTED
3311
1770                         RETESC  RTS           ;  SO RETURN
3312
1771                         *
3313
1772                         ********************************* SET SCREEN CURSOR
3314
1773                         *
3315
1774                         ESCCUR  TST  NEWROW   ; ROW SET?
3316
1775                                 BNE  ESCCU1   ; BRANCH IF SO
3317
1776                                 STA  NEWROW   ; ELSE SET NEW ROW
3318
1777                                 RTS           ;  AND RETURN
3319
1778                         *
3320
1779                         ESCCU1  CLR  ESCFLG
3321
1780                                 SUBA #$20      ; ADJUST COLUMN ADDRESS
3322
1781                                 CMPA #LINLEN-1 ; CHECK FOR ACCEPTABLE COLUM
3323
1782                                 BHI  RETESC    ; NOT OK, DO NOTHING
3324
1783                         *
3325
1784                         ESCCU2  LDB  NEWROW
3326
1785                                 CLR  NEWROW
3327
1786                                 SUBB #$20      ; ADJUST TO ROW ADDRESS
3328
1787                                 CMPB #NUMLIN-1 ; CHECK FOR ACCEPTABLE ROW
3329
1788                                 BHI  RETESC    ; ELSE RETURN DOING NOTHING
3330
1789                                 BRA  NEWCUR    ; GO SET NEW CURSOR IF SO
3331
1790                         *
3332
1791                         *************************** DELETE LINE FROM SCREEN
3333
1792                         *
3334
1793                         ESCDLL  BSR  CRETN     ; GO COL. ZERO
3335
1794                                 LDB  ROWADX
3336
1795                                 CMPB #NUMLIN-1
3337
1796                                 BEQ  SCROL3
3338
1797                                 BRA  SCROL1    ; AND DELETE THIS LINE
3339
1798                         *
3340
1799                         *************************** INSERT LINE INTO SCREEN
3341
1800                         *
3342
1801                         ESCINL  BSR  CRETN     ; GO TO COL. ZERO
3343
1802                                 LDB  ROWADX
3344
1803                                 CMPB #NUMLIN-1
3345
1804                                 BEQ  ESCCLL
3346
1805                         *
3347
1806                         ** SCROLL SCREEN DOWN FROM CURSOR
3348
1807                         *
3349
1808                                 LDX  #SCREEN+SCNLEN-LINLEN
3350
1809                         ESCIN0  LDA  ,-X
3351
1810                                 STA  LINLEN,X
3352
1811                                 LDA  SCNLEN,X
3353
1812                                 STA  SCNLEN+LINLEN,X
3354
1813                                 CMPX CURSOR
3355
1814                                 BNE  ESCIN0
3356
1815                         *
3357
1816                         ****************** CLEAR FROM CURSOR TO END OF LINE
3358
1817                         *
3359
1818                         ESCCLL  LDA  COLADX    ; GET CURRENT COLUMN
3360
1819                                 LDX  CURSOR    ; GET CURSOR
3361
1820                                 LDB  #$20      ; AND CLEAR CHAR
3362
1821                         ESCLL1  STB  SCNLEN,X  ; CLEAR ATTRIBUTE
3363
1822                                 STB  ,X+       ; CLEAR TEXT
3364
1823                                 INCA
3365
1824                                 CMPA #LINLEN   ; UNTIL END OF LINE
3366
1825                                 BNE  ESCLL1
3367
1826                                 CLR  ESCFLG
3368
1827                                 RTS
3369
1828                         *
3370
1829                         *********************************** CARRIAGE RETURN
3371
1830                         *
3372
1831                         CRETN   CLRA           ; SET COLUMN ZERO
3373
1832                         POSCOL  LDB  ROWADX    ; GET CURRENT ROW
3374
1833                         *
3375
1834                         *********** GENERATE NEW CURSOR POSITION AND RETURN
3376
1835                         *
3377
1836                         NEWCUR  STD  COLADX    ; SAVE NEW ROW AND COLUMN
3378
1837                                 LDA  #LINLEN   ; ELSE ADD A LINE
3379
1838                                 MUL            ; LINLEN * ROWADX
3380
1839                                 ADDB COLADX
3381
1840                                 ADCA #0
3382
1841                                 ADDD #SCREEN   ; ADD SCREEN BASE.
3383
1842                                 STD  CURSOR    ; SAVE NEW CURSOR
3384
1843                                 TFR  D,X       ; GET CURSOR IN X
3385
1844                                 RTS            ; AND RETURN
3386
1845                         *
3387
1846                         ********************* UPDATE CURRENT COLUMN AND ROW
3388
1847                         *
3389
1848                         NEWCOL  LDD  COLADX    ; GET ROW AND COLUMN
3390
1849                                 INCA           ; BUMP COLUMN
3391
1850                                 CMPA #LINLEN   ; ROLL?
3392
1851                                 BNE  NEWCUR    ; BRANCH IF NOT
3393
1852                                 CLRA           ; ELSE RESET TO ZERO
3394
1853                                 INCB           ; AND BUMP ROW
3395
1854                                 CMPB #NUMLIN
3396
1855                                 BNE  NEWCUR
3397
1856                                 DECB           ; BOTTOM ROW
3398
1857                                 BSR  NEWCUR
3399
1858                         *
3400
1859                         ********************************* SCROLL THE SCREEN
3401
1860                         *
3402
1861                         SCROLL  LDX  #SCREEN   ; POINT TO SCREEN
3403
1862                         SCROL1  LDA  SCNLEN+LINLEN,X
3404
1863                                 STA  SCNLEN,X
3405
1864                                 LDA  LINLEN,X  ; MOVE TWO BYTES
3406
1865                                 STA  ,X+       ; UP ONE LINE
3407
1866                                 CMPX #SCREEN+SCNLEN-LINLEN
3408
1867                                 BNE  SCROL1    ; LOOP UNTIL DONE
3409
1868                                 BRA  SCROL3
3410
1869                         *
3411
1870                         **************** CLEAR FROM CURSOR TO END OF SCREEN
3412
1871                         *
3413
1872                         ESCCLS  LDX   CURSOR   ; GET CURSOR
3414
1873                         SCROL3  LDA   #$20     ; GET A SPACE
3415
1874                         SCROL2  STA   SCNLEN,X ; CLEAR ATTRIBUTES
3416
1875                                 STA   ,X+      ; AND TEXT
3417
1876                                 CMPX  #SCREEN+SCNLEN
3418
1877                                 BNE   SCROL2   ; UNTIL DONE
3419
1878                                 CLR   ESCFLG
3420
1879                                 RTS
3421
1880                                 ENDIF DG640OPT
3422
1880                                 ENDIF DG640OPT
3423
1881                         *
3424
1882                                 IFD PRTOPT
3425
1883                         *************************************
3426
1884                         *
3427
1885                         ** PRINTER DRIVER ROUTINES
3428
1886                         *
3429
1887                         *************************************
3430
1888                         *
3431
1889                         ** PINIZ - INITIATE PRINTER PORT
3432
1890                         *
3433
1891                         PINIZ   PSHS B
3434
1892                                 LDD #DIRMSK*256+$04 ; ACCA=DIRMSK ACCB=$04
3435
1893                                 STD PADATA     ; SET DDR AND SELECT DATA
3436
1894                         *
3437
1895                         ** RESET PRINTER
3438
1896                         *
3439
1897                                 LDB  #PRESET
3440
1898                                 STB  PADATA
3441
1899                         RESTLP  INCB           ; DELAY FOR RESET
3442
1900                                 BNE  RESTLP
3443
1901                                 STA  PADATA    ; ACCA=DIRMSK
3444
1902                         *
3445
1903                         ** INITALIZE PORT B (DATA PORT)
3446
1904                         *
3447
1905                                 LDA  #$2A
3448
1906                                 STA  PBCTRL
3449
1907                                 LDD  #$FF2E    ; ACCA=$FF ACCB =%00101110
3450
1908                                 STD  PBDATA    ; PBDREG   PBCTRL
3451
1909                         *
3452
1910                         ** SELECT 66 LINES/PAGE
3453
1911                         *
3454
1912                                 LDA  #$1B
3455
1913                                 BSR  POUTCH
3456
1914                                 LDA  #'C
3457
1915                                 BSR  POUTCH
3458
1916                                 LDA  #66
3459
1917                                 PULS B
3460
1918                         *************************************
3461
1919                         *
3462
1920                         ** OUTPUT A CHARACTER TO THE PRINTER
3463
1921                         *
3464
1922                         *************************************
3465
1923                         POUTCH  PSHS B
3466
1924                                 LDB  PBDATA    ; CLEAR INTERRUPT BIT
3467
1925                         *
3468
1926                         ** WAIT TILL NOT BUSY
3469
1927                         *
3470
1928                         BUSYLP  LDB  PADATA
3471
1929                                 BITB #PERROR
3472
1930                                 BEQ  PEXIT
3473
1931                                 TSTB
3474
1932                                 BMI  BUSYLP
3475
1933                         *
3476
1934                         ** NOW OUTPUT CHARACTER
3477
1935                         *
3478
1936                                 STA  PBDATA
3479
1937                         PEXIT   PULS B,PC
3480
1938                         *************************************
3481
1939                         *
3482
1940                         ** PCHK TEST IFD PRINTER READY
3483
1941                         *
3484
1942                         *************************************
3485
1943                         PCHK    TST  PBCTRL    ; TEST STATE OF CRB7
3486
1944                                 RTS            ; SET ON ACKNOWLEDGE
3487
1945                                 ENDIF PRTOPT
3488
1945                                 ENDIF PRTOPT
3489
1946                         *************************************
3490
1947                         *
3491
1948                         * MONITOR KEYBOARD COMMAND JUMP TABLE
3492
1949                         *
3493
1950                         *************************************
3494
1951                         *
3495 221 davidgb
1952 FE3B                    JMPTAB  EQU *
3496
1953 FE3B 01                         FCB 1 " ^A "
3497
1954 FE3C FB 74                      FDB ALTRA
3498
1955 FE3E 02                         FCB 2 " ^B "
3499
1956 FE3F FB 69                      FDB ALTRB
3500
1957 FE41 03                         FCB 3 " ^C "
3501
1958 FE42 FB 7F                      FDB ALTRCC
3502
1959 FE44 04                         FCB 4 " ^D "
3503
1960 FE45 FB 5E                      FDB ALTRDP
3504
1961 FE47 10                         FCB $10 " ^P "
3505
1962 FE48 FB 31                      FDB ALTRPC
3506
1963 FE4A 15                         FCB $15 " ^U "
3507
1964 FE4B FB 3D                      FDB ALTRU
3508
1965 FE4D 18                         FCB $18 " ^X "
3509
1966 FE4E FB 53                      FDB ALTRX
3510
1967 FE50 19                         FCB $19 " ^Y "
3511
1968 FE51 FB 48                      FDB ALTRY
3512 218 davidgb
1969                         *
3513 221 davidgb
1970 FE53 42                         FCC 'B'
3514
1971 FE54 F9 5C                      FDB BRKPNT
3515
1972 FE56 45                         FCC 'E'
3516
1973 FE57 F8 FD                      FDB MEMDUMP
3517
1974 FE59 47                         FCC 'G'
3518
1975 FE5A F8 A5                      FDB GO
3519
1976 FE5C 4C                         FCC 'L'
3520
1977 FE5D FA 5E                      FDB LOAD
3521
1978 FE5F 50                         FCC 'P'
3522
1979 FE60 FA BC                      FDB PUNCH
3523
1980 FE62 4D                         FCC 'M'
3524
1981 FE63 F8 A8                      FDB MEMCHG
3525
1982 FE65 52                         FCC 'R'
3526
1983 FE66 FB ED                      FDB REGSTR
3527
1984 FE68 53                         FCC 'S'
3528
1985 FE69 F8 F1                      FDB DISSTK
3529
1986 FE6B 58                         FCC 'X'
3530
1987 FE6C F9 88                      FDB XBKPNT
3531 218 davidgb
1988                                 IFD MFDCOPT
3532
1989                                 FCC 'D'        ; *** SWTPC USES 'U' FOR MINIBOOT
3533
1990                                 FDB MINBOOT
3534
1991                                 ENDIF MFDCOPT
3535
1991                                 ENDIF MFDCOPT
3536
1992                                 IFD CF8OPT
3537
1993                                 FCC 'D'        ; *** FPGA 8 BIT USES 'D' FOR CFBOOT
3538
1994                                 FDB CFBOOT
3539
1995                                 ENDIF CF8OPT
3540
1995                                 ENDIF CF8OPT
3541
1996                                 IFD IDEOPT
3542 221 davidgb
1997 FE6E 44                         FCC 'D'        ; *** XESS FPGA 16 BIT IDE USES 'D' FOR IDEBOOT
3543
1998 FE6F F9 D5                      FDB IDEBOOT
3544 218 davidgb
1999                                 ENDIF IDEOPT
3545
2000                                 IFD DMAFOPT
3546
2001                                 FCC 'U'        ; *** SWTPC USES 'D' FOR DMAF2 BOOT
3547
2002                                 FDB DBOOT
3548
2003                                 ENDIF DMAFOPT
3549
2003                                 ENDIF DMAFOPT
3550
2004                                 IFD EXTOPT
3551 221 davidgb
2005 FE71 55                         FCC 'U'        ; *** IF FPGA, 'U' IS FOR USER
3552
2006 FE72 FC 92                      FDB USRCMD
3553 218 davidgb
2007                                 ENDIF EXTOPT
3554
2008                                 IFD RTCOPT
3555
2009                                 FCC 'T'
3556
2010                                 FDB TIMSET
3557
2011                                 ENDIF RTCOPT
3558
2011                                 ENDIF RTCOPT
3559
2012                                 IFD TRAOPT
3560
2013                                 FCC "T"
3561
2014                                 FDB TRACE
3562
2015                                 ENDIF TRAOPT
3563
2015                                 ENDIF TRAOPT
3564
2016                         *
3565 221 davidgb
2017 FE74                    TABEND  EQU *
3566 218 davidgb
2018                         *
3567
2019                         * ** 6809 VECTOR ADDRESSES **
3568
2020                         *
3569
2021                         * FOLLOWING ARE THE ADDRESSES OF THE VECTOR ROUTINES
3570
2022                         * FOR THE 6809 PROCESSOR. DURING INITIALIZATION THEY
3571
2023                         * ARE RELOCATED TO RAM FROM $DFC0 TO $DFCF. THEY ARE
3572
2024                         * RELOCATED TO RAM SO THAT THE USER MAY REVECTOR TO
3573
2025                         * HIS OWN ROUTINES IF HE SO DESIRES.
3574
2026                         *
3575
2027                         *
3576 221 davidgb
2028 FE74 F9 94              RAMVEC  FDB SWIE       ; USER-V
3577
2029 FE76 F8 A7                      FDB RTI        ; SWI3-V
3578
2030 FE78 F8 A7                      FDB RTI        ; SWI2-V
3579
2031 FE7A F8 A7                      FDB RTI        ; FIRQ-V
3580
2032 FE7C F8 A7                      FDB RTI        ; IRQ-V
3581
2033 FE7E F9 94                      FDB SWIE       ; SWI-V
3582
2034 FE80 FF FF                      FDB $FFFF      ; SVC-VO
3583
2035 FE82 FF FF                      FDB $FFFF      ; SVC-VL
3584 218 davidgb
2036                         *
3585
2037                         * PRINTABLE MESSAGE STRINGS
3586
2038                         *
3587 221 davidgb
2039 FE84 0D 0A 00 00 00     MSG1    FCB  $D,$A,$0,$0,$0 * 0, CR/LF, 0
3588
2040 FE89 53 79 73 30 39 42          FCC  'Sys09Bug 1.7 FOR '
3589 218 davidgb
          75 67 20 31 2E 37
3590
          20 46 4F 52 20
3591
2041                                 IFD  SWTOPT
3592
2042                                 FCC  'SWTPC'
3593
2043                                 ENDIF SWTOPT
3594
2043                                 ENDIF SWTOPT
3595
2044                                 IFD  ADSOPT
3596
2045                                 FCC  'ADS6809'
3597
2046                                 ENDIF ADSOPT
3598
2046                                 ENDIF ADSOPT
3599
2047                                 IFD  B3SOPT
3600
2048                                 FCC  'B3-S2+'
3601
2049                                 ENDIF B3SOPT
3602
2049                                 ENDIF B3SOPT
3603
2050                                 IFD  B5XOPT
3604
2051                                 FCC  'B5-X300'
3605
2052                                 ENDIF B5XOPT
3606
2052                                 ENDIF B5XOPT
3607
2053                                 IFD  S3SOPT
3608
2054                                 FCC  'S3STARTER'
3609
2055                                 ENDIF S3SOPT
3610
2055                                 ENDIF S3SOPT
3611
2056                                 IFD  S3EOPT
3612
2057                                 FCC  'S3E'
3613
2058                                 ENDIF S3EOPT
3614
2058                                 ENDIF S3EOPT
3615
2059                                 IFD  XESOPT
3616
2060                                 FCC  'XESS'
3617
2061                                 ENDIF XESOPT
3618
2061                                 ENDIF XESOPT
3619 221 davidgb
2062                                 IFD  ATLOPT
3620
2063 FE9A 41 74 6C 79 73             FCC  'Atlys'
3621
2064                                 ENDIF ATLOPT
3622 218 davidgb
2065                                 IFD  DE270OPT
3623
2066                                 FCC  'DE2-70'
3624
2067                                 ENDIF DE270OPT
3625
2067                                 ENDIF DE270OPT
3626 221 davidgb
2068 FE9F 20 2D 20                   FCC ' - '
3627
2069 FEA2 04                         FCB 4
3628
2070 FEA3 4B 0D 0A 00 00 00  MSG2    FCB 'K,$0D,$0A,$00,$00,$00,$04 ; K,,,3 NULS,
3629 218 davidgb
          04
3630 221 davidgb
2071 FEAA 3E                 MSG3    FCC '>'
3631
2072 FEAB 04                         FCB 4
3632
2073 FEAC 57 48 41 54 3F     MSG4    FCC 'WHAT?'
3633
2074 FEB1 04                         FCB 4
3634
2075 FEB2 20 2D 20           MSG5    FCC ' - '
3635
2076 FEB5 04                         FCB 4'
3636
2077 FEB6 20 20 53 50 3D     MSG10   FCC '  SP='
3637
2078 FEBB 04                         FCB 4
3638
2079 FEBC 20 20 50 43 3D     MSG11   FCC '  PC='
3639
2080 FEC1 04                         FCB 4
3640
2081 FEC2 20 20 55 53 3D     MSG12   FCC '  US='
3641
2082 FEC7 04                         FCB 4
3642
2083 FEC8 20 20 49 59 3D     MSG13   FCC '  IY='
3643
2084 FECD 04                         FCB 4
3644
2085 FECE 20 20 49 58 3D     MSG14   FCC '  IX='
3645
2086 FED3 04                         FCB 4
3646
2087 FED4 20 20 44 50 3D     MSG15   FCC '  DP='
3647
2088 FED9 04                         FCB 4
3648
2089 FEDA 20 20 41 3D        MSG16   FCC '  A='
3649
2090 FEDE 04                         FCB 4
3650
2091 FEDF 20 20 42 3D        MSG17   FCC '  B='
3651
2092 FEE3 04                         FCB 4
3652
2093 FEE4 20 20 43 43 3A 20  MSG18   FCC '  CC: '
3653
2094 FEEA 04                         FCB 4
3654
2095 FEEB 45 46 48 49 4E 5A  MSG19   FCC 'EFHINZVC'
3655 218 davidgb
          56 43
3656 221 davidgb
2096 FEF3 53 31              MSG20   FCC 'S1'
3657
2097 FEF5 04                         FCB 4
3658 218 davidgb
2098                                 IFD DATOPT
3659
2099                         *
3660
2100                         * POWER UP/ RESET/ NMI ENTRY POINT
3661
2101                         *
3662 221 davidgb
2102 FF00                            ORG $FF00
3663 218 davidgb
2103                         *
3664
2104                         *
3665 221 davidgb
2105 FF00 8E FF F0           START   LDX  #IC11    ; POINT TO DAT RAM IC11
3666
2106 FF03 86 0F                      LDA  #$0F     ; GET COMPLIMENT OF ZERO
3667 218 davidgb
2107                         *
3668
2108                         *
3669
2109                         * INITIALIZE DAT RAM --- LOADS $F-$0 IN LOCATIONS $0-$F
3670
2110                         * OF DAT RAM, THUS STORING COMPLEMENT OF MSB OF ADDRESS
3671
2111                         * IN THE DAT RAM. THE COMPLEMENT IS REQUIRED BECAUSE THE
3672
2112                         * OUTPUT OF IC11, A 74S189, IS THE INVERSE OF THE DATA
3673
2113                         * STORED IN IT.
3674
2114                         *
3675
2115                         *
3676 221 davidgb
2116 FF05 A7 80              DATLP   STA  ,X+       ; STORE & POINT TO NEXT RAM LOCATION
3677
2117 FF07 4A                         DECA           ; GET COMP. VALUE FOR NEXT LOCATION
3678
2118 FF08 26 FB                      BNE  DATLP     ; ALL 16 LOCATIONS INITIALIZED ?
3679 218 davidgb
2119                         *
3680
2120                         * NOTE: IX NOW CONTAINS $0000, DAT RAM IS NO LONGER
3681
2121                         *       ADDRESSED, AND LOGICAL ADDRESSES NOW EQUAL
3682
2122                         *       PHYSICAL ADDRESSES.
3683
2123                         *
3684 221 davidgb
2124 FF0A 86 F0                      LDA  #$F0
3685
2125 FF0C A7 84                      STA  ,X        ; STORE $F0 AT $FFFF
3686
2126 FF0E 8E D0 A0                   LDX  #$D0A0    ; ASSUME RAM TO BE AT $D000-$DFFF
3687
2127 FF11 10 8E 55 AA                LDY  #TSTPAT   ; LOAD TEST DATA PATTERN INTO "Y"
3688
2128 FF15 EE 84              TSTRAM  LDU  ,X        ; SAVE DATA FROM TEST LOCATION
3689
2129 FF17 10 AF 84                   STY  ,X        ; STORE TEST PATTERN AT $D0A0
3690
2130 FF1A 10 AC 84                   CMPY ,X        ; IS THERE RAM AT THIS LOCATION ?
3691
2131 FF1D 27 0B                      BEQ  CNVADR    ; IF MATCH THERE'S RAM, SO SKIP
3692
2132 FF1F 30 89 F0 00                LEAX -$1000,X  ; ELSE POINT 4K LOWER
3693
2133 FF23 8C F0 A0                   CMPX #$F0A0    ; DECREMENTED PAST ZER0 YET ?
3694
2134 FF26 26 ED                      BNE  TSTRAM    ; IF NOT CONTINUE TESTING FOR RAM
3695
2135 FF28 20 D6                      BRA  START     ; ELSE START ALL OVER AGAIN
3696 218 davidgb
2136                         *
3697
2137                         *
3698
2138                         * THE FOLLOWING CODE STORES THE COMPLEMENT OF
3699
2139                         * THE MS CHARACTER OF THE FOUR CHARACTER HEX
3700
2140                         * ADDRESS OF THE FIRST 4K BLOCK OF RAM LOCATED
3701
2141                         * BY THE ROUTINE "TSTRAM" INTO THE DAT RAM. IT
3702
2142                         * IS STORED IN RAM IN THE LOCATION THAT IS
3703
2143                         * ADDRESSED WHEN THE PROCESSOR ADDRESS IS $D---,
3704
2144                         * THUS IF THE FIRST 4K BLOCK OF RAM IS FOUND
3705
2145                         * WHEN TESTING LOCATION $70A0, MEANING THERE
3706
2146                         * IS NO RAM PHYSICALLY ADDRESSED IN THE RANGE
3707
2147                         * $8000-$DFFF, THEN THE COMPLEMENT OF THE
3708
2148                         * "7" IN THE $70A0 WILL BE STORED IN
3709
2149                         * THE DAT RAM. THUS WHEN THE PROCESSOR OUTPUTS
3710
2150                         * AN ADDRESS OF $D---, THE DAT RAM WILL RESPOND
3711
2151                         * BY RECOMPLEMENTING THE "7" AND OUTPUTTING THE
3712
2152                         * 7 ONTO THE A12-A15 ADDRESS LINES. THUS THE
3713
2153                         * RAM THAT IS PHYSICALLY ADDRESSED AT $7---
3714
2154                         * WILL RESPOND AND APPEAR TO THE 6809 THAT IT
3715
2155                         * IS AT $D--- SINCE THAT IS THE ADDRESS THE
3716
2156                         * 6809 WILL BE OUTPUTING WHEN THAT 4K BLOCK
3717
2157                         * OF RAM RESPONDS.
3718
2158                         *
3719
2159                         *
3720 221 davidgb
2160 FF2A EF 84              CNVADR  STU  ,X        ; RESTORE DATA AT TEST LOCATION
3721
2161 FF2C 1F 10                      TFR  X,D       ; PUT ADDR. OF PRESENT 4K BLOCK IN D
3722
2162 FF2E 43                         COMA           ; COMPLEMENT MSB OF THAT ADDRESS
3723
2163 FF2F 44                         LSRA           ; PUT MS 4 BITS OF ADDRESS IN
3724
2164 FF30 44                         LSRA           ; LOCATION D0-D3 TO ALLOW STORING
3725
2165 FF31 44                         LSRA           ; IT IN THE DYNAMIC ADDRESS
3726
2166 FF32 44                         LSRA           ; TRANSLATION RAM.
3727
2167 FF33 B7 FF FD                   STA  $FFFD     ; STORE XLATION FACTOR IN DAT "D"
3728 218 davidgb
2168                         *
3729 221 davidgb
2169 FF36 10 CE DF C0                LDS  #STACK    ; INITIALIZE STACK POINTER
3730 218 davidgb
2170                         *
3731
2171                         *
3732
2172                         * THE FOLLOWING CHECKS TO FIND THE REAL PHYSICAL ADDRESSES
3733
2173                         * OF ALL 4K BLKS OF RAM IN THE SYSTEM. WHEN EACH 4K BLK
3734
2174                         * OF RAM IS LOCATED, THE COMPLEMENT OF IT'S REAL ADDRESS
3735
2175                         * IS THEN STORED IN A "LOGICAL" TO "REAL" ADDRESS XLATION
3736
2176                         * TABLE THAT IS BUILT FROM $DFD0 TO $DFDF. FOR EXAMPLE IF
3737
2177                         * THE SYSTEM HAS RAM THAT IS PHYSICALLY LOCATED (WIRED TO
3738
2178                         * RESPOND) AT THE HEX LOCATIONS $0--- THRU $F---....
3739
2179                         *
3740
2180                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3741
2181                         * 4K 4K 4K 4K 4K 4K 4K 4K -- 4K 4K 4K 4K -- -- --
3742
2182                         *
3743
2183                         * ....FOR A TOTAL OF 48K OF RAM, THEN THE TRANSLATION TABLE
3744
2184                         * CREATED FROM $DFD0 TO $DFDF WILL CONSIST OF THE FOLLOWING....
3745
2185                         *
3746
2186                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3747
2187                         * 0F 0E 0D 0C 0B 0A 09 08 06 05 00 00 04 03 F1 F0
3748
2188                         *
3749
2189                         *
3750
2190                         * HERE WE SEE THE LOGICAL ADDRESSES OF MEMORY FROM $0000-$7FFF
3751
2191                         * HAVE NOT BEEN SELECTED FOR RELOCATION SO THAT THEIR PHYSICAL
3752
2192                         * ADDRESS WILL = THEIR LOGICAL ADDRESS; HOWEVER, THE 4K BLOCK
3753
2193                         * PHYSICALLY AT $9000 WILL HAVE ITS ADDRESS TRANSLATED SO THAT
3754
2194                         * IT WILL LOGICALLY RESPOND AT $8000. LIKEWISE $A,$B, AND $C000
3755
2195                         * WILL BE TRANSLATED TO RESPOND TO $9000,$C000, AND $D000
3756
2196                         * RESPECTIVELY. THE USER SYSTEM WILL LOGICALLY APPEAR TO HAVE
3757
2197                         * MEMORY ADDRESSED AS FOLLOWS....
3758
2198                         *
3759
2199                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3760
2200                         * 4K 4K 4K 4K 4K 4K 4K 4K 4K 4K -- -- 4K 4K -- --
3761
2201                         *
3762
2202                         *
3763 221 davidgb
2203 FF3A 10 8E DF D0                LDY  #LRARAM   ; POINT TO LOGICAL/REAL ADDR. TABLE
3764
2204 FF3E A7 2D                      STA  13,Y      ; STORE $D--- XLATION FACTOR AT $DFDD
3765
2205 FF40 6F 2E                      CLR  14,Y      ; CLEAR $DFDE
3766
2206 FF42 86 F0                      LDA  #$F0      ; DESTINED FOR IC8 AN MEM EXPANSION ?
3767
2207 FF44 A7 2F                      STA  15,Y      ; STORE AT $DFDF
3768
2208 FF46 86 0C                      LDA  #$0C      ; PRESET NUMBER OF BYTES TO CLEAR
3769
2209 FF48 6F A6              CLRLRT  CLR  A,Y       ; CLEAR $DFDC THRU $DFD0
3770
2210 FF4A 4A                         DECA           ; SUB. 1 FROM BYTES LEFT TO CLEAR
3771
2211 FF4B 2A FB                      BPL  CLRLRT    ; CONTINUE IF NOT DONE CLEARING
3772
2212 FF4D 30 89 F0 00        FNDRAM  LEAX -$1000,X  ; POINT TO NEXT LOWER 4K OF RAM
3773
2213 FF51 8C F0 A0                   CMPX #$F0A0    ; TEST FOR DECREMENT PAST ZERO
3774
2214 FF54 27 22                      BEQ  FINTAB    ; SKIP IF FINISHED
3775
2215 FF56 EE 84                      LDU  ,X        ; SAVE DATA AT CURRENT TEST LOCATION
3776
2216 FF58 10 8E 55 AA                LDY  #TSTPAT   ; LOAD TEST DATA PATTERN INTO Y REG.
3777
2217 FF5C 10 AF 84                   STY  ,X        ; STORE TEST PATT. INTO RAM TEST LOC.
3778
2218 FF5F 10 AC 84                   CMPY ,X        ; VERIFY RAM AT TEST LOCATION
3779
2219 FF62 26 E9                      BNE  FNDRAM    ; IF NO RAM GO LOOK 4K LOWER
3780
2220 FF64 EF 84                      STU  ,X        ; ELSE RESTORE DATA TO TEST LOCATION
3781
2221 FF66 10 8E DF D0                LDY  #LRARAM   ; POINT TO LOGICAL/REAL ADDR. TABLE
3782
2222 FF6A 1F 10                      TFR  X,D       ; PUT ADDR. OF PRESENT 4K BLOCK IN D
3783
2223 FF6C 44                         LSRA           ; PUT MS 4 BITS OF ADDR. IN LOC. D0-D3
3784
2224 FF6D 44                         LSRA           ; TO ALLOW STORING IT IN THE DAT RAM.
3785
2225 FF6E 44                         LSRA
3786
2226 FF6F 44                         LSRA
3787
2227 FF70 1F 89                      TFR  A,B       ; SAVE OFFSET INTO LRARAM TABLE
3788
2228 FF72 88 0F                      EORA #$0F      ; INVERT MSB OF ADDR. OF CURRENT 4K BLK
3789
2229 FF74 A7 A5                      STA  B,Y       ; SAVE TRANSLATION FACTOR IN LRARAM TABLE
3790
2230 FF76 20 D5                      BRA  FNDRAM    ; GO TRANSLATE ADDR. OF NEXT 4K BLK
3791
2231 FF78 86 F1              FINTAB  LDA  #$F1      ; DESTINED FOR IC8 AND MEM EXPANSION ?
3792
2232 FF7A 10 8E DF D0                LDY  #LRARAM   ; POINT TO LRARAM TABLE
3793
2233 FF7E A7 2E                      STA  14,Y      ; STORE $F1 AT $DFCE
3794 218 davidgb
2234                         *
3795
2235                         * THE FOLLOWING CHECKS TO SEE IF THERE IS A 4K BLK OF
3796
2236                         * RAM LOCATED AT $C000-$CFFF. IF NONE THERE IT LOCATES
3797
2237                         * THE NEXT LOWER 4K BLK AN XLATES ITS ADDR SO IT
3798
2238                         * LOGICALLY RESPONDS TO THE ADDRESS $C---.
3799
2239                         *
3800
2240                         *
3801 221 davidgb
2241 FF80 86 0C                      LDA  #$0C      ; PRESET NUMBER HEX "C"
3802
2242 FF82 E6 A6              FINDC   LDB  A,Y       ; GET ENTRY FROM LRARAM TABLE
3803
2243 FF84 26 05                      BNE  FOUNDC    ; BRANCH IF RAM THIS PHYSICAL ADDR.
3804
2244 FF86 4A                         DECA           ; ELSE POINT 4K LOWER
3805
2245 FF87 2A F9                      BPL  FINDC     ; GO TRY AGAIN
3806
2246 FF89 20 14                      BRA  XFERTF
3807
2247 FF8B 6F A6              FOUNDC  CLR  A,Y       ; CLR XLATION FACTOR OF 4K BLOCK FOUND
3808
2248 FF8D E7 2C                      STB  $0C,Y     ; GIVE IT XLATION FACTOR MOVING IT TO $C---
3809 218 davidgb
2249                         *
3810
2250                         * THE FOLLOWING CODE ADJUSTS THE TRANSLATION
3811
2251                         * FACTORS SUCH THAT ALL REMAINING RAM WILL
3812
2252                         * RESPOND TO A CONTIGUOUS BLOCK OF LOGICAL
3813
2253                         * ADDRESSES FROM $0000 AND UP....
3814
2254                         *
3815 221 davidgb
2255 FF8F 4F                         CLRA           ; START AT ZERO
3816
2256 FF90 1F 21                      TFR  Y,X       ; START POINTER "X" START OF "LRARAM" TABLE.
3817
2257 FF92 E6 A6              COMPRS  LDB  A,Y       ; GET ENTRY FROM "LRARAM" TABLE
3818
2258 FF94 27 04                      BEQ  PNTNXT    ; IF IT'S ZER0 SKIP
3819
2259 FF96 6F A6                      CLR  A,Y       ; ELSE ERASE FROM TABLE
3820
2260 FF98 E7 80                      STB  ,X+       ; AND ENTER ABOVE LAST ENTRY- BUMP
3821
2261 FF9A 4C                 PNTNXT  INCA           ; GET OFFSET TO NEXT ENTRY
3822
2262 FF9B 81 0C                      CMPA #$0C      ; LAST ENTRY YET ?
3823
2263 FF9D 2D F3                      BLT  COMPRS
3824 218 davidgb
2264                         *
3825
2265                         * THE FOLLOWING CODE TRANSFER THE TRANSLATION
3826
2266                         * FACTORS FROM THE LRARAM TABLE TO IC11 ON
3827
2267                         * THE MP-09 CPU CARD.
3828
2268                         *
3829 221 davidgb
2269 FF9F 8E FF F0           XFERTF  LDX  #IC11     ; POINT TO DAT RAM IC11
3830
2270 FFA2 C6 10                      LDB  #$10      ; GET NO. OF BYTES TO MOVE
3831
2271 FFA4 A6 A0              FETCH   LDA  ,Y+       ; GET BYTE AND POINT TO NEXT
3832
2272 FFA6 A7 80                      STA  ,X+       ; POKE XLATION FACTOR IN IC11
3833
2273 FFA8 5A                         DECB           ; SUB 1 FROM BYTES TO MOVE
3834
2274 FFA9 26 F9                      BNE  FETCH     ; CONTINUE UNTIL 16 MOVED
3835 218 davidgb
2275                         *
3836
2276                                 ELSE
3837 221 davidgb
2277                         LRA     RTS
3838
2278                         START   LDS  #STACK    ; INITIALIZE STACK POINTER
3839
2279                                 CLRB
3840 218 davidgb
2280                                 ENDIF DATOPT
3841 221 davidgb
2280                                 ENDIF DATOPT
3842 218 davidgb
2281                         *
3843 221 davidgb
2282 FFAB 53                         COMB           ; SET "B" NON-ZERO
3844
2283 FFAC F7 DF E2                   STB  ECHO      ; TURN ON ECHO FLAG
3845
2284 FFAF 16 F8 62                   LBRA MONITOR   ; INITIALIZATION IS COMPLETE
3846 218 davidgb
2285                         *
3847
2286                         ** INTERRUPT JUMP VECTORS
3848
2287                         *
3849 221 davidgb
2288 FFB2 6E 9F DF C0        V1      JMP  [STACK]
3850
2289 FFB6 6E 9F DF C4        V2      JMP  [SWI2]
3851
2290 FFBA 6E 9F DF C6        V3      JMP  [FIRQ]
3852
2291 FFBE 6E 9F DF C8        V4      JMP  [IRQ]
3853
2292 FFC2 6E 9F DF CA        V5      JMP  [SWI]
3854 218 davidgb
2293                         *
3855
2294                         * SWI3 ENTRY POINT
3856
2295                         *
3857 221 davidgb
2296 FFC6 1F 43              SWI3E   TFR  S,U
3858
2297 FFC8 AE 4A                      LDX  10,U      *$FFC8
3859
2298 FFCA E6 80                      LDB  ,X+
3860
2299 FFCC AF 4A                      STX  10,U
3861
2300 FFCE 4F                         CLRA
3862
2301 FFCF 58                         ASLB
3863
2302 FFD0 49                         ROLA
3864
2303 FFD1 BE DF CC                   LDX  SVCVO
3865
2304 FFD4 8C FF FF                   CMPX #$FFFF
3866
2305 FFD7 27 0F                      BEQ  SWI3Z
3867
2306 FFD9 30 8B                      LEAX D,X
3868
2307 FFDB BC DF CE                   CMPX SVCVL
3869
2308 FFDE 22 08                      BHI  SWI3Z
3870
2309 FFE0 34 10                      PSHS X
3871
2310 FFE2 EC C4                      LDD  ,U
3872
2311 FFE4 AE 44                      LDX  4,U
3873
2312 FFE6 6E F1                      JMP  [,S++]
3874
2313 FFE8 37 1F              SWI3Z   PULU A,B,X,CC,DP
3875
2314 FFEA EE 42                      LDU  2,U
3876
2315 FFEC 6E 9F DF C2                JMP  [SWI3]
3877 218 davidgb
2316                         *
3878
2317                         * 6809 VECTORS
3879
2318                         *
3880
2319 FFF0                            ORG $FFF0
3881 221 davidgb
2320 FFF0 FF B2                      FDB V1    USER-V
3882
2321 FFF2 FF C6                      FDB SWI3E SWI3-V
3883
2322 FFF4 FF B6                      FDB V2    SWI2-V
3884
2323 FFF6 FF BA                      FDB V3    FIRQ-V
3885
2324 FFF8 FF BE                      FDB V4    IRQ-V
3886
2325 FFFA FF C2                      FDB V5    SWI-V
3887
2326 FFFC FF B2                      FDB V1    NMI-V
3888
2327 FFFE FF 00                      FDB START RESTART-V
3889 218 davidgb
0005                                 END START
3890
0006                          END
3891 221 davidgb
Program + Init Data = 3583 bytes
3892 218 davidgb
Error count = 0
3893
 
3894
 
3895 221 davidgb
ACIAC1     E000
3896
ACIAD1     E001
3897
ACIAOPT    00FF
3898
ACIAS      E000
3899
ACINIZ     FCF9
3900
ACIRST     F1FC
3901 218 davidgb
ACK        0006
3902 221 davidgb
AJDUMP     F909
3903
ALTAD      FB7E
3904
ALTBD      FB73
3905
ALTCCD     FB8B
3906
ALTDPD     FB68
3907
ALTPC1     FB34
3908
ALTPCD     FB3C
3909
ALTRA      FB74
3910
ALTRB      FB69
3911
ALTRCC     FB7F
3912
ALTRDP     FB5E
3913
ALTRPC     FB31
3914
ALTRU      FB3D
3915
ALTRX      FB53
3916
ALTRY      FB48
3917
ALTUD      FB47
3918
ALTXD      FB5D
3919
ALTYD      FB52
3920
AOUTCH     FCE2
3921 218 davidgb
ATLOPT     00FF
3922 221 davidgb
AUXRESET   0006
3923
AUXRSTREL  0002
3924
BACK       F8ED
3925
BACKSP     FD80
3926
BIASCI     FC7D
3927 218 davidgb
BLKNUM     0104
3928 221 davidgb
BLOAD0     F70D
3929
BLOAD1     F71B
3930
BLOAD2     F731
3931
BLOAD3     F745
3932
BOOT       F700
3933
BPADJ      F9D2
3934
BPERR      F980
3935
BPTBL      DFE3
3936
BPTEST     F9C2
3937
BRKPNT     F95C
3938 218 davidgb
BSSTACK    C0FF
3939
BUFFER     0200
3940 221 davidgb
BUSY       0080
3941 218 davidgb
BYTCNT     0105
3942 221 davidgb
BYTE       FC26
3943 218 davidgb
CAN        0018
3944
CFLAG      0001
3945 221 davidgb
CF_AUX     E11E
3946
CF_BASE    E100
3947
CF_COMAND  E10E
3948
CF_CYLHI   E10A
3949
CF_CYLLO   E108
3950
CF_DATA    E100
3951
CF_ERROR   E102
3952
CF_FEATURE E102
3953
CF_HEAD    E10C
3954
CF_SECCNT  E104
3955
CF_SECNUM  E106
3956
CF_STATUS  E10E
3957
CHANGE     F8DB
3958
CHKDRV     F546
3959 218 davidgb
CHKSUM     0103
3960 221 davidgb
CHRIGHT    FD88
3961
CHRTN      F8DA
3962
CLRESC     FDAE
3963
CLRLRT     FF48
3964
CLRSCR     FDD2
3965 218 davidgb
CLRSTK     F82F
3966 221 davidgb
CMDREAD    0020
3967
CMDWRITE   0030
3968
CNVADR     FF2A
3969
COLADX     DFFB
3970
COMPRS     FF92
3971
CONTRL     FD48
3972
CPORT      DFE0
3973
CRETN      FDE9
3974
DATLP      FF05
3975
DATOPT     00FF
3976 218 davidgb
DELCNT     0108
3977
DELCON     04E2
3978 221 davidgb
DFL1       F119
3979
DFL2       F126
3980
DFL3       F13A
3981
DFL4       F1A4
3982
DISFOS     F089
3983
DISSTK     F8F1
3984
DLY        FA55
3985
DNS        F707
3986
DRDY       0040
3987
DRNUM      F70C
3988
DRQ        0008
3989 218 davidgb
DRVNUM     0100
3990 221 davidgb
DRVS2      F541
3991
DRVSEL     F53A
3992
ECHO       DFE2
3993
ECHON      FC96
3994
EDPASC     F948
3995
EDPRTN     F908
3996
EDUMP      F924
3997 218 davidgb
EFLAG      0080
3998 221 davidgb
ELOOP      F936
3999 218 davidgb
EOT        0004
4000 221 davidgb
ERR        0001
4001
ESCAPE     FD97
4002
ESCCL1     FDDC
4003
ESCCLL     FDD7
4004
ESCCLS     FE10
4005
ESCCLS1    FE15
4006
ESCCLS2    FE31
4007
ESCCU1     FDBB
4008
ESCCU2     FDC4
4009
ESCCUR     FDB2
4010
ESCFLG     DFFE
4011
EXITBP     F97F
4012
EXTCMD     0000
4013
EXTEND     F035
4014
EXTOPT     00FF
4015
EXTTAB     F02C
4016
FETCH      FFA4
4017
FETSTA     FCE7
4018 218 davidgb
FFLAG      0040
4019 221 davidgb
FFSTBL     F9B9
4020
FINDC      FF82
4021
FINTAB     FF78
4022 218 davidgb
FIRQ       DFC6
4023 221 davidgb
FNDBP      F9C8
4024
FNDRAM     FF4D
4025
FNDREL     F84E
4026
FORWRD     F8E9
4027
FOUNDC     FF8B
4028
GETCH      F752
4029
GETCH2     F758
4030
GETCH4     F767
4031
GETST1     FCBB
4032
GETSTA     FCA9
4033
GO         F8A5
4034
GOFLEX     F76A
4035
HEADLBA    00E0
4036
HFCOPT     00FF
4037 218 davidgb
HFLAG      0020
4038 221 davidgb
HOME       FD92
4039
IC11       FFF0
4040
IDEBOOT    F9D5
4041
IDEOPT     00FF
4042 218 davidgb
IFLAG      0010
4043 221 davidgb
IN1ADR     FC16
4044
IN2ADR     FC0B
4045
INCH       FCA1
4046
INCHE      FC9B
4047
INCHEK     FCC5
4048
INCHEK1    FCDA
4049 218 davidgb
INCHEV     F806
4050
INCHKV     F808
4051
INCHV      F804
4052 221 davidgb
INHEX      FC39
4053
INHEXA     FC46
4054
INHEXL     FC51
4055
INITDR     F4BD
4056
INTER      F207
4057
INTER0     F212
4058
INTER1     F221
4059
INTER2     F227
4060
INTEST     F1F6
4061
IOINIZ     FCF7
4062 218 davidgb
IRQ        DFC8
4063 221 davidgb
JBYTE      FB2B
4064
JIN1ADR    FB2E
4065
JMPCMD     F8A1
4066
JMPEXT     F02A
4067
JMPTAB     FE3B
4068
JOUT1S     FB28
4069
JOUT2H     FBB0
4070
JOUT4H     FB9D
4071
LADR       F70A
4072
LINEFD     FD6C
4073
LINEUP     FD77
4074
LINLEN     0050
4075
LOAD       FA5E
4076
LOAD1      FA69
4077
LOAD10     FA93
4078
LOAD16     FAA9
4079
LOAD2      FA6C
4080
LOAD21     FAB4
4081
LODERR     FAA8
4082 218 davidgb
LOOPA      F81D
4083 221 davidgb
LRA        FA2E
4084
LRARAM     DFD0
4085 218 davidgb
LRAV       F812
4086
MAXSEC     010C
4087
MAXTRK     010B
4088 221 davidgb
MDUMP1     F902
4089
MEMC2      F8AF
4090
MEMCHG     F8A8
4091
MEMDUMP    F8FD
4092
MESS6      F0B2
4093
MONEXT     F000
4094 218 davidgb
MONIO      E000
4095
MONITOR    F814
4096
MONITV     F800
4097
MONRAM     DFC0
4098
MONROM     F800
4099 221 davidgb
MSG1       FE84
4100
MSG10      FEB6
4101
MSG11      FEBC
4102
MSG12      FEC2
4103
MSG13      FEC8
4104
MSG14      FECE
4105
MSG15      FED4
4106
MSG16      FEDA
4107
MSG17      FEDF
4108
MSG18      FEE4
4109
MSG19      FEEB
4110
MSG2       FEA3
4111
MSG20      FEF3
4112
MSG3       FEAA
4113
MSG4       FEAC
4114
MSG5       FEB2
4115
MSGWHAT    F035
4116 218 davidgb
NAK        0015
4117 221 davidgb
NEWCOL     FDF5
4118
NEWCUR     FDED
4119
NEWROW     DFFD
4120
NEXTCMD    F861
4121
NEXTEXT    F002
4122 218 davidgb
NFLAG      0008
4123
NMI        DFC0
4124 221 davidgb
NOTHEX     FC5C
4125
NUMLIN     0019
4126
NXTCH0     F88B
4127
NXTCHR     F88E
4128 218 davidgb
NXTCMV     F802
4129 221 davidgb
NXTEX0     F016
4130
NXTEX1     F019
4131
NXTLIN     F918
4132
OUT1S      FCDE
4133
OUT2H      FC67
4134
OUT2S      FCDC
4135
OUT4H      FC5F
4136
OUTBA      FC81
4137
OUTC       FC7B
4138
OUTCH      FCE0
4139 218 davidgb
OUTCHV     F80A
4140 221 davidgb
OUTHL      FC67
4141
OUTHR      FC6F
4142
OUTTE1     F23C
4143
OUTTE2     F24B
4144
OUTTER     F23A
4145 218 davidgb
PCLKHI     0001
4146
PCLKLO     0000
4147 221 davidgb
PCRLF      FB1E
4148 218 davidgb
PCRLFV     F80E
4149 221 davidgb
PDATA      FB8F
4150
PDATA0     F251
4151
PDATA1     F253
4152 218 davidgb
PDATAV     F80C
4153 221 davidgb
PERIOD     F952
4154
PNTNXT     FF9A
4155
POSCOL     FDEA
4156
PRASC      F954
4157
PRINT      FB8C
4158 218 davidgb
PROMREG    E0C0
4159
PRSTHI     0002
4160
PRSTLO     0000
4161 221 davidgb
PRTA       FBCE
4162
PRTB       FBD7
4163
PRTBA      FC89
4164
PRTCC      FBE0
4165
PRTCMD     F87F
4166
PRTDP      FBA9
4167
PRTIX      FBB3
4168
PRTIY      FBBC
4169
PRTPC      FBC5
4170
PRTSP      FB96
4171
PRTUS      FBA0
4172
PS2KBD     E020
4173
PS2OPT     00FF
4174 218 davidgb
PSTRGV     F810
4175 221 davidgb
PSTRNG     FB1A
4176
PUNCH      FABC
4177
PUNCH2     FAD5
4178
PUNCH3     FAE1
4179
PUNCH4     FAE3
4180
PUNCHL     FAFB
4181
PUNEXT     FB12
4182
RAMVEC     FE74
4183
RCHAR      F046
4184
RCHAR1     F04B
4185
RCHAR2     F04F
4186
RCHAR3     F05F
4187
RDLOOP     FA03
4188
RDLP1      F502
4189
READ       F787
4190
READ1      F797
4191
READSC     F4F1
4192
REGPR      F9A2
4193
REGSTR     FBED
4194
RELPAS     F855
4195
RESTR1     F4D2
4196
RETESC     FDB1
4197
RETURN     FD46
4198
RF3        F1DB
4199 218 davidgb
RMAXSEC    00FF
4200
RMAXTRK    0100
4201 221 davidgb
ROWADX     DFFC
4202
RPLSWI     F9A8
4203
RTI        F8A7
4204 218 davidgb
RTOTSEC    FE01
4205 221 davidgb
SCHAR      F064
4206
SCHAR1     F06B
4207
SCHAR2     F06F
4208
SCHAR3     F082
4209
SCROL1     FE0E
4210
SCROLL     FE06
4211
SCT        F706
4212 218 davidgb
SCTBUF     C300
4213
SECTOR     0102
4214 221 davidgb
SEEK       F76D
4215
SEEKTS     F4D7
4216
SETESC     FDAA
4217
SKPDMP     F921
4218 218 davidgb
SOH        0001
4219 221 davidgb
SOROU1     FD39
4220
SOROU2     FD41
4221 218 davidgb
STACK      DFC0
4222 221 davidgb
START      FF00
4223
SUB1       FA59
4224 218 davidgb
SVCVL      DFCE
4225
SVCVO      DFCC
4226
SWI        DFCA
4227
SWI2       DFC4
4228
SWI3       DFC2
4229 221 davidgb
SWI3E      FFC6
4230
SWI3Z      FFE8
4231
SWIE       F994
4232 218 davidgb
SYNCHI     AA55
4233
SYNCLO     FF00
4234 221 davidgb
TABEND     FE74
4235
TADR       F708
4236 218 davidgb
TRACK      0101
4237 221 davidgb
TRK        F705
4238
TSTPAT     55AA
4239
TSTRAM     FF15
4240
UBSUB      F03E
4241
UFEXIT     F1F0
4242
UFMSG1     F0CF
4243
UFSUB      F0EA
4244
UFSUB1     F0F3
4245
USRCMD     FC92
4246
UXERR      F40A
4247
UXEXIT     F404
4248
UXLOOP     F3B8
4249
UXMES0     F25A
4250
UXMES1     F273
4251
UXMES2     F285
4252
UXMSG3     F294
4253
UXMSG4     F2A5
4254
UXSUB      F2BC
4255
UXSUB1     F2C8
4256
UXSUB2     F2F5
4257
V1         FFB2
4258
V2         FFB6
4259
V3         FFBA
4260
V4         FFBE
4261
V5         FFC2
4262
VDU        E030
4263
VDUATT     0001
4264
VDUCHR     0000
4265
VDUCOL     0002
4266
VDUOFF     0004
4267
VDUOPT     00FF
4268
VDUROW     0003
4269 218 davidgb
VFLAG      0002
4270 221 davidgb
VINIZ      FD0C
4271
VOLMSG     F0E1
4272
VOUTCH     FD2B
4273
WAITDRQ    FA26
4274
WAITRDY    FA17
4275
WRITSC     F515
4276
WRTLP1     F527
4277
WTDRQ      F7B7
4278
WTRDY      F7A8
4279
XACK       F4B4
4280
XASCII     FC73
4281
XBKPNT     F988
4282
XBPLP      F98E
4283
XBYTE0     F415
4284
XBYTE1     F424
4285
XFERTF     FF9F
4286
XREAD      F410
4287 218 davidgb
XSTATE     0106
4288 221 davidgb
XSTBL      F44D
4289
XSTBLE     F458
4290
XSTCK      F48E
4291
XSTCK1     F49E
4292
XSTCK2     F4AB
4293
XSTCOM     F463
4294
XSTDA      F477
4295
XSTDA1     F489
4296
XSTST      F42D
4297
XSTST1     F437
4298
XSTST2     F443
4299
XSTST3     F44A
4300 218 davidgb
ZFLAG      0004

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.