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

Subversion Repositories rf6809

[/] [rf6809/] [trunk/] [software/] [boot/] [boot_rom.lst] - Blame information for rev 13

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

Line No. Rev Author Line
1 13 robfinch
 
2 4 robfinch
                              ; ============================================================================
3
                              ;        __
4 13 robfinch
                              ;   \\__/ o\    (C) 2013-2022  Robert Finch, Waterloo
5 4 robfinch
                              ;    \  __ /    All rights reserved.
6
                              ;     \/_//     robfinch@opencores.org
7
                              ;       ||
8
                              ;
9
                              ;
10 13 robfinch
                              ; BSD 3-Clause License
11
                              ; Redistribution and use in source and binary forms, with or without
12
                              ; modification, are permitted provided that the following conditions are met:
13
                              ;
14
                              ; 1. Redistributions of source code must retain the above copyright notice, this
15
                              ;    list of conditions and the following disclaimer.
16
                              ;
17
                              ; 2. Redistributions in binary form must reproduce the above copyright notice,
18
                              ;    this list of conditions and the following disclaimer in the documentation
19
                              ;    and/or other materials provided with the distribution.
20
                              ;
21
                              ; 3. Neither the name of the copyright holder nor the names of its
22
                              ;    contributors may be used to endorse or promote products derived from
23
                              ;    this software without specific prior written permission.
24
                              ;
25
                              ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
                              ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
                              ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
                              ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29
                              ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
                              ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
                              ; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
                              ; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33
                              ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
                              ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 4 robfinch
                              ;
36
                              ; ============================================================================
37
                              ;
38
                              CR      EQU     $0D             ;ASCII equates
39
                              LF      EQU     $0A
40
                              TAB     EQU     $09
41
                              CTRLC   EQU     $03
42
                              CTRLH   EQU     $08
43
                              CTRLI   EQU     $09
44
                              CTRLJ   EQU     $0A
45
                              CTRLK   EQU     $0B
46
                              CTRLM   EQU $0D
47
                              CTRLS   EQU     $13
48 13 robfinch
                              CTRLT EQU $14
49 4 robfinch
                              CTRLX   EQU     $18
50
                              XON             EQU     $11
51
                              XOFF    EQU     $13
52
 
53
                              FIRST_CORE      EQU     1
54
                              MAX_TASKNO      EQU 63
55
                              DRAM_BASE       EQU $10000000
56
 
57
                              ScreenLocation          EQU             $10
58
                              ColorCodeLocation       EQU             $14
59
                              ScreenLocation2         EQU             $18
60
                              BlkcpySrc                       EQU             $1C
61
                              BlkcpyDst                       EQU             $20
62
                              Strptr                          EQU             $24
63
                              PICptr                          EQU             $28
64
                              ; Forth Area
65
                              ; 0x30-0x60
66
 
67
                              RunningID                       EQU             $800000
68
 
69
                              ; Task control blocks, room for 256 tasks
70
                              TCB_NxtRdy              EQU             $00     ; next task on ready / timeout list
71
                              TCB_PrvRdy              EQU             $04     ; previous task on ready / timeout list
72
                              TCB_NxtTCB              EQU             $08
73
                              TCB_Timeout             EQU             $0C
74
                              TCB_Priority    EQU             $10
75
                              TCB_MSGPTR_D1   EQU             $14
76
                              TCB_MSGPTR_D2   EQU             $18
77
                              TCB_hJCB                        EQU             $1C
78
                              TCB_Status              EQU             $1E
79
                              TCB_CursorRow   EQU             $20
80
                              TCB_CursorCol   EQU             $21
81
                              TCB_hWaitMbx    EQU             $22     ; handle of mailbox task is waiting at
82
                              TCB_mbq_next    EQU             $24     ; mailbox queue next
83
                              TCB_mbq_prev    EQU             $28     ; mailbox queue previous
84
                              TCB_iof_next    EQU             $2C
85
                              TCB_iof_prev    EQU             $30
86
                              TCB_SPSave              EQU             $34     ; TCB_SPSave area
87
                              TCB_mmu_map             EQU             $38
88
 
89
                              KeybdHead               EQU             $FFFFFC800
90
                              KeybdTail               EQU             $FFFFFC900
91
                              KeybdEcho               EQU             $FFFFFCA00
92
                              KeybdBad                EQU             $FFFFFCB00
93
                              KeybdAck                EQU             $FFFFFCC00
94
                              KeybdLocks              EQU             $FFFFFCD00
95
                              KeybdBuffer             EQU             $FFFFFC000      ; buffer is 16 chars
96
 
97
                              COREID  EQU             $FFFFFFFE0
98
                              MSCOUNT EQU             $FFFFFFFE4
99 13 robfinch
                              LEDS            EQU             $FFFE60001
100
                              VIA                     EQU             $FFFE60000
101
                              VIA_PA          EQU             1
102
                              VIA_DDRA        EQU             3
103
                              VIA_ACR                 EQU             11
104
                              VIA_IFR                 EQU             13
105
                              VIA_IER                 EQU             14
106
                              VIA_T3LL                EQU             18
107
                              VIA_T3LH                EQU             19
108
                              VIA_T3CMPL      EQU             20
109
                              VIA_T3CMPH      EQU             21
110 4 robfinch
                              TEXTSCR         EQU             $FFFE00000
111
                              TEXTREG         EQU             $FFFE0DF00
112
                              TEXT_COLS       EQU             0
113
                              TEXT_ROWS       EQU             1
114
                              TEXT_CURPOS     EQU             34
115 13 robfinch
                              ACIA            EQU             $FFFE30100
116
                              ACIA_TX         EQU             0
117
                              ACIA_RX         EQU             0
118
                              ACIA_STAT       EQU             1
119
                              ACIA_CMD        EQU             2
120
                              ACIA_CTRL       EQU             3
121
                              ACIA_CTRL2      EQU             11
122
                              RTC                             EQU             $FFFE30500      ; I2C
123
                              RTCBuf          EQU             $7FC0
124
 
125 4 robfinch
                              KEYBD           EQU             $FFFE30400
126
                              KEYBDCLR        EQU             $FFFE30402
127
                              PIC                     EQU             $FFFE3F000
128
                              SPRITE_CTRL             EQU             $FFFE10000
129
                              SPRITE_EN                       EQU             $3C0
130
 
131 13 robfinch
                              OUTSEMA EQU     $EF0000
132
                              SEMAABS EQU     $1000
133
                              OSSEMA  EQU     $EF0010
134
 
135 4 robfinch
                              BIOS_SCREENS    EQU     $17000000       ; $17000000 to $171FFFFF
136
 
137
                              ; EhBASIC vars:
138
                              ;
139 13 robfinch
                              NmiBase         EQU             $FF0013
140
                              IrqBase         EQU             $FF0014
141 4 robfinch
 
142
                              IOFocusNdx      EQU             $100
143
 
144 13 robfinch
                              ; These variables in global OS storage area
145
 
146
                              IOFocusList     EQU             $FF0000 ; to $FF000F
147
                              IOFocusID               EQU             $FF0010
148
                              IrqSource               EQU             $FF0011
149
                              IRQFlag                 EQU             $FF0012
150
 
151 4 robfinch
                              ; These variables use direct page access
152
                              CursorRow       EQU             $110
153
                              CursorCol       EQU             $111
154
                              CharColor       EQU             $112
155
                              ScreenColor     EQU             $113
156
                              CursorFlash     EQU             $114
157
                              KeyState1       EQU     $120
158
                              KeyState2       EQU     $121
159
                              KeyLED          EQU     $122
160
                              KeybdID         EQU     $124
161 13 robfinch
                              KeybdBlock      EQU     $126
162
                              kbdHeadRcv      EQU     $127
163
                              kbdTailRcv      EQU     $128
164
                              kbdFifo                 EQU     $40                             ; in local RAM
165
                              kbdFifoAlias    EQU     $C00040 ; to $C0007F    ; alias for $40 to $7F
166
                              SerhZero                EQU     $130
167
                              SerHeadRcv      EQU     $131
168
                              SertZero                EQU     $132
169
                              SerTailRcv      EQU     $133
170
                              SerHeadXmit     EQU     $136
171
                              SerTailXmit     EQU     $138
172
                              SerRcvXon               EQU     $139
173
                              SerRcvXoff      EQU     $140
174
                              SerRcvBuf               EQU     $BFF000 ; 4kB serial recieve buffer
175 4 robfinch
 
176 13 robfinch
                              asmbuf  EQU             $160    ; to $17F
177
 
178 4 robfinch
                              QNdx0           EQU             $780
179
                              QNdx1           EQU             QNdx0+2
180
                              QNdx2           EQU             QNdx1+2
181
                              QNdx3           EQU             QNdx2+2
182
                              QNdx4           EQU             QNdx3+2
183
                              FreeTCB         EQU             QNdx4+2
184
                              TimeoutList     EQU             FreeTCB+2
185
                              FreeMbx         EQU             RunningTCB + 2
186
                              nMailbox        EQU             FreeMbx + 2
187
                              FreeMsg         EQU             nMailbox + 2
188
                              nMsgBlk         EQU             FreeMsg + 2
189
 
190
 
191
                              CharOutVec      EQU             $800
192
                              CharInVec       EQU             $804
193 13 robfinch
                              CmdPromptJI     EQU     $808
194 4 robfinch
 
195
                              ; Register save area for monitor
196
                              mon_DSAVE       EQU             $900
197
                              mon_XSAVE       EQU             $902
198
                              mon_YSAVE       EQU             $904
199
                              mon_USAVE       EQU             $906
200
                              mon_SSAVE       EQU             $908
201
                              mon_PCSAVE      EQU             $90A
202
                              mon_DPRSAVE     EQU             $90E
203
                              mon_CCRSAVE     EQU             $90F
204
 
205
                              mon_numwka      EQU             $910
206
                              mon_r1          EQU             $920
207 13 robfinch
                              mon_r2          EQU             $924
208 4 robfinch
 
209
                              ; The ORG directive must set an address a multiple of 4 in order for the Verilog
210
                              ; output to work correctly.
211
 
212
                                      org             $FFD0AC
213
 00FFD0AC 012                             nop
214
 00FFD0AD 012                             nop
215
 00FFD0AE 012                             nop
216
                              XBLANK
217
 00FFD0AF 0C6020                          ldb             #' '
218 13 robfinch
 00FFD0B1 017001C5E                       lbsr    OUTCH
219 4 robfinch
 00FFD0B4 039                             rts
220
 
221
                                      org             $FFD0D0
222
 00FFD0D0 012                             nop
223
 00FFD0D1 012                             nop
224
                              CRLF
225
                              CRLF1:
226
 00FFD0D2 0C600D                          ldb             #CR
227 13 robfinch
 00FFD0D4 017001C3B                       lbsr    OUTCH
228 4 robfinch
 00FFD0D7 0C600A                          ldb             #LF
229 13 robfinch
 00FFD0D9 017001C36                       lbsr    OUTCH
230 4 robfinch
 00FFD0DC 039                             rts
231
 
232
                                      org             $FFD0F0
233
 00FFD0F0 012                             nop
234
 00FFD0F1 020FDF                          bra             CRLF1
235
 
236
                                      org             $FFD1DC
237
                              ONEKEY
238
 00FFD1DC 06E90F000804                    jmp             [CharInVec]
239
 
240
                                      org             $FFD2C0
241
 00FFD2C0 012                             nop
242
                              LETTER
243 13 robfinch
 00FFD2C1 017001A4E                       lbsr    OUTCH
244 4 robfinch
 00FFD2C4 039                             rts
245
 
246
                                      org             $FFD2CC
247
 00FFD2CC 012                             nop
248
 00FFD2CD 012                             nop
249
                              HEX2
250 13 robfinch
 00FFD2CE 017001125                       lbsr    DispByteAsHex
251 4 robfinch
 00FFD2D1 039                             rts
252
                              HEX4
253 13 robfinch
 00FFD2D2 017001118                       lbsr    DispWordAsHex
254 4 robfinch
 00FFD2D5 039                             rts
255
 
256
                                      org             $FFD300
257
                              ClearScreenJmp
258 13 robfinch
 00FFD300 016000F0E                       lbra    ClearScreen
259 4 robfinch
                                      org             $FFD308
260
                              HomeCursorJmp
261 13 robfinch
 00FFD308 016000F79                       lbra    HomeCursor
262 4 robfinch
 
263 13 robfinch
                                      org             $FFD400
264 4 robfinch
 
265
                              ; Local RAM test routine
266
                              ; Checkerboard testing.
267
                              ; There is 70kB of local RAM
268
                              ; Does not use any RAM including no stack
269
 
270
                              ramtest:
271 13 robfinch
 00FFD400 18E000000                       ldy             #0
272
 00FFD403 086001                          lda             #1
273
 00FFD405 0150B7FFFE60001                 sta             LEDS
274
 00FFD40A 0CCAAA555                       ldd             #$AAA555
275 4 robfinch
                              ramtest1:
276 13 robfinch
 00FFD40D 0EDA01                          std             ,y++
277
 00FFD40F 18C008000                       cmpy    #$8000
278
 00FFD412 025FF9                          blo             ramtest1
279 4 robfinch
                                      ; now readback values and compare
280 13 robfinch
 00FFD414 18E000000                       ldy             #0
281 4 robfinch
                              ramtest3:
282 13 robfinch
 00FFD417 0ECA01                          ldd             ,y++
283
 00FFD419 183AAA555                       cmpd    #$AAA555
284
 00FFD41C 02600E                          bne             ramerr
285
 00FFD41E 18C008000                       cmpy    #$8000
286
 00FFD421 025FF4                          blo             ramtest3
287
 00FFD423 086002                          lda             #2
288
 00FFD425 0150B7FFFE60001                 sta             LEDS
289
 00FFD42A 06EC04                          jmp             ,u
290 4 robfinch
                              ramerr:
291 13 robfinch
 00FFD42C 086080                          lda             #$80
292
 00FFD42E 0150B7FFFE60001                 sta             LEDS
293
 00FFD433 08EE00000                       ldx             #TEXTSCR
294
 00FFD436 0150F6FFFFFFFE0                 ldb             COREID
295
 00FFD43B 03A                             abx
296
 00FFD43C 086046                          lda             #'F'
297
 00FFD43E 0A7804                          sta             ,x
298
 00FFD440 013                             sync
299
 00FFD441 06EC04                          jmp             ,u
300 4 robfinch
 
301 13 robfinch
                                      org             $FFE000
302
 00FFE000 FFF8AC                          FDB Monitor
303
 00FFE002 FFE022                          FDB DumRts      ;       NEXTCMD
304
 00FFE004 FFECDA                          FDB INCH
305
 00FFE006 FFECF8                          FDB INCHE
306
 00FFE008 FFECFC                          FDB INCHEK
307
 00FFE00A FFED12                          FDB OUTCH
308
 00FFE00C FFE3DA                          FDB PDATA
309
 00FFE00E FFE3CD                          FDB PCRLF
310
 00FFE010 FFE3C9                          FDB PSTRNG
311
 00FFE012 FFE022                          FDB DumRts                      ; LRA
312
 00FFE014 FFE022                          FDB DumRts
313
 00FFE016 FFE022                          FDB DumRts
314
 00FFE018 FFE022                          FDB DumRts
315
 00FFE01A FFE022                          FDB DumRts                      ; VINIZ
316
 00FFE01C FFE2E1                          FDB DisplayChar ;       VOUTCH
317
 00FFE01E FFE022                          FDB DumRts                      ; ACINIZ
318
 00FFE020 FFE022                          FDB DumRts                      ; AOUTCH
319 4 robfinch
 
320
                              DumRts:
321 13 robfinch
 00FFE022 039                             rts
322 4 robfinch
 
323
                              ;------------------------------------------------------------------------------
324
                              ;------------------------------------------------------------------------------
325
 
326
                              start:
327 13 robfinch
 00FFE023 086FFF                          lda             #$FFF                   ; all cores can do this
328
 00FFE025 0150B7FFFE60003                 sta             VIA+VIA_DDRA
329
 00FFE02A 086055                          lda             #$55                    ; see if we can at least set LEDs
330
 00FFE02C 0150B7FFFE60001                 sta             LEDS
331
 00FFE031 086001                          lda             #1                              ; prime OS semaphore
332
 00FFE033 0B7EF1010                       sta             OSSEMA+$1000
333
 00FFE036 0CEFFE03C                       ldu             #st6                    ; U = return address
334
 00FFE039 07EFFD400                       jmp             ramtest         ; JMP dont JSR
335 4 robfinch
                              st6:
336 13 robfinch
 00FFE03C 1CE006FFF                       lds             #$6FFF          ; boot up stack area
337
 00FFE03F 0150B6FFFFFFFE0                 lda             COREID
338
 00FFE044 081001                          cmpa    #FIRST_CORE
339 4 robfinch
                              ;       beq             st8
340
                              ;       sync                                            ; halt cores other than 2
341
                              st8:
342
                              ;       bne             skip_init
343
                              ;       bsr             romToRam
344
                              ;       ldd             #st7 & $FFFF
345
                              ;       tfr             d,x
346
                              ;       jmp             ,x                              ; jump to the BIOS now in local RAM
347
                              st7:
348 13 robfinch
 00FFE046 08D145                          bsr             Delay3s         ; give some time for devices to reset
349
 00FFE048 0860AA                          lda             #$AA
350
 00FFE04A 0150B7FFFE60001                 sta             LEDS
351
 00FFE04F 086001                          lda             #FIRST_CORE
352
 00FFE051 0B7FF0010                       sta             IOFocusID       ; core #2 has focus
353
 00FFE054 0B7800000                       sta             RunningID
354
 00FFE057 0860CE                          lda             #$0CE
355
 00FFE059 097113                          sta             ScreenColor
356
 00FFE05B 097112                          sta             CharColor
357
 00FFE05D 08D1B2                          bsr             ClearScreen
358
 00FFE05F 0CCFFE2E1                       ldd             #DisplayChar
359
 00FFE062 0FD000800                       std             CharOutVec
360
 00FFE065 0CCFFEBE4                       ldd             #SerialPeekCharDirect
361
 00FFE068 0FD000804                       std             CharInVec
362
 00FFE06B 0C6018                          ldb             #24                             ; request IO focus
363
 00FFE06D 017000CE9                       lbsr    OSCall
364
 00FFE070 0150F6FFFFFFFE0                 ldb             COREID
365
 00FFE075 0C1001                          cmpb    #FIRST_CORE
366
 00FFE077 02700D                          beq             init
367
 00FFE079 020046                          bra             skip_init
368
 00FFE07B 0200AE                          bra             multi_sieve
369 4 robfinch
                              st3:
370 13 robfinch
 00FFE07D 0860FF                          lda             #$FF
371
 00FFE07F 0150B7FFFE60001                 sta             LEDS
372
 00FFE084 020FF7                          bra             st3
373 4 robfinch
 
374
                                      ; initialize interrupt controller
375
                                      ; first, zero out all the vectors
376
                              init:
377 13 robfinch
 00FFE086 01700042A                       lbsr    rtc_read        ; get clock values
378
 00FFE089 08E000127                       ldx             #kbdHeadRcv
379
 00FFE08C 0C6020                          ldb             #32                             ; number of bytes to zero out
380
                              init1:
381
 00FFE08E 06F800                          clr             ,x+
382
 00FFE090 05A                             decb
383
 00FFE091 026FFB                          bne             init1
384
 00FFE093 01700038E                       lbsr    TimerInit
385
 00FFE096 017000AD6                       lbsr    InitSerial
386
 00FFE099 08E000080                       ldx             #128
387
 00FFE09C 086001                          lda             #1                      ; set irq(bit0), clear firq (bit1), disable int (bit 6), clear edge sense(bit 7)
388
 00FFE09E 0C6001                          ldb             #FIRST_CORE                     ; serving core id
389 4 robfinch
                              st1:
390 13 robfinch
 00FFE0A0 06F809E3F000                    clr             PIC,x                   ; cause code
391
 00FFE0A4 0A7809E3F001                    sta             PIC+1,x
392
 00FFE0A8 0E7809E3F002                    stb             PIC+2,x
393
 00FFE0AC 030004                          leax    4,x
394
 00FFE0AE 08C000100                       cmpx    #256
395
 00FFE0B1 025FED                          blo             st1
396 4 robfinch
                              ;       lda             #4                              ; make the timer interrupt edge sensitive
397
                              ;       sta             PIC+4                   ; reg #4 is the edge sensitivity setting
398
                              ;       sta             PIC                             ; reg #0 is interrupt enable
399 13 robfinch
 00FFE0B3 086081                          lda             #$81                    ; make irq edge sensitive
400
 00FFE0B5 0150B7FFFE3F0FD                 sta             PIC+$FD
401
 00FFE0BA 08601F                          lda             #31                             ; enable timer interrupt
402
                              ;       sta             PIC+9
403
 00FFE0BC 0C6001                          ldb             #1
404
 00FFE0BE 0F7EF1000                       stb             OUTSEMA+SEMAABS ; set semaphore to 1 available slot
405 4 robfinch
                              skip_init:
406 13 robfinch
 00FFE0C1 01C0EF                          andcc   #$EF                    ; unmask irq
407
 00FFE0C3 086038                          lda             #56
408
 00FFE0C5 0150B7FFFE0DF00                 sta             TEXTREG+TEXT_COLS
409
 00FFE0CA 08601D                          lda             #29
410
 00FFE0CC 0150B7FFFE0DF01                 sta             TEXTREG+TEXT_ROWS
411
 00FFE0D1 08D13E                          bsr             ClearScreen
412
 00FFE0D3 08D1AF                          bsr             HomeCursor
413
 00FFE0D5 086005                          lda             #5
414
 00FFE0D7 0150B7FFFE60001                 sta             LEDS
415
 00FFE0DC 0CCFFE0F4                       ldd             #msgStartup
416
 00FFE0DF 08D2C1                          bsr             DisplayString
417
 00FFE0E1 08E000000                       ldx             #0
418
 00FFE0E4 0CC000000                       ldd             #0
419
 00FFE0E7 017000C32                       lbsr    ShowSprites
420
 00FFE0EA 017000853                       lbsr    KeybdInit
421
 00FFE0ED 0DC124                          ldd             KeybdID
422
 00FFE0EF 08D2FC                          bsr             DispWordAsHex
423
 00FFE0F1 07EFFF89A                       jmp             MonitorStart
424 4 robfinch
 
425
                              msgStartup
426 13 robfinch
 00FFE0F4 072066036038030039020           fcb             "rf6809 12-bit System Starting.",CR,LF,0
427
 00FFE0FB 03103202D062069074020
428
 00FFE102 05307907307406506D020
429
 00FFE109 05307406107207406906E
430
 00FFE110 06702E00D00A000
431 4 robfinch
 
432
                              ;------------------------------------------------------------------------------
433
                              ; The checkpoint register must be cleared within 1 second or a NMI interrupt
434
                              ; will occur. checkpoint should be called with a JSR so that the global ROM
435
                              ; routine is called.
436
                              ;
437
                              ; Modifies:
438
                              ;               none
439
                              ;------------------------------------------------------------------------------
440
 
441
                              checkpoint:
442 13 robfinch
 00FFE115 01507FFFFFFFFE1                 clr             $FFFFFFFE1      ; writing any value will do
443
 00FFE11A 039                             rts
444 4 robfinch
 
445
                              ;------------------------------------------------------------------------------
446
                              ; Copy the system ROM to local RAM
447
                              ; Running the code from local RAM is probably an order of magnitude faster
448
                              ; then running from the global ROM. It also reduces the network traffic to
449
                              ; run from local RAM.
450
                              ;
451
                              ; Modifies:
452
                              ;               d,x,y
453
                              ;------------------------------------------------------------------------------
454
 
455
                              romToRam:
456 13 robfinch
 00FFE11B 08EFFC000                       ldx             #$FFC000
457
 00FFE11E 18E00C000                       ldy             #$00C000
458 4 robfinch
                              romToRam1:
459 13 robfinch
 00FFE121 0EC801                          ldd             ,x++
460
 00FFE123 0EDA01                          std             ,y++
461
 00FFE125 08C000000                       cmpx    #0
462
 00FFE128 026FF7                          bne             romToRam1
463
 00FFE12A 039                             rts
464 4 robfinch
 
465
                              ;------------------------------------------------------------------------------
466
                              ; Multi-core sieve program.
467
                              ;------------------------------------------------------------------------------
468
 
469
                              ; First fill screen chars with 'P' indicating prime positions
470
                              ; Each core is responsible for the Nth position where N is the
471
                              ; core number minus two.
472
                              ;
473
                              multi_sieve:
474 13 robfinch
 00FFE12B 086050                          lda             #'P'                                    ; indicate prime
475
 00FFE12D 0150F6FFFFFFFE0                 ldb             COREID                          ; find out which core we are
476
 00FFE132 0C0001                          subb    #FIRST_CORE
477
 00FFE134 08E000000                       ldx             #0                                              ; start at first char of screen
478
 00FFE137 03A                             abx
479 4 robfinch
                              multi_sieve3:
480 13 robfinch
 00FFE138 0A7809E00000                    sta             TEXTSCR,x                       ; store 'P'
481
 00FFE13C 030008                          leax    8,x                                             ; advance to next position
482
 00FFE13E 08C000FFF                       cmpx    #4095
483
 00FFE141 025FF5                          blo             multi_sieve3
484
 00FFE143 0BDFFE115                       jsr             checkpoint
485 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
486 13 robfinch
 00FFE146 0CB002                          addb    #2                                              ; start sieve at 2 (core id)
487
 00FFE148 08604E                          lda             #'N'                                    ; flag position value of 'N' for non-prime
488 4 robfinch
                              multi_sieve2:
489 13 robfinch
 00FFE14A 08E000000                       ldx             #0
490
 00FFE14D 03A                             abx                                                                     ; skip the first position - might be prime
491 4 robfinch
                              multi_sieve1:
492 13 robfinch
 00FFE14E 03A                             abx                                                                     ; increment
493
 00FFE14F 0A7809E00000                    sta             TEXTSCR,x
494
 00FFE153 08C000FFF                       cmpx    #4095
495
 00FFE156 025FF6                          blo             multi_sieve1
496
 00FFE158 0BDFFE115                       jsr             checkpoint
497 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
498 13 robfinch
 00FFE15B 0CB008                          addb    #8                                              ; number of cores working on it
499
 00FFE15D 0C1FF0                          cmpb    #4080
500
 00FFE15F 025FE9                          blo             multi_sieve2
501 4 robfinch
                              multi_sieve4:                                   ; hang machine
502 13 robfinch
 00FFE161 013                             sync
503
 00FFE162 016001747                       lbra    Monitor
504 4 robfinch
 
505 13 robfinch
                              ;------------------------------------------------------------------------------
506
                              ; Single core sieve.
507
                              ;------------------------------------------------------------------------------
508
 
509 4 robfinch
                              sieve:
510 13 robfinch
 00FFE165 086050                          lda             #'P'                                    ; indicate prime
511
 00FFE167 08E000000                       ldx             #0                                              ; start at first char of screen
512 4 robfinch
                              sieve3:
513 13 robfinch
 00FFE16A 0A7809E00000                    sta             TEXTSCR,x                       ; store 'P'
514
 00FFE16E 030001                          inx                                                                     ; advance to next position
515
 00FFE170 08C000FFF                       cmpx    #4095
516
 00FFE173 025FF5                          blo             sieve3
517
 00FFE175 0C6002                          ldb             #2                                              ; start sieve at 2
518
 00FFE177 08604E                          lda             #'N'                                    ; flag position value of 'N' for non-prime
519 4 robfinch
                              sieve2:
520 13 robfinch
 00FFE179 08E000000                       ldx             #0
521
 00FFE17C 03A                             abx                                                                     ; skip the first position - might be prime
522 4 robfinch
                              sieve1:
523 13 robfinch
 00FFE17D 03A                             abx                                                                     ; increment
524
 00FFE17E 0A7809E00000                    sta             TEXTSCR,x
525
 00FFE182 08C000FFF                       cmpx    #4095
526
 00FFE185 025FC7                          blo             multi_sieve1
527
 00FFE187 05C                             incb                                                            ; number of cores working on it
528
 00FFE188 0C1FF0                          cmpb    #4080
529
 00FFE18A 025FED                          blo             sieve2
530 4 robfinch
                              sieve4:                                                         ; hang machine
531 13 robfinch
 00FFE18C 039                             rts
532 4 robfinch
 
533
                              ;------------------------------------------------------------------------------
534
                              ; Three second delay for user convenience and to allow some devices time to
535
                              ; reset.
536
                              ;------------------------------------------------------------------------------
537
 
538
                              Delay3s:
539 13 robfinch
 00FFE18D 0CC895440                       ldd             #9000000
540 4 robfinch
                              dly3s1:
541 13 robfinch
 00FFE190 0C10FF                          cmpb    #$FF
542
 00FFE192 026000                          bne             dly3s2
543 4 robfinch
                              dly3s2:
544 13 robfinch
 00FFE194 0150B7FFFE60001                 sta             LEDS
545
 00FFE199 083000001                       subd    #1
546
 00FFE19C 026FF2                          bne             dly3s1
547
 00FFE19E 039                             rts
548 4 robfinch
 
549
                              ;------------------------------------------------------------------------------
550
                              ;------------------------------------------------------------------------------
551
                              ShiftLeft5:
552 13 robfinch
 00FFE19F 058                             aslb
553
 00FFE1A0 049                             rola
554
 00FFE1A1 058                             aslb
555
 00FFE1A2 049                             rola
556
 00FFE1A3 058                             aslb
557
 00FFE1A4 049                             rola
558
 00FFE1A5 058                             aslb
559
 00FFE1A6 049                             rola
560
 00FFE1A7 058                             aslb
561
 00FFE1A8 049                             rola
562
 00FFE1A9 039                             rts
563 4 robfinch
 
564
                              ;------------------------------------------------------------------------------
565 13 robfinch
                              ; Parameters:
566
                              ;               b = core id of core to copy
567 4 robfinch
                              ;------------------------------------------------------------------------------
568
                              ;
569
                              CopyVirtualScreenToScreen:
570 13 robfinch
 00FFE1AA 034076                          pshs    d,x,y,u
571
                                      ; Compute virtual screen location for core passed in accb.
572
 00FFE1AC 01F098                          tfr             b,a
573
 00FFE1AE 048                             asla
574
 00FFE1AF 048                             asla
575
 00FFE1B0 048                             asla
576
 00FFE1B1 048                             asla
577
 00FFE1B2 08AC00                          ora             #$C00
578
 00FFE1B4 05F                             clrb
579
 00FFE1B5 01F001                          tfr             d,x
580
 00FFE1B7 034006                          pshs    d
581
 00FFE1B9 18EE00000                       ldy             #TEXTSCR
582
 00FFE1BC 0CE00032C                       ldu             #56*29/2
583 4 robfinch
                              cv2s1:
584 13 robfinch
 00FFE1BF 0EC801                          ldd             ,x++
585
 00FFE1C1 0EDA01                          std             ,y++
586
 00FFE1C3 0335FF                          leau    -1,u
587
 00FFE1C5 283000000                       cmpu    #0
588
 00FFE1C8 026FF5                          bne             cv2s1
589 4 robfinch
                                      ; reset the cursor position in the text controller
590 13 robfinch
 00FFE1CA 035010                          puls    x
591
 00FFE1CC 0E6808110                       ldb             CursorRow,x
592
 00FFE1CF 086038                          lda             #56
593
 00FFE1D1 03D                             mul
594
 00FFE1D2 01F002                          tfr             d,y
595
 00FFE1D4 0E6808111                       ldb             CursorCol,x
596
 00FFE1D7 01F021                          tfr             y,x
597
 00FFE1D9 03A                             abx
598
 00FFE1DA 0150BFFFFE0DF22                 stx             TEXTREG+TEXT_CURPOS
599
 00FFE1DF 0350F6                          puls    d,x,y,u,pc
600 4 robfinch
 
601
                              ;------------------------------------------------------------------------------
602
                              ;------------------------------------------------------------------------------
603
                              ;
604
                              CopyScreenToVirtualScreen:
605 13 robfinch
 00FFE1E1 034076                          pshs    d,x,y,u
606
 00FFE1E3 08D08D                          bsr             GetScreenLocation
607
 00FFE1E5 01F002                          tfr             d,y
608
 00FFE1E7 08EE00000                       ldx             #TEXTSCR
609
 00FFE1EA 0CE00032C                       ldu             #56*29/2
610 4 robfinch
                              cs2v1:
611 13 robfinch
 00FFE1ED 0EC801                          ldd             ,x++
612
 00FFE1EF 0EDA01                          std             ,y++
613
 00FFE1F1 0335FF                          leau    -1,u
614
 00FFE1F3 283000000                       cmpu    #0
615
 00FFE1F6 026FF5                          bne             cs2v1
616
 00FFE1F8 0350F6                          puls    d,x,y,u,pc
617 4 robfinch
 
618
                              ;------------------------------------------------------------------------------
619
                              ;------------------------------------------------------------------------------
620 13 robfinch
 00FFE1FA 054045058054053043052           fcb             "TEXTSCR "
621
 00FFE201 020
622
 00FFE202 FFE20C                          fcw             TextOpen
623
 00FFE204 FFE20D                          fcw             TextClose
624
 00FFE206 FFE20E                          fcw             TextRead
625
 00FFE208 FFE20F                          fcw             TextWrite
626
 00FFE20A FFE210                          fcw             TextSeek
627 4 robfinch
 
628
                              TextOpen:
629 13 robfinch
 00FFE20C 039                             rts
630 4 robfinch
                              TextClose:
631 13 robfinch
 00FFE20D 039                             rts
632 4 robfinch
                              TextRead:
633 13 robfinch
 00FFE20E 039                             rts
634 4 robfinch
                              TextWrite:
635 13 robfinch
 00FFE20F 039                             rts
636 4 robfinch
                              TextSeek:
637 13 robfinch
 00FFE210 039                             rts
638 4 robfinch
 
639
                              ;------------------------------------------------------------------------------
640
                              ; Clear the screen and the screen color memory
641
                              ; We clear the screen to give a visual indication that the system
642
                              ; is working at all.
643
                              ;
644
                              ; Modifies:
645
                              ;               none
646
                              ;------------------------------------------------------------------------------
647
 
648
                              ClearScreen:
649 13 robfinch
 00FFE211 034076                          pshs    d,x,y,u
650
 00FFE213 08E000658                       ldx             #56*29
651
 00FFE216 01F013                          tfr             x,u
652
 00FFE218 08D058                          bsr             GetScreenLocation
653
 00FFE21A 01F002                          tfr             d,y
654
 00FFE21C 0C6020                          ldb             #' '                            ; space char
655 4 robfinch
                              cs1:
656 13 robfinch
 00FFE21E 0E7A00                          stb             ,y+                                     ; set text to space
657
 00FFE220 0301FF                          leax    -1,x                            ; decrement x
658
 00FFE222 026FFA                          bne             cs1
659
 00FFE224 0150F6FFFFFFFE0                 ldb             COREID                  ; update colors only if we have focus
660
 00FFE229 0F1FF0010                       cmpb    IOFocusID
661
 00FFE22C 02000D                          bra             cs3
662
 00FFE22E 18EE02000                       ldy             #TEXTSCR+$2000
663 4 robfinch
                              ;       lda             CharColor
664 13 robfinch
 00FFE231 0860CE                          lda             #$0CE
665
 00FFE233 01F031                          tfr             u,x                                     ; get back count
666 4 robfinch
                              cs2:
667 13 robfinch
 00FFE235 0A7A00                          sta             ,y+
668
 00FFE237 0301FF                          dex                                                             ; decrement x
669
 00FFE239 026FFA                          bne             cs2
670 4 robfinch
                              cs3:
671 13 robfinch
 00FFE23B 0350F6                          puls    d,x,y,u,pc
672 4 robfinch
 
673
                              ;------------------------------------------------------------------------------
674
                              ; Scroll text on the screen upwards
675
                              ;
676
                              ; Modifies:
677
                              ;               none
678
                              ;------------------------------------------------------------------------------
679
 
680
                              ScrollUp:
681 13 robfinch
 00FFE23D 034076                          pshs    d,x,y,u
682
 00FFE23F 18E00032B                       ldy             #(56*29-1)/2    ; y = num chars/2 to move
683
 00FFE242 08D02E                          bsr             GetScreenLocation
684
 00FFE244 01F001                          tfr             d,x
685
 00FFE246 01F003                          tfr             d,u
686
 00FFE248 030038                          leax    56,x                    ; x = index to source row
687 4 robfinch
                              scrup1:
688 13 robfinch
 00FFE24A 0EC801                          ldd             ,x++                    ; move 2 characters
689
 00FFE24C 0EDC01                          std             ,u++
690
 00FFE24E 0313FF                          dey
691
 00FFE250 026FF8                          bne             scrup1
692
 00FFE252 08601D                          lda             #29
693
 00FFE254 08D002                          bsr             BlankLine
694
 00FFE256 0350F6                          puls    d,x,y,u,pc
695 4 robfinch
 
696
                              ;------------------------------------------------------------------------------
697
                              ; Blank out a line on the display
698
                              ;
699
                              ; Modifies:
700
                              ;               none
701
                              ; Parameters:
702
                              ;       acca = line number to blank
703
                              ;------------------------------------------------------------------------------
704
 
705
                              BlankLine:
706 13 robfinch
 00FFE258 034016                          pshs    d,x
707
 00FFE25A 034002                          pshs    a
708
 00FFE25C 08D014                          bsr             GetScreenLocation
709
 00FFE25E 01F001                          tfr             d,x
710
 00FFE260 035002                          puls    a
711
 00FFE262 0C6038                          ldb             #56             ; b = # chars to blank out from video controller
712
 00FFE264 03D                             mul                                     ; d = screen index (row# * #cols)
713
 00FFE265 03080B                          leax    d,x
714
 00FFE267 086020                          lda             #' '
715
 00FFE269 0C6038                          ldb             #56             ; b = # chars to blank out from video controller
716 4 robfinch
                              blnkln1:
717 13 robfinch
 00FFE26B 0A7800                          sta             ,x+
718
 00FFE26D 05A                             decb
719
 00FFE26E 026FFB                          bne             blnkln1
720
 00FFE270 035096                          puls    d,x,pc
721 4 robfinch
 
722
                              ;------------------------------------------------------------------------------
723
                              ; Get the location of the screen memory. The location
724
                              ; depends on whether or not the task has the output focus.
725
                              ;
726
                              ; Modifies:
727
                              ;               d
728
                              ; Retuns:
729
                              ;               d = screen location
730
                              ;------------------------------------------------------------------------------
731
 
732
                              GetScreenLocation:
733 13 robfinch
 00FFE272 0150B6FFFFFFFE0                 lda             COREID                  ; which core are we?
734
 00FFE277 0B1FF0010                       cmpa    IOFocusID               ; do we have the IO focus
735
 00FFE27A 026004                          bne             gsl1                            ; no, go pick virtual screen address
736
 00FFE27C 0CCE00000                       ldd             #TEXTSCR                ; yes, we update the real screen
737
 00FFE27F 039                             rts
738 4 robfinch
                              gsl1:
739 13 robfinch
 00FFE280 0CC007800                       ldd             #$7800
740
 00FFE283 039                             rts
741 4 robfinch
 
742
                              ;------------------------------------------------------------------------------
743
                              ; HomeCursor
744
                              ; Set the cursor location to the top left of the screen.
745
                              ;
746
                              ; Modifies:
747
                              ;               none
748
                              ;------------------------------------------------------------------------------
749
 
750
                              HomeCursor:
751 13 robfinch
 00FFE284 034016                          pshs    d,x
752
 00FFE286 00F110                          clr             CursorRow
753
 00FFE288 00F111                          clr             CursorCol
754
 00FFE28A 0150F6FFFFFFFE0                 ldb             COREID
755
 00FFE28F 0F1FF0010                       cmpb    IOFocusID
756
 00FFE292 026006                          bne             hc1
757
 00FFE294 04F                             clra
758
 00FFE295 0150B7FFFE0DF22                 sta             TEXTREG+TEXT_CURPOS
759 4 robfinch
                              hc1:
760 13 robfinch
 00FFE29A 035096                          puls    d,x,pc
761 4 robfinch
 
762
                              ;------------------------------------------------------------------------------
763
                              ; Update the cursor position in the text controller based on the
764
                              ;  CursorRow,CursorCol.
765
                              ;
766
                              ; Modifies:
767
                              ;               none
768
                              ;------------------------------------------------------------------------------
769
                              ;
770
                              UpdateCursorPos:
771 13 robfinch
 00FFE29C 034016                          pshs    d,x
772
 00FFE29E 0150F6FFFFFFFE0                 ldb             COREID                          ; update cursor position in text controller
773
 00FFE2A3 0F1FF0010                       cmpb    IOFocusID                       ; only for the task with the output focus
774
 00FFE2A6 026014                          bne             ucp1
775
 00FFE2A8 096110                          lda             CursorRow
776
 00FFE2AA 08403F                          anda    #$3F                                    ; limit of 63 rows
777
 00FFE2AC 0150F6FFFE0DF00                 ldb             TEXTREG+TEXT_COLS
778
 00FFE2B1 03D                             mul
779
 00FFE2B2 01F001                          tfr             d,x
780
 00FFE2B4 0D6111                          ldb             CursorCol
781
 00FFE2B6 03A                             abx
782
 00FFE2B7 0150BFFFFE0DF22                 stx             TEXTREG+TEXT_CURPOS
783 4 robfinch
                              ucp1:
784 13 robfinch
 00FFE2BC 035096                          puls    d,x,pc
785 4 robfinch
 
786
                              ;------------------------------------------------------------------------------
787
                              ; Calculate screen memory location from CursorRow,CursorCol.
788
                              ; Also refreshes the cursor location.
789
                              ;
790
                              ; Modifies:
791
                              ;               d
792
                              ; Returns:
793
                              ;       d = screen location
794
                              ;------------------------------------------------------------------------------
795
                              ;
796
                              CalcScreenLoc:
797 13 robfinch
 00FFE2BE 034010                          pshs    x
798
 00FFE2C0 096110                          lda             CursorRow
799
 00FFE2C2 0C6038                          ldb             #56
800
 00FFE2C4 03D                             mul
801
 00FFE2C5 01F001                          tfr             d,x
802
 00FFE2C7 0D6111                          ldb             CursorCol
803
 00FFE2C9 03A                             abx
804
 00FFE2CA 0150F6FFFFFFFE0                 ldb             COREID                          ; update cursor position in text controller
805
 00FFE2CF 0F1FF0010                       cmpb    IOFocusID                       ; only for the task with the output focus
806
 00FFE2D2 026005                          bne             csl1
807
 00FFE2D4 0150BFFFFE0DF22                 stx             TEXTREG+TEXT_CURPOS
808 4 robfinch
                              csl1:
809 13 robfinch
 00FFE2D9 08DF97                          bsr             GetScreenLocation
810
 00FFE2DB 03080B                          leax    d,x
811
 00FFE2DD 01F010                          tfr             x,d
812
 00FFE2DF 035090                          puls    x,pc
813 4 robfinch
 
814
                              ;------------------------------------------------------------------------------
815
                              ; Display a character on the screen.
816
                              ; If the task doesn't have the I/O focus then the character is written to
817
                              ; the virtual screen.
818
                              ;
819
                              ; Modifies:
820
                              ;               none
821
                              ; Parameters:
822
                              ;       accb = char to display
823
                              ;------------------------------------------------------------------------------
824
                              ;
825
                              DisplayChar:
826 13 robfinch
 00FFE2E1 017000924                       lbsr    SerialPutChar
827
 00FFE2E4 034016                          pshs    d,x
828
 00FFE2E6 0C100D                          cmpb    #CR                                     ; carriage return ?
829
 00FFE2E8 026007                          bne             dccr
830
 00FFE2EA 00F111                          clr             CursorCol               ; just set cursor column to zero on a CR
831
 00FFE2EC 08DFAE                          bsr             UpdateCursorPos
832 4 robfinch
                              dcx14:
833 13 robfinch
 00FFE2EE 01600008C                       lbra            dcx4
834 4 robfinch
                              dccr:
835 13 robfinch
 00FFE2F1 0C1091                          cmpb    #$91                            ; cursor right ?
836
 00FFE2F3 02600D                          bne             dcx6
837
 00FFE2F5 096111                          lda             CursorCol
838
 00FFE2F7 081038                          cmpa    #56
839
 00FFE2F9 024003                          bhs             dcx7
840
 00FFE2FB 04C                             inca
841
 00FFE2FC 097111                          sta             CursorCol
842 4 robfinch
                              dcx7:
843 13 robfinch
 00FFE2FE 08DF9C                          bsr             UpdateCursorPos
844
 00FFE300 035096                          puls    d,x,pc
845 4 robfinch
                              dcx6:
846 13 robfinch
 00FFE302 0C1090                          cmpb    #$90                            ; cursor up ?
847
 00FFE304 026009                          bne             dcx8
848
 00FFE306 096110                          lda             CursorRow
849
 00FFE308 027FF4                          beq             dcx7
850
 00FFE30A 04A                             deca
851
 00FFE30B 097110                          sta             CursorRow
852
 00FFE30D 020FEF                          bra             dcx7
853 4 robfinch
                              dcx8:
854 13 robfinch
 00FFE30F 0C1093                          cmpb    #$93                            ; cursor left ?
855
 00FFE311 026009                          bne             dcx9
856
 00FFE313 096111                          lda             CursorCol
857
 00FFE315 027FE7                          beq             dcx7
858
 00FFE317 04A                             deca
859
 00FFE318 097111                          sta             CursorCol
860
 00FFE31A 020FE2                          bra             dcx7
861 4 robfinch
                              dcx9:
862 13 robfinch
 00FFE31C 0C1092                          cmpb    #$92                            ; cursor down ?
863
 00FFE31E 02600B                          bne             dcx10
864
 00FFE320 096110                          lda             CursorRow
865
 00FFE322 08101D                          cmpa    #29
866
 00FFE324 027FD8                          beq             dcx7
867
 00FFE326 04C                             inca
868
 00FFE327 097110                          sta             CursorRow
869
 00FFE329 020FD3                          bra             dcx7
870 4 robfinch
                              dcx10:
871 13 robfinch
 00FFE32B 0C1094                          cmpb    #$94                            ; cursor home ?
872
 00FFE32D 02600C                          bne             dcx11
873
 00FFE32F 096111                          lda             CursorCol
874
 00FFE331 027004                          beq             dcx12
875
 00FFE333 00F111                          clr             CursorCol
876
 00FFE335 020FC7                          bra             dcx7
877 4 robfinch
                              dcx12:
878 13 robfinch
 00FFE337 00F110                          clr             CursorRow
879
 00FFE339 020FC3                          bra             dcx7
880 4 robfinch
                              dcx11:
881 13 robfinch
 00FFE33B 0C1099                          cmpb    #$99                            ; delete ?
882
 00FFE33D 026008                          bne             dcx13
883
 00FFE33F 08DF7D                          bsr             CalcScreenLoc
884
 00FFE341 01F001                          tfr             d,x
885
 00FFE343 096111                          lda             CursorCol               ; acc = cursor column
886
 00FFE345 020011                          bra             dcx5
887 4 robfinch
                              dcx13
888 13 robfinch
 00FFE347 0C1008                          cmpb    #CTRLH                  ; backspace ?
889
 00FFE349 02601E                          bne             dcx3
890
 00FFE34B 096111                          lda             CursorCol
891
 00FFE34D 02702E                          beq             dcx4
892
 00FFE34F 04A                             deca
893
 00FFE350 097111                          sta             CursorCol
894
 00FFE352 08DF6A                          bsr             CalcScreenLoc
895
 00FFE354 01F001                          tfr             d,x
896
 00FFE356 096111                          lda             CursorCol
897 4 robfinch
                              dcx5:
898 13 robfinch
 00FFE358 0E6001                          ldb             1,x
899
 00FFE35A 0E7801                          stb             ,x++
900
 00FFE35C 04C                             inca
901
 00FFE35D 081038                          cmpa    #56
902
 00FFE35F 025FF7                          blo             dcx5
903
 00FFE361 0C6020                          ldb             #' '
904
 00FFE363 0301FF                          dex
905
 00FFE365 0E7804                          stb             ,x
906
 00FFE367 020014                          bra             dcx4
907 4 robfinch
                              dcx3:
908 13 robfinch
 00FFE369 0C100A                          cmpb    #LF                             ; linefeed ?
909
 00FFE36B 02700E                          beq             dclf
910
 00FFE36D 034004                          pshs    b
911
 00FFE36F 08DF4D                          bsr     CalcScreenLoc
912
 00FFE371 01F001                          tfr             d,x
913
 00FFE373 035004                          puls    b
914
 00FFE375 0E7804                          stb             ,x
915 4 robfinch
                                      ; ToDo character color
916
                              ;       lda             CharColor
917
                              ;       sta             $2000,x
918 13 robfinch
 00FFE377 08D006                          bsr             IncCursorPos
919
 00FFE379 020002                          bra             dcx4
920 4 robfinch
                              dclf:
921 13 robfinch
 00FFE37B 08D011                          bsr             IncCursorRow
922 4 robfinch
                              dcx4:
923 13 robfinch
 00FFE37D 035096                          puls    d,x,pc
924 4 robfinch
 
925
                              ;------------------------------------------------------------------------------
926
                              ; Increment the cursor position, scroll the screen if needed.
927
                              ;
928
                              ; Modifies:
929
                              ;               none
930
                              ;------------------------------------------------------------------------------
931
 
932
                              IncCursorPos:
933 13 robfinch
 00FFE37F 034016                          pshs    d,x
934
 00FFE381 096111                          lda             CursorCol
935
 00FFE383 04C                             inca
936
 00FFE384 097111                          sta             CursorCol
937
 00FFE386 081038                          cmpa    #56
938
 00FFE388 025014                          blo             icc1
939
 00FFE38A 00F111                          clr             CursorCol               ; column = 0
940
 00FFE38C 020002                          bra             icr1
941 4 robfinch
                              IncCursorRow:
942 13 robfinch
 00FFE38E 034016                          pshs    d,x
943 4 robfinch
                              icr1:
944 13 robfinch
 00FFE390 096110                          lda             CursorRow
945
 00FFE392 04C                             inca
946
 00FFE393 097110                          sta             CursorRow
947
 00FFE395 08101D                          cmpa    #29
948
 00FFE397 025005                          blo             icc1
949
 00FFE399 04A                             deca                                                    ; backup the cursor row, we are scrolling up
950
 00FFE39A 097110                          sta             CursorRow
951
 00FFE39C 08DE9F                          bsr             ScrollUp
952 4 robfinch
                              icc1:
953 13 robfinch
 00FFE39E 08DEFC                          bsr             UpdateCursorPos
954 4 robfinch
                              icc2:
955 13 robfinch
 00FFE3A0 035096                          puls    d,x,pc
956 4 robfinch
 
957
                              ;------------------------------------------------------------------------------
958
                              ; Display a string on the screen.
959
                              ;
960
                              ; Modifies:
961
                              ;               none
962
                              ; Parameters:
963
                              ;               d = pointer to string
964
                              ;------------------------------------------------------------------------------
965
                              ;
966
                              DisplayString:
967 13 robfinch
 00FFE3A2 034016                          pshs    d,x
968
 00FFE3A4 01F001                          tfr             d,x
969
                              dspj2:                                          ; lock semaphore for access
970
 00FFE3A6 0B6EF0001                       lda             OUTSEMA+1
971
 00FFE3A9 027FFB                          beq             dspj2
972 4 robfinch
                              dspj1B:
973 13 robfinch
 00FFE3AB 0E6800                          ldb             ,x+                             ; move string char into acc
974
 00FFE3AD 027005                          beq             dsretB          ; is it end of string ?
975
 00FFE3AF 017000960                       lbsr    OUTCH                   ; display character
976
 00FFE3B2 020FF7                          bra             dspj1B
977 4 robfinch
                              dsretB:
978 13 robfinch
 00FFE3B4 07FEF0001                       clr             OUTSEMA+1       ; unlock semaphore
979
 00FFE3B7 035096                          puls    d,x,pc
980 4 robfinch
 
981
                              DisplayStringCRLF:
982 13 robfinch
 00FFE3B9 034006                          pshs    d
983
 00FFE3BB 08DFE5                          bsr             DisplayString
984
 00FFE3BD 0C600D                          ldb             #CR
985
 00FFE3BF 017000950                       lbsr    OUTCH
986
 00FFE3C2 0C600A                          ldb             #LF
987
 00FFE3C4 01700094B                       lbsr    OUTCH
988
 00FFE3C7 035086                          puls    d,pc
989 4 robfinch
 
990
                              ;
991
                              ; PRINT CR, LF, STRING
992
                              ;
993
                              PSTRNG
994 13 robfinch
 00FFE3C9 08D002                          BSR             PCRLF
995
 00FFE3CB 02000D                          BRA             PDATA
996 4 robfinch
                              PCRLF
997 13 robfinch
 00FFE3CD 034010                          PSHS    X
998
 00FFE3CF 08EFFE3E1                       LDX             #CRLFST
999
 00FFE3D2 08D006                          BSR             PDATA
1000
 00FFE3D4 035010                          PULS    X
1001
 00FFE3D6 039                             RTS
1002 4 robfinch
 
1003
                              PRINT
1004 13 robfinch
 00FFE3D7 0BDFFED12                       JSR             OUTCH
1005 4 robfinch
                              PDATA
1006 13 robfinch
 00FFE3DA 0E6800                          LDB             ,X+
1007
 00FFE3DC 0C1004                          CMPB    #$04
1008
 00FFE3DE 026FF7                          BNE             PRINT
1009
 00FFE3E0 039                             RTS
1010 4 robfinch
 
1011
                              CRLFST
1012 13 robfinch
 00FFE3E1 00D00A004                       fcb     CR,LF,4
1013 4 robfinch
 
1014
                              DispDWordAsHex:
1015 13 robfinch
 00FFE3E4 08D007                          bsr             DispWordAsHex
1016
 00FFE3E6 01E001                          exg             d,x
1017
 00FFE3E8 08D003                          bsr             DispWordAsHex
1018
 00FFE3EA 01E001                          exg             d,x
1019
 00FFE3EC 039                             rts
1020 4 robfinch
 
1021
                              DispWordAsHex:
1022 13 robfinch
 00FFE3ED 01E089                          exg             a,b
1023
 00FFE3EF 08D005                          bsr             DispByteAsHex
1024
 00FFE3F1 01E089                          exg             a,b
1025
 00FFE3F3 08D001                          bsr             DispByteAsHex
1026
 00FFE3F5 039                             rts
1027 4 robfinch
 
1028
                              DispByteAsHex:
1029 13 robfinch
 00FFE3F6 034004                    pshs  b
1030
 00FFE3F8 054                             lsrb
1031
 00FFE3F9 054                             lsrb
1032
 00FFE3FA 054                             lsrb
1033
 00FFE3FB 054                             lsrb
1034
 00FFE3FC 054                             lsrb
1035
 00FFE3FD 054                             lsrb
1036
 00FFE3FE 054                             lsrb
1037
 00FFE3FF 054                             lsrb
1038
 00FFE400 08D00C                          bsr             DispNyb
1039
 00FFE402 035004                          puls    b
1040
 00FFE404 034004                          pshs    b
1041
 00FFE406 054                             lsrb
1042
 00FFE407 054                             lsrb
1043
 00FFE408 054                             lsrb
1044
 00FFE409 054                             lsrb
1045
 00FFE40A 08D002                          bsr             DispNyb
1046
 00FFE40C 035004                          puls    b
1047 4 robfinch
 
1048
                              DispNyb
1049 13 robfinch
 00FFE40E 034004                          pshs    b
1050
 00FFE410 0C400F                          andb    #$0F
1051
 00FFE412 0C100A                          cmpb    #10
1052
 00FFE414 025007                          blo             DispNyb1
1053
 00FFE416 0CB037                          addb    #'A'-10
1054
 00FFE418 0170008F7                       lbsr    OUTCH
1055
 00FFE41B 035084                          puls    b,pc
1056 4 robfinch
                              DispNyb1
1057 13 robfinch
 00FFE41D 0CB030                          addb    #'0'
1058
 00FFE41F 0170008F0                       lbsr    OUTCH
1059
 00FFE422 035084                          puls    b,pc
1060 4 robfinch
 
1061
                              ;==============================================================================
1062 13 robfinch
                              ; Timer
1063
                              ;==============================================================================
1064
 
1065
                              ; ============================================================================
1066
                              ;        __
1067
                              ;   \\__/ o\    (C) 2022  Robert Finch, Waterloo
1068
                              ;    \  __ /    All rights reserved.
1069
                              ;     \/_//     robfinch@opencores.org
1070
                              ;       ||
1071
                              ;
1072
                              ;
1073
                              ; Timer routines for a WDC6522 compatible circuit.
1074
                              ;
1075
                              ; This source file is free software: you can redistribute it and/or modify
1076
                              ; it under the terms of the GNU Lesser General Public License as published
1077
                              ; by the Free Software Foundation, either version 3 of the License, or
1078
                              ; (at your option) any later version.
1079
                              ;
1080
                              ; This source file is distributed in the hope that it will be useful,
1081
                              ; but WITHOUT ANY WARRANTY; without even the implied warranty of
1082
                              ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1083
                              ; GNU General Public License for more details.
1084
                              ;
1085
                              ; You should have received a copy of the GNU General Public License
1086
                              ; along with this program.  If not, see .
1087
                              ;
1088
                              ; ============================================================================
1089
                              ;
1090
                              TimerInit:
1091
 00FFE424 0CC061A80                       ldd             #$61A80                                 ; compare to 400000 (100 Hz assuming 40MHz clock)
1092
 00FFE427 0150F7FFFE60014                 stb             VIA+VIA_T3CMPL
1093
 00FFE42C 0150B7FFFE60015                 sta             VIA+VIA_T3CMPH
1094
 00FFE431 01507FFFFE60012                 clr             VIA+VIA_T3LL
1095
 00FFE436 01507FFFFE60013                 clr             VIA+VIA_T3LH
1096
 00FFE43B 0150B6FFFE6000B                 lda             VIA+VIA_ACR                     ; set continuous mode for timer
1097
 00FFE440 08A100                          ora             #$100
1098
 00FFE442 0150B7FFFE6000B                 sta             VIA+VIA_ACR                     ; enable timer #3 interrupts
1099
 00FFE447 086810                          lda             #$810
1100
 00FFE449 0150B7FFFE6000E                 sta             VIA+VIA_IER
1101
 00FFE44E 039                             rts
1102
 
1103
                              TimerIRQ:
1104
                                      ; Reset the edge sense circuit in the PIC
1105
 00FFE44F 08601F                          lda             #31                                                     ; Timer is IRQ #31
1106
 00FFE451 0B7FF0011                       sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
1107
 00FFE454 0150B7FFFE3F010                 sta             PIC+16                                  ; register 16 is edge sense reset reg
1108
 00FFE459 0150B6FFFE6000D                 lda             VIA+VIA_IFR
1109
 00FFE45E 02A011                          bpl             notTimerIRQ
1110
 00FFE460 085800                          bita    #$800
1111
 00FFE462 02700D                          beq             notTimerIRQ
1112
 00FFE464 01507FFFFE60012                 clr             VIA+VIA_T3LL
1113
 00FFE469 01507FFFFE60013                 clr             VIA+VIA_T3LH
1114
 00FFE46E 07CE00037                       inc             $E00037                                 ; update timer IRQ screen flag
1115
                              notTimerIRQ:
1116
 00FFE471 039                             rts
1117
 
1118
 
1119
 
1120
                              ; ============================================================================
1121
                              ;        __
1122
                              ;   \\__/ o\    (C) 2013-2022  Robert Finch, Waterloo
1123
                              ;    \  __ /    All rights reserved.
1124
                              ;     \/_//     robfinch@opencores.org
1125
                              ;       ||
1126
                              ;
1127
                              ;
1128
                              ; BSD 3-Clause License
1129
                              ; Redistribution and use in source and binary forms, with or without
1130
                              ; modification, are permitted provided that the following conditions are met:
1131
                              ;
1132
                              ; 1. Redistributions of source code must retain the above copyright notice, this
1133
                              ;    list of conditions and the following disclaimer.
1134
                              ;
1135
                              ; 2. Redistributions in binary form must reproduce the above copyright notice,
1136
                              ;    this list of conditions and the following disclaimer in the documentation
1137
                              ;    and/or other materials provided with the distribution.
1138
                              ;
1139
                              ; 3. Neither the name of the copyright holder nor the names of its
1140
                              ;    contributors may be used to endorse or promote products derived from
1141
                              ;    this software without specific prior written permission.
1142
                              ;
1143
                              ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1144
                              ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1145
                              ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1146
                              ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
1147
                              ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1148
                              ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1149
                              ; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1150
                              ; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1151
                              ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1152
                              ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1153
                              ;
1154
                              ; ============================================================================
1155
                              ;
1156
                              ;===============================================================================
1157
                              ; Generic I2C routines
1158
                              ;
1159
                              ; It is assumed there may be more than one I2C controller in the system, so
1160
                              ; the address of the controller is passed in the X register.
1161
                              ;===============================================================================
1162
 
1163
                              I2C_PREL        EQU             $0
1164
                              I2C_PREH        EQU             $1
1165
                              I2C_CTRL        EQU             $2
1166
                              I2C_RXR         EQU             $3
1167
                              I2C_TXR         EQU             $3
1168
                              I2C_CMD         EQU             $4
1169
                              I2C_STAT        EQU             $4
1170
 
1171
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1172
                              ; i2c initialization, sets the clock prescaler
1173
                              ;
1174
                              ; Parameters:
1175
                              ;               x = I2C controller address
1176
                              ; Returns: none
1177
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1178
 
1179
                              _i2c_init:
1180
 00FFE472 034004                          pshs    b
1181
 00FFE474 0C6004                          ldb             #4                                                                      ; setup prescale for 400kHz clock
1182
 00FFE476 0E7804                          stb             I2C_PREL,x
1183
 00FFE478 06F001                          clr             I2C_PREH,x
1184
 00FFE47A 035084                          puls    b,pc
1185
 
1186
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1187
                              ; Wait for I2C transfer to complete
1188
                              ;
1189
                              ; Parameters
1190
                              ;       x - I2C controller base address
1191
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1192
 
1193
                              i2c_wait_tip:
1194
 00FFE47C 034004                          pshs            b
1195
                              i2cw1:
1196
 00FFE47E 0E6004                          ldb                     I2C_STAT,x              ; would use lvb, but lb is okay since its the I/O area
1197
 00FFE480 0C5001                          bitb            #1                                              ; wait for tip to clear
1198
 00FFE482 026FFA                          bne                     i2cw1
1199
 00FFE484 035084                          puls            b,pc
1200
 
1201
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1202
                              ; Write command to i2c
1203
                              ;
1204
                              ; Parameters
1205
                              ;               accb - data to transmit
1206
                              ;               acca - command value
1207
                              ;               x       - I2C controller base address
1208
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1209
 
1210
                              i2c_wr_cmd:
1211
 00FFE486 0E7003                          stb             I2C_TXR,x
1212
 00FFE488 0A7004                          sta             I2C_CMD,x
1213
 00FFE48A 08DFF0                          bsr             i2c_wait_tip
1214
 00FFE48C 0E6004                          ldb             I2C_STAT,x
1215
 00FFE48E 039                             rts
1216
 
1217
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1218
                              ; Parameters
1219
                              ;               x - I2C controller base address
1220
                              ;               accb - data to send
1221
                              ; Returns: none
1222
                              ; Stack space: 2 words
1223
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1224
 
1225
                              _i2c_xmit1:
1226
 00FFE48F 034006                          pshs    d                                                               ; save data value
1227
 00FFE491 034006                          pshs    d                                                               ; and save it again
1228
 00FFE493 0C6001                          ldb             #1
1229
 00FFE495 0E7002                          stb             I2C_CTRL,x                      ; enable the core
1230
 00FFE497 0C6076                          ldb             #$76                                            ; set slave address = %0111011
1231
 00FFE499 086090                          lda             #$90                                            ; set STA, WR
1232
 00FFE49B 08DFE9                          bsr             i2c_wr_cmd
1233
 00FFE49D 08D00A                          bsr             i2c_wait_rx_nack
1234
 00FFE49F 035006                          puls    d                                                               ; get back data value
1235
 00FFE4A1 086050                          lda             #$50                                            ; set STO, WR
1236
 00FFE4A3 08DFE1                          bsr             i2c_wr_cmd
1237
 00FFE4A5 08D002                          bsr             i2c_wait_rx_nack
1238
 00FFE4A7 035086                          puls    d,pc
1239
 
1240
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1241
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1242
 
1243
                              i2c_wait_rx_nack:
1244
 00FFE4A9 034004                          pshs    b                                                               ; save off accb
1245
                              i2cwr1:
1246
 00FFE4AB 0E6004                          ldb             I2C_STAT,x                      ; wait for RXack = 0
1247
 00FFE4AD 0C5080                          bitb    #$80                                            ; test for nack
1248
 00FFE4AF 026FFA                          bne             i2cwr1
1249
 00FFE4B1 035084                          puls    b,pc
1250
 
1251
                              ; ============================================================================
1252
                              ;        __
1253
                              ;   \\__/ o\    (C) 2022  Robert Finch, Waterloo
1254
                              ;    \  __ /    All rights reserved.
1255
                              ;     \/_//     robfinch@opencores.org
1256
                              ;       ||
1257
                              ;
1258
                              ;
1259
                              ; BSD 3-Clause License
1260
                              ; Redistribution and use in source and binary forms, with or without
1261
                              ; modification, are permitted provided that the following conditions are met:
1262
                              ;
1263
                              ; 1. Redistributions of source code must retain the above copyright notice, this
1264
                              ;    list of conditions and the following disclaimer.
1265
                              ;
1266
                              ; 2. Redistributions in binary form must reproduce the above copyright notice,
1267
                              ;    this list of conditions and the following disclaimer in the documentation
1268
                              ;    and/or other materials provided with the distribution.
1269
                              ;
1270
                              ; 3. Neither the name of the copyright holder nor the names of its
1271
                              ;    contributors may be used to endorse or promote products derived from
1272
                              ;    this software without specific prior written permission.
1273
                              ;
1274
                              ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1275
                              ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1276
                              ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1277
                              ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
1278
                              ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1279
                              ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1280
                              ; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1281
                              ; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1282
                              ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1283
                              ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1284
                              ;
1285
                              ; ============================================================================
1286
 
1287
                              ;===============================================================================
1288
                              ; Realtime clock routines
1289
                              ;===============================================================================
1290
 
1291
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1292
                              ; Read the real-time-clock chip.
1293
                              ;
1294
                              ; The entire contents of the clock registers and sram are read into a buffer
1295
                              ; in one-shot rather than reading the registers individually.
1296
                              ;
1297
                              ; Parameters: none
1298
                              ; Returns: d = 0 on success, otherwise non-zero
1299
                              ; Modifies: d and RTCBuf
1300
                              ; Stack space: 6 words
1301
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1302
 
1303
                              rtc_read:
1304
 00FFE4B3 08EE30500                       ldx                     #RTC
1305
 00FFE4B6 18E007FC0                       ldy                     #RTCBuf
1306
 00FFE4B9 0C6080                          ldb                     #$80
1307
 00FFE4BB 0E7002                          stb                     I2C_CTRL,x              ; enable I2C
1308
 00FFE4BD 0CC0900DE                       ldd                     #$900DE                         ; read address, write op, STA + wr bit
1309
 00FFE4C0 08DFC4                          bsr                     i2c_wr_cmd
1310
 00FFE4C2 0C5080                          bitb            #$80
1311
 00FFE4C4 02603C                          bne                     rtc_rxerr
1312
 00FFE4C6 0CC010000                       ldd                     #$10000                         ; address zero, wr bit
1313
 00FFE4C9 08DFBB                          bsr                     i2c_wr_cmd
1314
 00FFE4CB 0C5080                          bitb            #$80
1315
 00FFE4CD 026033                          bne                     rtc_rxerr
1316
 00FFE4CF 0CC0900DF                       ldd                     #$900DF                         ; read address, read op, STA + wr bit
1317
 00FFE4D2 08DFB2                          bsr                     i2c_wr_cmd
1318
 00FFE4D4 0C5080                          bitb            #$80
1319
 00FFE4D6 02602A                          bne                     rtc_rxerr
1320
 
1321
 00FFE4D8 05F                             clrb
1322
                              rtcr0001:
1323
 00FFE4D9 086020                          lda                     #$20
1324
 00FFE4DB 0A7004                          sta                     I2C_CMD,x                       ; rd bit
1325
 00FFE4DD 08DF9D                          bsr                     i2c_wait_tip
1326
 00FFE4DF 08DFC8                          bsr                     i2c_wait_rx_nack
1327
 00FFE4E1 0A6004                          lda                     I2C_STAT,x
1328
 00FFE4E3 085080                          bita            #$80
1329
 00FFE4E5 02601B                          bne                     rtc_rxerr
1330
 00FFE4E7 0A6003                          lda                     I2C_RXR,x
1331
 00FFE4E9 0A7A07                          sta                     b,y
1332
 00FFE4EB 05C                             incb
1333
 00FFE4EC 0C105F                          cmpb            #$5F
1334
 00FFE4EE 025FE9                          blo                     rtcr0001
1335
 00FFE4F0 086068                          lda                     #$68
1336
 00FFE4F2 0A7004                          sta                     I2C_CMD,x                       ; STO, rd bit + nack
1337
 00FFE4F4 08DF86                          bsr                     i2c_wait_tip
1338
 00FFE4F6 0A6004                          lda                     I2C_STAT,x
1339
 00FFE4F8 085080                          bita            #$80
1340
 00FFE4FA 026006                          bne                     rtc_rxerr
1341
 00FFE4FC 0A6003                          lda                     I2C_RXR,x
1342
 00FFE4FE 0A7A07                          sta                     b,y
1343
 00FFE500 04F05F                          clrd                                                                    ; return 0
1344
                              rtc_rxerr:
1345
 00FFE502 06F002                          clr                     I2C_CTRL,x      ; disable I2C and return status
1346
 00FFE504 04F                             clra
1347
 00FFE505 039                             rts
1348
 
1349
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1350
                              ; Write the real-time-clock chip.
1351
                              ;
1352
                              ; The entire contents of the clock registers and sram are written from a
1353
                              ; buffer (RTCBuf) in one-shot rather than writing the registers individually.
1354
                              ;
1355
                              ; Parameters: none
1356
                              ; Returns: r1 = 0 on success, otherwise non-zero
1357
                              ; Modifies: r1 and RTCBuf
1358
                              ; Stack space: 6 words
1359
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1360
 
1361
                              rtc_write:
1362
 00FFE506 08EE30500                       ldx             #RTC
1363
 00FFE509 18E007FC0                       ldy             #RTCBuf
1364
 
1365
 00FFE50C 0C6080                          ldb             #$80
1366
 00FFE50E 0E7002                          stb             I2C_CTRL,x              ; enable I2C
1367
 00FFE510 0CC0900DE                       ldd             #$900DE                         ; read address, write op, STA + wr bit
1368
 00FFE513 08DF71                          bsr             i2c_wr_cmd
1369
 00FFE515 0C5080                          bitb    #$80
1370
 00FFE517 026FE9                          bne             rtc_rxerr
1371
 00FFE519 0CC010000                       ldd             #$10000                         ; address zero, wr bit
1372
 00FFE51C 08DF68                          bsr             i2c_wr_cmd
1373
 00FFE51E 0C5080                          bitb    #$80
1374
 00FFE520 026FE0                          bne             rtc_rxerr
1375
 
1376
 00FFE522 0C6000                          ldb             #0
1377
                              rtcw0001:
1378
 00FFE524 034004                          pshs    b
1379
 00FFE526 0E6A05                          ldb             b,y
1380
 00FFE528 086010                          lda             #$10
1381
 00FFE52A 08DF5A                          bsr             i2c_wr_cmd
1382
 00FFE52C 0C5080                          bitb    #$80
1383
 00FFE52E 035004                          puls    b
1384
 00FFE530 026FD0                          bne             rtc_rxerr
1385
 00FFE532 05C                             incb
1386
 00FFE533 0C105F                          cmpb    #$5F
1387
 00FFE535 025FED                          blo             rtcw0001
1388
 00FFE537 0E6A05                          ldb             b,y
1389
 00FFE539 086050                          lda             #$50                                    ; STO, wr bit
1390
 00FFE53B 08DF49                          bsr             i2c_wr_cmd
1391
 00FFE53D 0C5080                          bitb    #$80
1392
 00FFE53F 026FC1                          bne             rtc_rxerr
1393
 00FFE541 04F05F                          clrd                                                            ; return 0
1394
 00FFE543 06F002                          clr             I2C_CTRL,x              ; disable I2C and return status
1395
 00FFE545 039                             rts
1396
 
1397
                              ;==============================================================================
1398 4 robfinch
                              ; Keyboard I/O
1399
                              ;==============================================================================
1400
 
1401
                                      ;--------------------------------------------------------------------------
1402
                                      ; PS2 scan codes to ascii conversion tables.
1403
                                      ;--------------------------------------------------------------------------
1404
                                      ;
1405
                                      org     (* + 127) & $FFFFFF80
1406
 
1407
                              unshiftedScanCodes:
1408 13 robfinch
 00FFE580 02E0A902E0A50A30A10A2           fcb     $2e,$a9,$2e,$a5,$a3,$a1,$a2,$ac
1409
 00FFE587 0AC
1410
 00FFE588 02E0AA0A80A60A4009060           fcb     $2e,$aa,$a8,$a6,$a4,$09,$60,$2e
1411
 00FFE58F 02E
1412
 00FFE590 02E02E02E02E02E071031           fcb     $2e,$2e,$2e,$2e,$2e,$71,$31,$2e
1413
 00FFE597 02E
1414
 00FFE598 02E02E07A073061077032           fcb     $2e,$2e,$7a,$73,$61,$77,$32,$2e
1415
 00FFE59F 02E
1416
 00FFE5A0 02E063078064065034033           fcb     $2e,$63,$78,$64,$65,$34,$33,$2e
1417
 00FFE5A7 02E
1418
 00FFE5A8 02E020076066074072035           fcb     $2e,$20,$76,$66,$74,$72,$35,$2e
1419
 00FFE5AF 02E
1420
 00FFE5B0 02E06E062068067079036           fcb     $2e,$6e,$62,$68,$67,$79,$36,$2e
1421
 00FFE5B7 02E
1422
 00FFE5B8 02E02E06D06A075037038           fcb     $2e,$2e,$6d,$6a,$75,$37,$38,$2e
1423
 00FFE5BF 02E
1424
 00FFE5C0 02E02C06B06906F030039           fcb     $2e,$2c,$6b,$69,$6f,$30,$39,$2e
1425
 00FFE5C7 02E
1426
 00FFE5C8 02E02E02F06C03B07002D           fcb     $2e,$2e,$2f,$6c,$3b,$70,$2d,$2e
1427
 00FFE5CF 02E
1428
 00FFE5D0 02E02E02702E05B03D02E           fcb     $2e,$2e,$27,$2e,$5b,$3d,$2e,$2e
1429
 00FFE5D7 02E
1430
 00FFE5D8 0AD02E00D05D02E05C02E           fcb     $ad,$2e,$0d,$5d,$2e,$5c,$2e,$2e
1431
 00FFE5DF 02E
1432
 00FFE5E0 02E02E02E02E02E02E008           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$08,$2e
1433
 00FFE5E7 02E
1434
 00FFE5E8 02E09502E09309402E02E           fcb     $2e,$95,$2e,$93,$94,$2e,$2e,$2e
1435
 00FFE5EF 02E
1436
 00FFE5F0 09807F09202E09109001B           fcb     $98,$7f,$92,$2e,$91,$90,$1b,$af
1437
 00FFE5F7 0AF
1438
 00FFE5F8 0AB02E09702E02E0960AE           fcb     $ab,$2e,$97,$2e,$2e,$96,$ae,$2e
1439
 00FFE5FF 02E
1440 4 robfinch
 
1441 13 robfinch
 00FFE600 02E02E02E0A702E02E02E           fcb     $2e,$2e,$2e,$a7,$2e,$2e,$2e,$2e
1442
 00FFE607 02E
1443
 00FFE608 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1444
 00FFE60F 02E
1445
 00FFE610 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1446
 00FFE617 02E
1447
 00FFE618 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1448
 00FFE61F 02E
1449
 00FFE620 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1450
 00FFE627 02E
1451
 00FFE628 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1452
 00FFE62F 02E
1453
 00FFE630 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1454
 00FFE637 02E
1455
 00FFE638 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1456
 00FFE63F 02E
1457
 00FFE640 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1458
 00FFE647 02E
1459
 00FFE648 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1460
 00FFE64F 02E
1461
 00FFE650 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1462
 00FFE657 02E
1463
 00FFE658 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1464
 00FFE65F 02E
1465
 00FFE660 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1466
 00FFE667 02E
1467
 00FFE668 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1468
 00FFE66F 02E
1469
 00FFE670 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1470
 00FFE677 02E
1471
 00FFE678 02E02E0FA02E02E02E02E           fcb     $2e,$2e,$fa,$2e,$2e,$2e,$2e,$2e
1472
 00FFE67F 02E
1473 4 robfinch
 
1474
                              shiftedScanCodes:
1475 13 robfinch
 00FFE680 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1476
 00FFE687 02E
1477
 00FFE688 02E02E02E02E02E00907E           fcb     $2e,$2e,$2e,$2e,$2e,$09,$7e,$2e
1478
 00FFE68F 02E
1479
 00FFE690 02E02E02E02E02E051021           fcb     $2e,$2e,$2e,$2e,$2e,$51,$21,$2e
1480
 00FFE697 02E
1481
 00FFE698 02E02E05A053041057040           fcb     $2e,$2e,$5a,$53,$41,$57,$40,$2e
1482
 00FFE69F 02E
1483
 00FFE6A0 02E043058044045024023           fcb     $2e,$43,$58,$44,$45,$24,$23,$2e
1484
 00FFE6A7 02E
1485
 00FFE6A8 02E020056046054052025           fcb     $2e,$20,$56,$46,$54,$52,$25,$2e
1486
 00FFE6AF 02E
1487
 00FFE6B0 02E04E04204804705905E           fcb     $2e,$4e,$42,$48,$47,$59,$5e,$2e
1488
 00FFE6B7 02E
1489
 00FFE6B8 02E02E04D04A05502602A           fcb     $2e,$2e,$4d,$4a,$55,$26,$2a,$2e
1490
 00FFE6BF 02E
1491
 00FFE6C0 02E03C04B04904F029028           fcb     $2e,$3c,$4b,$49,$4f,$29,$28,$2e
1492
 00FFE6C7 02E
1493
 00FFE6C8 02E03E03F04C03A05005F           fcb     $2e,$3e,$3f,$4c,$3a,$50,$5f,$2e
1494
 00FFE6CF 02E
1495
 00FFE6D0 02E02E02202E07B02B02E           fcb     $2e,$2e,$22,$2e,$7b,$2b,$2e,$2e
1496
 00FFE6D7 02E
1497
 00FFE6D8 02E02E00D07D02E07C02E           fcb     $2e,$2e,$0d,$7d,$2e,$7c,$2e,$2e
1498
 00FFE6DF 02E
1499
 00FFE6E0 02E02E02E02E02E02E008           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$08,$2e
1500
 00FFE6E7 02E
1501
 00FFE6E8 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1502
 00FFE6EF 02E
1503
 00FFE6F0 02E07F02E02E02E02E01B           fcb     $2e,$7f,$2e,$2e,$2e,$2e,$1b,$2e
1504
 00FFE6F7 02E
1505
 00FFE6F8 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1506
 00FFE6FF 02E
1507 4 robfinch
 
1508 13 robfinch
 00FFE700 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1509
 00FFE707 02E
1510
 00FFE708 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1511
 00FFE70F 02E
1512
 00FFE710 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1513
 00FFE717 02E
1514
 00FFE718 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1515
 00FFE71F 02E
1516
 00FFE720 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1517
 00FFE727 02E
1518
 00FFE728 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1519
 00FFE72F 02E
1520
 00FFE730 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1521
 00FFE737 02E
1522
 00FFE738 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1523
 00FFE73F 02E
1524
 00FFE740 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1525
 00FFE747 02E
1526
 00FFE748 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1527
 00FFE74F 02E
1528
 00FFE750 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1529
 00FFE757 02E
1530
 00FFE758 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1531
 00FFE75F 02E
1532
 00FFE760 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1533
 00FFE767 02E
1534
 00FFE768 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1535
 00FFE76F 02E
1536
 00FFE770 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1537
 00FFE777 02E
1538
 00FFE778 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1539
 00FFE77F 02E
1540 4 robfinch
 
1541
                              ; control
1542
                              keybdControlCodes:
1543 13 robfinch
 00FFE780 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1544
 00FFE787 02E
1545
 00FFE788 02E02E02E02E02E00907E           fcb     $2e,$2e,$2e,$2e,$2e,$09,$7e,$2e
1546
 00FFE78F 02E
1547
 00FFE790 02E02E02E02E02E011021           fcb     $2e,$2e,$2e,$2e,$2e,$11,$21,$2e
1548
 00FFE797 02E
1549
 00FFE798 02E02E01A013001017040           fcb     $2e,$2e,$1a,$13,$01,$17,$40,$2e
1550
 00FFE79F 02E
1551
 00FFE7A0 02E003018004005024023           fcb     $2e,$03,$18,$04,$05,$24,$23,$2e
1552
 00FFE7A7 02E
1553
 00FFE7A8 02E020016006014012025           fcb     $2e,$20,$16,$06,$14,$12,$25,$2e
1554
 00FFE7AF 02E
1555
 00FFE7B0 02E00E00200800701905E           fcb     $2e,$0e,$02,$08,$07,$19,$5e,$2e
1556
 00FFE7B7 02E
1557
 00FFE7B8 02E02E00D00A01502602A           fcb     $2e,$2e,$0d,$0a,$15,$26,$2a,$2e
1558
 00FFE7BF 02E
1559
 00FFE7C0 02E03C00B00900F029028           fcb     $2e,$3c,$0b,$09,$0f,$29,$28,$2e
1560
 00FFE7C7 02E
1561
 00FFE7C8 02E03E03F00C03A01005F           fcb     $2e,$3e,$3f,$0c,$3a,$10,$5f,$2e
1562
 00FFE7CF 02E
1563
 00FFE7D0 02E02E02202E07B02B02E           fcb     $2e,$2e,$22,$2e,$7b,$2b,$2e,$2e
1564
 00FFE7D7 02E
1565
 00FFE7D8 02E02E00D07D02E07C02E           fcb     $2e,$2e,$0d,$7d,$2e,$7c,$2e,$2e
1566
 00FFE7DF 02E
1567
 00FFE7E0 02E02E02E02E02E02E008           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$08,$2e
1568
 00FFE7E7 02E
1569
 00FFE7E8 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1570
 00FFE7EF 02E
1571
 00FFE7F0 02E07F02E02E02E02E01B           fcb     $2e,$7f,$2e,$2e,$2e,$2e,$1b,$2e
1572
 00FFE7F7 02E
1573
 00FFE7F8 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1574
 00FFE7FF 02E
1575 4 robfinch
 
1576
                              keybdExtendedCodes:
1577 13 robfinch
 00FFE800 02E02E02E02E0A30A10A2           fcb     $2e,$2e,$2e,$2e,$a3,$a1,$a2,$2e
1578
 00FFE807 02E
1579
 00FFE808 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1580
 00FFE80F 02E
1581
 00FFE810 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1582
 00FFE817 02E
1583
 00FFE818 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1584
 00FFE81F 02E
1585
 00FFE820 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1586
 00FFE827 02E
1587
 00FFE828 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1588
 00FFE82F 02E
1589
 00FFE830 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1590
 00FFE837 02E
1591
 00FFE838 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1592
 00FFE83F 02E
1593
 00FFE840 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1594
 00FFE847 02E
1595
 00FFE848 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1596
 00FFE84F 02E
1597
 00FFE850 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1598
 00FFE857 02E
1599
 00FFE858 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1600
 00FFE85F 02E
1601
 00FFE860 02E02E02E02E02E02E02E           fcb     $2e,$2e,$2e,$2e,$2e,$2e,$2e,$2e
1602
 00FFE867 02E
1603
 00FFE868 02E09502E09309402E02E           fcb     $2e,$95,$2e,$93,$94,$2e,$2e,$2e
1604
 00FFE86F 02E
1605
 00FFE870 09809909202E09109002E           fcb     $98,$99,$92,$2e,$91,$90,$2e,$2e
1606
 00FFE877 02E
1607
 00FFE878 02E02E09702E02E09602E           fcb     $2e,$2e,$97,$2e,$2e,$96,$2e,$2e
1608
 00FFE87F 02E
1609 4 robfinch
 
1610
                              ; ============================================================================
1611
                              ;        __
1612
                              ;   \\__/ o\    (C) 2013-2022  Robert Finch, Waterloo
1613
                              ;    \  __ /    All rights reserved.
1614
                              ;     \/_//     robfinch@opencores.org
1615
                              ;       ||
1616
                              ;
1617
                              ;
1618
                              ;       Keyboard driver routines to interface to a PS2 style keyboard
1619
                              ; Converts the scancode to ascii
1620
                              ;
1621
                              ; This source file is free software: you can redistribute it and/or modify
1622
                              ; it under the terms of the GNU Lesser General Public License as published
1623
                              ; by the Free Software Foundation, either version 3 of the License, or
1624
                              ; (at your option) any later version.
1625
                              ;
1626
                              ; This source file is distributed in the hope that it will be useful,
1627
                              ; but WITHOUT ANY WARRANTY; without even the implied warranty of
1628
                              ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1629
                              ; GNU General Public License for more details.
1630
                              ;
1631
                              ; You should have received a copy of the GNU General Public License
1632
                              ; along with this program.  If not, see .
1633
                              ;
1634
                              ; ============================================================================
1635
                              ;
1636
                              SC_F12  EQU     $07
1637
                              SC_C    EQU             $21
1638
                              SC_T    EQU         $2C
1639
                              SC_Z            EQU     $1A
1640
                              SC_DEL  EQU                     $71     ; extend
1641
                              SC_KEYUP        EQU             $F0     ; should be $f0
1642
                              SC_EXTEND EQU     $E0
1643
                              SC_CTRL EQU                     $14
1644
                              SC_RSHIFT               EQU     $59
1645
                              SC_NUMLOCK      EQU     $77
1646
                              SC_SCROLLLOCK           EQU     $7E
1647
                              SC_CAPSLOCK             EQU             $58
1648
                              SC_ALT  EQU                     $11
1649
 
1650
                              ;#define SC_LSHIFT      EQU             $12
1651
                              ;SC_DEL         EQU             $71             ; extend
1652
                              ;SC_LCTRL       EQU             $58
1653
 
1654
                              SC_TAB  EQU     $0D
1655
 
1656
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1657
                              ; Recieve a byte from the keyboard, used after a command is sent to the
1658
                              ; keyboard in order to wait for a response.
1659
                              ;
1660
                              ; Parameters: none
1661
                              ; Returns: accd = recieved byte ($00 to $FF), -1 on timeout
1662
                              ; Modifies: acc
1663
                              ; Stack Space: 2 words
1664
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1665
 
1666
                              KeybdRecvByte:
1667 13 robfinch
 00FFE880 034010                          pshs    x
1668
 00FFE882 08E000064                       ldx             #100                                            ; wait up to 1s
1669 4 robfinch
                              krb3:
1670 13 robfinch
 00FFE885 08D05A                          bsr             KeybdGetStatus  ; wait for response from keyboard
1671
 00FFE887 05D                             tstb
1672
 00FFE888 02B00B                          bmi             krb4                                            ; is input buffer full ? yes, branch
1673
 00FFE88A 08D02D                          bsr             Wait10ms                                ; wait a bit
1674
 00FFE88C 0301FF                          dex
1675
 00FFE88E 026FF5                          bne             krb3                                            ; go back and try again
1676
 00FFE890 0CCFFFFFF                       ldd             #-1                                                     ; return -1
1677
 00FFE893 035090                          puls    x,pc
1678 4 robfinch
                              krb4:
1679 13 robfinch
 00FFE895 08D066                          bsr             KeybdGetScancode
1680
 00FFE897 035090                          puls    x,pc
1681 4 robfinch
 
1682
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1683
                              ; Send a byte to the keyboard.
1684
                              ;
1685
                              ; Parameters: accb byte to send
1686
                              ; Returns: none
1687
                              ; Modifies: none
1688
                              ; Stack Space: 0 words
1689
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1690
 
1691
                              KeybdSendByte:
1692 13 robfinch
 00FFE899 0150F7FFFE30400                 stb             KEYBD
1693
 00FFE89E 039                             rts
1694 4 robfinch
 
1695
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1696
                              ; Wait until the keyboard transmit is complete
1697
                              ;
1698
                              ; Parameters: none
1699
                              ; Returns: r1 = 0 if successful, r1 = -1 timeout
1700
                              ; Modifies: r1
1701
                              ; Stack Space: 3 words
1702
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1703
 
1704
                              KeybdWaitTx:
1705 13 robfinch
 00FFE89F 034010                          pshs    x
1706
 00FFE8A1 08E000064                       ldx             #100                            ; wait a max of 1s
1707 4 robfinch
                              kwt1:
1708 13 robfinch
 00FFE8A4 08D03B                          bsr             KeybdGetStatus
1709
 00FFE8A6 0C4040                          andb    #$40                            ; check for transmit complete bit; branch if bit set
1710
 00FFE8A8 02600B                          bne             kwt2
1711
 00FFE8AA 08D00D                          bsr             Wait10ms                ; delay a little bit
1712
 00FFE8AC 0301FF                          dex
1713
 00FFE8AE 026FF4                          bne             kwt1                            ; go back and try again
1714
 00FFE8B0 0CCFFFFFF                       ldd             #-1                                     ; timed out, return -1
1715
 00FFE8B3 035090                          puls    x,pc
1716 4 robfinch
                              kwt2:
1717 13 robfinch
 00FFE8B5 04F                             clra                                                    ; wait complete, return 0
1718
 00FFE8B6 05F                             clrb
1719
 00FFE8B7 035090                          puls    x,pc
1720 4 robfinch
 
1721
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1722
                              ; Wait for 10 ms
1723
                              ;
1724
                              ; Parameters: none
1725
                              ; Returns: none
1726
                              ; Modifies: none
1727
                              ; Stack Space: 2 words
1728
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1729
 
1730
                              Wait10ms:
1731 13 robfinch
 00FFE8B9 034006                          pshs    d
1732
 00FFE8BB 0150B6FFFFFFFE7                 lda             MSCOUNT+3
1733 4 robfinch
                              W10_0001:
1734 13 robfinch
 00FFE8C0 01F089                          tfr             a,b
1735
 00FFE8C2 0150F0FFFFFFFE7                 subb    MSCOUNT+3
1736
 00FFE8C7 0C1FFA                          cmpb    #$FFA
1737
 00FFE8C9 022FF5                          bhi             W10_0001
1738
 00FFE8CB 035086                          puls    d,pc
1739 4 robfinch
 
1740
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1741
                              ; Wait for 300 ms (256 ms)
1742
                              ;
1743
                              ; Parameters: none
1744
                              ; Returns: none
1745
                              ; Modifies: none
1746
                              ; Stack Space: 2 words
1747
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1748
 
1749
                              Wait300ms:
1750 13 robfinch
 00FFE8CD 034006                          pshs    d
1751
 00FFE8CF 0150B6FFFFFFFE7                 lda             MSCOUNT+3
1752 4 robfinch
                              W300_0001:
1753 13 robfinch
 00FFE8D4 01F089                          tfr             a,b
1754
 00FFE8D6 0150F0FFFFFFFE7                 subb    MSCOUNT+3
1755
 00FFE8DB 0C1F00                          cmpb    #$F00
1756
 00FFE8DD 022FF5                          bhi     W300_0001
1757
 00FFE8DF 035086                          puls    d,pc
1758 4 robfinch
 
1759
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1760
                              ; Get the keyboard status
1761
                              ;
1762
                              ; Parameters: none
1763
                              ; Returns: d = status
1764
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1765
 
1766
                              KeybdGetStatus:
1767
                              kbgs3:
1768 13 robfinch
 00FFE8E1 0150F6FFFE30401                 ldb             KEYBD+1
1769
 00FFE8E6 0C5080                          bitb    #$80
1770
 00FFE8E8 02600E                          bne             kbgs1
1771
 00FFE8EA 0C5001                          bitb    #$01            ; check parity error flag
1772
 00FFE8EC 026002                          bne             kbgs2
1773
 00FFE8EE 04F                             clra
1774
 00FFE8EF 039                             rts
1775 4 robfinch
                              kbgs2:
1776 13 robfinch
 00FFE8F0 0C60FE                          ldb             #$FE            ; request resend
1777
 00FFE8F2 08DFA5                          bsr             KeybdSendByte
1778
 00FFE8F4 08DFA9                          bsr             KeybdWaitTx
1779
 00FFE8F6 020FE9                          bra             kbgs3
1780 4 robfinch
                              kbgs1:                                  ; return negative status
1781 13 robfinch
 00FFE8F8 0CAF00                          orb             #$F00
1782
 00FFE8FA 086FFF                          lda             #-1
1783
 00FFE8FC 039                             rts
1784 4 robfinch
 
1785
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1786
                              ; Get the scancode from the keyboard port
1787
                              ;
1788
                              ; Parameters: none
1789
                              ; Returns: acca = scancode
1790
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1791
 
1792
                              KeybdGetScancode:
1793 13 robfinch
 00FFE8FD 04F                             clra
1794
 00FFE8FE 0150F6FFFE30400                 ldb             KEYBD                           ; get the scan code
1795
 00FFE903 01507FFFFE30401                 clr             KEYBD+1                 ; clear receive register (write $00 to status reg)
1796
 00FFE908 039                             rts
1797 4 robfinch
 
1798
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1799
                              ; Set the LEDs on the keyboard.
1800
                              ;
1801
                              ; Parameters: d LED status to set
1802
                              ; Returns: none
1803
                              ; Modifies: none
1804
                              ; Stack Space: 2 words
1805
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1806
 
1807
                              KeybdSetLED:
1808 13 robfinch
 00FFE909 034004                          pshs    b
1809
 00FFE90B 0C60ED                          ldb             #$ED                                            ; set LEDs command
1810
 00FFE90D 08DF8A                          bsr             KeybdSendByte
1811
 00FFE90F 08DF8E                          bsr             KeybdWaitTx
1812
 00FFE911 08DF6D                          bsr             KeybdRecvByte   ; should be an ack
1813
 00FFE913 035004                          puls    b
1814
 00FFE915 08DF82                          bsr             KeybdSendByte
1815
 00FFE917 08DF86                          bsr             KeybdWaitTx
1816
 00FFE919 08DF65                          bsr             KeybdRecvByte   ; should be an ack
1817
 00FFE91B 039                             rts
1818 4 robfinch
 
1819
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1820
                              ; Get ID - get the keyboards identifier code.
1821
                              ;
1822
                              ; Parameters: none
1823
                              ; Returns: d = $AB83, $00 on fail
1824
                              ; Modifies: d, KeybdID updated
1825
                              ; Stack Space: 2 words
1826
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1827
 
1828
                              KeybdGetID:
1829 13 robfinch
 00FFE91C 0C60F2                          ldb             #$F2
1830
 00FFE91E 08DF79                          bsr             KeybdSendByte
1831
 00FFE920 08DF7D                          bsr             KeybdWaitTx
1832
 00FFE922 08DF5C                          bsr             KeybdRecvByte
1833
 00FFE924 0C5080                          bitb    #$80
1834
 00FFE926 026014                          bne             kgnotKbd
1835
 00FFE928 0C10AB                          cmpb    #$AB
1836
 00FFE92A 026010                          bne             kgnotKbd
1837
 00FFE92C 08DF52                          bsr             KeybdRecvByte
1838
 00FFE92E 0C5080                          bitb    #$80
1839
 00FFE930 02600A                          bne             kgnotKbd
1840
 00FFE932 0C1083                          cmpb    #$83
1841
 00FFE934 026006                          bne             kgnotKbd
1842
 00FFE936 0CC00AB83                       ldd             #$AB83
1843 4 robfinch
                              kgid1:
1844 13 robfinch
 00FFE939 0DD124                          std             KeybdID
1845
 00FFE93B 039                             rts
1846 4 robfinch
                              kgnotKbd:
1847 13 robfinch
 00FFE93C 04F                             clra
1848
 00FFE93D 05F                             clrb
1849
 00FFE93E 020FF9                          bra             kgid1
1850 4 robfinch
 
1851
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1852
                              ; Initialize the keyboard.
1853
                              ;
1854
                              ; Parameters:
1855
                              ;               none
1856
                              ;       Modifies:
1857
                              ;               none
1858
                              ; Returns:
1859
                              ;               none
1860
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1861
 
1862
                              KeybdInit:
1863 13 robfinch
 00FFE940 034026                          pshs    d,y
1864
 00FFE942 18E000005                       ldy             #5
1865
 00FFE945 00F120                          clr             KeyState1               ; records key up/down state
1866
 00FFE947 00F121                          clr             KeyState2               ; records shift,ctrl,alt state
1867 4 robfinch
                              kbdi0002:
1868 13 robfinch
 00FFE949 08DF6E                          bsr             Wait10ms
1869
 00FFE94B 01507FFFFE30401                 clr             KEYBD+1                 ; clear receive register (write $00 to status reg)
1870
 00FFE950 0C6FFF                          ldb             #-1                                     ; send reset code to keyboard
1871
 00FFE952 0150F7FFFE30401                 stb             KEYBD+1                 ; write $FF to status reg to clear TX state
1872
 00FFE957 08DF40                          bsr             KeybdSendByte   ; now write to transmit register
1873
 00FFE959 08DF44                          bsr             KeybdWaitTx             ; wait until no longer busy
1874
 00FFE95B 08DF23                          bsr             KeybdRecvByte   ; look for an ACK ($FA)
1875
 00FFE95D 0C10FA                          cmpb    #$FA
1876
 00FFE95F 026021                          bne             kbdiTryAgain
1877
 00FFE961 08DF1D                          bsr             KeybdRecvByte   ; look for BAT completion code ($AA)
1878
 00FFE963 0C10FC                          cmpb    #$FC                            ; reset error ?
1879
 00FFE965 02701B                          beq             kbdiTryAgain
1880
 00FFE967 0C10AA                          cmpb    #$AA                            ; reset complete okay ?
1881
 00FFE969 026017                          bne             kbdiTryAgain
1882 4 robfinch
 
1883
                                      ; After a reset, scan code set #2 should be active
1884
                              .config:
1885 13 robfinch
 00FFE96B 0C60F0                          ldb             #$F0                    ; send scan code select
1886
 00FFE96D 0150F7FFFE60001                 stb             LEDS
1887
 00FFE972 08DF25                          bsr             KeybdSendByte
1888
 00FFE974 08DF29                          bsr             KeybdWaitTx
1889
 00FFE976 05D                             tstb
1890
 00FFE977 02B009                          bmi             kbdiTryAgain
1891
 00FFE979 08DF05                          bsr             KeybdRecvByte   ; wait for response from keyboard
1892
 00FFE97B 04D                             tsta
1893
 00FFE97C 02B004                          bmi             kbdiTryAgain
1894
 00FFE97E 0C10FA                          cmpb    #$FA                                    ; ACK
1895
 00FFE980 02700C                          beq             kbdi0004
1896 4 robfinch
                              kbdiTryAgain:
1897 13 robfinch
 00FFE982 0313FF                          dey
1898
 00FFE984 026FC3                          bne       kbdi0002
1899 4 robfinch
                              .keybdErr:
1900 13 robfinch
 00FFE986 0CCFFE9AE                       ldd             #msgBadKeybd
1901
 00FFE989 017FFFA2D                       lbsr    DisplayStringCRLF
1902 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
1903 13 robfinch
 00FFE98C 020014                          bra             ledxit
1904 4 robfinch
                              kbdi0004:
1905 13 robfinch
 00FFE98E 0C6002                          ldb             #2                      ; select scan code set #2
1906
 00FFE990 08DF07                          bsr             KeybdSendByte
1907
 00FFE992 08DF0B                          bsr             KeybdWaitTx
1908
 00FFE994 05D                             tstb
1909
 00FFE995 02BFEB                          bmi             kbdiTryAgain
1910
 00FFE997 08DEE7                          bsr             KeybdRecvByte   ; wait for response from keyboard
1911
 00FFE999 04D                             tsta
1912
 00FFE99A 02BFE6                          bmi             kbdiTryAgain
1913
 00FFE99C 0C10FA                          cmpb    #$FA
1914
 00FFE99E 026FE2                          bne             kbdiTryAgain
1915
 00FFE9A0 08DF7A                          bsr             KeybdGetID
1916 4 robfinch
                              ledxit:
1917 13 robfinch
 00FFE9A2 0C6007                          ldb             #$07
1918
 00FFE9A4 08DF63                          bsr             KeybdSetLED
1919
 00FFE9A6 08DF25                          bsr             Wait300ms
1920
 00FFE9A8 0C6000                          ldb             #$00
1921
 00FFE9AA 08DF5D                          bsr             KeybdSetLED
1922
 00FFE9AC 0350A6                          puls    d,y,pc
1923 4 robfinch
 
1924
                              msgBadKeybd:
1925 13 robfinch
 00FFE9AE 04B06507906206F061072           fcb             "Keyboard error",0
1926
 00FFE9B5 06402006507207206F072
1927
 00FFE9BC 000
1928 4 robfinch
 
1929 13 robfinch
                              ;------------------------------------------------------------------------------
1930
                              ; Calculate number of character in input buffer
1931
                              ;
1932
                              ; Parameters:
1933
                              ;               y = $Cn00000 where n is core id
1934
                              ; Returns:
1935
                              ;               d = number of bytes in buffer.
1936
                              ;------------------------------------------------------------------------------
1937
 
1938
                              kbdRcvCount:
1939
 00FFE9BD 04F                             clra
1940
 00FFE9BE 0E6A08128                       ldb             kbdTailRcv,y
1941
 00FFE9C1 0E0A08127                       subb    kbdHeadRcv,y
1942
 00FFE9C4 02C008                          bge             krcXit
1943
 00FFE9C6 0C6040                          ldb             #$40
1944
 00FFE9C8 0E0A08127                       subb    kbdHeadRcv,y
1945
 00FFE9CB 0EBA08128                       addb    kbdTailRcv,y
1946
                              krcXit:
1947
 00FFE9CE 039                             rts
1948
 
1949
 
1950 4 robfinch
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1951
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1952
 
1953 13 robfinch
                              KeybdIRQ:
1954
 00FFE9CF 0150B6FFFE30401                 lda             KEYBD+1                                         ; check status
1955
 00FFE9D4 085080                          bita    #$80                                                    ; was key pressed?
1956
 00FFE9D6 027034                          beq             notKbdIRQ                                       ; if not, exit
1957
 00FFE9D8 0150F6FFFE30400                 ldb             KEYBD                                                   ; get the scan code
1958
 00FFE9DD 01507FFFFE30401                 clr             KEYBD+1                                         ; clear receive register (write $00 to status reg)
1959
 00FFE9E2 034004                          pshs    b                                                                       ; save it off
1960
 00FFE9E4 0B6FF0010                       lda             IOFocusID                                       ; compute core memory address $Cn0000
1961
 00FFE9E7 05F                             clrb
1962
 00FFE9E8 048                             asla
1963
 00FFE9E9 048                             asla
1964
 00FFE9EA 048                             asla
1965
 00FFE9EB 048                             asla
1966
 00FFE9EC 08AC00                          ora             #$C00                                                   ; address $Cn0000
1967
 00FFE9EE 01F002                          tfr             d,y                                                             ; y =
1968
 00FFE9F0 08DFCB                          bsr             kbdRcvCount                             ; get count of scan codes in buffer
1969
 00FFE9F2 0C1040                          cmpb    #64                                                             ; check if buffer full?
1970
 00FFE9F4 024017                          bhs             kbdBufFull                              ; if buffer full, ignore new keystroke
1971
 00FFE9F6 01F021                          tfr             y,x                                                             ; compute fifo address
1972
 00FFE9F8 0E6A08128                       ldb             kbdTailRcv,y                    ; b = buffer index
1973
 00FFE9FB 035002                          puls    a                                                                       ; get back scancode
1974
 00FFE9FD 030040                          leax    kbdFifo,x                                       ; x = base address for fifo
1975
 00FFE9FF 0A7845                          sta             b,x                                                             ; store in buffer
1976
 00FFEA01 05C                             incb                                                                            ; increment buffer index
1977
 00FFEA02 0C403F                          andb    #$3f                                                    ; wrap around at 64 chars
1978
 00FFEA04 0E7A08128                       stb             kbdTailRcv,y                    ; update it
1979
 00FFEA07 08601C                          lda             #28                                                             ; Keyboard is IRQ #28
1980
 00FFEA09 0B7FF0011                       sta             IrqSource                                       ; stuff a byte indicating the IRQ source for PEEK()
1981
                              notKbdIRQ:
1982
 00FFEA0C 039                             rts
1983
                              kbdBufFull:
1984
 00FFEA0D 032601                          leas    1,s                                                             ; get rid of saved scancode
1985
 00FFEA0F 039                             rts
1986
 
1987
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1988
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1989
 
1990 4 robfinch
                              DBGCheckForKey:
1991 13 robfinch
 00FFEA10 020ECF                          bra             KeybdGetStatus
1992 4 robfinch
 
1993
 
1994
                              ; KeyState2 variable bit meanings
1995
                              ;1176543210
1996
                              ; ||||||||+ = shift
1997
                              ; |||||||+- = alt
1998
                              ; ||||||+-- = control
1999
                              ; |||||+--- = numlock
2000
                              ; ||||+---- = capslock
2001
                              ; |||+----- = scrolllock
2002
                              ; ||+------ = 
2003
                              ; |+------- =    "
2004
                              ; |         =    "
2005
                              ; |         =    "
2006
                              ; |         =    "
2007
                              ; +-------- = extended
2008
 
2009
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2010 13 robfinch
                              ; Keyboard get routine.
2011 4 robfinch
                              ;
2012 13 robfinch
                              ; The routine may get characters directly from the scancode input or less
2013
                              ; directly from the scancode buffer, if things are interrupt driven.
2014
                              ;
2015 4 robfinch
                              ; Parameters:
2016 13 robfinch
                              ;               b:  bit 11 = blocking status 1=blocking, 0=non blocking
2017
                              ;               b:      bit 1  = scancode source 1=scancode buffer, 0=direct
2018 4 robfinch
                              ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2019
 
2020 13 robfinch
                              GetKey:
2021
 00FFEA12 034030                          pshs    x,y
2022
 00FFEA14 0D7126                          stb             KeybdBlock                              ; save off blocking status
2023 4 robfinch
                              dbgk2:
2024 13 robfinch
 00FFEA16 0D6126                          ldb             KeybdBlock
2025
 00FFEA18 034004                          pshs    b
2026
 00FFEA1A 0C5001                          bitb    #1                                                              ; what is the scancode source
2027
 00FFEA1C 02701A                          beq             dbgk20                                          ; branch if direct read
2028
 00FFEA1E 0150B6FFFFFFFE0                 lda             COREID                                          ; compute core memory address
2029
 00FFEA23 05F                             clrb
2030
 00FFEA24 048                             asla
2031
 00FFEA25 048                             asla
2032
 00FFEA26 048                             asla
2033
 00FFEA27 048                             asla
2034
 00FFEA28 08AC00                          ora             #$C00
2035
 00FFEA2A 01F002                          tfr             d,y                                                             ; y = $Cn0000
2036
 00FFEA2C 08DF8F                          bsr             kbdRcvCount
2037
 00FFEA2E 05D                             tstb                                                                            ; anything in buffer?
2038
 00FFEA2F 035004                          puls    b
2039
 00FFEA31 026018                          bne             dbgk1                                                   ; branch if something in buffer
2040
 00FFEA33 05D                             tstb
2041
 00FFEA34 02BFE0                          bmi             dbgk2                                                   ; if no key and blocking - loop
2042
 00FFEA36 02000E                          bra             dbgk24
2043
                              dbgk20:
2044
 00FFEA38 18E000000                       ldy             #0
2045
 00FFEA3B 08DEA4                          bsr             KeybdGetStatus
2046
 00FFEA3D 0C4080                          andb    #$80                                                    ; is key available?
2047
 00FFEA3F 035004                          puls    b
2048
 00FFEA41 026008                          bne             dbgk1                                                   ; branch if key
2049
 00FFEA43 05D                             tstb                                                                            ; block?
2050
 00FFEA44 02BFD0                          bmi             dbgk2                                                   ; If no key and blocking - loop
2051
                              dbgk24:
2052
 00FFEA46 0CCFFFFFF                       ldd             #-1                                                             ; return -1 if no block and no key
2053
 00FFEA49 0350B0                          puls    x,y,pc
2054 4 robfinch
                              dbgk1:
2055 13 robfinch
 00FFEA4B 18C000000                       cmpy    #0
2056
 00FFEA4E 026004                          bne             dbgk22
2057
 00FFEA50 08DEAB                          bsr             KeybdGetScancode        ; get scancode directly
2058
 00FFEA52 020011                          bra             dbgk23
2059
                              dbgk22:
2060
                                      ; Retrieve value from scancode buffer
2061
 00FFEA54 01F021                          tfr             y,x
2062
 00FFEA56 030040                          leax    kbdFifo,x                                       ; x = fifo address
2063
 00FFEA58 0E6A08127                       ldb             kbdHeadRcv,y                    ; b = buffer index
2064
 00FFEA5B 0A6A0D                          lda             b,x                                                             ; get the scancode
2065
 00FFEA5D 05C                             incb                                                                            ; increment fifo index
2066
 00FFEA5E 0C403F                          andb    #$3f                                                    ; and wrap around
2067
 00FFEA60 0E7A08127                       stb             kbdHeadRcv,y                    ; save it back
2068
 00FFEA63 01F089                          tfr             a,b                                                             ; the scancode is needed in accb
2069
                              dbgk23:
2070 4 robfinch
                              ;       lbsr    DispByteAsHex
2071
                                      ; Make sure there is a small delay between scancode reads
2072 13 robfinch
 00FFEA65 08E000014                       ldx             #20
2073 4 robfinch
                              dbgk3:
2074 13 robfinch
 00FFEA68 0301FF                          dex
2075
 00FFEA6A 026FFC                          bne             dbgk3
2076 4 robfinch
                                      ; switch on scan code
2077 13 robfinch
 00FFEA6C 0C10F0                          cmpb    #SC_KEYUP
2078
 00FFEA6E 026004                          bne             dbgk4
2079
 00FFEA70 0D7120                          stb             KeyState1                                       ; make KeyState1 <> 0
2080
 00FFEA72 020FA2                          bra             dbgk2                                                   ; loop back
2081 4 robfinch
                              dbgk4:
2082 13 robfinch
 00FFEA74 0C10E0                          cmpb    #SC_EXTEND
2083
 00FFEA76 026008                          bne             dbgk5
2084
 00FFEA78 096121                          lda             KeyState2
2085
 00FFEA7A 08A800                          ora             #$800
2086
 00FFEA7C 097121                          sta             KeyState2
2087
 00FFEA7E 020F96                          bra             dbgk2
2088 4 robfinch
                              dbgk5:
2089 13 robfinch
 00FFEA80 0C1014                          cmpb    #SC_CTRL
2090
 00FFEA82 026016                          bne             dbgkNotCtrl
2091
 00FFEA84 00D120                          tst             KeyState1
2092
 00FFEA86 026008                          bne             dbgk7
2093
 00FFEA88 096121                          lda             KeyState2
2094
 00FFEA8A 08A004                          ora             #4
2095
 00FFEA8C 097121                          sta             KeyState2
2096
 00FFEA8E 020006                          bra             dbgk8
2097 4 robfinch
                              dbgk7:
2098 13 robfinch
 00FFEA90 096121                          lda             KeyState2
2099
 00FFEA92 084FFB                          anda    #~4
2100
 00FFEA94 097121                          sta             KeyState2
2101 4 robfinch
                              dbgk8:
2102 13 robfinch
 00FFEA96 00F120                          clr             KeyState1
2103
 00FFEA98 020F7C                          bra             dbgk2
2104 4 robfinch
                              dbgkNotCtrl:
2105 13 robfinch
 00FFEA9A 0C1059                          cmpb    #SC_RSHIFT
2106
 00FFEA9C 026016                          bne             dbgkNotRshift
2107
 00FFEA9E 00D120                          tst             KeyState1
2108
 00FFEAA0 026008                          bne             dbgk9
2109
 00FFEAA2 096121                          lda             KeyState2
2110
 00FFEAA4 08A001                          ora             #1
2111
 00FFEAA6 097121                          sta             KeyState2
2112
 00FFEAA8 020006                          bra             dbgk10
2113 4 robfinch
                              dbgk9:
2114 13 robfinch
 00FFEAAA 096121                          lda             KeyState2
2115
 00FFEAAC 084FFE                          anda    #~1
2116
 00FFEAAE 097121                          sta             KeyState2
2117 4 robfinch
                              dbgk10:
2118 13 robfinch
 00FFEAB0 00F120                          clr             KeyState1
2119
 00FFEAB2 020F62                          bra             dbgk2
2120 4 robfinch
                              dbgkNotRshift:
2121 13 robfinch
 00FFEAB4 0C1077                          cmpb    #SC_NUMLOCK
2122
 00FFEAB6 026013                          bne             dbgkNotNumlock
2123
 00FFEAB8 096121                          lda             KeyState2
2124
 00FFEABA 088010                          eora    #16
2125
 00FFEABC 097121                          sta             KeyState2
2126
 00FFEABE 096122                          lda             KeyLED
2127
 00FFEAC0 088002                          eora    #2
2128
 00FFEAC2 097122                          sta             KeyLED
2129
 00FFEAC4 01F089                          tfr             a,b
2130
 00FFEAC6 04F                             clra
2131
 00FFEAC7 08DE40                          bsr             KeybdSetLED
2132
 00FFEAC9 020F4B                          bra             dbgk2
2133 4 robfinch
                              dbgkNotNumlock:
2134 13 robfinch
 00FFEACB 0C1058                          cmpb    #SC_CAPSLOCK
2135
 00FFEACD 026013                          bne             dbgkNotCapslock
2136
 00FFEACF 096121                          lda             KeyState2
2137
 00FFEAD1 088020                          eora    #32
2138
 00FFEAD3 097121                          sta             KeyState2
2139
 00FFEAD5 096122                          lda             KeyLED
2140
 00FFEAD7 088004                          eora    #4
2141
 00FFEAD9 097122                          sta             KeyLED
2142
 00FFEADB 01F089                          tfr             a,b
2143
 00FFEADD 04F                             clra
2144
 00FFEADE 08DE29                          bsr             KeybdSetLED
2145
 00FFEAE0 020F34                          bra             dbgk2
2146 4 robfinch
                              dbgkNotCapslock:
2147 13 robfinch
 00FFEAE2 0C107E                          cmpb    #SC_SCROLLLOCK
2148
 00FFEAE4 026013                          bne             dbgkNotScrolllock
2149
 00FFEAE6 096121                          lda             KeyState2
2150
 00FFEAE8 088040                          eora    #64
2151
 00FFEAEA 097121                          sta             KeyState2
2152
 00FFEAEC 096122                          lda             KeyLED
2153
 00FFEAEE 088001                          eora    #1
2154
 00FFEAF0 097122                          sta             KeyLED
2155
 00FFEAF2 01F089                          tfr             a,b
2156
 00FFEAF4 04F                             clra
2157
 00FFEAF5 08DE12                          bsr             KeybdSetLED
2158
 00FFEAF7 020F1D                          bra             dbgk2
2159 4 robfinch
                              dbgkNotScrolllock:
2160 13 robfinch
 00FFEAF9 0C1011                          cmpb    #SC_ALT
2161
 00FFEAFB 026016                          bne             dbgkNotAlt
2162
 00FFEAFD 00D120                          tst             KeyState1
2163
 00FFEAFF 026008                          bne             dbgk11
2164
 00FFEB01 096121                          lda             KeyState2
2165
 00FFEB03 08A002                          ora             #2
2166
 00FFEB05 097121                          sta             KeyState2
2167
 00FFEB07 020006                          bra             dbgk12
2168 4 robfinch
                              dbgk11:
2169 13 robfinch
 00FFEB09 096121                          lda             KeyState2
2170
 00FFEB0B 084FFD                          anda    #~2
2171
 00FFEB0D 097121                          sta             KeyState2
2172 4 robfinch
                              dbgk12:
2173 13 robfinch
 00FFEB0F 00F120                          clr             KeyState1
2174
 00FFEB11 020F03                          bra             dbgk2
2175 4 robfinch
                              dbgkNotAlt:
2176 13 robfinch
 00FFEB13 00D120                          tst             KeyState1
2177
 00FFEB15 027004                          beq             dbgk13
2178
 00FFEB17 00F120                          clr             KeyState1
2179
 00FFEB19 020EFB                          bra             dbgk2
2180 4 robfinch
                              dbgk13:
2181 13 robfinch
 00FFEB1B 096121                          lda             KeyState2               ; Check for CTRL-ALT-DEL
2182
 00FFEB1D 084006                          anda    #6
2183
 00FFEB1F 081006                          cmpa    #6
2184
 00FFEB21 026008                          bne             dbgk14
2185
 00FFEB23 0C1071                          cmpb    #SC_DEL
2186
 00FFEB25 026004                          bne             dbgk14
2187
 00FFEB27 06E90FFFFFFC                    jmp             [$FFFFFC]               ; jump to NMI vector
2188 4 robfinch
                              dbgk14:
2189 13 robfinch
 00FFEB2B 00D121                          tst             KeyState2               ; extended code?
2190
 00FFEB2D 02A00B                          bpl             dbgk15
2191
 00FFEB2F 096121                          lda             KeyState2
2192
 00FFEB31 0847FF                          anda    #$7FF
2193
 00FFEB33 097121                          sta             KeyState2
2194
 00FFEB35 08EFFE800                       ldx             #keybdExtendedCodes
2195
 00FFEB38 020017                          bra             dbgk18
2196 4 robfinch
                              dbgk15:
2197 13 robfinch
 00FFEB3A 096121                          lda             KeyState2               ; Is CTRL down?
2198
 00FFEB3C 085004                          bita    #4
2199
 00FFEB3E 027005                          beq             dbgk16
2200
 00FFEB40 08EFFE780                       ldx             #keybdControlCodes
2201
 00FFEB43 02000C                          bra             dbgk18
2202 4 robfinch
                              dbgk16:
2203 13 robfinch
 00FFEB45 085001                          bita    #1                                      ; Is shift down?
2204
 00FFEB47 027005                          beq             dbgk17
2205
 00FFEB49 08EFFE680                       ldx             #shiftedScanCodes
2206
 00FFEB4C 020003                          bra             dbgk18
2207 4 robfinch
                              dbgk17:
2208 13 robfinch
 00FFEB4E 08EFFE580                       ldx             #unshiftedScanCodes
2209 4 robfinch
                              dbgk18:
2210 13 robfinch
 00FFEB51 0E690FFFE580                    ldb             b,x                                     ; load accb with ascii from table
2211
 00FFEB55 04F                             clra
2212
 00FFEB56 0350B0                          puls    x,y,pc                  ; and return
2213 4 robfinch
 
2214
 
2215 13 robfinch
 00FFEB58 04B04505904204F041052           fcb             "KEYBOARD"
2216
 00FFEB5F 044
2217
 00FFEB60 FFEB6A                          fcw             KeybdOpen
2218
 00FFEB62 FFEB6B                          fcw             KeybdClose
2219
 00FFEB64 FFEB6C                          fcw             KeybdRead
2220
 00FFEB66 FFEB6D                          fcw             KeybdWrite
2221
 00FFEB68 FFEB6E                          fcw             KeybdSeek
2222 4 robfinch
 
2223
                              ; Keyboard Open:
2224
                              ; Initialize the keyboard buffer head and tail indexes
2225
                              ;
2226
                              KeybdOpen:
2227 13 robfinch
 00FFEB6A 039                             rts
2228 4 robfinch
 
2229
                              ; Keyboard Close:
2230
                              ; Nothing to do except maybe clear the keyboard buffer
2231
                              ;
2232
                              KeybdClose:
2233 13 robfinch
 00FFEB6B 039                             rts
2234 4 robfinch
                              ;
2235
                              KeybdRead:
2236 13 robfinch
 00FFEB6C 039                             rts
2237 4 robfinch
                              ;
2238
                              KeybdWrite:
2239 13 robfinch
 00FFEB6D 039                             rts
2240 4 robfinch
 
2241
                              KeybdSeek:
2242 13 robfinch
 00FFEB6E 039                             rts
2243 4 robfinch
 
2244 13 robfinch
                              ;==============================================================================
2245
                              ; Serial I/O
2246
                              ;==============================================================================
2247
 
2248
                              ; ============================================================================
2249
                              ;        __
2250
                              ;   \\__/ o\    (C) 2022  Robert Finch, Waterloo
2251
                              ;    \  __ /    All rights reserved.
2252
                              ;     \/_//     robfinch@opencores.org
2253
                              ;       ||
2254
                              ;
2255
                              ;
2256
                              ; Serial port routines for a WDC6551 compatible circuit.
2257
                              ;
2258
                              ; This source file is free software: you can redistribute it and/or modify
2259
                              ; it under the terms of the GNU Lesser General Public License as published
2260
                              ; by the Free Software Foundation, either version 3 of the License, or
2261
                              ; (at your option) any later version.
2262
                              ;
2263
                              ; This source file is distributed in the hope that it will be useful,
2264
                              ; but WITHOUT ANY WARRANTY; without even the implied warranty of
2265
                              ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2266
                              ; GNU General Public License for more details.
2267
                              ;
2268
                              ; You should have received a copy of the GNU General Public License
2269
                              ; along with this program.  If not, see .
2270
                              ;
2271
                              ; ============================================================================
2272
                              ;
2273 4 robfinch
                              ;------------------------------------------------------------------------------
2274 13 robfinch
                              ; Initialize serial port.
2275
                              ;
2276
                              ; Clear buffer indexes. Two bytes are used for the buffer index even though
2277
                              ; only a single byte is needed. This is for convenience in calculating the
2278
                              ; number of characters in the buffer, done later. The upper byte remains at
2279
                              ; zero.
2280
                              ; The port is initialized for 9600 baud, 1 stop bit and 8 bits data sent.
2281
                              ; The internal baud rate generator is used.
2282
                              ;
2283
                              ; Parameters:
2284
                              ;               none
2285
                              ; Modifies:
2286
                              ;               d
2287
                              ; Returns:
2288
                              ;               none
2289
                              ;------------------------------------------------------------------------------
2290
 
2291
                              InitSerial:
2292
                              SerialInit:
2293
 00FFEB6F 04F                             clra
2294
 00FFEB70 05F                             clrb
2295
 00FFEB71 0DD130                          std             SerHeadRcv-1
2296
 00FFEB73 0DD132                          std             SerTailRcv-1
2297
 00FFEB75 0DD135                          std             SerHeadXmit-1
2298
 00FFEB77 0DD137                          std             SerTailXmit-1
2299
 00FFEB79 00F139                          clr             SerRcvXon
2300
 00FFEB7B 00F140                          clr             SerRcvXoff
2301
 00FFEB7D 0150B6FFFFFFFE0                 lda             COREID
2302
                              sini1:
2303
 00FFEB82 0B1FF0010                       cmpa    IOFocusID
2304
 00FFEB85 026FFB                          bne             sini1
2305
 00FFEB87 0C6009                          ldb             #$09                                            ; dtr,rts active, rxint enabled, no parity
2306
 00FFEB89 0150F7FFFE30102                 stb             ACIA+ACIA_CMD
2307
 00FFEB8E 0C601E                          ldb             #$1E                                            ; baud 9600, 1 stop bit, 8 bit, internal baud gen
2308
 00FFEB90 0150F7FFFE30103                 stb             ACIA+ACIA_CTRL
2309
 00FFEB95 0C60A6                          ldb             #$0A6                                           ; diable fifos, reset fifos
2310
 00FFEB97 0150F7FFFE3010B                 stb             ACIA+ACIA_CTRL2
2311
 00FFEB9C 039                             rts
2312
 
2313
                              ;------------------------------------------------------------------------------
2314
                              ; SerialGetChar
2315
                              ;
2316
                              ; Check the serial port buffer to see if there's a char available. If there's
2317
                              ; a char available then return it. If the buffer is almost empty then send an
2318
                              ; XON.
2319
                              ;
2320
                              ; Stack Space:
2321
                              ;               2 words
2322
                              ; Parameters:
2323
                              ;               none
2324
                              ; Modifies:
2325
                              ;               none
2326
                              ; Returns:
2327
                              ;               d = character or -1
2328
                              ;------------------------------------------------------------------------------
2329
 
2330
                              SerialGetChar:
2331
 00FFEB9D 034030                                  pshs    x,y
2332
 00FFEB9F 18E000000                               ldy             #0
2333
 00FFEBA2 01A010                                  sei                                                                             ; disable interrupts
2334
 00FFEBA4 08D082                                  bsr             SerialRcvCount                  ; check number of chars in receive buffer
2335
 00FFEBA6 0C1008                                  cmpb    #8                                                      ; less than 8?
2336
 00FFEBA8 02200C                                  bhi             sgc2
2337
 00FFEBAA 0D6139                                  ldb             SerRcvXon                               ; skip sending XON if already sent
2338
 00FFEBAC 026008                                  bne       sgc2            ; XON already sent?
2339
 00FFEBAE 0C6011                                  ldb             #XON                                            ; if <8 send an XON
2340
 00FFEBB0 00F140                                  clr             SerRcvXoff                      ; clear XOFF status
2341
 00FFEBB2 0D7139                                  stb             SerRcvXon                               ; flag so we don't send it multiple times
2342
 00FFEBB4 08D052                                  bsr             SerialPutChar
2343
                              sgc2:
2344
 00FFEBB6 0D6131                                  ldb             SerHeadRcv                      ; check if anything is in buffer
2345
 00FFEBB8 0D1133                                  cmpb    SerTailRcv
2346
 00FFEBBA 02700A                                  beq             sgcNoChars                      ; no?
2347
 00FFEBBC 08EBFF000                               ldx             #SerRcvBuf
2348
 00FFEBBF 04F                                     clra
2349
 00FFEBC0 0E6835                                  ldb             b,x                                                     ; get byte from buffer
2350
 00FFEBC2 00C131                                  inc             SerHeadRcv                      ; 4k wrap around
2351
 00FFEBC4 020003                                  bra             sgcXit
2352
                              sgcNoChars:
2353
 00FFEBC6 0CCFFFFFF                               ldd             #-1
2354
                              sgcXit:
2355
 00FFEBC9 01C0EF                                  cli
2356
 00FFEBCB 0350B0                                  puls    x,y,pc
2357
 
2358
                              ;------------------------------------------------------------------------------
2359
                              ; SerialPeekChar
2360
                              ;
2361
                              ; Check the serial port buffer to see if there's a char available. If there's
2362
                              ; a char available then return it. But don't update the buffer indexes. No need
2363
                              ; to send an XON here.
2364
                              ;
2365
                              ; Stack Space:
2366
                              ;               0 words
2367
                              ; Parameters:
2368
                              ;               none
2369
                              ; Modifies:
2370
                              ;               none
2371
                              ; Returns:
2372
                              ;               d = character or -1
2373
                              ;------------------------------------------------------------------------------
2374
 
2375
                              SerialPeekChar:
2376
 00FFEBCD 034011                          pshs    x,ccr
2377
 00FFEBCF 01A010                          sei
2378
 00FFEBD1 0D6131                          ldb             SerHeadRcv                              ; check if anything is in buffer
2379
 00FFEBD3 0D1133                          cmpb    SerTailRcv
2380
 00FFEBD5 027008                          beq             spcNoChars                              ; no?
2381
 00FFEBD7 08EBFF000                       ldx             #SerRcvBuf
2382
 00FFEBDA 04F                             clra
2383
 00FFEBDB 0E6815                          ldb             b,x                                                             ; get byte from buffer
2384
 00FFEBDD 020003                          bra             spcXit
2385
                              spcNoChars:
2386
 00FFEBDF 0CCFFFFFF                       ldd             #-1
2387
                              spcXit:
2388
 00FFEBE2 035091                          puls    x,ccr,pc
2389
 
2390
                              ;------------------------------------------------------------------------------
2391
                              ; SerialPeekChar
2392
                              ;               Get a character directly from the I/O port. This bypasses the input
2393
                              ; buffer.
2394
                              ;
2395
                              ; Stack Space:
2396
                              ;               0 words
2397
                              ; Parameters:
2398
                              ;               none
2399
                              ; Modifies:
2400
                              ;               d
2401
                              ; Returns:
2402
                              ;               d = character or -1
2403
                              ;------------------------------------------------------------------------------
2404
 
2405
                              SerialPeekCharDirect:
2406
 00FFEBE4 0150B6FFFFFFFE0                 lda             COREID                                                  ; Ensure we have the IO Focus
2407
 00FFEBE9 0B1FF0010                       cmpa    IOFocusID
2408
 00FFEBEC 026014                          bne             spcd0001
2409
                                      ; Disallow interrupts between status read and rx read.
2410
 00FFEBEE 01A010                          sei
2411
 00FFEBF0 0150F6FFFE30101                 ldb             ACIA+ACIA_STAT
2412
 00FFEBF5 0C5008                          bitb    #8                                                                      ; look for Rx not empty
2413
 00FFEBF7 027009                          beq             spcd0001
2414
 00FFEBF9 04F                             clra
2415
 00FFEBFA 0150F6FFFE30100                 ldb             ACIA+ACIA_RX
2416
 00FFEBFF 01C0EF                          cli
2417
 00FFEC01 039                             rts
2418
                              spcd0001:
2419
 00FFEC02 0CCFFFFFF                       ldd             #-1
2420
 00FFEC05 01C0EF                          cli
2421
 00FFEC07 039                             rts
2422
 
2423
                              ;------------------------------------------------------------------------------
2424
                              ; SerialPutChar
2425
                              ;    Put a character to the serial transmitter. This routine blocks until the
2426
                              ; transmitter is empty.
2427
                              ;
2428
                              ; Stack Space
2429
                              ;               0 words
2430
                              ; Parameters:
2431
                              ;               b = character to put
2432
                              ; Modifies:
2433
                              ;               none
2434
                              ;------------------------------------------------------------------------------
2435
 
2436
                              SerialPutChar:
2437
 00FFEC08 034003                          pshs    a,ccr
2438
                              spc0001:
2439
 00FFEC0A 0150B6FFFFFFFE0                 lda             COREID                                  ; Ensure we have the IO Focus
2440
 00FFEC0F 0B1FF0010                       cmpa    IOFocusID
2441
 00FFEC12 026FF6                          bne             spc0001
2442
 00FFEC14 01C0EF                          cli                                                                             ; provide a window for an interrupt to occur
2443
 00FFEC16 01A010                          sei
2444
                                      ; Between the status read and the transmit do not allow an
2445
                                      ; intervening interrupt.
2446
 00FFEC18 0150B6FFFE30101                 lda             ACIA+ACIA_STAT  ; wait until the uart indicates tx empty
2447
 00FFEC1D 085010                          bita    #16                                                     ; bit #4 of the status reg
2448
 00FFEC1F 027FE9                          beq             spc0001                     ; branch if transmitter is not empty
2449
 00FFEC21 0150F7FFFE30100                 stb             ACIA+ACIA_TX            ; send the byte
2450
 00FFEC26 035083                          puls    a,ccr,pc
2451
 
2452
                              ;------------------------------------------------------------------------------
2453
                              ; Calculate number of character in input buffer
2454
                              ;
2455
                              ; Parameters:
2456
                              ;               y = 0 if current core, otherwise reference to core memory area $Cyxxxx
2457
                              ; Returns:
2458
                              ;               d = number of bytes in buffer.
2459
                              ;------------------------------------------------------------------------------
2460
 
2461
                              SerialRcvCount:
2462
 00FFEC28 04F                             clra
2463
 00FFEC29 0E6A08133                       ldb             SerTailRcv,y
2464
 00FFEC2C 0E0A08131                       subb    SerHeadRcv,y
2465
 00FFEC2F 02C009                          bge             srcXit
2466
 00FFEC31 0CC001000                       ldd             #$1000
2467
 00FFEC34 0A3A08131                       subd    SerHeadRcv,y
2468
 00FFEC37 0E3A08133                       addd    SerTailRcv,y
2469
                              srcXit:
2470
 00FFEC3A 039                             rts
2471
 
2472
                              ;------------------------------------------------------------------------------
2473
                              ; Serial IRQ routine
2474
                              ;
2475
                              ; Keeps looping as long as it finds characters in the ACIA recieve buffer/fifo.
2476
                              ; Received characters are buffered. If the buffer becomes full, new characters
2477
                              ; will be lost.
2478
                              ;
2479
                              ; Parameters:
2480
                              ;               none
2481
                              ; Modifies:
2482
                              ;               d,x
2483
                              ; Returns:
2484
                              ;               none
2485
                              ;------------------------------------------------------------------------------
2486
 
2487
                              SerialIRQ:
2488
                              sirqNxtByte:
2489
 00FFEC3B 0150F6FFFE30101                 ldb             ACIA+ACIA_STAT  ; check the status
2490
 00FFEC40 0C5008                          bitb    #$08                                            ; bit 3 = rx full
2491
 00FFEC42 027049                          beq             notRxInt
2492
 00FFEC44 0150F6FFFE30100                 ldb             ACIA+ACIA_RX            ; get data from Rx buffer to clear interrupt
2493
 00FFEC49 0C1014                          cmpb    #CTRLT                                  ; detect special keystroke
2494
 00FFEC4B 026000                          bne     sirq0001
2495
                              ;       bsr     DumpTraceQueue
2496
                              sirq0001:
2497
 00FFEC4D 034004                          pshs    b
2498
                                      ; Compute receive buffer address
2499
 00FFEC4F 0B6FF0010                       lda             IOFocusID
2500
 00FFEC52 048                             asla
2501
 00FFEC53 048                             asla
2502
 00FFEC54 048                             asla
2503
 00FFEC55 048                             asla
2504
 00FFEC56 08AC00                          ora             #$C00
2505
 00FFEC58 05F                             clrb
2506
 00FFEC59 01F002                          tfr             d,y
2507
 00FFEC5B 035004                          puls    b
2508
 00FFEC5D 0A6A08133                       lda             SerTailRcv,y                    ; check if recieve buffer full
2509
 00FFEC60 04C                             inca
2510
 00FFEC61 0A1A08131                       cmpa    SerHeadRcv,y
2511
 00FFEC64 027027                          beq             sirqRxFull
2512
 00FFEC66 0A7A08133                       sta             SerTailRcv,y            ; update tail pointer
2513
 00FFEC69 04A                             deca                                                                    ; backup
2514
 00FFEC6A 01E089                          exg             a,b
2515
 00FFEC6C 030A0A000BFF000                 leax    SerRcvBuf,y                     ; x = buffer address
2516
 00FFEC71 0A7A0F                          sta             b,x                                                     ; store recieved byte in buffer
2517
 00FFEC73 06DA08140                       tst             SerRcvXoff,y            ; check if xoff already sent
2518
 00FFEC76 026FC3                          bne             sirqNxtByte
2519
 00FFEC78 08DFAE                          bsr             SerialRcvCount  ; if more than 4080 chars in buffer
2520
 00FFEC7A 0C1FF0                          cmpb    #4080
2521
 00FFEC7C 025FBD                          blo             sirqNxtByte
2522
 00FFEC7E 0C6013                          ldb             #XOFF                                           ; send an XOFF
2523
 00FFEC80 06FA08139                       clr             SerRcvXon,y                     ; clear XON status
2524
 00FFEC83 0E7A08140                       stb             SerRcvXoff,y            ; set XOFF status
2525
 00FFEC86 0150F7FFFE30100                 stb             ACIA+ACIA_TX
2526
 00FFEC8B 020FAE                          bra             sirqNxtByte     ; check the status for another byte
2527
                              sirqRxFull:
2528
                              notRxInt:
2529
 00FFEC8D 039                             rts
2530
 
2531
                              nmeSerial:
2532
 00FFEC8E 05306507206906106C000           fcb             "Serial",0
2533
 
2534
                              ;------------------------------------------------------------------------------
2535
                              ; Put a string to the serial port.
2536
                              ;
2537
                              ; Parameters:
2538
                              ;               d = pointer to string
2539
                              ; Modifies:
2540
                              ;               none
2541
                              ; Returns:
2542
                              ;               none
2543
                              ;------------------------------------------------------------------------------
2544
 
2545
                              SerialPutString:
2546
 00FFEC95 034016                          pshs    d,x
2547
 00FFEC97 01F001                          tfr             d,x
2548
                              sps2:
2549
 00FFEC99 0E6804                          ldb             ,x
2550
 00FFEC9B 027006                          beq             spsXit
2551
 00FFEC9D 030001                          inx
2552
 00FFEC9F 08DF67                          bsr             SerialPutChar
2553
 00FFECA1 020FF6                          bra             sps2
2554
                              spsXit:
2555
 00FFECA3 035096                          puls    d,x,pc
2556
 
2557
                              ;------------------------------------------------------------------------------
2558
                              ; A little routine to test serial output.
2559
                              ;
2560
                              ; Parameters:
2561
                              ;               none
2562
                              ; Modifies:
2563
                              ;               none
2564
                              ; Returns:
2565
                              ;               none
2566
                              ;------------------------------------------------------------------------------
2567
 
2568
                              SerialOutputTest:
2569
 00FFECA5 034006                          pshs    d
2570
 00FFECA7 0CCFFECC5                       ldd             #msgSerialTest
2571
 00FFECAA 017FFF6F5                       lbsr    DisplayString
2572
*** warning 1: Long branch within short branch range could be optimized
2573
 00FFECAD 08DEC0                          bsr             SerialInit
2574
                              sotst1:
2575
 00FFECAF 0C6011                          ldb             #XON
2576
 00FFECB1 08DF55                          bsr             SerialPutChar
2577
 00FFECB3 08DF53                          bsr             SerialPutChar
2578
 00FFECB5 08DF51                          bsr             SerialPutChar
2579
 00FFECB7 0CCFFECC5                       ldd             #msgSerialTest
2580
 00FFECBA 08DFD9                          bsr             SerialPutString
2581
 00FFECBC 01700001B                       lbsr    INCH
2582
 00FFECBF 0C1003                          cmpb    #CTRLC
2583
 00FFECC1 026FEC                          bne             sotst1
2584
 00FFECC3 035086                          puls    d,pc
2585
 
2586
                              msgSerialTest:
2587
 00FFECC5 05306507206906106C020           fcb     "Serial port test",CR,LF,0
2588
 00FFECCC 07006F072074020074065
2589
 00FFECD3 07307400D00A000
2590
 
2591
 
2592
                              ;------------------------------------------------------------------------------
2593 4 robfinch
                              ; Check if there is a keyboard character available. If so return true (<0)
2594
                              ; otherwise return false (0) in accb.
2595
                              ;------------------------------------------------------------------------------
2596
                              ;
2597
                              KeybdCheckForKeyDirect:
2598 13 robfinch
 00FFECD8 020D36                          bra             DBGCheckForKey
2599 4 robfinch
 
2600
                              ;------------------------------------------------------------------------------
2601
                              ;------------------------------------------------------------------------------
2602
                              INCH:
2603 13 robfinch
 00FFECDA 034004                          pshs    b
2604
                              INCH2:
2605
 00FFECDC 0150F6FFFFFFFE0                 ldb             COREID
2606
 00FFECE1 0F1FF0010                       cmpb    IOFocusID       ; if we do not have focus, block
2607
 00FFECE4 026FF6                          bne             INCH2
2608
                              ;       ldb             #$800                   ; block if no key available, get scancode directly
2609
                              ;       bra             GetKey
2610
                              ;       jsr             [CharInVec]     ; vector is being overwritten somehow
2611
 00FFECE6 017FFFEFB                       lbsr    SerialPeekCharDirect
2612
*** warning 1: Long branch within short branch range could be optimized
2613
 00FFECE9 04D                             tsta
2614
 00FFECEA 02B003                          bmi             INCH1                   ; block if no key available
2615
 00FFECEC 032601                          leas    1,s                             ; get rid of blocking status
2616
 00FFECEE 039                             rts
2617
                              INCH1:
2618
 00FFECEF 035004                          puls    b                                       ; check blocking status
2619
 00FFECF1 05D                             tstb
2620
 00FFECF2 02BFE6                          bmi     INCH                    ; if blocking, loop
2621
 00FFECF4 0CCFFFFFF                       ldd             #-1                             ; return -1 if no char available
2622
 00FFECF7 039                             rts
2623 4 robfinch
 
2624
                              INCHE:
2625 13 robfinch
 00FFECF8 08DFE0                          bsr             INCH
2626
 00FFECFA 020009                          bra             INCHEK3
2627 4 robfinch
 
2628
                              INCHEK:
2629 13 robfinch
 00FFECFC 08DFDC                          bsr             INCH
2630
 00FFECFE 01507DFFFFFCA00                 tst             KeybdEcho
2631
 00FFED03 02700C                          beq             INCHEK1
2632 4 robfinch
                              INCHEK3:
2633 13 robfinch
 00FFED05 08100D                          cmpa    #CR
2634
 00FFED07 026005                          bne             INCHEK2
2635
 00FFED09 017FFE3C6                       lbsr            CRLF
2636 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
2637 13 robfinch
 00FFED0C 020003                          bra             INCHEK1
2638 4 robfinch
                              INCHEK2:
2639 13 robfinch
 00FFED0E 017FFF5D0                       lbsr    DisplayChar
2640
*** warning 1: Long branch within short branch range could be optimized
2641 4 robfinch
                              INCHEK1:
2642 13 robfinch
 00FFED11 039                             rts
2643 4 robfinch
 
2644
                              OUTCH:
2645 13 robfinch
 00FFED12 06E90F000800                    jmp             [CharOutVec]
2646 4 robfinch
 
2647
                              ;------------------------------------------------------------------------------
2648
                              ; r1 0=echo off, non-zero = echo on
2649
                              ;------------------------------------------------------------------------------
2650
                              ;
2651
                              SetKeyboardEcho:
2652 13 robfinch
 00FFED16 0150F7FFFFFCA00                 stb             KeybdEcho
2653
 00FFED1B 039                             rts
2654 4 robfinch
 
2655
 
2656
                              ;------------------------------------------------------------------------------
2657
                              ; Parameters:
2658
                              ;               x,d     bitmap of sprites to enable
2659
                              ;------------------------------------------------------------------------------
2660
 
2661
                              ShowSprites:
2662 13 robfinch
 00FFED1C 0150BFFFFE103C0                 stx             SPRITE_CTRL+SPRITE_EN
2663
 00FFED21 0150FDFFFE103C2                 std             SPRITE_CTRL+SPRITE_EN+2
2664
 00FFED26 039                             rts
2665 4 robfinch
 
2666
                              ;==============================================================================
2667 13 robfinch
                              ; Femtiki Operating System.
2668
                              ;==============================================================================
2669
 
2670
                              OSCallTbl:
2671
 00FFED27 000000                          fcw             0
2672
 00FFED29 000000                          fcw             0
2673
 00FFED2B 000000                          fcw             0
2674
 00FFED2D 000000                          fcw             0
2675
 00FFED2F 000000                          fcw             0
2676
 00FFED31 000000                          fcw             0
2677
 00FFED33 000000                          fcw             0
2678
 00FFED35 000000                          fcw             0
2679
 00FFED37 000000                          fcw             0
2680
 00FFED39 000000                          fcw             0
2681
 00FFED3B 000000                          fcw             0
2682
 00FFED3D 000000                          fcw             0
2683
 00FFED3F 000000                          fcw             0
2684
 00FFED41 000000                          fcw             0
2685
 00FFED43 000000                          fcw             0
2686
 00FFED45 000000                          fcw             0
2687
 00FFED47 000000                          fcw             0
2688
 00FFED49 000000                          fcw             0
2689
 00FFED4B 000000                          fcw             0
2690
 00FFED4D 000000                          fcw             0
2691
 00FFED4F 000000                          fcw             0
2692
 00FFED51 000000                          fcw             0
2693
 00FFED53 FFED84                          fcw             ReleaseIOFocus
2694
 00FFED55 000000                          fcw             0
2695
 00FFED57 FFED6D                          fcw             RequestIOFocus
2696
 
2697
                              OSCall:
2698
                                      ; wait for availability
2699
                              osc1:
2700
 00FFED59 07DEF0011                       tst             OSSEMA+1
2701
 00FFED5C 027FFB                          beq             osc1
2702
 00FFED5E 058                             aslb
2703
 00FFED5F 08EFFED27                       ldx             #OSCallTbl
2704
 00FFED62 03A                             abx
2705
 00FFED63 06D804                          tst             ,x
2706
 00FFED65 027002                          beq             oscx
2707
 00FFED67 06E904                          jmp             [,x]
2708
                              oscx:
2709
 00FFED69 07FEF0011                       clr             OSSEMA+1
2710
 00FFED6C 039                             rts
2711
 
2712
                              RequestIOFocus:
2713
 00FFED6D 0150F6FFFFFFFE0                 ldb             COREID
2714
 00FFED72 08EFF0000                       ldx             #IOFocusList
2715
 00FFED75 03A                             abx
2716
 00FFED76 0A7804                          sta             ,x
2717
 00FFED78 07DFF0010                       tst             IOFocusID
2718
 00FFED7B 126FFFFEB                       lbne    oscx
2719
*** warning 1: Long branch within short branch range could be optimized
2720
 00FFED7E 0F7FF0010                       stb             IOFocusID
2721
 00FFED81 016FFFFE5                       lbra    oscx
2722
*** warning 1: Long branch within short branch range could be optimized
2723
 
2724
                              ReleaseIOFocus:
2725
 00FFED84 0150F6FFFFFFFE0                 ldb             COREID
2726
 00FFED89 08EFF0000                       ldx             #IOFocusList
2727
 00FFED8C 03A                             abx
2728
 00FFED8D 06F804                          clr             ,x                                              ; clear the request indicator
2729
 00FFED8F 017FFF44F                       lbsr    CopyScreenToVirtualScreen
2730
*** warning 1: Long branch within short branch range could be optimized
2731
 00FFED92 0F1FF0010                       cmpb    IOFocusID                       ; are we the one with the focus?
2732
 00FFED95 126FFFFD1                       lbne    oscx
2733
*** warning 1: Long branch within short branch range could be optimized
2734
                                      ; We had the focus, so now a new core needs the focus.
2735
                                      ; Search the focus list for a requestor. If no requester
2736
                                      ; is found, give focus to core #1.
2737
 00FFED98 08600F                          lda             #15
2738
                              riof2:
2739
 00FFED9A 05C                             incb
2740
 00FFED9B 0C400F                          andb    #15
2741
 00FFED9D 03A                             abx
2742
 00FFED9E 06D804                          tst             ,x
2743
 00FFEDA0 026009                          bne             riof1
2744
 00FFEDA2 04A                             deca
2745
 00FFEDA3 026FF5                          bne             riof2
2746
                                      ; If no focus is requested by anyone, give to core #1
2747
 00FFEDA5 0C6001                          ldb             #1
2748
 00FFEDA7 086018                          lda             #24
2749
 00FFEDA9 0A7804                          sta             ,x
2750
                              riof1:
2751
 00FFEDAB 0F7FF0010                       stb             IOFocusID
2752
 00FFEDAE 017FFF3F9                       lbsr    CopyVirtualScreenToScreen
2753
*** warning 1: Long branch within short branch range could be optimized
2754
 00FFEDB1 016FFFFB5                       lbra    oscx
2755
*** warning 1: Long branch within short branch range could be optimized
2756
 
2757
 
2758
                              ;==============================================================================
2759
                              ; Disassembler
2760
                              ;==============================================================================
2761
 
2762
                              ; ============================================================================
2763
                              ;        __
2764
                              ;   \\__/ o\    (C) 2013-2022  Robert Finch, Waterloo
2765
                              ;    \  __ /    All rights reserved.
2766
                              ;     \/_//     robfinch@opencores.org
2767
                              ;       ||
2768
                              ;
2769
                              ;
2770
                              ; BSD 3-Clause License
2771
                              ; Redistribution and use in source and binary forms, with or without
2772
                              ; modification, are permitted provided that the following conditions are met:
2773
                              ;
2774
                              ; 1. Redistributions of source code must retain the above copyright notice, this
2775
                              ;    list of conditions and the following disclaimer.
2776
                              ;
2777
                              ; 2. Redistributions in binary form must reproduce the above copyright notice,
2778
                              ;    this list of conditions and the following disclaimer in the documentation
2779
                              ;    and/or other materials provided with the distribution.
2780
                              ;
2781
                              ; 3. Neither the name of the copyright holder nor the names of its
2782
                              ;    contributors may be used to endorse or promote products derived from
2783
                              ;    this software without specific prior written permission.
2784
                              ;
2785
                              ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2786
                              ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2787
                              ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2788
                              ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2789
                              ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2790
                              ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2791
                              ; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2792
                              ; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2793
                              ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2794
                              ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2795
                              ;
2796
                              ; ============================================================================
2797
                              ;
2798
                              ; Disassembler
2799
                              ;
2800
                              ;
2801
                              DIRECT  EQU     1
2802
                              LSREL           EQU     2
2803
                              IMMB            EQU     3
2804
                              SREL            EQU     4
2805
                              NDX                     EQU     5
2806
                              EXT                     EQU     6
2807
                              IMMW            EQU     7
2808
                              FAREXT  EQU     8
2809
 
2810
                              distbl1:
2811
                                      ; 00 to 0F
2812
 00FFEDB4 04E045047020001                 fcb             "NEG ", DIRECT
2813
 00FFEDB9 020020020020000                 fcb             "    ", 0
2814
 00FFEDBE 020020020020000                 fcb             "    ", 0
2815
 00FFEDC3 04304F04D020001                 fcb             "COM ", DIRECT
2816
 00FFEDC8 04C053052020001                 fcb             "LSR ", DIRECT
2817
 00FFEDCD 020020020020000                 fcb             "    ", 0
2818
 00FFEDD2 05204F052020001                 fcb             "ROR ", DIRECT
2819
 00FFEDD7 041053052020001                 fcb             "ASR ", DIRECT
2820
 00FFEDDC 04105304C020001                 fcb             "ASL ", DIRECT
2821
 00FFEDE1 05204F04C020001                 fcb             "ROL ", DIRECT
2822
 00FFEDE6 044045043020001                 fcb             "DEC ", DIRECT
2823
 00FFEDEB 020020020020000                 fcb             "    ", 0
2824
 00FFEDF0 04904E043020001                 fcb             "INC ", DIRECT
2825
 00FFEDF5 054053054020001                 fcb             "TST ", DIRECT
2826
 00FFEDFA 04A04D050020001                 fcb             "JMP ", DIRECT
2827
 00FFEDFF 04304C052020001                 fcb             "CLR ", DIRECT
2828
 
2829
                                      ; 10 to 1F
2830
 00FFEE04 020020020020000                 fcb             "    ", 0
2831
 00FFEE09 020020020020000                 fcb             "    ", 0
2832
 00FFEE0E 04E04F050020000                 fcb             "NOP ", 0
2833
 00FFEE13 05305904E043000                 fcb             "SYNC", 0
2834
 00FFEE18 020020020020000                 fcb             "    ", 0
2835
 00FFEE1D 046041052020000                 fcb             "FAR ", 0
2836
 00FFEE22 04C042052041002                 fcb             "LBRA", LSREL
2837
 00FFEE27 04C042053052002                 fcb             "LBSR", LSREL
2838
 00FFEE2C 020020020020000                 fcb             "    ", 0
2839
 00FFEE31 044041041020000                 fcb             "DAA ", 0
2840
 00FFEE36 04F052043043003                 fcb             "ORCC", IMMB
2841
 00FFEE3B 020020020020000                 fcb             "    ", 0
2842
 00FFEE40 04104E044043003                 fcb             "ANDC", IMMB
2843
 00FFEE45 053045058020000                 fcb             "SEX ", 0
2844
 00FFEE4A 045058047020003                 fcb             "EXG ", IMMB
2845
 00FFEE4F 054046052020003                 fcb             "TFR ", IMMB
2846
 
2847
                                      ; 20 to 2F
2848
 00FFEE54 042052041020004                 fcb             "BRA ", SREL
2849
 00FFEE59 04205204E020004                 fcb             "BRN ", SREL
2850
 00FFEE5E 042048049020004                 fcb             "BHI ", SREL
2851
 00FFEE63 04204C053020004                 fcb             "BLS ", SREL
2852
 00FFEE68 042048053020004                 fcb             "BHS ", SREL
2853
 00FFEE6D 04204C04F020004                 fcb             "BLO ", SREL
2854
 00FFEE72 04204E045020004                 fcb             "BNE ", SREL
2855
 00FFEE77 042045051020004                 fcb             "BEQ ", SREL
2856
 00FFEE7C 042056043020004                 fcb             "BVC ", SREL
2857
 00FFEE81 042056053020004                 fcb             "BVS ", SREL
2858
 00FFEE86 04205004C020004                 fcb             "BPL ", SREL
2859
 00FFEE8B 04204D049020004                 fcb             "BMI ", SREL
2860
 00FFEE90 042047045020004                 fcb             "BGE ", SREL
2861
 00FFEE95 04204C054020004                 fcb             "BLT ", SREL
2862
 00FFEE9A 042047054020004                 fcb             "BGT ", SREL
2863
 00FFEE9F 04204C045020004                 fcb             "BLE ", SREL
2864
 
2865
                                      ; 30 to 3F
2866
 00FFEEA4 04C045041058005                 fcb             "LEAX", NDX
2867
 00FFEEA9 04C045041059005                 fcb             "LEAY", NDX
2868
 00FFEEAE 04C045041053005                 fcb             "LEAS", NDX
2869
 00FFEEB3 04C045041055005                 fcb             "LEAU", NDX
2870
 00FFEEB8 050053048053003                 fcb             "PSHS", IMMB
2871
 00FFEEBD 05005504C053003                 fcb             "PULS", IMMB
2872
 00FFEEC2 050053048055003                 fcb             "PSHU", IMMB
2873
 00FFEEC7 05005504C055003                 fcb             "PULU", IMMB
2874
 00FFEECC 052054046020000                 fcb             "RTF ", 0
2875
 00FFEED1 052054053020000                 fcb             "RTS ", 0
2876
 00FFEED6 041042058020000                 fcb             "ABX ", 0
2877
 00FFEEDB 052054049020000                 fcb             "RTI ", 0
2878
 00FFEEE0 043057041049003                 fcb             "CWAI", IMMB
2879
 00FFEEE5 04D05504C020000                 fcb             "MUL ", 0
2880
 00FFEEEA 020020020020000                 fcb             "    ", 0
2881
 00FFEEEF 053057049020000                 fcb             "SWI ", 0
2882
 
2883
                                      ; 40 to 4F
2884
 00FFEEF4 04E045047041000                 fcb             "NEGA", 0
2885
 00FFEEF9 020020020020000                 fcb             "    ", 0
2886
 00FFEEFE 020020020020000                 fcb       "    ", 0
2887
 00FFEF03 04304F04D041000                 fcb             "COMA", 0
2888
 00FFEF08 04C053052041000                 fcb             "LSRA", 0
2889
 00FFEF0D 020020020020000                 fcb             "    ", 0
2890
 00FFEF12 05204F052041000                 fcb             "RORA", 0
2891
 00FFEF17 041053052041000                 fcb             "ASRA", 0
2892
 00FFEF1C 04105304C041000                 fcb             "ASLA", 0
2893
 00FFEF21 05204F04C041000                 fcb             "ROLA", 0
2894
 00FFEF26 044045043041000                 fcb             "DECA", 0
2895
 00FFEF2B 020020020020000                 fcb             "    ", 0
2896
 00FFEF30 04904E043041000                 fcb             "INCA", 0
2897
 00FFEF35 054053054041000                 fcb             "TSTA", 0
2898
 00FFEF3A 020020020020000                 fcb             "    ", 0
2899
 00FFEF3F 04304C052041000                 fcb             "CLRA", 0
2900
 
2901
                                      ; 50 to 5F
2902
 00FFEF44 04E045047042000                 fcb             "NEGB", 0
2903
 00FFEF49 020020020020000                 fcb             "    ", 0
2904
 00FFEF4E 020020020020000                 fcb       "    ", 0
2905
 00FFEF53 04304F04D042000                 fcb             "COMB", 0
2906
 00FFEF58 04C053052042000                 fcb             "LSRB", 0
2907
 00FFEF5D 020020020020000                 fcb             "    ", 0
2908
 00FFEF62 05204F052042000                 fcb             "RORB", 0
2909
 00FFEF67 041053052042000                 fcb             "ASRB", 0
2910
 00FFEF6C 04105304C042000                 fcb             "ASLB", 0
2911
 00FFEF71 05204F04C042000                 fcb             "ROLB", 0
2912
 00FFEF76 044045043042000                 fcb             "DECB", 0
2913
 00FFEF7B 020020020020000                 fcb             "    ", 0
2914
 00FFEF80 04904E043042000                 fcb             "INCB", 0
2915
 00FFEF85 054053054042000                 fcb             "TSTB", 0
2916
 00FFEF8A 020020020020000                 fcb             "    ", 0
2917
 00FFEF8F 04304C052042000                 fcb             "CLRB", 0
2918
 
2919
                                      ; 60 to 6F
2920
 00FFEF94 04E045047020005                 fcb             "NEG ", NDX
2921
 00FFEF99 020020020020000                 fcb             "    ", 0
2922
 00FFEF9E 020020020020000                 fcb       "    ", 0
2923
 00FFEFA3 04304F04D020005                 fcb             "COM ", NDX
2924
 00FFEFA8 04C053052020005                 fcb             "LSR ", NDX
2925
 00FFEFAD 020020020020000                 fcb             "    ", 0
2926
 00FFEFB2 05204F052020005                 fcb             "ROR ", NDX
2927
 00FFEFB7 041053052020005                 fcb             "ASR ", NDX
2928
 00FFEFBC 04105304C020005                 fcb             "ASL ", NDX
2929
 00FFEFC1 05204F04C020005                 fcb             "ROL ", NDX
2930
 00FFEFC6 044045043020005                 fcb             "DEC ", NDX
2931
 00FFEFCB 020020020020000                 fcb             "    ", 0
2932
 00FFEFD0 04904E043020005                 fcb             "INC ", NDX
2933
 00FFEFD5 054053054020005                 fcb             "TST ", NDX
2934
 00FFEFDA 04A04D050020005                 fcb             "JMP ", NDX
2935
 00FFEFDF 04304C052020005                 fcb             "CLR ", NDX
2936
 
2937
                                      ; 70 to 7F
2938
 00FFEFE4 04E045047020006                 fcb             "NEG ", EXT
2939
 00FFEFE9 020020020020000                 fcb             "    ", 0
2940
 00FFEFEE 020020020020000                 fcb       "    ", 0
2941
 00FFEFF3 04304F04D020006                 fcb             "COM ", EXT
2942
 00FFEFF8 04C053052020006                 fcb             "LSR ", EXT
2943
 00FFEFFD 020020020020000                 fcb             "    ", 0
2944
 00FFF002 05204F052020006                 fcb             "ROR ", EXT
2945
 00FFF007 041053052020006                 fcb             "ASR ", EXT
2946
 00FFF00C 04105304C020006                 fcb             "ASL ", EXT
2947
 00FFF011 05204F04C020006                 fcb             "ROL ", EXT
2948
 00FFF016 044045043020006                 fcb             "DEC ", EXT
2949
 00FFF01B 020020020020000                 fcb             "    ", 0
2950
 00FFF020 04904E043020006                 fcb             "INC ", EXT
2951
 00FFF025 054053054020006                 fcb             "TST ", EXT
2952
 00FFF02A 04A04D050020006                 fcb             "JMP ", EXT
2953
 00FFF02F 04304C052020006                 fcb             "CLR ", EXT
2954
 
2955
                                      ; 80 to 8F
2956
 00FFF034 053055042041003                 fcb             "SUBA", IMMB
2957
 00FFF039 04304D050041003                 fcb             "CMPA", IMMB
2958
 00FFF03E 053042043041003                 fcb             "SBCA", IMMB
2959
 00FFF043 053055042044007                 fcb             "SUBD", IMMW
2960
 00FFF048 04104E044041003                 fcb             "ANDA", IMMB
2961
 00FFF04D 042049054041003                 fcb             "BITA", IMMB
2962
 00FFF052 04C044041020003                 fcb             "LDA ", IMMB
2963
 00FFF057 020020020020000                 fcb             "    ", 0
2964
 00FFF05C 04504F052041003                 fcb             "EORA", IMMB
2965
 00FFF061 041044043041003                 fcb             "ADCA", IMMB
2966
 00FFF066 04F052041020003                 fcb             "ORA ", IMMB
2967
 00FFF06B 041044044041003                 fcb             "ADDA", IMMB
2968
 00FFF070 04304D050058007                 fcb             "CMPX", IMMW
2969
 00FFF075 042053052020004                 fcb             "BSR ", SREL
2970
 00FFF07A 04C044058020007                 fcb             "LDX ", IMMW
2971
 00FFF07F 04A04D046020008                 fcb             "JMF ", FAREXT
2972
 
2973
                                      ; 90 to 9F
2974
 00FFF084 053055042041001                 fcb             "SUBA", DIRECT
2975
 00FFF089 04304D050041001                 fcb             "CMPA", DIRECT
2976
 00FFF08E 053042043041001                 fcb             "SBCA", DIRECT
2977
 00FFF093 053055042044001                 fcb             "SUBD", DIRECT
2978
 00FFF098 04104E044041001                 fcb             "ANDA", DIRECT
2979
 00FFF09D 042049054041001                 fcb             "BITA", DIRECT
2980
 00FFF0A2 04C044041020001                 fcb             "LDA ", DIRECT
2981
 00FFF0A7 053054041020001                 fcb             "STA ", DIRECT
2982
 00FFF0AC 04504F052041001                 fcb             "EORA", DIRECT
2983
 00FFF0B1 041044043041001                 fcb             "ADCA", DIRECT
2984
 00FFF0B6 04F052041020001                 fcb             "ORA ", DIRECT
2985
 00FFF0BB 041044044041001                 fcb             "ADDA", DIRECT
2986
 00FFF0C0 04304D050058001                 fcb             "CMPX", DIRECT
2987
 00FFF0C5 04A053052020001                 fcb             "JSR ", DIRECT
2988
 00FFF0CA 04C044058020001                 fcb             "LDX ", DIRECT
2989
 00FFF0CF 053054058020001                 fcb             "STX ", DIRECT
2990
 
2991
                                      ; A0 to AF
2992
 00FFF0D4 053055042041005                 fcb             "SUBA", NDX
2993
 00FFF0D9 04304D050041005                 fcb             "CMPA", NDX
2994
 00FFF0DE 053042043041005                 fcb             "SBCA", NDX
2995
 00FFF0E3 053055042044005                 fcb             "SUBD", NDX
2996
 00FFF0E8 04104E044041005                 fcb             "ANDA", NDX
2997
 00FFF0ED 042049054041005                 fcb             "BITA", NDX
2998
 00FFF0F2 04C044041020005                 fcb             "LDA ", NDX
2999
 00FFF0F7 053054041020005                 fcb             "STA ", NDX
3000
 00FFF0FC 04504F052041005                 fcb             "EORA", NDX
3001
 00FFF101 041044043041005                 fcb             "ADCA", NDX
3002
 00FFF106 04F052041020005                 fcb             "ORA ", NDX
3003
 00FFF10B 041044044041005                 fcb             "ADDA", NDX
3004
 00FFF110 04304D050058005                 fcb             "CMPX", NDX
3005
 00FFF115 04A053052020005                 fcb             "JSR ", NDX
3006
 00FFF11A 04C044058020005                 fcb             "LDX ", NDX
3007
 00FFF11F 053054058020005                 fcb             "STX ", NDX
3008
 
3009
                                      ; B0 to BF
3010
 00FFF124 053055042041006                 fcb             "SUBA", EXT
3011
 00FFF129 04304D050041006                 fcb             "CMPA", EXT
3012
 00FFF12E 053042043041006                 fcb             "SBCA", EXT
3013
 00FFF133 053055042044006                 fcb             "SUBD", EXT
3014
 00FFF138 04104E044041006                 fcb             "ANDA", EXT
3015
 00FFF13D 042049054041006                 fcb             "BITA", EXT
3016
 00FFF142 04C044041020006                 fcb             "LDA ", EXT
3017
 00FFF147 053054041020006                 fcb             "STA ", EXT
3018
 00FFF14C 04504F052041006                 fcb             "EORA", EXT
3019
 00FFF151 041044043041006                 fcb             "ADCA", EXT
3020
 00FFF156 04F052041020006                 fcb             "ORA ", EXT
3021
 00FFF15B 041044044041006                 fcb             "ADDA", EXT
3022
 00FFF160 04304D050058006                 fcb             "CMPX", EXT
3023
 00FFF165 04A053052020006                 fcb             "JSR ", EXT
3024
 00FFF16A 04C044058020006                 fcb             "LDX ", EXT
3025
 00FFF16F 053054058020006                 fcb             "STX ", EXT
3026
 
3027
                                      ; C0 to CF
3028
 00FFF174 053055042042003                 fcb             "SUBB", IMMB
3029
 00FFF179 04304D050042003                 fcb             "CMPB", IMMB
3030
 00FFF17E 053042043062003                 fcb             "SBCb", IMMB
3031
 00FFF183 041044044044007                 fcb             "ADDD", IMMW
3032
 00FFF188 04104E044042003                 fcb             "ANDB", IMMB
3033
 00FFF18D 042049054042003                 fcb             "BITB", IMMB
3034
 00FFF192 04C044042020003                 fcb             "LDB ", IMMB
3035
 00FFF197 020020020020000                 fcb             "    ", 0
3036
 00FFF19C 04504F052042003                 fcb             "EORB", IMMB
3037
 00FFF1A1 041044043042003                 fcb             "ADCB", IMMB
3038
 00FFF1A6 04F052042020003                 fcb             "ORB ", IMMB
3039
 00FFF1AB 041044044042003                 fcb             "ADDB", IMMB
3040
 00FFF1B0 04C044044020007                 fcb             "LDD ", IMMW
3041
 00FFF1B5 020020020020004                 fcb             "    ", SREL
3042
 00FFF1BA 04C044055020007                 fcb             "LDU ", IMMW
3043
 00FFF1BF 04A053046020008                 fcb             "JSF ", FAREXT
3044
 
3045
                                      ; D0 to DF
3046
 00FFF1C4 053055042042001                 fcb             "SUBB", DIRECT
3047
 00FFF1C9 04304D050042001                 fcb             "CMPB", DIRECT
3048
 00FFF1CE 053042043042001                 fcb             "SBCB", DIRECT
3049
 00FFF1D3 041044044044001                 fcb             "ADDD", DIRECT
3050
 00FFF1D8 04104E044042001                 fcb             "ANDB", DIRECT
3051
 00FFF1DD 042049054042001                 fcb             "BITB", DIRECT
3052
 00FFF1E2 04C044042020001                 fcb             "LDB ", DIRECT
3053
 00FFF1E7 053054042020001                 fcb             "STB ", DIRECT
3054
 00FFF1EC 04504F052042001                 fcb             "EORB", DIRECT
3055
 00FFF1F1 041044043042001                 fcb             "ADCB", DIRECT
3056
 00FFF1F6 04F052042020001                 fcb             "ORB ", DIRECT
3057
 00FFF1FB 041044044042001                 fcb             "ADDB", DIRECT
3058
 00FFF200 04C044044020001                 fcb             "LDD ", DIRECT
3059
 00FFF205 053054044020001                 fcb             "STD ", DIRECT
3060
 00FFF20A 04C044055020001                 fcb             "LDU ", DIRECT
3061
 00FFF20F 053054055020001                 fcb             "STU ", DIRECT
3062
 
3063
                                      ; E0 to EF
3064
 00FFF214 053055042042005                 fcb             "SUBB", NDX
3065
 00FFF219 04304D050042005                 fcb             "CMPB", NDX
3066
 00FFF21E 053042043042005                 fcb             "SBCB", NDX
3067
 00FFF223 041044044044005                 fcb             "ADDD", NDX
3068
 00FFF228 04104E044042005                 fcb             "ANDB", NDX
3069
 00FFF22D 042049054042005                 fcb             "BITB", NDX
3070
 00FFF232 04C044042020005                 fcb             "LDB ", NDX
3071
 00FFF237 053054042020005                 fcb             "STB ", NDX
3072
 00FFF23C 04504F052042005                 fcb             "EORB", NDX
3073
 00FFF241 041044043042005                 fcb             "ADCB", NDX
3074
 00FFF246 04F052042020005                 fcb             "ORB ", NDX
3075
 00FFF24B 041044044042005                 fcb             "ADDB", NDX
3076
 00FFF250 04C044044020005                 fcb             "LDD ", NDX
3077
 00FFF255 053054044020005                 fcb             "STD ", NDX
3078
 00FFF25A 04C044055020005                 fcb             "LDU ", NDX
3079
 00FFF25F 053054055020005                 fcb             "STU ", NDX
3080
 
3081
                                      ; F0 to FF
3082
 00FFF264 053055042042006                 fcb             "SUBB", EXT
3083
 00FFF269 04304D050042006                 fcb             "CMPB", EXT
3084
 00FFF26E 053042043042006                 fcb             "SBCB", EXT
3085
 00FFF273 041044044044006                 fcb             "ADDD", EXT
3086
 00FFF278 04104E044042006                 fcb             "ANDB", EXT
3087
 00FFF27D 042049054042006                 fcb             "BITB", EXT
3088
 00FFF282 04C044042020006                 fcb             "LDB ", EXT
3089
 00FFF287 053054042020006                 fcb             "STB ", EXT
3090
 00FFF28C 04504F052042006                 fcb             "EORB", EXT
3091
 00FFF291 041044043042006                 fcb             "ADCB", EXT
3092
 00FFF296 04F052042020006                 fcb             "ORB ", EXT
3093
 00FFF29B 041044044042006                 fcb             "ADDB", EXT
3094
 00FFF2A0 04C044044020006                 fcb             "LDD ", EXT
3095
 00FFF2A5 053054044020006                 fcb             "STD ", EXT
3096
 00FFF2AA 04C044055020006                 fcb             "LDU ", EXT
3097
 00FFF2AF 053054055020006                 fcb             "STU ", EXT
3098
 
3099
                                      ; 120 to 12F
3100
                              distbl2:
3101
 00FFF2B4 04C042052041                    fcb             "LBRA"
3102
 00FFF2B8 04C04205204E                    fcb             "LBRN"
3103
 00FFF2BC 04C042048049                    fcb             "LBHI"
3104
 00FFF2C0 04C04204C053                    fcb             "LBLS"
3105
 00FFF2C4 04C042048053                    fcb             "LBHS"
3106
 00FFF2C8 04C04204C04F                    fcb             "LBLO"
3107
 00FFF2CC 04C04204E045                    fcb             "LBNE"
3108
 00FFF2D0 04C042045051                    fcb             "LBEQ"
3109
 00FFF2D4 04C042056043                    fcb             "LBVC"
3110
 00FFF2D8 04C042056053                    fcb             "LBVS"
3111
 00FFF2DC 04C04205004C                    fcb             "LBPL"
3112
 00FFF2E0 04C04204D049                    fcb             "LBMI"
3113
 00FFF2E4 04C042047045                    fcb             "LBGE"
3114
 00FFF2E8 04C04204C054                    fcb             "LBLT"
3115
 00FFF2EC 04C042047054                    fcb             "LBGT"
3116
 00FFF2F0 04C04204C045                    fcb             "LBLE"
3117
 
3118
                              distbl3:
3119
 00FFF2F4 13F                             fcb             $13F
3120
 00FFF2F5 183                             fcb             $183
3121
 00FFF2F6 18C                             fcb             $18C
3122
 00FFF2F7 18E                             fcb             $18E
3123
 00FFF2F8 193                             fcb             $193
3124
 00FFF2F9 19C                             fcb             $19C
3125
 00FFF2FA 19E                             fcb             $19E
3126
 00FFF2FB 19F                             fcb             $19F
3127
 00FFF2FC 1A3                             fcb             $1A3
3128
 00FFF2FD 1AC                             fcb             $1AC
3129
 00FFF2FE 1AE                             fcb             $1AE
3130
 00FFF2FF 1AF                             fcb             $1AF
3131
 00FFF300 1B3                             fcb             $1B3
3132
 00FFF301 1BC                             fcb             $1BC
3133
 00FFF302 1BE                             fcb             $1BE
3134
 00FFF303 1BF                             fcb             $1BF
3135
 00FFF304 1CE                             fcb             $1CE
3136
 00FFF305 1DE                             fcb             $1DE
3137
 00FFF306 1DF                             fcb             $1DF
3138
 00FFF307 1EE                             fcb             $1EE
3139
 00FFF308 1EF                             fcb             $1EF
3140
 00FFF309 1FE                             fcb             $1FE
3141
 00FFF30A 1FF                             fcb             $1FF
3142
 00FFF30B 23F                             fcb             $23F
3143
 00FFF30C 283                             fcb             $283
3144
 00FFF30D 28C                             fcb             $28C
3145
 00FFF30E 293                             fcb             $293
3146
 00FFF30F 29C                             fcb             $29C
3147
 00FFF310 2A3                             fcb             $2A3
3148
 00FFF311 2AC                             fcb             $2AC
3149
 00FFF312 2B3                             fcb             $2B3
3150
 00FFF313 2BC                             fcb             $2BC
3151
 
3152
                              distbl4:
3153
 00FFF314 053057049032000                 fcb             "SWI2", 0
3154
 00FFF319 04304D050044007                 fcb             "CMPD", IMMW
3155
 00FFF31E 04304D050059007                 fcb             "CMPY", IMMW
3156
 00FFF323 04C044059020007                 fcb             "LDY ", IMMW
3157
 00FFF328 04304D050044001                 fcb             "CMPD", DIRECT
3158
 00FFF32D 04304D050059001                 fcb             "CMPY", DIRECT
3159
 00FFF332 04C044059020001                 fcb             "LDY ", DIRECT
3160
 00FFF337 053054059020001                 fcb             "STY ", DIRECT
3161
 00FFF33C 04304D050044005                 fcb             "CMPD", NDX
3162
 00FFF341 04304D050059005                 fcb             "CMPY", NDX
3163
 00FFF346 04C044059020005                 fcb             "LDY ", NDX
3164
 00FFF34B 053054059020005                 fcb             "STY ", NDX
3165
 00FFF350 04304D050044006                 fcb             "CMPD", EXT
3166
 00FFF355 04304D050059006                 fcb             "CMPY", EXT
3167
 00FFF35A 04C044059020006                 fcb             "LDY ", EXT
3168
 00FFF35F 053054059020006                 fcb             "STY ", EXT
3169
 00FFF364 04C044053020007                 fcb             "LDS ", IMMW
3170
 00FFF369 04C044053020001                 fcb             "LDS ", DIRECT
3171
 00FFF36E 053054053020001                 fcb             "STS ", DIRECT
3172
 00FFF373 04C044053020005                 fcb             "LDS ", NDX
3173
 00FFF378 053054053020005                 fcb             "STS ", NDX
3174
 00FFF37D 04C044053020006                 fcb             "LDS ", EXT
3175
 00FFF382 053054053020006                 fcb             "STS ", EXT
3176
 00FFF387 053057049033000                 fcb             "SWI3", 0
3177
 00FFF38C 04304D050055007                 fcb             "CMPU", IMMW
3178
 00FFF391 04304D050053007                 fcb             "CMPS", IMMW
3179
 00FFF396 04304D050055001                 fcb             "CMPU", DIRECT
3180
 00FFF39B 04304D050053001                 fcb             "CMPS", DIRECT
3181
 00FFF3A0 04304D050055005                 fcb             "CMPU", NDX
3182
 00FFF3A5 04304D050053005                 fcb             "CMPS", NDX
3183
 00FFF3AA 04304D050055006                 fcb             "CMPU", EXT
3184
 00FFF3AF 04304D050053006                 fcb             "CMPS", EXT
3185
 
3186
                              disassem:
3187
 00FFF3B4 0170005FE                       lbsr    GetTwoParams
3188
 00FFF3B7 017FFDD18                       lbsr    CRLF
3189
*** warning 1: Long branch within short branch range could be optimized
3190
 00FFF3BA 1BE000922                       ldy             mon_r1+2
3191
                              disLoop1:
3192
 00FFF3BD 01F020                          tfr             y,d
3193
 00FFF3BF 017FFF02B                       lbsr    DispWordAsHex
3194
*** warning 1: Long branch within short branch range could be optimized
3195
 00FFF3C2 0C6020                          ldb             #' '
3196
 00FFF3C4 017FFF94B                       lbsr    OUTCH
3197
*** warning 1: Long branch within short branch range could be optimized
3198
 00FFF3C7 0E6A00                          ldb             ,y+
3199
 00FFF3C9 0C5300                          bitb    #$300
3200
 00FFF3CB 126000400                       lbne    dis1
3201
                              dis20:
3202
 00FFF3CE 08EFFEDB4                       ldx             #distbl1
3203
                              dis23:
3204
 00FFF3D1 086005                          lda             #5
3205
 00FFF3D3 03D                             mul
3206
 00FFF3D4 03A                             abx
3207
 00FFF3D5 0E6800                          ldb             ,x+
3208
 00FFF3D7 017FFF938                       lbsr    OUTCH
3209
*** warning 1: Long branch within short branch range could be optimized
3210
 00FFF3DA 0E6800                          ldb             ,x+
3211
 00FFF3DC 017FFF933                       lbsr    OUTCH
3212
*** warning 1: Long branch within short branch range could be optimized
3213
 00FFF3DF 0E6800                          ldb             ,x+
3214
 00FFF3E1 017FFF92E                       lbsr    OUTCH
3215
*** warning 1: Long branch within short branch range could be optimized
3216
 00FFF3E4 0E6800                          ldb             ,x+
3217
 00FFF3E6 017FFF929                       lbsr    OUTCH
3218
*** warning 1: Long branch within short branch range could be optimized
3219
 00FFF3E9 0C6020                          ldb             #' '
3220
 00FFF3EB 017FFF924                       lbsr    OUTCH
3221
*** warning 1: Long branch within short branch range could be optimized
3222
 00FFF3EE 0E6800                          ldb             ,x+
3223
 00FFF3F0 12700042E                       lbeq    disNextLine
3224
 00FFF3F3 0C1001                          cmpb    #DIRECT
3225
 00FFF3F5 026008                          bne             disNotDirect
3226
 00FFF3F7 0E6A00                          ldb             ,y+
3227
 00FFF3F9 017FFEFFA                       lbsr    DispByteAsHex
3228
*** warning 1: Long branch within short branch range could be optimized
3229
 00FFF3FC 016000422                       lbra    disNextLine
3230
                              disNotDirect:
3231
 00FFF3FF 0C1002                          cmpb    #LSREL
3232
 00FFF401 02600C                          bne             disNotLRel
3233
                              dis21:
3234
 00FFF403 0ECA01                          ldd             ,y++
3235
                              dis2:
3236
 00FFF405 030A0B                          leax    d,y
3237
 00FFF407 01F010                          tfr             x,d
3238
 00FFF409 017FFEFE1                       lbsr    DispWordAsHex
3239
*** warning 1: Long branch within short branch range could be optimized
3240
 00FFF40C 016000412                       lbra    disNextLine
3241
                              disNotLRel:
3242
 00FFF40F 0C1004                          cmpb    #SREL
3243
 00FFF411 026005                          bne             disNotRel
3244
 00FFF413 0E6A00                          ldb             ,y+
3245
 00FFF415 04F                             clra
3246
 00FFF416 020FED                          bra             dis2
3247
                              disNotRel:
3248
 00FFF418 0C1005                          cmpb    #NDX
3249
 00FFF41A 026385                          bne             disNotNdx
3250
 00FFF41C 0E6A00                          ldb             ,y+
3251
 00FFF41E 0C5800                          bitb    #$800
3252
 00FFF420 02601E                          bne             disNot9                 ; test for offset 9 mode
3253
 00FFF422 034004                          pshs    b
3254
 00FFF424 0C41FF                          andb    #$1FF                           ; mask to offset bits
3255
 00FFF426 04F                             clra                                                    ;
3256
 00FFF427 0C5100                          bitb    #$100                           ; test for negative offset
3257
 00FFF429 027003                          beq             dis3
3258
 00FFF42B 04A                             deca                                                    ; sign extend offset
3259
 00FFF42C 0CAE00                          orb             #$E00
3260
                              dis3:
3261
 00FFF42E 017FFEFBC                       lbsr    DispWordAsHex
3262
*** warning 1: Long branch within short branch range could be optimized
3263
 00FFF431 0C602C                          ldb             #','
3264
 00FFF433 017FFF8DC                       lbsr    OUTCH
3265
*** warning 1: Long branch within short branch range could be optimized
3266
 00FFF436 035004                          puls    b
3267
 00FFF438 08D3F7                          bsr             disNdxReg
3268
 00FFF43A 017FFF8D5                       lbsr    OUTCH
3269
*** warning 1: Long branch within short branch range could be optimized
3270
 00FFF43D 0160003E1                       lbra    disNextLine
3271
                              disNot9:
3272
 00FFF440 034004                          pshs    b
3273
 00FFF442 0C5100                          bitb    #$100                   ; check if indirect
3274
 00FFF444 026005                          bne             dis4
3275
 00FFF446 0C605B                          ldb             #'['
3276
 00FFF448 017FFF8C7                       lbsr    OUTCH
3277
*** warning 1: Long branch within short branch range could be optimized
3278
                              dis4:
3279
 00FFF44B 0E6E04                          ldb             ,s                              ; get back b
3280
 00FFF44D 0C400F                          andb    #15
3281
 00FFF44F 026030                          bne             disNotRplus
3282
 00FFF451 0E6E04                          ldb             ,s
3283
 00FFF453 0C5080                          bitb    #$80                    ; outer indexed?
3284
 00FFF455 026005                          bne             dis5
3285
 00FFF457 0C605D                          ldb             #']'
3286
 00FFF459 017FFF8B6                       lbsr    OUTCH
3287
*** warning 1: Long branch within short branch range could be optimized
3288
                              dis5:
3289
 00FFF45C 0C602C                          ldb             #','
3290
 00FFF45E 017FFF8B1                       lbsr    OUTCH
3291
*** warning 1: Long branch within short branch range could be optimized
3292
 00FFF461 0E6E04                          ldb             ,s
3293
 00FFF463 08D3CC                          bsr             disNdxReg
3294
 00FFF465 017FFF8AA                       lbsr    OUTCH
3295
*** warning 1: Long branch within short branch range could be optimized
3296
 00FFF468 0C602B                          ldb             #'+'
3297
 00FFF46A 017FFF8A5                       lbsr    OUTCH
3298
*** warning 1: Long branch within short branch range could be optimized
3299
 00FFF46D 035004                          puls    b
3300
 00FFF46F 0C5100                          bitb    #$100
3301
 00FFF471 1260003AD                       lbne    disNextLine
3302
 00FFF474 0C5080                          bitb    #$80
3303
 00FFF476 1260003A8                       lbne    disNextLine
3304
 00FFF479 0C605D                          ldb             #']'
3305
 00FFF47B 017FFF894                       lbsr    OUTCH
3306
*** warning 1: Long branch within short branch range could be optimized
3307
 00FFF47E 0160003A0                       lbra    disNextLine
3308
                              disNotRplus:
3309
 00FFF481 0C1001                          cmpb    #1
3310
 00FFF483 026033                          bne             disNotRplusplus
3311
 00FFF485 0E6E04                          ldb             ,s
3312
 00FFF487 0C5080                          bitb    #$80                    ; outer indexed?
3313
 00FFF489 026005                          bne             dis6
3314
 00FFF48B 0C605D                          ldb             #']'
3315
 00FFF48D 017FFF882                       lbsr    OUTCH
3316
*** warning 1: Long branch within short branch range could be optimized
3317
                              dis6:
3318
 00FFF490 0C602C                          ldb             #','
3319
 00FFF492 017FFF87D                       lbsr    OUTCH
3320
*** warning 1: Long branch within short branch range could be optimized
3321
 00FFF495 0E6E04                          ldb             ,s
3322
 00FFF497 08D398                          bsr             disNdxReg
3323
 00FFF499 017FFF876                       lbsr    OUTCH
3324
*** warning 1: Long branch within short branch range could be optimized
3325
 00FFF49C 0C602B                          ldb             #'+'
3326
 00FFF49E 017FFF871                       lbsr    OUTCH
3327
*** warning 1: Long branch within short branch range could be optimized
3328
 00FFF4A1 017FFF86E                       lbsr    OUTCH
3329
*** warning 1: Long branch within short branch range could be optimized
3330
 00FFF4A4 035004                          puls    b
3331
 00FFF4A6 0C5100                          bitb    #$100
3332
 00FFF4A8 126000376                       lbne    disNextLine
3333
 00FFF4AB 0C5080                          bitb    #$80
3334
 00FFF4AD 126000371                       lbne    disNextLine
3335
 00FFF4B0 0C605D                          ldb             #']'
3336
 00FFF4B2 017FFF85D                       lbsr    OUTCH
3337
*** warning 1: Long branch within short branch range could be optimized
3338
 00FFF4B5 016000369                       lbra    disNextLine
3339
                              disNotRplusplus:
3340
 00FFF4B8 0C1002                          cmpb    #2
3341
 00FFF4BA 026030                          bne             disNotRminus
3342
 00FFF4BC 0E6E04                          ldb             ,s
3343
 00FFF4BE 0C5080                          bitb    #$80                    ; outer indexed?
3344
 00FFF4C0 026005                          bne             dis7
3345
 00FFF4C2 0C605D                          ldb             #']'
3346
 00FFF4C4 017FFF84B                       lbsr    OUTCH
3347
*** warning 1: Long branch within short branch range could be optimized
3348
                              dis7:
3349
 00FFF4C7 0C602C                          ldb             #','
3350
 00FFF4C9 017FFF846                       lbsr    OUTCH
3351
*** warning 1: Long branch within short branch range could be optimized
3352
 00FFF4CC 0E6E04                          ldb             ,s
3353
 00FFF4CE 08D361                          bsr             disNdxReg
3354
 00FFF4D0 017FFF83F                       lbsr    OUTCH
3355
*** warning 1: Long branch within short branch range could be optimized
3356
 00FFF4D3 0C602D                          ldb             #'-'
3357
 00FFF4D5 017FFF83A                       lbsr    OUTCH
3358
*** warning 1: Long branch within short branch range could be optimized
3359
 00FFF4D8 035004                          puls    b
3360
 00FFF4DA 0C5100                          bitb    #$100
3361
 00FFF4DC 126000342                       lbne    disNextLine
3362
 00FFF4DF 0C5080                          bitb    #$80
3363
 00FFF4E1 12600033D                       lbne    disNextLine
3364
 00FFF4E4 0C605D                          ldb             #']'
3365
 00FFF4E6 017FFF829                       lbsr    OUTCH
3366
*** warning 1: Long branch within short branch range could be optimized
3367
 00FFF4E9 016000335                       lbra    disNextLine
3368
                              disNotRminus:
3369
 00FFF4EC 0C1003                          cmpb    #3
3370
 00FFF4EE 026033                          bne             disNotRminusminus
3371
 00FFF4F0 0E6E04                          ldb             ,s
3372
 00FFF4F2 0C5080                          bitb    #$80                    ; outer indexed?
3373
 00FFF4F4 026005                          bne             dis8
3374
 00FFF4F6 0C605D                          ldb             #']'
3375
 00FFF4F8 017FFF817                       lbsr    OUTCH
3376
*** warning 1: Long branch within short branch range could be optimized
3377
                              dis8:
3378
 00FFF4FB 0C602C                          ldb             #','
3379
 00FFF4FD 017FFF812                       lbsr    OUTCH
3380
*** warning 1: Long branch within short branch range could be optimized
3381
 00FFF500 0E6E04                          ldb             ,s
3382
 00FFF502 08D32D                          bsr             disNdxReg
3383
 00FFF504 017FFF80B                       lbsr    OUTCH
3384
*** warning 1: Long branch within short branch range could be optimized
3385
 00FFF507 0C602D                          ldb             #'-'
3386
 00FFF509 017FFF806                       lbsr    OUTCH
3387
*** warning 1: Long branch within short branch range could be optimized
3388
 00FFF50C 017FFF803                       lbsr    OUTCH
3389
*** warning 1: Long branch within short branch range could be optimized
3390
 00FFF50F 035004                          puls    b
3391
 00FFF511 0C5100                          bitb    #$100
3392
 00FFF513 12600030B                       lbne    disNextLine
3393
 00FFF516 0C5080                          bitb    #$80
3394
 00FFF518 126000306                       lbne    disNextLine
3395
 00FFF51B 0C605D                          ldb             #']'
3396
 00FFF51D 017FFF7F2                       lbsr    OUTCH
3397
*** warning 1: Long branch within short branch range could be optimized
3398
 00FFF520 0160002FE                       lbra    disNextLine
3399
                              disNotRminusminus:
3400
 00FFF523 0C1004                          cmpb    #4
3401
 00FFF525 02602B                          bne             disNotR
3402
 00FFF527 0E6E04                          ldb             ,s
3403
 00FFF529 0C5080                          bitb    #$80                    ; outer indexed?
3404
 00FFF52B 026005                          bne             dis9
3405
 00FFF52D 0C605D                          ldb             #']'
3406
 00FFF52F 017FFF7E0                       lbsr    OUTCH
3407
*** warning 1: Long branch within short branch range could be optimized
3408
                              dis9:
3409
 00FFF532 0C602C                          ldb             #','
3410
 00FFF534 017FFF7DB                       lbsr    OUTCH
3411
*** warning 1: Long branch within short branch range could be optimized
3412
 00FFF537 0E6E04                          ldb             ,s
3413
 00FFF539 08D2F6                          bsr             disNdxReg
3414
 00FFF53B 017FFF7D4                       lbsr    OUTCH
3415
*** warning 1: Long branch within short branch range could be optimized
3416
 00FFF53E 035004                          puls    b
3417
 00FFF540 0C5100                          bitb    #$100
3418
 00FFF542 1260002DC                       lbne    disNextLine
3419
 00FFF545 0C5080                          bitb    #$80
3420
 00FFF547 1260002D7                       lbne    disNextLine
3421
 00FFF54A 0C605D                          ldb             #']'
3422
 00FFF54C 017FFF7C3                       lbsr    OUTCH
3423
*** warning 1: Long branch within short branch range could be optimized
3424
 00FFF54F 0160002CF                       lbra    disNextLine
3425
                              disNotR:
3426
 00FFF552 0C1005                          cmpb    #5
3427
 00FFF554 026038                          bne             disNotBOffs
3428
 00FFF556 0C6042                          ldb             #'B'
3429
 00FFF558 017FFF7B7                       lbsr    OUTCH
3430
*** warning 1: Long branch within short branch range could be optimized
3431
 00FFF55B 0E6E04                          ldb             ,s
3432
 00FFF55D 0C5080                          bitb    #$80                    ; outer indexed?
3433
 00FFF55F 026005                          bne             dis10
3434
 00FFF561 0C605D                          ldb             #']'
3435
 00FFF563 017FFF7AC                       lbsr    OUTCH
3436
*** warning 1: Long branch within short branch range could be optimized
3437
                              dis10:
3438
 00FFF566 0C602C                          ldb             #','
3439
 00FFF568 017FFF7A7                       lbsr    OUTCH
3440
*** warning 1: Long branch within short branch range could be optimized
3441
 00FFF56B 0E6E04                          ldb             ,s
3442
 00FFF56D 08D2C2                          bsr             disNdxReg
3443
 00FFF56F 017FFF7A0                       lbsr    OUTCH
3444
*** warning 1: Long branch within short branch range could be optimized
3445
 00FFF572 0C602D                          ldb             #'-'
3446
 00FFF574 017FFF79B                       lbsr    OUTCH
3447
*** warning 1: Long branch within short branch range could be optimized
3448
 00FFF577 017FFF798                       lbsr    OUTCH
3449
*** warning 1: Long branch within short branch range could be optimized
3450
 00FFF57A 035004                          puls    b
3451
 00FFF57C 0C5100                          bitb    #$100
3452
 00FFF57E 1260002A0                       lbne    disNextLine
3453
 00FFF581 0C5080                          bitb    #$80
3454
 00FFF583 12600029B                       lbne    disNextLine
3455
 00FFF586 0C605D                          ldb             #']'
3456
 00FFF588 017FFF787                       lbsr    OUTCH
3457
*** warning 1: Long branch within short branch range could be optimized
3458
 00FFF58B 016000293                       lbra    disNextLine
3459
                              disNotBOffs:
3460
 00FFF58E 0C1006                          cmpb    #6
3461
 00FFF590 026038                          bne             disNotAOffs
3462
 00FFF592 0C6041                          ldb             #'A'
3463
 00FFF594 017FFF77B                       lbsr    OUTCH
3464
*** warning 1: Long branch within short branch range could be optimized
3465
 00FFF597 0E6E04                          ldb             ,s
3466
 00FFF599 0C5080                          bitb    #$80                    ; outer indexed?
3467
 00FFF59B 026005                          bne             dis11
3468
 00FFF59D 0C605D                          ldb             #']'
3469
 00FFF59F 017FFF770                       lbsr    OUTCH
3470
*** warning 1: Long branch within short branch range could be optimized
3471
                              dis11:
3472
 00FFF5A2 0C602C                          ldb             #','
3473
 00FFF5A4 017FFF76B                       lbsr    OUTCH
3474
*** warning 1: Long branch within short branch range could be optimized
3475
 00FFF5A7 0E6E04                          ldb             ,s
3476
 00FFF5A9 08D286                          bsr             disNdxReg
3477
 00FFF5AB 017FFF764                       lbsr    OUTCH
3478
*** warning 1: Long branch within short branch range could be optimized
3479
 00FFF5AE 0C602D                          ldb             #'-'
3480
 00FFF5B0 017FFF75F                       lbsr    OUTCH
3481
*** warning 1: Long branch within short branch range could be optimized
3482
 00FFF5B3 017FFF75C                       lbsr    OUTCH
3483
*** warning 1: Long branch within short branch range could be optimized
3484
 00FFF5B6 035004                          puls    b
3485
 00FFF5B8 0C5100                          bitb    #$100
3486
 00FFF5BA 126000264                       lbne    disNextLine
3487
 00FFF5BD 0C5080                          bitb    #$80
3488
 00FFF5BF 12600025F                       lbne    disNextLine
3489
 00FFF5C2 0C605D                          ldb             #']'
3490
 00FFF5C4 017FFF74B                       lbsr    OUTCH
3491
*** warning 1: Long branch within short branch range could be optimized
3492
 00FFF5C7 016000257                       lbra    disNextLine
3493
                              disNotAOffs:
3494
 00FFF5CA 0C1008                          cmpb    #8
3495
 00FFF5CC 026039                          bne             disNotBO
3496
 00FFF5CE 0E6A00                          ldb             ,y+
3497
 00FFF5D0 01D                             sex
3498
 00FFF5D1 017FFEE19                       lbsr    DispWordAsHex
3499
*** warning 1: Long branch within short branch range could be optimized
3500
 00FFF5D4 0E6E04                          ldb             ,s
3501
 00FFF5D6 0C5080                          bitb    #$80                    ; outer indexed?
3502
 00FFF5D8 026005                          bne             dis12
3503
 00FFF5DA 0C605D                          ldb             #']'
3504
 00FFF5DC 017FFF733                       lbsr    OUTCH
3505
*** warning 1: Long branch within short branch range could be optimized
3506
                              dis12:
3507
 00FFF5DF 0C602C                          ldb             #','
3508
 00FFF5E1 017FFF72E                       lbsr    OUTCH
3509
*** warning 1: Long branch within short branch range could be optimized
3510
 00FFF5E4 0E6E04                          ldb             ,s
3511
 00FFF5E6 08D249                          bsr             disNdxReg
3512
 00FFF5E8 017FFF727                       lbsr    OUTCH
3513
*** warning 1: Long branch within short branch range could be optimized
3514
 00FFF5EB 0C602D                          ldb             #'-'
3515
 00FFF5ED 017FFF722                       lbsr    OUTCH
3516
*** warning 1: Long branch within short branch range could be optimized
3517
 00FFF5F0 017FFF71F                       lbsr    OUTCH
3518
*** warning 1: Long branch within short branch range could be optimized
3519
 00FFF5F3 035004                          puls    b
3520
 00FFF5F5 0C5100                          bitb    #$100
3521
 00FFF5F7 126000227                       lbne    disNextLine
3522
 00FFF5FA 0C5080                          bitb    #$80
3523
 00FFF5FC 126000222                       lbne    disNextLine
3524
 00FFF5FF 0C605D                          ldb             #']'
3525
 00FFF601 017FFF70E                       lbsr    OUTCH
3526
*** warning 1: Long branch within short branch range could be optimized
3527
 00FFF604 01600021A                       lbra    disNextLine
3528
                              disNotBO:
3529
 00FFF607 0C1009                          cmpb    #9
3530
 00FFF609 026038                          bne             disNotWO
3531
 00FFF60B 0ECA01                          ldd             ,y++
3532
 00FFF60D 017FFEDDD                       lbsr    DispWordAsHex
3533
*** warning 1: Long branch within short branch range could be optimized
3534
 00FFF610 0E6E04                          ldb             ,s
3535
 00FFF612 0C5080                          bitb    #$80                    ; outer indexed?
3536
 00FFF614 026005                          bne             dis13
3537
 00FFF616 0C605D                          ldb             #']'
3538
 00FFF618 017FFF6F7                       lbsr    OUTCH
3539
*** warning 1: Long branch within short branch range could be optimized
3540
                              dis13:
3541
 00FFF61B 0C602C                          ldb             #','
3542
 00FFF61D 017FFF6F2                       lbsr    OUTCH
3543
*** warning 1: Long branch within short branch range could be optimized
3544
 00FFF620 0E6E04                          ldb             ,s
3545
 00FFF622 08D20D                          bsr             disNdxReg
3546
 00FFF624 017FFF6EB                       lbsr    OUTCH
3547
*** warning 1: Long branch within short branch range could be optimized
3548
 00FFF627 0C602D                          ldb             #'-'
3549
 00FFF629 017FFF6E6                       lbsr    OUTCH
3550
*** warning 1: Long branch within short branch range could be optimized
3551
 00FFF62C 017FFF6E3                       lbsr    OUTCH
3552
*** warning 1: Long branch within short branch range could be optimized
3553
 00FFF62F 035004                          puls    b
3554
 00FFF631 0C5100                          bitb    #$100
3555
 00FFF633 1260001EB                       lbne    disNextLine
3556
 00FFF636 0C5080                          bitb    #$80
3557
 00FFF638 1260001E6                       lbne    disNextLine
3558
 00FFF63B 0C605D                          ldb             #']'
3559
 00FFF63D 017FFF6D2                       lbsr    OUTCH
3560
*** warning 1: Long branch within short branch range could be optimized
3561
 00FFF640 0160001DE                       lbra    disNextLine
3562
                              disNotWO:
3563
 00FFF643 0C100A                          cmpb    #10
3564
 00FFF645 02603D                          bne             disNotTO
3565
 00FFF647 0E6A01                          ldb             ,y++
3566
 00FFF649 017FFEDAA                       lbsr    DispByteAsHex
3567
*** warning 1: Long branch within short branch range could be optimized
3568
 00FFF64C 0ECA01                          ldd             ,y++
3569
 00FFF64E 017FFED9C                       lbsr    DispWordAsHex
3570
*** warning 1: Long branch within short branch range could be optimized
3571
 00FFF651 0E6E04                          ldb             ,s
3572
 00FFF653 0C5080                          bitb    #$80                    ; outer indexed?
3573
 00FFF655 026005                          bne             dis14
3574
 00FFF657 0C605D                          ldb             #']'
3575
 00FFF659 017FFF6B6                       lbsr    OUTCH
3576
*** warning 1: Long branch within short branch range could be optimized
3577
                              dis14:
3578
 00FFF65C 0C602C                          ldb             #','
3579
 00FFF65E 017FFF6B1                       lbsr    OUTCH
3580
*** warning 1: Long branch within short branch range could be optimized
3581
 00FFF661 0E6E04                          ldb             ,s
3582
 00FFF663 08D1CC                          bsr             disNdxReg
3583
 00FFF665 017FFF6AA                       lbsr    OUTCH
3584
*** warning 1: Long branch within short branch range could be optimized
3585
 00FFF668 0C602D                          ldb             #'-'
3586
 00FFF66A 017FFF6A5                       lbsr    OUTCH
3587
*** warning 1: Long branch within short branch range could be optimized
3588
 00FFF66D 017FFF6A2                       lbsr    OUTCH
3589
*** warning 1: Long branch within short branch range could be optimized
3590
 00FFF670 035004                          puls    b
3591
 00FFF672 0C5100                          bitb    #$100
3592
 00FFF674 1260001AA                       lbne    disNextLine
3593
 00FFF677 0C5080                          bitb    #$80
3594
 00FFF679 1260001A5                       lbne    disNextLine
3595
 00FFF67C 0C605D                          ldb             #']'
3596
 00FFF67E 017FFF691                       lbsr    OUTCH
3597
*** warning 1: Long branch within short branch range could be optimized
3598
 00FFF681 01600019D                       lbra    disNextLine
3599
                              disNotTO:
3600
 00FFF684 0C100B                          cmpb    #11
3601
 00FFF686 026038                          bne             disNotDOffs
3602
 00FFF688 0C6044                          ldb             #'D'
3603
 00FFF68A 017FFF685                       lbsr    OUTCH
3604
*** warning 1: Long branch within short branch range could be optimized
3605
 00FFF68D 0E6E04                          ldb             ,s
3606
 00FFF68F 0C5080                          bitb    #$80                    ; outer indexed?
3607
 00FFF691 026005                          bne             dis15
3608
 00FFF693 0C605D                          ldb             #']'
3609
 00FFF695 017FFF67A                       lbsr    OUTCH
3610
*** warning 1: Long branch within short branch range could be optimized
3611
                              dis15:
3612
 00FFF698 0C602C                          ldb             #','
3613
 00FFF69A 017FFF675                       lbsr    OUTCH
3614
*** warning 1: Long branch within short branch range could be optimized
3615
 00FFF69D 0E6E04                          ldb             ,s
3616
 00FFF69F 08D190                          bsr             disNdxReg
3617
 00FFF6A1 017FFF66E                       lbsr    OUTCH
3618
*** warning 1: Long branch within short branch range could be optimized
3619
 00FFF6A4 0C602D                          ldb             #'-'
3620
 00FFF6A6 017FFF669                       lbsr    OUTCH
3621
*** warning 1: Long branch within short branch range could be optimized
3622
 00FFF6A9 017FFF666                       lbsr    OUTCH
3623
*** warning 1: Long branch within short branch range could be optimized
3624
 00FFF6AC 035004                          puls    b
3625
 00FFF6AE 0C5100                          bitb    #$100
3626
 00FFF6B0 12600016E                       lbne    disNextLine
3627
 00FFF6B3 0C5080                          bitb    #$80
3628
 00FFF6B5 126000169                       lbne    disNextLine
3629
 00FFF6B8 0C605D                          ldb             #']'
3630
 00FFF6BA 017FFF655                       lbsr    OUTCH
3631
*** warning 1: Long branch within short branch range could be optimized
3632
 00FFF6BD 016000161                       lbra    disNextLine
3633
                              disNotDOffs:
3634
 00FFF6C0 0C100C                          cmpb    #12
3635
 00FFF6C2 026040                          bne             disNotPBO
3636
 00FFF6C4 0E6A00                          ldb             ,y+
3637
 00FFF6C6 01D                             sex
3638
 00FFF6C7 017FFED23                       lbsr    DispWordAsHex
3639
*** warning 1: Long branch within short branch range could be optimized
3640
 00FFF6CA 0E6E04                          ldb             ,s
3641
 00FFF6CC 0C5080                          bitb    #$80                    ; outer indexed?
3642
 00FFF6CE 026005                          bne             dis16
3643
 00FFF6D0 0C605D                          ldb             #']'
3644
 00FFF6D2 017FFF63D                       lbsr    OUTCH
3645
*** warning 1: Long branch within short branch range could be optimized
3646
                              dis16:
3647
 00FFF6D5 0C602C                          ldb             #','
3648
 00FFF6D7 017FFF638                       lbsr    OUTCH
3649
*** warning 1: Long branch within short branch range could be optimized
3650
 00FFF6DA 0E6E04                          ldb             ,s
3651
 00FFF6DC 08D153                          bsr             disNdxReg
3652
 00FFF6DE 0C6050                          ldb             #'P'
3653
 00FFF6E0 017FFF62F                       lbsr    OUTCH
3654
*** warning 1: Long branch within short branch range could be optimized
3655
 00FFF6E3 0C6043                          ldb             #'C'
3656
 00FFF6E5 017FFF62A                       lbsr    OUTCH
3657
*** warning 1: Long branch within short branch range could be optimized
3658
 00FFF6E8 0C602D                          ldb             #'-'
3659
 00FFF6EA 017FFF625                       lbsr    OUTCH
3660
*** warning 1: Long branch within short branch range could be optimized
3661
 00FFF6ED 017FFF622                       lbsr    OUTCH
3662
*** warning 1: Long branch within short branch range could be optimized
3663
 00FFF6F0 035004                          puls    b
3664
 00FFF6F2 0C5100                          bitb    #$100
3665
 00FFF6F4 12600012A                       lbne    disNextLine
3666
 00FFF6F7 0C5080                          bitb    #$80
3667
 00FFF6F9 126000125                       lbne    disNextLine
3668
 00FFF6FC 0C605D                          ldb             #']'
3669
 00FFF6FE 017FFF611                       lbsr    OUTCH
3670
*** warning 1: Long branch within short branch range could be optimized
3671
 00FFF701 01600011D                       lbra    disNextLine
3672
                              disNotPBO:
3673
 00FFF704 0C100D                          cmpb    #13
3674
 00FFF706 02603F                          bne             disNotPWO
3675
 00FFF708 0ECA01                          ldd             ,y++
3676
 00FFF70A 017FFECE0                       lbsr    DispWordAsHex
3677
*** warning 1: Long branch within short branch range could be optimized
3678
 00FFF70D 0E6E04                          ldb             ,s
3679
 00FFF70F 0C5080                          bitb    #$80                    ; outer indexed?
3680
 00FFF711 026005                          bne             dis17
3681
 00FFF713 0C605D                          ldb             #']'
3682
 00FFF715 017FFF5FA                       lbsr    OUTCH
3683
*** warning 1: Long branch within short branch range could be optimized
3684
                              dis17:
3685
 00FFF718 0C602C                          ldb             #','
3686
 00FFF71A 017FFF5F5                       lbsr    OUTCH
3687
*** warning 1: Long branch within short branch range could be optimized
3688
 00FFF71D 0E6E04                          ldb             ,s
3689
 00FFF71F 08D110                          bsr             disNdxReg
3690
 00FFF721 0C6050                          ldb             #'P'
3691
 00FFF723 017FFF5EC                       lbsr    OUTCH
3692
*** warning 1: Long branch within short branch range could be optimized
3693
 00FFF726 0C6043                          ldb             #'C'
3694
 00FFF728 017FFF5E7                       lbsr    OUTCH
3695
*** warning 1: Long branch within short branch range could be optimized
3696
 00FFF72B 0C602D                          ldb             #'-'
3697
 00FFF72D 017FFF5E2                       lbsr    OUTCH
3698
*** warning 1: Long branch within short branch range could be optimized
3699
 00FFF730 017FFF5DF                       lbsr    OUTCH
3700
*** warning 1: Long branch within short branch range could be optimized
3701
 00FFF733 035004                          puls    b
3702
 00FFF735 0C5100                          bitb    #$100
3703
 00FFF737 1260000E7                       lbne    disNextLine
3704
 00FFF73A 0C5080                          bitb    #$80
3705
 00FFF73C 1260000E2                       lbne    disNextLine
3706
 00FFF73F 0C605D                          ldb             #']'
3707
 00FFF741 017FFF5CE                       lbsr    OUTCH
3708
*** warning 1: Long branch within short branch range could be optimized
3709
 00FFF744 0160000DA                       lbra    disNextLine
3710
                              disNotPWO:
3711
 00FFF747 0C100E                          cmpb    #14
3712
 00FFF749 026044                          bne             disNotPTO
3713
 00FFF74B 0E6A00                          ldb             ,y+
3714
 00FFF74D 017FFECA6                       lbsr    DispByteAsHex
3715
*** warning 1: Long branch within short branch range could be optimized
3716
 00FFF750 0ECA01                          ldd             ,y++
3717
 00FFF752 017FFEC98                       lbsr    DispWordAsHex
3718
*** warning 1: Long branch within short branch range could be optimized
3719
 00FFF755 0E6E04                          ldb             ,s
3720
 00FFF757 0C5080                          bitb    #$80                    ; outer indexed?
3721
 00FFF759 026005                          bne             dis18
3722
 00FFF75B 0C605D                          ldb             #']'
3723
 00FFF75D 017FFF5B2                       lbsr    OUTCH
3724
*** warning 1: Long branch within short branch range could be optimized
3725
                              dis18:
3726
 00FFF760 0C602C                          ldb             #','
3727
 00FFF762 017FFF5AD                       lbsr    OUTCH
3728
*** warning 1: Long branch within short branch range could be optimized
3729
 00FFF765 0E6E04                          ldb             ,s
3730
 00FFF767 08D0C8                          bsr             disNdxReg
3731
 00FFF769 0C6050                          ldb             #'P'
3732
 00FFF76B 017FFF5A4                       lbsr    OUTCH
3733
*** warning 1: Long branch within short branch range could be optimized
3734
 00FFF76E 0C6043                          ldb             #'C'
3735
 00FFF770 017FFF59F                       lbsr    OUTCH
3736
*** warning 1: Long branch within short branch range could be optimized
3737
 00FFF773 0C602D                          ldb             #'-'
3738
 00FFF775 017FFF59A                       lbsr    OUTCH
3739
*** warning 1: Long branch within short branch range could be optimized
3740
 00FFF778 017FFF597                       lbsr    OUTCH
3741
*** warning 1: Long branch within short branch range could be optimized
3742
 00FFF77B 035004                          puls    b
3743
 00FFF77D 0C5100                          bitb    #$100
3744
 00FFF77F 12600009F                       lbne    disNextLine
3745
 00FFF782 0C5080                          bitb    #$80
3746
 00FFF784 12600009A                       lbne    disNextLine
3747
 00FFF787 0C605D                          ldb             #']'
3748
 00FFF789 017FFF586                       lbsr    OUTCH
3749
*** warning 1: Long branch within short branch range could be optimized
3750
 00FFF78C 016000092                       lbra    disNextLine
3751
                              disNotPTO:
3752
 00FFF78F 0C605B                          ldb             #'['
3753
 00FFF791 017FFF57E                       lbsr    OUTCH
3754
*** warning 1: Long branch within short branch range could be optimized
3755
 00FFF794 0ECA01                          ldd             ,y++
3756
 00FFF796 017FFEC54                       lbsr    DispWordAsHex
3757
*** warning 1: Long branch within short branch range could be optimized
3758
 00FFF799 0C605D                          ldb             #']'
3759
 00FFF79B 017FFF574                       lbsr    OUTCH
3760
*** warning 1: Long branch within short branch range could be optimized
3761
 00FFF79E 016000080                       lbra    disNextLine
3762
                              disNotNdx:
3763
 00FFF7A1 0C1006                          cmpb    #EXT
3764
 00FFF7A3 026008                          bne             disNotExt
3765
 00FFF7A5 0ECA01                          ldd             ,y++
3766
 00FFF7A7 017FFEC43                       lbsr    DispWordAsHex
3767
*** warning 1: Long branch within short branch range could be optimized
3768
 00FFF7AA 016000074                       lbra    disNextLine
3769
                              disNotExt:
3770
 00FFF7AD 0C1003                          cmpb    #IMMB
3771
 00FFF7AF 02600D                          bne             disNotIMMB
3772
 00FFF7B1 0C6023                          ldb             #'#'
3773
 00FFF7B3 017FFF55C                       lbsr    OUTCH
3774
*** warning 1: Long branch within short branch range could be optimized
3775
 00FFF7B6 0E6A00                          ldb             ,y+
3776
 00FFF7B8 017FFEC3B                       lbsr    DispByteAsHex
3777
*** warning 1: Long branch within short branch range could be optimized
3778
 00FFF7BB 016000063                       lbra    disNextLine
3779
                              disNotIMMB:
3780
 00FFF7BE 0C1007                          cmpb    #IMMW
3781
 00FFF7C0 02600C                          bne             disNotIMMW
3782
 00FFF7C2 0C6023                          ldb             #'#'
3783
 00FFF7C4 017FFF54B                       lbsr    OUTCH
3784
*** warning 1: Long branch within short branch range could be optimized
3785
 00FFF7C7 0ECA01                          ldd             ,y++
3786
 00FFF7C9 017FFEC21                       lbsr    DispWordAsHex
3787
*** warning 1: Long branch within short branch range could be optimized
3788
 00FFF7CC 020053                          bra             disNextLine
3789
                              disNotIMMW:
3790
                              dis1:
3791
 00FFF7CE 0C1121                          cmpb    #$121
3792
 00FFF7D0 025028                          blo             dis19
3793
 00FFF7D2 0C112F                          cmpb    #$12F
3794
 00FFF7D4 022024                          bhi             dis19
3795
 00FFF7D6 0C40FF                          andb    #$FF
3796
 00FFF7D8 08EFFEDB4                       ldx             #distbl1
3797
 00FFF7DB 058                             aslb
3798
 00FFF7DC 058                             aslb
3799
 00FFF7DD 03A                             abx
3800
 00FFF7DE 0E6800                          ldb             ,x+
3801
 00FFF7E0 017FFF52F                       lbsr    OUTCH
3802
*** warning 1: Long branch within short branch range could be optimized
3803
 00FFF7E3 0E6800                          ldb             ,x+
3804
 00FFF7E5 017FFF52A                       lbsr    OUTCH
3805
*** warning 1: Long branch within short branch range could be optimized
3806
 00FFF7E8 0E6800                          ldb             ,x+
3807
 00FFF7EA 017FFF525                       lbsr    OUTCH
3808
*** warning 1: Long branch within short branch range could be optimized
3809
 00FFF7ED 0E6800                          ldb             ,x+
3810
 00FFF7EF 017FFF520                       lbsr    OUTCH
3811
*** warning 1: Long branch within short branch range could be optimized
3812
 00FFF7F2 0C6020                          ldb             #' '
3813
 00FFF7F4 017FFF51B                       lbsr    OUTCH
3814
*** warning 1: Long branch within short branch range could be optimized
3815
 00FFF7F7 016FFFC09                       lbra    dis21
3816
*** warning 1: Long branch within short branch range could be optimized
3817
                              dis19:
3818
 00FFF7FA 08E000000                       ldx             #0
3819
                              dis24:
3820
 00FFF7FD 0E180A000FFF2F4                 cmpb    distbl3,x
3821
 00FFF802 026006                          bne             dis25
3822
 00FFF804 08EFFF314                       ldx             #distbl4
3823
 00FFF807 016FFFBC7                       lbra    dis23
3824
*** warning 1: Long branch within short branch range could be optimized
3825
                              dis25:
3826
 00FFF80A 030001                          inx
3827
 00FFF80C 08C00001F                       cmpx    #31
3828
 00FFF80F 025FEC                          blo             dis24
3829
 00FFF811 0C603F                          ldb             #'?'
3830
 00FFF813 017FFF4FC                       lbsr    OUTCH
3831
*** warning 1: Long branch within short branch range could be optimized
3832
 00FFF816 017FFF4F9                       lbsr    OUTCH
3833
*** warning 1: Long branch within short branch range could be optimized
3834
 00FFF819 017FFF4F6                       lbsr    OUTCH
3835
*** warning 1: Long branch within short branch range could be optimized
3836
 00FFF81C 017FFF4F3                       lbsr    OUTCH
3837
*** warning 1: Long branch within short branch range could be optimized
3838
 00FFF81F 020000                          bra             disNextLine
3839
                              disNextLine
3840
 00FFF821 017FFD8AE                       lbsr    CRLF
3841
*** warning 1: Long branch within short branch range could be optimized
3842
 00FFF824 1BC000926                       cmpy    mon_r2+2
3843
 00FFF827 125FFFB93                       lblo    disLoop1
3844
*** warning 1: Long branch within short branch range could be optimized
3845
 00FFF82A 01600007F                       lbra    Monitor
3846
 
3847
                              disNdxRegs:
3848
 00FFF82D 058059053055                    fcb             'X','Y','S','U'
3849
                              disNdxReg:
3850
 00FFF831 0C4600                          andb    #$600
3851
 00FFF833 059                             rolb
3852
 00FFF834 059                             rolb
3853
 00FFF835 059                             rolb
3854
 00FFF836 059                             rolb
3855
 00FFF837 04F                             clra
3856
 00FFF838 034040                          pshs    u
3857
 00FFF83A 01F003                          tfr             d,u
3858
 00FFF83C 0A6C0A000FFF82D                 lda             disNdxRegs,u
3859
 00FFF841 035040                          puls    u
3860
 00FFF843 01E089                          exg             a,b
3861
 00FFF845 039                             rts
3862
 
3863
                              ASMO:
3864
 00FFF846 034006                          pshs    d
3865
 00FFF848 0CCFFF85A                       ldd             #ASMOUTCH
3866
 00FFF84B 0FD000800                       std             CharOutVec
3867
 00FFF84E 035086                          puls    d,pc
3868
 
3869
                              ASMOO:
3870
 00FFF850 034006                          pshs    d
3871
 00FFF852 0CCFFE2E1                       ldd             #DisplayChar
3872
 00FFF855 0FD000800                       std             CharOutVec
3873
 00FFF858 035086                          puls    d,pc
3874
 
3875
                              ASMOUTCH:
3876
 00FFF85A 0E7C00                          stb             ,u+
3877
 00FFF85C 039                             rts
3878
 
3879
                              DumpAsmbuf:
3880
 00FFF85D 0CE000160                       ldu             #asmbuf
3881
                              dab2:
3882
 00FFF860 0E6C00                          ldb             ,u+
3883
 00FFF862 027005                          beq             dab1
3884
 00FFF864 017FFF4AB                       lbsr    OUTCH
3885
*** warning 1: Long branch within short branch range could be optimized
3886
 00FFF867 020FF7                          bra             dab2
3887
                              dab1:
3888
 00FFF869 039                             rts
3889
 
3890
                              ;==============================================================================
3891 4 robfinch
                              ; System Monitor
3892
                              ;==============================================================================
3893 13 robfinch
 
3894
                              CmdPrompt:
3895
 00FFF86A 017FFD865                       lbsr    CRLF
3896
*** warning 1: Long branch within short branch range could be optimized
3897
 00FFF86D 0C6024                          ldb             #'$'
3898
 00FFF86F 017FFF4A0                       lbsr    OUTCH
3899
*** warning 1: Long branch within short branch range could be optimized
3900
 00FFF872 016FFF49D                       lbra    OUTCH
3901
*** warning 1: Long branch within short branch range could be optimized
3902
 
3903
                              msgF09Starting:
3904
 00FFF875 04606506D07406906B069           fcb             "Femtiki F09 Multi-core OS Starting",CR,LF,0
3905
 00FFF87C 02004603003902004D075
3906
 00FFF883 06C07406902D06306F072
3907
 00FFF88A 06502004F053020053074
3908
 00FFF891 06107207406906E06700D
3909
 00FFF898 00A000
3910
 
3911 4 robfinch
                              MonitorStart:
3912 13 robfinch
 00FFF89A 0CCFFF875                       ldd             #msgF09Starting
3913
 00FFF89D 017FFEB02                       lbsr    DisplayString
3914
*** warning 1: Long branch within short branch range could be optimized
3915
 00FFF8A0 0CCFFFA78                       ldd             #HelpMsg
3916
 00FFF8A3 017FFEAFC                       lbsr    DisplayString
3917
*** warning 1: Long branch within short branch range could be optimized
3918
 00FFF8A6 0CCFFF86A                       ldd             #CmdPrompt
3919
 00FFF8A9 0FD000808                       std             CmdPromptJI
3920 4 robfinch
                              Monitor:
3921 13 robfinch
 00FFF8AC 03280F006FFF                    leas    $6FFF                           ; reset stack pointer
3922
 00FFF8B0 05F                             clrb                                                    ; turn off keyboard echo
3923
 00FFF8B1 017FFF462                       lbsr    SetKeyboardEcho
3924
*** warning 1: Long branch within short branch range could be optimized
3925
                                      ; Reset IO vectors
3926
 00FFF8B4 0CCFFEBE4                       ldd             #SerialPeekCharDirect
3927
 00FFF8B7 0FD000804                       std             CharInVec
3928
 00FFF8BA 0CCFFE2E1                       ldd             #DisplayChar
3929
 00FFF8BD 0FD000800                       std             CharOutVec
3930
 00FFF8C0 0CCFFF86A                       ldd             #CmdPrompt
3931
 00FFF8C3 0FD000808                       std             CmdPromptJI
3932 4 robfinch
                              ;       jsr             RequestIOFocus
3933
                              PromptLn:
3934 13 robfinch
 00FFF8C6 0AD90F000808                    jsr             [CmdPromptJI]
3935 4 robfinch
 
3936
                              ; Get characters until a CR is keyed
3937
 
3938
                              Prompt3:
3939 13 robfinch
 00FFF8CA 0CCFFFFFF                       ldd             #-1                                     ; block until key present
3940
 00FFF8CD 017FFF40A                       lbsr    INCH
3941
*** warning 1: Long branch within short branch range could be optimized
3942
 00FFF8D0 0C100D                          cmpb    #CR
3943
 00FFF8D2 027005                          beq             Prompt1
3944
 00FFF8D4 017FFF43B                       lbsr    OUTCH
3945
*** warning 1: Long branch within short branch range could be optimized
3946
 00FFF8D7 020FF1                          bra             Prompt3
3947 4 robfinch
 
3948
                              ; Process the screen line that the CR was keyed on
3949
                              ;
3950
                              Prompt1:
3951 13 robfinch
 00FFF8D9 0CC005050                       ldd             #$5050
3952
 00FFF8DC 0150FDFFFE60001                 std             LEDS
3953
                              ;       ldb             RunningID
3954
                              ;       cmpb    #61
3955
                              ;       bhi             Prompt3
3956
 00FFF8E1 0CC005151                       ldd             #$5151
3957
 00FFF8E4 0150FDFFFE60001                 std             LEDS
3958
 00FFF8E9 00F111                          clr             CursorCol                       ; go back to the start of the line
3959
 00FFF8EB 017FFE9D0                       lbsr    CalcScreenLoc   ; calc screen memory location
3960
*** warning 1: Long branch within short branch range could be optimized
3961
 00FFF8EE 01F002                          tfr             d,y
3962
 00FFF8F0 0CC005252                       ldd             #$5252
3963
 00FFF8F3 0150FDFFFE60001                 std             LEDS
3964
                              skipDollar:
3965
 00FFF8F8 08D0AB                          bsr             MonGetNonSpace
3966
 00FFF8FA 0C1024                          cmpb    #'$'
3967
 00FFF8FC 027FFA                          beq             skipDollar              ; skip over '$' prompt character
3968
 00FFF8FE 086353                          lda             #$5353
3969
 00FFF900 0150FDFFFE60001                 std             LEDS
3970 4 robfinch
 
3971
                              ; Dispatch based on command character
3972
                              ;
3973
                              Prompt2:
3974 13 robfinch
 00FFF905 0C103C                          cmpb    #'<'
3975
 00FFF907 02602C                          bne             PromptHelp
3976
 00FFF909 08D095                          bsr             MonGetch
3977
 00FFF90B 0C103E                          cmpb    #'>'
3978
 00FFF90D 026F9D                          bne             Monitor
3979
 00FFF90F 08D08F                          bsr             MonGetch
3980
 00FFF911 0C1073                          cmpb    #'s'
3981
 00FFF913 02600E                          bne             Prompt2a
3982
 00FFF915 0CCFFEBE4                       ldd             #SerialPeekCharDirect
3983
 00FFF918 0FD000804                       std             CharInVec
3984
 00FFF91B 0CCFFEC08                       ldd             #SerialPutChar
3985
 00FFF91E 0FD000800                       std             CharOutVec
3986
 00FFF921 020F89                          bra             Monitor
3987
                              Prompt2a:
3988
 00FFF923 0C1063                          cmpb    #'c'
3989
 00FFF925 026F85                          bne             Monitor
3990
 00FFF927 0CCFFEA12                       ldd             #GetKey
3991
 00FFF92A 0FD000804                       std             CharInVec
3992
 00FFF92D 0CCFFE2E1                       ldd             #DisplayChar
3993
 00FFF930 0FD000800                       std             CharOutVec
3994
 00FFF933 020F77                          bra             Monitor
3995
                              PromptHelp:
3996
 00FFF935 0C103F                          cmpb    #'?'                    ; $? - display help
3997
 00FFF937 026008                          bne             PromptC
3998
 00FFF939 0CCFFFA78                       ldd             #HelpMsg
3999
 00FFF93C 017FFEA63                       lbsr    DisplayString
4000
*** warning 1: Long branch within short branch range could be optimized
4001
 00FFF93F 020F6B                          bra             Monitor
4002 4 robfinch
                              PromptC:
4003 13 robfinch
 00FFF941 0C1043                          cmpb    #'C'
4004
 00FFF943 026008                          bne             PromptD
4005
 00FFF945 017FFE8C9                       lbsr    ClearScreen
4006 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
4007 13 robfinch
 00FFF948 017FFE939                       lbsr    HomeCursor
4008
*** warning 1: Long branch within short branch range could be optimized
4009
 00FFF94B 020F5F                          bra             Monitor
4010 4 robfinch
                              PromptD:
4011 13 robfinch
 00FFF94D 0C1044                          cmpb    #'D'
4012
 00FFF94F 026008                          bne             PromptF
4013
 00FFF951 08D04D                          bsr             MonGetch
4014
 00FFF953 0C1052                          cmpb    #'R'
4015
 00FFF955 02621A                          bne             DumpMemory
4016
 00FFF957 020274                          bra             DumpRegs
4017 4 robfinch
                              PromptF:
4018 13 robfinch
 00FFF959 0C1046                          cmpb    #'F'
4019
 00FFF95B 02600F                          bne             PromptJ
4020
 00FFF95D 08D041                          bsr             MonGetch
4021
 00FFF95F 0C1049                          cmpb    #'I'
4022
 00FFF961 026F49                          bne             Monitor
4023
 00FFF963 08D03B                          bsr             MonGetch
4024
 00FFF965 0C1047                          cmpb    #'G'
4025
 00FFF967 026F43                          bne             Monitor
4026
 00FFF969 07EFE0000                       jmp             $FE0000
4027 4 robfinch
                              PromptJ:
4028 13 robfinch
 00FFF96C 0C104A                          cmpb    #'J'
4029
 00FFF96E 1270002A7                       lbeq    jump_to_code
4030 4 robfinch
                              PromptR:
4031 13 robfinch
 00FFF971 0C1052                          cmpb    #'R'
4032
 00FFF973 026006                          bne             Prompt_s
4033
 00FFF975 0CEFFF8AC                       ldu             #Monitor
4034
 00FFF978 016FFDA85                       lbra    ramtest
4035 4 robfinch
*** warning 1: Long branch within short branch range could be optimized
4036 13 robfinch
                              Prompt_s:
4037
 00FFF97B 0C1073                          cmpb    #'s'
4038
 00FFF97D 026005                          bne             PromptT
4039
 00FFF97F 017FFF323                       lbsr    SerialOutputTest
4040
*** warning 1: Long branch within short branch range could be optimized
4041
 00FFF982 020F28                          bra             Monitor
4042
                              PromptT:
4043
 00FFF984 0C1054                          cmpb    #'T'
4044
 00FFF986 026011                          bne             PromptU
4045
 00FFF988 08D016                          bsr             MonGetch
4046
 00FFF98A 0C1049                          cmpb    #'I'
4047
 00FFF98C 026F1E                          bne             Monitor
4048
 00FFF98E 08D010                          bsr             MonGetch
4049
 00FFF990 0C1052                          cmpb    #'R'
4050
 00FFF992 026F18                          bne             Monitor
4051
 00FFF994 017FFEB1C                       lbsr    rtc_read
4052
*** warning 1: Long branch within short branch range could be optimized
4053
 00FFF997 020F13                          bra             Monitor
4054
                              PromptU:
4055
 00FFF999 0C1055                          cmpb    #'U'
4056
 00FFF99B 026F0F                          bne             Monitor
4057
 00FFF99D 016FFFA14                       lbra    disassem
4058
*** warning 1: Long branch within short branch range could be optimized
4059 4 robfinch
 
4060
                              MonGetch:
4061 13 robfinch
 00FFF9A0 0E6A04                          ldb             ,y
4062
 00FFF9A2 031201                          iny
4063
 00FFF9A4 039                             rts
4064 4 robfinch
 
4065
                              MonGetNonSpace:
4066 13 robfinch
 00FFF9A5 08DFF9                          bsr             MonGetCh
4067
 00FFF9A7 0C1020                          cmpb    #' '
4068
 00FFF9A9 027FFA                          beq             MonGetNonSpace
4069
 00FFF9AB 039                             rts
4070 4 robfinch
 
4071
                              ;------------------------------------------------------------------------------
4072
                              ; Ignore blanks in the input
4073
                              ; Y = text pointer
4074
                              ; D destroyed
4075
                              ;------------------------------------------------------------------------------
4076
                              ;
4077
                              ignBlanks:
4078
                              ignBlanks1:
4079 13 robfinch
 00FFF9AC 08DFF2                          bsr             MonGetch
4080
 00FFF9AE 0C1020                          cmpb    #' '
4081
 00FFF9B0 027FFA                          beq             ignBlanks1
4082
 00FFF9B2 0313FF                          dey
4083
 00FFF9B4 039                             rts
4084 4 robfinch
 
4085
                              ;------------------------------------------------------------------------------
4086
                              ;------------------------------------------------------------------------------
4087
                              GetTwoParams:
4088 13 robfinch
 00FFF9B5 08DFF5                          bsr             ignBlanks
4089
 00FFF9B7 08D03F                          bsr             GetHexNumber    ; get start address of dump
4090
 00FFF9B9 0FC000910                       ldd             mon_numwka
4091
 00FFF9BC 0FD000920                       std             mon_r1
4092
 00FFF9BF 0FC000912                       ldd             mon_numwka+2
4093
 00FFF9C2 0FD000922                       std             mon_r1+2
4094
 00FFF9C5 08DFE5                          bsr             ignBlanks
4095
 00FFF9C7 08D02F                          bsr             GetHexNumber    ; get end address of dump
4096
 00FFF9C9 0FC000910                       ldd             mon_numwka
4097
 00FFF9CC 0FD000924                       std             mon_r2
4098
 00FFF9CF 0FC000912                       ldd             mon_numwka+2
4099
 00FFF9D2 0FD000926                       std             mon_r2+2
4100
 00FFF9D5 039                             rts
4101 4 robfinch
 
4102
                              ;------------------------------------------------------------------------------
4103
                              ; Get a range, the end must be greater or equal to the start.
4104
                              ;------------------------------------------------------------------------------
4105
                              GetRange:
4106 13 robfinch
 00FFF9D6 08DFDD                          bsr             GetTwoParams
4107
 00FFF9D8 0FC000926                       ldd             mon_r2+2
4108
 00FFF9DB 0B3000922                       subd    mon_r1+2
4109
 00FFF9DE 0FC000924                       ldd             mon_r2
4110
 00FFF9E1 0F2000921                       sbcb    mon_r1+1
4111
 00FFF9E4 0B2000920                       sbca    mon_r1
4112
 00FFF9E7 125000074                       lbcs    DisplayErr
4113
 00FFF9EA 039                             rts
4114 4 robfinch
 
4115
                              shl_numwka:
4116 13 robfinch
 00FFF9EB 078000913                       asl             mon_numwka+3
4117
 00FFF9EE 079000912                       rol             mon_numwka+2
4118
 00FFF9F1 079000911                       rol             mon_numwka+1
4119
 00FFF9F4 079000910                       rol             mon_numwka
4120
 00FFF9F7 039                             rts
4121 4 robfinch
 
4122
                              ;------------------------------------------------------------------------------
4123 13 robfinch
                              ; Get a hexidecimal number. Maximum of twelve digits.
4124
                              ;
4125
                              ; Modifies:
4126
                              ;       Y = text pointer (updated)
4127
                              ;       D = number of digits
4128
                              ;       mon_numwka contains number
4129 4 robfinch
                              ;------------------------------------------------------------------------------
4130
                              ;
4131
                              GetHexNumber:
4132 13 robfinch
 00FFF9F8 04F05F                          clrd
4133
 00FFF9FA 0FD000910                       std             mon_numwka      ; zero out work area
4134
 00FFF9FD 0FD000912                       std             mon_numwka+2
4135
 00FFFA00 034010                          pshs    x
4136
 00FFFA02 08E000000                       ldx             #0                                      ; max 12 eight digits
4137 4 robfinch
                              gthxn2:
4138 13 robfinch
 00FFFA05 08DF99                          bsr             MonGetch
4139
 00FFFA07 08D01F                          bsr             AsciiToHexNybble
4140
 00FFFA09 0C1FFF                          cmpb    #-1
4141
 00FFFA0B 027017                          beq             gthxn1
4142
 00FFFA0D 08DFDC                          bsr             shl_numwka
4143
 00FFFA0F 08DFDA                          bsr             shl_numwka
4144
 00FFFA11 08DFD8                          bsr             shl_numwka
4145
 00FFFA13 08DFD6                          bsr             shl_numwka
4146
 00FFFA15 0C400F                          andb    #$0f
4147
 00FFFA17 0FA000913                       orb             mon_numwka+3
4148
 00FFFA1A 0F7000913                       stb             mon_numwka+3
4149
 00FFFA1D 030001                          inx
4150
 00FFFA1F 08C00000C                       cmpx    #12
4151
 00FFFA22 025FE1                          blo             gthxn2
4152 4 robfinch
                              gthxn1:
4153 13 robfinch
 00FFFA24 01F010                          tfr             x,d
4154
 00FFFA26 035090                          puls    x,pc
4155 4 robfinch
 
4156
                              ;GetDecNumber:
4157
                              ;       phx
4158
                              ;       push    r4
4159
                              ;       push    r5
4160
                              ;       ldx             #0
4161
                              ;       ld              r4,#10
4162
                              ;       ld              r5,#10
4163
                              ;gtdcn2:
4164
                              ;       jsr             MonGetch
4165
                              ;       jsr             AsciiToDecNybble
4166
                              ;       cmp             #-1
4167
                              ;       beq             gtdcn1
4168
                              ;       mul             r2,r2,r5
4169
                              ;       add             r2,r1
4170
                              ;       dec             r4
4171
                              ;       bne             gtdcn2
4172
                              ;gtdcn1:
4173
                              ;       txa
4174
                              ;       pop             r5
4175
                              ;       pop             r4
4176
                              ;       plx
4177
                              ;       rts
4178
 
4179
                              ;------------------------------------------------------------------------------
4180
                              ; Convert ASCII character in the range '0' to '9', 'a' to 'f' or 'A' to 'F'
4181
                              ; to a hex nybble.
4182
                              ;------------------------------------------------------------------------------
4183
                              ;
4184
                              AsciiToHexNybble:
4185 13 robfinch
 00FFFA28 0C1030                          cmpb    #'0'
4186
 00FFFA2A 025021                          blo             gthx3
4187
 00FFFA2C 0C1039                          cmpb    #'9'
4188
 00FFFA2E 022003                          bhi             gthx5
4189
 00FFFA30 0C0030                          subb    #'0'
4190
 00FFFA32 039                             rts
4191 4 robfinch
                              gthx5:
4192 13 robfinch
 00FFFA33 0C1041                          cmpb    #'A'
4193
 00FFFA35 025016                          blo             gthx3
4194
 00FFFA37 0C1046                          cmpb    #'F'
4195
 00FFFA39 022005                          bhi             gthx6
4196
 00FFFA3B 0C0041                          subb    #'A'
4197
 00FFFA3D 0CB00A                          addb    #10
4198
 00FFFA3F 039                             rts
4199 4 robfinch
                              gthx6:
4200 13 robfinch
 00FFFA40 0C1061                          cmpb    #'a'
4201
 00FFFA42 025009                          blo             gthx3
4202
 00FFFA44 0C107A                          cmpb    #'z'
4203
 00FFFA46 022005                          bhi             gthx3
4204
 00FFFA48 0C0061                          subb    #'a'
4205
 00FFFA4A 0CB00A                          addb    #10
4206
 00FFFA4C 039                             rts
4207 4 robfinch
                              gthx3:
4208 13 robfinch
 00FFFA4D 0C6FFF                          ldb             #-1             ; not a hex number
4209
 00FFFA4F 039                             rts
4210 4 robfinch
 
4211
                              AsciiToDecNybble:
4212 13 robfinch
 00FFFA50 0C1030                          cmpb    #'0'
4213
 00FFFA52 024007                          bcc             gtdc3
4214
 00FFFA54 0C103A                          cmpb    #'9'+1
4215
 00FFFA56 025003                          bcs             gtdc3
4216
 00FFFA58 0C0030                          subb    #'0'
4217
 00FFFA5A 039                             rts
4218 4 robfinch
                              gtdc3:
4219 13 robfinch
 00FFFA5B 0C6FFF                          ldb             #-1
4220
 00FFFA5D 039                             rts
4221 4 robfinch
 
4222
                              DisplayErr:
4223 13 robfinch
 00FFFA5E 08EFFFA70                       ldx             #msgErr
4224
 00FFFA61 04F05F                          clrd
4225
 00FFFA63 08D003                          bsr             DisplayStringDX
4226
 00FFFA65 07EFFF8AC                       jmp             Monitor
4227 4 robfinch
 
4228
                              DisplayStringDX
4229 13 robfinch
 00FFFA68 0DD024                          std             Strptr
4230
 00FFFA6A 09F026                          stx             Strptr+2
4231
 00FFFA6C 0BDFFE3A2                       jsr             DisplayString
4232
 00FFFA6F 039                             rts
4233 4 robfinch
 
4234
                              msgErr:
4235 13 robfinch
 00FFFA70 02A02A04507207200D00A           fcb     "**Err",CR,LF,0
4236
 00FFFA77 000
4237 4 robfinch
 
4238
                              HelpMsg:
4239 13 robfinch
 00FFFA78 03F02003D020044069073           fcb             "? = Display help",CR,LF
4240
 00FFFA7F 07006C061079020068065
4241
 00FFFA86 06C07000D00A
4242
 00FFFA8A 04304C05302003D020063           fcb     "CLS = clear screen",CR,LF
4243
 00FFFA91 06C065061072020073063
4244
 00FFFA98 07206506506E00D00A
4245 4 robfinch
                              ;       db      "S = Boot from SD Card",CR,LF
4246
                              ;       db      ": = Edit memory bytes",CR,LF
4247
                              ;       db      "L = Load sector",CR,LF
4248
                              ;       db      "W = Write sector",CR,LF
4249 13 robfinch
 00FFFA9E 04405202003D020044075           fcb "DR = Dump registers",CR,LF
4250
 00FFFAA5 06D070020072065067069
4251
 00FFFAAC 07307406507207300D00A
4252
 00FFFAB3 04402003D02004407506D           fcb     "D = Dump memory",CR,LF
4253
 00FFFABA 07002006D06506D06F072
4254
 00FFFAC1 07900D00A
4255 4 robfinch
                              ;       db      "F = Fill memory",CR,LF
4256
                              ;       db  "FL = Dump I/O Focus List",CR,LF
4257 13 robfinch
 00FFFAC4 04604904702003D020073           fcb "FIG = start FIG Forth",CR,LF
4258
 00FFFACB 074061072074020046049
4259
 00FFFAD2 04702004606F072074068
4260
 00FFFAD9 00D00A
4261 4 robfinch
                              ;       db      "KILL n = kill task #n",CR,LF
4262
                              ;       db      "B = start tiny basic",CR,LF
4263
                              ;       db      "b = start EhBasic 6502",CR,LF
4264 13 robfinch
 00FFFADB 04A02003D02004A07506D           fcb     "J = Jump to code",CR,LF
4265
 00FFFAE2 07002007406F02006306F
4266
 00FFFAE9 06406500D00A
4267
 00FFFAED 05204104D02003D020074           fcb "RAM = test RAM",CR,LF
4268
 00FFFAF4 06507307402005204104D
4269
 00FFFAFB 00D00A
4270 4 robfinch
                              ;       db      "R[n] = Set register value",CR,LF
4271
                              ;       db      "r = random lines - test bitmap",CR,LF
4272
                              ;       db      "e = ethernet test",CR,LF
4273 13 robfinch
 00FFFAFD 07302003D020073065072           fcb     "s = serial output test",CR,LF
4274
 00FFFB04 06906106C02006F075074
4275
 00FFFB0B 070075074020074065073
4276
 00FFFB12 07400D00A
4277 4 robfinch
                              ;       db      "T = Dump task list",CR,LF
4278
                              ;       db      "TO = Dump timeout list",CR,LF
4279 13 robfinch
 00FFFB15 05404902003D020064069           fcb     "TI = display date/time",CR,LF
4280
 00FFFB1C 07307006C061079020064
4281
 00FFFB23 06107406502F07406906D
4282
 00FFFB2A 06500D00A
4283 4 robfinch
                              ;       db      "TEMP = display temperature",CR,LF
4284
                              ;       db      "P = Piano",CR,LF,0
4285 13 robfinch
 00FFFB2D 000                             fcb             0
4286 4 robfinch
 
4287
                              msgRegHeadings
4288 13 robfinch
 00FFFB2E 00D00A02002004402F041           fcb     CR,LF,"  D/AB     X      Y      U      S       PC    DP  CCR",CR,LF,0
4289
 00FFFB35 042020020020020020058
4290
 00FFFB3C 020020020020020020059
4291
 00FFFB43 020020020020020020055
4292
 00FFFB4A 020020020020020020053
4293
 00FFFB51 020020020020020020020
4294
 00FFFB58 050043020020020020044
4295
 00FFFB5F 05002002004304305200D
4296
 00FFFB66 00A000
4297 4 robfinch
 
4298
                              nHEX4:
4299 13 robfinch
 00FFFB68 0BDFFD2D2                       jsr             HEX4
4300
 00FFFB6B 039                             rts
4301 4 robfinch
 
4302
                              nXBLANK:
4303 13 robfinch
 00FFFB6C 0C6020                          ldb             #' '
4304
 00FFFB6E 016FFF1A1                       lbra    OUTCH
4305
*** warning 1: Long branch within short branch range could be optimized
4306 4 robfinch
 
4307 13 robfinch
                              ;------------------------------------------------------------------------------
4308
                              ; Dump Memory
4309
                              ;
4310
                              ; Usage:
4311
                              ;       $D FFFC12 8
4312
                              ;
4313
                              ; Dump formatted to look like:
4314
                              ;               :FFFC12 012 012 012 012 555 666 777 888
4315
                              ;
4316
                              ;------------------------------------------------------------------------------
4317 4 robfinch
 
4318 13 robfinch
                              DumpMemory:
4319
 00FFFB71 08DE42                          bsr             GetTwoParams
4320
 00FFFB73 18E000000                       ldy             #0
4321
 00FFFB76 1BE000922                       ldy             mon_r1+2
4322
                              dmpm2:
4323
 00FFFB79 017FFD556                       lbsr    CRLF
4324
*** warning 1: Long branch within short branch range could be optimized
4325
 00FFFB7C 0C603A                          ldb             #':'
4326
 00FFFB7E 017FFF191                       lbsr    OUTCH
4327
*** warning 1: Long branch within short branch range could be optimized
4328
 00FFFB81 01F020                          tfr             y,d
4329
                                      ;addd   mon_r1+2                                        ; output the address
4330
 00FFFB83 017FFE867                       lbsr    DispWordAsHex
4331
*** warning 1: Long branch within short branch range could be optimized
4332
 00FFFB86 0C6020                          ldb             #' '
4333
 00FFFB88 017FFF187                       lbsr    OUTCH
4334
*** warning 1: Long branch within short branch range could be optimized
4335
 00FFFB8B 08E000008                       ldx             #8                                                              ; number of bytes to display
4336
                              dmpm1:
4337
                              ;       ldb             far [mon_r1+1],y
4338
                                      ;ldb            [mon_r1+2],y
4339
 00FFFB8E 0E6A04                          ldb             ,y
4340
 00FFFB90 031201                          iny
4341
 00FFFB92 017FFE861                       lbsr    DispByteAsHex                   ; display byte
4342
*** warning 1: Long branch within short branch range could be optimized
4343
 00FFFB95 0C6020                          ldb             #' '                                                    ; followed by a space
4344
 00FFFB97 017FFF178                       lbsr    OUTCH
4345
*** warning 1: Long branch within short branch range could be optimized
4346
 00FFFB9A 05F                             clrb
4347
 00FFFB9B 04F                             clra
4348
 00FFFB9C 017FFF13B                       lbsr    INCH
4349
*** warning 1: Long branch within short branch range could be optimized
4350
 00FFFB9F 0C1003                          cmpb    #CTRLC
4351
 00FFFBA1 027024                          beq             dmpm3
4352
 00FFFBA3 0301FF                          dex
4353
 00FFFBA5 026FE7                          bne             dmpm1
4354
                                      ; Now output ascii
4355
 00FFFBA7 0C6020                          ldb             #' '
4356
 00FFFBA9 017FFF166                       lbsr    OUTCH
4357
*** warning 1: Long branch within short branch range could be optimized
4358
 00FFFBAC 08E000008                       ldx             #8                                                              ; 8 chars to output
4359
 00FFFBAF 0313F8                          leay    -8,y                                                    ; backup pointer
4360
                              dmpm5:
4361
                              ;       ldb             far [mon_r1+1],y        ; get the char
4362
                              ;       ldb             [mon_r1+2],y                    ; get the char
4363
 00FFFBB1 0E6A04                          ldb             ,y
4364
 00FFFBB3 0C1020                          cmpb    #$20                                                    ; is it a control char?
4365
 00FFFBB5 024002                          bhs             dmpm4
4366
 00FFFBB7 0C602E                          ldb             #'.'
4367
                              dmpm4:
4368
 00FFFBB9 017FFF156                       lbsr    OUTCH
4369
*** warning 1: Long branch within short branch range could be optimized
4370
 00FFFBBC 031201                          iny
4371
 00FFFBBE 0301FF                          dex
4372
 00FFFBC0 026FEF                          bne             dmpm5
4373
 00FFFBC2 1BC000926                       cmpy    mon_r2+2
4374
 00FFFBC5 025FB2                          blo             dmpm2
4375
                              dmpm3:
4376
 00FFFBC7 017FFD508                       lbsr    CRLF
4377
*** warning 1: Long branch within short branch range could be optimized
4378
 00FFFBCA 016FFFCDF                       lbra    Monitor
4379
*** warning 1: Long branch within short branch range could be optimized
4380
 
4381
                              ;------------------------------------------------------------------------------
4382
                              ; Dump Registers
4383
                              ;
4384
                              ;       Usage:
4385
                              ;               $DR
4386
                              ;------------------------------------------------------------------------------
4387
 
4388
                              DumpRegs:
4389
 00FFFBCD 0CCFFFB2E                       ldd             #msgRegHeadings
4390
 00FFFBD0 017FFE7CF                       lbsr    DisplayString
4391
*** warning 1: Long branch within short branch range could be optimized
4392
 00FFFBD3 08DF97                          bsr             nXBLANK
4393
 00FFFBD5 0FC000900                       ldd             mon_DSAVE
4394
 00FFFBD8 08DF8E                          bsr             nHEX4
4395
 00FFFBDA 08DF90                          bsr             nXBLANK
4396
 00FFFBDC 0FC000902                       ldd             mon_XSAVE
4397
 00FFFBDF 08DF87                          bsr             nHEX4
4398
 00FFFBE1 08DF89                          bsr             nXBLANK
4399
 00FFFBE3 0FC000904                       ldd             mon_YSAVE
4400
 00FFFBE6 08DF80                          bsr             nHEX4
4401
 00FFFBE8 08DF82                          bsr             nXBLANK
4402
 00FFFBEA 0FC000906                       ldd             mon_USAVE
4403
 00FFFBED 08DF79                          bsr             nHEX4
4404
 00FFFBEF 08DF7B                          bsr             nXBLANK
4405
 00FFFBF1 0FC000908                       ldd             mon_SSAVE
4406
 00FFFBF4 08DF72                          bsr             nHEX4
4407
 00FFFBF6 08DF74                          bsr             nXBLANK
4408
 00FFFBF8 0F600090B                       ldb             mon_PCSAVE+1
4409
 00FFFBFB 017FFE7F8                       lbsr    DispByteAsHex
4410
*** warning 1: Long branch within short branch range could be optimized
4411
 00FFFBFE 0FC00090C                       ldd             mon_PCSAVE+2
4412
 00FFFC01 08DF65                          bsr             nHEX4
4413
 00FFFC03 08DF67                          bsr             nXBLANK
4414
 00FFFC05 0FC00090E                       ldd             mon_DPRSAVE
4415
 00FFFC08 0BDFFD2CE                       jsr             HEX2
4416
 00FFFC0B 08DF5F                          bsr             nXBLANK
4417
 00FFFC0D 0B600090F                       lda             mon_CCRSAVE
4418
 00FFFC10 017FFD6BB                       lbsr    HEX2
4419
*** warning 1: Long branch within short branch range could be optimized
4420
 00FFFC13 08DF57                          bsr             nXBLANK
4421
 00FFFC15 016FFFC94                       lbra    Monitor
4422
*** warning 1: Long branch within short branch range could be optimized
4423
 
4424
                              ;------------------------------------------------------------------------------
4425 4 robfinch
                              ; Jump to code
4426 13 robfinch
                              ;
4427
                              ; Registers are loaded with values from the monitor register save area before
4428
                              ; the code is jumped to.
4429
                              ;
4430
                              ; J 
4431
                              ;------------------------------------------------------------------------------
4432
 
4433 4 robfinch
                              jump_to_code:
4434 13 robfinch
 00FFFC18 08DDDE                          bsr             GetHexNumber
4435
 00FFFC1A 01A010                          sei
4436
 00FFFC1C 1FE000908                       lds             mon_SSAVE
4437
 00FFFC1F 0CCFFFC53                       ldd             #
4438
 00FFFC22 034006                          pshs    d
4439
 00FFFC24 0C6000                          ldb             #>jtc_exit
4440
 00FFFC26 034004                          pshs    b
4441
 00FFFC28 0FC000912                       ldd             mon_numwka+2
4442
 00FFFC2B 034006                          pshs    d
4443
 00FFFC2D 0F6000911                       ldb             mon_numwka+1
4444
 00FFFC30 034004                          pshs    b
4445
 00FFFC32 0FC000906                       ldd             mon_USAVE
4446
 00FFFC35 034006                          pshs    d
4447
 00FFFC37 0FC000904                       ldd             mon_YSAVE
4448
 00FFFC3A 034006                          pshs    d
4449
 00FFFC3C 0FC000902                       ldd             mon_XSAVE
4450
 00FFFC3F 034006                          pshs    d
4451
 00FFFC41 0B600090E                       lda             mon_DPRSave
4452
 00FFFC44 034002                          pshs    a
4453
 00FFFC46 0FC000900                       ldd             mon_DSAVE
4454
 00FFFC49 034006                          pshs    d
4455
 00FFFC4B 0B600090F                       lda             mon_CCRSAVE
4456
 00FFFC4E 034002                          pshs    a
4457
 00FFFC50 0150350FF                       puls    far ccr,d,dpr,x,y,u,pc
4458 4 robfinch
                              jtc_exit:
4459 13 robfinch
 00FFFC53 1FF000908                       sts             >mon_SSAVE              ; need to use extended addressing, no direct page setting
4460
 00FFFC56 03280F006FFF                    leas    $6FFF                                   ; reset stack to system area, dont modify flags register!
4461
 00FFFC5A 034001                          pshs    ccr                                             ; now the stack can be used
4462
 00FFFC5C 034002                          pshs    a                                                       ; save acca register so we can use it
4463
 00FFFC5E 01F0B8                          tfr             dpr,a                                   ; a = outgoing dpr value
4464
 00FFFC60 0B700090E                       sta             >mon_DPRSAVE    ; force extended addressing mode usage here dpr is not set
4465
 00FFFC63 04F                             clra                                                            ; dpg register must be set to zero before values are
4466
 00FFFC64 01F08B                          tfr             a,dpr                                   ; saved in the monitor register save area.
4467
 00FFFC66 035002                          puls    a                                                       ; get back acca
4468
 00FFFC68 0FD000900                       std             mon_DSAVE                       ; save regsters, can use direct addressing now
4469
 00FFFC6B 0BF000902                       stx             mon_XSAVE
4470
 00FFFC6E 1BF000904                       sty             mon_YSAVE
4471
 00FFFC71 0FF000906                       stu             mon_USAVE
4472
 00FFFC74 035002                          puls    a                                                       ; get back ccr
4473
 00FFFC76 0B700090F                       sta             mon_CCRSAVE             ; and save it too
4474
                                      ; Reset vectors in case they got toasted.
4475
 00FFFC79 0CCFFEBE4                       ldd             #SerialPeekCharDirect
4476
 00FFFC7C 0FD000804                       std             CharInVec
4477
 00FFFC7F 0CCFFE2E1                       ldd             #DisplayChar
4478
 00FFFC82 0FD000800                       std             CharOutVec
4479 4 robfinch
                                      ; todo set according to coreid
4480 13 robfinch
 00FFFC85 016FFFF45                       lbra    DumpRegs                        ; now go do a register dump
4481
*** warning 1: Long branch within short branch range could be optimized
4482 4 robfinch
 
4483
                              ;------------------------------------------------------------------------------
4484
                              ;------------------------------------------------------------------------------
4485
                              swi3_rout:
4486 13 robfinch
 00FFFC88 01A010                          sei
4487
 00FFFC8A 035002                          puls    a
4488
 00FFFC8C 0B700090F                       sta             mon_CCRSAVE
4489
 00FFFC8F 03507E                          puls    D,DPR,X,Y,U
4490
 00FFFC91 0FD000900                       std             mon_DSAVE
4491
 00FFFC94 0BF000902                       stx             mon_XSAVE
4492
 00FFFC97 1BF000904                       sty             mon_YSAVE
4493
 00FFFC9A 0FF000906                       stu             mon_USAVE
4494
 00FFFC9D 01F0B8                          tfr             dpr,a
4495
 00FFFC9F 0B700090E                       sta             mon_DPRSAVE
4496
 00FFFCA2 035002                          puls    a
4497
 00FFFCA4 0B700090A                       sta             mon_PCSAVE
4498
 00FFFCA7 035006                          puls    D
4499
 00FFFCA9 0FD00090B                       std             mon_PCSAVE+1
4500
 00FFFCAC 1FF000908                       sts             mon_SSAVE
4501
 00FFFCAF 1CE003FFF                       lds             #$3FFF
4502
 00FFFCB2 01C0EF                          cli
4503
 00FFFCB4 07EFFFBCD                       jmp             DumpRegs
4504 4 robfinch
                              swi3_exit:
4505 13 robfinch
 00FFFCB7 01A010                          sei
4506
 00FFFCB9 1FE000908                       lds             mon_SSAVE
4507
 00FFFCBC 0FC00090B                       ldd             mon_PCSAVE+1
4508
 00FFFCBF 034006                          pshs    d
4509
 00FFFCC1 0B600090A                       lda             mon_PCSAVE
4510
 00FFFCC4 034002                          pshs    a
4511
 00FFFCC6 0FE000906                       ldu             mon_USAVE
4512
 00FFFCC9 1BE000904                       ldy             mon_YSAVE
4513
 00FFFCCC 0BE000902                       ldx             mon_XSAVE
4514
 00FFFCCF 034070                          pshs    x,y,u
4515
 00FFFCD1 0B600090E                       lda             mon_DPRSAVE
4516
 00FFFCD4 034002                          pshs    a
4517
 00FFFCD6 0FC000900                       ldd             mon_DSAVE
4518
 00FFFCD9 034006                          pshs    d
4519
 00FFFCDB 0B600090F                       lda             mon_CCRSAVE
4520
 00FFFCDE 034002                          pshs    a
4521
 00FFFCE0 01F08A                          tfr             a,ccr
4522
 00FFFCE2 01C0EF                          cli
4523
 00FFFCE4 03B                             rti
4524 4 robfinch
 
4525
                              ;------------------------------------------------------------------------------
4526
                              ;------------------------------------------------------------------------------
4527 13 robfinch
                              firq_rout:
4528
 00FFFCE5 03B                             rti
4529
 
4530 4 robfinch
                              irq_rout:
4531 13 robfinch
                              ;       lbsr    SerialIRQ       ; check for recieved character
4532
                              ;       lbsr    TimerIRQ
4533
 
4534 4 robfinch
                                      ; Reset the edge sense circuit in the PIC
4535 13 robfinch
 00FFFCE6 08601F                          lda             #31                                                     ; Timer is IRQ #31
4536
 00FFFCE8 0B7FF0011                       sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
4537
 00FFFCEB 0150B7FFFE3F010                 sta             PIC+16                                  ; register 16 is edge sense reset reg
4538
 00FFFCF0 0150B6FFFE6000D                 lda             VIA+VIA_IFR
4539
 00FFFCF5 02A011                          bpl             notTimerIRQ2
4540
 00FFFCF7 085800                          bita    #$800
4541
 00FFFCF9 02700D                          beq             notTimerIRQ2
4542
 00FFFCFB 01507FFFFE60012                 clr             VIA+VIA_T3LL
4543
 00FFFD00 01507FFFFE60013                 clr             VIA+VIA_T3LH
4544
 00FFFD05 07CE00037                       inc             $E00037                                 ; update timer IRQ screen flag
4545
                              notTimerIRQ2:
4546 4 robfinch
 
4547 13 robfinch
 00FFFD08 0B6FF0014                       lda             IrqBase                 ; get the IRQ flag byte
4548
 00FFFD0B 044                             lsra
4549
 00FFFD0C 0BAFF0014                       ora             IrqBase
4550
 00FFFD0F 0840E0                          anda    #$E0
4551
 00FFFD11 0B7FF0014                       sta             IrqBase
4552 4 robfinch
 
4553 13 robfinch
                              ;       inc             TEXTSCR+54              ; update IRQ live indicator on screen
4554 4 robfinch
 
4555
                                      ; flash the cursor
4556
                                      ; only bother to flash the cursor for the task with the IO focus.
4557 13 robfinch
                              ;       lda             COREID
4558
                              ;       cmpa    IOFocusID
4559
                              ;       bne             tr1a
4560
                              ;       lda             CursorFlash             ; test if we want a flashing cursor
4561
                              ;       beq             tr1a
4562
                              ;       lbsr    CalcScreenLoc   ; compute cursor location in memory
4563
                              ;       tfr             d,y
4564
                              ;       lda             $2000,y                 ; get color code $2000 higher in memory
4565
                              ;       ldb             IRQFlag                 ; get counter
4566
                              ;       lsrb
4567
                              ;       lsra
4568
                              ;       lsra
4569
                              ;       lsra
4570
                              ;       lsra
4571
                              ;       lsrb
4572
                              ;       rola
4573
                              ;       lsrb
4574
                              ;       rola
4575
                              ;       lsrb
4576
                              ;       rola
4577
                              ;       lsrb
4578
                              ;       rola
4579
                              ;       sta             $E00000,y               ; store the color code back to memory
4580
                              tr1a:
4581
 00FFFD14 03B                             rti
4582 4 robfinch
 
4583
                              ;------------------------------------------------------------------------------
4584
                              ;------------------------------------------------------------------------------
4585
                              nmi_rout:
4586 13 robfinch
 00FFFD15 0150F6FFFFFFFE0                 ldb             COREID
4587
 00FFFD1A 086049                          lda             #'I'
4588
 00FFFD1C 08EE00028                       ldx             #TEXTSCR+40
4589
 00FFFD1F 0A788F                          sta             b,x
4590
                              rti_insn:
4591
 00FFFD21 03B                             rti
4592 4 robfinch
 
4593 13 robfinch
                              ; Special Register Area
4594
                                      org             $FFFFE0
4595
 
4596
                              ; Interrupt vector table
4597
 
4598 4 robfinch
                                      org             $FFFFF0
4599 13 robfinch
 00FFFFF0 FFFD21                          fcw             rti_insn                ; reserved
4600
 00FFFFF2 FFFC88                          fcw             swi3_rout               ; SWI3
4601
 00FFFFF4 FFFD21                          fcw             rti_insn                ; SWI2
4602
 00FFFFF6 FFFCE5                          fcw             firq_rout               ; FIRQ
4603
 00FFFFF8 FFFCE6                          fcw             irq_rout                ; IRQ
4604
 00FFFFFA FFE023                          fcw             start                           ; SWI
4605
 00FFFFFC FFFD15                          fcw             nmi_rout                ; NMI
4606
 00FFFFFE FFE023                          fcw             start                           ; RST
4607 4 robfinch
 
4608 13 robfinch
176 warning(s) in pass 2.
4609 4 robfinch
 
4610
SYMBOL TABLE
4611 13 robfinch
      ACIA 00 FFE30100  ACIA_CMD 00 00000002 ACIA_CTRL 00 00000003 ACIA_CTRL2 00 0000000B
4612
   ACIA_RX 00 00000000 ACIA_STAT 00 00000001   ACIA_TX 00 00000000 ASCIITODECNYBBLE 02 00FFFA50
4613
 ASCIITOHEXNYBBLE 02 00FFFA28    ASMBUF 00 00000160      ASMO 02 00FFF846     ASMOO 02 00FFF850
4614
  ASMOUTCH 02 00FFF85A BIOS_SCREENS 00 17000000 BLANKLINE 02 00FFE258 BLKCPYDST 00 00000020
4615
 BLKCPYSRC 00 0000001C   BLNKLN1 02 00FFE26B CALCSCREENLOC 02 00FFE2BE CHARCOLOR 00 00000112
4616
 CHARINVEC 00 00000804 CHAROUTVEC 00 00000800 CHECKPOINT 02 00FFE115 CLEARSCREEN 02 00FFE211
4617
 CLEARSCREENJMP 02 00FFD300 CMDPROMPT 02 00FFF86A CMDPROMPTJI 00 00000808 COLORCODELOCATION 00 00000014
4618
 COPYSCREENTOVIRTUALSCREEN 02 00FFE1E1 COPYVIRTUALSCREENTOSCREEN 02 00FFE1AA    COREID 00 FFFFFFE0        CR 00 0000000D
4619
      CRLF 02 00FFD0D2     CRLF1 02 00FFD0D2    CRLFST 02 00FFE3E1       CS1 02 00FFE21E
4620
       CS2 02 00FFE235     CS2V1 02 00FFE1ED       CS3 02 00FFE23B      CSL1 02 00FFE2D9
4621
     CTRLC 00 00000003     CTRLH 00 00000008     CTRLI 00 00000009     CTRLJ 00 0000000A
4622
     CTRLK 00 0000000B     CTRLM 00 0000000D     CTRLS 00 00000013     CTRLT 00 00000014
4623
     CTRLX 00 00000018 CURSORCOL 00 00000111 CURSORFLASH 00 00000114 CURSORROW 00 00000110
4624
     CV2S1 02 00FFE1BF      DAB1 02 00FFF869      DAB2 02 00FFF860 DBGCHECKFORKEY 02 00FFEA10
4625
     DBGK1 02 00FFEA4B    DBGK10 02 00FFEAB0    DBGK11 02 00FFEB09    DBGK12 02 00FFEB0F
4626
    DBGK13 02 00FFEB1B    DBGK14 02 00FFEB2B    DBGK15 02 00FFEB3A    DBGK16 02 00FFEB45
4627
    DBGK17 02 00FFEB4E    DBGK18 02 00FFEB51     DBGK2 02 00FFEA16    DBGK20 02 00FFEA38
4628
    DBGK22 02 00FFEA54    DBGK23 02 00FFEA65    DBGK24 02 00FFEA46     DBGK3 02 00FFEA68
4629
     DBGK4 02 00FFEA74     DBGK5 02 00FFEA80     DBGK7 02 00FFEA90     DBGK8 02 00FFEA96
4630
     DBGK9 02 00FFEAAA DBGKNOTALT 02 00FFEB13 DBGKNOTCAPSLOCK 02 00FFEAE2 DBGKNOTCTRL 02 00FFEA9A
4631
 DBGKNOTNUMLOCK 02 00FFEACB DBGKNOTRSHIFT 02 00FFEAB4 DBGKNOTSCROLLLOCK 02 00FFEAF9      DCCR 02 00FFE2F1
4632
      DCLF 02 00FFE37B     DCX10 02 00FFE32B     DCX11 02 00FFE33B     DCX12 02 00FFE337
4633
     DCX13 02 00FFE347     DCX14 02 00FFE2EE      DCX3 02 00FFE369      DCX4 02 00FFE37D
4634
      DCX5 02 00FFE358      DCX6 02 00FFE302      DCX7 02 00FFE2FE      DCX8 02 00FFE30F
4635
      DCX9 02 00FFE31C   DELAY3S 02 00FFE18D    DIRECT 00 00000001      DIS1 02 00FFF7CE
4636
     DIS10 02 00FFF566     DIS11 02 00FFF5A2     DIS12 02 00FFF5DF     DIS13 02 00FFF61B
4637
     DIS14 02 00FFF65C     DIS15 02 00FFF698     DIS16 02 00FFF6D5     DIS17 02 00FFF718
4638
     DIS18 02 00FFF760     DIS19 02 00FFF7FA      DIS2 02 00FFF405     DIS20 02 00FFF3CE
4639
     DIS21 02 00FFF403     DIS23 02 00FFF3D1     DIS24 02 00FFF7FD     DIS25 02 00FFF80A
4640
      DIS3 02 00FFF42E      DIS4 02 00FFF44B      DIS5 02 00FFF45C      DIS6 02 00FFF490
4641
      DIS7 02 00FFF4C7      DIS8 02 00FFF4FB      DIS9 02 00FFF532  DISASSEM 02 00FFF3B4
4642
  DISLOOP1 02 00FFF3BD DISNDXREG 02 00FFF831 DISNDXREGS 02 00FFF82D DISNEXTLINE 02 00FFF821
4643
   DISNOT9 02 00FFF440 DISNOTAOFFS 02 00FFF5CA  DISNOTBO 02 00FFF607 DISNOTBOFFS 02 00FFF58E
4644
 DISNOTDIRECT 02 00FFF3FF DISNOTDOFFS 02 00FFF6C0 DISNOTEXT 02 00FFF7AD DISNOTIMMB 02 00FFF7BE
4645
 DISNOTIMMW 02 00FFF7CE DISNOTLREL 02 00FFF40F DISNOTNDX 02 00FFF7A1 DISNOTPBO 02 00FFF704
4646
 DISNOTPTO 02 00FFF78F DISNOTPWO 02 00FFF747   DISNOTR 02 00FFF552 DISNOTREL 02 00FFF418
4647
 DISNOTRMINUS 02 00FFF4EC DISNOTRMINUSMINUS 02 00FFF523 DISNOTRPLUS 02 00FFF481 DISNOTRPLUSPLUS 02 00FFF4B8
4648
  DISNOTTO 02 00FFF684  DISNOTWO 02 00FFF643 DISPBYTEASHEX 02 00FFE3F6 DISPDWORDASHEX 02 00FFE3E4
4649
 DISPLAYCHAR 02 00FFE2E1 DISPLAYERR 02 00FFFA5E DISPLAYSTRING 02 00FFE3A2 DISPLAYSTRINGCRLF 02 00FFE3B9
4650
 DISPLAYSTRINGDX 02 00FFFA68   DISPNYB 02 00FFE40E  DISPNYB1 02 00FFE41D DISPWORDASHEX 02 00FFE3ED
4651
   DISTBL1 02 00FFEDB4   DISTBL2 02 00FFF2B4   DISTBL3 02 00FFF2F4   DISTBL4 02 00FFF314
4652
    DLY3S1 02 00FFE190    DLY3S2 02 00FFE194     DMPM1 02 00FFFB8E     DMPM2 02 00FFFB79
4653
     DMPM3 02 00FFFBC7     DMPM4 02 00FFFBB9     DMPM5 02 00FFFBB1 DRAM_BASE 00 10000000
4654
    DSPJ1B 02 00FFE3AB     DSPJ2 02 00FFE3A6    DSRETB 02 00FFE3B4 DUMPASMBUF 02 00FFF85D
4655
 DUMPMEMORY 02 00FFFB71  DUMPREGS 02 00FFFBCD    DUMRTS 02 00FFE022       EXT 00 00000006
4656
    FAREXT 00 00000008 FIRQ_ROUT 02 00FFFCE5 FIRST_CORE 00 00000001   FREEMBX 02 00000002
4657
   FREEMSG 02 00000006   FREETCB 00 0000078A GETHEXNUMBER 02 00FFF9F8    GETKEY 02 00FFEA12
4658
  GETRANGE 02 00FFF9D6 GETSCREENLOCATION 02 00FFE272 GETTWOPARAMS 02 00FFF9B5      GSL1 02 00FFE280
4659
     GTDC3 02 00FFFA5B     GTHX3 02 00FFFA4D     GTHX5 02 00FFFA33     GTHX6 02 00FFFA40
4660
    GTHXN1 02 00FFFA24    GTHXN2 02 00FFFA05       HC1 02 00FFE29A   HELPMSG 02 00FFFA78
4661
      HEX2 02 00FFD2CE      HEX4 02 00FFD2D2 HOMECURSOR 02 00FFE284 HOMECURSORJMP 02 00FFD308
4662
     I2CW1 02 00FFE47E    I2CWR1 02 00FFE4AB   I2C_CMD 00 00000004  I2C_CTRL 00 00000002
4663
  I2C_PREH 00 00000001  I2C_PREL 00 00000000   I2C_RXR 00 00000003  I2C_STAT 00 00000004
4664
   I2C_TXR 00 00000003 I2C_WAIT_RX_NACK 02 00FFE4A9 I2C_WAIT_TIP 02 00FFE47C I2C_WR_CMD 02 00FFE486
4665
      ICC1 02 00FFE39E      ICC2 02 00FFE3A0      ICR1 02 00FFE390 IGNBLANKS 02 00FFF9AC
4666
 IGNBLANKS1 02 00FFF9AC      IMMB 00 00000003      IMMW 00 00000007 INCCURSORPOS 02 00FFE37F
4667
 INCCURSORROW 02 00FFE38E      INCH 02 00FFECDA     INCH1 02 00FFECEF     INCH2 02 00FFECDC
4668
     INCHE 02 00FFECF8    INCHEK 02 00FFECFC   INCHEK1 02 00FFED11   INCHEK2 02 00FFED0E
4669
   INCHEK3 02 00FFED05      INIT 02 00FFE086     INIT1 02 00FFE08E INITSERIAL 02 00FFEB6F
4670
 IOFOCUSID 00 00FF0010 IOFOCUSLIST 00 00FF0000 IOFOCUSNDX 00 00000100   IRQBASE 00 00FF0014
4671
   IRQFLAG 00 00FF0012 IRQSOURCE 00 00FF0011  IRQ_ROUT 02 00FFFCE6  JTC_EXIT 02 00FFFC53
4672
 JUMP_TO_CODE 02 00FFFC18 KBDBUFFULL 02 00FFEA0D   KBDFIFO 00 00000040 KBDFIFOALIAS 00 00C00040
4673
 KBDHEADRCV 00 00000127  KBDI0002 02 00FFE949  KBDI0004 02 00FFE98E KBDITRYAGAIN 02 00FFE982
4674
 KBDRCVCOUNT 02 00FFE9BD KBDTAILRCV 00 00000128     KBGS1 02 00FFE8F8     KBGS2 02 00FFE8F0
4675
     KBGS3 02 00FFE8E1     KEYBD 00 FFE30400  KEYBDACK 00 FFFFCC00  KEYBDBAD 00 FFFFCB00
4676
 KEYBDBLOCK 00 00000126 KEYBDBUFFER 00 FFFFC000 KEYBDCHECKFORKEYDIRECT 02 00FFECD8 KEYBDCLOSE 02 00FFEB6B
4677
  KEYBDCLR 00 FFE30402 KEYBDCONTROLCODES 02 00FFE780 KEYBDECHO 00 FFFFCA00 KEYBDEXTENDEDCODES 02 00FFE800
4678
 KEYBDGETID 02 00FFE91C KEYBDGETSCANCODE 02 00FFE8FD KEYBDGETSTATUS 02 00FFE8E1 KEYBDHEAD 00 FFFFC800
4679
   KEYBDID 00 00000124 KEYBDINIT 02 00FFE940  KEYBDIRQ 02 00FFE9CF KEYBDLOCKS 00 FFFFCD00
4680
 KEYBDOPEN 02 00FFEB6A KEYBDREAD 02 00FFEB6C KEYBDRECVBYTE 02 00FFE880 KEYBDSEEK 02 00FFEB6E
4681
 KEYBDSENDBYTE 02 00FFE899 KEYBDSETLED 02 00FFE909 KEYBDTAIL 00 FFFFC900 KEYBDWAITTX 02 00FFE89F
4682
 KEYBDWRITE 02 00FFEB6D    KEYLED 00 00000122 KEYSTATE1 00 00000120 KEYSTATE2 00 00000121
4683
     KGID1 02 00FFE939  KGNOTKBD 02 00FFE93C      KRB3 02 00FFE885      KRB4 02 00FFE895
4684
    KRCXIT 02 00FFE9CE      KWT1 02 00FFE8A4      KWT2 02 00FFE8B5      LEDS 00 FFE60001
4685
    LEDXIT 02 00FFE9A2    LETTER 02 00FFD2C1        LF 00 0000000A     LSREL 00 00000002
4686
 MAX_TASKNO 00 0000003F  MONGETCH 02 00FFF9A0 MONGETNONSPACE 02 00FFF9A5   MONITOR 02 00FFF8AC
4687
 MONITORSTART 02 00FFF89A MON_CCRSAVE 00 0000090F MON_DPRSAVE 00 0000090E MON_DSAVE 00 00000900
4688
 MON_NUMWKA 00 00000910 MON_PCSAVE 00 0000090A    MON_R1 00 00000920    MON_R2 00 00000924
4689 4 robfinch
 MON_SSAVE 00 00000908 MON_USAVE 00 00000906 MON_XSAVE 00 00000902 MON_YSAVE 00 00000904
4690 13 robfinch
   MSCOUNT 00 FFFFFFE4 MSGBADKEYBD 02 00FFE9AE    MSGERR 02 00FFFA70 MSGF09STARTING 02 00FFF875
4691
 MSGREGHEADINGS 02 00FFFB2E MSGSERIALTEST 02 00FFECC5 MSGSTARTUP 02 00FFE0F4 MULTI_SIEVE 02 00FFE12B
4692
 MULTI_SIEVE1 02 00FFE14E MULTI_SIEVE2 02 00FFE14A MULTI_SIEVE3 02 00FFE138 MULTI_SIEVE4 02 00FFE161
4693
       NDX 00 00000005     NHEX4 02 00FFFB68  NMAILBOX 02 00000004 NMESERIAL 02 00FFEC8E
4694
   NMIBASE 00 00FF0013  NMI_ROUT 02 00FFFD15   NMSGBLK 02 00000008 NOTKBDIRQ 02 00FFEA0C
4695
  NOTRXINT 02 00FFEC8D NOTTIMERIRQ 02 00FFE471 NOTTIMERIRQ2 02 00FFFD08   NXBLANK 02 00FFFB6C
4696
    ONEKEY 02 00FFD1DC      OSC1 02 00FFED59    OSCALL 02 00FFED59 OSCALLTBL 02 00FFED27
4697
      OSCX 02 00FFED69    OSSEMA 00 00EF0010     OUTCH 02 00FFED12   OUTSEMA 00 00EF0000
4698
     PCRLF 02 00FFE3CD     PDATA 02 00FFE3DA       PIC 00 FFE3F000    PICPTR 00 00000028
4699
     PRINT 02 00FFE3D7   PROMPT1 02 00FFF8D9   PROMPT2 02 00FFF905  PROMPT2A 02 00FFF923
4700
   PROMPT3 02 00FFF8CA   PROMPTC 02 00FFF941   PROMPTD 02 00FFF94D   PROMPTF 02 00FFF959
4701
 PROMPTHELP 02 00FFF935   PROMPTJ 02 00FFF96C  PROMPTLN 02 00FFF8C6   PROMPTR 02 00FFF971
4702
   PROMPTT 02 00FFF984   PROMPTU 02 00FFF999  PROMPT_S 02 00FFF97B    PSTRNG 02 00FFE3C9
4703
     QNDX0 00 00000780     QNDX1 00 00000782     QNDX2 00 00000784     QNDX3 00 00000786
4704
     QNDX4 00 00000788    RAMERR 02 00FFD42C   RAMTEST 02 00FFD400  RAMTEST1 02 00FFD40D
4705
  RAMTEST3 02 00FFD417 RELEASEIOFOCUS 02 00FFED84 REQUESTIOFOCUS 02 00FFED6D     RIOF1 02 00FFEDAB
4706
     RIOF2 02 00FFED9A  ROMTORAM 02 00FFE11B ROMTORAM1 02 00FFE121       RTC 00 FFE30500
4707
    RTCBUF 00 00007FC0  RTCR0001 02 00FFE4D9  RTCW0001 02 00FFE524  RTC_READ 02 00FFE4B3
4708
 RTC_RXERR 02 00FFE502 RTC_WRITE 02 00FFE506  RTI_INSN 02 00FFFD21 RUNNINGID 00 00800000
4709
 RUNNINGTCB 06 00000000 SCREENCOLOR 00 00000113 SCREENLOCATION 00 00000010 SCREENLOCATION2 00 00000018
4710
  SCROLLUP 02 00FFE23D    SCRUP1 02 00FFE24A    SC_ALT 00 00000011      SC_C 00 00000021
4711
 SC_CAPSLOCK 00 00000058   SC_CTRL 00 00000014    SC_DEL 00 00000071 SC_EXTEND 00 000000E0
4712
    SC_F12 00 00000007  SC_KEYUP 00 000000F0 SC_NUMLOCK 00 00000077 SC_RSHIFT 00 00000059
4713
 SC_SCROLLLOCK 00 0000007E      SC_T 00 0000002C    SC_TAB 00 0000000D      SC_Z 00 0000001A
4714
   SEMAABS 00 00001000 SERHEADRCV 00 00000131 SERHEADXMIT 00 00000136  SERHZERO 00 00000130
4715
 SERIALGETCHAR 02 00FFEB9D SERIALINIT 02 00FFEB6F SERIALIRQ 02 00FFEC3B SERIALOUTPUTTEST 02 00FFECA5
4716
 SERIALPEEKCHAR 02 00FFEBCD SERIALPEEKCHARDIRECT 02 00FFEBE4 SERIALPUTCHAR 02 00FFEC08 SERIALPUTSTRING 02 00FFEC95
4717
 SERIALRCVCOUNT 02 00FFEC28 SERRCVBUF 00 00BFF000 SERRCVXOFF 00 00000140 SERRCVXON 00 00000139
4718
 SERTAILRCV 00 00000133 SERTAILXMIT 00 00000138  SERTZERO 00 00000132 SETKEYBOARDECHO 02 00FFED16
4719
      SGC2 02 00FFEBB6 SGCNOCHARS 02 00FFEBC6    SGCXIT 02 00FFEBC9 SHIFTEDSCANCODES 02 00FFE680
4720
 SHIFTLEFT5 02 00FFE19F SHL_NUMWKA 02 00FFF9EB SHOWSPRITES 02 00FFED1C     SIEVE 02 00FFE165
4721
    SIEVE1 02 00FFE17D    SIEVE2 02 00FFE179    SIEVE3 02 00FFE16A    SIEVE4 02 00FFE18C
4722
     SINI1 02 00FFEB82  SIRQ0001 02 00FFEC4D SIRQNXTBYTE 02 00FFEC3B SIRQRXFULL 02 00FFEC8D
4723
 SKIPDOLLAR 02 00FFF8F8 SKIP_INIT 02 00FFE0C1    SOTST1 02 00FFECAF   SPC0001 02 00FFEC0A
4724
  SPCD0001 02 00FFEC02 SPCNOCHARS 02 00FFEBDF    SPCXIT 02 00FFEBE2 SPRITE_CTRL 00 FFE10000
4725
 SPRITE_EN 00 000003C0      SPS2 02 00FFEC99    SPSXIT 02 00FFECA3    SRCXIT 02 00FFEC3A
4726
      SREL 00 00000004       ST1 02 00FFE0A0       ST3 02 00FFE07D       ST6 02 00FFE03C
4727
       ST7 02 00FFE046       ST8 02 00FFE046     START 02 00FFE023    STRPTR 00 00000024
4728
 SWI3_EXIT 02 00FFFCB7 SWI3_ROUT 02 00FFFC88       TAB 00 00000009 TCB_CURSORCOL 00 00000021
4729
 TCB_CURSORROW 00 00000020  TCB_HJCB 00 0000001C TCB_HWAITMBX 00 00000022 TCB_IOF_NEXT 00 0000002C
4730
 TCB_IOF_PREV 00 00000030 TCB_MBQ_NEXT 00 00000024 TCB_MBQ_PREV 00 00000028 TCB_MMU_MAP 00 00000038
4731
 TCB_MSGPTR_D1 00 00000014 TCB_MSGPTR_D2 00 00000018 TCB_NXTRDY 00 00000000 TCB_NXTTCB 00 00000008
4732
 TCB_PRIORITY 00 00000010 TCB_PRVRDY 00 00000004 TCB_SPSAVE 00 00000034 TCB_STATUS 00 0000001E
4733
 TCB_TIMEOUT 00 0000000C TEXTCLOSE 02 00FFE20D  TEXTOPEN 02 00FFE20C  TEXTREAD 02 00FFE20E
4734
   TEXTREG 00 FFE0DF00   TEXTSCR 00 FFE00000  TEXTSEEK 02 00FFE210 TEXTWRITE 02 00FFE20F
4735
 TEXT_COLS 00 00000000 TEXT_CURPOS 00 00000022 TEXT_ROWS 00 00000001 TIMEOUTLIST 00 0000078C
4736
 TIMERINIT 02 00FFE424  TIMERIRQ 02 00FFE44F      TR1A 02 00FFFD14      UCP1 02 00FFE2BC
4737
 UNSHIFTEDSCANCODES 02 00FFE580 UPDATECURSORPOS 02 00FFE29C       VIA 00 FFE60000   VIA_ACR 00 0000000B
4738
  VIA_DDRA 00 00000003   VIA_IER 00 0000000E   VIA_IFR 00 0000000D    VIA_PA 00 00000001
4739
 VIA_T3CMPH 00 00000015 VIA_T3CMPL 00 00000014  VIA_T3LH 00 00000013  VIA_T3LL 00 00000012
4740
  W10_0001 02 00FFE8C0 W300_0001 02 00FFE8D4  WAIT10MS 02 00FFE8B9 WAIT300MS 02 00FFE8CD
4741
    XBLANK 02 00FFD0AF      XOFF 00 00000013       XON 00 00000011
4742
523 SYMBOLS
4743 4 robfinch
 
4744 13 robfinch
 

powered by: WebSVN 2.1.0

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