Mercurial > repos > blastem
annotate upd78k2.cpu @ 2707:a64c0e1ed6ac default tip
Implement speed control and reset for media player. Fix other bindings that could cause it to crash
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 06 Jul 2025 20:43:37 -0700 |
parents | 0bd48217941a |
children |
rev | line source |
---|---|
2705 | 1 #"Minimum instruction cycle is 333 ns for internal ROM 500 ns for external at 12 MHz" |
2 #That's 4 clks for internal ROM, 6 clocks external | |
3 #Above seems to be defined based on external clock input, but there's an internal divider | |
4 #Instruction timing tables seem to specified in terms of this divided clock | |
5 info | |
6 prefix upd78k2_ | |
7 opcode_size 8 | |
8 header upd78k2.h | |
9 body upd78k2_run_op | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
10 sync_cycle upd78k2_sync_cycle |
2705 | 11 extra_tables sfr bit1 bit2 muldiv base sfrbit spmov indexed regind alt_base alt_indexed alt_regind mov_reg |
12 include upd78k2_util.c | |
13 regs | |
14 main 8 x a c b e d l h | |
15 psw 8 | |
16 pc 16 | |
17 sp 16 | |
18 rbs 8 | |
19 int_enable 8 | |
20 int_priority_flag 8 | |
21 chflags 8 | |
22 zflag 8 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
23 stbc 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
24 int_cycle 32 |
2705 | 25 scratch1 32 |
26 scratch2 32 | |
27 mem_pointers ptr8 4 | |
28 port_data 8 8 | |
29 port_mode 8 8 | |
30 mm 8 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
31 if0 16 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
32 mk0 16 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
33 pr0 16 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
34 ism0 16 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
35 intm0 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
36 intm1 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
37 ist 8 |
2705 | 38 iram 8 256 |
39 flags | |
40 register psw | |
41 I 7 none int_enable | |
42 Z 6 zero zflag | |
43 R 5 none rbs.1 | |
44 A 4 half-carry chflags.3 | |
45 B 3 none rbs.0 | |
46 P 1 none int_priority_flag | |
47 C 0 carry chflags.7 | |
48 declare | |
49 uint8_t upd78237_sfr_read(uint32_t address, void *context); | |
50 void *upd78237_sfr_write(uint32_t address, void *context, uint8_t value); | |
51 void init_upd78k2_opts(upd78k2_options *opts, memmap_chunk const *chunks, uint32_t num_chunks); | |
52 upd78k2_context *init_upd78k2_context(upd78k2_options *opts); | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
53 void upd78k2_sync_cycle(upd78k2_context *upd, uint32_t target_cycle); |
2705 | 54 |
55 #Prefix bytes | |
56 # 0000 0001 -> saddr becomes sfr, mem becomes &mem | |
57 # 0000 0010 -> bit instructions/ conditional branches | |
58 # 0000 0011 -> more bit instructions / conditional branches | |
59 # 0000 0110 -> base mode | |
60 # 0000 1000 -> saddr/sfr bit instructions / conditional branches | |
61 # 0000 1001 -> mov !addr16/stbc | |
62 # 0000 1010 -> indexed mode | |
63 # 0001 0110 -> register indirect | |
64 | |
65 sfr_read | |
66 arg offset 8 | |
67 scratch1 = offset + 0xFF00 | |
68 ocall read_8 | |
69 | |
70 sfr_write | |
71 arg offset 8 | |
72 arg value 8 | |
73 scratch2 = offset + 0xFF00 | |
74 scratch1 = value | |
75 ocall write_8 | |
76 | |
77 iram_read | |
78 arg offset 8 | |
79 local normal_iram 8 | |
80 normal_iram = 1 | |
81 if offset >=U 0xE0 | |
82 #register bank area | |
83 switch rbs | |
84 case 0 | |
85 if offset >=U 0xF8 | |
86 normal_iram = 0 | |
87 end | |
88 case 1 | |
89 if offset >=U 0xF0 | |
90 if offset >=U 0xF8 | |
91 else | |
92 normal_iram = 0 | |
93 end | |
94 end | |
95 case 2 | |
96 if offset >=U 0xE8 | |
97 if offset >=U 0xF0 | |
98 else | |
99 normal_iram = 0 | |
100 end | |
101 end | |
102 case 3 | |
103 if offset >=U 0xE8 | |
104 else | |
105 normal_iram = 0 | |
106 end | |
107 end | |
108 end | |
109 if normal_iram | |
110 scratch1 = iram.offset | |
111 else | |
112 scratch1 = offset & 7 | |
113 scratch1 = main.scratch1 | |
114 end | |
115 | |
116 iram_write | |
117 arg offset 8 | |
118 arg value 8 | |
119 local normal_iram 8 | |
120 local regnum 8 | |
121 normal_iram = 1 | |
122 if offset >=U 0xE0 | |
123 #register bank area | |
124 switch rbs | |
125 case 0 | |
126 if offset >=U 0xF8 | |
127 normal_iram = 0 | |
128 end | |
129 case 1 | |
130 if offset >=U 0xF0 | |
131 if offset >=U 0xF8 | |
132 else | |
133 normal_iram = 0 | |
134 end | |
135 end | |
136 case 2 | |
137 if offset >=U 0xE8 | |
138 if offset >=U 0xF0 | |
139 else | |
140 normal_iram = 0 | |
141 end | |
142 end | |
143 case 3 | |
144 if offset >=U 0xE8 | |
145 else | |
146 normal_iram = 0 | |
147 end | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
148 end |
2705 | 149 end |
150 if normal_iram | |
151 iram.offset = value | |
152 else | |
153 regnum = offset & 8 | |
154 main.regnum = value | |
155 end | |
156 | |
157 mem_read_no_exp | |
158 arg addr 32 | |
159 local offset 8 | |
160 if addr >=U 0xFE00 | |
161 if addr >=U 0xFF00 | |
162 offset = addr | |
163 sfr_read offset | |
164 else | |
165 offset = addr | |
166 iram_read offset | |
167 end | |
168 else | |
169 scratch1 = addr | |
170 ocall read_8 | |
171 end | |
172 | |
173 mem_write_no_exp | |
174 arg addr 32 | |
175 arg value 8 | |
176 local offset 8 | |
177 if addr >=U 0xFE00 | |
178 if addr >=U 0xFF00 | |
179 offset = addr | |
180 sfr_write offset value | |
181 else | |
182 offset = addr | |
183 iram_write offset value | |
184 end | |
185 else | |
186 scratch2 = addr | |
187 scratch1 = value | |
188 ocall write_8 | |
189 end | |
190 | |
191 upd78k2_op_fetch | |
192 mem_read_no_exp pc | |
193 pc += 1 | |
194 | |
195 upd78k2_op_fetch_word | |
196 local tmp 8 | |
197 upd78k2_op_fetch | |
198 tmp = scratch1 | |
199 upd78k2_op_fetch | |
200 scratch1 <<= 8 | |
201 scratch1 |= tmp | |
202 | |
203 upd78k2_run_op | |
204 upd78k2_op_fetch | |
205 dispatch scratch1 | |
206 | |
207 saddr_read | |
208 arg offset 8 | |
209 local tmp 8 | |
210 if offset >=U 0xE0 | |
211 #sfr area | |
212 tmp = offset - 0xE0 | |
213 sfr_read tmp | |
214 else | |
215 tmp = offset + 0x20 | |
216 iram_read tmp | |
217 end | |
218 | |
219 saddr_write | |
220 arg offset 8 | |
221 arg value 8 | |
222 local tmp 8 | |
223 if offset >=U 0xE0 | |
224 #sfr area | |
225 tmp = offset - 0xE0 | |
226 sfr_write tmp value | |
227 else | |
228 tmp = offset + 0x20 | |
229 iram_write tmp value | |
230 end | |
231 | |
232 mem_read | |
233 arg address 16 | |
234 arg alt_bank 8 | |
235 local full_address 32 | |
236 local meg_enable 8 | |
237 meg_enable = mm & 0x40 | |
238 if meg_enable | |
239 if alt_bank | |
240 full_address = port_data.6 & 0xF | |
241 else | |
242 full_address = port_mode.6 & 0xF | |
243 end | |
244 full_address <<= 16 | |
245 full_address |= address | |
246 else | |
247 full_address = address | |
248 end | |
249 mem_read_no_exp full_address | |
250 | |
251 mem_write | |
252 arg address 16 | |
253 arg value 8 | |
254 arg alt_bank 8 | |
255 local full_address 32 | |
256 local meg_enable 8 | |
257 meg_enable = mm & 0x40 | |
258 if meg_enable | |
259 if alt_bank | |
260 full_address = port_data.6 & 0xF | |
261 else | |
262 full_address = port_mode.6 & 0xF | |
263 end | |
264 full_address <<= 16 | |
265 full_address |= address | |
266 else | |
267 full_address = address | |
268 end | |
269 mem_write_no_exp full_address value | |
270 | |
271 push_word | |
272 arg value 16 | |
273 local tmp 8 | |
274 tmp = value >> 8 | |
275 sp -= 1 | |
276 mem_write_no_exp sp tmp | |
277 tmp = value | |
278 sp -= 1 | |
279 mem_write_no_exp sp tmp | |
280 | |
281 pop_word | |
282 mem_read_no_exp sp | |
283 dst = scratch1 | |
284 sp += 1 | |
285 mem_read_no_exp sp | |
286 scratch1 <<= 8 | |
287 dst |= scratch1 | |
288 sp += 1 | |
289 | |
290 00000000 nop | |
291 cycles 2 #minimum cycle time appears to be 4 (ignoring internal divider) | |
292 | |
293 00000001 sfr_prefix | |
294 upd78k2_op_fetch | |
295 dispatch scratch1 sfr | |
296 | |
297 00000010 bit1_prefix | |
298 upd78k2_op_fetch | |
299 dispatch scratch1 bit1 | |
300 | |
301 00000011 bit2_prefix | |
302 upd78k2_op_fetch | |
303 dispatch scratch1 bit2 | |
304 | |
305 00000101 muldiv_prefix | |
306 upd78k2_op_fetch | |
307 dispatch scratch1 muldiv | |
308 | |
309 00000110 base_prefix | |
310 upd78k2_op_fetch | |
311 dispatch scratch1 base | |
312 | |
313 00001000 sfrbit_prefix | |
314 upd78k2_op_fetch | |
315 dispatch scratch1 sfrbit | |
316 | |
317 00001001 spmov_prefix | |
318 upd78k2_op_fetch | |
319 dispatch scratch1 spmov | |
320 | |
321 00001010 indexed_prefix | |
322 upd78k2_op_fetch | |
323 dispatch scratch1 indexed | |
324 | |
325 00010110 regind_prefix | |
326 upd78k2_op_fetch | |
327 dispatch scratch1 regind | |
328 | |
329 00100100 mov_reg_prefix | |
330 upd78k2_op_fetch | |
331 dispatch scratch1 mov_reg | |
332 | |
333 sfr 00000110 alt_base_prefix | |
334 upd78k2_op_fetch | |
335 dispatch scratch1 alt_base | |
336 | |
337 sfr 00001010 alt_indexed_prefix | |
338 upd78k2_op_fetch | |
339 dispatch scratch1 alt_indexed | |
340 | |
341 sfr 00010110 alt_regind_prefix | |
342 upd78k2_op_fetch | |
343 dispatch scratch1 alt_regind | |
344 | |
345 aluop | |
346 arg op 8 | |
347 arg src 8 | |
348 switch op | |
349 case 0 | |
350 dst += src | |
351 update_flags ZAC | |
352 case 1 | |
353 adc dst src dst | |
354 update_flags ZAC | |
355 case 2 | |
356 dst -= src | |
357 update_flags ZAC | |
358 case 3 | |
359 sbc dst src dst | |
360 update_flags ZAC | |
361 case 4 | |
362 dst &= src | |
363 update_flags Z | |
364 case 5 | |
365 dst ^= src | |
366 update_flags Z | |
367 case 6 | |
368 dst |= src | |
369 update_flags Z | |
370 case 7 | |
371 cmp dst src | |
372 update_flags ZAC | |
373 end | |
374 | |
375 aluop16 | |
376 arg op 8 | |
377 arg src 16 | |
378 switch op | |
379 case 0 | |
380 dst += src | |
381 update_flags ZAC | |
382 case 2 | |
383 dst -= src | |
384 update_flags ZAC | |
385 case 7 | |
386 dst -= src | |
387 update_flags ZAC | |
388 default | |
389 #TODO: what happens in these invalid cases | |
390 end | |
391 | |
392 10001PPP alu_r_r | |
393 local tmp_src 16 | |
394 local tmp_dst 16 | |
395 upd78k2_op_fetch | |
396 scratch2 = scratch1 >> 4 | |
397 if scratch2 >=U 7 | |
398 #TODO: is MSB just ignored or is this treated as some kind of illegal instruction or nop? | |
399 else | |
400 scratch1 &= 0xF | |
401 if scratch1 >=U 7 | |
402 scratch1 &= 7 | |
403 meta dst tmp_dst | |
404 tmp_dst = a << 8 | |
405 tmp_dst |= x | |
406 switch scratch1 | |
407 case 0 | |
408 tmp_src = a << 8 | |
409 tmp_src |= x | |
410 case 2 | |
411 tmp_src = b << 8 | |
412 tmp_src |= c | |
413 case 4 | |
414 tmp_src = d << 8 | |
415 tmp_src |= e | |
416 case 6 | |
417 tmp_src = h << 8 | |
418 tmp_src |= l | |
419 default | |
420 #TODO: what happens in these invalid cases | |
421 end | |
422 aluop16 P tmp_src | |
423 x = tmp_dst | |
424 a = tmp_dst >> 8 | |
425 else | |
426 meta dst main.scratch2 | |
427 cycles 2 #penalty for extra IRAM access since regs are technically stored there? | |
428 aluop P main.scratch1 | |
429 end | |
430 end | |
431 | |
432 10101PPP alu_immed | |
433 upd78k2_op_fetch | |
434 meta dst a | |
435 aluop P scratch1 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
436 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
437 01101PPP alu_saddr_immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
438 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
439 local immed 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
440 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
441 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
442 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
443 immed = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
444 saddr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
445 meta dst scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
446 aluop P immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
447 saddr_write offset scratch1 |
2705 | 448 |
449 calc_addr_base | |
450 arg regpair 8 | |
451 local tmp 16 | |
452 upd78k2_op_fetch | |
453 switch regpair | |
454 case 0 | |
455 #[de+byte] | |
456 tmp = d << 8 | |
457 tmp |= e | |
458 adst += tmp | |
459 case 1 | |
460 #[sp+byte] | |
461 adst += sp | |
462 case 2 | |
463 #[hl+byte] | |
464 tmp = h << 8 | |
465 tmp |= l | |
466 adst += tmp | |
467 end | |
468 | |
469 read_base_mode | |
470 arg regpair 8 | |
471 arg alt_bank 8 | |
472 meta adst scratch1 | |
473 calc_addr_base regpair | |
474 mem_read scratch1 alt_bank | |
475 | |
476 write_base_mode | |
477 arg regpair 8 | |
478 arg value 8 | |
479 arg alt_bank 8 | |
480 meta adst scratch2 | |
481 calc_addr_base regpair | |
482 mem_write scratch2 value alt_bank | |
483 | |
484 calc_addr_regind | |
485 arg regpair 8 | |
486 local tmp 16 | |
487 switch regpair | |
488 case 0 | |
489 #[de+] | |
490 adst = d << 8 | |
491 adst |= e | |
492 tmp = adst + 1 | |
493 e = tmp | |
494 d = tmp >> 8 | |
495 case 1 | |
496 #[hl+] | |
497 adst = h << 8 | |
498 adst |= l | |
499 tmp = adst + 1 | |
500 l = tmp | |
501 h = tmp >> 8 | |
502 case 2 | |
503 #[de-] | |
504 adst = d << 8 | |
505 adst |= e | |
506 tmp = adst - 1 | |
507 e = tmp | |
508 d = tmp >> 8 | |
509 case 3 | |
510 #[hl-] | |
511 adst = h << 8 | |
512 adst |= l | |
513 tmp = adst - 1 | |
514 l = tmp | |
515 h = tmp >> 8 | |
516 case 4 | |
517 #[de] | |
518 adst = d << 8 | |
519 adst |= e | |
520 case 5 | |
521 #[hl] | |
522 adst = h << 8 | |
523 adst |= l | |
524 end | |
525 | |
526 read_regind_mode | |
527 arg regpair 8 | |
528 arg alt_bank 8 | |
529 meta adst scratch1 | |
530 calc_addr_regind regpair | |
531 mem_read scratch1 alt_bank | |
532 | |
533 write_regind_mode | |
534 arg regpair 8 | |
535 arg value 8 | |
536 arg alt_bank 8 | |
537 meta adst scratch2 | |
538 calc_addr_regind regpair | |
539 mem_write scratch2 value alt_bank | |
540 | |
541 calc_addr_indexed | |
542 arg index_reg 8 | |
543 local tmp 16 | |
544 upd78k2_op_fetch_word | |
545 switch index_reg | |
546 case 0 | |
547 tmp = d << 8 | |
548 tmp |= e | |
549 adst += tmp | |
550 case 1 | |
551 adst += a | |
552 case 2 | |
553 tmp = h << 8 | |
554 tmp |= l | |
555 adst += tmp | |
556 case 3 | |
557 adst += b | |
558 end | |
559 | |
560 read_indexed_mode | |
561 arg index_reg 8 | |
562 arg alt_bank 8 | |
563 meta adst scratch1 | |
564 calc_addr_indexed index_reg | |
565 mem_read scratch1 alt_bank | |
566 | |
567 write_indexed_mode | |
568 arg index_reg 8 | |
569 arg value 8 | |
570 arg alt_bank 8 | |
571 meta adst scratch2 | |
572 calc_addr_indexed index_reg | |
573 mem_write scratch2 value alt_bank | |
574 | |
575 base 00RR1PPP alu_base | |
576 invalid R 3 | |
577 read_base_mode R 0 | |
578 meta dst a | |
579 aluop P scratch1 | |
580 | |
581 alt_base 00RR1PPP alu_alt_base | |
582 invalid R 3 | |
583 read_base_mode R 1 | |
584 meta dst a | |
585 aluop P scratch1 | |
586 | |
587 base 00RR0000 mov_a_base | |
588 invalid R 3 | |
589 read_base_mode R 0 | |
590 a = scratch1 | |
591 | |
592 alt_base 00RR0000 alt_mov_a_base | |
593 invalid R 3 | |
594 read_base_mode R 1 | |
595 a = scratch1 | |
596 | |
597 base 10RR0000 mov_base_a | |
598 invalid R 3 | |
599 write_base_mode R a 0 | |
600 | |
601 alt_base 10RR0000 alt_mov_base_a | |
602 invalid R 3 | |
603 write_base_mode R a 1 | |
604 | |
605 regind 0RRR1PPP alu_reg_indirect | |
606 invalid R 6 | |
607 invalid R 7 | |
608 read_regind_mode R 0 | |
609 meta dst a | |
610 aluop P scratch1 | |
611 | |
612 alt_regind 0RRR1PPP alu_alt_reg_indirect | |
613 invalid R 6 | |
614 invalid R 7 | |
615 read_regind_mode R 1 | |
616 meta dst a | |
617 aluop P scratch1 | |
618 | |
619 regind 0RRR0000 mov_a_reg_indirect | |
620 invalid R 6 | |
621 invalid R 7 | |
622 read_regind_mode R 0 | |
623 a = scratch1 | |
624 | |
625 alt_regind 0RRR0000 alt_mov_a_reg_indirect | |
626 invalid R 6 | |
627 invalid R 7 | |
628 read_regind_mode R 1 | |
629 a = scratch1 | |
630 | |
631 regind 1RRR0000 mov_reg_indirect_a | |
632 invalid R 6 | |
633 invalid R 7 | |
634 write_regind_mode R a 0 | |
635 | |
636 alt_regind 1RRR0000 alt_mov_reg_indirect_a | |
637 invalid R 6 | |
638 invalid R 7 | |
639 write_regind_mode R a 1 | |
640 | |
641 01010RRR mov_reg_indirect_a_short | |
642 invalid R 6 | |
643 invalid R 7 | |
644 write_regind_mode R a 0 | |
645 | |
646 01011RRR mov_a_reg_indirect_short | |
647 invalid R 6 | |
648 invalid R 7 | |
649 read_regind_mode R 0 | |
650 a = scratch1 | |
651 | |
652 indexed 00RR1PPP alu_indexed | |
653 read_indexed_mode R 0 | |
654 meta dst a | |
655 aluop P scratch1 | |
656 | |
657 alt_indexed 00RR1PPP alu_alt_indexed | |
658 read_indexed_mode R 1 | |
659 meta dst a | |
660 aluop P scratch1 | |
661 | |
662 indexed 00RR0000 mov_a_indexed | |
663 read_indexed_mode R 0 | |
664 a = scratch1 | |
665 | |
666 alt_indexed 00RR0000 alt_mov_a_indexed | |
667 read_indexed_mode R 1 | |
668 a = scratch1 | |
669 | |
670 indexed 10RR0000 mov_indexed_a | |
671 write_indexed_mode R a 0 | |
672 | |
673 alt_indexed 10RR0000 alt_mov_indexed_a | |
674 write_indexed_mode R a 1 | |
675 | |
676 mov_reg 0DD01SS0 movw_rp_rp | |
677 local dst 8 | |
678 local src 8 | |
679 dst = D << 1 | |
680 src = S << 1 | |
681 main.dst = main.src | |
682 dst += 1 | |
683 src += 1 | |
684 main.dst = main.src | |
685 | |
686 mov_reg 0DDD0SSS mov_r_r | |
687 main.D = main.S | |
688 | |
689 01100PP0 movw_rp_immed | |
690 local dst 8 | |
691 dst = P << 1 | |
692 upd78k2_op_fetch | |
693 main.dst = scratch1 | |
694 dst += 1 | |
695 upd78k2_op_fetch | |
696 main.dst = scratch1 | |
697 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
698 10111RRR mov_r_immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
699 local dst 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
700 dst = R << 1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
701 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
702 main.dst = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
703 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
704 spmov 11000000 mov_stbc_immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
705 local tmp 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
706 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
707 tmp = ~scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
708 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
709 if tmp = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
710 stbc = tmp |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
711 #TODO: actually handle stbc changes |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
712 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
713 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
714 spmov 11110000 mov_a_abs |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
715 upd78k2_op_fetch_word |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
716 mem_read_no_exp scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
717 a = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
718 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
719 spmov 11110001 mov_abs_a |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
720 upd78k2_op_fetch_word |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
721 scratch2 = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
722 mem_write_no_exp scratch2 a |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
723 |
2705 | 724 11000RRR inc_r |
725 cycles 2 | |
726 main.R += 1 | |
727 update_flags ZA | |
728 | |
729 11001RRR dec_r | |
730 cycles 2 | |
731 main.R -= 1 | |
732 update_flags ZA | |
733 | |
734 11010RRR mov_a_r | |
735 a = main.R | |
736 | |
737 muldiv 01001PP0 br_rp | |
738 local reg 8 | |
739 local tmp 16 | |
740 reg = P << 1 | |
741 pc = main.reg | |
742 reg += 1 | |
743 tmp = main.reg << 8 | |
744 pc |= tmp | |
745 | |
746 00010100 br_rel | |
747 upd78k2_op_fetch | |
748 sext 16 scratch1 scratch1 | |
749 pc += scratch1 | |
750 | |
751 00101100 br_abs | |
752 upd78k2_op_fetch_word | |
753 pc = scratch1 | |
754 | |
755 100000FS bcc | |
756 local flag 8 | |
757 upd78k2_op_fetch | |
758 if F | |
759 flag = chflags >> 7 | |
760 else | |
761 flag = zflag | |
762 end | |
763 if flag = S | |
764 sext 16 scratch1 scratch1 | |
765 pc += scratch1 | |
766 end | |
767 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
768 bit1 10100BBB bf_psw |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
769 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
770 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
771 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
772 mask &= psw |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
773 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
774 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
775 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
776 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
777 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
778 bit1 10110BBB bt_psw |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
779 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
780 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
781 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
782 mask &= psw |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
783 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
784 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
785 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
786 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
787 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
788 bit2 1010RBBB bf_r |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
789 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
790 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
791 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
792 mask &= main.R |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
793 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
794 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
795 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
796 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
797 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
798 bit2 1011RBBB bt_r |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
799 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
800 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
801 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
802 mask &= main.R |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
803 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
804 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
805 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
806 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
807 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
808 sfrbit 10100BBB bf_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
809 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
810 local tmp 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
811 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
812 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
813 tmp = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
814 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
815 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
816 mask &= tmp |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
817 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
818 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
819 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
820 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
821 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
822 01110BBB bt_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
823 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
824 local tmp 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
825 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
826 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
827 tmp = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
828 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
829 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
830 mask &= tmp |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
831 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
832 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
833 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
834 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
835 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
836 sfrbit 10101BBB bf_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
837 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
838 local tmp 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
839 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
840 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
841 tmp = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
842 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
843 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
844 mask &= tmp |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
845 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
846 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
847 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
848 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
849 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
850 sfrbit 10111BBB bt_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
851 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
852 local tmp 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
853 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
854 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
855 tmp = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
856 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
857 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
858 mask &= tmp |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
859 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
860 sext 16 scratch1 scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
861 pc += scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
862 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
863 |
2705 | 864 muldiv 01011PP0 call_rp |
865 local reg 8 | |
866 local tmp 16 | |
867 push_word pc | |
868 reg = P << 1 | |
869 pc = main.reg | |
870 reg += 1 | |
871 tmp = main.reg << 8 | |
872 pc |= tmp | |
873 | |
874 00101000 call_long | |
875 local address 16 | |
876 upd78k2_op_fetch_word | |
877 address = scratch1 | |
878 push_word pc | |
879 pc = address | |
880 | |
881 10010AAA call_short | |
882 local address 16 | |
883 address = A << 8 | |
884 address |= 0x800 | |
885 upd78k2_op_fetch | |
886 address |= scratch1 | |
887 push_word pc | |
888 pc = address | |
889 | |
890 111TTTTT call_table | |
891 local address 16 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
892 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
893 offset = T << 1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
894 offset += 0x40 |
2705 | 895 mem_read_no_exp T |
896 address = scratch1 | |
897 scratch1 = T + 1 | |
898 mem_read_no_exp scratch1 | |
899 scratch1 <<= 8 | |
900 address |= 8 | |
901 push_word pc | |
902 pc = address | |
903 | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
904 01001010 di |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
905 int_enable = 0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
906 update_sync |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
907 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
908 01001011 ei |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
909 int_enable = 1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
910 update_sync |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
911 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
912 if cycles >=U int_cycle |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
913 int_cycle = cycles + 1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
914 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
915 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
916 |
2705 | 917 01010110 ret |
918 meta dst pc | |
919 pop_word | |
920 | |
921 001101PP pop_rp | |
922 local rp 8 | |
923 local word 16 | |
924 meta dst word | |
925 pop_word | |
926 main.rp = word | |
927 rp += 1 | |
928 main.rp = word >> 8 | |
929 | |
930 001111PP push_rp | |
931 local rp 8 | |
932 local word 16 | |
933 rp = P << 1 | |
934 rp += 1 | |
935 word = main.rp << 8 | |
936 rp -= 1 | |
937 word |= main.rp | |
938 push_word word | |
939 | |
940 muldiv 101010NN sel | |
941 local offset 8 | |
942 if N != rbs | |
943 offset = rbs << 3 | |
944 offset = 0xF8 - offset | |
945 iram.offset = x | |
946 offset += 1 | |
947 iram.offset = a | |
948 offset += 1 | |
949 iram.offset = c | |
950 offset += 1 | |
951 iram.offset = b | |
952 offset += 1 | |
953 iram.offset = e | |
954 offset += 1 | |
955 iram.offset = d | |
956 offset += 1 | |
957 iram.offset = l | |
958 offset += 1 | |
959 iram.offset = h | |
960 offset = N << 3 | |
961 offset = 0xF8 - offset | |
962 x = iram.offset | |
963 offset += 1 | |
964 a = iram.offset | |
965 offset += 1 | |
966 c = iram.offset | |
967 offset += 1 | |
968 b = iram.offset | |
969 offset += 1 | |
970 e = iram.offset | |
971 offset += 1 | |
972 d = iram.offset | |
973 offset += 1 | |
974 l = iram.offset | |
975 offset += 1 | |
976 h = iram.offset | |
977 rbs = N | |
978 end | |
979 | |
980 muldiv 11001000 incw_sp | |
981 sp += 1 | |
982 | |
983 muldiv 11001001 decw_sp | |
984 sp -= 1 | |
985 | |
986 00001011 movw_sfrp_immed | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
987 local offset 8 |
2705 | 988 upd78k2_op_fetch |
989 if scratch1 = 0xFC | |
990 #unclear if SP is actually mapped in the SFR space | |
991 #or if this is special cased, but the docs don't | |
992 #suggest you can write to SP with other SFR-targeting | |
993 #instructions so I'm assuming the latter. | |
994 upd78k2_op_fetch | |
995 sp = scratch1 | |
996 upd78k2_op_fetch | |
997 scratch1 <<= 8 | |
998 sp |= scratch1 | |
999 else | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1000 offset = scratch1 |
2705 | 1001 upd78k2_op_fetch |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1002 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1003 offset += 1 |
2705 | 1004 upd78k2_op_fetch |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1005 sfr_write offset scratch1 |
2705 | 1006 end |
1007 | |
1008 00001100 movw_sadrp_word | |
1009 local offset 8 | |
1010 upd78k2_op_fetch | |
1011 offset = scratch1 | |
1012 upd78k2_op_fetch | |
1013 saddr_write offset scratch1 | |
1014 offset += 1 | |
1015 upd78k2_op_fetch | |
2706
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1016 saddr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1017 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1018 00101011 mov_sfr_immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1019 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1020 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1021 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1022 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1023 if offset = 0xFE |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1024 psw = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1025 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1026 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1027 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1028 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1029 00111010 mov_saddr_immed |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1030 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1031 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1032 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1033 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1034 saddr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1035 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1036 sfrbit 00000BBB mov1_cy_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1037 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1038 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1039 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1040 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1041 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1042 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1043 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1044 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1045 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1046 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1047 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1048 sfrbit 00001BBB mov1_cy_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1049 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1050 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1051 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1052 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1053 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1054 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1055 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1056 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1057 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1058 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1059 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1060 sfrbit 00010BBB mov1_saddr_cy |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1061 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1062 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1063 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1064 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1065 saddr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1066 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1067 if chflags >=U 0x80 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1068 scratch1 |= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1069 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1070 mask = ~mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1071 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1072 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1073 saddr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1074 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1075 sfrbit 00011BBB mov1_sfr_cy |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1076 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1077 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1078 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1079 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1080 sfr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1081 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1082 if chflags >=U 0x80 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1083 scratch1 |= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1084 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1085 mask = ~mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1086 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1087 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1088 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1089 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1090 sfrbit 001I0BBB and1_cy_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1091 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1092 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1093 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1094 if I |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1095 scratch1 = ~scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1096 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1097 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1098 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1099 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1100 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1101 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1102 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1103 sfrbit 001I1BBB and1_cy_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1104 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1105 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1106 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1107 if I |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1108 scratch1 = ~scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1109 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1110 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1111 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1112 if = |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1113 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1114 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1115 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1116 sfrbit 010I0BBB or1_cy_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1117 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1118 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1119 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1120 if I |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1121 scratch1 = ~scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1122 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1123 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1124 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1125 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1126 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1127 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1128 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1129 sfrbit 010I1BBB or1_cy_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1130 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1131 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1132 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1133 if I |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1134 scratch1 = ~scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1135 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1136 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1137 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1138 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1139 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1140 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1141 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1142 sfrbit 01100BBB xor1_cy_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1143 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1144 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1145 saddr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1146 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1147 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1148 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1149 if chflags >=U 0x80 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1150 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1151 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1152 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1153 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1154 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1155 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1156 sfrbit 01101BBB xor1_cy_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1157 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1158 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1159 sfr_read scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1160 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1161 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1162 if != |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1163 if chflags >=U 0x80 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1164 update_flags C0 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1165 else |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1166 update_flags C1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1167 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1168 end |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1169 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1170 sfrbit 01110BBB not1_saddr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1171 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1172 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1173 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1174 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1175 saddr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1176 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1177 scratch1 ^= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1178 saddr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1179 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1180 sfrbit 01111BBB not1_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1181 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1182 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1183 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1184 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1185 sfr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1186 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1187 scratch1 ^= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1188 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1189 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1190 sfrbit 10001BBB set1_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1191 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1192 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1193 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1194 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1195 sfr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1196 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1197 scratch1 |= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1198 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1199 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1200 sfrbit 10011BBB clr1_sfr |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1201 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1202 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1203 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1204 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1205 sfr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1206 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1207 mask = ~mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1208 scratch1 &= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1209 sfr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1210 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1211 10110BBB set1_saddr_cy |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1212 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1213 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1214 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1215 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1216 saddr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1217 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1218 scratch1 |= mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1219 saddr_write offset scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1220 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1221 10100BBB clr1_saddr_cy |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1222 local mask 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1223 local offset 8 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1224 upd78k2_op_fetch |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1225 offset = scratch1 |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1226 saddr_read offset |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1227 mask = 1 << B |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1228 mask = ~mask |
0bd48217941a
Get uPD78K/II core done enough to run the LaserActive firmware main loop
Michael Pavone <pavone@retrodev.com>
parents:
2705
diff
changeset
|
1229 scratch1 &= mask |
2705 | 1230 saddr_write offset scratch1 |