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

Subversion Repositories System09

[/] [System09/] [trunk/] [src/] [sys09bug/] [sys09270.lst] - Blame information for rev 142

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

Line No. Rev Author Line
1 120 dilbert57
Assembler release DWC_2.0 version 2.11
2
May 6, 2004 (c) Motorola (free ware)
3
0001                          NAM SYS09BUG FOR TERASIC CYCLONE II DE2-70
4
0000                          INCLUDE "opt_270.asm"
5
0001
6
0002                         *
7
0003                         ***************************************************
8
0004                         *   OPTION SWITCHES
9
0005                         ***************************************************
10
0006                         *
11
0007                         *
12
0008                         ** THE CONTROL PORT CAN ONLY BE ONE OF THESE
13
0009                         ** NOTE THAT THE ACIA WILL ALWAYS BE PRESET
14
0010                         ** FOR LOADING AND SAVING S1 RECORDS
15
0011                         *
16
0012                         *SWTOPT EQU $FF SWTP ACIA SERIAL CONTROL PORT
17
0013                         *ADSOPT  EQU $FF ADS6809 & DG640 VIDEO DISPAY
18
0014                         *B3SOPT EQU $FF B3-SPARTAN2 FPGA VIDEO & PS2 KEYBOARD
19
0015                         *B5XOPT EQU $FF B5-X300 FPGA VIDEO & PS2 KEYBOARD
20
0016                         *S3SOPT EQU $FF SPARTAN3 STARTER FPGA VIDEO & PS2 KEYBOARD
21
0017                         *S3EOPT EQU $FF SPARTAN3E STARTER
22
0018                         *XESOPT EQU $FF XESS XSA-3S100 & XST-3.0
23
0019 00FF                    DE270OPT EQU $FF CYCLONE II DE2-70
24
0020                         *
25
0002                          END
26
0000                          INCLUDE "sys09equ.asm"
27
0001                         *
28
0002                         ***************************************************
29
0003                         *   MEMORY MAP EQUATES                            *
30
0004                         ***************************************************
31
0005 E000                    MONIO  EQU $E000  I/O SPACE
32
0006                                IFD B3SOPT
33
0007                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
34
0008                         EXTCMD EQU $00    EXTENDED OFFSET
35
0009                                ENDIF B3SOPT
36
0009                                ENDIF B3SOPT
37
0010                                IFD S3EOPT
38
0011                         MONRAM EQU $7FC0
39
0012                                ELSE
40
0013 DFC0                    MONRAM EQU $DFC0  STACK SPACE
41
0014                                ENDIF S3EOPT
42
0015 F800                    MONROM EQU $F800  START OF ROM
43
0016                                IFD S3SOPT
44
0017                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
45
0018                         EXTCMD EQU $00    EXTENDED OFFSET
46
0019                                ENDIF S3SOPT
47
0019                                ENDIF S3SOPT
48
0020                                IFD XESOPT
49
0021                         MONEXT EQU $F000  START OF EXTENDED COMMANDS
50
0022                         EXTCMD EQU $00    EXTENDED OFFSET
51
0023                                ENDIF XESOPT
52
0023                                ENDIF XESOPT
53
0024                                IFD DE270OPT
54
0025 F000                    MONEXT EQU $F000  START OF EXTENDED COMMANDS
55
0026 0000                    EXTCMD EQU $00    EXTENDED OFFSET
56
0027                                ENDIF DE270OPT
57
0028                         **************************************************
58
0029                         **************************************************
59
0030
60
0031                                 IFD SWTOPT
61
0032                         *
62
0033                         * SOUTH WEST TECHNICAL PRODUCTS COMPUTER
63
0034                         *
64
0035                         ACIAOPT EQU $FF ACIA AT PORT 0
65
0036                         DMAFOPT EQU $FF DMAF2 8" FLOPPY DISK BOOT
66
0037                         MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
67
0038                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
68
0039                                 ENDIF
69
0039                                 ENDIF
70
0040                         *
71
0041                                 IFD ADSOPT
72
0042                         *
73
0043                         * ACKERMAN DIGITAL ADS6809
74
0044                         *
75
0045                         DG640OPT  EQU $FF DG640 VDU AT $E800
76
0046                         *RTCOPT  EQU $FF REAL TIME CLOCK
77
0047                         PRTOPT  EQU $FF PRINTER DRIVERS
78
0048                         MFDCOPT EQU $FF MINIFLOPPY 5.25" DISK BOOT
79
0049                                 ENDIF ADSOPT
80
0049                                 ENDIF ADSOPT
81
0050                         *
82
0051                                 IFD B3SOPT
83
0052                         *
84
0053                         * BURCHED SPARTAN 2 B3+
85
0054                         *
86
0055                         ACIAOPT EQU $FF ACIA AT PORT 0
87
0056                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
88
0057                         VDUOPT  EQU $FF VDU AT $E030
89
0058                         IDEOPT  EQU $FF IDE AT $E100
90
0059                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
91
0060                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
92
0061                                 ENDIF B3SOPT
93
0061                                 ENDIF B3SOPT
94
0062                         *
95
0063                                 IFD B5XOPT
96
0064                         *
97
0065                         * BURCHED SPARTAN 2 B5-X300
98
0066                         *
99
0067                         ACIAOPT EQU $FF ACIA AT PORT 0
100
0068                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
101
0069                         VDUOPT  EQU $FF VDU AT $E030
102
0070                         CF8OPT  EQU $FF COMPACT FLASH AT $E040
103
0071                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
104
0072                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
105
0073                                 ENDIF B5XOPT
106
0073                                 ENDIF B5XOPT
107
0074                         *
108
0075                                 IFD S3SOPT
109
0076                         *
110
0077                         * DIGILENT SPARTAN 3 STARTER
111
0078                         *
112
0079                         ACIAOPT EQU $FF ACIA AT PORT 0
113
0080                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
114
0081                         VDUOPT  EQU $FF VDU AT $E030
115
0082                         CF8OPT  EQU $FF COMPACT FLASH AT $E040
116
0083                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
117
0084                         EXTOPT  EQU $FF EXTENDED COMMANDS
118
0085                                 ENDIF S3SOPT
119
0085                                 ENDIF S3SOPT
120
0086                         *
121
0087                                 IFD S3EOPT
122
0088                         *
123
0089                         * DIGILENT SPARTAN 3E STARTER
124
0090                         *
125
0091                         ACIAOPT EQU $FF ACIA AT PORT 0
126
0092                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
127
0093                         VDUOPT  EQU $FF VDU AT $E030
128
0094                         TRAOPT  EQU $FF PIA TRACE TIMER
129
0095                                 ENDIF S3EOPT
130
0095                                 ENDIF S3EOPT
131
0096                         *
132
0097                                 IFD XESOPT
133
0098                         *
134
0099                         * XESS SPARTAN 3 XSA-3S1000 & XST-3.0
135
0100                         *
136
0101                         ACIAOPT EQU $FF ACIA AT PORT 0
137
0102                         PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
138
0103                         VDUOPT  EQU $FF VDU AT $E030
139
0104                         IDEOPT  EQU $FF IDE AT $E100
140
0105                         DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
141
0106                         HFCOPT  EQU $FF HARDWARE FLOW CONTROL
142
0107                         EXTOPT  EQU $FF EXTENDED COMMANDS
143
0108                                 ENDIF XESOPT
144
0108                                 ENDIF XESOPT
145
0109                         *
146
0110                                 IFD DE270OPT
147
0111                         *
148
0112                         * TERASIC CYCLONE 2 DE2-70
149
0113                         *
150
0114 00FF                    ACIAOPT EQU $FF ACIA AT PORT 0
151
0115 00FF                    PS2OPT  EQU $FF PS2 KEYBOARD AT $E020
152
0116 00FF                    VDUOPT  EQU $FF VDU AT $E030
153
0117 00FF                    CF8OPT  EQU $FF COMPACT FLASH AT $E040
154
0118 00FF                    DATOPT  EQU $FF DYNAMIC ADDRESS TRANSLATION
155
0119 00FF                    EXTOPT  EQU $FF EXTENDED COMMANDS
156
0120                                 ENDIF DE270OPT
157
0121                         *
158
0122                         *
159
0123                                 IFD   ACIAOPT
160
0124                         *
161
0125                         ***************************************************
162
0126                         *   SERIAL PORT                                   *
163
0127                         ***************************************************
164
0128                         *
165
0129                         ** ACIA SITS ON PORT 0
166
0130                         *
167
0131 E000                    ACIAS   EQU   MONIO+$00   CONTROL PORT
168
0132                         *
169
0133                                 ENDIF ACIAOPT
170
0134                                 IFD   MFDCOPT
171
0135                         *
172
0136                         ***************************************************
173
0137                         *   MINIFLOPPY DRIVE                              *
174
0138                         ***************************************************
175
0139                         *
176
0140                         ** FLOPPY DISK CONTROLLER SITS ON PORT 1
177
0141                         *
178
0142                         DRVFDC  EQU   MONIO+$14
179
0143                         CMDFDC  EQU   MONIO+$18
180
0144                         SECFDC  EQU   MONIO+$1A
181
0145                         DATFDC  EQU   MONIO+$1B
182
0146                                 ENDIF MFDCOPT
183
0146                                 ENDIF MFDCOPT
184
0147                                 IFD PS2OPT
185
0148                         *
186
0149                         ***************************************************
187
0150                         *   VDU8 PS/2 KEYBOARD PORT                       *
188
0151                         ***************************************************
189
0152                         *
190
0153                         ** KEYBOARD SITS ON PORT 2
191
0154                         *
192
0155 E020                    PS2KBD  EQU   MONIO+$20   PS/2 KEYBOARD PORT
193
0156                                 ENDIF PS2OPT
194
0157                                 IFD VDUOPT
195
0158                         *
196
0159                         ***************************************************
197
0160                         *   VDU8 DISPLAY DRIVER EQUATES                   *
198
0161                         ***************************************************
199
0162                         *
200
0163                         ** VDU8 DISPLAY SITS ON PORT 3
201
0164                         *
202
0165 E030                    VDU     EQU   MONIO+$30
203
0166 0000                    VDUCHR  EQU   0        CHARACTER REGISTER
204
0167 0001                    VDUATT  EQU   1        ATTRIBUTE REGISTER
205
0168 0002                    VDUCOL  EQU   2        CURSOR COLUMN
206
0169 0003                    VDUROW  EQU   3        CURSOR ROW
207
0170 0004                    VDUOFF  EQU   4        ROW OFFSET
208
0171                         *
209
0172 0050                    LINLEN  EQU   80       LENGTH OF A LINE
210
0173 0019                    NUMLIN  EQU   25       NUMBER OF LINES
211
0174                                 ENDIF VDUOPT
212
0175                         *
213
0176                                    IFD CF8OPT
214
0177                         *
215
0178                         ***************************************************
216
0179                         *   COMPACT FLASH EQUATES 8 BIT TRANSFER          *
217
0180                         ***************************************************
218
0181                         *
219
0182                         ** COMPACT FLASH SITS AT PORT 4
220
0183                         *
221
0184 E040                    CF_BASE    EQU MONIO+$40
222
0185 E040                    CF_DATA    EQU CF_BASE+0
223
0186 E041                    CF_ERROR   EQU CF_BASE+1 ; read error
224
0187 E041                    CF_FEATURE EQU CF_BASE+1 ; write feature
225
0188 E042                    CF_SECCNT  EQU CF_BASE+2
226
0189 E043                    CF_SECNUM  EQU CF_BASE+3
227
0190 E044                    CF_CYLLO   EQU CF_BASE+4
228
0191 E045                    CF_CYLHI   EQU CF_BASE+5
229
0192 E046                    CF_HEAD    EQU CF_BASE+6
230
0193 E047                    CF_STATUS  EQU CF_BASE+7 ; read status
231
0194 E047                    CF_COMAND  EQU CF_BASE+7 ; write command
232
0195                         *
233
0196                         * Command Equates
234
0197                         *
235
0198 0020                    CMDREAD    EQU $20 ; Read Single sector
236
0199 0030                    CMDWRITE   EQU $30 ; Write Single sector
237
0200 00EF                    CMDFEATURE EQU $EF
238
0201 0001                    FEAT8BIT   EQU $01 ; enable 8 bit transfers
239
0202 00E0                    HEADLBA    EQU $E0
240
0203                         *
241
0204                         * Status bit equates
242
0205                         *
243
0206 0080                    BUSY       EQU $80
244
0207 0040                    DRDY       EQU $40
245
0208 0008                    DRQ        EQU $08
246
0209 0001                    ERR        EQU $01
247
0210                         *
248
0211                                    ENDIF CF8OPT
249
0212                         *
250
0213                                    IFD IDEOPT
251
0214                         *
252
0215                         ***************************************************
253
0216                         *   COMPACT FLASH EQUATES 16 BIT TRANSFER (XESS)  *
254
0217                         ***************************************************
255
0218                         *
256
0219                         ** COMPACT FLASH SITS AT PORT 4
257
0220                         *
258
0221                         CF_BASE    EQU MONIO+$0100
259
0222                         CF_DATA    EQU CF_BASE+0
260
0223                         CF_ERROR   EQU CF_BASE+2 ; read error
261
0224                         CF_FEATURE EQU CF_BASE+2 ; write feature
262
0225                         CF_SECCNT  EQU CF_BASE+4
263
0226                         CF_SECNUM  EQU CF_BASE+6
264
0227                         CF_CYLLO   EQU CF_BASE+8
265
0228                         CF_CYLHI   EQU CF_BASE+10
266
0229                         CF_HEAD    EQU CF_BASE+12
267
0230                         CF_STATUS  EQU CF_BASE+14 ; read status
268
0231                         CF_COMAND  EQU CF_BASE+14 ; write command
269
0232                         CF_AUX     EQU CF_BASE+30
270
0233                         *
271
0234                         * Command Equates
272
0235                         *
273
0236                         CMDREAD    EQU $20 ; Read Single sector
274
0237                         CMDWRITE   EQU $30 ; Write Single sector
275
0238                         AUXRESET   EQU $06 ; Reset IDE
276
0239                         AUXRSTREL  EQU $02 ; Reset release IRQ masked
277
0240                         HEADLBA    EQU $E0
278
0241                         *
279
0242                         * Status bit equates
280
0243                         *
281
0244                         BUSY       EQU $80
282
0245                         DRDY       EQU $40
283
0246                         DRQ        EQU $08
284
0247                         ERR        EQU $01
285
0248                         *
286
0249                                    ENDIF CF8OPT
287
0249                                    ENDIF CF8OPT
288
0250                         *
289
0251                                 IFD RTCOPT
290
0252                         *
291
0253                         **************************************************
292
0254                         * MM58167A REAL TIME CLOCK MEMORY MAP:
293
0255                         **************************************************
294
0256                         *
295
0257                         ** REAL TIME CLOCK SITS ON PORT 4 AND PORT 5
296
0258                         *
297
0259                         CLOCK  EQU MONIO+$40 CLOCK BASE ADDRESS AND REGISTERS
298
0260                         *
299
0261                         * COUNTER AND COMPARITOR REGISTERS:
300
0262                         *
301
0263                         * Both the Clock Counter and Clock Comparitor
302
0264                         * consist of 8 registers for holding the time.
303
0265                         * The register offsets from the Counter and
304
0266                         * Comparitor registers are listed above.
305
0267                         *
306
0268                         COUNTR EQU CLOCK+0
307
0269                         CMPRAM EQU CLOCK+8 COMPARITOR REGISTERS
308
0270                         *
309
0271                         * CLOCK REGISTER OFFSETS:
310
0272                         * These register offsets are used for the CLOCK
311
0273                         * and comparitor ram CMPRAM.
312
0274                         *
313
0275                         S10000 EQU 0 TEN THOUNSANDTHS OF SECONDS
314
0276                         S100   EQU 1 HUNDRETHS AND TENTHS OF SECONDS
315
0277                         SECOND EQU 2
316
0278                         MINUIT EQU 3
317
0279                         HOUR   EQU 4
318
0280                         WKDAY  EQU 5
319
0281                         MTHDAY EQU 6
320
0282                         MONTH  EQU 7
321
0283                         *
322
0284                         * INTERRUPT OUTPUT REGISTERS:
323
0285                         *
324
0286                         * An interrupt output may be generated at the
325
0287                         * following rates by setting the appropriate bit
326
0288                         * in the Interrupt Control Register (CINTCR).
327
0289                         * The Interrupt Status Register (CINTSR) must be
328
0290                         * read to clear the interrupt and will return
329
0291                         * the source of the interrupt.
330
0292                         *
331
0293                         * 1/Month      Bit 7
332
0294                         * 1/Week       Bit 6
333
0295                         * 1/Day        Bit 5
334
0296                         * 1/Hour       Bit 4
335
0297                         * 1/Minuite    Bit 3
336
0298                         * 1/Second     Bit 2
337
0299                         * 10/Second    Bit 1
338
0300                         * Comparitor   Bit 0
339
0301                         *
340
0302                         CINTSR  EQU CLOCK+16 INTERRUPT STATUS REGISTER
341
0303                         CINTCR  EQU CLOCK+17 INTERRUPT CONTROL REGISTER
342
0304                         *
343
0305                         * COUNTER AND RAM RESETS; GO COMMAND.
344
0306                         *
345
0307                         * The counter and comparitor may be reset
346
0308                         * by writing $FF into CTRRES and CMPRES
347
0309                         * respectivly.
348
0310                         * A write to the Go command register (GOCMND)
349
0311                         * will reset the 1/1000ths, 1/100ths and 1/10ths
350
0312                         * of a second counter.
351
0313                         *
352
0314                         CTRRES EQU CLOCK+18 COUNTER RESET
353
0315                         CMPRES EQU CLOCK+19 COMPARITOR RAM RESET
354
0316                         GOCMND EQU CLOCK+21 GO COMMAND
355
0317                         *
356
0318                         * CLOCK STATUS REGISTER.
357
0319                         *
358
0320                         * The counter takes 61 usec. to rollover for
359
0321                         * every 1KHz clock pulse. If the Status bit is
360
0322                         * set after reading the counter, the counter
361
0323                         * should be re-read to ensure the time is correct.
362
0324                         *
363
0325                         CLKSTA EQU CLOCK+20 STATUS BIT
364
0326                         SBYINT EQU CLOCK+22 STANDBY INTERRUPT
365
0327                         TSTMOD EQU CLOCK+31 TEST MODE REGISTER
366
0328                                ENDIF RTCOPT
367
0328                                ENDIF RTCOPT
368
0329                         *
369
0330                                IFD TRAOPT
370
0331                         *
371
0332                         **************************************************
372
0333                         * PIA INTERRUPT TIMER
373
0334                         **************************************************
374
0335                         *
375
0336                         ** PIA INTERRUPT TIMER SITS ON PORT 7
376
0337                         *
377
0338                         ** PIA TIMER FOR SINGLE STEP / TRACE
378
0339                         *
379
0340                         * TADATA = Output = Timer preset register
380
0341                         * TACTRL - CA1 = input = rising edge = NMI
381
0342                         *        - CA2 = Output = Timer Reset (Active High)
382
0343                         * TBDATA = Input = Timer read back register
383
0344                         * TBCTRL - CB1 = input = rising edge = FIRQ
384
0345                         *        - CB2 = output = strobe low on write to TBDATA = Timer Preset
385
0346                         *
386
0347                         * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
387
0348                         * CRA1 = 1 CA1 Rising edge IRQ
388
0349                         * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
389
0350                         * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
390
0351                         * CRA4 = 1 ] CA2 = Set/Reset output
391
0352                         * CRA5 = 1 ]
392
0353                         * CRA6 = X CA2 Input Interrupt Flag
393
0354                         * CRA7 = X CA1 Interrupt Flag
394
0355                         *
395
0356                         * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
396
0357                         * CRB1 = 1 CB1 Rising edge IRQ
397
0358                         * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
398
0359                         * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
399
0360                         * CRB4 = 1 ] CB2 = Set/Reset output
400
0361                         * CRB5 = 1 ]
401
0362                         * CRB6 = X CB2 Input Interrupt Flag
402
0363                         * CRB7 = X CB1 Interrupt Flag
403
0364                         *
404
0365                         * DDRA = 0 TADATA = Input, DDRA = 1 TADATA = Output
405
0366                         * DDRB = 0 TBDATA = Input, DDRB = 1 TBDATA = Output
406
0367                         *
407
0368                         TADATA EQU MONIO+$70 Timer preset port
408
0369                         TACTRL EQU MONIO+$71
409
0370                         TBDATA EQU MONIO+$72 Timer read back port
410
0371                         TBCTRL EQU MONIO+$73
411
0372                         *
412
0373                         TRADEL EQU 13  Number of E cycles for RTI (May need to be fudged)
413
0374                         *
414
0375                                ENDIF TRAOPT
415
0375                                ENDIF TRAOPT
416
0376                                IFD ADSOPT
417
0377                         *
418
0378                         ***************************************************
419
0379                         *   SERIAL PORT FOR DG640                         *
420
0380                         ***************************************************
421
0381                         *
422
0382                         ** SET UP FOR ACKERMAN DIGITAL ADS6809
423
0383                         ** THE ADS6809 S100 BOAD HAS AN ON BOARD ACIA
424
0384                         *
425
0385                         ACIAS   EQU   MONIO+$400   CONTROL PORT
426
0386                         *
427
0387                                 ENDIF ADSOPT
428
0387                                 ENDIF ADSOPT
429
0388                                 IFD PRTOPT
430
0389                         *
431
0390                         ***************************************************
432
0391                         * PRINTER INTERFACE                               *
433
0392                         ***************************************************
434
0393                         *
435
0394                         PADATA EQU MONIO+$404
436
0395                         PACTRL EQU MONIO+$405
437
0396                         PBDATA EQU MONIO+$406
438
0397                         PBCTRL EQU MONIO+$407
439
0398                         *
440
0399                         ** CB1  ACK.  I/P
441
0400                         ** CB2  STB.  O/P
442
0401                         ** PB0 - PB7   DATA 1 - 8   O/P
443
0402                         ** PORT A BIT ASSIGNMENT
444
0403                         *
445
0404                         PBUSY  EQU $80 I/P
446
0405                         PEMPTY EQU $40 I/P
447
0406                         SELECT EQU $20 I/P
448
0407                         PERROR EQU $10 I/P
449
0408                         PRESET EQU %00000100 O/P PA3 = 0
450
0409                         AUTOFD EQU %00001000 O/P PA2 = 0
451
0410                         DIRMSK EQU %00001100
452
0411                                ENDIF PRTOPT
453
0411                                ENDIF PRTOPT
454
0412                                IFD DG640OPT
455
0413                         *
456
0414                         ***************************************************
457
0415                         *   DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES  *
458
0416                         ***************************************************
459
0417                         *
460
0418                         ** VIDEO DISPLAY DEFINITIONS
461
0419                         *
462
0420                         SCREEN  EQU   MONIO+$0800 START OF SCREEN MEMORY
463
0421                         LINLEN  EQU   64          LENGTH OF A LINE
464
0422                         NUMLIN  EQU   16          NUMBER OF LINES
465
0423                         SCNLEN  EQU   $400        LENGTH OF SCREEN
466
0424                                 ENDIF DG640OPT
467
0424                                 ENDIF DG640OPT
468
0425                         *
469
0426                                 IFD   DMAFOPT
470
0427                         *
471
0428                         ***************************************************
472
0429                         *   DMAF2 8" DRIVE                                *
473
0430                         ***************************************************
474
0431                         *
475
0432                         ADDREG  EQU   $F000  ADDRESS REGISTER
476
0433                         CNTREG  EQU   $F002  COUNT REGISTER
477
0434                         CCREG   EQU   $F010  CHANNEL CONTROL REGISTER
478
0435                         PRIREG  EQU   $F014  DMA PRIORITY REGISTER
479
0436                         AAAREG  EQU   $F015  ???
480
0437                         BBBREG  EQU   $F016  ???
481
0438                         COMREG  EQU   $F020  1791 COMMAND REGISTER
482
0439                         SECREG  EQU   $F022  SECTOR REGISTER
483
0440                         DRVREG  EQU   $F024  DRIVE SELECT LATCH
484
0441                         CCCREG  EQU   $F040  ???
485
0442                                 ENDIF DMAFOPT
486
0442                                 ENDIF DMAFOPT
487
0443                                 IFD DATOPT
488
0444                         **************************************************
489
0445                         * DYNAMIC ADDRESS TRANSLATION REGISTERS          *
490
0446                         **************************************************
491
0447                         *
492
0448 FFF0                    IC11    EQU  $FFF0  DAT RAM CHIP
493
0449 55AA                    TSTPAT  EQU  $55AA  TEST PATTERN
494
0450                                 ENDIF DATOPT
495
0451                         *
496
0003                                 END
497
0000                          INCLUDE "sys09bug.asm"
498
0001                         * NAM SYS09BUG12 SYSTEM09 MONITOR
499
0002                          OPT l
500
 
501
 
502
sys09bug.asm                                                                      page   2
503
0004                         *
504
0005                         * MONITOR PROGRAM FOR THE SOUTHWEST TECHNICAL
505
0006                         * PRODUCTS MP-09 CPU BOARD AS COMMENTED BY....
506
0007                         *
507
0008                         * ALLEN CLARK            WALLACE WATSON
508
0009                         * 2502 REGAL OAKS LANE   4815 EAST 97th AVE.
509
0010                         * LUTZ, FLA. 33549       TEMPLE TERRACE, FLA. 33617
510
0011                         * PH. 813-977-0347       PH. 813-985-1359
511
0012                         *
512
0013                         * MODIFIED TO SBUG09 VER 1.8 BY:  RANDY JARRETT
513
0014                         *                                 2561 NANTUCKET DR APT. E
514
0015                         *                                 ATLANTA, GA  30345
515
0016                         *                                 PH. 404-320-1043
516
0017                         *
517
0018                         * MODIFIED TO SYS09BUG VER 1.0
518
0019                         * FOR:     SYSTEM09 FPGA SYSTEM
519
0020                         * BY:      JOHN KENT
520
0021                         * DATE:    21ST NOVEMBER 2006
521
0022                         * REMOVED: DISK BOOTS
522
0023                         *          MEMORY TEST
523
0024                         * ADDED:   ADM3A VDU DRIVER
524
0025                         *
525
0026                         * MODIFIED TO SYS09BUG VER 1.1
526
0027                         * BY:      JOHN KENT
527
0028                         * DATE:    7TH JANUARY 2007
528
0029                         * ADDED:   'U' USER EXTENTION COMMANDS AT $F000
529
0030                         *          CONDITIONAL ASSEMBLY OF FLOPPY BOOTS
530
0031                         *          AND REALTIME CLOCK
531
0032                         *
532
0033                         * MODIFIED TO SYS09BUG VER 1.2
533
0034                         * BY:      JOHN KENT
534
0035                         * DATE:    21ST MAY 2007
535
0036                         * ADDED:   COMPACT FLASH BOOT TO FPGA VERSION
536
0037                         *          REMOVED PORT REDIRECTION ON PUNCH & LOAD
537
0038                         *
538
0039                         * Modified to SYS09BUG VER 1.3
539
0040                         * BY:      JOHN KENT
540
0041                         * DATE:    8TH JAN 2008
541
0042                         * ADDED:   CONDITIONALS FOR SPARTAN3E STARTER BOARD
542
0043                         *          WITH ONLY 32K OF RAM
543
0044                         *
544
0045                         * Modified to SYS09BUG VER 1.4
545
0046                         * BY:      JOHN KENT
546
0047                         * DATE:    3RD FEB 2008
547
0048                         * ADDED:   CONDITIONALS FOR XESS BOARD WITH IDE
548
0049                         *          SEPERATE CONDITIONAL FOR S3 STARTER AND B5-X300
549
0050                         *          16 BIT IDE DISK BOOT STRAP ROUTINE
550
0051                         *
551
0052                         * Modified to SYS09BUG VER 1.5
552
0053                         * BY:      JOHN KENT
553
0054                         * DATE:    7TH SEP 2008
554
0055                         * ADDED:   ADDED "B3-S2+" STRING
555
0056                         *
556
0057                         * Modified to SYS09BUG VER 1.6
557
0058                         * BY:      JOHN KENT
558
0059                         * DATE:    2ND DEC 2008
559
0060                         * ADDED:   ADDED HARDWARE FLOW CONTROL
560
0061                         *
561
0062                         * CHANGED: SEPARARTED OPTIONS EQUATES AND BODY INTO SEPARATE FILES
562
0063                         *
563
0064                         * Modified to SYS09BUG VER 1.7
564
0065                         * BY:     JOHN KENT
565
0066                         * DATE:   16TH OCT 2010
566
0067                         * ADDED:  "DE2-70" STRING
567
0068                         *
568
0069                         *       *** COMMANDS ***
569
0070                         *
570
0071                         * CONTROL A   = ALTER THE "A" ACCUMULATOR
571
0072                         * CONTROL B   = ALTER THE "B" ACCUMULATOR
572
0073                         * CONTROL C   = ALTER THE CONDITION CODE REGISTER
573
0074                         * CONTROL D   = ALTER THE DIRECT PAGE REGISTER
574
0075                         * CONTROL P   = ALTER THE PROGRAM COUNTER
575
0076                         * CONTROL U   = ALTER USER STACK POINTER
576
0077                         * CONTROL X   = ALTER "X" INDEX REGISTER
577
0078                         * CONTROL Y   = ALTER "Y" INDEX REGISTER
578
0079                         * B hhhh      = SET BREAKPOINT AT LOCATION $hhhh
579
0080                         * D           = 5.25" MINIFLOPPY BOOT
580
0081                         * E ssss-eeee = EXAMINE MEMORY
581
0082                         *               FROM STARTING ADDRESS ssss
582
0083                         *               TO ENDING ADDRESS eeee.
583
0084                         * G           = CONTINUE EXECUTION FROM BREAKPOINT OR SWI
584
0085                         * L           = LOAD TAPE
585
0086                         * M hhhh      = EXAMINE AND CHANGE MEMORY LOCATION hhhh
586
0087                         * P ssss-eeee = PUNCH TAPE, START ssss TO END eeee ADDR.
587
0088                         * R           = DISPLAY REGISTER CONTENTS
588
0089                         * S           = DISPLAY STACK FROM ssss TO $DFC0
589
0090                         * U           = 8" DMAF2 FLOPPY BOOT
590
0091                         * U           = USER EXTENSION COMMANDS AT $F000
591
0092                         * X           = REMOVE ALL BREAKPOINTS
592
0093                         *
593
0094                         *
594
0095                         ***************************************************
595
0096                         *   SYS09BUG VARIABLE SPACE
596
0097                         ***************************************************
597
0098                         *
598
0099 DFC0                            ORG   MONRAM
599
0100 DFC0                    STACK   EQU   *         ; TOP OF INTERNAL STACK
600
0101 DFC0                    NMI     RMB   2         ; USER NMI VECTOR
601
0102 DFC2                    SWI3    RMB   2         ; SOFTWARE INTERRUPT VECTOR #3
602
0103 DFC4                    SWI2    RMB   2         ; SOFTWARE INTERRUPT VECTOR #2
603
0104 DFC6                    FIRQ    RMB   2         ; FAST INTERRUPT VECTOR
604
0105 DFC8                    IRQ     RMB   2         ; INTERRUPT VECTOR
605
0106 DFCA                    SWI     RMB   2         ; SOFTWARE INTERRUPT VECTOR
606
0107 DFCC                    SVCVO   RMB   2         ; SUPERVISOR CALL VECTOR ORGIN
607
0108 DFCE                    SVCVL   RMB   2         ; SUPERVISOR CALL VECTOR LIMIT
608
0109                                 IFD DATOPT
609
0110 DFD0                    LRARAM  RMB  16         ; LRA ADDRESSES
610
0111                                 ENDIF DATOPT
611
0112 DFE0                    CPORT   RMB   2         ; RE-VECTORABLE CONTROL PORT
612
0113 DFE2                    ECHO    RMB   1         ; ECHO FLAG
613
0114 DFE3                    BPTBL   RMB  24         ; BREAKPOINT TABLE BASE ADDR
614
0115                                 IFD  TRAOPT
615
0116                         NMISAV  RMB   2         ; NMI Jump Vector Backup
616
0117                         TRACNT  RMB   2         ; Trace Count
617
0118                                 ENDIF TRAOPT
618
0118                                 ENDIF TRAOPT
619
0119                                 IFD VDUOPT
620
0120                         *
621
0121                         **************************************************
622
0122                         *   VDU8 DISPLAY DRIVER VARIABLES                                    *
623
0123                         **************************************************
624
0124                         *
625
0125                         **** ALWAYS KEEP COLADX AND ROWADX TOGETHER ******
626
0126 DFFB                    COLADX  RMB   1         ; CURSOR COLUMN
627
0127 DFFC                    ROWADX  RMB   1         ; CURSOR ROW
628
0128                         **************************************************
629
0129                         *
630
0130 DFFD                    NEWROW  RMB   1         ; NEW ROW TEMP FOR ESCAPE
631
0131 DFFE                    ESCFLG  RMB   1         ; ESCAPE SEQUENCE ACTIVE
632
0132                                 ENDIF VDUOPT
633
0133                                 IFD DG640OPT
634
0134                         *
635
0135                         ***************************************************
636
0136                         *   DG640 MEMORY MAPPED DISPLAY DRIVER VARIABLES  *
637
0137                         ***************************************************
638
0138                         *
639
0139                         ***** ALWAYS KEEP THESE TWO BYTES TOGETHER *****
640
0140                         COLADX  RMB   1        ; CURSOR COLUMN
641
0141                         ROWADX  RMB   1        ; CURSOR ROW
642
0142                         *************************************************
643
0143                         CURSOR  RMB   2        ; ABSOLUTE SCREEN ADDRESS
644
0144                         NEWROW  RMB   1        ; NEW ROW TEMP FOR ESCAPE
645
0145                         ESCFLG  RMB   1        ; ESCAPE SEQUENCE ACTIVE
646
0146                                 ENDIF DG640OPT
647
0146                                 ENDIF DG640OPT
648
0147                         *
649
0148                         *
650
0149                         ***************************************************
651
0150                         *   START OF ROM                                  *
652
0151                         ***************************************************
653
0152                         *
654
0153 F800                            ORG   MONROM
655
0154 F800 F8 14                      FDB   MONITOR
656
0155 F802 F8 61                      FDB   NEXTCMD
657
0156 F804 FC A1                      FDB   INCH
658
0157 F806 FC 9B                      FDB   INCHE
659
0158 F808 FC B9                      FDB   INCHEK
660
0159 F80A FC CE                      FDB   OUTCH
661
0160 F80C FB 8F                      FDB   PDATA
662
0161 F80E FB 1E                      FDB   PCRLF
663
0162 F810 FB 1A                      FDB   PSTRNG
664
0163 F812 FA 2E                      FDB   LRA
665
0164                         *
666
0165                                 IFD   ADSOPT
667
0166                                 FDB   PCHK     ; CHECK FOR PRINTER INPUT
668
0167                                 FDB   PINIZ    ; INITIATE PRINTER
669
0168                                 FDB   POUTCH   ; OUTPUT CH. TO PRINTER
670
0169                                 FDB   VINIZ
671
0170                                 FDB   VOUTCH
672
0171                                 FDB   ACINIZ
673
0172                                 FDB   AOUTCH
674
0173                                 ENDIF ADSOPT
675
0173                                 ENDIF ADSOPT
676
0174                         *
677
0175                         * MONITOR
678
0176                         *
679
0177                         * VECTOR ADDRESS STRING IS.....
680
0178                         * $F8A1-$F8A1-$F8A1-$F8A1-$F8A1-$FAB0-$FFFF-$FFFF
681
0179                         *
682
0180 F814 8E FE 62           MONITOR LDX   #RAMVEC  ; POINT TO VECTOR ADDR. STRING
683
0181 F817 10 8E DF C0                LDY   #STACK   ; POINT TO RAM VECTOR LOCATION
684
0182 F81B C6 10                      LDB   #$10     ; BYTES TO MOVE = 16
685
0183 F81D A6 80              LOOPA   LDA   ,X+      ; GET VECTOR BYTE
686
0184 F81F A7 A0                      STA   ,Y+      ; PUT VECTORS IN RAM / $DFC0-$DFCF
687
0185 F821 5A                         DECB           ; SUBTRACT 1 FROM NUMBER OF BYTES TO MOVE
688
0186 F822 26 F9                      BNE   LOOPA    ; CONTINUE UNTIL ALL VECTORS MOVED
689
0187                         *
690
0188                         * CONTENTS     FROM         TO      FUNCTION
691
0189                         *  $F8A1       $FE40      $DFC0     USER-V
692
0190                         *  $F8A1       $FE42      $DFC2     SWI3-V
693
0191                         *  $F8A1       $FE44      $DFC4     SWI2-V
694
0192                         *  $F8A1       $FE46      $DFC6     FIRQ-V
695
0193                         *  $F8A1       $FE48      $DFC8     IRQ-V
696
0194                         *  $FAB0       $FE4A      $DFCA     SWI-V
697
0195                         *  $FFFF       $FE4C      $DFCC     SVC-VO
698
0196                         *  $FFFF       $FE4E      $DFCE     SVC-VL
699
0197                         *
700
0198 F824 8E E0 00                   LDX   #ACIAS
701
0199 F827 BF DF E0                   STX   CPORT    ; STORE ADDR. IN RAM
702
0200 F82A 17 01 5B                   LBSR  XBKPNT   ; CLEAR OUTSTANDING BREAKPOINTS
703
0201 F82D C6 0C                      LDB   #12      ; CLEAR 12 BYTES ON STACK
704
0202 F82F 6F E2              CLRSTK  CLR   ,-S
705
0203 F831 5A                         DECB
706
0204 F832 26 FB                      BNE   CLRSTK
707
0205 F834 30 8C DD                   LEAX  MONITOR,PCR  ; SET PC TO SBUG-E ENTRY
708
0206 F837 AF 6A                      STX   10,S    ; ON STACK
709
0207 F839 86 D0                      LDA   #$D0    ; PRESET CONDITION CODES ON STACK
710
0208 F83B A7 E4                      STA   ,S
711
0209 F83D 1F 43                      TFR   S,U
712
0210 F83F 17 04 A3                   LBSR  IOINIZ  ; INITIALIZE CONTROL PORT
713
0211 F842 8E FE 72                   LDX   #MSG1   ; POINT TO MONITOR MESSAGE
714
0212 F845 17 03 47                   LBSR  PDATA   ; PRINT MSG
715
0213                         *
716
0214                                 IFD   DATOPT
717
0215 F848 8E DF D0                   LDX   #LRARAM ; POINT TO LRA RAM STORAGE AREA
718
0216 F84B 4F                         CLRA  START   ; TOTAL AT ZERO
719
0217 F84C C6 0D                      LDB   #13     ; TOTAL UP ALL ACTIVE RAM MEMORY
720
0218 F84E 6D 85              FNDREL  TST   B,X     ; TEST FOR RAM AT NEXT LOC.
721
0219 F850 27 03                      BEQ   RELPAS  ; IF NO RAM GO TO NEXT LOC.
722
0220 F852 8B 04                      ADDA  #4      ; ELSE ADD 4K TO TOTAL
723
0221 F854 19                         DAA           ; ADJ. TOTAL FOR DECIMAL
724
0222 F855 5A                 RELPAS  DECB          ; SUB. 1 FROM LOCS. TO TEST
725
0223 F856 2A F6                      BPL   FNDREL  ; PRINT TOTAL OF RAM
726
0224 F858 17 04 0C                   LBSR  OUT2H   ; OUTPUT HEX BYTE AS ASCII
727
0225 F85B 8E FE 92                   LDX   #MSG2   ; POINT TO MSG 'K' CR/LF + 3 NULS
728
0226 F85E 17 03 2E                   LBSR  PDATA   ; PRINT MSG
729
0227                                 ENDIF DATOPT
730
0228                         *
731
0229                                 IFD   TRAOPT
732
0230                                 LBSR  TRAINZ
733
0231                                 ENDIF TRAOPT
734
0231                                 ENDIF TRAOPT
735
0232                         *
736
0233                         ***** NEXTCMD *****
737
0234                         *
738
0235 F861 8E FE 99           NEXTCMD LDX  #MSG3   ; POINT TO MSG ">"
739
0236 F864 17 02 B3                   LBSR PSTRNG  ; PRINT MSG
740
0237 F867 17 04 37                   LBSR INCH    ; GET ONE CHAR. FROM TERMINAL
741
0238 F86A 84 7F                      ANDA #$7F    ; STRIP PARITY FROM CHAR.
742
0239 F86C 81 0D                      CMPA #$0D    ; IS IT CARRIAGE RETURN ?
743
0240 F86E 27 F1                      BEQ  NEXTCMD ; IF CR THEN GET ANOTHER CHAR.
744
0241 F870 1F 89                      TFR  A,B     ; PUT CHAR. IN "B" ACCUM.
745
0242 F872 81 20                      CMPA #$20    ; IS IT CONTROL OR DATA CHAR ?
746
0243 F874 2C 09                      BGE  PRTCMD  ; IF CMD CHAR IS DATA, PRNT IT
747
0244 F876 86 5E                      LDA  #'^     ; ELSE CNTRL CHAR CMD SO...
748
0245 F878 17 04 53                   LBSR OUTCH   ; PRINT "^"
749
0246 F87B 1F 98                      TFR  B,A     ; RECALL CNTRL CMD CHAR
750
0247 F87D 8B 40                      ADDA #$40    ; CONVERT IT TO ASCII LETTER
751
0248 F87F 17 04 4C           PRTCMD  LBSR OUTCH   ; PRNT CMD CHAR
752
0249 F882 17 04 47                   LBSR OUT1S   ; PRNT SPACE
753
0250 F885 C1 60                      CMPB #$60
754
0251 F887 2F 02                      BLE  NXTCH0
755
0252 F889 C0 20                      SUBB #$20
756
0253                         *
757
0254                         ***** DO TABLE LOOKUP *****
758
0255                         *   FOR COMMAND FUNCTIONS
759
0256                         *
760
0257 F88B 8E FE 29           NXTCH0  LDX  #JMPTAB ; POINT TO JUMP TABLE
761
0258 F88E E1 80              NXTCHR  CMPB ,X+     ; DOES COMMAND MATCH TABLE ENTRY ?
762
0259 F890 27 0F                      BEQ  JMPCMD  ; BRANCH IF MATCH FOUND
763
0260 F892 30 02                      LEAX 2,X     ; POINT TO NEXT ENTRY IN TABLE
764
0261 F894 8C FE 62                   CMPX #TABEND ; REACHED END OF TABLE YET ?
765
0262 F897 26 F5                      BNE  NXTCHR  ; IF NOT END, CHECK NEXT ENTRY
766
0263 F899 8E FE 9B                   LDX  #MSG4   ; POINT TO MSG "WHAT?"
767
0264 F89C 17 02 F0                   LBSR PDATA   ; PRINT MSG
768
0265 F89F 20 C0                      BRA  NEXTCMD ; IF NO MATCH, PRMPT FOR NEW CMD
769
0266 F8A1 AD 94              JMPCMD  JSR  [,X]    ; JUMP TO COMMAND ROUTINE
770
0267 F8A3 20 BC                      BRA  NEXTCMD ; PROMPT FOR NEW COMMAND
771
0268                         *
772
0269                         * "G" GO OR CONTINUE
773
0270                         *
774
0271 F8A5 1F 34              GO      TFR  U,S
775
0272 F8A7 3B                 RTI     RTI
776
0273                         *
777
0274                         ***** "M" MEMORY EXAMINE AND CHANGE *****
778
0275                         *
779
0276 F8A8 17 03 6B           MEMCHG  LBSR IN1ADR  ; INPUT ADDRESS
780
0277 F8AB 29 2D                      BVS  CHRTN   ; IF NOT HEX, RETURN
781
0278 F8AD 1F 12                      TFR  X,Y     ; SAVE ADDR IN "Y"
782
0279 F8AF 8E FE A1           MEMC2   LDX  #MSG5   ; POINT TO MSG " - "
783
0280 F8B2 17 02 65                   LBSR PSTRNG  ; PRINT MSG
784
0281 F8B5 1F 21                      TFR  Y,X     ; FETCH ADDRESS
785
0282 F8B7 17 03 A5                   LBSR OUT4H   ; PRINT ADDR IN HEX
786
0283 F8BA 17 04 0F                   LBSR OUT1S   ; OUTPUT SPACE
787
0284 F8BD A6 A4                      LDA  ,Y      ; GET CONTENTS OF CURRENT ADDR.
788
0285 F8BF 17 03 A5                   LBSR OUT2H   ; OUTPUT CONTENTS IN ASCII
789
0286 F8C2 17 04 07                   LBSR OUT1S   ; OUTPUT SPACE
790
0287 F8C5 17 03 5E                   LBSR BYTE    ; LOOP WAITING FOR OPERATOR INPUT
791
0288 F8C8 28 11                      BVC  CHANGE  ; IF VALID HEX GO CHANGE MEM. LOC.
792
0289 F8CA 81 08                      CMPA #8      ; IS IT A BACKSPACE (CNTRL H)?
793
0290 F8CC 27 E1                      BEQ  MEMC2   ; PROMPT OPERATOR AGAIN
794
0291 F8CE 81 18                      CMPA #$18    ; IS IT A CANCEL (CNTRL X)?
795
0292 F8D0 27 DD                      BEQ  MEMC2   ; PROMPT OPERATOR AGAIN
796
0293 F8D2 81 5E                      CMPA #'^     ; IS IT AN UP ARROW?
797
0294 F8D4 27 17                      BEQ  BACK    ; DISPLAY PREVIOUS BYTE
798
0295 F8D6 81 0D                      CMPA #$D     ; IS IT A CR?
799
0296 F8D8 26 0F                      BNE  FORWRD  ; DISPLAY NEXT BYTE
800
0297 F8DA 39                 CHRTN   RTS          ; EXIT ROUTINE
801
0298                         *
802
0299                         *
803
0300 F8DB A7 A4              CHANGE  STA  ,Y      ; CHANGE BYTE IN MEMORY
804
0301 F8DD A1 A4                      CMPA ,Y      ; DID MEMORY BYTE CHANGE?
805
0302 F8DF 27 08                      BEQ  FORWRD  ; $F972
806
0303 F8E1 17 03 E8                   LBSR OUT1S   ; OUTPUT SPACE
807
0304 F8E4 86 3F                      LDA  #'?     ; LOAD QUESTION MARK
808
0305 F8E6 17 03 E5                   LBSR OUTCH   ; PRINT IT
809
0306 F8E9 31 21              FORWRD  LEAY 1,Y     ; POINT TO NEXT HIGHER MEM LOCATION
810
0307 F8EB 20 C2                      BRA  MEMC2   ; PRINT LOCATION & CONTENTS
811
0308 F8ED 31 3F              BACK    LEAY -1,Y    ; POINT TO LAST MEM LOCATION
812
0309 F8EF 20 BE                      BRA  MEMC2   ; PRINT LOCATION & CONTENTS
813
0310                         *
814
0311                         * "S" DISPLAY STACK
815
0312                         * HEX-ASCII DISPLAY OF CURRENT STACK CONTENTS FROM
816
0313                         ** CURRENT STACK POINTER TO INTERNAL STACK LIMIT.
817
0314                         *
818
0315 F8F1 17 02 A2           DISSTK  LBSR PRTSP   ; PRINT CURRENT STACK POINTER
819
0316 F8F4 1F 32                      TFR  U,Y
820
0317 F8F6 8E DF C0                   LDX  #STACK  ; LOAD INTERNAL STACK AS UPPER LIMIT
821
0318 F8F9 30 1F                      LEAX -1,X    ; POINT TO CURRENT STACK
822
0319 F8FB 20 05                      BRA  MDUMP1  ; ENTER MEMORY DUMP OF STACK CONTENTS
823
0320                         *
824
0321                         * "E" DUMP MEMORY FOR EXAMINE IN HEX AND ASCII
825
0322                         * AFTER CALLING 'IN2ADR' LOWER ADDRESS IN Y-REG.
826
0323                         *                        UPPER ADDRESS IN X-REG.
827
0324                         * IF HEX ADDRESSES ARE INVALID (V)=1.
828
0325                         *
829
0326 F8FD 17 03 0B           MEMDUMP LBSR IN2ADR  ; INPUT ADDRESS BOUNDRIES
830
0327 F900 29 06                      BVS  EDPRTN  ; NEW COMMAND IF ILLEGAL HEX
831
0328 F902 34 20              MDUMP1  PSHS Y       ; COMPARE LOWER TO UPPER BOUNDS
832
0329 F904 AC E1                      CMPX ,S++    ; LOWER BOUNDS > UPPER BOUNDS?
833
0330 F906 24 01                      BCC  AJDUMP  ; IF NOT, DUMP HEX AND ASCII
834
0331 F908 39                 EDPRTN  RTS          ;
835
0332                         *
836
0333                         * ADJUST LOWER AND UPPER ADDRESS LIMITS
837
0334                         * TO EVEN 16 BYTE BOUNDRIES.
838
0335                         *
839
0336                         * IF LOWER ADDR = $4532
840
0337                         * LOWER BOUNDS WILL BE ADJUSTED TO = $4530.
841
0338                         *
842
0339                         * IF UPPER ADDR = $4567
843
0340                         * UPPER BOUNDS WILL BE ADJUSTED TO = $4570.
844
0341                         *
845
0342                         * ENTER WITH LOWER ADDRESS IN X-REG.
846
0343                         *           -UPPER ADDRESS ON TOP OF STACK.
847
0344                         *
848
0345 F909 1F 10              AJDUMP  TFR  X,D     ; GET UPPER ADDR IN D-REG
849
0346 F90B C3 00 10                   ADDD #$10    ; ADD 16 TO UPPER ADDRESS
850
0347 F90E C4 F0                      ANDB #$F0    ; MASK TO EVEN 16 BYTE BOUNDRY
851
0348 F910 34 06                      PSHS A,B     ; SAVE ON STACK AS UPPER DUMP LIMIT
852
0349 F912 1F 20                      TFR  Y,D     ; $F9A5 GET LOWER ADDRESS IN D-REG
853
0350 F914 C4 F0                      ANDB #$F0    ; MASK TO EVEN 16 BYTE BOUNDRY
854
0351 F916 1F 01                      TFR  D,X     ; PUT IN X-REG AS LOWER DUMP LIMIT
855
0352 F918 AC E4              NXTLIN  CMPX ,S      ; COMPARE LOWER TO UPPER LIMIT
856
0353 F91A 27 05                      BEQ  SKPDMP  ; IF EQUAL SKIP HEX-ASCII DUMP
857
0354 F91C 17 03 9A                   LBSR INCHEK  ; CHECK FOR INPUT FROM KEYBOARD
858
0355 F91F 27 03                      BEQ  EDUMP
859
0356 F921 32 62              SKPDMP  LEAS 2,S     ; READJUST STACK IF NOT DUMPING
860
0357 F923 39                         RTS          ;
861
0358                         *
862
0359                         * PRINT 16 HEX BYTES FOLLOWED BY 16 ASCII CHARACTERS
863
0360                         * FOR EACH LINE THROUGHOUT ADDRESS LIMITS.
864
0361                         *
865
0362 F924 34 10              EDUMP   PSHS X       ; PUSH LOWER ADDR LIMIT ON STACK
866
0363 F926 8E FE A1                   LDX  #MSG5   ; POINT TO MSG " - "
867
0364 F929 17 01 EE                   LBSR PSTRNG  ; PRINT MSG
868
0365 F92C AE E4                      LDX  ,S      ; LOAD LOWER ADDR FROM TOP OF STACK
869
0366 F92E 17 03 2E                   LBSR OUT4H   ; PRINT THE ADDRESS
870
0367 F931 17 03 96                   LBSR OUT2S   ; 2 SPACES
871
0368 F934 C6 10                      LDB  #$10    ; LOAD COUNT OF 16 BYTES TO DUMP
872
0369 F936 A6 80              ELOOP   LDA  ,X+     ; GET FROM MEMORY HEX BYTE TO PRINT
873
0370 F938 17 03 2C                   LBSR OUT2H   ; OUTPUT HEX BYTE AS ASCII
874
0371 F93B 17 03 8E                   LBSR OUT1S   ; OUTPUT SPACE
875
0372 F93E 5A                         DECB         ; $F9D1 DECREMENT BYTE COUNT
876
0373 F93F 26 F5                      BNE  ELOOP   ; CONTINUE TIL 16 HEX BYTES PRINTED
877
0374                         *
878
0375                         * PRINT 16 ASCII CHARACTERS
879
0376                         * IF NOT PRINTABLE OR NOT VALID
880
0377                         * ASCII PRINT A PERIOD (.)
881
0378 F941 17 03 86                   LBSR OUT2S   ; 2 SPACES
882
0379 F944 AE E1                      LDX  ,S++    ; GET LOW LIMIT FRM STACK - ADJ STACK
883
0380 F946 C6 10                      LDB  #$10    ; SET ASCII CHAR TO PRINT = 16
884
0381 F948 A6 80              EDPASC  LDA  ,X+     ; GET CHARACTER FROM MEMORY
885
0382 F94A 81 20                      CMPA #$20    ; IF LESS THAN $20, NON-PRINTABLE?
886
0383 F94C 25 04                      BCS  PERIOD  ; IF SO, PRINT PERIOD INSTEAD
887
0384 F94E 81 7E                      CMPA #$7E    ; IS IT VALID ASCII?
888
0385 F950 23 02                      BLS  PRASC   ; IF SO PRINT IT
889
0386 F952 86 2E              PERIOD  LDA  #'.     ; LOAD A PERIOD (.)
890
0387 F954 17 03 77           PRASC   LBSR OUTCH   ; PRINT ASCII CHARACTER
891
0388 F957 5A                         DECB         ; DECREMENT COUNT
892
0389 F958 26 EE                      BNE  EDPASC
893
0390 F95A 20 BC                      BRA  NXTLIN
894
0391                         *
895
0392                         ***** "B" SET BREAKPOINT *****
896
0393                         *
897
0394 F95C 17 02 B7           BRKPNT  LBSR IN1ADR  ; GET BREAKPOINT ADDRESS
898
0395 F95F 29 1E                      BVS  EXITBP  ; EXIT IF INVALID HEX ADDR.
899
0396 F961 8C DF C0                   CMPX #STACK  ; ADDRESS ILLEGAL IF >=$DFC0
900
0397 F964 24 1A                      BCC  BPERR   ; IF ERROR PRINT (?), EXIT
901
0398 F966 34 10                      PSHS X       ; $FA82 PUSH BP ADDRESS ON STACK
902
0399 F968 8E FF FF                   LDX  #$FFFF  ; LOAD DUMMY ADDR TO TEST BP TABLE
903
0400 F96B 8D 55                      BSR BPTEST   ; TEST BP TABLE FOR FREE SPACE
904
0401 F96D 35 10                      PULS X       ; POP BP ADDRESS FROM STACK
905
0402 F96F 27 0F                      BEQ  BPERR   ; (Z) SET, OUT OF BP TABLE SPACE
906
0403 F971 A6 84                      LDA  ,X      ; GET DATA AT BREAKPOINT ADDRESS
907
0404 F973 81 3F                      CMPA #$3F    ; IS IT A SWI?
908
0405 F975 27 09                      BEQ  BPERR   ; IF SWI ALREADY, INDICATE ERROR
909
0406 F977 A7 A0                      STA  ,Y+     ; SAVE DATA BYTE IN BP TABLE
910
0407 F979 AF A4                      STX  ,Y      ; SAVE BP ADDRESS IN BP TABLE
911
0408 F97B 86 3F                      LDA  #$3F    ; LOAD A SWI ($3F)
912
0409 F97D A7 84                      STA  ,X      ; SAVE SWI AT BREAKPOINT ADDRESS
913
0410 F97F 39                 EXITBP  RTS ;
914
0411                         *
915
0412                         *  INDICATE ERROR SETTING BREAKPOINT
916
0413                         *
917
0414 F980 17 03 49           BPERR   LBSR OUT1S   ; OUTPUT SPACE
918
0415 F983 86 3F                      LDA  #'?     ; LOAD (?), INDICATE BREAKPOINT ERROR
919
0416 F985 16 03 46                   LBRA OUTCH   ; PRINT "?"
920
0417                         *
921
0418                         *** "X" CLEAR OUTSTANDING BREAKPOINTS ***
922
0419                         *
923
0420 F988 10 8E DF E3        XBKPNT  LDY  #BPTBL  ; POINT TO BREAKPOINT TABLE
924
0421 F98C C6 08                      LDB  #8      ; LOAD BREAKPOINT COUNTER
925
0422 F98E 8D 18              XBPLP   BSR  RPLSWI  ; REMOVE USED ENTRY IN BP TABLE
926
0423 F990 5A                         DECB  $FAAC  ; DECREMENT BP COUNTER
927
0424 F991 26 FB                      BNE  XBPLP   ; END OF BREAKPOINT TABLE?
928
0425 F993 39                         RTS
929
0426                         *
930
0427                         ***** SWI ENTRY POINT *****
931
0428                         *
932
0429 F994 1F 43              SWIE    TFR  S,U     ; TRANSFER STACK TO USER POINTER
933
0430 F996 AE 4A                      LDX  10,U    ; LOAD PC FROM STACK INTO X-REG
934
0431 F998 30 1F                      LEAX -1,X    ; ADJUST ADDR DOWN 1 BYTE.
935
0432 F99A 8D 26                      BSR  BPTEST  ; FIND BREAKPOINT IN BP TABLE
936
0433 F99C 27 04                      BEQ  REGPR   ; IF FOUND, REPLACE DATA AT BP ADDR
937
0434 F99E AF 4A                      STX  10,U    ; SAVE BREAKPOINT ADDR IN STACK
938
0435 F9A0 8D 06                      BSR  RPLSWI  ; GO REPLACE SWI WITH ORIGINAL DATA
939
0436 F9A2 17 02 48           REGPR   LBSR REGSTR  ; GO PRINT REGISTERS
940
0437                         *
941
0438                                 IFD TRAOPT
942
0439                                 LDX #0
943
0440                                 STX TRACNT
944
0441                                 ENDIF TRAOPT
945
0441                                 ENDIF TRAOPT
946
0442                         *
947
0443 F9A5 16 FE B9                   LBRA NEXTCMD ; GET NEXT COMMAND
948
0444                         *
949
0445 F9A8 AE 21              RPLSWI  LDX  1,Y     ; LOAD BP ADDRESS FROM BP TABLE
950
0446 F9AA 8C DF C0                   CMPX #STACK  ; COMPARE TO TOP AVAILABLE USER MEMORY
951
0447 F9AD 24 0A                      BCC  FFSTBL  ; GO RESET TABLE ENTRY TO $FF'S
952
0448 F9AF A6 84                      LDA  ,X      ; GET DATA FROM BP ADDRESS
953
0449 F9B1 81 3F                      CMPA #$3F    ; IS IT SWI?
954
0450 F9B3 26 04                      BNE  FFSTBL  ; IF NOT, RESET TABLE ENTRY TO $FF'S
955
0451 F9B5 A6 A4                      LDA  ,Y      ; GET ORIGINAL DATA FROM BP TABLE
956
0452 F9B7 A7 84                      STA  ,X      ; $FAD3 RESTORE DATA AT BP ADDRESS
957
0453 F9B9 86 FF              FFSTBL  LDA  #$FF    ; LOAD $FF IN A-ACC
958
0454 F9BB A7 A0                      STA  ,Y+     ; RESET BREAKPOINT TABLE DATA TO $FF'S
959
0455 F9BD A7 A0                      STA  ,Y+     ; RESET BREAKPOINT TABLE ADDR TO $FF'S
960
0456 F9BF A7 A0                      STA  ,Y+
961
0457 F9C1 39                         RTS
962
0458                         *
963
0459                         ** SEARCH BREAKPOINT TABLE FOR MATCH **
964
0460                         *
965
0461 F9C2 10 8E DF E3        BPTEST  LDY  #BPTBL  ; POINT TO BREAKPOINT TABLE
966
0462 F9C6 C6 08                      LDB  #8      ; LOAD BREAKPOINT COUNTER
967
0463 F9C8 A6 A0              FNDBP   LDA  ,Y+     ; LOAD DATA BYTE
968
0464 F9CA AC A1                      CMPX ,Y++    ; COMPARE ADDRESS, IS IT SAME?
969
0465 F9CC 27 04                      BEQ  BPADJ   ; IF SO, ADJUST POINTER FOR TABLE ENTRY
970
0466 F9CE 5A                         DECB         ; IF NOT, DECREMENT BREAKPOINT COUNTER
971
0467 F9CF 26 F7                      BNE  FNDBP   ; AND LOOK FOR NEXT POSSIBLE MATCH
972
0468 F9D1 39                         RTS          ;
973
0469                         *
974
0470                         *
975
0471 F9D2 31 3D              BPADJ   LEAY -3,Y    ; MOVE POINTER TO BEGIN OF BP ENTRY
976
0472 F9D4 39                         RTS
977
0473                         *
978
0474                                 IFD TRAOPT
979
0475                         *
980
0476                         ** TRACE from address AAAA BB bytes
981
0477                         *
982
0478                         TRACE   LBSR ALTPC1  ; SET UP NEW PC
983
0479                                 BVS  TREXIT  ; ADDRESS ERROR, EXIT
984
0480                                 LBSR OUT1S
985
0481                                 LBSR IN1ADR  ; Fetch Byte Count
986
0482                                 BVS TREXIT   ; Byte Count error, EXIT
987
0483                                 STX TRACNT
988
0484                         *
989
0485                                 LDX NMI      ; Save NMI Vector
990
0486                                 STX NMISAV
991
0487                                 LDX #NMIE    ; Set up NMI for Tracing
992
0488                                 STX NMI
993
0489                                 LBSR TRAINZ  ; Initialise Hardware
994
0490                                 BRA TRACEG   ; Start Trace
995
0491                         TREXIT  RTS
996
0492                         *
997
0493                         * CRA0 = 0 CA1 IRQ DISAB, CRA0 = 1 CA1 IRQ ENAB
998
0494                         * CRA1 = 1 CA1 Rising edge IRQ
999
0495                         * CRA2 = 0 TADATA = Data Direction, CRA2 = 1 TADATA = I/O Register
1000
0496                         * CRA3 = 0 CA2 = 0 output, CRA3 = 1 CA2 = 1
1001
0497                         * CRA4 = 1 ] CA2 = Set/Reset output
1002
0498                         * CRA5 = 1 ]
1003
0499                         * CRA6 = X CA2 Input Interrupt Flag
1004
0500                         * CRA7 = X CA1 Interrupt Flag
1005
0501                         *
1006
0502                         * CRB0 = 0 CB1 IRQ DISAB, CRB0 = 1 CA1 IRQ ENAB
1007
0503                         * CRB1 = 1 CB1 Rising edge IRQ
1008
0504                         * CRB2 = 0 TBDATA = Data Direction, CRB2 = 1 TBDATA = I/O Register
1009
0505                         * CRB3 = 0 CB2 = 0 output, CRB3 = 1 CB2 = 1
1010
0506                         * CRB4 = 1 ] CB2 = Set/Reset output
1011
0507                         * CRB5 = 1 ]
1012
0508                         * CRB6 = X CB2 Input Interrupt Flag
1013
0509                         * CRB7 = X CB1 Interrupt Flag
1014
0510                         *
1015
0511                         *
1016
0512                         ** TRACE NMI ENTRY POINT
1017
0513                         *
1018
0514                         NMIE    TFR  S,U
1019
0515                                 LDA  #$36    ; Disable Interrupt, CA2 Low
1020
0516                                 STA  TACTRL
1021
0517                                 LDA  TADATA  ; Clear Interrupt flag by reading data port
1022
0518                         *
1023
0519                                 LBSR REGSTR  ; DUMP REGISTERS
1024
0520                         *
1025
0521                                 LDX  10,U    ; TEST IF NEXT INSTRUCTION IS A SWI
1026
0522                                 LDA  ,X
1027
0523                                 CMPA #$3F
1028
0524                                 BEQ  TRACEX  ; EXIT ON SWI
1029
0525                         *
1030
0526                                 LDX  TRACNT  ; CHECK IF TRACE COUNT EXPIRED
1031
0527                                 BEQ  TRACEX  ; YES, GO BACK TO THE MONITOR
1032
0528                                 LEAX -1,X    ; ECREMENT TRACE COUNT
1033
0529                                 STX  TRACNT
1034
0530                         *
1035
0531                         **  TRACE GO (RESUME SINGLE STEP)
1036
0532                         *
1037
0533                         TRACEG  TFR  U,S     ; SET UP PROGRAM STACK POINTER
1038
0534                                 LDA  #TRADEL ; SET UP TIMER DELAY (NUMB CYCLES FOR RTI+1)
1039
0535                                 STA  TADATA
1040
0536                                 LDA  #$36    ; LOAD STROBE LOW
1041
0537                                 STA  TACTRL
1042
0538                                 LDA  TADATA  ; CLEAR INTERRUPT
1043
0539                                 LDA  #$36    ; RELEASE RESET
1044
0540                                 STA  TBCTRL
1045
0541                                 LDA  #$3F    ; RELEASE LOAD, ENABLE CA1 NMI, CA1 RISING EDGE
1046
0542                                 STA  TACTRL
1047
0543                                 RTI          ; GO EXECUTE INSTRUCTION
1048
0544                         *
1049
0545                         TRACEX  LDX NMISAV   ; Restore NMI vector
1050
0546                                 STX NMI
1051
0547                                 LBRA NEXTCMD ; Jump back to the command loop.
1052
0548                         *
1053
0549                         ** TRACE HARDWARE INITIALISATION
1054
0550                         *
1055
0551                         TRAINZ  LDA #$32     ; SELECT DDRA, CA2 LOW, NMI DISABLED
1056
0552                                 STA TACTRL
1057
0553                                 LDA #$3A     ; SELECT DDRB, CB2 HIGH, FIRQ DISABLED
1058
0554                                 STA TBCTRL
1059
0555                                 LDA #$FF     ; PORTA = OUTPUT
1060
0556                                 STA TADATA
1061
0557                                 LDA #$00     ; PORTB = INPUT
1062
0558                                 STA TBDATA
1063
0559                                 LDA #$36     ; SELECT OUTPUT REGISTER A, CA2 LOW
1064
0560                                 STA TACTRL
1065
0561                                 LDA #$3E     ; SELECT OUTPUT REGISTER B, CB2 HIGH
1066
0562                                 STA TBCTRL
1067
0563                                 RTS
1068
0564                         *
1069
0565                                 ENDIF TRAOPT
1070
0565                                 ENDIF TRAOPT
1071
0566                                 IFD  MFDCOPT
1072
0567                         *
1073
0568                         ** "U" MINI DISK BOOT
1074
0569                         *
1075
0570                         MINBOOT TST  CMDFDC
1076
0571                                 CLR  DRVFDC
1077
0572                                 LDX  #$0000
1078
0573                         LOOP    LEAX $01,X
1079
0574                                 CMPX #$0000
1080
0575                                 BNE  LOOP
1081
0576                                 LDA  #$0F
1082
0577                                 STA  CMDFDC
1083
0578                                 BSR  DELAY
1084
0579                         LOOP1   LDB  CMDFDC
1085
0580                                 BITB #$01
1086
0581                                 BNE  LOOP1
1087
0582                                 LDA  #$01
1088
0583                                 STA  SECFDC
1089
0584                                 BSR  DELAY
1090
0585                                 LDA  #$8C
1091
0586                                 STA  CMDFDC
1092
0587                                 BSR  DELAY
1093
0588                                 LDX  #$C000
1094
0589                                 BRA  LOOP3
1095
0590                         LOOP2   BITB #$02
1096
0591                                 BEQ  LOOP3
1097
0592                                 LDA  DATFDC
1098
0593                                 STA ,X+
1099
0594                         LOOP3   LDB  CMDFDC
1100
0595                                 BITB #$01
1101
0596                                 BNE  LOOP2
1102
0597                                 BITB #$2C
1103
0598                                 BEQ  LOOP4
1104
0599                                 RTS
1105
0600                         *
1106
0601                         LOOP4   LDX  #$C000
1107
0602                                 STX  $0A,U
1108
0603                                 TFR  U,S
1109
0604                                 RTI
1110
0605                         *
1111
0606                         DELAY   LDB  #$04
1112
0607                         LOOP5   DECB
1113
0608                                 BNE  LOOP5
1114
0609                                 RTS
1115
0610                                 ENDIF MFDCOPT
1116
0610                                 ENDIF MFDCOPT
1117
0611                         *
1118
0612                                 IFD  DMAFOPT
1119
0613                         *
1120
0614                         *** "D" DISK BOOT FOR DMAF2 ***
1121
0615                         *
1122
0616                         DBOOT   LDA  #$DE
1123
0617                                 STA  DRVREG
1124
0618                                 LDA  #$FF
1125
0619                                 STA  PRIREG  ; $FAF8
1126
0620                                 STA  CCREG
1127
0621                                 STA  AAAREG
1128
0622                                 STA  BBBREG
1129
0623                                 TST  CCREG
1130
0624                                 LDA  #$D8
1131
0625                                 STA  COMREG
1132
0626                                 LBSR DLY
1133
0627                         DBOOT0  LDA  COMREG
1134
0628                                 BMI  DBOOT0
1135
0629                                 LDA  #$09
1136
0630                                 STA  COMREG
1137
0631                                 LBSR DLY
1138
0632                         *
1139
0633                         DISKWT  LDA  COMREG  ; FETCH DRIVE STATUS
1140
0634                                 BITA #1      ; TEST BUSY BIT
1141
0635                                 BNE  DISKWT  ; LOOP UNTIL NOT BUSY
1142
0636                         *
1143
0637                                 BITA #$10
1144
0638                                 BNE  DBOOT
1145
0639                         *
1146
0640                                 LDX  #$C000  ; LOGICAL ADDR. = $C000
1147
0641                                 BSR LRA      ; GET 20 BIT PHYSICAL ADDR. OF LOG. ADDR.
1148
0642                                 ORA  #$10
1149
0643                                 STA  CCCREG
1150
0644                                 TFR  X,D
1151
0645                                 COMA  ;
1152
0646                                 COMB  ;
1153
0647                                 STD  ADDREG
1154
0648                                 LDX  #$FEFF  ; LOAD DMA BYTE COUNT = $100
1155
0649                                 STX  CNTREG  ; STORE IN COUNT REGISTER
1156
0650                                 LDA  #$FF    ; LOAD THE CHANNEL REGISTER
1157
0651                                 STA  CCREG
1158
0652                                 LDA  #$FE    ; SET CHANNEL 0
1159
0653                                 STA  PRIREG
1160
0654                                 LDA  #1      ; SET SECTOR TO "1"
1161
0655                                 STA  SECREG  ; ISSUE COMMAND
1162
0656                                 LDA  #$8C    ; SET SINGLE SECTOR READ
1163
0657                                 STA  COMREG  ; ISSUE COMMAND
1164
0658                                 BSR  DLY
1165
0659                         *
1166
0660                         * THE FOLLOWING CODE TESTS THE STATUS OF THE
1167
0661                         * CHANNEL CONTROL REGISTER. IF "D7" IS NOT
1168
0662                         * ZERO THEN IT WILL LOOP WAITING FOR "D7"
1169
0663                         * TO GO TO ZERO. IF AFTER 65,536 TRIES IT
1170
0664                         * IS STILL A ONE THE BOOT OPERATION WILL
1171
0665                         * BE STARTED OVER FROM THE BEGINING.
1172
0666                         *
1173
0667                                 CLRB         ;
1174
0668                         DBOOT1  PSHS B       ; $FB55
1175
0669                                 CLRB         ;
1176
0670                         DBOOT2  TST  CCREG
1177
0671                                 BPL  DBOOT3
1178
0672                                 DECB  ;
1179
0673                                 BNE  DBOOT2
1180
0674                                 PULS B
1181
0675                                 DECB
1182
0676                                 BNE  DBOOT1
1183
0677                                 BRA  DBOOT
1184
0678                         DBOOT3  PULS B
1185
0679                                 LDA  COMREG
1186
0680                                 BITA #$1C
1187
0681                                 BEQ  DBOOT4
1188
0682                                 RTS  ;
1189
0683                         *
1190
0684                         *
1191
0685                         DBOOT4  LDB  #$DE
1192
0686                                 STB  DRVREG
1193
0687                                 LDX  #$C000
1194
0688                                 STX  10,U
1195
0689                                 TFR  U,S     ; $FB7B
1196
0690                                 RTI  ;
1197
0691                                 ENDIF DMAFOPT
1198
0691                                 ENDIF DMAFOPT
1199
0692                         *
1200
0693                                 IFD CF8OPT
1201
0694                         *
1202
0695                         * COMPACT FLASH BOOT
1203
0696                         *
1204
0697 F9D5 8D 40              CFBOOT  BSR  WAITRDY
1205
0698 F9D7 86 E0                      LDA  #HEADLBA
1206
0699 F9D9 B7 E0 46                   STA  CF_HEAD
1207
0700 F9DC 8D 39                      BSR  WAITRDY
1208
0701 F9DE 86 01                      LDA  #FEAT8BIT
1209
0702 F9E0 B7 E0 41                   STA  CF_FEATURE
1210
0703 F9E3 86 EF                      LDA  #CMDFEATURE
1211
0704 F9E5 B7 E0 47                   STA  CF_COMAND
1212
0705 F9E8 8D 2D                      BSR  WAITRDY
1213
0706                         *
1214
0707                         * READ SECTORS FROM CF
1215
0708                         *
1216
0709 F9EA 86 01              CFREAD  LDA  #$01
1217
0710 F9EC B7 E0 42                   STA  CF_SECCNT
1218
0711 F9EF 4F                         CLRA
1219
0712 F9F0 B7 E0 43                   STA  CF_SECNUM
1220
0713 F9F3 B7 E0 44                   STA  CF_CYLLO
1221
0714 F9F6 B7 E0 45                   STA  CF_CYLHI
1222
0715                         *
1223
0716 F9F9 86 20                      LDA  #CMDREAD ; IDE READ MULTIPLE
1224
0717 F9FB B7 E0 47                   STA  CF_COMAND
1225
0718 F9FE 8D 17                      BSR  WAITRDY
1226
0719 FA00 8E C0 00                   LDX  #$C000
1227
0720                         *
1228
0721                         * READ LOOP
1229
0722                         *
1230
0723 FA03 8D 21              RDLOOP  BSR  WAITDRQ
1231
0724 FA05 B6 E0 40                   LDA  CF_DATA
1232
0725 FA08 A7 80                      STA  ,X+
1233
0726 FA0A 8C C2 00                   CMPX #$C200
1234
0727 FA0D 26 F4                      BNE  RDLOOP
1235
0728                         *
1236
0729 FA0F 8E C0 00                   LDX  #$C000
1237
0730 FA12 AF 4A                      STX  $0A,U
1238
0731 FA14 1F 34                      TFR  U,S
1239
0732 FA16 3B                         RTI
1240
0733                         *
1241
0734                         * WAIT UNTIL READY
1242
0735                         *
1243
0736 FA17 B6 E0 47           WAITRDY LDA  CF_STATUS
1244
0737 FA1A 85 80                      BITA #BUSY
1245
0738 FA1C 26 F9                      BNE  WAITRDY
1246
0739 FA1E B6 E0 47                   LDA  CF_STATUS
1247
0740 FA21 85 40                      BITA #DRDY
1248
0741 FA23 27 F2                      BEQ  WAITRDY
1249
0742 FA25 39                         RTS
1250
0743                         *
1251
0744                         * WAIT FOR DATA REQUEST
1252
0745                         *
1253
0746 FA26 B6 E0 47           WAITDRQ LDA  CF_STATUS
1254
0747 FA29 85 08                      BITA #DRQ
1255
0748 FA2B 27 F9                      BEQ  WAITDRQ
1256
0749 FA2D 39                         RTS
1257
0750                                 ENDIF CF8OPT
1258
0751                         *
1259
0752                                 IFD IDEOPT
1260
0753                         *
1261
0754                         * XESS 16 BIT IDE BOOT
1262
0755                         *
1263
0756                         IDEBOOT LDD  #AUXRESET
1264
0757                                 STD  CF_AUX
1265
0758                                 LDD #AUXRSTREL
1266
0759                                 STD CF_AUX
1267
0760                                 LDD  #HEADLBA
1268
0761                                 STD  CF_HEAD
1269
0762                                 BSR  WAITRDY
1270
0763                         *
1271
0764                         * READ SECTORS FROM CF
1272
0765                         *
1273
0766                                 LDD  #$01
1274
0767                                 STD  CF_SECCNT
1275
0768                                 CLRB
1276
0769                                 STD  CF_SECNUM
1277
0770                                 STD  CF_CYLLO
1278
0771                                 STD  CF_CYLHI
1279
0772                         *
1280
0773                                 LDB  #CMDREAD ; IDE READ MULTIPLE
1281
0774                                 STD  CF_COMAND
1282
0775                                 BSR  WAITRDY
1283
0776                                 LDX  #$C000
1284
0777                         *
1285
0778                         * READ LOOP
1286
0779                         *
1287
0780                         RDLOOP  BSR  WAITDRQ
1288
0781                                 LDD  CF_DATA
1289
0782                                 STB  ,X+
1290
0783                                 CMPX #$C100
1291
0784                                 BNE  RDLOOP
1292
0785                         *
1293
0786                                 LDX  #$C000
1294
0787                                 STX  $0A,U
1295
0788                                 TFR  U,S
1296
0789                                 RTI
1297
0790                         *
1298
0791                         * WAIT UNTIL READY
1299
0792                         *
1300
0793                         WAITRDY LDD  CF_STATUS
1301
0794                                 BITB #BUSY
1302
0795                                 BNE  WAITRDY
1303
0796                                 LDD  CF_STATUS
1304
0797                                 BITB #DRDY
1305
0798                                 BEQ  WAITRDY
1306
0799                                 RTS
1307
0800                         *
1308
0801                         * WAIT FOR DATA REQUEST
1309
0802                         *
1310
0803                         WAITDRQ LDD  CF_STATUS
1311
0804                                 BITB #DRQ
1312
0805                                 BEQ  WAITDRQ
1313
0806                                 RTS
1314
0807                                 ENDIF IDEOPT
1315
0807                                 ENDIF IDEOPT
1316
0808                         *
1317
0809                                 IFD RTCOPT
1318
0810                         *
1319
0811                         * CLOCK INTER FACE UTILITY
1320
0812                         *
1321
0813                         * TIME   
1322
0814                         * If no argument is specified, the current time
1323
0815                         * will be displayed.
1324
0816                         *
1325
0817                         * READ A REGISTER FROM THE COUNTER.
1326
0818                         * The X Index rgister points to the register
1327
0819                         * to be read. The Status Register is checked
1328
0820                         * before and after the register is read before
1329
0821                         * returning a value in accumulator A
1330
0822                         *
1331
0823                         RDCLK  TST CLKSTA
1332
0824                                BNE RDCLK
1333
0825                         RDCLK1 LDA 0,X
1334
0826                                TST CLKSTA
1335
0827                                BNE RDCLK1
1336
0828                                RTS
1337
0829                         *
1338
0830                         * MAIN PROGRAM:
1339
0831                         *
1340
0832                         TIMSET LDX #COUNTR    ; POINT TO TIMER
1341
0833                               LBSR BYTE       ; READ HOURS
1342
0834                               BVS  SHOWTM     ; NO ARG, DISP TIME
1343
0835                               STA HOUR,X
1344
0836                               LBSR OUT1S
1345
0837                               LBSR BYTE       ; READ MINUITES
1346
0838                               BVS  SHOWTM
1347
0839                               STA MINUIT,X
1348
0840                               LBSR OUT1S
1349
0841                               LBSR BYTE       ; SECONDS.
1350
0842                               BVS SHOWTM
1351
0843                               STA SECOND,X
1352
0844                         *
1353
0845                         * DISPLAY CURRENT TIME
1354
0846                         *
1355
0847                         SHOWTM LBSR PCRLF
1356
0848                                LDX #COUNTR+HOUR
1357
0849                                LDB #3
1358
0850                         SHOWLP BSR RDCLK
1359
0851                                LBSR OUT2H
1360
0852                                LDA #':
1361
0853                                LBSR OUTCH
1362
0854                                LEAX -1,X
1363
0855                                DECB
1364
0856                                BNE SHOWLP
1365
0857                                RTS
1366
0858                         *
1367
0859                         * INITIATE CLOCK.
1368
0860                         * MASK INTERRUPTS.
1369
0861                         *
1370
0862                         CLKINZ CLR CINTCR     ; MASK ALL INTERRUPTS
1371
0863                                TST CINTSR     ; CLEAR ANY INTERRUPTS
1372
0864                                RTS
1373
0865                                ENDIF RTCOPT
1374
0865                                ENDIF RTCOPT
1375
0866                                IFD DATOPT
1376
0867                         *
1377
0868                         ***** LRA LOAD REAL ADDRESS *****
1378
0869                         *
1379
0870                         * THE FOLLOWING CODE LOADS THE 20-BIT
1380
0871                         * PHYSICAL ADDRESS OF A MEMORY BYTE
1381
0872                         * INTO THE "A" AND "X" REGISTERS. THIS
1382
0873                         * ROUTINE IS ENTERED WITH THE LOGICAL
1383
0874                         * ADDRESS OF A MEMORY BYTE IN THE "IX"
1384
0875                         * REGISTER. EXIT IS MADE WITH THE HIGH-
1385
0876                         * ORDER FOUR BITS OF THE 20-BIT PHYSICAL
1386
0877                         * ADDRESS IN THE "A" REGISTER, AND THE
1387
0878                         * LOW-ORDER 16-BITS OF THE 20-BIT
1388
0879                         * PHYSICAL ADDRESS IN THE "IX" REGISTER.
1389
0880                         * ALL OTHER REGISTERS ARE PRESERVED.
1390
0881                         * THIS ROUTINE IS REQUIRED SINCE THE
1391
0882                         * DMAF1 AND DMAF2 DISK CONTROLLERS MUST
1392
0883                         * PRESENT PHYSICAL ADDRESSES ON THE
1393
0884                         * SYSTEM BUS.
1394
0885                         *
1395
0886 FA2E 34 36              LRA     PSHS A,B,X,Y  ; PUSH REGISTERS ON STACK
1396
0887 FA30 A6 62                      LDA  2,S      ; GET MSB LOGICAL ADDR FRM X REG ON STACK
1397
0888 FA32 44                         LSRA          ;
1398
0889 FA33 44                         LSRA          ; ADJ FOR INDEXED INTO
1399
0890 FA34 44                         LSRA          ; CORRESPONDING LOCATION
1400
0891 FA35 44                         LSRA          ; IN LRA TABLE
1401
0892 FA36 10 8E DF D0                LDY  #LRARAM  ; LOAD LRA TABLE BASE ADDRESS
1402
0893 FA3A E6 A6                      LDB  A,Y      ; GET PHYSICAL ADDR. DATA FROM LRA TABLE
1403
0894 FA3C 54                         LSRB          ; ADJ. REAL ADDR. TO REFLECT EXTENDED
1404
0895 FA3D 54                         LSRB          ; PHYSICAL ADDRESS.
1405
0896 FA3E 54                         LSRB          ; EXTENDED MS 4-BITS ARE RETURNED
1406
0897 FA3F 54                         LSRB          ; IN THE "A" ACCUMULATOR
1407
0898 FA40 E7 E4                      STB  ,S       ; MS 4 BITS IN A ACCUM. STORED ON STACK
1408
0899 FA42 E6 A6                      LDB  A,Y      ; LOAD REAL ADDRESS DATA FROM LRA TABLE
1409
0900 FA44 53                         COMB          ; COMP TO ADJ FOR PHYSICAL ADDR. IN X REG
1410
0901 FA45 58                         ASLB          ; ADJ DATA FOR RELOCATION IN X REG
1411
0902 FA46 58                         ASLB          ;
1412
0903 FA47 58                         ASLB          ; $FB97
1413
0904 FA48 58                         ASLB          ;
1414
0905 FA49 A6 62                      LDA  2,S      ; GET MS BYTE OF LOGICAL ADDR.
1415
0906 FA4B 84 0F                      ANDA #$0F     ; MASK MS NIBBLE OF LOGICAL ADDRESS
1416
0907 FA4D A7 62                      STA  2,S      ; SAVE IT IN X REG ON STACK
1417
0908 FA4F EA 62                      ORB  2,S      ; SET MS BYTE IN X REG TO ADJ PHY ADDR.
1418
0909                         *
1419
0910                         * PLUS LS NIBBLE OF LOGICAL ADDRESS
1420
0911                         *
1421
0912 FA51 E7 62                      STB  2,S      ; SAVE AS LS 16 BITS OF PHY ADDR IN X REG ON STACK
1422
0913 FA53 35 B6                      PULS A,B,X,Y,PC ; POP REGS. FROM STACK
1423
0914                                 ENDIF DATOPT
1424
0915                         *
1425
0916                         * DELAY LOOP
1426
0917                         *
1427
0918 FA55 34 04              DLY     PSHS B        ; SAVE CONTENTS OF "B"
1428
0919 FA57 C6 20                      LDB  #$20     ; GET LOOP DELAY VALUE
1429
0920 FA59 5A                 SUB1    DECB          ; SUBTRACT ONE FROM VALUE
1430
0921 FA5A 26 FD                      BNE  SUB1     ; LOOP UNTIL ZERO
1431
0922 FA5C 35 84                      PULS B,PC     ; RESTORE CONTENTS OF "B"
1432
0923                         * RTS  ;
1433
0924                         *
1434
0925                         ***** "L" LOAD MIKBUG TAPE *****
1435
0926                         *
1436
0927 FA5E BD FC E7           LOAD    JSR  ACINIZ
1437
0928 FA61 86 11                      LDA  #$11     ; LOAD 'DC1' CASS. READ ON CODE
1438
0929 FA63 17 02 68                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL PORT
1439
0930 FA66 7F DF E2                   CLR  ECHO     ; TURN OFF ECHO FLAG
1440
0931 FA69 17 02 2A           LOAD1   LBSR ECHON    ; INPUT 8 BIT BYTE WITH NO ECHO
1441
0932 FA6C 81 53              LOAD2   CMPA #'S      ; IS IT AN "S", START CHARACTER ?
1442
0933 FA6E 26 F9                      BNE  LOAD1    ; IF NOT, DISCARD AND GET NEXT CHAR.
1443
0934 FA70 17 02 23                   LBSR ECHON
1444
0935 FA73 81 39                      CMPA #'9      ; IS IT A "9" , END OF FILE CHAR ?
1445
0936 FA75 27 3D                      BEQ  LOAD21   ; IF SO, EXIT LOAD
1446
0937 FA77 81 31                      CMPA #'1      ; IS IT A "1" , FILE LOAD CHAR ?
1447
0938 FA79 26 F1                      BNE  LOAD2    ; IF NOT, LOOK FOR START CHAR.
1448
0939 FA7B 17 01 A8                   LBSR BYTE     ; INPUT BYTE COUNT
1449
0940 FA7E 34 02                      PSHS A        ; PUSH COUNT ON STACK
1450
0941 FA80 29 26                      BVS  LODERR   ; (V) C-CODE SET, ILLEGAL HEX
1451
0942 FA82 17 01 91                   LBSR IN1ADR   ; INPUT LOAD ADDRESS
1452
0943 FA85 29 21                      BVS  LODERR   ; (V) C-CODE SET, ADDR NOT HEX
1453
0944 FA87 34 10                      PSHS X        ; PUSH ADDR ON STACK
1454
0945 FA89 E6 E0                      LDB  ,S+      ; LOAD MSB OF ADDR AS CHECKSUM BYTE
1455
0946 FA8B EB E0                      ADDB ,S+      ; ADD LSB OF ADDR TO CHECKSUM
1456
0947 FA8D EB E4                      ADDB ,S       ; ADD BYTE COUNT BYTE TO CHECKSUM
1457
0948 FA8F 6A E4                      DEC  ,S       ; $FC37 DECREMENT BYTE COUNT 2 TO BYPASS
1458
0949 FA91 6A E4                      DEC  ,S       ; ADDRESS BYTES.
1459
0950 FA93 34 04              LOAD10  PSHS B        ; PUSH CHECKSUM ON STACK
1460
0951 FA95 17 01 8E                   LBSR BYTE     ; INPUT DATA BYTE (2 HEX CHAR)
1461
0952 FA98 35 04                      PULS B        ; POP CHECKSUM FROM STACK
1462
0953 FA9A 29 0C                      BVS  LODERR   ; (V) SET, DATA BYTE NOT HEX
1463
0954 FA9C 34 02                      PSHS A        ; PUSH DATA BYTE ON STACK
1464
0955 FA9E EB E0                      ADDB ,S+      ; ADD DATA TO CHECKSUM, AUTO INC STACK
1465
0956 FAA0 6A E4                      DEC  ,S       ; DECREMENT BYTE COUNT 1
1466
0957 FAA2 27 05                      BEQ  LOAD16   ; IF BYTE COUNT ZERO, TEST CHECKSUM
1467
0958 FAA4 A7 80                      STA  ,X+      ; SAVE DATA BYTE IN MEMORY
1468
0959 FAA6 20 EB                      BRA  LOAD10   ; GET NEXT DATA BYTE
1469
0960 FAA8 5F                 LODERR  CLRB          ; ERROR CONDITION, ZERO CHECKSUM  ;
1470
0961 FAA9 35 02              LOAD16  PULS A        ; ADJUST STACK (REMOVE BYTE COUNT)
1471
0962 FAAB C1 FF                      CMPB #$FF     ; CHECKSUM OK?
1472
0963 FAAD 27 BA                      BEQ  LOAD1    ; IF SO, LOAD NEXT LINE
1473
0964 FAAF 86 3F                      LDA  #'?      ; LOAD (?) ERROR INDICATOR
1474
0965 FAB1 17 02 1A                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL
1475
0966 FAB4 73 DF E2           LOAD21  COM  ECHO     ; TURN ECHO ON
1476
0967 FAB7 86 13                      LDA  #$13     ; $FC5F LOAD 'DC3' CASS. READ OFF CODE
1477
0968 FAB9 16 02 12                   LBRA OUTCH    ; OUTPUT IT
1478
0969                         *
1479
0970                         ***** "P" PUNCH MIKBUG TAPE *****
1480
0971                         *
1481
0972 FABC 6F E2              PUNCH   CLR  ,-S      ; CLEAR RESERVED BYTE ON STACK
1482
0973 FABE 17 01 4A                   LBSR IN2ADR   ; GET BEGIN AND END ADDRESS
1483
0974 FAC1 34 30                      PSHS X,Y      ; SAVE ADDRESSES ON STACK
1484
0975 FAC3 29 4D                      BVS  PUNEXT   ; (V) C-CODE SET, EXIT PUNCH
1485
0976 FAC5 AC 62                      CMPX 2,S      ; COMPARE BEGIN TO END ADDR
1486
0977 FAC7 25 49                      BCS  PUNEXT   ; IF BEGIN GREATER THAN END, EXIT PUNCH
1487
0978 FAC9 30 01                      LEAX 1,X      ; INCREMENT END ADDRESS
1488
0979 FACB AF E4                      STX  ,S       ; STORE END ADDR ON STACK
1489
0980 FACD BD FC E7                   JSR  ACINIZ
1490
0981 FAD0 86 12                      LDA  #$12     ; LOAD 'DC2' PUNCH ON CODE
1491
0982 FAD2 17 01 F9                   LBSR OUTCH    ; OUTPUT IT TO TERMINAL
1492
0983 FAD5 EC E4              PUNCH2  LDD  ,S       ; LOAD END ADDR IN D-ACC
1493
0984 FAD7 A3 62                      SUBD 2,S      ; SUBTRACT BEGIN FROM END
1494
0985 FAD9 27 06                      BEQ  PUNCH3   ; SAME, PUNCH 32 BYTES DEFAULT
1495
0986 FADB 10 83 00 20                CMPD #$20     ; LESS THAN 32 BYTES?
1496
0987 FADF 23 02                      BLS  PUNCH4   ; PUNCH THAT MANY BYTES
1497
0988 FAE1 C6 20              PUNCH3  LDB  #$20     ; LOAD BYTE COUNT OF 32.
1498
0989 FAE3 E7 64              PUNCH4  STB  4,S      ; STORE ON STACK AS BYTE COUNT
1499
0990 FAE5 8E FE E2                   LDX  #MSG20   ; POINT TO MSG "S1"
1500
0991 FAE8 17 00 2F                   LBSR PSTRNG   ; PRINT MSG
1501
0992 FAEB CB 03                      ADDB #3       ; ADD 3 BYTES TO BYTE COUNT
1502
0993 FAED 1F 98                      TFR  B,A      ; GET BYTE COUNT IN A-ACC TO PUNCH
1503
0994 FAEF 17 01 75                   LBSR OUT2H    ; OUTPUT BYTE COUNT
1504
0995 FAF2 AE 62                      LDX  2,S      ; LOAD BEGIN ADDRESS
1505
0996 FAF4 17 01 68                   LBSR OUT4H    ; PUNCH ADDRESS
1506
0997 FAF7 EB 62                      ADDB 2,S      ; ADD ADDR MSB TO CHECKSUM
1507
0998 FAF9 EB 63                      ADDB 3,S      ; ADD ADDR LSB TO CHECKSUM
1508
0999 FAFB EB 84              PUNCHL  ADDB ,X       ; ADD DATA BYTE TO CHECKSUM
1509
1000 FAFD A6 80                      LDA  ,X+      ; LOAD DATA BYTE TO PUNCH
1510
1001 FAFF 17 01 65                   LBSR OUT2H    ; OUTPUT DATA BYTE
1511
1002 FB02 6A 64                      DEC  4,S      ; DECREMENT BYTE COUNT
1512
1003 FB04 26 F5                      BNE  PUNCHL   ; NOT DONE, PUNCH NEXT BYTE
1513
1004 FB06 53                         COMB  1's     ; COMPLIMENT CHECKSUM BYTE
1514
1005 FB07 1F 98                      TFR  B,A      ; GET IT IN A-ACC TO PUNCH
1515
1006 FB09 17 01 5B                   LBSR OUT2H    ; OUTPUT CHECKSUM BYTE
1516
1007 FB0C AF 62                      STX  2,S      ; SAVE X-REG IN STACK AS NEW PUNCH ADDR
1517
1008 FB0E AC E4                      CMPX ,S       ; COMPARE IT TO END ADDR
1518
1009 FB10 26 C3                      BNE  PUNCH2   ; $FCB5 PUNCH NOT DONE, CONT.
1519
1010 FB12 86 14              PUNEXT  LDA  #$14     ; LOAD 'DC4' PUNCH OFF CODE
1520
1011 FB14 17 01 B7                   LBSR OUTCH    ; OUTPUT IT
1521
1012 FB17 32 65                      LEAS 5,S      ; READJUST STACK POINTER
1522
1013 FB19 39                         RTS  ;
1523
1014                         *
1524
1015                         * PRINT STRING PRECEEDED BY A CR & LF.
1525
1016                         *
1526
1017 FB1A 8D 02              PSTRNG  BSR  PCRLF    ; PRINT CR/LF
1527
1018 FB1C 20 71                      BRA  PDATA    ; PRINT STRING POINTED TO BY IX
1528
1019                         *
1529
1020                         * PCRLF
1530
1021                         *
1531
1022 FB1E 34 10              PCRLF   PSHS X        ; SAVE IX
1532
1023 FB20 8E FE 93                   LDX  #MSG2+1  ; POINT TO MSG CR/LF + 3 NULS
1533
1024 FB23 17 00 69                   LBSR PDATA    ; PRINT MSG
1534
1025 FB26 35 90                      PULS X,PC     ; RESTORE IX & RETURN
1535
1026                         *
1536
1027                         * LONG BRANCHES TO COMMON ROUTINES
1537
1028                         *
1538
1029 FB28 16 01 A1           JOUT1S  LBRA OUT1S
1539
1030 FB2B 16 00 F8           JBYTE   LBRA BYTE
1540
1031 FB2E 16 00 E5           JIN1ADR LBRA IN1ADR
1541
1032                         *
1542
1033                         * ALTER "PC" PROGRAM COUNTER
1543
1034                         *
1544
1035 FB31 17 00 91           ALTRPC  LBSR  PRTPC   ; $FCF5 PRINT MSG " PC = "
1545
1036 FB34 8D F2              ALTPC1  BSR  JOUT1S   ; OUTPUT SPACE
1546
1037 FB36 8D F6                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "PC"
1547
1038 FB38 29 02                      BVS  ALTPCD   ; EXIT IF INVALID HEX
1548
1039 FB3A AF 4A                      STX  10,U     ; POKE IN NEW CONTENTS
1549
1040 FB3C 39                 ALTPCD  RTS           ;
1550
1041                         *
1551
1042                         * ALTER "U" USER STACK POINTER
1552
1043                         *
1553
1044 FB3D 8D 61              ALTRU   BSR  PRTUS    ; $FCCA PRINT MSG " US = "
1554
1045 FB3F 8D E7                      BSR  JOUT1S   ; OUTPUT SPACE
1555
1046 FB41 8D EB                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "US"
1556
1047 FB43 29 02                      BVS  ALTUD    ; EXIT IF INVALID HEX
1557
1048 FB45 AF 48                      STX  8,U      ; POKE IN NEW CONTENTS
1558
1049 FB47 39                 ALTUD   RTS           ;
1559
1050                         *
1560
1051                         * ALTER "Y" INDEX REGISTER
1561
1052                         *
1562
1053 FB48 8D 72              ALTRY   BSR  PRTIY    ; PRINT MSG " IY = "
1563
1054 FB4A 8D DC                      BSR  JOUT1S   ; OUTPUT SPACE
1564
1055 FB4C 8D E0                      BSR  JIN1ADR  ; GET NEW CONTENTS FOR "IY"
1565
1056 FB4E 29 02                      BVS  ALTYD    ; EXIT IF INVALID HEX
1566
1057 FB50 AF 46                      STX  6,U      ; $F8F0 POKE IN NEW CONTENTS
1567
1058 FB52 39                 ALTYD   RTS           ;
1568
1059                         *
1569
1060                         * ALTER "X" INDEX REGISTER
1570
1061                         *
1571
1062 FB53 8D 5E              ALTRX   BSR  PRTIX    ; $FCE0 PRINT MSG " IX = "
1572
1063 FB55 8D D1                      BSR  JOUT1S   ; OUTPUT SPACE
1573
1064 FB57 8D D5                      BSR  JIN1ADR
1574
1065 FB59 29 02                      BVS  ALTXD
1575
1066 FB5B AF 44                      STX  4,U
1576
1067 FB5D 39                 ALTXD   RTS ;
1577
1068                         *
1578
1069                         * ALTER "DP" DIRECT PAGE REGISTER
1579
1070                         *
1580
1071 FB5E 8D 49              ALTRDP  BSR  PRTDP    ; $FCD5 PRINT MSG " DP = "
1581
1072 FB60 8D C6                      BSR  JOUT1S   ; OUTPUT SPACE
1582
1073 FB62 8D C7                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
1583
1074 FB64 29 02                      BVS  ALTDPD
1584
1075 FB66 A7 43                      STA  3,U
1585
1076 FB68 39                 ALTDPD  RTS ;
1586
1077                         *
1587
1078                         * ALTER "B" ACCUMULATOR
1588
1079                         *
1589
1080 FB69 8D 6C              ALTRB   BSR  PRTB     ; $FD09 PRINT MSG " B = "
1590
1081 FB6B 8D BB                      BSR  JOUT1S   ; OUTPUT SPACE
1591
1082 FB6D 8D BC                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
1592
1083 FB6F 29 02                      BVS  ALTBD
1593
1084 FB71 A7 42                      STA  2,U
1594
1085 FB73 39                 ALTBD   RTS           ; $F91C
1595
1086                         *
1596
1087                         * ALTER "A" ACCUMULATOR
1597
1088                         *
1598
1089 FB74 8D 58              ALTRA   BSR  PRTA     ; $FCFF RINT MSG " A = "
1599
1090 FB76 8D B0                      BSR  JOUT1S   ; OUTPUT SPACE
1600
1091 FB78 8D B1                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
1601
1092 FB7A 29 02                      BVS  ALTAD
1602
1093 FB7C A7 41                      STA  1,U
1603
1094 FB7E 39                 ALTAD   RTS ;
1604
1095                         *
1605
1096                         * ALTER "CC" REGISTER
1606
1097                         *
1607
1098 FB7F 8D 5F              ALTRCC  BSR  PRTCC    ; $FD13 PRINT MSG " CC: "
1608
1099 FB81 8D A5                      BSR  JOUT1S   ; OUTPUT SPACE
1609
1100 FB83 8D A6                      BSR  JBYTE    ; INPUT BYTE (2 HEX CHAR)
1610
1101 FB85 29 04                      BVS  ALTCCD
1611
1102 FB87 8A 80                      ORA  #$80     ; SETS "E" FLAG IN PRINT LIST
1612
1103 FB89 A7 C4                      STA  ,U
1613
1104 FB8B 39                 ALTCCD  RTS ;
1614
1105                         *
1615
1106                         * PDATA
1616
1107                         *
1617
1108 FB8C 17 01 3F           PRINT   LBSR OUTCH
1618
1109 FB8F A6 80              PDATA   LDA  ,X+      ; GET 1st CHAR. TO PRINT
1619
1110 FB91 81 04                      CMPA #4       ; IS IT EOT?
1620
1111 FB93 26 F7                      BNE  PRINT    ; IF NOT EOT PRINT IT
1621
1112 FB95 39                         RTS  ;
1622
1113                         *
1623
1114                         * PRINT REGISTERS
1624
1115                         *
1625
1116 FB96 8E FE A5           PRTSP   LDX  #MSG10   ; POINT TO MSG "SP="
1626
1117 FB99 8D F4                      BSR  PDATA    ; PRINT MSG
1627
1118 FB9B 1F 31                      TFR  U,X
1628
1119 FB9D 16 00 BF           JOUT4H  LBRA OUT4H
1629
1120                         *
1630
1121 FBA0 8E FE B1           PRTUS   LDX  #MSG12   ; POINT TO MSG "US="
1631
1122 FBA3 8D EA                      BSR  PDATA    ; PRINT MSG
1632
1123 FBA5 AE 48                      LDX  8,U
1633
1124 FBA7 20 F4                      BRA  JOUT4H
1634
1125                         *
1635
1126 FBA9 8E FE C3           PRTDP   LDX   #MSG15  ; POINT TO MSG "DP="
1636
1127 FBAC 8D E1                      BSR  PDATA    ; PRINT MSG
1637
1128 FBAE A6 43                      LDA  3,U
1638
1129 FBB0 16 00 B4           JOUT2H  LBRA OUT2H    ; OUTPUT HEX BYTE AS ASCII
1639
1130                         *
1640
1131 FBB3 8E FE BD           PRTIX   LDX  #MSG14   ; POINT TO MSG "IX="
1641
1132 FBB6 8D D7                      BSR  PDATA    ; PRINT MSG
1642
1133 FBB8 AE 44                      LDX  4,U      ; $FCE6
1643
1134 FBBA 20 E1                      BRA  JOUT4H
1644
1135                         *
1645
1136 FBBC 8E FE B7           PRTIY   LDX  #MSG13   ; POINT TO MSG "IY="
1646
1137 FBBF 8D CE                      BSR  PDATA    ; PRINT MSG
1647
1138 FBC1 AE 46                      LDX  6,U
1648
1139 FBC3 20 D8                      BRA  JOUT4H
1649
1140                         *
1650
1141 FBC5 8E FE AB           PRTPC   LDX  #MSG11   ; POINT TO MSG "PC="
1651
1142 FBC8 8D C5                      BSR  PDATA    ; PRINT MSG
1652
1143 FBCA AE 4A                      LDX  10,U
1653
1144 FBCC 20 CF                      BRA  JOUT4H
1654
1145                         *
1655
1146 FBCE 8E FE C9           PRTA    LDX  #MSG16   ; POINT TO MSG "A="
1656
1147 FBD1 8D BC                      BSR  PDATA    ; PRINT MSG
1657
1148 FBD3 A6 41                      LDA  1,U
1658
1149 FBD5 20 D9                      BRA  JOUT2H   ; OUTPUT HEX BYTE AS ASCII
1659
1150                         *
1660
1151 FBD7 8E FE CE           PRTB    LDX  #MSG17   ; POINT TO MSG "B="
1661
1152 FBDA 8D B3                      BSR  PDATA    ; PRINT MSG
1662
1153 FBDC A6 42                      LDA  2,U
1663
1154 FBDE 20 D0                      BRA  JOUT2H   ; OUTPUT HEX BYTE AS ASCII
1664
1155                         *
1665
1156 FBE0 8E FE D3           PRTCC   LDX  #MSG18   ; POINT TO MSG "CC:"
1666
1157 FBE3 8D AA                      BSR  PDATA    ; PRINT MSG
1667
1158 FBE5 A6 C4                      LDA  ,U
1668
1159 FBE7 8E FE DA                   LDX  #MSG19   ; POINT TO MSG "EFHINZVC"
1669
1160 FBEA 16 00 90                   LBRA BIASCI   ; OUTPUT IN BINARY/ASCII FORMAT
1670
1161                         *
1671
1162                         * "R" DISPLAY REGISTERS
1672
1163                         *
1673
1164 FBED 8E FE A1           REGSTR  LDX  #MSG5    ; POINT TO MSG " - "
1674
1165 FBF0 17 FF 27                   LBSR PSTRNG   ; PRINT MSG
1675
1166 FBF3 8D A1                      BSR  PRTSP    ; $FCBF
1676
1167 FBF5 8D A9                      BSR  PRTUS    ; $FCCA
1677
1168 FBF7 8D B0                      BSR  PRTDP    ; $FCD5
1678
1169 FBF9 8D B8                      BSR  PRTIX    ; $FCE0
1679
1170 FBFB 8D BF                      BSR  PRTIY    ; $FCEB
1680
1171 FBFD 8E FE A1                   LDX  #MSG5    ; POINT TO MSG " - "
1681
1172 FC00 17 FF 17                   LBSR PSTRNG   ; PRINT MSG
1682
1173 FC03 8D C0                      BSR  PRTPC    ; $FCF5
1683
1174 FC05 8D C7                      BSR  PRTA     ; $FCFF
1684
1175 FC07 8D CE                      BSR  PRTB     ; $FD09
1685
1176 FC09 20 D5                      BRA  PRTCC    ; $FD13
1686
1177                         *
1687
1178                         * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
1688
1179                         * OPERATOR TO INPUT TWO VALID HEX ADDRESSES.
1689
1180                         * THE FIRST ADDRESS INPUT IS RETURNED IN "IY".
1690
1181                         * THE SECOND IS RETURNED IN "IX". THE "V" BIT
1691
1182                         * IN THE C-CODE REG. IS SET IF AN INVALID HEX
1692
1183                         * ADDRESS IS INPUT.
1693
1184                         *
1694
1185 FC0B 8D 09              IN2ADR  BSR  IN1ADR   ; GET FIRST ADDRESS
1695
1186 FC0D 29 4D                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
1696
1187 FC0F 1F 12                      TFR  X,Y      ; SAVE FIRST ADDR. IN "IY"
1697
1188 FC11 86 2D                      LDA  #'-
1698
1189 FC13 17 00 B8                   LBSR OUTCH    ; PRINT " - "
1699
1190                         *
1700
1191                         * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
1701
1192                         * OPERATOR TO INPUT ONE VALID HEX ADDRESS. THE
1702
1193                         * ADDRESS IS RETURNED IN THE "X" REGISTER.
1703
1194                         *
1704
1195 FC16 8D 0E              IN1ADR  BSR  BYTE     ; INPUT BYTE (2 HEX CHAR)
1705
1196 FC18 29 42                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
1706
1197 FC1A 1F 01                      TFR  D,X
1707
1198 FC1C 8D 08                      BSR  BYTE     ; INPUT BYTE (2 HEX CHAR)
1708
1199 FC1E 29 3C                      BVS  NOTHEX
1709
1200 FC20 34 10                      PSHS X
1710
1201 FC22 A7 61                      STA  1,S
1711
1202 FC24 35 90                      PULS X,PC
1712
1203                         *
1713
1204                         ***** INPUT BYTE (2 HEX CHAR.) *****
1714
1205                         *
1715
1206 FC26 8D 11              BYTE    BSR  INHEX    ; GET HEX LEFT
1716
1207 FC28 29 32                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
1717
1208 FC2A 48                         ASLA          ;
1718
1209 FC2B 48                         ASLA          ;
1719
1210 FC2C 48                         ASLA          ; SHIFT INTO LEFT NIBBLE
1720
1211 FC2D 48                         ASLA          ;
1721
1212 FC2E 1F 89                      TFR  A,B      ; PUT HEXL IN "B"
1722
1213 FC30 8D 07                      BSR  INHEX    ; GET HEX RIGHT
1723
1214 FC32 29 28                      BVS  NOTHEX   ; EXIT IF NOT VALID HEX
1724
1215 FC34 34 04                      PSHS B        ; PUSH HEXL ON STACK
1725
1216 FC36 AB E0                      ADDA ,S+      ; ADD HEXL TO HEXR AND ADJ. STK
1726
1217 FC38 39                         RTS           ; RETURN WITH HEX L&R IN "A"
1727
1218                         *
1728
1219                         *
1729
1220 FC39 8D 5B              INHEX   BSR  ECHON    ; INPUT ASCII CHAR.
1730
1221 FC3B 81 30                      CMPA #'0      ; IS IT > OR = "0" ?
1731
1222 FC3D 25 1D                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
1732
1223 FC3F 81 39                      CMPA #'9      ; IS IT < OR = "9" ?
1733
1224 FC41 22 03                      BHI  INHEXA   ; IF > MAYBE IT'S ALPHA
1734
1225 FC43 80 30                      SUBA #$30     ; ASCII ADJ. NUMERIC
1735
1226 FC45 39                         RTS           ;
1736
1227                         *
1737
1228                         *
1738
1229 FC46 81 41              INHEXA  CMPA #'A      ; IS IT > OR = "A"
1739
1230 FC48 25 12                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
1740
1231 FC4A 81 46                      CMPA #'F      ; IS IT < OR = "F" ?
1741
1232 FC4C 22 03                      BHI  INHEXL   ; IF > IT AIN'T HEX
1742
1233 FC4E 80 37                      SUBA #'A-10   ; ($37) ASCII ADJ. ALPHA
1743
1234 FC50 39                         RTS           ;
1744
1235                         *
1745
1236 FC51 81 61              INHEXL  CMPA #'a      ; IS IT > OR = "a"
1746
1237 FC53 25 07                      BCS  NOTHEX   ; IF LESS IT AIN'T HEX
1747
1238 FC55 81 66                      CMPA #'f      ; IS IT < "f"
1748
1239 FC57 22 03                      BHI  NOTHEX   ; IF > IT AIN'T HEX
1749
1240 FC59 80 57                      SUBA #'a-10   ; ($57) ADJUST TO LOWER CASE
1750
1241 FC5B 39                         RTS           ;
1751
1242                         *
1752
1243                         *
1753
1244 FC5C 1A 02              NOTHEX  ORCC #2       ; SET (V) FLAG IN C-CODES REGISTER
1754
1245 FC5E 39                         RTS           ;
1755
1246                         *
1756
1247                         *
1757
1248 FC5F 34 10              OUT4H   PSHS X        ; PUSH X-REG. ON THE STACK
1758
1249 FC61 35 02                      PULS A        ; POP MS BYTE OF X-REG INTO A-ACC.
1759
1250 FC63 8D 02                      BSR  OUTHL    ; OUTPUT HEX LEFT
1760
1251 FC65 35 02                      PULS A        ; POP LS BYTE OF X-REG INTO A-ACC.
1761
1252 FC67                    OUTHL   EQU *
1762
1253 FC67 34 02              OUT2H   PSHS A        ; SAVE IT BACK ON STACK
1763
1254 FC69 44                         LSRA          ; CONVERT UPPER HEX NIBBLE TO ASCII
1764
1255 FC6A 44                         LSRA          ;
1765
1256 FC6B 44                         LSRA          ;
1766
1257 FC6C 44                         LSRA          ;
1767
1258 FC6D 8D 04                      BSR  XASCII   ; PRINT HEX NIBBLE AS ASCII
1768
1259 FC6F 35 02              OUTHR   PULS A        ; CONVERT LOWER HEX NIBBLE TO ASCII
1769
1260 FC71 84 0F                      ANDA #$0F     ; STRIP LEFT NIBBLE
1770
1261 FC73 8B 30              XASCII  ADDA #$30     ; ASCII ADJ
1771
1262 FC75 81 39                      CMPA #$39     ; IS IT < OR = "9" ?
1772
1263 FC77 2F 02                      BLE  OUTC     ; IF LESS, OUTPUT IT
1773
1264 FC79 8B 07                      ADDA #7       ; IF > MAKE ASCII LETTER
1774
1265 FC7B 20 51              OUTC    BRA  OUTCH    ; OUTPUT CHAR
1775
1266                         *
1776
1267                         * BINARY / ASCII --- THIS ROUTINE
1777
1268                         * OUTPUTS A BYTE IN ENHANCED
1778
1269                         * BINARY FORMAT. THE ENHANCEMENT
1779
1270                         * IS DONE BY SUBSTITUTING ASCII
1780
1271                         * LETTERS FOR THE ONES IN THE BYTE.
1781
1272                         * THE ASCII ENHANCEMENT LETTERS
1782
1273                         * ARE OBTAINED FROM THE STRING
1783
1274                         * POINTED TO BY THE INDEX REG. "X".
1784
1275                         *
1785
1276 FC7D 34 02              BIASCI  PSHS A        ; SAVE "A" ON STACK
1786
1277 FC7F C6 08                      LDB  #8       ; PRESET LOOP# TO BITS PER BYTE
1787
1278 FC81 A6 80              OUTBA   LDA  ,X+      ; GET LETTER FROM STRING
1788
1279 FC83 68 E4                      ASL  ,S       ; TEST BYTE FOR "1" IN B7
1789
1280 FC85 25 02                      BCS  PRTBA    ; IF ONE PRINT LETTER
1790
1281 FC87 86 2D                      LDA  #'-      ; IF ZERO PRINT "-"
1791
1282 FC89 8D 43              PRTBA   BSR  OUTCH    ; PRINT IT
1792
1283 FC8B 8D 3F                      BSR  OUT1S    ; PRINT SPACE
1793
1284 FC8D 5A                         DECB          ; SUB 1 FROM #BITS YET TO PRINT
1794
1285 FC8E 26 F1                      BNE  OUTBA
1795
1286 FC90 35 82                      PULS A,PC
1796
1287                         *
1797
1288                                 IFD EXTOPT
1798
1289                         *
1799
1290                         * EXTENDED USER COMMANDS
1800
1291                         *
1801
1292 FC92 6E 9F F0 00        USRCMD  JMP [MONEXT+EXTCMD]
1802
1293                                 ENDIF EXTOPT
1803
1294                         *
1804
1295                         *
1805
1296 FC96 7D DF E2           ECHON   TST  ECHO     ; IS ECHO REQUIRED ?
1806
1297 FC99 27 06                      BEQ  INCH     ; ECHO NOT REQ. IF CLEAR
1807
1298                         *
1808
1299                         * INCHE
1809
1300                         *
1810
1301                         * GETS CHARACTER FROM TERMINAL AND
1811
1302                         * ECHOS SAME. THE CHARACTER IS RETURNED
1812
1303                         * IN THE "A" ACCUMULATOR WITH THE PARITY
1813
1304                         * BIT MASKED OFF. ALL OTHER REGISTERS
1814
1305                         * ARE PRESERVED.
1815
1306                         *
1816
1307 FC9B 8D 04              INCHE   BSR  INCH     ; GET CHAR FROM TERMINAL
1817
1308 FC9D 84 7F                      ANDA #$7F     ; STRIP PARITY FROM CHAR.
1818
1309 FC9F 20 2D                      BRA  OUTCH    ; ECHO CHAR TO TERMINAL
1819
1310                         *
1820
1311                         * INCH
1821
1312                         *
1822
1313                         * GET CHARACTER FROM TERMINAL. RETURN
1823
1314                         * CHARACTER IN "A" ACCUMULATOR AND PRESERVE
1824
1315                         * ALL OTHER REGISTERS. THE INPUT CHARACTER
1825
1316                         * IS 8 BITS AND IS NOT ECHOED.
1826
1317                         *
1827
1318                         *
1828
1319 FCA1 34 10              INCH    PSHS X        ; SAVE IX
1829
1320                                 IFD  HFCOPT
1830
1321                                 LDA  #$11     ; SET RTS* LOW, REQUEST FAR END TO TX
1831
1322                                 STA  [CPORT]
1832
1323                                 ENDIF HFCOPT
1833
1323                                 ENDIF HFCOPT
1834
1324 FCA3 BE DF E0           GETSTA  LDX  CPORT    ; POINT TO TERMINAL PORT
1835
1325 FCA6 A6 84                      LDA  ,X       ; FETCH PORT STATUS
1836
1326 FCA8 85 01                      BITA #1       ; TEST READY BIT, RDRF ?
1837
1327                                 IFD  PS2OPT
1838
1328 FCAA 26 09                      BNE  GETST1
1839
1329 FCAC 8E E0 20                   LDX  #PS2KBD
1840
1330 FCAF A6 84                      LDA  ,X
1841
1331 FCB1 85 01                      BITA #1
1842
1332                                 ENDIF PS2OPT
1843
1333 FCB3 27 EE                      BEQ  GETSTA   ; IF NOT RDY, THEN TRY AGAIN
1844
1334 FCB5                    GETST1  EQU  *
1845
1335                                 IFD  HFCOPT
1846
1336                                 LDA  #$51     ; SET RTS* HIGH, STOP FAR END FROM TXING, UNTIL NEXT INPUT
1847
1337                                 STA  [CPORT]
1848
1338                                 ENDIF HFCOPT
1849
1338                                 ENDIF HFCOPT
1850
1339 FCB5 A6 01                      LDA  1,X      ; FETCH CHAR
1851
1340 FCB7 35 90                      PULS X,PC     ; RESTORE IX
1852
1341                         *
1853
1342                         * INCHEK
1854
1343                         *
1855
1344                         * CHECK FOR A CHARACTER AVAILABLE FROM
1856
1345                         * THE TERMINAL. THE SERIAL PORT IS CHECKED
1857
1346                         * FOR READ READY. ALL REGISTERS ARE
1858
1347                         * PRESERVED, AND THE "Z" BIT WILL BE
1859
1348                         * CLEAR IF A CHARACTER CAN BE READ.
1860
1349                         *
1861
1350                         *
1862
1351 FCB9 34 02              INCHEK  PSHS A        ; SAVE A ACCUM
1863
1352                                 IFD  HFCOPT
1864
1353                                 LDA  #$11     ; SET RTS* LOW, REQUEST FAR END TO TX
1865
1354                                 STA  [CPORT]
1866
1355                                 ENDIF HFCOPT
1867
1355                                 ENDIF HFCOPT
1868
1356 FCBB A6 9F DF E0                LDA  [CPORT]  ; FETCH PORT STATUS
1869
1357 FCBF 85 01                      BITA #1       ; TEST READY BIT, RDRF ?
1870
1358                                 IFD  PS2OPT
1871
1359 FCC1 26 05                      BNE  INCHEK1
1872
1360 FCC3 B6 E0 20                   LDA  PS2KBD
1873
1361 FCC6 85 01                      BITA #1       ; TEST READY BIT< RDRF ?
1874
1362                                 ENDIF PS2OPT
1875
1363 FCC8 35 82              INCHEK1 PULS A,PC     ; RESTORE A ACCUM.
1876
1364                         *
1877
1365 FCCA 8D 00              OUT2S   BSR  OUT1S    ; OUTPUT 2 SPACES
1878
1366 FCCC 86 20              OUT1S   LDA  #$20     ; OUTPUT 1 SPACE
1879
1367                         *
1880
1368                         *
1881
1369                         * OUTCH
1882
1370                         *
1883
1371                         * OUTPUT CHARACTER TO TERMINAL.
1884
1372                         * THE CHAR. TO BE OUTPUT IS
1885
1373                         * PASSED IN THE A REGISTER.
1886
1374                         * ALL REGISTERS ARE PRESERVED.
1887
1375                         *
1888
1376                         OUTCH   IFD   VDUOPT
1889
1377 FCCE 8D 49                      BSR   VOUTCH
1890
1378                                 ENDIF VDUOPT
1891
1379                                 IFD   DG640OPT
1892
1380                                 BSR   VOUTCH
1893
1381                                 ENDIF DG640OPT
1894
1381                                 ENDIF DG640OPT
1895
1382 FCD0 34 12              AOUTCH  PSHS A,X      ; SAVE A ACCUM AND IX
1896
1383 FCD2 BE DF E0                   LDX  CPORT    ; GET ADDR. OF TERMINAL
1897
1384 FCD5 A6 84              FETSTA  LDA  ,X       ; FETCH PORT STATUS
1898
1385 FCD7 85 02                      BITA #2       ; TEST TDRE, OK TO XMIT ?
1899
1386 FCD9 27 FA                      BEQ  FETSTA   ; IF NOT LOOP UNTIL RDY
1900
1387 FCDB 85 08                      BITA #8       ; CLEAR TO SEND ?
1901
1388 FCDD 26 F6                      BNE  FETSTA   ; NO, LOOP UNTIL CLEAR
1902
1389 FCDF 35 02                      PULS A        ; GET CHAR. FOR XMIT
1903
1390 FCE1 A7 01                      STA  1,X      ; XMIT CHAR.
1904
1391 FCE3 35 90                      PULS X,PC     ; RESTORE IX
1905
1392                         *
1906
1393                         * IO INITIALIZATION
1907
1394                         *
1908
1395 FCE5                    IOINIZ  EQU  *
1909
1396                                 IFD  VDUOPT
1910
1397 FCE5 8D 13                      BSR  VINIZ
1911
1398                                 ENDIF VDUOPT
1912
1399                                 IFD  DG640OPT
1913
1400                                 BSR  VINIZ
1914
1401                                 ENDIF DG640OPT
1915
1401                                 ENDIF DG640OPT
1916
1402 FCE7 BE DF E0           ACINIZ  LDX  CPORT    ; POINT TO CONTROL PORT ADDRESS
1917
1403 FCEA 86 03                      LDA  #3       ; RESET ACIA PORT CODE
1918
1404 FCEC A7 84                      STA  ,X       ; STORE IN CONTROL REGISTER
1919
1405 FCEE 86 51                      LDA  #$51     ; SET 8 DATA, 2 STOP AN 0 PARITY RTS* HIGH
1920
1406 FCF0 A7 84                      STA  ,X       ; STORE IN CONTROL REGISTER
1921
1407 FCF2 6D 01                      TST  1,X      ; ANYTHING IN DATA REGISTER?
1922
1408 FCF4 86 FF                      LDA  #$FF     ; TURN ON ECHO FLAG
1923
1409 FCF6 B7 DF E2                   STA  ECHO
1924
1410 FCF9 39                         RTS
1925
1411                         *
1926
1412                                 IFD VDUOPT
1927
1413                         *
1928
1414                         ***************************************************
1929
1415                         *      VDU8 ADM3A REGISTER-MAPPED EMULATOR        *
1930
1416                         *                                                 *
1931
1417                         *      80 x 25 Characters
1932
1418                         *
1933
1419                         ***************************************************
1934
1420                         *
1935
1421                         ***************************************************
1936
1422                         *               INITIALIZE EMULATOR               *
1937
1423                         ***************************************************
1938
1424                         *
1939
1425 FCFA 8E E0 30           VINIZ   LDX  #VDU
1940
1426 FCFD CC 00 00                   LDD  #0
1941
1427 FD00 FD DF FB                   STD  COLADX   ; AND ROWADX
1942
1428 FD03 A7 02                      STA  VDUCOL,X
1943
1429 FD05 E7 03                      STB  VDUROW,X
1944
1430 FD07 E7 04                      STB  VDUOFF,X
1945
1431 FD09 FD DF FD                   STD  NEWROW   ; AND ESCFLG
1946
1432 FD0C C6 02                      LDB  #$02
1947
1433 FD0E E7 01                      STB  VDUATT,X
1948
1434 FD10 7F DF FE                   CLR  ESCFLG
1949
1435 FD13 86 1B                      LDA  #$1B     ; SEND ESCAPE
1950
1436 FD15 8D 02                      BSR  VOUTCH
1951
1437 FD17 86 59                      LDA  #'Y      ; CLEAR TO END OF SCREEN
1952
1438                         *
1953
1439                         ** VIDEO OUTPUT ROUTINE
1954
1440                         *
1955
1441 FD19 34 16              VOUTCH  PSHS A,B,X    ; SAVE REGISTERS
1956
1442 FD1B 8E E0 30                   LDX  #VDU     ; POINT TO VDU REGISTERS
1957
1443                         *
1958
1444                         ** CHECK FOR ESCAPE SEQUENCE
1959
1445                         *
1960
1446 FD1E 7D DF FE                   TST  ESCFLG   ; ESCAPE ACTIVE?
1961
1447 FD21 27 04                      BEQ  SOROU1   ; BRANCH IF NOT
1962
1448 FD23 8D 60                      BSR  ESCAPE   ; ELSE DO ESCAPE
1963
1449 FD25 20 0D                      BRA  RETURN   ; AND RETURN
1964
1450                         *
1965
1451                         ** CHECK FOR CONTROL CHARACTERS
1966
1452                         *
1967
1453 FD27 81 20              SOROU1  CMPA #$20     ; CONTROL CODES?
1968
1454 FD29 24 04                      BHS  SOROU2
1969
1455 FD2B 8D 09                      BSR  CONTRL   ; BRANCH IF SO
1970
1456 FD2D 20 05                      BRA  RETURN
1971
1457                         *
1972
1458                         ** OUTPUT TEXT CHARACTER
1973
1459                         *
1974
1460 FD2F A7 84              SOROU2  STA  VDUCHR,X ; DISPLAY CHARACTER
1975
1461 FD31 17 00 AF                   LBSR NEWCOL   ; UPDATE COLUMN
1976
1462                         *
1977
1463                         ** DISPLAY CURSOR AND RETURN
1978
1464                         *
1979
1465 FD34 35 96              RETURN  PULS A,B,X,PC ; RESTORE REGISTERS AND RETURN
1980
1466                         *
1981
1467                         ***************************************************
1982
1468                         *              CONTROL CODE HANDLERS              *
1983
1469                         ***************************************************
1984
1470                         *
1985
1471 FD36 81 08              CONTRL  CMPA #$08     ; CTRL H - BACKSPACE ?
1986
1472 FD38 27 34                      BEQ  BACKSP
1987
1473 FD3A 81 1B                      CMPA #$1B     ; ESCAPE SEQUENCE?
1988
1474 FD3C 27 5A                      BEQ  SETESC
1989
1475 FD3E 81 1A                      CMPA #$1A     ; CTRL Z - Clear Screen
1990
1476 FD40 10 27 00 7C                LBEQ CLRSCR
1991
1477 FD44 81 16                      CMPA #$16     ; CTRL ^ - Home
1992
1478 FD46 27 38                      BEQ  HOME
1993
1479 FD48 81 0D                      CMPA #$0D     ; CTRL M - RETURN?
1994
1480 FD4A 10 27 00 89                LBEQ CRETN
1995
1481 FD4E 81 0C                      CMPA #$0C     ; CTRL L - CHAR RIGHT
1996
1482 FD50 27 24                      BEQ  CHRIGHT
1997
1483 FD52 81 0B                      CMPA #$0B     ; CTRL K - MOVE UP ONE LINE
1998
1484 FD54 27 0F                      BEQ  LINEUP
1999
1485 FD56 81 0A                      CMPA #$0A     ; CTRL J - LINE FEED
2000
1486 FD58 26 45                      BNE  RETESC   ; NONE OF THESE, RETURN
2001
1487                         *
2002
1488                         ***************************************** LINE FEED
2003
1489                         *
2004
1490 FD5A FC DF FB           LINEFD  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
2005
1491 FD5D 5C                         INCB          ; BUMP ROW
2006
1492 FD5E C1 19                      CMPB #NUMLIN  ; SCROLL TIME?
2007
1493 FD60 26 79                      BNE  NEWCUR   ; POSITION CURSOR IF NOT
2008
1494 FD62 16 00 8F                   LBRA SCROLL   ; ELSE SCROLL IT
2009
1495                         *
2010
1496                         ***************************************** LINE FEED
2011
1497                         *
2012
1498 FD65 FC DF FB           LINEUP  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
2013
1499 FD68 5D                         TSTB          ; AT TOP OF SCREEN ?
2014
1500 FD69 27 34                      BEQ  RETESC   ; Yes, Ignore
2015
1501 FD6B 5A                         DECB          ; No, Decrement ROW
2016
1502 FD6C 20 6D                      BRA  NEWCUR   ; POSITION CURSOR
2017
1503                         *
2018
1504                         *********************************** BACK SPACE
2019
1505                         *
2020
1506 FD6E B6 DF FB           BACKSP  LDA  COLADX
2021
1507 FD71 27 2C                      BEQ  RETESC   ; RETURN
2022
1508 FD73 4A                         DECA
2023
1509 FD74 20 62                      BRA  POSCOL   ; POSITION CURSOR
2024
1510                         *
2025
1511                         *********************************** CURSOR RIGHT
2026
1512                         *
2027
1513 FD76 B6 DF FB           CHRIGHT LDA  COLADX
2028
1514 FD79 4C                         INCA
2029
1515 FD7A 81 50                      CMPA #LINLEN
2030
1516 FD7C 27 21                      BEQ  RETESC
2031
1517 FD7E 20 58                      BRA  POSCOL
2032
1518                         *
2033
1519                         *********************************** CURSOR RIGHT
2034
1520                         *
2035
1521 FD80 CC 00 00           HOME    LDD  #0       ; HOME - POSITION TOP OF SCREEN
2036
1522 FD83 20 56                      BRA  NEWCUR
2037
1523                         *
2038
1524                         ***************************************************
2039
1525                         *                 ESCAPE HANDLERS                 *
2040
1526                         ***************************************************
2041
1527                         *
2042
1528 FD85 F6 DF FE           ESCAPE  LDB  ESCFLG   ; GET FLAG
2043
1529 FD88 C1 3D                      CMPB #'=      ; SETTING CURSOR?
2044
1530 FD8A 27 14                      BEQ  ESCCUR   ; BRANCH IF SO
2045
1531 FD8C 81 59                      CMPA #'Y      ; CLEAR TO END OF SCREEN?
2046
1532 FD8E 27 6E                      BEQ  ESCCLS
2047
1533 FD90 81 54                      CMPA #'T      ; CLEAR TO END OF LINE?
2048
1534 FD92 27 31                      BEQ  ESCCLL
2049
1535 FD94 81 3D                      CMPA #'=      ; STARTING CURSOR SET?
2050
1536 FD96 26 04                      BNE  CLRESC   ; BRANCH IF NOT
2051
1537                         *
2052
1538                         ***************************** START ESCAPE SEQUENCE
2053
1539                         *
2054
1540 FD98 B7 DF FE           SETESC  STA  ESCFLG   ; ELSE START CURSORING
2055
1541 FD9B 39                         RTS           ; AND RETURN
2056
1542                         *
2057
1543 FD9C 7F DF FE           CLRESC  CLR  ESCFLG   ; NO OTHERS SUPPORTED
2058
1544 FD9F 39                 RETESC  RTS           ; SO RETURN
2059
1545                         *
2060
1546                         ********************************* SET SCREEN CURSOR
2061
1547                         *
2062
1548 FDA0 7D DF FD           ESCCUR  TST  NEWROW   ; ROW SET?
2063
1549 FDA3 26 04                      BNE  ESCCU1   ; BRANCH IF SO
2064
1550 FDA5 B7 DF FD                   STA  NEWROW   ; ELSE SET NEW ROW
2065
1551 FDA8 39                         RTS           ; AND RETURN
2066
1552                         *
2067
1553 FDA9 7F DF FE           ESCCU1  CLR  ESCFLG
2068
1554 FDAC 80 20                      SUBA #$20     ; ADJUST COLUMN ADDRESS
2069
1555 FDAE 81 4F                      CMPA #LINLEN-1 ;CHECK FOR ACCEPTABLE COLUM
2070
1556 FDB0 22 ED                      BHI  RETESC   ; NOT OK, DO NOTHING
2071
1557                         *
2072
1558 FDB2 F6 DF FD           ESCCU2  LDB  NEWROW
2073
1559 FDB5 7F DF FD                   CLR  NEWROW
2074
1560 FDB8 C0 20                      SUBB #$20     ; ADJUST TO ROW ADDRESS
2075
1561 FDBA C1 18                      CMPB #NUMLIN-1 ; CHECK FOR ACCEPTABLE ROW
2076
1562 FDBC 22 E1                      BHI  RETESC   ; ELSE RETURN DOING NOTHING
2077
1563 FDBE 20 1B                      BRA  NEWCUR   ; GO SET NEW CURSOR IF SO
2078
1564                         *
2079
1565                         ****************** CLEAR FROM CURSOR TO END OF LINE
2080
1566                         *
2081
1567 FDC0 CC 00 00           CLRSCR  LDD  #0       ; CLEAR FROM TOP OF SCREEN
2082
1568 FDC3 8D 16                      BSR  NEWCUR
2083
1569 FDC5 B6 DF FB           ESCCLL  LDA  COLADX
2084
1570 FDC8 C6 20                      LDB  #$20     ; AND CLEAR CHAR
2085
1571 FDCA E7 84              ESCCL1  STB  VDUCHR,X ; DISPLAY TEXT
2086
1572 FDCC 4C                         INCA
2087
1573 FDCD A7 02                 STA  VDUCOL,X
2088
1574 FDCF 81 50                      CMPA #LINLEN  ; UNTIL END OF LINE
2089
1575 FDD1 26 F7                      BNE  ESCCL1
2090
1576 FDD3 7F DF FE                   CLR  ESCFLG
2091
1577 FDD6 39                         RTS
2092
1578                         *
2093
1579                         *********************************** CARRIAGE RETURN
2094
1580                         *
2095
1581 FDD7 4F                 CRETN   CLRA          ; SET COLUMN ZERO
2096
1582 FDD8 F6 DF FC           POSCOL  LDB  ROWADX   ; GET CURRENT ROW
2097
1583                         *
2098
1584                         *********** GENERATE NEW CURSOR POSITION AND RETURN
2099
1585                         *
2100
1586 FDDB FD DF FB           NEWCUR  STD  COLADX   ; SAVE NEW ROW AND COLUMN
2101
1587 FDDE A7 02                 STA  VDUCOL,X ; SET NEW COLUMN
2102
1588 FDE0 E7 03                      STB  VDUROW,X ; SET NEW ROW
2103
1589 FDE2 39                         RTS           ; AND RETURN
2104
1590                         *
2105
1591                         ********************* UPDATE CURRENT COLUMN AND ROW
2106
1592                         *
2107
1593 FDE3 FC DF FB           NEWCOL  LDD  COLADX   ; GET ROW AND COLUMN
2108
1594 FDE6 4C                         INCA          ; BUMP COLUMN
2109
1595 FDE7 81 50                      CMPA #LINLEN  ; ROLL?
2110
1596 FDE9 26 F0                      BNE  NEWCUR   ; BRANCH IF NOT
2111
1597 FDEB 4F                         CLRA          ; ELSE RESET TO ZERO
2112
1598 FDEC 5C                         INCB          ; AND BUMP ROW
2113
1599 FDED C1 19                      CMPB #NUMLIN
2114
1600 FDEF 26 EA                      BNE  NEWCUR
2115
1601 FDF1 5A                         DECB          ; BOTTOM ROW
2116
1602 FDF2 8D E7                      BSR  NEWCUR
2117
1603                         *
2118
1604                         ********************************* SCROLL THE SCREEN
2119
1605                         *
2120
1606 FDF4 E6 04              SCROLL  LDB  VDUOFF,X
2121
1607 FDF6 5C                         INCB
2122
1608 FDF7 C1 19                      CMPB #NUMLIN
2123
1609 FDF9 25 01                      BLO  SCROL1
2124
1610 FDFB 5F                         CLRB
2125
1611 FDFC E7 04              SCROL1  STB  VDUOFF,X
2126
1612                         *
2127
1613                         **************** CLEAR FROM CURSOR TO END OF SCREEN
2128
1614                         *
2129
1615 FDFE F6 DF FB           ESCCLS  LDB  COLADX   ; GET CURSOR
2130
1616 FE01 86 20                      LDA  #$20     ; GET A SPACE
2131
1617 FE03 F7 DF FB           ESCCLS1    STB  COLADX
2132
1618 FE06 E7 02                      STB  VDUCOL,X
2133
1619 FE08 A7 84                      STA  VDUCHR,X
2134
1620 FE0A 5C                         INCB
2135
1621 FE0B C1 50                      CMPB #LINLEN
2136
1622 FE0D 26 F4                      BNE  ESCCLS1
2137
1623                         *
2138
1624 FE0F F6 DF FC                   LDB  ROWADX
2139
1625 FE12 5C                         INCB
2140
1626 FE13 C1 19                      CMPB #NUMLIN
2141
1627 FE15 27 08                      BEQ  ESCCLS2
2142
1628 FE17 F7 DF FC                   STB  ROWADX
2143
1629 FE1A E7 03                      STB  VDUROW,X
2144
1630 FE1C 5F                         CLRB
2145
1631 FE1D 20 E4                      BRA  ESCCLS1
2146
1632                         *
2147
1633 FE1F 5F                 ESCCLS2 CLRB
2148
1634 FE20 F7 DF FB                   STB  COLADX
2149
1635 FE23 E7 02                      STB  VDUCOL,X
2150
1636 FE25 F7 DF FE                   STB  ESCFLG
2151
1637 FE28 39                         RTS
2152
1638                                 ENDIF VDUOPT
2153
1639                         *
2154
1640                                 IFD DG640OPT
2155
1641                         ***************************************************
2156
1642                         *      TELEVIDEO-TYPE MEMORY-MAPPED EMULATOR      *
2157
1643                         *                                                 *
2158
1644                         * FOR HARD-WIRED MEMORY-MAPPED DISPLAYS USING THE *
2159
1645                         * HIGH ORDER BIT OF EACH BYTE FOR  REVERSE  VIDEO *
2160
1646                         * CURSORING  (SUCH  AS THE THOMAS INSTRUMENTATION *
2161
1647                         * 16x64 BOARD).                                   *
2162
1648                         ***************************************************
2163
1649                         *
2164
1650                         ***************************************************
2165
1651                         *               INITIALIZE EMULATOR               *
2166
1652                         ***************************************************
2167
1653                         *
2168
1654                         VINIZ   LDX  #0
2169
1655                                 STX  COLADX   ; AND ROWADX
2170
1656                                 STX  NEWROW   ; AND ESCFLG
2171
1657                                 LDX  #SCREEN  ; POINT TO SCREEN
2172
1658                                 STX  CURSOR   ; SET PROGRAM CURSOR
2173
1659                                 LDA  #$1B     ; SEND ESCAPE
2174
1660                                 BSR  VOUTCH
2175
1661                                 LDA  #'Y      ; CLEAR TO END OF SCREEN
2176
1662                         *
2177
1663                         ** VIDEO OUTPUT ROUTINE
2178
1664                         *
2179
1665                         VOUTCH  PSHS A,B,X    ; SAVE REGISTERS
2180
1666                         *
2181
1667                         ** CLEAR CURSOR
2182
1668                         *
2183
1669                                 LDX  CURSOR
2184
1670                                 LDB  0,X
2185
1671                                 ANDB #$7F
2186
1672                                 STB  0,X
2187
1673                         *
2188
1674                         ** CHECK FOR ESCAPE SEQUENCE
2189
1675                         *
2190
1676                                 TST  ESCFLG   ; ESCAPE ACTIVE?
2191
1677                                 BEQ  SOROU1   ; BRANCH IF NOT
2192
1678                                 BSR  ESCAPE   ; ELSE DO ESCAPE
2193
1679                                 BRA  RETURN   ; AND RETURN
2194
1680                         *
2195
1681                         ** CHECK FOR CONTROL CHARACTERS
2196
1682                         *
2197
1683                         SOROU1  CMPA #$20     ; CONTROL CODES?
2198
1684                                 BHS  SOROU2
2199
1685                                 BSR  CONTRL   ; BRANCH IF SO
2200
1686                                 BRA  RETURN
2201
1687                         *
2202
1688                         ** OUTPUT TEXT CHARACTER
2203
1689                         *
2204
1690                         SOROU2  LDX  CURSOR   ; ELSE GET CURSOR
2205
1691                                 STA  0,X      ; DISPLAY CHARACTER
2206
1692                                 LBSR NEWCOL   ; UPDATE COLUMN
2207
1693                         *
2208
1694                         ** DISPLAY CURSOR AND RETURN
2209
1695                         *
2210
1696                         RETURN  LDX  CURSOR   ; AND DISPLAY IT
2211
1697                                 LDB  ,X
2212
1698                                 ORB  #$80     ; WITH REVID
2213
1699                                 STB  ,X
2214
1700                                 PULS A,B,X,PC ; RESTORE REGISTERS AND RETURN
2215
1701                         *
2216
1702                         ***************************************************
2217
1703                         *              CONTROL CODE HANDLERS              *
2218
1704                         ***************************************************
2219
1705                         *
2220
1706                         CONTRL  CMPA #$08     ; CTRL H - BACKSPACE ?
2221
1707                                 LBEQ BACKSP
2222
1708                                 CMPA #$1B     ; ESCAPE SEQUENCE?
2223
1709                                 LBEQ SETESC
2224
1710                                 CMPA #$D      ; CTRL M - RETURN?
2225
1711                                 LBEQ CRETN
2226
1712                                 CMPA #$0A     ; CTRL J - LINE FEED
2227
1713                                 BNE  RETESC   ; NONE OF THESE, RETURN
2228
1714                         *
2229
1715                         ***************************************** LINE FEED
2230
1716                         *
2231
1717                         LINEFD  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
2232
1718                                 INCB          ; BUMP ROW
2233
1719                                 CMPB #NUMLIN  ; SCROLL TIME?
2234
1720                                 LBNE NEWCUR   ; POSITION CURSOR IF NOT
2235
1721                                 LBRA SCROLL   ; ELSE SCROLL IT
2236
1722                         *
2237
1723                         ***************************************** LINE FEED
2238
1724                         *
2239
1725                         LINEUP  LDD  COLADX   ; GET CURRENT COLUMN AND ROW
2240
1726                                 TSTB          ; AT TOP OF SCREEN ?
2241
1727                                 BEQ  RETESC   ; YES, RETURN
2242
1728                                 DECB          ; NO, DECREMENT ROW
2243
1729                                 LBRA NEWCUR   ; POSITION CURSOR
2244
1730                         *
2245
1731                         *********************************** BACK SPACE
2246
1732                         *
2247
1733                         BACKSP  LDA  COLADX    ; GET CURRENT COLUMN AND ROW
2248
1734                                 BEQ  RETESC    ; IF AT TOP LEFT CORNER RETURN
2249
1735                                 DECA           ; OTHERWISE BACK STEP ONE CHARACTER
2250
1736                                 LBRA POSCOL    ; POSITION CURSOR
2251
1737                         *
2252
1738                         *********************************** CURSOR RIGHT
2253
1739                         *
2254
1740                         CHRIGHT LDA  COLADX    ; GET CURRENT COLUMN AND ROW
2255
1741                                 INCA           ; MOVE RIGHT ONE CHARACTER
2256
1742                                 CMPA #LINLEN   ; ARE WE AT THE END OF THE LINE ?
2257
1743                                 BEQ  RETESC    ; YES, RETURN
2258
1744                                 LBRA POSCOL    ; NO, POSITION CURSOR
2259
1745                         *
2260
1746                         ***************************************************
2261
1747                         *                 ESCAPE HANDLERS                 *
2262
1748                         ***************************************************
2263
1749                         *
2264
1750                         ESCAPE  LDB  ESCFLG   ; ARE WE IN AN ESCAPE SEQUENCE ?
2265
1751                                 CMPB #'=      ; ARE WE SETTING CURSOR?
2266
1752                                 BEQ  ESCCUR   ; YES BRANCH TO SET CURSOR
2267
1753                                 CMPA #'Y      ; CLEAR TO END OF SCREEN?
2268
1754                                 LBEQ ESCCLS   ; YES, CLEAR SCREEN
2269
1755                                 CMPA #'T      ; CLEAR TO END OF LINE?
2270
1756                                 BEQ  ESCCLL   ; YES, CLEAR LINE
2271
1757                                 CMPA #'E      ; INSERT LINE?
2272
1758                                 BEQ  ESCINL
2273
1759                                 CMPA #'R      ; DELETE LINE?
2274
1760                                 BEQ  ESCDLL
2275
1761                                 CMPA #'=      ; STARTING CURSOR SET?
2276
1762                                 BNE  CLRESC   ; BRANCH IF NOT
2277
1763                         *
2278
1764                         ***************************** START ESCAPE SEQUENCE
2279
1765                         *
2280
1766                         SETESC  STA  ESCFLG   ; ELSE START CURSORING
2281
1767                                 RTS           ; AND RETURN
2282
1768                         *
2283
1769                         CLRESC  CLR  ESCFLG   ; NO OTHERS SUPPORTED
2284
1770                         RETESC  RTS           ;  SO RETURN
2285
1771                         *
2286
1772                         ********************************* SET SCREEN CURSOR
2287
1773                         *
2288
1774                         ESCCUR  TST  NEWROW   ; ROW SET?
2289
1775                                 BNE  ESCCU1   ; BRANCH IF SO
2290
1776                                 STA  NEWROW   ; ELSE SET NEW ROW
2291
1777                                 RTS           ;  AND RETURN
2292
1778                         *
2293
1779                         ESCCU1  CLR  ESCFLG
2294
1780                                 SUBA #$20      ; ADJUST COLUMN ADDRESS
2295
1781                                 CMPA #LINLEN-1 ; CHECK FOR ACCEPTABLE COLUM
2296
1782                                 BHI  RETESC    ; NOT OK, DO NOTHING
2297
1783                         *
2298
1784                         ESCCU2  LDB  NEWROW
2299
1785                                 CLR  NEWROW
2300
1786                                 SUBB #$20      ; ADJUST TO ROW ADDRESS
2301
1787                                 CMPB #NUMLIN-1 ; CHECK FOR ACCEPTABLE ROW
2302
1788                                 BHI  RETESC    ; ELSE RETURN DOING NOTHING
2303
1789                                 BRA  NEWCUR    ; GO SET NEW CURSOR IF SO
2304
1790                         *
2305
1791                         *************************** DELETE LINE FROM SCREEN
2306
1792                         *
2307
1793                         ESCDLL  BSR  CRETN     ; GO COL. ZERO
2308
1794                                 LDB  ROWADX
2309
1795                                 CMPB #NUMLIN-1
2310
1796                                 BEQ  SCROL3
2311
1797                                 BRA  SCROL1    ; AND DELETE THIS LINE
2312
1798                         *
2313
1799                         *************************** INSERT LINE INTO SCREEN
2314
1800                         *
2315
1801                         ESCINL  BSR  CRETN     ; GO TO COL. ZERO
2316
1802                                 LDB  ROWADX
2317
1803                                 CMPB #NUMLIN-1
2318
1804                                 BEQ  ESCCLL
2319
1805                         *
2320
1806                         ** SCROLL SCREEN DOWN FROM CURSOR
2321
1807                         *
2322
1808                                 LDX  #SCREEN+SCNLEN-LINLEN
2323
1809                         ESCIN0  LDA  ,-X
2324
1810                                 STA  LINLEN,X
2325
1811                                 LDA  SCNLEN,X
2326
1812                                 STA  SCNLEN+LINLEN,X
2327
1813                                 CMPX CURSOR
2328
1814                                 BNE  ESCIN0
2329
1815                         *
2330
1816                         ****************** CLEAR FROM CURSOR TO END OF LINE
2331
1817                         *
2332
1818                         ESCCLL  LDA  COLADX    ; GET CURRENT COLUMN
2333
1819                                 LDX  CURSOR    ; GET CURSOR
2334
1820                                 LDB  #$20      ; AND CLEAR CHAR
2335
1821                         ESCLL1  STB  SCNLEN,X  ; CLEAR ATTRIBUTE
2336
1822                                 STB  ,X+       ; CLEAR TEXT
2337
1823                                 INCA
2338
1824                                 CMPA #LINLEN   ; UNTIL END OF LINE
2339
1825                                 BNE  ESCLL1
2340
1826                                 CLR  ESCFLG
2341
1827                                 RTS
2342
1828                         *
2343
1829                         *********************************** CARRIAGE RETURN
2344
1830                         *
2345
1831                         CRETN   CLRA           ; SET COLUMN ZERO
2346
1832                         POSCOL  LDB  ROWADX    ; GET CURRENT ROW
2347
1833                         *
2348
1834                         *********** GENERATE NEW CURSOR POSITION AND RETURN
2349
1835                         *
2350
1836                         NEWCUR  STD  COLADX    ; SAVE NEW ROW AND COLUMN
2351
1837                                 LDA  #LINLEN   ; ELSE ADD A LINE
2352
1838                                 MUL            ; LINLEN * ROWADX
2353
1839                                 ADDB COLADX
2354
1840                                 ADCA #0
2355
1841                                 ADDD #SCREEN   ; ADD SCREEN BASE.
2356
1842                                 STD  CURSOR    ; SAVE NEW CURSOR
2357
1843                                 TFR  D,X       ; GET CURSOR IN X
2358
1844                                 RTS            ; AND RETURN
2359
1845                         *
2360
1846                         ********************* UPDATE CURRENT COLUMN AND ROW
2361
1847                         *
2362
1848                         NEWCOL  LDD  COLADX    ; GET ROW AND COLUMN
2363
1849                                 INCA           ; BUMP COLUMN
2364
1850                                 CMPA #LINLEN   ; ROLL?
2365
1851                                 BNE  NEWCUR    ; BRANCH IF NOT
2366
1852                                 CLRA           ; ELSE RESET TO ZERO
2367
1853                                 INCB           ; AND BUMP ROW
2368
1854                                 CMPB #NUMLIN
2369
1855                                 BNE  NEWCUR
2370
1856                                 DECB           ; BOTTOM ROW
2371
1857                                 BSR  NEWCUR
2372
1858                         *
2373
1859                         ********************************* SCROLL THE SCREEN
2374
1860                         *
2375
1861                         SCROLL  LDX  #SCREEN   ; POINT TO SCREEN
2376
1862                         SCROL1  LDA  SCNLEN+LINLEN,X
2377
1863                                 STA  SCNLEN,X
2378
1864                                 LDA  LINLEN,X  ; MOVE TWO BYTES
2379
1865                                 STA  ,X+       ; UP ONE LINE
2380
1866                                 CMPX #SCREEN+SCNLEN-LINLEN
2381
1867                                 BNE  SCROL1    ; LOOP UNTIL DONE
2382
1868                                 BRA  SCROL3
2383
1869                         *
2384
1870                         **************** CLEAR FROM CURSOR TO END OF SCREEN
2385
1871                         *
2386
1872                         ESCCLS  LDX   CURSOR   ; GET CURSOR
2387
1873                         SCROL3  LDA   #$20     ; GET A SPACE
2388
1874                         SCROL2  STA   SCNLEN,X ; CLEAR ATTRIBUTES
2389
1875                                 STA   ,X+      ; AND TEXT
2390
1876                                 CMPX  #SCREEN+SCNLEN
2391
1877                                 BNE   SCROL2   ; UNTIL DONE
2392
1878                                 CLR   ESCFLG
2393
1879                                 RTS
2394
1880                                 ENDIF DG640OPT
2395
1880                                 ENDIF DG640OPT
2396
1881                         *
2397
1882                                 IFD PRTOPT
2398
1883                         *************************************
2399
1884                         *
2400
1885                         ** PRINTER DRIVER ROUTINES
2401
1886                         *
2402
1887                         *************************************
2403
1888                         *
2404
1889                         ** PINIZ - INITIATE PRINTER PORT
2405
1890                         *
2406
1891                         PINIZ   PSHS B
2407
1892                                 LDD #DIRMSK*256+$04 ; ACCA=DIRMSK ACCB=$04
2408
1893                                 STD PADATA     ; SET DDR AND SELECT DATA
2409
1894                         *
2410
1895                         ** RESET PRINTER
2411
1896                         *
2412
1897                                 LDB  #PRESET
2413
1898                                 STB  PADATA
2414
1899                         RESTLP  INCB           ; DELAY FOR RESET
2415
1900                                 BNE  RESTLP
2416
1901                                 STA  PADATA    ; ACCA=DIRMSK
2417
1902                         *
2418
1903                         ** INITALIZE PORT B (DATA PORT)
2419
1904                         *
2420
1905                                 LDA  #$2A
2421
1906                                 STA  PBCTRL
2422
1907                                 LDD  #$FF2E    ; ACCA=$FF ACCB =%00101110
2423
1908                                 STD  PBDATA    ; PBDREG   PBCTRL
2424
1909                         *
2425
1910                         ** SELECT 66 LINES/PAGE
2426
1911                         *
2427
1912                                 LDA  #$1B
2428
1913                                 BSR  POUTCH
2429
1914                                 LDA  #'C
2430
1915                                 BSR  POUTCH
2431
1916                                 LDA  #66
2432
1917                                 PULS B
2433
1918                         *************************************
2434
1919                         *
2435
1920                         ** OUTPUT A CHARACTER TO THE PRINTER
2436
1921                         *
2437
1922                         *************************************
2438
1923                         POUTCH  PSHS B
2439
1924                                 LDB  PBDATA    ; CLEAR INTERRUPT BIT
2440
1925                         *
2441
1926                         ** WAIT TILL NOT BUSY
2442
1927                         *
2443
1928                         BUSYLP  LDB  PADATA
2444
1929                                 BITB #PERROR
2445
1930                                 BEQ  PEXIT
2446
1931                                 TSTB
2447
1932                                 BMI  BUSYLP
2448
1933                         *
2449
1934                         ** NOW OUTPUT CHARACTER
2450
1935                         *
2451
1936                                 STA  PBDATA
2452
1937                         PEXIT   PULS B,PC
2453
1938                         *************************************
2454
1939                         *
2455
1940                         ** PCHK TEST IFD PRINTER READY
2456
1941                         *
2457
1942                         *************************************
2458
1943                         PCHK    TST  PBCTRL    ; TEST STATE OF CRB7
2459
1944                                 RTS            ; SET ON ACKNOWLEDGE
2460
1945                                 ENDIF PRTOPT
2461
1945                                 ENDIF PRTOPT
2462
1946                         *************************************
2463
1947                         *
2464
1948                         * MONITOR KEYBOARD COMMAND JUMP TABLE
2465
1949                         *
2466
1950                         *************************************
2467
1951                         *
2468
1952 FE29                    JMPTAB  EQU *
2469
1953 FE29 01                         FCB 1 " ^A "
2470
1954 FE2A FB 74                      FDB ALTRA
2471
1955 FE2C 02                         FCB 2 " ^B "
2472
1956 FE2D FB 69                      FDB ALTRB
2473
1957 FE2F 03                         FCB 3 " ^C "
2474
1958 FE30 FB 7F                      FDB ALTRCC
2475
1959 FE32 04                         FCB 4 " ^D "
2476
1960 FE33 FB 5E                      FDB ALTRDP
2477
1961 FE35 10                         FCB $10 " ^P "
2478
1962 FE36 FB 31                      FDB ALTRPC
2479
1963 FE38 15                         FCB $15 " ^U "
2480
1964 FE39 FB 3D                      FDB ALTRU
2481
1965 FE3B 18                         FCB $18 " ^X "
2482
1966 FE3C FB 53                      FDB ALTRX
2483
1967 FE3E 19                         FCB $19 " ^Y "
2484
1968 FE3F FB 48                      FDB ALTRY
2485
1969                         *
2486
1970 FE41 42                         FCC 'B'
2487
1971 FE42 F9 5C                      FDB BRKPNT
2488
1972 FE44 45                         FCC 'E'
2489
1973 FE45 F8 FD                      FDB MEMDUMP
2490
1974 FE47 47                         FCC 'G'
2491
1975 FE48 F8 A5                      FDB GO
2492
1976 FE4A 4C                         FCC 'L'
2493
1977 FE4B FA 5E                      FDB LOAD
2494
1978 FE4D 50                         FCC 'P'
2495
1979 FE4E FA BC                      FDB PUNCH
2496
1980 FE50 4D                         FCC 'M'
2497
1981 FE51 F8 A8                      FDB MEMCHG
2498
1982 FE53 52                         FCC 'R'
2499
1983 FE54 FB ED                      FDB REGSTR
2500
1984 FE56 53                         FCC 'S'
2501
1985 FE57 F8 F1                      FDB DISSTK
2502
1986 FE59 58                         FCC 'X'
2503
1987 FE5A F9 88                      FDB XBKPNT
2504
1988                                 IFD MFDCOPT
2505
1989                                 FCC 'D'        ; *** SWTPC USES 'U' FOR MINIBOOT
2506
1990                                 FDB MINBOOT
2507
1991                                 ENDIF MFDCOPT
2508
1991                                 ENDIF MFDCOPT
2509
1992                                 IFD CF8OPT
2510
1993 FE5C 44                         FCC 'D'        ; *** FPGA 8 BIT USES 'D' FOR CFBOOT
2511
1994 FE5D F9 D5                      FDB CFBOOT
2512
1995                                 ENDIF CF8OPT
2513
1996                                 IFD IDEOPT
2514
1997                                 FCC 'D'        ; *** XESS FPGA 16 BIT IDE USES 'D' FOR IDEBOOT
2515
1998                                 FDB IDEBOOT
2516
1999                                 ENDIF IDEOPT
2517
1999                                 ENDIF IDEOPT
2518
2000                                 IFD DMAFOPT
2519
2001                                 FCC 'U'        ; *** SWTPC USES 'D' FOR DMAF2 BOOT
2520
2002                                 FDB DBOOT
2521
2003                                 ENDIF DMAFOPT
2522
2003                                 ENDIF DMAFOPT
2523
2004                                 IFD EXTOPT
2524
2005 FE5F 55                         FCC 'U'        ; *** IF FPGA, 'U' IS FOR USER
2525
2006 FE60 FC 92                      FDB USRCMD
2526
2007                                 ENDIF EXTOPT
2527
2008                                 IFD RTCOPT
2528
2009                                 FCC 'T'
2529
2010                                 FDB TIMSET
2530
2011                                 ENDIF RTCOPT
2531
2011                                 ENDIF RTCOPT
2532
2012                                 IFD TRAOPT
2533
2013                                 FCC "T"
2534
2014                                 FDB TRACE
2535
2015                                 ENDIF TRAOPT
2536
2015                                 ENDIF TRAOPT
2537
2016                         *
2538
2017 FE62                    TABEND  EQU *
2539
2018                         *
2540
2019                         * ** 6809 VECTOR ADDRESSES **
2541
2020                         *
2542
2021                         * FOLLOWING ARE THE ADDRESSES OF THE VECTOR ROUTINES
2543
2022                         * FOR THE 6809 PROCESSOR. DURING INITIALIZATION THEY
2544
2023                         * ARE RELOCATED TO RAM FROM $DFC0 TO $DFCF. THEY ARE
2545
2024                         * RELOCATED TO RAM SO THAT THE USER MAY REVECTOR TO
2546
2025                         * HIS OWN ROUTINES IF HE SO DESIRES.
2547
2026                         *
2548
2027                         *
2549
2028 FE62 F9 94              RAMVEC  FDB SWIE       ; USER-V
2550
2029 FE64 F8 A7                      FDB RTI        ; SWI3-V
2551
2030 FE66 F8 A7                      FDB RTI        ; SWI2-V
2552
2031 FE68 F8 A7                      FDB RTI        ; FIRQ-V
2553
2032 FE6A F8 A7                      FDB RTI        ; IRQ-V
2554
2033 FE6C F9 94                      FDB SWIE       ; SWI-V
2555
2034 FE6E FF FF                      FDB $FFFF      ; SVC-VO
2556
2035 FE70 FF FF                      FDB $FFFF      ; SVC-VL
2557
2036                         *
2558
2037                         * PRINTABLE MESSAGE STRINGS
2559
2038                         *
2560
2039 FE72 0D 0A 00 00 00     MSG1    FCB  $D,$A,$0,$0,$0 * 0, CR/LF, 0
2561
2040 FE77 53 59 53 30 39 42          FCC  'SYS09BUG 1.7 FOR '
2562
          55 47 20 31 2E 37
2563
          20 46 4F 52 20
2564
2041                                 IFD  SWTOPT
2565
2042                                 FCC  'SWTPC'
2566
2043                                 ENDIF SWTOPT
2567
2043                                 ENDIF SWTOPT
2568
2044                                 IFD  ADSOPT
2569
2045                                 FCC  'ADS6809'
2570
2046                                 ENDIF ADSOPT
2571
2046                                 ENDIF ADSOPT
2572
2047                                 IFD  B3SOPT
2573
2048                                 FCC  'B3-S2+'
2574
2049                                 ENDIF B3SOPT
2575
2049                                 ENDIF B3SOPT
2576
2050                                 IFD  B5XOPT
2577
2051                                 FCC  'B5-X300'
2578
2052                                 ENDIF B5XOPT
2579
2052                                 ENDIF B5XOPT
2580
2053                                 IFD  S3SOPT
2581
2054                                 FCC  'S3STARTER'
2582
2055                                 ENDIF S3SOPT
2583
2055                                 ENDIF S3SOPT
2584
2056                                 IFD  S3EOPT
2585
2057                                 FCC  'S3E'
2586
2058                                 ENDIF S3EOPT
2587
2058                                 ENDIF S3EOPT
2588
2059                                 IFD  XESOPT
2589
2060                                 FCC  'XESS'
2590
2061                                 ENDIF XESOPT
2591
2061                                 ENDIF XESOPT
2592
2062                                 IFD  DE270OPT
2593
2063 FE88 44 45 32 2D 37 30          FCC  'DE2-70'
2594
2064                                 ENDIF DE270OPT
2595
2065 FE8E 20 2D 20                   FCC ' - '
2596
2066 FE91 04                         FCB 4
2597
2067 FE92 4B 0D 0A 00 00 00  MSG2    FCB 'K,$0D,$0A,$00,$00,$00,$04 ; K,,,3 NULS,
2598
          04
2599
2068 FE99 3E                 MSG3    FCC '>'
2600
2069 FE9A 04                         FCB 4
2601
2070 FE9B 57 48 41 54 3F     MSG4    FCC 'WHAT?'
2602
2071 FEA0 04                         FCB 4
2603
2072 FEA1 20 2D 20           MSG5    FCC ' - '
2604
2073 FEA4 04                         FCB 4'
2605
2074 FEA5 20 20 53 50 3D     MSG10   FCC '  SP='
2606
2075 FEAA 04                         FCB 4
2607
2076 FEAB 20 20 50 43 3D     MSG11   FCC '  PC='
2608
2077 FEB0 04                         FCB 4
2609
2078 FEB1 20 20 55 53 3D     MSG12   FCC '  US='
2610
2079 FEB6 04                         FCB 4
2611
2080 FEB7 20 20 49 59 3D     MSG13   FCC '  IY='
2612
2081 FEBC 04                         FCB 4
2613
2082 FEBD 20 20 49 58 3D     MSG14   FCC '  IX='
2614
2083 FEC2 04                         FCB 4
2615
2084 FEC3 20 20 44 50 3D     MSG15   FCC '  DP='
2616
2085 FEC8 04                         FCB 4
2617
2086 FEC9 20 20 41 3D        MSG16   FCC '  A='
2618
2087 FECD 04                         FCB 4
2619
2088 FECE 20 20 42 3D        MSG17   FCC '  B='
2620
2089 FED2 04                         FCB 4
2621
2090 FED3 20 20 43 43 3A 20  MSG18   FCC '  CC: '
2622
2091 FED9 04                         FCB 4
2623
2092 FEDA 45 46 48 49 4E 5A  MSG19   FCC 'EFHINZVC'
2624
          56 43
2625
2093 FEE2 53 31              MSG20   FCC 'S1'
2626
2094 FEE4 04                         FCB 4
2627
2095                                 IFD DATOPT
2628
2096                         *
2629
2097                         * POWER UP/ RESET/ NMI ENTRY POINT
2630
2098                         *
2631
2099 FF00                            ORG $FF00
2632
2100                         *
2633
2101                         *
2634
2102 FF00 8E FF F0           START   LDX  #IC11    ; POINT TO DAT RAM IC11
2635
2103 FF03 86 0F                      LDA  #$0F     ; GET COMPLIMENT OF ZERO
2636
2104                         *
2637
2105                         *
2638
2106                         * INITIALIZE DAT RAM --- LOADS $F-$0 IN LOCATIONS $0-$F
2639
2107                         * OF DAT RAM, THUS STORING COMPLEMENT OF MSB OF ADDRESS
2640
2108                         * IN THE DAT RAM. THE COMPLEMENT IS REQUIRED BECAUSE THE
2641
2109                         * OUTPUT OF IC11, A 74S189, IS THE INVERSE OF THE DATA
2642
2110                         * STORED IN IT.
2643
2111                         *
2644
2112                         *
2645
2113 FF05 A7 80              DATLP   STA  ,X+       ; STORE & POINT TO NEXT RAM LOCATION
2646
2114 FF07 4A                         DECA           ; GET COMP. VALUE FOR NEXT LOCATION
2647
2115 FF08 26 FB                      BNE  DATLP     ; ALL 16 LOCATIONS INITIALIZED ?
2648
2116                         *
2649
2117                         * NOTE: IX NOW CONTAINS $0000, DAT RAM IS NO LONGER
2650
2118                         *       ADDRESSED, AND LOGICAL ADDRESSES NOW EQUAL
2651
2119                         *       PHYSICAL ADDRESSES.
2652
2120                         *
2653
2121 FF0A 86 F0                      LDA  #$F0
2654
2122 FF0C A7 84                      STA  ,X        ; STORE $F0 AT $FFFF
2655
2123 FF0E 8E D0 A0                   LDX  #$D0A0    ; ASSUME RAM TO BE AT $D000-$DFFF
2656
2124 FF11 10 8E 55 AA                LDY  #TSTPAT   ; LOAD TEST DATA PATTERN INTO "Y"
2657
2125 FF15 EE 84              TSTRAM  LDU  ,X        ; SAVE DATA FROM TEST LOCATION
2658
2126 FF17 10 AF 84                   STY  ,X        ; STORE TEST PATTERN AT $D0A0
2659
2127 FF1A 10 AC 84                   CMPY ,X        ; IS THERE RAM AT THIS LOCATION ?
2660
2128 FF1D 27 0B                      BEQ  CNVADR    ; IF MATCH THERE'S RAM, SO SKIP
2661
2129 FF1F 30 89 F0 00                LEAX -$1000,X  ; ELSE POINT 4K LOWER
2662
2130 FF23 8C F0 A0                   CMPX #$F0A0    ; DECREMENTED PAST ZER0 YET ?
2663
2131 FF26 26 ED                      BNE  TSTRAM    ; IF NOT CONTINUE TESTING FOR RAM
2664
2132 FF28 20 D6                      BRA  START     ; ELSE START ALL OVER AGAIN
2665
2133                         *
2666
2134                         *
2667
2135                         * THE FOLLOWING CODE STORES THE COMPLEMENT OF
2668
2136                         * THE MS CHARACTER OF THE FOUR CHARACTER HEX
2669
2137                         * ADDRESS OF THE FIRST 4K BLOCK OF RAM LOCATED
2670
2138                         * BY THE ROUTINE "TSTRAM" INTO THE DAT RAM. IT
2671
2139                         * IS STORED IN RAM IN THE LOCATION THAT IS
2672
2140                         * ADDRESSED WHEN THE PROCESSOR ADDRESS IS $D---,
2673
2141                         * THUS IF THE FIRST 4K BLOCK OF RAM IS FOUND
2674
2142                         * WHEN TESTING LOCATION $70A0, MEANING THERE
2675
2143                         * IS NO RAM PHYSICALLY ADDRESSED IN THE RANGE
2676
2144                         * $8000-$DFFF, THEN THE COMPLEMENT OF THE
2677
2145                         * "7" IN THE $70A0 WILL BE STORED IN
2678
2146                         * THE DAT RAM. THUS WHEN THE PROCESSOR OUTPUTS
2679
2147                         * AN ADDRESS OF $D---, THE DAT RAM WILL RESPOND
2680
2148                         * BY RECOMPLEMENTING THE "7" AND OUTPUTTING THE
2681
2149                         * 7 ONTO THE A12-A15 ADDRESS LINES. THUS THE
2682
2150                         * RAM THAT IS PHYSICALLY ADDRESSED AT $7---
2683
2151                         * WILL RESPOND AND APPEAR TO THE 6809 THAT IT
2684
2152                         * IS AT $D--- SINCE THAT IS THE ADDRESS THE
2685
2153                         * 6809 WILL BE OUTPUTING WHEN THAT 4K BLOCK
2686
2154                         * OF RAM RESPONDS.
2687
2155                         *
2688
2156                         *
2689
2157 FF2A EF 84              CNVADR  STU  ,X        ; RESTORE DATA AT TEST LOCATION
2690
2158 FF2C 1F 10                      TFR  X,D       ; PUT ADDR. OF PRESENT 4K BLOCK IN D
2691
2159 FF2E 43                         COMA           ; COMPLEMENT MSB OF THAT ADDRESS
2692
2160 FF2F 44                         LSRA           ; PUT MS 4 BITS OF ADDRESS IN
2693
2161 FF30 44                         LSRA           ; LOCATION D0-D3 TO ALLOW STORING
2694
2162 FF31 44                         LSRA           ; IT IN THE DYNAMIC ADDRESS
2695
2163 FF32 44                         LSRA           ; TRANSLATION RAM.
2696
2164 FF33 B7 FF FD                   STA  $FFFD     ; STORE XLATION FACTOR IN DAT "D"
2697
2165                         *
2698
2166 FF36 10 CE DF C0                LDS  #STACK    ; INITIALIZE STACK POINTER
2699
2167                         *
2700
2168                         *
2701
2169                         * THE FOLLOWING CHECKS TO FIND THE REAL PHYSICAL ADDRESSES
2702
2170                         * OF ALL 4K BLKS OF RAM IN THE SYSTEM. WHEN EACH 4K BLK
2703
2171                         * OF RAM IS LOCATED, THE COMPLEMENT OF IT'S REAL ADDRESS
2704
2172                         * IS THEN STORED IN A "LOGICAL" TO "REAL" ADDRESS XLATION
2705
2173                         * TABLE THAT IS BUILT FROM $DFD0 TO $DFDF. FOR EXAMPLE IF
2706
2174                         * THE SYSTEM HAS RAM THAT IS PHYSICALLY LOCATED (WIRED TO
2707
2175                         * RESPOND) AT THE HEX LOCATIONS $0--- THRU $F---....
2708
2176                         *
2709
2177                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2710
2178                         * 4K 4K 4K 4K 4K 4K 4K 4K -- 4K 4K 4K 4K -- -- --
2711
2179                         *
2712
2180                         * ....FOR A TOTAL OF 48K OF RAM, THEN THE TRANSLATION TABLE
2713
2181                         * CREATED FROM $DFD0 TO $DFDF WILL CONSIST OF THE FOLLOWING....
2714
2182                         *
2715
2183                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2716
2184                         * 0F 0E 0D 0C 0B 0A 09 08 06 05 00 00 04 03 F1 F0
2717
2185                         *
2718
2186                         *
2719
2187                         * HERE WE SEE THE LOGICAL ADDRESSES OF MEMORY FROM $0000-$7FFF
2720
2188                         * HAVE NOT BEEN SELECTED FOR RELOCATION SO THAT THEIR PHYSICAL
2721
2189                         * ADDRESS WILL = THEIR LOGICAL ADDRESS; HOWEVER, THE 4K BLOCK
2722
2190                         * PHYSICALLY AT $9000 WILL HAVE ITS ADDRESS TRANSLATED SO THAT
2723
2191                         * IT WILL LOGICALLY RESPOND AT $8000. LIKEWISE $A,$B, AND $C000
2724
2192                         * WILL BE TRANSLATED TO RESPOND TO $9000,$C000, AND $D000
2725
2193                         * RESPECTIVELY. THE USER SYSTEM WILL LOGICALLY APPEAR TO HAVE
2726
2194                         * MEMORY ADDRESSED AS FOLLOWS....
2727
2195                         *
2728
2196                         *  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2729
2197                         * 4K 4K 4K 4K 4K 4K 4K 4K 4K 4K -- -- 4K 4K -- --
2730
2198                         *
2731
2199                         *
2732
2200 FF3A 10 8E DF D0                LDY  #LRARAM   ; POINT TO LOGICAL/REAL ADDR. TABLE
2733
2201 FF3E A7 2D                      STA  13,Y      ; STORE $D--- XLATION FACTOR AT $DFDD
2734
2202 FF40 6F 2E                      CLR  14,Y      ; CLEAR $DFDE
2735
2203 FF42 86 F0                      LDA  #$F0      ; DESTINED FOR IC8 AN MEM EXPANSION ?
2736
2204 FF44 A7 2F                      STA  15,Y      ; STORE AT $DFDF
2737
2205 FF46 86 0C                      LDA  #$0C      ; PRESET NUMBER OF BYTES TO CLEAR
2738
2206 FF48 6F A6              CLRLRT  CLR  A,Y       ; CLEAR $DFDC THRU $DFD0
2739
2207 FF4A 4A                         DECA           ; SUB. 1 FROM BYTES LEFT TO CLEAR
2740
2208 FF4B 2A FB                      BPL  CLRLRT    ; CONTINUE IF NOT DONE CLEARING
2741
2209 FF4D 30 89 F0 00        FNDRAM  LEAX -$1000,X  ; POINT TO NEXT LOWER 4K OF RAM
2742
2210 FF51 8C F0 A0                   CMPX #$F0A0    ; TEST FOR DECREMENT PAST ZERO
2743
2211 FF54 27 22                      BEQ  FINTAB    ; SKIP IF FINISHED
2744
2212 FF56 EE 84                      LDU  ,X        ; SAVE DATA AT CURRENT TEST LOCATION
2745
2213 FF58 10 8E 55 AA                LDY  #TSTPAT   ; LOAD TEST DATA PATTERN INTO Y REG.
2746
2214 FF5C 10 AF 84                   STY  ,X        ; STORE TEST PATT. INTO RAM TEST LOC.
2747
2215 FF5F 10 AC 84                   CMPY ,X        ; VERIFY RAM AT TEST LOCATION
2748
2216 FF62 26 E9                      BNE  FNDRAM    ; IF NO RAM GO LOOK 4K LOWER
2749
2217 FF64 EF 84                      STU  ,X        ; ELSE RESTORE DATA TO TEST LOCATION
2750
2218 FF66 10 8E DF D0                LDY  #LRARAM   ; POINT TO LOGICAL/REAL ADDR. TABLE
2751
2219 FF6A 1F 10                      TFR  X,D       ; PUT ADDR. OF PRESENT 4K BLOCK IN D
2752
2220 FF6C 44                         LSRA           ; PUT MS 4 BITS OF ADDR. IN LOC. D0-D3
2753
2221 FF6D 44                         LSRA           ; TO ALLOW STORING IT IN THE DAT RAM.
2754
2222 FF6E 44                         LSRA
2755
2223 FF6F 44                         LSRA
2756
2224 FF70 1F 89                      TFR  A,B       ; SAVE OFFSET INTO LRARAM TABLE
2757
2225 FF72 88 0F                      EORA #$0F      ; INVERT MSB OF ADDR. OF CURRENT 4K BLK
2758
2226 FF74 A7 A5                      STA  B,Y       ; SAVE TRANSLATION FACTOR IN LRARAM TABLE
2759
2227 FF76 20 D5                      BRA  FNDRAM    ; GO TRANSLATE ADDR. OF NEXT 4K BLK
2760
2228 FF78 86 F1              FINTAB  LDA  #$F1      ; DESTINED FOR IC8 AND MEM EXPANSION ?
2761
2229 FF7A 10 8E DF D0                LDY  #LRARAM   ; POINT TO LRARAM TABLE
2762
2230 FF7E A7 2E                      STA  14,Y      ; STORE $F1 AT $DFCE
2763
2231                         *
2764
2232                         * THE FOLLOWING CHECKS TO SEE IF THERE IS A 4K BLK OF
2765
2233                         * RAM LOCATED AT $C000-$CFFF. IF NONE THERE IT LOCATES
2766
2234                         * THE NEXT LOWER 4K BLK AN XLATES ITS ADDR SO IT
2767
2235                         * LOGICALLY RESPONDS TO THE ADDRESS $C---.
2768
2236                         *
2769
2237                         *
2770
2238 FF80 86 0C                      LDA  #$0C      ; PRESET NUMBER HEX "C"
2771
2239 FF82 E6 A6              FINDC   LDB  A,Y       ; GET ENTRY FROM LRARAM TABLE
2772
2240 FF84 26 05                      BNE  FOUNDC    ; BRANCH IF RAM THIS PHYSICAL ADDR.
2773
2241 FF86 4A                         DECA           ; ELSE POINT 4K LOWER
2774
2242 FF87 2A F9                      BPL  FINDC     ; GO TRY AGAIN
2775
2243 FF89 20 14                      BRA  XFERTF
2776
2244 FF8B 6F A6              FOUNDC  CLR  A,Y       ; CLR XLATION FACTOR OF 4K BLOCK FOUND
2777
2245 FF8D E7 2C                      STB  $0C,Y     ; GIVE IT XLATION FACTOR MOVING IT TO $C---
2778
2246                         *
2779
2247                         * THE FOLLOWING CODE ADJUSTS THE TRANSLATION
2780
2248                         * FACTORS SUCH THAT ALL REMAINING RAM WILL
2781
2249                         * RESPOND TO A CONTIGUOUS BLOCK OF LOGICAL
2782
2250                         * ADDRESSES FROM $0000 AND UP....
2783
2251                         *
2784
2252 FF8F 4F                         CLRA           ; START AT ZERO
2785
2253 FF90 1F 21                      TFR  Y,X       ; START POINTER "X" START OF "LRARAM" TABLE.
2786
2254 FF92 E6 A6              COMPRS  LDB  A,Y       ; GET ENTRY FROM "LRARAM" TABLE
2787
2255 FF94 27 04                      BEQ  PNTNXT    ; IF IT'S ZER0 SKIP
2788
2256 FF96 6F A6                      CLR  A,Y       ; ELSE ERASE FROM TABLE
2789
2257 FF98 E7 80                      STB  ,X+       ; AND ENTER ABOVE LAST ENTRY- BUMP
2790
2258 FF9A 4C                 PNTNXT  INCA           ; GET OFFSET TO NEXT ENTRY
2791
2259 FF9B 81 0C                      CMPA #$0C      ; LAST ENTRY YET ?
2792
2260 FF9D 2D F3                      BLT  COMPRS
2793
2261                         *
2794
2262                         * THE FOLLOWING CODE TRANSFER THE TRANSLATION
2795
2263                         * FACTORS FROM THE LRARAM TABLE TO IC11 ON
2796
2264                         * THE MP-09 CPU CARD.
2797
2265                         *
2798
2266 FF9F 8E FF F0           XFERTF  LDX  #IC11     ; POINT TO DAT RAM IC11
2799
2267 FFA2 C6 10                      LDB  #$10      ; GET NO. OF BYTES TO MOVE
2800
2268 FFA4 A6 A0              FETCH   LDA  ,Y+       ; GET BYTE AND POINT TO NEXT
2801
2269 FFA6 A7 80                      STA  ,X+       ; POKE XLATION FACTOR IN IC11
2802
2270 FFA8 5A                         DECB           ; SUB 1 FROM BYTES TO MOVE
2803
2271 FFA9 26 F9                      BNE  FETCH     ; CONTINUE UNTIL 16 MOVED
2804
2272                         *
2805
2273                                 ELSE
2806
2274                         LRA     RTS
2807
2275                         START   LDS  #STACK    ; INITIALIZE STACK POINTER
2808
2276                                 CLRB
2809
2277                                 ENDIF DATOPT
2810
2277                                 ENDIF DATOPT
2811
2278                         *
2812
2279 FFAB 53                         COMB           ; SET "B" NON-ZERO
2813
2280 FFAC F7 DF E2                   STB  ECHO      ; TURN ON ECHO FLAG
2814
2281 FFAF 16 F8 62                   LBRA MONITOR   ; INITIALIZATION IS COMPLETE
2815
2282                         *
2816
2283                         ** INTERRUPT JUMP VECTORS
2817
2284                         *
2818
2285 FFB2 6E 9F DF C0        V1      JMP  [STACK]
2819
2286 FFB6 6E 9F DF C4        V2      JMP  [SWI2]
2820
2287 FFBA 6E 9F DF C6        V3      JMP  [FIRQ]
2821
2288 FFBE 6E 9F DF C8        V4      JMP  [IRQ]
2822
2289 FFC2 6E 9F DF CA        V5      JMP  [SWI]
2823
2290                         *
2824
2291                         * SWI3 ENTRY POINT
2825
2292                         *
2826
2293 FFC6 1F 43              SWI3E   TFR  S,U
2827
2294 FFC8 AE 4A                      LDX  10,U      *$FFC8
2828
2295 FFCA E6 80                      LDB  ,X+
2829
2296 FFCC AF 4A                      STX  10,U
2830
2297 FFCE 4F                         CLRA
2831
2298 FFCF 58                         ASLB
2832
2299 FFD0 49                         ROLA
2833
2300 FFD1 BE DF CC                   LDX  SVCVO
2834
2301 FFD4 8C FF FF                   CMPX #$FFFF
2835
2302 FFD7 27 0F                      BEQ  SWI3Z
2836
2303 FFD9 30 8B                      LEAX D,X
2837
2304 FFDB BC DF CE                   CMPX SVCVL
2838
2305 FFDE 22 08                      BHI  SWI3Z
2839
2306 FFE0 34 10                      PSHS X
2840
2307 FFE2 EC C4                      LDD  ,U
2841
2308 FFE4 AE 44                      LDX  4,U
2842
2309 FFE6 6E F1                      JMP  [,S++]
2843
2310 FFE8 37 1F              SWI3Z   PULU A,B,X,CC,DP
2844
2311 FFEA EE 42                      LDU  2,U
2845
2312 FFEC 6E 9F DF C2                JMP  [SWI3]
2846
2313                         *
2847
2314                         * 6809 VECTORS
2848
2315                         *
2849
2316 FFF0                            ORG $FFF0
2850
2317 FFF0 FF B2                      FDB V1    USER-V
2851
2318 FFF2 FF C6                      FDB SWI3E SWI3-V
2852
2319 FFF4 FF B6                      FDB V2    SWI2-V
2853
2320 FFF6 FF BA                      FDB V3    FIRQ-V
2854
2321 FFF8 FF BE                      FDB V4    IRQ-V
2855
2322 FFFA FF C2                      FDB V5    SWI-V
2856
2323 FFFC FF B2                      FDB V1    NMI-V
2857
2324 FFFE FF 00                      FDB START RESTART-V
2858
0004                                 END START
2859
0005                          END
2860
Program + Init Data = 2021 bytes
2861
Error count = 0

powered by: WebSVN 2.1.0

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