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

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [software/] [sample code/] [bootrom.lst] - Blame information for rev 36

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

Line No. Rev Author Line
1 27 robfinch
                                                ; ============================================================================
2
                                                 ; (C) 2012 Robert Finch
3
                                                 ; All Rights Reserved.
4
                                                 ; robfinch@opencores.org
5
                                                 ;
6
                                                 ; This source file is free software: you can redistribute it and/or modify
7
                                                 ; it under the terms of the GNU Lesser General Public License as published
8
                                                 ; by the Free Software Foundation, either version 3 of the License, or
9
                                                 ; (at your option) any later version.
10
                                                 ;
11
                                                 ; This source file is distributed in the hope that it will be useful,
12
                                                 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
                                                 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
                                                 ; GNU General Public License for more details.
15
                                                 ;
16
                                                 ; You should have received a copy of the GNU General Public License
17
                                                 ; along with this program.  If not, see .
18
                                                 ;
19
                                                 ; ============================================================================
20
                                                 ;
21
                                                 CR     EQU     0x0D            ;ASCII equates
22
                                                 LF     EQU     0x0A
23
                                                 TAB    EQU     0x09
24
                                                 CTRLC  EQU     0x03
25
                                                 CTRLH  EQU     0x08
26
                                                 CTRLS  EQU     0x13
27
                                                 CTRLX  EQU     0x18
28
 
29
                                                 STACKTOP       EQU             0xFFFF_FFFF_FFFE_FFF8
30
                                                 Milliseconds   EQU             0x400
31
                                                 Lastloc                        EQU             0x408
32
                                                 ScreenColor    EQU             0x414
33
                                                 CursorRow      EQU             0x416
34
                                                 CursorCol      EQU             0x418
35
                                                 KeybdEcho      EQU             0x41A
36
                                                 KeybdBuffer    EQU             0x440
37
                                                 KeybdHead      EQU             0x450
38
                                                 KeybdTail      EQU             0x451
39
                                                 TEXTSCR                EQU             0xFFFF_FFFF_FFD0_0000
40
                                                 COLORSCR       EQU             0xFFFF_FFFF_FFD1_0000
41
                                                 TEXTREG                EQU             0xFFFFFFFF_FFDA0000
42
                                                 TEXT_COLS      EQU             0x0
43
                                                 TEXT_ROWS      EQU             0x2
44
                                                 TEXT_CURPOS    EQU             0x16
45
                                                 KEYBD          EQU             0xFFFF_FFFF_FFDC_0000
46
                                                 KEYBDCLR       EQU             0xFFFF_FFFF_FFDC_0002
47
                                                 UART   EQU             0xFFFF_FFFF_FFDC_0A00
48
                                                 UART_LS                EQU     0xFFFF_FFFF_FFDC_0A01
49
                                                 PIC            EQU             0xFFFF_FFFF_FFDC_0FF0
50
                                                 PSG                    EQU             0xFFFF_FFFF_FFD5_0000
51
                                                 AC97           EQU             0xFFFF_FFFF_FFDC_1000
52
                                                 BOOT_STACK     EQU             0xFFFF_FFFF_FFFE_FFF8
53
                                                 BITMAPSCR      EQU             0x00000001_00200000
54
 
55
                                                 txempty        EQU             0x40
56
                                                 rxfull EQU             0x01
57
 
58
                                                 ;      org 0x070
59
                                                 ;      iret
60
                                                 ;      nop
61
                                                 ;      nop
62
                                                 ;      nop
63
                                                 ;      nop
64
                                                 ;      nop
65
                                                 ;      nop
66
                                                 ;      nop
67
                                                 ;
68
0000000000000000.0                                      code
69
FFFFFFFFFFFFE800.0                                      org 0xFFFF_FFFF_FFFF_E800
70
 
71
                                                 ; jump table
72
                                                 ;
73
FFFFFFFFFFFFE800.0      0CFFFFFFA54                     jmp             SerialGetChar
74
FFFFFFFFFFFFE800.1      0CFFFFFFA60                     jmp             SerialPutChar
75
FFFFFFFFFFFFE800.2      0CFFFFFFA90                     jmp             SetKeyboardEcho
76
FFFFFFFFFFFFE810.0      0CFFFFFFAA6                     jmp             KeybdCheckForKey
77
FFFFFFFFFFFFE810.1      0CFFFFFFA92                     jmp             KeybdGetChar
78
FFFFFFFFFFFFE810.2      0CFFFFFFB65                     jmp             DisplayChar
79
FFFFFFFFFFFFE820.0      0CFFFFFFBF5                     jmp             DisplayString
80
 
81
FFFFFFFFFFFFE820.1                               start:
82
                                                 ;      lea             MSGRAM,a1
83
                                                 ;      jsr             DisplayString
84
 
85
FFFFFFFFFFFFE820.1                               ColdStart:
86
FFFFFFFFFFFFE820.1      0000000000A                     icache_on                               ; turn on the ICache
87
FFFFFFFFFFFFE820.2      0000000000C                     dcache_on                               ; turn on the DCache
88
FFFFFFFFFFFFE830.0      0BEFFFEFFF8                     setlo   sp,#STACKTOP    ; top of stack
89
FFFFFFFFFFFFE830.1      0C7FFFFFA6E                     call    KeybdInit
90
FFFFFFFFFFFFE830.2      0C7FFFFFA50                     call    PICInit
91
FFFFFFFFFFFFE840.0      00000000040                     cli                                             ; enable interrupts
92
FFFFFFFFFFFFE840.1      0A3000000CE                     setlo   r3,#0xCE                ; blue on blue
93
FFFFFFFFFFFFE840.2      18806000414                     sc              r3,ScreenColor
94
FFFFFFFFFFFFE850.0      10806000414                     lc              r3,0x414
95
FFFFFFFFFFFFE850.1      0A300000020                     setlo   r3,#32
96
FFFFFFFFFFFFE850.2      18806000416                     sc              r3,0x416                ; we do a store, then a load through the dcache
97
FFFFFFFFFFFFE860.0      10804000416                     lc              r2,0x416                ;
98
FFFFFFFFFFFFE860.1      10804000416                     lc              r2,0x416                ;
99
FFFFFFFFFFFFE860.2      2F8860000A8                     beq             r2,r3,dcokay
100
FFFFFFFFFFFFE870.0      0000000000D                     dcache_off                              ; data cache failed
101
FFFFFFFFFFFFE870.1                               dcokay:
102
FFFFFFFFFFFFE870.1      10806000414                     lc              r3,ScreenColor
103
FFFFFFFFFFFFE870.2      0C7FFFFFB06                     call    ClearScreen
104
FFFFFFFFFFFFE880.0      0C7FFFFFAF4                     call    ClearBmpScreen
105
FFFFFFFFFFFFE880.1      18800000416                     sc              r0,CursorRow
106
FFFFFFFFFFFFE880.2      18800000418                     sc              r0,CursorCol
107
FFFFFFFFFFFFE890.0      0A1FFFFE920                     setlo   r1,#
108
FFFFFFFFFFFFE890.1      0E1FFFFFFFF                     sethi   r1,#>MSGSTART
109
FFFFFFFFFFFFE890.2      0C7FFFFFBF5                     call    DisplayString
110
                                                 ;      call    SetupAC97               ; and Beep
111
 
112
                                                 ; Allow some other contexts to start up
113
                                                 ; equal processing time for sixteen contexts
114
                                                 ;
115
FFFFFFFFFFFFE8A0.0      00802000AA8                     mfspr   r1,AXC                  ; which context am I
116
FFFFFFFFFFFFE8A0.1      2F840000149                     bne             r1,r0,j4
117
FFFFFFFFFFFFE8A0.2      0A176543210                     setlo   r1,#0x76543210
118
FFFFFFFFFFFFE8B0.0      008400008A9                     mtspr   EP0,r1
119
FFFFFFFFFFFFE8B0.1      008400009A9                     mtspr   EP2,r1
120
FFFFFFFFFFFFE8B0.2      0A1FEDCBA98                     setlo   r1,#0xFEDCBA98
121
FFFFFFFFFFFFE8C0.0      00840000929                     mtspr   EP1,r1
122
FFFFFFFFFFFFE8C0.1      00840000A29                     mtspr   EP3,r1
123
FFFFFFFFFFFFE8C0.2                               j4:
124
FFFFFFFFFFFFE8C0.2      0CFFFFFFCA6                     jmp             Monitor
125
FFFFFFFFFFFFE8D0.0      2F801FFFFCA                     bra             j4
126
 
127
                                                 ;      call    ramtest
128
 
129
                                                 ;-----------------------------------------
130
                                                 ; Hello World!
131
                                                 ;-----------------------------------------
132
FFFFFFFFFFFFE8D0.1                               HelloWorld:
133
FFFFFFFFFFFFE8D0.1      03FBC000018                     subui   r30,r30,#24
134
FFFFFFFFFFFFE8D0.2      27F40000003                     sm              [r30],r1/r2/r31
135
FFFFFFFFFFFFE8E0.0      0A2FFFFE910                     setlo   r2,#MSG
136
FFFFFFFFFFFFE8E0.1                               j3:
137
FFFFFFFFFFFFE8E0.1      10082000000                     lb              r1,[r2]
138
FFFFFFFFFFFFE8E0.2      2F840000108                     beq             r1,r0,j2
139
FFFFFFFFFFFFE8F0.0      0C7FFFFFA60                     call    SerialPutChar
140
FFFFFFFFFFFFE8F0.1      02884000001                     addui   r2,r2,#1
141
FFFFFFFFFFFFE8F0.2      2F801FFFFAA                     bra             j3
142
FFFFFFFFFFFFE900.0                               j2:
143
FFFFFFFFFFFFE900.0      27740000003                     lm              [r30],r1/r2/r31
144
FFFFFFFFFFFFE900.1      0DFBE000018                     ret             #24
145
 
146
 
147
FFFFFFFFFFFFE900.2      37800000000                     align   16
148
FFFFFFFFFFFFE910.0                                      align   16
149
FFFFFFFFFFFFE910.0                               MSG:
150
FFFFFFFFFFFFE910 6F57206F6C6C6548               DB      "Hello World!",0,0,0,0
151
FFFFFFFFFFFFE918 0000000021646C72
152
FFFFFFFFFFFFE920.0                                      align   16
153
FFFFFFFFFFFFE920.0                               MSGSTART:
154
FFFFFFFFFFFFE920 3436726F74706152               db      "Raptor64 system starting....",CR,LF,0,0
155
FFFFFFFFFFFFE928 206D657473797320
156
FFFFFFFFFFFFE930 676E697472617473
157
FFFFFFFFFFFFE938 00000A0D2E2E2E2E
158
 
159
FFFFFFFFFFFFE940.0                                      align 16
160
 
161
                                                 ;----------------------------------------------------------
162
                                                 ; Initialize programmable interrupt controller (PIC)
163
                                                 ;  0 = nmi
164
                                                 ;  1 = keyboard reset
165
                                                 ;  2 = 1000Hz pulse (cursor flash)
166
                                                 ; 15 = keyboard char
167
                                                 ;----------------------------------------------------------
168
FFFFFFFFFFFFE940.0                               PICInit:
169
FFFFFFFFFFFFE940.0      0A1FFFF8007                     setlo   r1,#0x8007      ; enable nmi,kbd_rst,and kbd_irq
170
FFFFFFFFFFFFE940.1      24803DC0FF2                     outc    r1,PIC+2
171
FFFFFFFFFFFFE940.2      0DFBE000000                     ret
172
 
173
                                                 ;-----------------------------------------
174
                                                 ; Get character from serial port
175
                                                 ;-----------------------------------------
176
FFFFFFFFFFFFE950.0                               SerialGetChar:
177
FFFFFFFFFFFFE950.0      03FBC000008                     subui   r30,r30,#8
178
FFFFFFFFFFFFE950.1      19F86000000                     sw              r3,[r30]
179
FFFFFFFFFFFFE950.2      0A1FFDC0A00                     setlo   r1,#UART
180
FFFFFFFFFFFFE960.0                               sgc1:
181
FFFFFFFFFFFFE960.0      20046000001                     inb             r3,1[r1]                ; uart status
182
FFFFFFFFFFFFE960.1      050C6000001                     andi    r3,r3,#rxfull   ; is there a char available ?
183
FFFFFFFFFFFFE960.2      2F8C0000008                     beq             r3,r0,sgc1
184
FFFFFFFFFFFFE970.0      11F86000000                     lw              r3,[r30]
185
FFFFFFFFFFFFE970.1      20042000000                     inb             r1,[r1]
186
FFFFFFFFFFFFE970.2      0DFBE000008                     ret             #8
187
 
188
                                                 ;-----------------------------------------
189
                                                 ; Put character to serial port
190
                                                 ;-----------------------------------------
191
FFFFFFFFFFFFE980.0                               SerialPutChar:
192
FFFFFFFFFFFFE980.0      03FBC000010                     subui   r30,r30,#16
193
FFFFFFFFFFFFE980.1      19F84000008                     sw              r2,8[r30]
194
FFFFFFFFFFFFE980.2      19F86000000                     sw              r3,[r30]
195
FFFFFFFFFFFFE990.0      0A3FFDC0A00                     setlo   r3,#UART
196
FFFFFFFFFFFFE990.1                               spc1:
197
FFFFFFFFFFFFE990.1      200C4000001                     inb             r2,1[r3]                ; uart status
198
FFFFFFFFFFFFE990.2      05084000040                     andi    r2,r2,#txempty  ; is there a char available ?
199
FFFFFFFFFFFFE9A0.0      2F881FFFFA8                     beq             r2,r0,spc1
200
FFFFFFFFFFFFE9A0.1      240C2000000                     outb    r1,[r3]
201
FFFFFFFFFFFFE9A0.2      11F86000000                     lw              r3,[r30]
202
FFFFFFFFFFFFE9B0.0      11F84000008                     lw              r2,8[r30]
203
FFFFFFFFFFFFE9B0.1      0DFBE000010                     ret             #16
204
 
205
                                                 ;==============================================================================
206
                                                 ; Keyboard
207
                                                 ;==============================================================================
208
                                                 ;------------------------------------------------------------------------------
209
                                                 ; Initialize keyboard
210
                                                 ;------------------------------------------------------------------------------
211
FFFFFFFFFFFFE9B0.2                               KeybdInit:
212
FFFFFFFFFFFFE9B0.2      18000000450                     sb              r0,KeybdHead
213
FFFFFFFFFFFFE9C0.0      18000000451                     sb              r0,KeybdTail
214
FFFFFFFFFFFFE9C0.1      0A100000001                     setlo   r1,#1                   ; turn on keyboard echo
215
FFFFFFFFFFFFE9C0.2      1800200041A                     sb              r1,KeybdEcho
216
FFFFFFFFFFFFE9D0.0      0DFBE000000                     ret
217
 
218
                                                 ;------------------------------------------------------------------------------
219
                                                 ; Normal keyboard interrupt, the lowest priority interrupt in the system.
220
                                                 ; Grab the character from the keyboard device and store it in a buffer.
221
                                                 ;------------------------------------------------------------------------------
222
                                                 ;
223
FFFFFFFFFFFFE9D0.1                               KeybdIRQ:
224
FFFFFFFFFFFFE9D0.1      03FBC000018                     subui   sp,sp,#24
225
FFFFFFFFFFFFE9D0.2      27F00000007                     sm              [sp],r1/r2/r3
226
FFFFFFFFFFFFE9E0.0      12802000450                     lbu             r1,KeybdHead
227
FFFFFFFFFFFFE9E0.1      0504200000F                     andi    r1,r1,#0x0f                             ; r1 = index into buffer
228
FFFFFFFFFFFFE9E0.2      0A300000440                     setlo   r3,#
229
FFFFFFFFFFFFE9F0.0      0E300000000                     sethi   r3,#>KeybdBuffer
230
FFFFFFFFFFFFE9F0.1                               KeybdIRQa:
231
FFFFFFFFFFFFE9F0.1      20805DC0000                     inch    r2,KEYBD                                ; get keyboard character
232
FFFFFFFFFFFFE9F0.2      24801DC0002                     outc    r0,KEYBD+2                              ; clear keyboard strobe (turns off the IRQ)
233
FFFFFFFFFFFFEA00.0      1A8C2200010                     sb              r2,[r3+r1]                              ; store character in buffer
234
FFFFFFFFFFFFEA00.1      02842000001                     addui   r1,r1,#1                                ; increment head index
235
FFFFFFFFFFFFEA00.2      0504200000F                     andi    r1,r1,#0x0f
236
FFFFFFFFFFFFEA10.0      18002000450                     sb              r1,KeybdHead
237
FFFFFFFFFFFFEA10.1                               KeybdIRQb:
238
FFFFFFFFFFFFEA10.1      12804000451                     lbu             r2,KeybdTail                    ; check to see if we've collided
239
FFFFFFFFFFFFEA10.2      2F844000109                     bne             r1,r2,KeybdIRQc                 ; with the tail
240
FFFFFFFFFFFFEA20.0      02884000001                     addui   r2,r2,#1                                ; if so, increment the tail index
241
FFFFFFFFFFFFEA20.1      0508400000F                     andi    r2,r2,#0x0f                             ; the oldest character will be lost
242
FFFFFFFFFFFFEA20.2      18004000451                     sb              r2,KeybdTail
243
FFFFFFFFFFFFEA30.0                               KeybdIRQc:
244
FFFFFFFFFFFFEA30.0      27700000007                     lm              [sp],r1/r2/r3
245
FFFFFFFFFFFFEA30.1      02FBC000018                     addui   sp,sp,#24
246
FFFFFFFFFFFFEA30.2      0DFBE000000                     ret
247
 
248
                                                 ;------------------------------------------------------------------------------
249
                                                 ; r1 0=echo off, non-zero = echo on
250
                                                 ;------------------------------------------------------------------------------
251
FFFFFFFFFFFFEA40.0                               SetKeyboardEcho:
252
FFFFFFFFFFFFEA40.0      1800200041A                     sb              r1,KeybdEcho
253
FFFFFFFFFFFFEA40.1      0DFBE000000                     ret
254
 
255
                                                 ;-----------------------------------------
256
                                                 ; Get character from keyboard buffer
257
                                                 ;-----------------------------------------
258
FFFFFFFFFFFFEA40.2                               KeybdGetChar:
259
FFFFFFFFFFFFEA40.2      03FBC000010                     subui   sp,sp,#16
260
FFFFFFFFFFFFEA50.0      27F00000006                     sm              [sp],r2/r3
261
FFFFFFFFFFFFEA50.1      12804000451                     lbu             r2,KeybdTail
262
FFFFFFFFFFFFEA50.2      12802000450                     lbu             r1,KeybdHead
263
FFFFFFFFFFFFEA60.0      2F844000148                     beq             r1,r2,nochar
264
FFFFFFFFFFFFEA60.1      0A300000440                     setlo   r3,#KeybdBuffer
265
FFFFFFFFFFFFEA60.2      1A8C4100005                     lbu             r1,[r3+r2]
266
FFFFFFFFFFFFEA70.0      02884000001                     addui   r2,r2,#1
267
FFFFFFFFFFFFEA70.1      0508400000F                     andi    r2,r2,#0x0f
268
FFFFFFFFFFFFEA70.2      18004000451                     sb              r2,KeybdTail
269
FFFFFFFFFFFFEA80.0      27700000006                     lm              [sp],r2/r3
270
FFFFFFFFFFFFEA80.1      0DFBE000010                     ret             #16
271
FFFFFFFFFFFFEA80.2                               nochar:
272
FFFFFFFFFFFFEA80.2      0A1FFFFFFFF                     setlo   r1,#-1
273
FFFFFFFFFFFFEA90.0      27700000006                     lm              [sp],r2/r3
274
FFFFFFFFFFFFEA90.1      0DFBE000010                     ret             #16
275
 
276
                                                 ;------------------------------------------------------------------------------
277
                                                 ; Check if there is a keyboard character available in the keyboard buffer.
278
                                                 ;------------------------------------------------------------------------------
279
                                                 ;
280
FFFFFFFFFFFFEA90.2                               KeybdCheckForKey:
281
FFFFFFFFFFFFEA90.2      12802000451                     lbu             r1,KeybdTail
282
FFFFFFFFFFFFEAA0.0      12804000450                     lbu             r2,KeybdHead
283
FFFFFFFFFFFFEAA0.1      2F8440000A8                     beq             r1,r2,kck1
284
FFFFFFFFFFFFEAA0.2      0A100000001                     setlo   r1,#1
285
FFFFFFFFFFFFEAB0.0      0DFBE000000                     ret
286
FFFFFFFFFFFFEAB0.1                               kck1:
287
FFFFFFFFFFFFEAB0.1      0104210000A                     xor             r1,r1,r1                ; return zero
288
FFFFFFFFFFFFEAB0.2      0DFBE000000                     ret
289
 
290
                                                 ;------------------------------------------------------------------------------
291
                                                 ; Check if there is a keyboard character available. If so return true (1)
292
                                                 ; otherwise return false (0) in r1.
293
                                                 ;------------------------------------------------------------------------------
294
                                                 ;
295
FFFFFFFFFFFFEAC0.0                               KeybdCheckForKeyDirect:
296
FFFFFFFFFFFFEAC0.0      20803DC0000                     inch    r1,KEYBD
297
FFFFFFFFFFFFEAC0.1      2F8400000A1                     bge             r1,r0,cfkd1
298
FFFFFFFFFFFFEAC0.2      0A100000001                     setlo   r1,#1
299
FFFFFFFFFFFFEAD0.0      0DFBE000000                     ret
300
FFFFFFFFFFFFEAD0.1                               cfkd1:
301
FFFFFFFFFFFFEAD0.1      0104210000A                     xor             r1,r1,r1        ; return 0 in r1
302
FFFFFFFFFFFFEAD0.2      0DFBE000000                     ret
303
 
304
                                                 ;------------------------------------------------------------------------------
305
                                                 ; Get character directly from keyboard. This routine blocks until a key is
306
                                                 ; available.
307
                                                 ;------------------------------------------------------------------------------
308
                                                 ;
309
FFFFFFFFFFFFEAE0.0                               KeybdGetCharDirect:
310
FFFFFFFFFFFFEAE0.0      03FBC000010                     subui   sp,sp,#16
311
FFFFFFFFFFFFEAE0.1      27F40000002                     sm              [sp],r2/r31
312
FFFFFFFFFFFFEAE0.2      0A2FFDC0000                     setlo   r2,KEYBD
313
FFFFFFFFFFFFEAF0.0                               kgc1:
314
FFFFFFFFFFFFEAF0.0      20803DC0000                     inch    r1,KEYBD
315
FFFFFFFFFFFFEAF0.1      2F840000001                     bge             r1,r0,kgc1
316
FFFFFFFFFFFFEAF0.2      24801DC0002                     outc    r0,KEYBD+2              ; clear keyboard strobe
317
FFFFFFFFFFFFEB00.0      050420000FF                     andi    r1,r1,#0xff             ; remove strobe bit
318
FFFFFFFFFFFFEB00.1      1000400041A                     lb              r2,KeybdEcho    ; is keyboard echo on ?
319
FFFFFFFFFFFFEB00.2      2F880000128                     beq             r2,r0,gk1
320
FFFFFFFFFFFFEB10.0      2C84010000D                     bnei    r1,#'\r',gk2    ; convert CR keystroke into CRLF
321
FFFFFFFFFFFFEB10.1      0C7FFFFFC09                     call    CRLF
322
FFFFFFFFFFFFEB10.2      2F8000000AA                     bra             gk1
323
FFFFFFFFFFFFEB20.0                               gk2:
324
FFFFFFFFFFFFEB20.0      0C7FFFFFB65                     call    DisplayChar
325
FFFFFFFFFFFFEB20.1                               gk1:
326
FFFFFFFFFFFFEB20.1      27740000002                     lm              [sp],r2/r31
327
FFFFFFFFFFFFEB20.2      0DFBE000010                     ret             #16
328
 
329
                                                 ;==============================================================================
330
                                                 ;==============================================================================
331
                                                 ;------------------------------------------------------------------------------
332
                                                 ; 1000 Hz interrupt
333
                                                 ; - takes care of "flashing" the cursor
334
                                                 ;------------------------------------------------------------------------------
335
                                                 ;
336
FFFFFFFFFFFFEB30.0                               Pulse1000:
337
FFFFFFFFFFFFEB30.0      03FBC000018                     subui   sp,sp,#24
338
FFFFFFFFFFFFEB30.1      27F40000003                     sm              [sp],r1/r2/lr
339
FFFFFFFFFFFFEB30.2      11802000400                     lw              r1,Milliseconds
340
FFFFFFFFFFFFEB40.0      02842000001                     addui   r1,r1,#1
341
FFFFFFFFFFFFEB40.1      19802000400                     sw              r1,Milliseconds
342
FFFFFFFFFFFFEB40.2      0A2FFD00000                     setlo   r2,TEXTSCR
343
FFFFFFFFFFFFEB50.0      108820000DE                     lc              r1,222[r2]
344
FFFFFFFFFFFFEB50.1      02842000001                     addui   r1,r1,#1
345
FFFFFFFFFFFFEB50.2      188820000DE                     sc              r1,222[r2]
346
FFFFFFFFFFFFEB60.0      10801FF0000                     lc              r0,0xFFFF_FFFF_FFFF_0000        ; clear interrupt
347
FFFFFFFFFFFFEB60.1      11802000400                     lw              r1,Milliseconds
348
FFFFFFFFFFFFEB60.2      0504200007F                     andi    r1,r1,#0x7f
349
FFFFFFFFFFFFEB70.0      2C840080040                     bnei    r1,#64,p10001
350
FFFFFFFFFFFFEB70.1      0C7FFFFFAE1                     call    FlashCursor
351
FFFFFFFFFFFFEB70.2                               p10001:
352
FFFFFFFFFFFFEB70.2      27740000003                     lm              [sp],r1/r2/lr
353
FFFFFFFFFFFFEB80.0      0DFBE000018                     ret             #24
354
 
355
                                                 ;------------------------------------------------------------------------------
356
                                                 ; Flash Cursor
357
                                                 ;------------------------------------------------------------------------------
358
                                                 ;
359
FFFFFFFFFFFFEB80.1                               FlashCursor:
360
FFFFFFFFFFFFEB80.1      03FBC000020                     subui   sp,sp,#32
361
FFFFFFFFFFFFEB80.2      27F40000007                     sm              [sp],r1/r2/r3/r31
362
FFFFFFFFFFFFEB90.0      0C7FFFFFB55                     call    CalcScreenLoc
363
FFFFFFFFFFFFEB90.1      02842010000                     addui   r1,r1,#0x10000
364
                                                        ; causes screen colors to flip around
365
FFFFFFFFFFFFEB90.2      10844000000                     lc              r2,[r1]
366
FFFFFFFFFFFFEBA0.0      02884000001                     addui   r2,r2,#1
367
FFFFFFFFFFFFEBA0.1      18844000000                     sc              r2,[r1]
368
FFFFFFFFFFFFEBA0.2      11804000408                     lw              r2,Lastloc
369
FFFFFFFFFFFFEBB0.0      2F8440000A8                     beq             r1,r2,flshcrsr1
370
                                                        ; restore the screen colors of the previous cursor location
371
FFFFFFFFFFFFEBB0.1      10806000414                     lc              r3,ScreenColor
372
FFFFFFFFFFFFEBB0.2      18886000000                     sc              r3,[r2]
373
FFFFFFFFFFFFEBC0.0      19802000408                     sw              r1,Lastloc
374
FFFFFFFFFFFFEBC0.1                               flshcrsr1:
375
FFFFFFFFFFFFEBC0.1      27740000007                     lm              [sp],r1/r2/r3/r31
376
FFFFFFFFFFFFEBC0.2      0DFBE000020                     ret             #32
377
 
378
                                                 ;------------------------------------------------------------------------------
379
                                                 ;------------------------------------------------------------------------------
380
FFFFFFFFFFFFEBD0.0                               ClearBmpScreen:
381
FFFFFFFFFFFFEBD0.0      03FBC000028                     subui   sp,sp,#40
382
FFFFFFFFFFFFEBD0.1      27F4000000F                     sm              [sp],r1/r2/r3/r4/r31
383
FFFFFFFFFFFFEBD0.2      0A100000554                     setlo   r1,#1364                        ; calc number to clear
384
FFFFFFFFFFFFEBE0.0      0A200000300                     setlo   r2,#768
385
FFFFFFFFFFFFEBE0.1      01044200018                     mulu    r2,r1,r2                        ; r2 = # pixels to clear
386
FFFFFFFFFFFFEBE0.2      01004400009                     or              r4,r0,r2                        ; r4 = # pixels to clear
387
FFFFFFFFFFFFEBF0.0      0A129292929                     setlo   r1,#0x29292929          ;
388
FFFFFFFFFFFFEBF0.1      0A300200000                     setlo   r3,#
389
FFFFFFFFFFFFEBF0.2      0E300000001                     sethi   r3,#>BITMAPSCR
390
FFFFFFFFFFFFEC00.0                               csj4:
391
FFFFFFFFFFFFEC00.0      190C2000000                     sh              r1,[r3]
392
FFFFFFFFFFFFEC00.1      028C6000004                     addui   r3,r3,#4
393
FFFFFFFFFFFFEC00.2      2F80400000F                     loop    r2,csj4
394
FFFFFFFFFFFFEC10.0      2774000000F                     lm              [sp],r1/r2/r3/r4/r31
395
FFFFFFFFFFFFEC10.1      0DFBE000028                     ret             #40
396
 
397
                                                 ;------------------------------------------------------------------------------
398
                                                 ; Clear the screen and the screen color memory
399
                                                 ; We clear the screen to give a visual indication that the system
400
                                                 ; is working at all.
401
                                                 ;------------------------------------------------------------------------------
402
                                                 ;
403
FFFFFFFFFFFFEC10.2                               ClearScreen:
404
FFFFFFFFFFFFEC10.2      03FBC000028                     subui   sp,sp,#40
405
FFFFFFFFFFFFEC20.0      27F4000000F                     sm              [sp],r1/r2/r3/r4/r31
406
FFFFFFFFFFFFEC20.1      0A3FFDA0000                     setlo   r3,#TEXTREG
407
FFFFFFFFFFFFEC20.2      108C2000000                     lc              r1,TEXT_COLS[r3]        ; calc number to clear
408
FFFFFFFFFFFFEC30.0      108C4000002                     lc              r2,TEXT_ROWS[r3]
409
FFFFFFFFFFFFEC30.1      01044200018                     mulu    r2,r1,r2                        ; r2 = # chars to clear
410
FFFFFFFFFFFFEC30.2      0A100000020                     setlo   r1,#32                  ; space char
411
FFFFFFFFFFFFEC40.0      10808000414                     lc              r4,ScreenColor
412
FFFFFFFFFFFFEC40.1      0C7FFFFFB45                     call    AsciiToScreen
413
FFFFFFFFFFFFEC40.2      0A3FFD00000                     setlo   r3,#TEXTSCR             ; text screen address
414
FFFFFFFFFFFFEC50.0                               csj4:
415
FFFFFFFFFFFFEC50.0      188C2000000                     sc              r1,[r3]
416
FFFFFFFFFFFFEC50.1      188C8010000                     sc              r4,0x10000[r3]  ; color screen is 0x10000 higher
417
FFFFFFFFFFFFEC50.2      028C6000002                     addu    r3,r3,#2
418
FFFFFFFFFFFFEC60.0      2F805FFFF8F                     loop    r2,csj4
419
FFFFFFFFFFFFEC60.1      2774000000F                     lm              [sp],r1/r2/r3/r4/r31
420
FFFFFFFFFFFFEC60.2      0DFBE000028                     ret             #40
421
 
422
                                                 ;------------------------------------------------------------------------------
423
                                                 ; Scroll text on the screen upwards
424
                                                 ;------------------------------------------------------------------------------
425
                                                 ;
426
FFFFFFFFFFFFEC70.0                               ScrollUp:
427
FFFFFFFFFFFFEC70.0      03FBC000028                     subui   sp,sp,#40
428
FFFFFFFFFFFFEC70.1      27F4000000F                     sm              [sp],r1/r2/r3/r4/r31
429
FFFFFFFFFFFFEC70.2      0A3FFDA0000                     setlo   r3,#TEXTREG
430
FFFFFFFFFFFFEC80.0      108C2000000                     lc              r1,TEXT_COLS[r3]        ; r1 = # text columns
431
FFFFFFFFFFFFEC80.1      108C4000002                     lc              r2,TEXT_ROWS[r3]
432
FFFFFFFFFFFFEC80.2      01044200018                     mulu    r2,r1,r2                        ; calc number of chars to scroll
433
FFFFFFFFFFFFEC90.0      01082200005                     subu    r2,r2,r1                        ; one less row
434
FFFFFFFFFFFFEC90.1      0A3FFD00000                     setlo   r3,#TEXTSCR
435
FFFFFFFFFFFFEC90.2                               scrup1:
436
FFFFFFFFFFFFEC90.2      1A8C2400001                     lc              r4,[r3+r1]                      ; indexed addressing example
437
FFFFFFFFFFFFECA0.0      188C8000000                     sc              r4,[r3]
438
FFFFFFFFFFFFECA0.1      028C6000002                     addui   r3,r3,#2
439
FFFFFFFFFFFFECA0.2      2F805FFFFCF                     loop    r2,scrup1
440
 
441
FFFFFFFFFFFFECB0.0      0A3FFDA0000                     setlo   r3,#TEXTREG
442
FFFFFFFFFFFFECB0.1      108C2000002                     lc              r1,TEXT_ROWS[r3]
443
FFFFFFFFFFFFECB0.2      03842000001                     subui   r1,r1,#1
444
FFFFFFFFFFFFECC0.0      0C7FFFFFB34                     call    BlankLine
445
FFFFFFFFFFFFECC0.1      2774000000F                     lm              [sp],r1/r2/r3/r4/r31
446
FFFFFFFFFFFFECC0.2      0DFBE000028                     ret             #40
447
 
448
                                                 ;------------------------------------------------------------------------------
449
                                                 ; Blank out a line on the display
450
                                                 ; line number to blank is in r1
451
                                                 ;------------------------------------------------------------------------------
452
                                                 ;
453
FFFFFFFFFFFFECD0.0                               BlankLine:
454
FFFFFFFFFFFFECD0.0      03FBC000018                     subui   sp,sp,#24
455
FFFFFFFFFFFFECD0.1      27F00000007                     sm              [sp],r1/r2/r3
456
FFFFFFFFFFFFECD0.2      0A3FFDA0000                     setlo   r3,TEXTREG                      ; r3 = text register address
457
FFFFFFFFFFFFECE0.0      108C4000000                     lc              r2,TEXT_COLS[r3]        ; r2 = # chars to blank out
458
FFFFFFFFFFFFECE0.1      01082300018                     mulu    r3,r2,r1
459
FFFFFFFFFFFFECE0.2      018C6080000                     shli    r3,r3,#1
460
FFFFFFFFFFFFECF0.0      028C7D00000                     addui   r3,r3,#TEXTSCR          ; r3 = screen address
461
FFFFFFFFFFFFECF0.1      0A100000020                     setlo   r1,#' '
462
FFFFFFFFFFFFECF0.2                               blnkln1:
463
FFFFFFFFFFFFECF0.2      188C2000000                     sc              r1,[r3]
464
FFFFFFFFFFFFED00.0      028C6000002                     addui   r3,r3,#2
465
FFFFFFFFFFFFED00.1      2F805FFFFCF                     loop    r2,blnkln1
466
FFFFFFFFFFFFED00.2      27700000007                     lm              [sp],r1/r2/r3
467
FFFFFFFFFFFFED10.0      0DFBE000018                     ret             #24
468
 
469
                                                 ;------------------------------------------------------------------------------
470
                                                 ; Convert ASCII character to screen display character.
471
                                                 ;------------------------------------------------------------------------------
472
                                                 ;
473
FFFFFFFFFFFFED10.1                               AsciiToScreen:
474
FFFFFFFFFFFFED10.1      050420000FF                     andi    r1,r1,#0x00ff
475
FFFFFFFFFFFFED10.2      2A040240041                     bltui   r1,#'A',atoscr1
476
FFFFFFFFFFFFED20.0      2B04014005A                     bleui   r1,#'Z',atoscr1
477
FFFFFFFFFFFFED20.1      2B84014007A                     bgtui   r1,#'z',atoscr1
478
FFFFFFFFFFFFED20.2      2A040140061                     bltui   r1,#'a',atoscr1
479
FFFFFFFFFFFFED30.0      03042000060                     subi    r1,r1,#0x60
480
FFFFFFFFFFFFED30.1                               atoscr1:
481
FFFFFFFFFFFFED30.1      05842000100                     ori             r1,r1,#0x100
482
FFFFFFFFFFFFED30.2      0DFBE000000                     ret
483
 
484
                                                 ;------------------------------------------------------------------------------
485
                                                 ; Convert screen character to ascii character
486
                                                 ;------------------------------------------------------------------------------
487
                                                 ;
488
FFFFFFFFFFFFED40.0                               ScreenToAscii:
489
FFFFFFFFFFFFED40.0      050420000FF                     andi    r1,r1,#0xff
490
FFFFFFFFFFFFED40.1      2B84010001A                     bgtui   r1,#26,stasc1
491
FFFFFFFFFFFFED40.2      0284200003C                     addui   r1,r1,#60
492
FFFFFFFFFFFFED50.0                               stasc1:
493
FFFFFFFFFFFFED50.0      0DFBE000000                     ret
494
 
495
                                                 ;------------------------------------------------------------------------------
496
                                                 ; Calculate screen memory location from CursorRow,CursorCol.
497
                                                 ; Also refreshes the cursor location.
498
                                                 ; Destroys r1,r2,r3
499
                                                 ; r1 = screen location
500
                                                 ;------------------------------------------------------------------------------
501
                                                 ;
502
FFFFFFFFFFFFED50.1                               CalcScreenLoc:
503
FFFFFFFFFFFFED50.1      10802000416                     lc              r1,CursorRow
504
FFFFFFFFFFFFED50.2      0504200007F                     andi    r1,r1,#0x7f
505
FFFFFFFFFFFFED60.0      0A3FFDA0000                     setlo   r3,TEXTREG
506
FFFFFFFFFFFFED60.1      208C4000000                     inch    r2,TEXT_COLS[r3]
507
FFFFFFFFFFFFED60.2      01082200018                     mulu    r2,r2,r1
508
FFFFFFFFFFFFED70.0      10802000418                     lc              r1,CursorCol
509
FFFFFFFFFFFFED70.1      0504200007F                     andi    r1,r1,#0x7f
510
FFFFFFFFFFFFED70.2      01082200003                     addu    r2,r2,r1
511
FFFFFFFFFFFFED80.0      248C4000016                     outc    r2,TEXT_CURPOS[r3]
512
FFFFFFFFFFFFED80.1      01884080000                     shli    r2,r2,#1
513
FFFFFFFFFFFFED80.2      02883D00000                     addui   r1,r2,#TEXTSCR                  ; r1 = screen location
514
FFFFFFFFFFFFED90.0      0DFBE000000                     ret
515
 
516
                                                 ;------------------------------------------------------------------------------
517
                                                 ; Display a character on the screen
518
                                                 ; d1.b = char to display
519
                                                 ;------------------------------------------------------------------------------
520
                                                 ;
521
FFFFFFFFFFFFED90.1                               DisplayChar:
522
FFFFFFFFFFFFED90.1      2C84020000D                     bnei    r1,#'\r',dccr           ; carriage return ?
523
FFFFFFFFFFFFED90.2      03FBC000020                     subui   sp,sp,#32
524
FFFFFFFFFFFFEDA0.0      27F40000007                     sm              [sp],r1/r2/r3/lr
525
FFFFFFFFFFFFEDA0.1      18800000418                     sc              r0,CursorCol            ; just set cursor column to zero on a CR
526
FFFFFFFFFFFFEDA0.2      2F8000001AA                     bra             dcx7
527
FFFFFFFFFFFFEDB0.0                               dccr:
528
FFFFFFFFFFFFEDB0.0      2C840340091                     bnei    r1,#0x91,dcx6           ; cursor right ?
529
FFFFFFFFFFFFEDB0.1      03FBC000020                     subui   sp,sp,#32
530
FFFFFFFFFFFFEDB0.2      27F40000007                     sm              [sp],r1/r2/r3/lr
531
FFFFFFFFFFFFEDC0.0      10804000418                     lc              r2,CursorCol
532
FFFFFFFFFFFFEDC0.1      2C080140038                     beqi    r2,#56,dcx7
533
FFFFFFFFFFFFEDC0.2      02884000001                     addui   r2,r2,#1
534
FFFFFFFFFFFFEDD0.0      18804000418                     sc              r2,CursorCol
535
FFFFFFFFFFFFEDD0.1                               dcx7:
536
FFFFFFFFFFFFEDD0.1      0C7FFFFFB55                     call    CalcScreenLoc
537
FFFFFFFFFFFFEDD0.2      27740000007                     lm              [sp],r1/r2/r3/lr
538
FFFFFFFFFFFFEDE0.0      0DFBE000020                     ret             #32
539
FFFFFFFFFFFFEDE0.1                               dcx6:
540
FFFFFFFFFFFFEDE0.1      2C840300090                     bnei    r1,#0x90,dcx8           ; cursor up ?
541
FFFFFFFFFFFFEDE0.2      03FBC000020                     subui   sp,sp,#32
542
FFFFFFFFFFFFEDF0.0      27F40000007                     sm              [sp],r1/r2/r3/lr
543
FFFFFFFFFFFFEDF0.1      10804000416                     lc              r2,CursorRow
544
FFFFFFFFFFFFEDF0.2      2C0BFE40000                     beqi    r2,#0,dcx7
545
FFFFFFFFFFFFEE00.0      03884000001                     subui   r2,r2,#1
546
FFFFFFFFFFFFEE00.1      18804000416                     sc              r2,CursorRow
547
FFFFFFFFFFFFEE00.2      2F801FFFEAA                     bra             dcx7
548
FFFFFFFFFFFFEE10.0                               dcx8:
549
FFFFFFFFFFFFEE10.0      2C840280093                     bnei    r1,#0x93,dcx9           ; cursor left ?
550
FFFFFFFFFFFFEE10.1      03FBC000020                     subui   sp,sp,#32
551
FFFFFFFFFFFFEE10.2      27F40000007                     sm              [sp],r1/r2/r3/lr
552
FFFFFFFFFFFFEE20.0      10804000418                     lc              r2,CursorCol
553
FFFFFFFFFFFFEE20.1      2C0BFB40000                     beqi    r2,#0,dcx7
554
FFFFFFFFFFFFEE20.2      03884000001                     subui   r2,r2,#1
555
FFFFFFFFFFFFEE30.0      18804000418                     sc              r2,CursorCol
556
FFFFFFFFFFFFEE30.1      2F801FFFD2A                     bra             dcx7
557
FFFFFFFFFFFFEE30.2                               dcx9:
558
FFFFFFFFFFFFEE30.2      2C840340092                     bnei    r1,#0x92,dcx10          ; cursor down ?
559
FFFFFFFFFFFFEE40.0      03FBC000020                     subui   sp,sp,#32
560
FFFFFFFFFFFFEE40.1      27F40000007                     sm              [sp],r1/r2/r3/lr
561
FFFFFFFFFFFFEE40.2      10804000416                     lc              r2,CursorRow
562
FFFFFFFFFFFFEE50.0      2C0BF84001E                     beqi    r2,#30,dcx7
563
FFFFFFFFFFFFEE50.1      02884000001                     addui   r2,r2,#1
564
FFFFFFFFFFFFEE50.2      18804000416                     sc              r2,CursorRow
565
FFFFFFFFFFFFEE60.0      2F801FFFBAA                     bra             dcx7
566
FFFFFFFFFFFFEE60.1                               dcx10:
567
FFFFFFFFFFFFEE60.1      2C840340094                     bnei    r1,#0x94,dcx11                  ; cursor home ?
568
FFFFFFFFFFFFEE60.2      03FBC000020                     subui   sp,sp,#32
569
FFFFFFFFFFFFEE70.0      27F40000007                     sm              [sp],r1/r2/r3/lr
570
FFFFFFFFFFFFEE70.1      10804000418                     lc              r2,CursorCol
571
FFFFFFFFFFFFEE70.2      2F8800000C8                     beq             r2,r0,dcx12
572
FFFFFFFFFFFFEE80.0      18800000418                     sc              r0,CursorCol
573
FFFFFFFFFFFFEE80.1      2F801FFFAAA                     bra             dcx7
574
FFFFFFFFFFFFEE80.2                               dcx12:
575
FFFFFFFFFFFFEE80.2      18800000416                     sc              r0,CursorRow
576
FFFFFFFFFFFFEE90.0      2F801FFFA2A                     bra             dcx7
577
FFFFFFFFFFFFEE90.1                               dcx11:
578
FFFFFFFFFFFFEE90.1      03FBC000030                     subui   sp,sp,#48
579
FFFFFFFFFFFFEE90.2      27F4000001F                     sm              [sp],r1/r2/r3/r4/r5/r31
580
FFFFFFFFFFFFEEA0.0      2C840180099                     bnei    r1,#0x99,dcx13          ; delete ?
581
FFFFFFFFFFFFEEA0.1      0C7FFFFFB55                     call    CalcScreenLoc
582
FFFFFFFFFFFFEEA0.2      01002300009                     or              r3,r0,r1                        ; r3 = screen location
583
FFFFFFFFFFFFEEB0.0      10802000418                     lc              r1,CursorCol            ; r1 = cursor column
584
FFFFFFFFFFFFEEB0.1      2F8000001AA                     bra             dcx5
585
FFFFFFFFFFFFEEB0.2                               dcx13:
586
FFFFFFFFFFFFEEB0.2      2C840680008                     bnei    r1,#CTRLH,dcx3          ; backspace ?
587
FFFFFFFFFFFFEEC0.0      10804000418                     lc              r2,CursorCol
588
FFFFFFFFFFFFEEC0.1      2F8800004A8                     beq             r2,r0,dcx4
589
FFFFFFFFFFFFEEC0.2      03884000001                     subui   r2,r2,#1
590
FFFFFFFFFFFFEED0.0      18804000418                     sc              r2,CursorCol
591
FFFFFFFFFFFFEED0.1      0C7FFFFFB55                     call    CalcScreenLoc           ; a0 = screen location
592
FFFFFFFFFFFFEED0.2      01002300009                     or              r3,r0,r1                        ; r3 = screen location
593
FFFFFFFFFFFFEEE0.0      10802000418                     lc              r1,CursorCol
594
FFFFFFFFFFFFEEE0.1                               dcx5:
595
FFFFFFFFFFFFEEE0.1      108C4000002                     lc              r2,2[r3]
596
FFFFFFFFFFFFEEE0.2      188C4000000                     sc              r2,[r3]
597
FFFFFFFFFFFFEEF0.0      028C6000002                     addui   r3,r3,#2
598
FFFFFFFFFFFFEEF0.1      02842000001                     addui   r1,r1,#1
599
FFFFFFFFFFFFEEF0.2      0A4FFDA0000                     setlo   r4,#TEXTREG
600
FFFFFFFFFFFFEF00.0      2090A000000                     inch    r5,TEXT_COLS[r4]
601
FFFFFFFFFFFFEF00.1      2F84BFFFF24                     bltu    r1,r5,dcx5
602
FFFFFFFFFFFFEF00.2      0A200000020                     setlo   r2,#' '
603
FFFFFFFFFFFFEF10.0      188C5FFFFFE                     sc              r2,-2[r3]
604
FFFFFFFFFFFFEF10.1      2F80000022A                     bra             dcx4
605
FFFFFFFFFFFFEF10.2                               dcx3:
606
FFFFFFFFFFFFEF10.2      2C04040000A                     beqi    r1,#'\n',dclf   ; linefeed ?
607
FFFFFFFFFFFFEF20.0      01002400009                     or              r4,r0,r1                ; save r1 in r4
608
FFFFFFFFFFFFEF20.1      0C7FFFFFB55                     call    CalcScreenLoc   ; r1 = screen location
609
FFFFFFFFFFFFEF20.2      01002300009                     or              r3,r0,r1                ; r3 = screen location
610
FFFFFFFFFFFFEF30.0      01008100009                     or              r1,r0,r4                ; restore r1
611
FFFFFFFFFFFFEF30.1      0C7FFFFFB45                     call    AsciiToScreen   ; convert ascii char to screen char
612
FFFFFFFFFFFFEF30.2      188C2000000                     sc              r1,[r3]
613
FFFFFFFFFFFFEF40.0      0C7FFFFFBD8                     call    IncCursorPos
614
FFFFFFFFFFFFEF40.1      2774000001F                     lm              [sp],r1/r2/r3/r4/r5/r31
615
FFFFFFFFFFFFEF40.2      0DFBE000030                     ret             #48
616
FFFFFFFFFFFFEF50.0                               dclf:
617
FFFFFFFFFFFFEF50.0      0C7FFFFFBE4                     call    IncCursorRow
618
FFFFFFFFFFFFEF50.1                               dcx4:
619
FFFFFFFFFFFFEF50.1      2774000001F                     lm              [sp],r1/r2/r3/r4/r5/r31
620
FFFFFFFFFFFFEF50.2      0DFBE000030                     ret             #48
621
 
622
 
623
                                                 ;------------------------------------------------------------------------------
624
                                                 ; Increment the cursor position, scroll the screen if needed.
625
                                                 ;------------------------------------------------------------------------------
626
                                                 ;
627
FFFFFFFFFFFFEF60.0                               IncCursorPos:
628
FFFFFFFFFFFFEF60.0      03FBC000020                     subui   sp,sp,#32
629
FFFFFFFFFFFFEF60.1      27F40000007                     sm              [r30],r1/r2/r3/r31
630
FFFFFFFFFFFFEF60.2      10802000418                     lc              r1,CursorCol
631
FFFFFFFFFFFFEF70.0      02842000001                     addui   r1,r1,#1
632
FFFFFFFFFFFFEF70.1      18802000418                     sc              r1,CursorCol
633
FFFFFFFFFFFFEF70.2      20805DA0000                     inch    r2,TEXTREG+TEXT_COLS
634
FFFFFFFFFFFFEF80.0      2F844000226                     bleu    r1,r2,icc1
635
FFFFFFFFFFFFEF80.1      18800000418                     sc              r0,CursorCol            ; column = 0
636
FFFFFFFFFFFFEF80.2      2F8000000CA                     bra             icr1
637
FFFFFFFFFFFFEF90.0                               IncCursorRow:
638
FFFFFFFFFFFFEF90.0      03FBC000020                     subui   sp,sp,#32
639
FFFFFFFFFFFFEF90.1      27F40000007                     sm              [sp],r1/r2/r3/r31
640
FFFFFFFFFFFFEF90.2                               icr1:
641
FFFFFFFFFFFFEF90.2      10802000416                     lc              r1,CursorRow
642
FFFFFFFFFFFFEFA0.0      02842000001                     addui   r1,r1,#1
643
FFFFFFFFFFFFEFA0.1      18802000416                     sc              r1,CursorRow
644
FFFFFFFFFFFFEFA0.2      20805DA0002                     inch    r2,TEXTREG+TEXT_ROWS
645
FFFFFFFFFFFFEFB0.0      2F8440000A6                     bleu    r1,r2,icc1
646
FFFFFFFFFFFFEFB0.1      03884000001                     subui   r2,r2,#1                        ; backup the cursor row, we are scrolling up
647
FFFFFFFFFFFFEFB0.2      18804000416                     sc              r2,CursorRow
648
FFFFFFFFFFFFEFC0.0      0C7FFFFFB1C                     call    ScrollUp
649
FFFFFFFFFFFFEFC0.1                               icc1:
650
FFFFFFFFFFFFEFC0.1      0C7FFFFFB55                     call    CalcScreenLoc
651
FFFFFFFFFFFFEFC0.2      27740000007                     lm              [sp],r1/r2/r3/r31
652
FFFFFFFFFFFFEFD0.0      0DFBE000020                     ret             #32
653
 
654
                                                 ;------------------------------------------------------------------------------
655
                                                 ; Display a string on the screen.
656
                                                 ;------------------------------------------------------------------------------
657
                                                 ;
658
FFFFFFFFFFFFEFD0.1                               DisplayString:
659
FFFFFFFFFFFFEFD0.1      037BC000018                     subi    sp,sp,#24
660
FFFFFFFFFFFFEFD0.2      27F40000003                     sm              [sp],r1/r2/r31
661
FFFFFFFFFFFFEFE0.0      01040200009                     or              r2,r1,r0                ; r2 = pointer to string
662
FFFFFFFFFFFFEFE0.1                               dspj1:
663
FFFFFFFFFFFFEFE0.1      12882000000                     lbu             r1,[r2]                 ; move string char into r1
664
FFFFFFFFFFFFEFE0.2      02884000001                     addui   r2,r2,#1                ; increment pointer
665
FFFFFFFFFFFFEFF0.0      2F840000088                     beq             r1,r0,dsret             ; is it end of string ?
666
FFFFFFFFFFFFEFF0.1      0C7FFFFFB65                     call    DisplayChar             ; display character
667
FFFFFFFFFFFFEFF0.2      2F801FFFFAA                     bra             dspj1                   ; go back for next character
668
FFFFFFFFFFFFF000.0                               dsret:
669
FFFFFFFFFFFFF000.0      27740000003                     lm              [r30],r1/r2/r31
670
FFFFFFFFFFFFF000.1      0DFBE000018                     ret             #24
671
 
672
FFFFFFFFFFFFF000.2                               DisplayStringCRLF:
673
FFFFFFFFFFFFF000.2      03FBC000008                     subui   r30,r30,#8
674
FFFFFFFFFFFFF010.0      19FBE000000                     sw              r31,[r30]
675
FFFFFFFFFFFFF010.1      0C7FFFFFBF5                     call    DisplayString
676
FFFFFFFFFFFFF010.2      11FBE000000                     lw              r31,[r30]
677
FFFFFFFFFFFFF020.0      02FBC000008                     addui   r30,r30,#8
678
 
679
FFFFFFFFFFFFF020.1                               CRLF:
680
FFFFFFFFFFFFF020.1      03FBC000010                     subui   r30,r30,#16
681
FFFFFFFFFFFFF020.2      19F82000000                     sw              r1,[r30]
682
FFFFFFFFFFFFF030.0      19FBE000008                     sw              r31,8[r30]
683
FFFFFFFFFFFFF030.1      0A10000000D                     setlo   r1,#'\r'
684
FFFFFFFFFFFFF030.2      0C7FFFFFB65                     call    DisplayChar
685
FFFFFFFFFFFFF040.0      0A10000000A                     setlo   r1,#'\n'
686
FFFFFFFFFFFFF040.1      0C7FFFFFB65                     call    DisplayChar
687
FFFFFFFFFFFFF040.2      11F82000000                     lw              r1,[r30]
688
FFFFFFFFFFFFF050.0      11FBE000008                     lw              r31,8[r30]
689
FFFFFFFFFFFFF050.1      0DFBE000010                     ret             #16
690
 
691
                                                 ;------------------------------------------------------------------------------
692
                                                 ; Display nybble in r1
693
                                                 ;------------------------------------------------------------------------------
694
                                                 ;
695
FFFFFFFFFFFFF050.2                               DisplayNybble:
696
FFFFFFFFFFFFF050.2      03FBC000010                     subui   r30,r30,#16
697
FFFFFFFFFFFFF060.0      19FBE000008                     sw              r31,8[r30]
698
FFFFFFFFFFFFF060.1      19F82000000                     sw              r1,[r30]
699
FFFFFFFFFFFFF060.2      0504200000F                     andi    r1,r1,#0x0F
700
FFFFFFFFFFFFF070.0      02842000030                     addui   r1,r1,#'0'
701
FFFFFFFFFFFFF070.1      2B040100039                     bleui   r1,#'9',dispnyb1
702
FFFFFFFFFFFFF070.2      02842000007                     addui   r1,r1,#7
703
FFFFFFFFFFFFF080.0                               dispnyb1:
704
FFFFFFFFFFFFF080.0      0C7FFFFFB65                     call    DisplayChar
705
FFFFFFFFFFFFF080.1      11F82000000                     lw              r1,[r30]
706
FFFFFFFFFFFFF080.2      11FBE000008                     lw              r31,8[r30]
707
FFFFFFFFFFFFF090.0      0DFBE000010                     ret             #16
708
 
709
                                                 ;------------------------------------------------------------------------------
710
                                                 ; Display the byte in r1
711
                                                 ;------------------------------------------------------------------------------
712
                                                 ;
713
FFFFFFFFFFFFF090.1                               DisplayByte:
714
FFFFFFFFFFFFF090.1      03FBC000010                     subui   sp,sp,#16
715
FFFFFFFFFFFFF090.2      27F40000001                     sm              [sp],r1/r31
716
FFFFFFFFFFFFF0A0.0      01842200004                     rori    r1,r1,#4
717
FFFFFFFFFFFFF0A0.1      0C7FFFFFC16                     call    DisplayNybble
718
FFFFFFFFFFFFF0A0.2      01842200002                     roli    r1,r1,#4
719
FFFFFFFFFFFFF0B0.0      0C7FFFFFC16                     call    DisplayNybble
720
FFFFFFFFFFFFF0B0.1      27740000001                     lm              [sp],r1/r31
721
FFFFFFFFFFFFF0B0.2      0DFBE000010                     ret             #16
722
 
723
                                                 ;------------------------------------------------------------------------------
724
                                                 ; Display the 64 bit word in r1
725
                                                 ;------------------------------------------------------------------------------
726
                                                 ;
727
FFFFFFFFFFFFF0C0.0                               DisplayWord:
728
FFFFFFFFFFFFF0C0.0      03FBC000018                     subui   sp,sp,#24
729
FFFFFFFFFFFFF0C0.1      27F40000005                     sm              [sp],r1/r3/r31
730
FFFFFFFFFFFFF0C0.2      0A300000007                     setlo   r3,#7
731
FFFFFFFFFFFFF0D0.0                               dspwd1:
732
FFFFFFFFFFFFF0D0.0      01842400002                     roli    r1,r1,#8
733
FFFFFFFFFFFFF0D0.1      0C7FFFFFC25                     call    DisplayByte
734
FFFFFFFFFFFFF0D0.2      2F80600000F                     loop    r3,dspwd1
735
FFFFFFFFFFFFF0E0.0      27740000005                     lm              [sp],r1/r3/r31
736
FFFFFFFFFFFFF0E0.1      0DFBE000018                     ret             #24
737
 
738
                                                 ;------------------------------------------------------------------------------
739
                                                 ; Display memory pointed to by r2.
740
                                                 ; destroys r1,r3
741
                                                 ;------------------------------------------------------------------------------
742
                                                 ;
743
FFFFFFFFFFFFF0E0.2                               DisplayMem:
744
FFFFFFFFFFFFF0E0.2      03FBC000008                     subui   sp,sp,#8
745
FFFFFFFFFFFFF0F0.0      19FBE000000                     sw              lr,[sp]
746
FFFFFFFFFFFFF0F0.1      0A10000003A                     setlo   r1,#':'
747
FFFFFFFFFFFFF0F0.2      0C7FFFFFB65                     call    DisplayChar
748
FFFFFFFFFFFFF100.0      01080100009                     or              r1,r2,r0
749
FFFFFFFFFFFFF100.1      0C7FFFFFC30                     call    DisplayWord
750
FFFFFFFFFFFFF100.2      0A300000007                     setlo   r3,#7
751
FFFFFFFFFFFFF110.0                               dspmem1:
752
FFFFFFFFFFFFF110.0      0A100000020                     setlo   r1,#' '
753
FFFFFFFFFFFFF110.1      0C7FFFFFB65                     call    DisplayChar
754
FFFFFFFFFFFFF110.2      10082000000                     lb              r1,[r2]
755
FFFFFFFFFFFFF120.0      0C7FFFFFC25                     call    DisplayByte
756
FFFFFFFFFFFFF120.1      02884000001                     addui   r2,r2,#1
757
FFFFFFFFFFFFF120.2      2F807FFFF8F                     loop    r3,dspmem1
758
FFFFFFFFFFFFF130.0      0C7FFFFFC09                     call    CRLF
759
FFFFFFFFFFFFF130.1      11FBE000000                     lw              lr,[sp]
760
FFFFFFFFFFFFF130.2      0DFBE000008                     ret             #8
761
 
762
                                                 ;------------------------------------------------------------------------------
763
                                                 ; Converts binary number in r1 into BCD number in r2 and r1.
764
                                                 ;------------------------------------------------------------------------------
765
                                                 ;
766
FFFFFFFFFFFFF140.0                               BinToBCD:
767
FFFFFFFFFFFFF140.0      03FBC000030                     subui   sp,sp,#48
768
FFFFFFFFFFFFF140.1      27F000000FC                     sm              [sp],r3/r4/r5/r6/r7/r8
769
FFFFFFFFFFFFF140.2      0A20000000A                     setlo   r2,#10
770
FFFFFFFFFFFFF150.0      0A800000013                     setlo   r8,#19          ; number of digits to produce - 1
771
FFFFFFFFFFFFF150.1                               bta1:
772
FFFFFFFFFFFFF150.1      0104430001C                     mod             r3,r1,r2
773
FFFFFFFFFFFFF150.2      018C7E00000                     shli    r3,r3,#60       ; shift result to uppermost bits
774
FFFFFFFFFFFFF160.0      0194FE00000                     shli    r7,r5,#60       ; copy low order nybble of r5 to r4 topmost nybble
775
FFFFFFFFFFFFF160.1      01908200001                     shrui   r4,r4,#4
776
FFFFFFFFFFFFF160.2      0110E400009                     or              r4,r4,r7
777
FFFFFFFFFFFFF170.0      0194A200001                     shrui   r5,r5,#4
778
FFFFFFFFFFFFF170.1      01146500009                     or              r5,r5,r3        ; copy new bcd digit into uppermost bits of r5
779
FFFFFFFFFFFFF170.2      07042000000                     divui   r1,r1,r2        ; r1=r1/10
780
FFFFFFFFFFFFF180.0      2F811FFFEAF                     loop    r8,bta1
781
FFFFFFFFFFFFF180.1      01909800001                     shrui   r4,r4,#48       ; right align number in register
782
FFFFFFFFFFFFF180.2      0194C800000                     shli    r6,r5,#16
783
FFFFFFFFFFFFF190.0      0110C400009                     or              r4,r4,r6        ; copy bits into r4
784
FFFFFFFFFFFFF190.1      0194B800001                     shrui   r5,r5,#48
785
FFFFFFFFFFFFF190.2      01008100009                     or              r1,r0,r4
786
FFFFFFFFFFFFF1A0.0      0100A200009                     or              r2,r0,r5
787
FFFFFFFFFFFFF1A0.1      277000000FC                     lm              [sp],r3/r4/r5/r6/r7/r8
788
FFFFFFFFFFFFF1A0.2      0DFBE000030                     ret             #48
789
 
790
                                                 ;------------------------------------------------------------------------------
791
                                                 ; Converts BCD number in r1 into Ascii number in r2 and r1.
792
                                                 ;------------------------------------------------------------------------------
793
                                                 ;
794
FFFFFFFFFFFFF1B0.0                               BCDToAscii:
795
FFFFFFFFFFFFF1B0.0      03FBC000020                     subui   sp,sp,#32
796
FFFFFFFFFFFFF1B0.1      27F0000009C                     sm              [sp],r3/r4/r5/r8
797
FFFFFFFFFFFFF1B0.2      0A80000000F                     setlo   r8,#15
798
FFFFFFFFFFFFF1C0.0                               bta2:
799
FFFFFFFFFFFFF1C0.0      0504400000F                     andi    r2,r1,#0x0F
800
FFFFFFFFFFFFF1C0.1      05884000030                     ori             r2,r2,#0x30
801
FFFFFFFFFFFFF1C0.2      01885C00000                     shli    r2,r2,#56
802
FFFFFFFFFFFFF1D0.0      01908400001                     shrui   r4,r4,#8
803
FFFFFFFFFFFFF1D0.1      018CBC00000                     shli    r5,r3,#56
804
FFFFFFFFFFFFF1D0.2      0110A400009                     or              r4,r4,r5
805
FFFFFFFFFFFFF1E0.0      018C6400001                     shrui   r3,r3,#8
806
FFFFFFFFFFFFF1E0.1      010C4300009                     or              r3,r3,r2
807
FFFFFFFFFFFFF1E0.2      01842200001                     shrui   r1,r1,#4
808
FFFFFFFFFFFFF1F0.0      2F811FFFE8F                     loop    r8,bta2
809
FFFFFFFFFFFFF1F0.1      01008100009                     or              r1,r0,r4
810
FFFFFFFFFFFFF1F0.2      01006200009                     or              r2,r0,r3
811
FFFFFFFFFFFFF200.0      2770000009C                     lm              [sp],r3/r4/r5/r8
812
FFFFFFFFFFFFF200.1      0DFBE000020                     ret             #32
813
 
814
                                                 ;------------------------------------------------------------------------------
815
                                                 ; Convert a binary number into a 20 character ascii string.
816
                                                 ; r1 = number to convert
817
                                                 ; r2 = address of string buffer
818
                                                 ;------------------------------------------------------------------------------
819
                                                 ;
820
FFFFFFFFFFFFF200.2                               BinToStr:
821
FFFFFFFFFFFFF200.2      03FBC000038                     subui   sp,sp,#56
822
FFFFFFFFFFFFF210.0      27F400007C4                     sm              [sp],r3/r7/r8/r9/r10/r11/r31
823
FFFFFFFFFFFFF210.1      01004B00009                     or              r11,r0,r2
824
FFFFFFFFFFFFF210.2      0C7FFFFFC50                     call    BinToBCD
825
FFFFFFFFFFFFF220.0      01004A00009                     or              r10,r0,r2       ; save off r2
826
FFFFFFFFFFFFF220.1      0C7FFFFFC6C                     call    BCDToAscii
827
FFFFFFFFFFFFF220.2      0A900000001                     setlo   r9,#1
828
FFFFFFFFFFFFF230.0                               btos3:
829
FFFFFFFFFFFFF230.0      0A800000007                     setlo   r8,#7
830
FFFFFFFFFFFFF230.1                               btos1:
831
FFFFFFFFFFFFF230.1      01A4E180000                     shli    r7,r9,#3
832
FFFFFFFFFFFFF230.2      029CE000000                     addui   r7,r7,r8
833
FFFFFFFFFFFFF240.0      029CE000004                     addui   r7,r7,#4
834
FFFFFFFFFFFFF240.1      050460000FF                     andi    r3,r1,#0xff
835
FFFFFFFFFFFFF240.2      1A9D6300010                     sb              r3,[r7+r11]
836
FFFFFFFFFFFFF250.0      01842400001                     shrui   r1,r1,#8
837
FFFFFFFFFFFFF250.1      2F811FFFF2F                     loop    r8,btos1
838
FFFFFFFFFFFFF250.2      01004100009                     or              r1,r0,r2
839
FFFFFFFFFFFFF260.0      2F813FFFE8F                     loop    r9,btos3
840
                                                 ; the last four digits
841
FFFFFFFFFFFFF260.1      01014100009                     or              r1,r0,r10       ; get back r2
842
FFFFFFFFFFFFF260.2      0C7FFFFFC6C                     call    BCDToAscii
843
FFFFFFFFFFFFF270.0      0A800000003                     setlo   r8,#3
844
FFFFFFFFFFFFF270.1                               btos2:
845
FFFFFFFFFFFFF270.1      050460000FF                     andi    r3,r1,#0xff
846
FFFFFFFFFFFFF270.2      1AA16300010                     sb              r3,[r8+r11]
847
FFFFFFFFFFFFF280.0      01842400001                     shrui   r1,r1,#8
848
FFFFFFFFFFFFF280.1      2F811FFFFAF                     loop    r8,btos2
849
FFFFFFFFFFFFF280.2      182C0000014                     sb              r0,20[r11]      ; null terminate
850
FFFFFFFFFFFFF290.0      277400007C4                     lm              [sp],r3/r7/r8/r9/r10/r11/r31
851
FFFFFFFFFFFFF290.1      0DFBE000038                     ret             #56
852
 
853
 
854
                                                 ;==============================================================================
855
                                                 ;==============================================================================
856
FFFFFFFFFFFFF290.2                               Monitor:
857
FFFFFFFFFFFFF290.2      0BEFFFEFFF8                     setlo   sp,#STACKTOP    ; top of stack; reset the stack pointer
858
FFFFFFFFFFFFF2A0.0      1800000041A                     sb              r0,KeybdEcho    ; turn off keyboard echo
859
FFFFFFFFFFFFF2A0.1                               PromptLn:
860
FFFFFFFFFFFFF2A0.1      0C7FFFFFC09                     call    CRLF
861
FFFFFFFFFFFFF2A0.2      0A100000024                     setlo   r1,#'$'
862
FFFFFFFFFFFFF2B0.0      0C7FFFFFB65                     call    DisplayChar
863
 
864
                                                 ; Get characters until a CR is keyed
865
                                                 ;
866
FFFFFFFFFFFFF2B0.1                               Prompt3:
867
FFFFFFFFFFFFF2B0.1      0C7FFFFFA92                     call    KeybdGetChar
868
FFFFFFFFFFFFF2B0.2      2C04007FFFF                     beqi    r1,#-1,Prompt3  ; wait for a character
869
FFFFFFFFFFFFF2C0.0      2C04010000D                     beqi    r1,#CR,Prompt1
870
FFFFFFFFFFFFF2C0.1      0C7FFFFFB65                     call    DisplayChar
871
FFFFFFFFFFFFF2C0.2      2F801FFFFAA                     bra             Prompt3
872
 
873
                                                 ; Process the screen line that the CR was keyed on
874
                                                 ;
875
FFFFFFFFFFFFF2D0.0                               Prompt1:
876
FFFFFFFFFFFFF2D0.0      18800000418                     sc              r0,CursorCol    ; go back to the start of the line
877
FFFFFFFFFFFFF2D0.1      0C7FFFFFB55                     call    CalcScreenLoc   ; r1 = screen memory location
878
FFFFFFFFFFFFF2D0.2      01040300009                     or              r3,r1,r0
879
FFFFFFFFFFFFF2E0.0      108C2000000                     lc              r1,[r3]
880
FFFFFFFFFFFFF2E0.1      028C6000002                     addui   r3,r3,#2
881
FFFFFFFFFFFFF2E0.2      0C7FFFFFB50                     call    ScreenToAscii
882
FFFFFFFFFFFFF2F0.0      2C840140024                     bnei    r1,#'$',Prompt2 ; skip over '$' prompt character
883
FFFFFFFFFFFFF2F0.1      108C2000000                     lc              r1,[r3]
884
FFFFFFFFFFFFF2F0.2      028C6000002                     addui   r3,r3,#2
885
FFFFFFFFFFFFF300.0      0C7FFFFFB50                     call    ScreenToAscii
886
 
887
                                                 ; Dispatch based on command character
888
                                                 ;
889
FFFFFFFFFFFFF300.1                               Prompt2:
890
FFFFFFFFFFFFF300.1      2C04150003A                     beqi    r1,#':',Editmem         ; $: - edit memory
891
FFFFFFFFFFFFF300.2      2C041A00044                     beqi    r1,#'D',Dumpmem         ; $D - dump memory
892
FFFFFFFFFFFFF310.0      2C075140042                     beqi    r1,#'B',START           ; $B - start tiny basic
893
FFFFFFFFFFFFF310.1      2C04174004A                     beqi    r1,#'J',ExecuteCode     ; $J - execute code
894
FFFFFFFFFFFFF310.2      2C04280004C                     beqi    r1,#'L',LoadS19         ; $L - load S19 file
895
FFFFFFFFFFFFF320.0      2C04054003F                     beqi    r1,#'?',DisplayHelp     ; $? - display help
896
FFFFFFFFFFFFF320.1      2C040100043                     beqi    r1,#'C',TestCLS         ; $C - clear screen
897
FFFFFFFFFFFFF320.2      2F801FFFBCA                     bra             Monitor
898
 
899
FFFFFFFFFFFFF330.0                               TestCLS:
900
FFFFFFFFFFFFF330.0      108C2000000                     lc              r1,[r3]
901
FFFFFFFFFFFFF330.1      028C6000002                     addui   r3,r3,#2
902
FFFFFFFFFFFFF330.2      0C7FFFFFB50                     call    ScreenToAscii
903
FFFFFFFFFFFFF340.0      2C87F58004C                     bnei    r1,#'L',Monitor
904
FFFFFFFFFFFFF340.1      108C2000000                     lc              r1,[r3]
905
FFFFFFFFFFFFF340.2      028C6000002                     addui   r3,r3,#2
906
FFFFFFFFFFFFF350.0      0C7FFFFFB50                     call    ScreenToAscii
907
FFFFFFFFFFFFF350.1      2C87F480053                     bnei    r1,#'S',Monitor
908
FFFFFFFFFFFFF350.2      0C7FFFFFB06                     call    ClearScreen
909
FFFFFFFFFFFFF360.0      18000000418                     sb              r0,CursorCol
910
FFFFFFFFFFFFF360.1      18000000416                     sb              r0,CursorRow
911
FFFFFFFFFFFFF360.2      0C7FFFFFB55                     call    CalcScreenLoc
912
FFFFFFFFFFFFF370.0      2F801FFF94A                     bra             Monitor
913 10 robfinch
 
914 27 robfinch
FFFFFFFFFFFFF370.1                               DisplayHelp:
915
FFFFFFFFFFFFF370.1      0A1FFFFF390                     setlo   r1,HelpMsg
916
FFFFFFFFFFFFF370.2      0C7FFFFFBF5                     call    DisplayString
917
FFFFFFFFFFFFF380.0      2F801FFF8CA                     bra             Monitor
918 10 robfinch
 
919 27 robfinch
FFFFFFFFFFFFF380.1      37800000000                     align   16
920
FFFFFFFFFFFFF380.2      37800000000                     align   16
921
FFFFFFFFFFFFF390.0                                      align   16
922
FFFFFFFFFFFFF390.0                               HelpMsg:
923
FFFFFFFFFFFFF390 70736944203D203F               db      "? = Display help",CR,LF
924
FFFFFFFFFFFFF398 706C65682079616C
925
FFFFFFFFFFFFF3A0 203D20534C430A0D               db      "CLS = clear screen",CR,LF
926
FFFFFFFFFFFFF3A8 6373207261656C63
927
FFFFFFFFFFFFF3B0 203A0A0D6E656572               db      ": = Edit memory bytes",CR,LF
928
FFFFFFFFFFFFF3B8 6D2074696445203D
929
FFFFFFFFFFFFF3C0 79622079726F6D65
930
FFFFFFFFFFFFF3C8 3D204C0A0D736574               db      "L = Load S19 file",CR,LF
931
FFFFFFFFFFFFF3D0 31532064616F4C20
932
FFFFFFFFFFFFF3D8 0A0D656C69662039
933
FFFFFFFFFFFFF3E0 706D7544203D2044               db      "D = Dump memory",CR,LF
934
FFFFFFFFFFFFF3E8 0D79726F6D656D20
935
FFFFFFFFFFFFF3F0 617473203D20420A               db      "B = start tiny basic",CR,LF
936
FFFFFFFFFFFFF3F8 20796E6974207472
937
FFFFFFFFFFFFF400 4A0A0D6369736162               db      "J = Jump to code",CR,LF,0
938
FFFFFFFFFFFFF408 20706D754A203D20
939
FFFFFFFFFFFFF410 0D65646F63206F74
940
FFFFFFFFFFFFF418 000000000000000A               align   16
941
FFFFFFFFFFFFF420.0                                      align   16
942
 
943
                                                 ;------------------------------------------------------------------------------
944
                                                 ; Ignore blanks in the input
945
                                                 ; r3 = text pointer
946
                                                 ; r1 destroyed
947
                                                 ;------------------------------------------------------------------------------
948
                                                 ;
949
FFFFFFFFFFFFF420.0                               ignBlanks:
950
FFFFFFFFFFFFF420.0      03FBC000008                     subui   sp,sp,#8
951
FFFFFFFFFFFFF420.1      19FBE000000                     sw              r31,[sp]
952
FFFFFFFFFFFFF420.2                               ignBlanks1:
953
FFFFFFFFFFFFF420.2      108C2000000                     lc              r1,[r3]
954
FFFFFFFFFFFFF430.0      028C6000002                     addui   r3,r3,#2
955
FFFFFFFFFFFFF430.1      0C7FFFFFB50                     call    ScreenToAscii
956
FFFFFFFFFFFFF430.2      2C07FF80020                     beqi    r1,#' ',ignBlanks1
957
FFFFFFFFFFFFF440.0      038C6000002                     subui   r3,r3,#2
958
FFFFFFFFFFFFF440.1      11FBE000000                     lw              r31,[sp]
959
FFFFFFFFFFFFF440.2      0DFBE000008                     ret             #8
960
 
961
                                                 ;------------------------------------------------------------------------------
962
                                                 ; Edit memory byte(s).
963
                                                 ;------------------------------------------------------------------------------
964
                                                 ;
965
FFFFFFFFFFFFF450.0                               EditMem:
966
FFFFFFFFFFFFF450.0      0C7FFFFFD08                     call    ignBlanks
967
FFFFFFFFFFFFF450.1      0C7FFFFFD39                     call    GetHexNumber
968
FFFFFFFFFFFFF450.2      01040500009                     or              r5,r1,r0
969
FFFFFFFFFFFFF460.0      0A400000007                     setlo   r4,#7
970
FFFFFFFFFFFFF460.1                               edtmem1:
971
FFFFFFFFFFFFF460.1      0C7FFFFFD08                     call    ignBlanks
972
FFFFFFFFFFFFF460.2      0C7FFFFFD39                     call    GetHexNumber
973
FFFFFFFFFFFFF470.0      18142000000                     sb              r1,[r5]
974
FFFFFFFFFFFFF470.1      0294A000001                     addui   r5,r5,#1
975
FFFFFFFFFFFFF470.2      2F809FFFFAF                     loop    r4,edtmem1
976
FFFFFFFFFFFFF480.0      2F801FFF0CA                     bra             Monitor
977
 
978
                                                 ;------------------------------------------------------------------------------
979
                                                 ; Execute code at the specified address.
980
                                                 ;------------------------------------------------------------------------------
981
                                                 ;
982
FFFFFFFFFFFFF480.1                               ExecuteCode:
983
FFFFFFFFFFFFF480.1      0C7FFFFFD08                     call    ignBlanks
984
FFFFFFFFFFFFF480.2      0C7FFFFFD39                     call    GetHexNumber
985
FFFFFFFFFFFFF490.0      01040300009                     or              r3,r1,r0
986
FFFFFFFFFFFFF490.1      0D0FE000000                     jal             r31,[r3]
987
FFFFFFFFFFFFF490.2      2F801FFF04A                     bra     Monitor
988
 
989
                                                 ;------------------------------------------------------------------------------
990
                                                 ; Do a memory dump of the requested location.
991
                                                 ;------------------------------------------------------------------------------
992
                                                 ;
993
FFFFFFFFFFFFF4A0.0                               DumpMem:
994
FFFFFFFFFFFFF4A0.0      0C7FFFFFD08                     call    ignBlanks
995
FFFFFFFFFFFFF4A0.1      0C7FFFFFD39                     call    GetHexNumber
996
FFFFFFFFFFFFF4A0.2      01040200009                     or              r2,r1,r0
997
FFFFFFFFFFFFF4B0.0      0C7FFFFFC09                     call    CRLF
998
FFFFFFFFFFFFF4B0.1      0C7FFFFFC3A                     call    DisplayMem
999
FFFFFFFFFFFFF4B0.2      0C7FFFFFC3A                     call    DisplayMem
1000
FFFFFFFFFFFFF4C0.0      0C7FFFFFC3A                     call    DisplayMem
1001
FFFFFFFFFFFFF4C0.1      0C7FFFFFC3A                     call    DisplayMem
1002
FFFFFFFFFFFFF4C0.2      0C7FFFFFC3A                     call    DisplayMem
1003
FFFFFFFFFFFFF4D0.0      0C7FFFFFC3A                     call    DisplayMem
1004
FFFFFFFFFFFFF4D0.1      0C7FFFFFC3A                     call    DisplayMem
1005
FFFFFFFFFFFFF4D0.2      0C7FFFFFC3A                     call    DisplayMem
1006
FFFFFFFFFFFFF4E0.0      2F801FFEDCA                     bra             Monitor
1007
 
1008
                                                 ;------------------------------------------------------------------------------
1009
                                                 ; Get a hexidecimal number. Maximum of sixteen digits.
1010
                                                 ; R3 = text pointer (updated)
1011
                                                 ;------------------------------------------------------------------------------
1012
                                                 ;
1013
FFFFFFFFFFFFF4E0.1                               GetHexNumber:
1014
FFFFFFFFFFFFF4E0.1      03FBC000018                     subui   sp,sp,#24
1015
FFFFFFFFFFFFF4E0.2      27F4000000A                     sm              [sp],r2/r4/r31
1016
FFFFFFFFFFFFF4F0.0      0A200000000                     setlo   r2,#0
1017
FFFFFFFFFFFFF4F0.1      0A40000000F                     setlo   r4,#15
1018
FFFFFFFFFFFFF4F0.2                               gthxn2:
1019
FFFFFFFFFFFFF4F0.2      108C2000000                     lc              r1,[r3]
1020
FFFFFFFFFFFFF500.0      028C6000002                     addui   r3,r3,#2
1021
FFFFFFFFFFFFF500.1      0C7FFFFFB50                     call    ScreenToAscii
1022
FFFFFFFFFFFFF500.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1023
FFFFFFFFFFFFF510.0      2C0401BFFFF                     beqi    r1,#-1,gthxn1
1024
FFFFFFFFFFFFF510.1      01884200000                     shli    r2,r2,#4
1025
FFFFFFFFFFFFF510.2      0504200000F                     andi    r1,r1,#0x0f
1026
FFFFFFFFFFFFF520.0      01082200009                     or              r2,r2,r1
1027
FFFFFFFFFFFFF520.1      2F809FFFECF                     loop    r4,gthxn2
1028
FFFFFFFFFFFFF520.2                               gthxn1:
1029
FFFFFFFFFFFFF520.2      01080100009                     or              r1,r2,r0
1030
FFFFFFFFFFFFF530.0      2774000000A                     lm              [sp],r2/r4/r31
1031
FFFFFFFFFFFFF530.1      0DFBE000018                     ret             #24
1032
 
1033
                                                 ;------------------------------------------------------------------------------
1034
                                                 ; Convert ASCII character in the range '0' to '9', 'a' to 'f' or 'A' to 'F'
1035
                                                 ; to a hex nybble.
1036
                                                 ;------------------------------------------------------------------------------
1037
                                                 ;
1038
FFFFFFFFFFFFF530.2                               AsciiToHexNybble:
1039
FFFFFFFFFFFFF530.2      2A040540030                     bltui   r1,#'0',gthx3
1040
FFFFFFFFFFFFF540.0      2B840100039                     bgtui   r1,#'9',gthx5
1041
FFFFFFFFFFFFF540.1      03842000030                     subui   r1,r1,#'0'
1042
FFFFFFFFFFFFF540.2      0DFBE000000                     ret
1043
FFFFFFFFFFFFF550.0                               gthx5:
1044
FFFFFFFFFFFFF550.0      2A040340041                     bltui   r1,#'A',gthx3
1045
FFFFFFFFFFFFF550.1      2B840180046                     bgtui   r1,#'F',gthx6
1046
FFFFFFFFFFFFF550.2      03842000041                     subui   r1,r1,#'A'
1047
FFFFFFFFFFFFF560.0      0284200000A                     addui   r1,r1,#10
1048
FFFFFFFFFFFFF560.1      0DFBE000000                     ret
1049
FFFFFFFFFFFFF560.2                               gthx6:
1050
FFFFFFFFFFFFF560.2      2A040240061                     bltui   r1,#'a',gthx3
1051
FFFFFFFFFFFFF570.0      2B840140066                     bgtui   r1,#'f',gthx3
1052
FFFFFFFFFFFFF570.1      03842000061                     subui   r1,r1,#'a'
1053
FFFFFFFFFFFFF570.2      0284200000A                     addui   r1,r1,#10
1054
FFFFFFFFFFFFF580.0      0DFBE000000                     ret
1055
FFFFFFFFFFFFF580.1                               gthx3:
1056
FFFFFFFFFFFFF580.1      0A1FFFFFFFF                     setlo   r1,#-1          ; not a hex number
1057
FFFFFFFFFFFFF580.2      0DFBE000000                     ret
1058
 
1059 10 robfinch
                                                 ;==============================================================================
1060 27 robfinch
                                                 ; Load an S19 format file
1061
                                                 ;==============================================================================
1062
                                                 ;
1063
FFFFFFFFFFFFF590.0                               LoadS19:
1064
FFFFFFFFFFFFF590.0      2F80000008A                     bra             ProcessRec
1065
FFFFFFFFFFFFF590.1                               NextRec:
1066
FFFFFFFFFFFFF590.1      0C7FFFFFDFC                     call    sGetChar
1067
FFFFFFFFFFFFF590.2      2C84004000A                     bne             r1,#LF,NextRec
1068
FFFFFFFFFFFFF5A0.0                               ProcessRec:
1069
FFFFFFFFFFFFF5A0.0      0C7FFFFFDFC                     call    sGetChar
1070
FFFFFFFFFFFFF5A0.1      2C07CF8001A                     beqi    r1,#26,Monitor  ; CTRL-Z ?
1071
FFFFFFFFFFFFF5A0.2      2C87FF40053                     bnei    r1,#'S',NextRec
1072
FFFFFFFFFFFFF5B0.0      0C7FFFFFDFC                     call    sGetChar
1073
FFFFFFFFFFFFF5B0.1      2807FE40030                     blt             r1,#'0',NextRec
1074
FFFFFFFFFFFFF5B0.2      2987FE40039                     bgt             r1,#'9',NextRec
1075
FFFFFFFFFFFFF5C0.0      01040400009                     or              r4,r1,r0                ; r4 = record type
1076
FFFFFFFFFFFFF5C0.1      0C7FFFFFDFC                     call    sGetChar
1077
FFFFFFFFFFFFF5C0.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1078
FFFFFFFFFFFFF5D0.0      01040200009                     or              r2,r1,r0
1079
FFFFFFFFFFFFF5D0.1      0C7FFFFFDFC                     call    sGetChar
1080
FFFFFFFFFFFFF5D0.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1081
FFFFFFFFFFFFF5E0.0      01884200000                     shli    r2,r2,#4
1082
FFFFFFFFFFFFF5E0.1      01082200009                     or              r2,r2,r1                ; r2 = byte count
1083
FFFFFFFFFFFFF5E0.2      01082300009                     or              r3,r2,r1                ; r3 = byte count
1084
FFFFFFFFFFFFF5F0.0      2C13FA40030                     beqi    r4,#'0',NextRec ; manufacturer ID record, ignore
1085
FFFFFFFFFFFFF5F0.1      2C100A40031                     beqi    r4,#'1',ProcessS1
1086
FFFFFFFFFFFFF5F0.2      2C100B00032                     beqi    r4,#'2',ProcessS2
1087
FFFFFFFFFFFFF600.0      2C100A80033                     beqi    r4,#'3',ProcessS3
1088
FFFFFFFFFFFFF600.1      2C13F940035                     beqi    r4,#'5',NextRec ; record count record, ignore
1089
FFFFFFFFFFFFF600.2      2C100B40037                     beqi    r4,#'7',ProcessS7
1090
FFFFFFFFFFFFF610.0      2C100B40038                     beqi    r4,#'8',ProcessS8
1091
FFFFFFFFFFFFF610.1      2C100C40039                     beqi    r4,#'9',ProcessS9
1092
FFFFFFFFFFFFF610.2      2F801FFFC2A                     bra             NextRec
1093
 
1094
FFFFFFFFFFFFF620.0                               pcssxa:
1095
FFFFFFFFFFFFF620.0      050C60000FF                     andi    r3,r3,#0xff
1096
FFFFFFFFFFFFF620.1      038C6000001                     subui   r3,r3,#1                ; one less for loop
1097
FFFFFFFFFFFFF620.2                               pcss1a:
1098
FFFFFFFFFFFFF620.2      0C7FFFFFDFC                     call    sGetChar
1099
FFFFFFFFFFFFF630.0      0C7FFFFFD4E                     call    AsciiToHexNybble
1100
FFFFFFFFFFFFF630.1      01884200000                     shli    r2,r2,#4
1101
FFFFFFFFFFFFF630.2      01082200009                     or              r2,r2,r1
1102
FFFFFFFFFFFFF640.0      0C7FFFFFDFC                     call    sGetChar
1103
FFFFFFFFFFFFF640.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1104
FFFFFFFFFFFFF640.2      01884200000                     shli    r2,r2,#4
1105
FFFFFFFFFFFFF650.0      01082200009                     or              r2,r2,r1
1106
FFFFFFFFFFFFF650.1      18144000000                     sb              r2,[r5]
1107
FFFFFFFFFFFFF650.2      0294A000001                     addui   r5,r5,#1
1108
FFFFFFFFFFFFF660.0      2F807FFFE4F                     loop    r3,pcss1a
1109
                                                 ; Get the checksum byte
1110
FFFFFFFFFFFFF660.1      0C7FFFFFDFC                     call    sGetChar
1111
FFFFFFFFFFFFF660.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1112
FFFFFFFFFFFFF670.0      01884200000                     shli    r2,r2,#4
1113
FFFFFFFFFFFFF670.1      01082200009                     or              r2,r2,r1
1114
FFFFFFFFFFFFF670.2      0C7FFFFFDFC                     call    sGetChar
1115
FFFFFFFFFFFFF680.0      0C7FFFFFD4E                     call    AsciiToHexNybble
1116
FFFFFFFFFFFFF680.1      01884200000                     shli    r2,r2,#4
1117
FFFFFFFFFFFFF680.2      01082200009                     or              r2,r2,r1
1118
FFFFFFFFFFFFF690.0      2F801FFF82A                     bra             NextRec
1119
 
1120
FFFFFFFFFFFFF690.1                               ProcessS1:
1121
FFFFFFFFFFFFF690.1      0C7FFFFFDB9                     call    S19Get16BitAddress
1122
FFFFFFFFFFFFF690.2      2F801FFFC8A                     bra             pcssxa
1123
FFFFFFFFFFFFF6A0.0                               ProcessS2:
1124
FFFFFFFFFFFFF6A0.0      0C7FFFFFDC1                     call    S19Get24BitAddress
1125
FFFFFFFFFFFFF6A0.1      2F801FFFC0A                     bra             pcssxa
1126
FFFFFFFFFFFFF6A0.2                               ProcessS3:
1127
FFFFFFFFFFFFF6A0.2      0C7FFFFFDC9                     call    S19Get32BitAddress
1128
FFFFFFFFFFFFF6B0.0      2F801FFFB8A                     bra             pcssxa
1129
FFFFFFFFFFFFF6B0.1                               ProcessS7:
1130
FFFFFFFFFFFFF6B0.1      0C7FFFFFDC9                     call    S19Get32BitAddress
1131
FFFFFFFFFFFFF6B0.2      1980A000000                     sw              r5,S19StartAddress
1132
FFFFFFFFFFFFF6C0.0      2F801FFDECA                     bra             Monitor
1133
FFFFFFFFFFFFF6C0.1                               ProcessS8:
1134
FFFFFFFFFFFFF6C0.1      0C7FFFFFDC1                     call    S19Get24BitAddress
1135
FFFFFFFFFFFFF6C0.2      1980A000000                     sw              r5,S19StartAddress
1136
FFFFFFFFFFFFF6D0.0      2F801FFDE4A                     bra             Monitor
1137
FFFFFFFFFFFFF6D0.1                               ProcessS9:
1138
FFFFFFFFFFFFF6D0.1      0C7FFFFFDB9                     call    S19Get16BitAddress
1139
FFFFFFFFFFFFF6D0.2      1980A000000                     sw              r5,S19StartAddress
1140
FFFFFFFFFFFFF6E0.0      2F801FFDDCA                     bra             Monitor
1141
 
1142
FFFFFFFFFFFFF6E0.1                               S19Get16BitAddress:
1143
FFFFFFFFFFFFF6E0.1      03FBC000008                     subui   sp,sp,#8
1144
FFFFFFFFFFFFF6E0.2      19FBE000000                     sw              r31,[sp]
1145
FFFFFFFFFFFFF6F0.0      0C7FFFFFDFC                     call    sGetChar
1146
FFFFFFFFFFFFF6F0.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1147
FFFFFFFFFFFFF6F0.2      01040200009                     or              r2,r1,r0
1148
FFFFFFFFFFFFF700.0      2F8000004AA                     bra             S1932b
1149
 
1150
FFFFFFFFFFFFF700.1                               S19Get24BitAddress:
1151
FFFFFFFFFFFFF700.1      03FBC000008                     subui   sp,sp,#8
1152
FFFFFFFFFFFFF700.2      19FBE000000                     sw              r31,[sp]
1153
FFFFFFFFFFFFF710.0      0C7FFFFFDFC                     call    sGetChar
1154
FFFFFFFFFFFFF710.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1155
FFFFFFFFFFFFF710.2      01040200009                     or              r2,r1,r0
1156
FFFFFFFFFFFFF720.0      2F80000024A                     bra             S1932a
1157
 
1158
FFFFFFFFFFFFF720.1                               S19Get32BitAddress:
1159
FFFFFFFFFFFFF720.1      03FBC000008                     subui   sp,sp,#8
1160
FFFFFFFFFFFFF720.2      19FBE000000                     sw              r31,[sp]
1161
FFFFFFFFFFFFF730.0      0C7FFFFFDFC                     call    sGetChar
1162
FFFFFFFFFFFFF730.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1163
FFFFFFFFFFFFF730.2      01040200009                     or              r2,r1,r0
1164
FFFFFFFFFFFFF740.0      0C7FFFFFDFC                     call    sGetChar
1165
FFFFFFFFFFFFF740.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1166
FFFFFFFFFFFFF740.2      01884200000                     shli    r2,r2,#4
1167
FFFFFFFFFFFFF750.0      01044200009                     or              r2,r1,r2
1168
FFFFFFFFFFFFF750.1      0C7FFFFFDFC                     call    sGetChar
1169
FFFFFFFFFFFFF750.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1170
FFFFFFFFFFFFF760.0      01884200000                     shli    r2,r2,#4
1171
FFFFFFFFFFFFF760.1      01082200009                     or              r2,r2,r1
1172
FFFFFFFFFFFFF760.2                               S1932a:
1173
FFFFFFFFFFFFF760.2      0C7FFFFFDFC                     call    sGetChar
1174
FFFFFFFFFFFFF770.0      0C7FFFFFD4E                     call    AsciiToHexNybble
1175
FFFFFFFFFFFFF770.1      01884200000                     shli    r2,r2,#4
1176
FFFFFFFFFFFFF770.2      01082200009                     or              r2,r2,r1
1177
FFFFFFFFFFFFF780.0      0C7FFFFFDFC                     call    sGetChar
1178
FFFFFFFFFFFFF780.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1179
FFFFFFFFFFFFF780.2      01884200000                     shli    r2,r2,#4
1180
FFFFFFFFFFFFF790.0      01082200009                     or              r2,r2,r1
1181
FFFFFFFFFFFFF790.1                               S1932b:
1182
FFFFFFFFFFFFF790.1      0C7FFFFFDFC                     call    sGetChar
1183
FFFFFFFFFFFFF790.2      0C7FFFFFD4E                     call    AsciiToHexNybble
1184
FFFFFFFFFFFFF7A0.0      01884200000                     shli    r2,r2,#4
1185
FFFFFFFFFFFFF7A0.1      01082200009                     or              r2,r2,r1
1186
FFFFFFFFFFFFF7A0.2      0C7FFFFFDFC                     call    sGetChar
1187
FFFFFFFFFFFFF7B0.0      0C7FFFFFD4E                     call    AsciiToHexNybble
1188
FFFFFFFFFFFFF7B0.1      01884200000                     shli    r2,r2,#4
1189
FFFFFFFFFFFFF7B0.2      01082200009                     or              r2,r2,r1
1190
FFFFFFFFFFFFF7C0.0      0C7FFFFFDFC                     call    sGetChar
1191
FFFFFFFFFFFFF7C0.1      0C7FFFFFD4E                     call    AsciiToHexNybble
1192
FFFFFFFFFFFFF7C0.2      01884200000                     shli    r2,r2,#4
1193
FFFFFFFFFFFFF7D0.0      01082200009                     or              r2,r2,r1
1194
FFFFFFFFFFFFF7D0.1      0110840000A                     xor             r4,r4,r4
1195
FFFFFFFFFFFFF7D0.2      01080500009                     or              r5,r2,r0
1196
FFFFFFFFFFFFF7E0.0      11FBE000000                     lw              r31,[sp]
1197
FFFFFFFFFFFFF7E0.1      02FBC000008                     addui   sp,sp,#8
1198
FFFFFFFFFFFFF7E0.2      0DFBE000000                     ret
1199
 
1200
                                                 ;------------------------------------------------------------------------------
1201
                                                 ; Get a character from auxillary input, checking the keyboard status for a
1202
                                                 ; CTRL-C
1203
                                                 ;------------------------------------------------------------------------------
1204
                                                 ;
1205
FFFFFFFFFFFFF7F0.0                               sGetChar:
1206
FFFFFFFFFFFFF7F0.0      03FBC000008                     subui   sp,sp,#8
1207
FFFFFFFFFFFFF7F0.1      19FBE000000                     sw              r31,[sp]
1208
FFFFFFFFFFFFF7F0.2                               sgc2:
1209
FFFFFFFFFFFFF7F0.2      0C7FFFFFAA6                     call    KeybdCheckForKey
1210
FFFFFFFFFFFFF800.0      2F841FF8B08                     beq             r1,r0,sgc1
1211
FFFFFFFFFFFFF800.1      0C7FFFFFA92                     call    KeybdGetchar
1212
FFFFFFFFFFFFF800.2      2C07A980000                     beqi    r1,#CRTLC,Monitor
1213
FFFFFFFFFFFFF810.0                               sgc1:
1214
FFFFFFFFFFFFF810.0      0C7FFFFFE30                     call    AUXIN
1215
FFFFFFFFFFFFF810.1      2F841FFFF48                     beq             r1,r0,sgc2
1216
FFFFFFFFFFFFF810.2      11FBE000000                     lw              r31,[sp]
1217
FFFFFFFFFFFFF820.0      02FBC000008                     addui   sp,sp,#8
1218
FFFFFFFFFFFFF820.1      0DFBE000000                     ret
1219
 
1220
                                                 ;--------------------------------------------------------------------------
1221
                                                 ; Sound a 800 Hz beep
1222
                                                 ;--------------------------------------------------------------------------
1223
                                                 ;
1224
FFFFFFFFFFFFF820.2                               SetupAC97:
1225
FFFFFFFFFFFFF820.2      05802000000                     ori             r1,r0,#0                ; trigger a read of register 26
1226
FFFFFFFFFFFFF830.0      18803DC1026                     sc              r1,AC97+0x26
1227
FFFFFFFFFFFFF830.1                               sac971:                                                ; wait for status to register 0xF (all ready)
1228
FFFFFFFFFFFFF830.1      10803DC1026                     lc              r1,AC97+0x26
1229
FFFFFFFFFFFFF830.2      2C84004000F                     bnei    r1,#0x0F,sac971
1230
FFFFFFFFFFFFF840.0      05802000000                     ori             r1,r0,#0                ; master volume, 0db attenuation, mute off
1231
FFFFFFFFFFFFF840.1      18803DC1002                     sc              r1,AC97+2
1232
FFFFFFFFFFFFF840.2      18803DC1004                     sc              r1,AC97+4               ; headphone volume, 0db attenuation, mute off
1233
FFFFFFFFFFFFF850.0      05802001F40                     ori             r1,r0,#8000             ; wait a while for the settings to take effect
1234
FFFFFFFFFFFFF850.1                               sac972:
1235
FFFFFFFFFFFFF850.1      2F80200002F                     loop    r1,sac972
1236
 
1237
FFFFFFFFFFFFF850.2                               Beep:
1238
FFFFFFFFFFFFF850.2      0580200000F                     ori             r1,r0,#15               ; master volume to max
1239
FFFFFFFFFFFFF860.0      18803D50080                     sc              r1,PSG+128
1240
FFFFFFFFFFFFF860.1      0580200346E                     ori             r1,r0,#13422    ; 800Hz
1241
FFFFFFFFFFFFF860.2      18803D50000                     sc              r1,PSG
1242
FFFFFFFFFFFFF870.0      05802000020                     ori             r1,r0,#32               ; attack (8.192 ms)
1243
FFFFFFFFFFFFF870.1      18803D50008                     sc              r1,PSG+8
1244
FFFFFFFFFFFFF870.2      05802000040                     ori             r1,r0,#64               ; decay  (16.384 ms)
1245
FFFFFFFFFFFFF880.0      18803D5000A                     sc              r1,PSG+10
1246
FFFFFFFFFFFFF880.1      058020000C0                     ori             r1,r0,#0xC0             ; sustain level
1247
FFFFFFFFFFFFF880.2      18803D5000C                     sc              r1,PSG+12
1248
FFFFFFFFFFFFF890.0      05802000FA0                     ori             r1,r0,#4000             ; release (1.024 s)
1249
FFFFFFFFFFFFF890.1      18803D5000E                     sc              r1,PSG+14
1250
FFFFFFFFFFFFF890.2      05802001104                     ori             r1,r0,#0x1104   ; gate, output enable, triangle waveform
1251
FFFFFFFFFFFFF8A0.0      18803D50004                     sc              r1,PSG+4
1252
FFFFFFFFFFFFF8A0.1      38000000000
1253
FFFFFFFFFFFFF8A0.2      058037D7840                     ori             r1,r0,#25000000 ; delay about 1s
1254
FFFFFFFFFFFFF8B0.0                               beep1:
1255
FFFFFFFFFFFFF8B0.0      2F80200000F                     loop    r1,beep1
1256
FFFFFFFFFFFFF8B0.1      05802000000                     ori             r1,r0,#0x0000   ; gate off, output enable off, no waveform
1257
FFFFFFFFFFFFF8B0.2      0DFBE000000                     ret
1258
 
1259
                                                 ;*
1260
                                                 ;* ===== Input a character from the host into register D0 (or
1261
                                                 ;*     return Zero status if there's no character available).
1262
                                                 ;*
1263
FFFFFFFFFFFFF8C0.0                               AUXIN:
1264
FFFFFFFFFFFFF8C0.0      20003DC0A01                     inb             r1,UART_LS              ; is character ready ?
1265
FFFFFFFFFFFFF8C0.1      05042000001                     andi    r1,r1,#rxfull
1266
FFFFFFFFFFFFF8C0.2      2F8400000C8                     beq             r1,r0,AXIRET    ;if not, return Zero status
1267
FFFFFFFFFFFFF8D0.0      20003DC0A00                     inb             r1,UART                 ; else get the character
1268
FFFFFFFFFFFFF8D0.1      0504200007F                     andi    r1,r1,#0x7f             ;zero out the high bit
1269
FFFFFFFFFFFFF8D0.2                               AXIRET:
1270
FFFFFFFFFFFFF8D0.2      0DFBE000000                     ret
1271
 
1272
                                                 ;*
1273
                                                 ;* ===== Return to the resident monitor, operating system, etc.
1274
                                                 ;*
1275
FFFFFFFFFFFFF8E0.0                               BYEBYE:
1276
FFFFFFFFFFFFF8E0.0      0CFFFFFFCA6                     jmp             Monitor
1277
                                                 ;    MOVE.B    #228,D7         ;return to Tutor
1278
                                                 ;      TRAP    #14
1279
 
1280
FFFFFFFFFFFFF8E0.1      37800000000                     align 16
1281
FFFFFFFFFFFFF8E0.2      37800000000                     align 16
1282
FFFFFFFFFFFFF8F0.0                                      align 16
1283
FFFFFFFFFFFFF8F0 726F747061520A0D        msgInit db     CR,LF,"Raptor64 Tiny BASIC v1.0",CR,LF,"(C) 2012  Robert Finch",CR,LF,LF,0
1284
FFFFFFFFFFFFF8F8 20796E6954203436
1285
FFFFFFFFFFFFF900 3176204349534142
1286
FFFFFFFFFFFFF908 202943280A0D302E
1287
FFFFFFFFFFFFF910 6F52202032313032
1288
FFFFFFFFFFFFF918 6E69462074726562
1289
FFFFFFFFFFFFF920 0A0D000A0A0D6863        OKMSG  db      CR,LF,"OK",CR,LF,0
1290
FFFFFFFFFFFFF928 616857000A0D4B4F        msgWhat        db      "What?",CR,LF,0
1291
FFFFFFFFFFFFF930 726F53000A0D3F74        SRYMSG db      "Sorry."
1292
FFFFFFFFFFFFF938 6F43000A0D2E7972        msgReadError   db      "Compact FLASH read error",CR,LF,0
1293
FFFFFFFFFFFFF940 4C4620746361706D
1294
FFFFFFFFFFFFF948 6461657220485341
1295
FFFFFFFFFFFFF950 0A0D726F72726520
1296
FFFFFFFFFFFFF958 207265626D754E00        msgNumTooBig   db      "Number is too big",CR,LF,0
1297
FFFFFFFFFFFFF960 62206F6F74207369
1298
FFFFFFFFFFFFF968 766944000A0D6769        msgDivZero             db      "Division by zero",CR,LF,0
1299
FFFFFFFFFFFFF970 7962206E6F697369
1300
FFFFFFFFFFFFF978 000A0D6F72657A20
1301
FFFFFFFFFFFFF980 7620666F2074754F        msgVarSpace     db  "Out of variable space",CR,LF,0
1302
FFFFFFFFFFFFF988 20656C6261697261
1303
FFFFFFFFFFFFF990 000A0D6563617073
1304
FFFFFFFFFFFFF998 6620736574796220        msgBytesFree   db      " bytes free",CR,LF,0
1305
FFFFFFFFFFFFF9A0 0A0D000A0D656572        msgReady               db      CR,LF,"Ready",CR,LF,0
1306
FFFFFFFFFFFFF9A8 000A0D7964616552
1307
FFFFFFFFFFFFF9B0 6E69746365707845        msgComma               db      "Expecting a comma",CR,LF,0
1308
FFFFFFFFFFFFF9B8 6D6D6F6320612067
1309
FFFFFFFFFFFFF9C0 656E694C000A0D61        msgLineRange   db      "Line number too big",CR,LF,0
1310
FFFFFFFFFFFFF9C8 207265626D756E20
1311
FFFFFFFFFFFFF9D0 0D676962206F6F74
1312
FFFFFFFFFFFFF9D8 746365707845000A        msgVar                 db      "Expecting a variable",CR,LF,0
1313
FFFFFFFFFFFFF9E0 6176206120676E69
1314
FFFFFFFFFFFFF9E8 0A0D656C62616972
1315
FFFFFFFFFFFFF9F0 64616220444E5200        msgRNDBad              db      "RND bad parameter",CR,LF,0
1316
FFFFFFFFFFFFF9F8 74656D6172617020
1317
FFFFFFFFFFFFFA00 535953000A0D7265        msgSYSBad              db      "SYS bad address",CR,LF,0
1318
FFFFFFFFFFFFFA08 6464612064616220
1319
FFFFFFFFFFFFFA10 49000A0D73736572        msgInputVar            db      "INPUT expecting a variable",CR,LF,0
1320
FFFFFFFFFFFFFA18 707865205455504E
1321
FFFFFFFFFFFFFA20 6120676E69746365
1322
FFFFFFFFFFFFFA28 6C62616972617620
1323
FFFFFFFFFFFFFA30 5458454E000A0D65        msgNextFor             db      "NEXT without FOR",CR,LF,0
1324
FFFFFFFFFFFFFA38 74756F6874697720
1325
FFFFFFFFFFFFFA40 4E000A0D524F4620        msgNextVar             db      "NEXT expecting a defined variable",CR,LF,0
1326
FFFFFFFFFFFFFA48 6570786520545845
1327
FFFFFFFFFFFFFA50 206120676E697463
1328
FFFFFFFFFFFFFA58 2064656E69666564
1329
FFFFFFFFFFFFFA60 656C626169726176
1330
FFFFFFFFFFFFFA68 2F4F544F47000A0D        msgBadGotoGosub        db      "GOTO/GOSUB bad line number",CR,LF,0
1331
FFFFFFFFFFFFFA70 6162204255534F47
1332
FFFFFFFFFFFFFA78 6E20656E696C2064
1333
FFFFFFFFFFFFFA80 000A0D7265626D75
1334
FFFFFFFFFFFFFA88 77204E5255544552        msgRetWoGosub   db     "RETURN without GOSUB",CR,LF,0
1335
FFFFFFFFFFFFFA90 472074756F687469
1336
FFFFFFFFFFFFFA98 50000A0D4255534F        msgTooBig              db      "Program is too big",CR,LF,0
1337
FFFFFFFFFFFFFAA0 69206D6172676F72
1338
FFFFFFFFFFFFFAA8 6962206F6F742073
1339
FFFFFFFFFFFFFAB0 72747845000A0D67        msgExtraChars  db      "Extra characters on line ignored",CR,LF,0
1340
FFFFFFFFFFFFFAB8 6361726168632061
1341
FFFFFFFFFFFFFAC0 206E6F2073726574
1342
FFFFFFFFFFFFFAC8 6E676920656E696C
1343
 
1344
FFFFFFFFFFFFFAD7.0                               INITMSG:
1345
FFFFFFFFFFFFFAD0 0D000A0D6465726F               db              CR,LF,'Raptor64 Tiny BASIC, v1.0',CR,LF,LF,0
1346
FFFFFFFFFFFFFADF.0                               OKMSG:
1347
FFFFFFFFFFFFFAD8 0D000A0A0D00520A               db              CR,LF,'OK',CR,LF,0
1348
FFFFFFFFFFFFFAE6.0                               HOWMSG:
1349
FFFFFFFFFFFFFAE0 0048000A0D004F0A               db              'How?',CR,LF,0
1350
FFFFFFFFFFFFFAEB.0                               WHTMSG:
1351
FFFFFFFFFFFFFAE8 000A0D0057000A0D               db              'What?',CR,LF,0
1352
FFFFFFFFFFFFFAF0.0                               SRYMSG:
1353
FFFFFFFFFFFFFAF2.0                               CLMSG:
1354
                                                 ;      DC.B    0        ;<- for aligning on a word boundary
1355
FFFFFFFFFFFFFAF0 000000000A0D0053               align   16
1356
FFFFFFFFFFFFFAF8 0000000000000000
1357
FFFFFFFFFFFFFB00.0                                      align   16
1358
 
1359
                                                 LSTROM EQU             $
1360
                                                        ;       end of possible ROM area
1361
 
1362
0000000000000110                                        bss
1363
0000000000000110                                        align   16
1364
 
1365
0000000000000080                                                org             0x0080
1366
0000000000000088                                         align   8
1367
0000000000000088 0000000000000001        OSSP   dw      1       ; OS value of sp
1368
0000000000000090 0000000000000001        CURRNT dw      1       ;       Current line pointer
1369
0000000000000098 0000000000000001        STKGOS dw      1       ;       Saves stack pointer in 'GOSUB'
1370
00000000000000A0 0000000000000001        STKINP dw      1       ;       Saves stack pointer during 'INPUT'
1371
00000000000000A8 0000000000000001        LOPVAR dw      1       ;       'FOR' loop save area
1372
00000000000000B0 0000000000000001        LOPINC dw      1       ;       increment
1373
00000000000000B8 0000000000000001        LOPLMT dw      1       ;       limit
1374
00000000000000C0 0000000000000001        LOPLN  dw      1       ;       line number
1375
00000000000000C8 0000000000000001        LOPPT  dw      1       ;       text pointer
1376
00000000000000D0 0000000000000001        TXTUNF dw      1       ;       points to unfilled text area
1377
00000000000000D8 0000000000000001        VARBGN dw      1       ;       points to variable area
1378
00000000000000E0 0000000000000001        IVARBGN dw  1   ;   points to integer variable area
1379
00000000000000E8 0000000000000001        SVARBGN dw  1   ;   points to string variable area
1380
00000000000000F0 0000000000000001        FVARBGN dw  1   ;   points to float variable area
1381
00000000000000F8 0000000000000001        STKBOT dw      1       ;       holds lower limit for stack growth
1382
FF 0000000000000000      NUMWKA fill.b  12,0                    ; numeric work area
1383
107 00000000000000
1384
107 0000000000000000     BUFFER fill.b  BUFLEN,0x00             ;               Keyboard input buffer
1385
10F 00
1386
 
1387
 
1388
                                                 ;==============================================================================
1389 10 robfinch
                                                 ; Checkerboard RAM tester
1390
                                                 ;==============================================================================
1391
                                                 ;
1392 27 robfinch
FFFFFFFFFFFFFB00.0                                      code
1393
FFFFFFFFFFFFFB00.0                                      align   16
1394
FFFFFFFFFFFFFB00.0                               ramtest:
1395
FFFFFFFFFFFFFB00.0      01000800009                     or              r8,r0,r0                ; r8 = 0
1396
FFFFFFFFFFFFFB00.1      3D5552AAAD5
1397
FFFFFFFFFFFFFB00.2      05802AA5555                     ori             r1,r0,#0xAAAA5555AAAA5555       ; checkerboard pattern
1398
FFFFFFFFFFFFFB10.0                               ramtest2:
1399
FFFFFFFFFFFFFB10.0      19A02000000                     sw              r1,[r8]                 ; save the checkerboard to memory
1400
FFFFFFFFFFFFFB10.1      11A04000000                     lw              r2,[r8]                 ; read it back
1401
FFFFFFFFFFFFFB10.2      01044300006                     cmp             r3,r1,r2                ; is it the same ?
1402
FFFFFFFFFFFFFB20.0      2F8C00000C9                     bne     r3,r0,ramtest1
1403
FFFFFFFFFFFFFB20.1      02A10000008                     addui   r8,r8,#8                ; increment RAM pointer
1404
FFFFFFFFFFFFFB20.2      38000000002
1405
FFFFFFFFFFFFFB30.0      04206000000                     cmpi    r3,r8,#0x0000_0000_0400_0000
1406
FFFFFFFFFFFFFB30.1      2F8C1FFFF00                     blt             r3,r0,ramtest2
1407
FFFFFFFFFFFFFB30.2                               ramtest1:
1408
FFFFFFFFFFFFFB30.2      01200A00009                     or              r10,r8,r0               ; r10 = max ram address
1409 10 robfinch
                                                        ; readback the checkerboard pattern
1410 27 robfinch
FFFFFFFFFFFFFB40.0      01000800009                     or              r8,r0,r0                ; r8 = 0
1411
FFFFFFFFFFFFFB40.1                               ramtest4:
1412
FFFFFFFFFFFFFB40.1      11A04000000                     lw              r2,[r8]
1413
FFFFFFFFFFFFFB40.2      3D5552AAAD5
1414
FFFFFFFFFFFFFB50.0      04086AA5555                     cmpi    r3,r2,#0xAAAA5555AAAA5555
1415
FFFFFFFFFFFFFB50.1      2F8C0000109                     bne             r3,r0,ramtest3
1416
FFFFFFFFFFFFFB50.2      02210000008                     addi    r8,r8,#8
1417
FFFFFFFFFFFFFB60.0      38000000000
1418
FFFFFFFFFFFFFB60.1      04207000000                     cmpi    r3,r8,#0x0000_0000_0100_0000
1419
FFFFFFFFFFFFFB60.2      2F8C1FFFF20                     blt     r3,r0,ramtest4
1420
FFFFFFFFFFFFFB70.0                               ramtest3:
1421
FFFFFFFFFFFFFB70.0      2FA140003A9                     bne             r8,r10,ramtest8 ; check for equal maximum address
1422 10 robfinch
 
1423
                                                        ; perform ramtest again with inverted checkerboard
1424 27 robfinch
FFFFFFFFFFFFFB70.1      01000800009                     or              r8,r0,r0                ; r8 = 0
1425
FFFFFFFFFFFFFB70.2      3AAAAD5552A
1426
FFFFFFFFFFFFFB80.0      0580355AAAA                     ori             r1,r0,#0x5555AAAA5555AAAA
1427
FFFFFFFFFFFFFB80.1                               ramtest5:
1428
FFFFFFFFFFFFFB80.1      19A02000000                     sw              r1,[r8]
1429
FFFFFFFFFFFFFB80.2      11A04000000                     lw              r2,[r8]
1430
FFFFFFFFFFFFFB90.0      01044300006                     cmp             r3,r1,r2
1431
FFFFFFFFFFFFFB90.1      2F8C0000109                     bne             r3,r0,ramtest6
1432
FFFFFFFFFFFFFB90.2      02210000008                     addi    r8,r8,#8
1433
FFFFFFFFFFFFFBA0.0      38000000000
1434
FFFFFFFFFFFFFBA0.1      04207000000                     cmpi    r3,r8,#0x0000_0000_0100_0000
1435
FFFFFFFFFFFFFBA0.2      2F8C1FFFF20                     blt             r3,r0,ramtest5
1436
FFFFFFFFFFFFFBB0.0                               ramtest6:
1437
FFFFFFFFFFFFFBB0.0      01200B00009                     or              r11,r8,r0               ; r11 = max ram address
1438 10 robfinch
                                                        ; readback checkerboard
1439 27 robfinch
FFFFFFFFFFFFFBB0.1      01000800009                     or              r8,r0,r0
1440
FFFFFFFFFFFFFBB0.2                               ramtest7:
1441
FFFFFFFFFFFFFBB0.2      11A04000000                     lw              r2,[r8]
1442
FFFFFFFFFFFFFBC0.0      3AAAAD5552A
1443
FFFFFFFFFFFFFBC0.1      0408755AAAA                     cmpi    r3,r2,#0x5555AAAA5555AAAA
1444
FFFFFFFFFFFFFBC0.2      2F8C0000129                     bne             r3,r0,ramtest8
1445
FFFFFFFFFFFFFBD0.0      02210000008                     addi    r8,r8,#8
1446
FFFFFFFFFFFFFBD0.1      38000000000
1447
FFFFFFFFFFFFFBD0.2      04207000000                     cmpi    r3,r8,#0x0000_0000_0100_0000
1448
FFFFFFFFFFFFFBE0.0      2F8C1FFFEC0                     blt             r3,r0,ramtest7
1449
FFFFFFFFFFFFFBE0.1                               ramtest8:
1450
FFFFFFFFFFFFFBE0.1      2FA16000088                     beq             r8,r11,ramtest9
1451
FFFFFFFFFFFFFBE0.2      01216800014                     min             r8,r8,r11
1452
FFFFFFFFFFFFFBF0.0                               ramtest9:
1453
FFFFFFFFFFFFFBF0.0      2FA14000048                     beq             r8,r10,ramtest10
1454
FFFFFFFFFFFFFBF0.1      01214800014                     min             r8,r8,r10
1455
FFFFFFFFFFFFFBF0.2                               ramtest10:
1456
FFFFFFFFFFFFFBF0.2      19810000400                     sw              r8,0x00000400   ;memend
1457
FFFFFFFFFFFFFC00.0      0DFBE000000                     ret
1458
 
1459
                                                 ;-------------------------------------------
1460
                                                 ; IRQ routine
1461
                                                 ;-------------------------------------------
1462
FFFFFFFFFFFFFC00.1                               irqrout:
1463
FFFFFFFFFFFFFC00.1      03FBC000010                     subui   sp,sp,#16
1464
FFFFFFFFFFFFFC00.2      27F40000001                     sm              [sp],r1/lr
1465
FFFFFFFFFFFFFC10.0      20803DC0FF0                     inch    r1,PIC
1466
FFFFFFFFFFFFFC10.1      2C06C140001                     beqi    r1,#1,ColdStart
1467
FFFFFFFFFFFFFC10.2                               irqrout3:
1468
FFFFFFFFFFFFFC10.2      2C840180002                     bnei    r1,#2,irqrout2
1469
FFFFFFFFFFFFFC20.0      0C7FFFFFACC                     call    Pulse1000
1470
FFFFFFFFFFFFFC20.1      2F8000000AA                     bra             irqrout1
1471
FFFFFFFFFFFFFC20.2                               irqrout2:
1472
FFFFFFFFFFFFFC20.2      2C84014000F                     bnei    r1,#15,irqrout1
1473
FFFFFFFFFFFFFC30.0      0C7FFFFFA75                     call    KeybdIRQ
1474
FFFFFFFFFFFFFC30.1                               irqrout1:
1475
FFFFFFFFFFFFFC30.1      27740000001                     lm              [sp],r1/lr
1476
FFFFFFFFFFFFFC30.2      02FBC000010                     addui   sp,sp,#16
1477
FFFFFFFFFFFFFC40.0      00000000020                     iret
1478
 
1479
                                                 ;-------------------------------------------
1480
                                                 ; NMI routine
1481
                                                 ;-------------------------------------------
1482
FFFFFFFFFFFFFC40.1                               nmirout:
1483
FFFFFFFFFFFFFC40.1      00000000020                     iret
1484
 
1485
                                                 ;-------------------------------------------
1486
                                                 ; Handle miss on Data TLB
1487
                                                 ;-------------------------------------------
1488
FFFFFFFFFFFFFC40.2                               DTLBHandler:
1489
FFFFFFFFFFFFFC40.2      19803FF0000                     sw              r1,0xFFFF_FFFF_FFFF_0000
1490
FFFFFFFFFFFFFC50.0      19805FF0008                     sw              r2,0xFFFF_FFFF_FFFF_0008
1491
FFFFFFFFFFFFFC50.1                               dh1:
1492
FFFFFFFFFFFFFC50.1      00802000034                     omgi    r1,#0           ; try open mutex gate #0 (TLB protector)
1493
FFFFFFFFFFFFFC50.2      2F840000029                     bne             r1,r0,dh1       ; spinlock if gate is closed
1494
FFFFFFFFFFFFFC60.0      00802000228                     mfspr   r1,PTA          ; get the page table address
1495
FFFFFFFFFFFFFC60.1      00804000428                     mfspr   r2,BadVAddr     ; get the bad virtual address
1496
FFFFFFFFFFFFFC60.2      008800005A9                     mtspr   TLBVirtPage,r2  ; which virtual address to update
1497
FFFFFFFFFFFFFC70.0      01884680001                     shrui   r2,r2,#13       ; turn va into index
1498
FFFFFFFFFFFFFC70.1      01044100003                     addu    r1,r1,r2
1499
FFFFFFFFFFFFFC70.2      11844000000                     lw              r2,[r1]         ; get the physical address from the table
1500
FFFFFFFFFFFFFC80.0      05084000000                     and             r2,r2,#FFFF_FFFF_FFFF_E000      ; mask off lower bits
1501
FFFFFFFFFFFFFC80.1      00880000529                     mtspr   TLBPhysPage0,r2 ;
1502
FFFFFFFFFFFFFC80.2      11844000008                     lw              r2,8[r1]        ; get the physical address from the table
1503
FFFFFFFFFFFFFC90.0      05084000000                     and             r2,r2,#FFFF_FFFF_FFFF_E000      ; mask off lower bits
1504
FFFFFFFFFFFFFC90.1      008800005A9                     mtspr   TLBPhysPage1,r2 ;
1505
FFFFFFFFFFFFFC90.2      00800000034                     tlbwr                           ; update a random entry in the TLB
1506
FFFFFFFFFFFFFCA0.0      00800000035                     cmgi    #0                      ; close the mutex gate
1507
FFFFFFFFFFFFFCA0.1      11803FF0000                     lw              r1,0xFFFF_FFFF_FFFF_0000
1508
FFFFFFFFFFFFFCA0.2      11805FF0008                     lw              r2,0xFFFF_FFFF_FFFF_0008
1509
FFFFFFFFFFFFFCB0.0      00000000020                     iret
1510
FFFFFFFFFFFFFCB0.1      37800000000                     nop
1511
FFFFFFFFFFFFFCB0.2      37800000000                     nop
1512 10 robfinch
 
1513 27 robfinch
FFFFFFFFFFFFFFB0.0                                      org             0xFFFF_FFFF_FFFF_FFB0
1514
FFFFFFFFFFFFFFB0.0      0CFFFFFFF12                     jmp             DTLBHandler
1515
FFFFFFFFFFFFFFB0.1      37800000000                     nop
1516
FFFFFFFFFFFFFFB0.2      37800000000                     nop
1517 10 robfinch
FFFFFFFFFFFFFFC0.0                                      org             0xFFFF_FFFF_FFFF_FFC0
1518 27 robfinch
FFFFFFFFFFFFFFC0.0      0CFFFFFFF12                     jmp             DTLBHandler
1519 10 robfinch
FFFFFFFFFFFFFFC0.1      37800000000                     nop
1520
FFFFFFFFFFFFFFC0.2      37800000000                     nop
1521 27 robfinch
FFFFFFFFFFFFFFD0.0                                      org     0xFFFF_FFFF_FFFF_FFD0
1522
FFFFFFFFFFFFFFD0.0      0CFFFFFFF01                     jmp             irqrout
1523 10 robfinch
FFFFFFFFFFFFFFD0.1      37800000000                     nop
1524
FFFFFFFFFFFFFFD0.2      37800000000                     nop
1525 27 robfinch
FFFFFFFFFFFFFFE0.0                                      org     0xFFFF_FFFF_FFFF_FFE0
1526
FFFFFFFFFFFFFFE0.0      0CFFFFFFF11                     jmp             nmirout
1527 10 robfinch
FFFFFFFFFFFFFFE0.1      37800000000                     nop
1528
FFFFFFFFFFFFFFE0.2      37800000000                     nop
1529
FFFFFFFFFFFFFFF0.0                                      org             0xFFFF_FFFF_FFFF_FFF0
1530 27 robfinch
FFFFFFFFFFFFFFF0.0      0CFFFFFFA09                     jmp             start
1531
FFFFFFFFFFFFFFF0.1      37800000000                     nop
1532
FFFFFFFFFFFFFFF0.2      37800000000                     nop
1533 10 robfinch
 
1534 27 robfinch
 
1535
 
1536
0000000000000000.0      00000000000
1537
0000000000000000.1      00000000000
1538
 
1539
 
1540
Symbol Table:
1541
==========================================================
1542
Name                   Typ  Segment     Address/Value
1543
----------------------------------------------------------
1544
CR                      C       constant        000000000000000D
1545
LF                      C       constant        000000000000000A
1546
TAB                     C       constant        0000000000000009
1547
CTRLC                   C       constant        0000000000000003
1548
CTRLH                   C       constant        0000000000000008
1549
CTRLS                   C       constant        0000000000000013
1550
CTRLX                   C       constant        0000000000000018
1551
STACKTOP                C       constant        FFFFFFFFFFFEFFF8
1552
Milliseconds            C       constant        0000000000000400
1553
Lastloc                 C       constant        0000000000000408
1554
ScreenColor             C       constant        0000000000000414
1555
CursorRow               C       constant        0000000000000416
1556
CursorCol               C       constant        0000000000000418
1557
KeybdEcho               C       constant        000000000000041A
1558
KeybdBuffer             C       constant        0000000000000440
1559
KeybdHead               C       constant        0000000000000450
1560
KeybdTail               C       constant        0000000000000451
1561
TEXTSCR                 C       constant        FFFFFFFFFFD00000
1562
COLORSCR                C       constant        FFFFFFFFFFD10000
1563
TEXTREG                 C       constant        FFFFFFFFFFDA0000
1564
TEXT_COLS               C       constant        0000000000000000
1565
TEXT_ROWS               C       constant        0000000000000002
1566
TEXT_CURPOS             C       constant        0000000000000016
1567
KEYBD                   C       constant        FFFFFFFFFFDC0000
1568
KEYBDCLR                C       constant        FFFFFFFFFFDC0002
1569
UART                    C       constant        FFFFFFFFFFDC0A00
1570
UART_LS                 C       constant        FFFFFFFFFFDC0A01
1571
PIC                     C       constant        FFFFFFFFFFDC0FF0
1572
PSG                     C       constant        FFFFFFFFFFD50000
1573
AC97                    C       constant        FFFFFFFFFFDC1000
1574
BOOT_STACK              C       constant        FFFFFFFFFFFEFFF8
1575
BITMAPSCR               C       constant        0000000100200000
1576
txempty                 C       constant        0000000000000040
1577
rxfull                  C       constant        0000000000000001
1578
SerialGetChar           L       code            FFFFFFFFFFFFE950.0
1579
SerialPutChar           L       code            FFFFFFFFFFFFE980.0
1580
SetKeyboardEcho         L       code            FFFFFFFFFFFFEA40.0
1581
KeybdCheckForKey        L       code            FFFFFFFFFFFFEA90.2
1582
KeybdGetChar            L       code            FFFFFFFFFFFFEA40.2
1583
DisplayChar             L       code            FFFFFFFFFFFFED90.1
1584
DisplayString           L       code            FFFFFFFFFFFFEFD0.1
1585
start                   L       code            FFFFFFFFFFFFE820.1
1586
ColdStart               L       code            FFFFFFFFFFFFE820.1
1587
KeybdInit               L       code            FFFFFFFFFFFFE9B0.2
1588
PICInit                 L       code            FFFFFFFFFFFFE940.0
1589
dcokay                  L       code            FFFFFFFFFFFFE870.1
1590
ClearScreen             L       code            FFFFFFFFFFFFEC10.2
1591
ClearBmpScreen          L       code            FFFFFFFFFFFFEBD0.0
1592
j4                      L       code            FFFFFFFFFFFFE8C0.2
1593
Monitor                 L       code            FFFFFFFFFFFFF290.2
1594
HelloWorld              L       code            FFFFFFFFFFFFE8D0.1
1595
j3                      L       code            FFFFFFFFFFFFE8E0.1
1596
j2                      L       code            FFFFFFFFFFFFE900.0
1597
MSG                     L       code            FFFFFFFFFFFFE910.0
1598
MSGSTART                L       code            FFFFFFFFFFFFE920.0
1599
sgc1                    L       code            FFFFFFFFFFFFF810.0
1600
spc1                    L       code            FFFFFFFFFFFFE990.1
1601
KeybdIRQ                L       code            FFFFFFFFFFFFE9D0.1
1602
KeybdIRQa               L       code            FFFFFFFFFFFFE9F0.1
1603
KeybdIRQb               L       code            FFFFFFFFFFFFEA10.1
1604
KeybdIRQc               L       code            FFFFFFFFFFFFEA30.0
1605
nochar                  L       code            FFFFFFFFFFFFEA80.2
1606
kck1                    L       code            FFFFFFFFFFFFEAB0.1
1607
KeybdCheckForKeyDirect  L       code            FFFFFFFFFFFFEAC0.0
1608
cfkd1                   L       code            FFFFFFFFFFFFEAD0.1
1609
KeybdGetCharDirect      L       code            FFFFFFFFFFFFEAE0.0
1610
kgc1                    L       code            FFFFFFFFFFFFEAF0.0
1611
gk1                     L       code            FFFFFFFFFFFFEB20.1
1612
gk2                     L       code            FFFFFFFFFFFFEB20.0
1613
CRLF                    L       code            FFFFFFFFFFFFF020.1
1614
Pulse1000               L       code            FFFFFFFFFFFFEB30.0
1615
p10001                  L       code            FFFFFFFFFFFFEB70.2
1616
FlashCursor             L       code            FFFFFFFFFFFFEB80.1
1617
CalcScreenLoc           L       code            FFFFFFFFFFFFED50.1
1618
flshcrsr1               L       code            FFFFFFFFFFFFEBC0.1
1619
csj4                    L       code            FFFFFFFFFFFFEC50.0
1620
AsciiToScreen           L       code            FFFFFFFFFFFFED10.1
1621
ScrollUp                L       code            FFFFFFFFFFFFEC70.0
1622
scrup1                  L       code            FFFFFFFFFFFFEC90.2
1623
BlankLine               L       code            FFFFFFFFFFFFECD0.0
1624
blnkln1                 L       code            FFFFFFFFFFFFECF0.2
1625
atoscr1                 L       code            FFFFFFFFFFFFED30.1
1626
ScreenToAscii           L       code            FFFFFFFFFFFFED40.0
1627
stasc1                  L       code            FFFFFFFFFFFFED50.0
1628
dccr                    L       code            FFFFFFFFFFFFEDB0.0
1629
dcx7                    L       code            FFFFFFFFFFFFEDD0.1
1630
dcx6                    L       code            FFFFFFFFFFFFEDE0.1
1631
dcx8                    L       code            FFFFFFFFFFFFEE10.0
1632
dcx9                    L       code            FFFFFFFFFFFFEE30.2
1633
dcx10                   L       code            FFFFFFFFFFFFEE60.1
1634
dcx11                   L       code            FFFFFFFFFFFFEE90.1
1635
dcx12                   L       code            FFFFFFFFFFFFEE80.2
1636
dcx13                   L       code            FFFFFFFFFFFFEEB0.2
1637
dcx5                    L       code            FFFFFFFFFFFFEEE0.1
1638
dcx3                    L       code            FFFFFFFFFFFFEF10.2
1639
dcx4                    L       code            FFFFFFFFFFFFEF50.1
1640
dclf                    L       code            FFFFFFFFFFFFEF50.0
1641
IncCursorPos            L       code            FFFFFFFFFFFFEF60.0
1642
IncCursorRow            L       code            FFFFFFFFFFFFEF90.0
1643
icc1                    L       code            FFFFFFFFFFFFEFC0.1
1644
icr1                    L       code            FFFFFFFFFFFFEF90.2
1645
dspj1                   L       code            FFFFFFFFFFFFEFE0.1
1646
dsret                   L       code            FFFFFFFFFFFFF000.0
1647
DisplayStringCRLF       L       code            FFFFFFFFFFFFF000.2
1648
DisplayNybble           L       code            FFFFFFFFFFFFF050.2
1649
dispnyb1                L       code            FFFFFFFFFFFFF080.0
1650
DisplayByte             L       code            FFFFFFFFFFFFF090.1
1651
DisplayWord             L       code            FFFFFFFFFFFFF0C0.0
1652
dspwd1                  L       code            FFFFFFFFFFFFF0D0.0
1653
DisplayMem              L       code            FFFFFFFFFFFFF0E0.2
1654
dspmem1                 L       code            FFFFFFFFFFFFF110.0
1655
BinToBCD                L       code            FFFFFFFFFFFFF140.0
1656
bta1                    L       code            FFFFFFFFFFFFF150.1
1657
BCDToAscii              L       code            FFFFFFFFFFFFF1B0.0
1658
bta2                    L       code            FFFFFFFFFFFFF1C0.0
1659
BinToStr                L       code            FFFFFFFFFFFFF200.2
1660
btos3                   L       code            FFFFFFFFFFFFF230.0
1661
btos1                   L       code            FFFFFFFFFFFFF230.1
1662
btos2                   L       code            FFFFFFFFFFFFF270.1
1663
PromptLn                L       code            FFFFFFFFFFFFF2A0.1
1664
Prompt3                 L       code            FFFFFFFFFFFFF2B0.1
1665
Prompt1                 L       code            FFFFFFFFFFFFF2D0.0
1666
Prompt2                 L       code            FFFFFFFFFFFFF300.1
1667
Editmem                 L       code            FFFFFFFFFFFFF450.0
1668
Dumpmem                 L       code            FFFFFFFFFFFFF4A0.0
1669
ExecuteCode             L       code            FFFFFFFFFFFFF480.1
1670
LoadS19                 L       code            FFFFFFFFFFFFF590.0
1671
DisplayHelp             L       code            FFFFFFFFFFFFF370.1
1672
TestCLS                 L       code            FFFFFFFFFFFFF330.0
1673
HelpMsg                 L       code            FFFFFFFFFFFFF390.0
1674
ignBlanks               L       code            FFFFFFFFFFFFF420.0
1675
ignBlanks1              L       code            FFFFFFFFFFFFF420.2
1676
GetHexNumber            L       code            FFFFFFFFFFFFF4E0.1
1677
edtmem1                 L       code            FFFFFFFFFFFFF460.1
1678
gthxn2                  L       code            FFFFFFFFFFFFF4F0.2
1679
AsciiToHexNybble        L       code            FFFFFFFFFFFFF530.2
1680
gthxn1                  L       code            FFFFFFFFFFFFF520.2
1681
gthx3                   L       code            FFFFFFFFFFFFF580.1
1682
gthx5                   L       code            FFFFFFFFFFFFF550.0
1683
gthx6                   L       code            FFFFFFFFFFFFF560.2
1684
ProcessRec              L       code            FFFFFFFFFFFFF5A0.0
1685
NextRec                 L       code            FFFFFFFFFFFFF590.1
1686
sGetChar                L       code            FFFFFFFFFFFFF7F0.0
1687
ProcessS1               L       code            FFFFFFFFFFFFF690.1
1688
ProcessS2               L       code            FFFFFFFFFFFFF6A0.0
1689
ProcessS3               L       code            FFFFFFFFFFFFF6A0.2
1690
ProcessS7               L       code            FFFFFFFFFFFFF6B0.1
1691
ProcessS8               L       code            FFFFFFFFFFFFF6C0.1
1692
ProcessS9               L       code            FFFFFFFFFFFFF6D0.1
1693
pcssxa                  L       code            FFFFFFFFFFFFF620.0
1694
pcss1a                  L       code            FFFFFFFFFFFFF620.2
1695
S19Get16BitAddress      L       code            FFFFFFFFFFFFF6E0.1
1696
S19Get24BitAddress      L       code            FFFFFFFFFFFFF700.1
1697
S19Get32BitAddress      L       code            FFFFFFFFFFFFF720.1
1698
S1932b                  L       code            FFFFFFFFFFFFF790.1
1699
S1932a                  L       code            FFFFFFFFFFFFF760.2
1700
sgc2                    L       code            FFFFFFFFFFFFF7F0.2
1701
AUXIN                   L       code            FFFFFFFFFFFFF8C0.0
1702
SetupAC97               L       code            FFFFFFFFFFFFF820.2
1703
sac971                  L       code            FFFFFFFFFFFFF830.1
1704
sac972                  L       code            FFFFFFFFFFFFF850.1
1705
Beep                    L       code            FFFFFFFFFFFFF850.2
1706
beep1                   L       code            FFFFFFFFFFFFF8B0.0
1707
AXIRET                  L       code            FFFFFFFFFFFFF8D0.2
1708
BYEBYE                  L       code            FFFFFFFFFFFFF8E0.0
1709
msgInit                 L       code            FFFFFFFFFFFFF8F0.0
1710
OKMSG                   L       code            FFFFFFFFFFFFFADF.0
1711
msgWhat                 L       code            FFFFFFFFFFFFF92D.0
1712
SRYMSG                  L       code            FFFFFFFFFFFFFAF0.0
1713
CLMSG                   L       code            FFFFFFFFFFFFFAF2.0
1714
msgReadError            L       code            FFFFFFFFFFFFF93E.0
1715
msgNumTooBig            L       code            FFFFFFFFFFFFF959.0
1716
msgDivZero              L       code            FFFFFFFFFFFFF96D.0
1717
msgVarSpace             L       code            FFFFFFFFFFFFF980.0
1718
msgBytesFree            L       code            FFFFFFFFFFFFF998.0
1719
msgReady                L       code            FFFFFFFFFFFFF9A6.0
1720
msgComma                L       code            FFFFFFFFFFFFF9B0.0
1721
msgLineRange            L       code            FFFFFFFFFFFFF9C4.0
1722
msgVar                  L       code            FFFFFFFFFFFFF9DA.0
1723
msgRNDBad               L       code            FFFFFFFFFFFFF9F1.0
1724
msgSYSBad               L       code            FFFFFFFFFFFFFA05.0
1725
msgInputVar             L       code            FFFFFFFFFFFFFA17.0
1726
msgNextFor              L       code            FFFFFFFFFFFFFA34.0
1727
msgNextVar              L       code            FFFFFFFFFFFFFA47.0
1728
msgBadGotoGosub         L       code            FFFFFFFFFFFFFA6B.0
1729
msgRetWoGosub           L       code            FFFFFFFFFFFFFA88.0
1730
msgTooBig               L       code            FFFFFFFFFFFFFA9F.0
1731
msgExtraChars           L       code            FFFFFFFFFFFFFAB4.0
1732
INITMSG                 L       code            FFFFFFFFFFFFFAD7.0
1733
HOWMSG                  L       code            FFFFFFFFFFFFFAE6.0
1734
WHTMSG                  L       code            FFFFFFFFFFFFFAEB.0
1735
LSTROM                  C       constant        0000000000000000
1736
typef                   L       bss             0000000000000080
1737
OSSP                    L       bss             0000000000000088
1738
CURRNT                  L       bss             0000000000000090
1739
STKGOS                  L       bss             0000000000000098
1740
STKINP                  L       bss             00000000000000A0
1741
LOPVAR                  L       bss             00000000000000A8
1742
LOPINC                  L       bss             00000000000000B0
1743
LOPLMT                  L       bss             00000000000000B8
1744
LOPLN                   L       bss             00000000000000C0
1745
LOPPT                   L       bss             00000000000000C8
1746
TXTUNF                  L       bss             00000000000000D0
1747
VARBGN                  L       bss             00000000000000D8
1748
IVARBGN                 L       bss             00000000000000E0
1749
SVARBGN                 L       bss             00000000000000E8
1750
FVARBGN                 L       bss             00000000000000F0
1751
STKBOT                  L       bss             00000000000000F8
1752
NUMWKA                  L       bss             0000000000000100
1753
BUFFER                  L       bss             000000000000010E
1754
ramtest                 L       code            FFFFFFFFFFFFFB00.0
1755
ramtest2                L       code            FFFFFFFFFFFFFB10.0
1756
ramtest1                L       code            FFFFFFFFFFFFFB30.2
1757
ramtest4                L       code            FFFFFFFFFFFFFB40.1
1758
ramtest3                L       code            FFFFFFFFFFFFFB70.0
1759
ramtest8                L       code            FFFFFFFFFFFFFBE0.1
1760
ramtest5                L       code            FFFFFFFFFFFFFB80.1
1761
ramtest6                L       code            FFFFFFFFFFFFFBB0.0
1762
ramtest7                L       code            FFFFFFFFFFFFFBB0.2
1763
ramtest9                L       code            FFFFFFFFFFFFFBF0.0
1764
ramtest10               L       code            FFFFFFFFFFFFFBF0.2
1765
irqrout                 L       code            FFFFFFFFFFFFFC00.1
1766
irqrout3                L       code            FFFFFFFFFFFFFC10.2
1767
irqrout2                L       code            FFFFFFFFFFFFFC20.2
1768
irqrout1                L       code            FFFFFFFFFFFFFC30.1
1769
nmirout                 L       code            FFFFFFFFFFFFFC40.1
1770
DTLBHandler             L       code            FFFFFFFFFFFFFC40.2
1771
dh1                     L       code            FFFFFFFFFFFFFC50.1

powered by: WebSVN 2.1.0

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