This source file includes following definitions.
- update_apu
- update_cpts
- update_data_1
- update_data_2
- update_data_3
- update_data_4
- update_data_5
- update_data_6
- update_data_7
- update_data_scroll
- update_data
- update_display
- lwrite
- send_lamp_data
- set_message
- time_handler
- update_port
- scraperThreadMain
- panelScraperInit
- panelScraperStart
- panelScraperStop
- panelScraperMsg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <termios.h>
28 #include <fcntl.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <poll.h>
33 #include <errno.h>
34
35 #include "panelScraper.h"
36
37 #include "../font8x8/font8x8.h"
38
39 #include "dps8.h"
40 #include "dps8_sys.h"
41 #include "dps8_cpu.h"
42
43 #undef cpu
44 static cpu_state_t * volatile panel_cpup;
45 #define cpu (* panel_cpup)
46
47 #include <pthread.h>
48 #include <sys/types.h>
49 #include <sys/stat.h>
50 #include <fcntl.h>
51 #include <unistd.h>
52 #if defined(__MINGW64__) || defined(__MINGW32__)
53 # define FD HANDLE
54 #else
55 # include <poll.h>
56 # define FD int
57 #endif
58
59 #if !defined MIN
60 # define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
61 #endif
62
63 static pthread_t scraperThread;
64
65 static int scraperThreadArg;
66
67 #define msgLen 4096
68 static char message [msgLen];
69 static int c_offset = 0;
70
71
72
73 #define nrows 16
74 #define ncols 40
75 static bool banks [nrows] [ncols];
76 #define bank_a banks [ 0]
77 #define bank_b banks [ 1]
78 #define bank_c banks [ 2]
79 #define bank_d banks [ 3]
80 #define bank_e banks [ 4]
81 #define bank_f banks [ 5]
82 #define bank_g banks [ 6]
83 #define bank_h banks [ 7]
84 #define bank_i banks [ 8]
85 #define bank_j banks [ 9]
86 #define bank_k banks [10]
87 #define bank_l banks [11]
88 #define bank_m banks [12]
89 #define bank_n banks [13]
90 #define bank_o banks [14]
91 #define bank_p banks [15]
92
93 #define SETL(lights, light_os, from, n) \
94 for (uint i = 0; i < (n); i ++) \
95 lights [(light_os) + i] = !! ((from) & (1llu << ((n) - i - 1)));
96
97 #define SETLA(lights, light_os, from, n) \
98 for (uint i = 0; i < (n); i ++) \
99 lights [(light_os) + i] = !! from [i];
100
101 #define SETL1(lights, light_os, from) \
102 lights [(light_os)] = !! (from);
103
104 static void update_apu (void)
105 {
106 uint n = cpu.APU_panel_scroll_select_n_sw;
107
108 switch (cpu.APU_panel_scroll_wheel_sw)
109 {
110
111 case 0:
112 {
113 if (cpu.APU_panel_scroll_select_ul_sw)
114 {
115
116
117
118
119 SETL (bank_a, 0+3, cpu.PTWAM[n].POINTER, 15);
120 SETL (bank_a, 15+3, cpu.PTWAM[n].PAGENO, 12);
121 SETL1 (bank_a, 27+3, cpu.PTWAM[n].FE);
122 SETL (bank_a, 32+3, cpu.PTWAM[n].USE, 4);
123 }
124 else
125 {
126
127 }
128 }
129 break;
130
131
132 case 1:
133 {
134 if (cpu.APU_panel_scroll_select_ul_sw)
135 {
136
137
138 SETL (bank_a, 0+3, cpu.PTWAM[n].ADDR, 18);
139 SETL1 (bank_a, 29+3, cpu.PTWAM[n].M);
140 }
141 else
142 {
143
144 }
145 }
146 break;
147
148
149 case 2:
150 {
151 if (cpu.APU_panel_scroll_select_ul_sw)
152 {
153
154
155
156 SETL (bank_a, 0+3, cpu.SDWAM[n].POINTER, 15);
157 SETL1 (bank_a, 27+3, cpu.SDWAM[n].FE);
158 SETL (bank_a, 32+3, cpu.SDWAM[n].USE, 4);
159 }
160 else
161 {
162
163 }
164 }
165 break;
166
167
168 case 3:
169 {
170 if (cpu.APU_panel_scroll_select_ul_sw)
171 {
172
173
174
175
176 SETL (bank_a, 0+3, cpu.SDWAM[n].ADDR, 24);
177 SETL (bank_a, 24+3, cpu.SDWAM[n].R1, 3);
178 SETL (bank_a, 27+3, cpu.SDWAM[n].R2, 3);
179 SETL (bank_a, 30+3, cpu.SDWAM[n].R2, 3);
180 }
181 else
182 {
183
184
185
186
187
188
189
190
191 SETL (bank_a, 1+3, cpu.SDWAM[n].BOUND, 14);
192 SETL1 (bank_a, 15+3, cpu.SDWAM[n].R);
193 SETL1 (bank_a, 16+3, cpu.SDWAM[n].E);
194 SETL1 (bank_a, 17+3, cpu.SDWAM[n].W);
195 SETL1 (bank_a, 18+3, cpu.SDWAM[n].P);
196 SETL1 (bank_a, 19+3, cpu.SDWAM[n].U);
197 SETL1 (bank_a, 20+3, cpu.SDWAM[n].G);
198 SETL (bank_a, 22+3, cpu.SDWAM[n].EB, 14);
199 }
200 }
201 break;
202
203
204 case 4:
205 {
206 if (cpu.APU_panel_scroll_select_ul_sw)
207 {
208
209
210 SETL (bank_a, 0+3, cpu.lastPTWOffset, 18);
211 SETL1 (bank_a, 26+3, cpu.lastPTWIsDS);
212 }
213 else
214 {
215
216
217
218
219
220
221
222
223 SETL (bank_a, 1+3, cpu.SDWAM[n].BOUND, 14);
224 SETL1 (bank_a, 15+3, cpu.SDWAM[n].R);
225 SETL1 (bank_a, 16+3, cpu.SDWAM[n].E);
226 SETL1 (bank_a, 17+3, cpu.SDWAM[n].W);
227 SETL1 (bank_a, 18+3, cpu.SDWAM[n].P);
228 SETL1 (bank_a, 19+3, cpu.SDWAM[n].U);
229 SETL1 (bank_a, 20+3, cpu.SDWAM[n].G);
230 SETL (bank_a, 22+3, cpu.SDWAM[n].EB, 14);
231 }
232 }
233 break;
234
235
236 case 5:
237 {
238 if (cpu.APU_panel_scroll_select_ul_sw)
239 {
240
241 SETL (bank_a, 0+3, cpu.DSBR.ADDR, 24);
242 }
243 else
244 {
245 SETL (bank_a, 1+3, cpu.SDWAM[n].BOUND, 14);
246 SETL1 (bank_a, 15+3, cpu.SDWAM[n].R);
247 SETL1 (bank_a, 16+3, cpu.SDWAM[n].E);
248 SETL1 (bank_a, 17+3, cpu.SDWAM[n].W);
249 SETL1 (bank_a, 18+3, cpu.SDWAM[n].P);
250 SETL1 (bank_a, 19+3, cpu.SDWAM[n].U);
251 SETL1 (bank_a, 20+3, cpu.SDWAM[n].G);
252 SETL (bank_a, 22+3, cpu.SDWAM[n].EB, 14);
253 }
254 }
255 break;
256
257
258 case 6:
259 {
260 if (cpu.APU_panel_scroll_select_ul_sw)
261 {
262
263
264
265
266 SETL (bank_a, 0+3, cpu.SDW0.ADDR, 24);
267 SETL (bank_a, 24+3, cpu.SDW0.R1, 3);
268 SETL (bank_a, 27+3, cpu.SDW0.R2, 3);
269 SETL (bank_a, 30+3, cpu.SDW0.R2, 3);
270 }
271 else
272 {
273
274
275
276
277
278
279
280
281 SETL (bank_a, 1+3, cpu.SDW0.BOUND, 14);
282 SETL1 (bank_a, 15+3, cpu.SDW0.R);
283 SETL1 (bank_a, 16+3, cpu.SDW0.E);
284 SETL1 (bank_a, 17+3, cpu.SDW0.W);
285 SETL1 (bank_a, 18+3, cpu.SDW0.P);
286 SETL1 (bank_a, 19+3, cpu.SDW0.U);
287 SETL1 (bank_a, 20+3, cpu.SDW0.G);
288 SETL (bank_a, 22+3, cpu.SDW0.EB, 14);
289 }
290 }
291 break;
292
293
294
295 case 7:
296 {
297 if (cpu.APU_panel_scroll_select_ul_sw)
298 {
299
300
301 SETL (bank_a, 0+3, cpu.APUDataBusOffset, 18);
302
303 }
304 else
305 {
306
307
308 SETL (bank_a, 0+3, cpu.APUDataBusAddr, 24);
309 }
310 }
311 break;
312
313
314 case 8:
315 {
316 if (cpu.APU_panel_scroll_select_ul_sw)
317 {
318
319
320 SETL (bank_a, 0+3, cpu.APUMemAddr, 24);
321 SETL (bank_a, 24+3, cpu.rRALR, 3);
322 }
323 else
324 {
325
326
327
328
329 word16 flts = (word16) cpu.acvFaults;
330 SETL (bank_a, 3+3, flts, 16);
331
332
333 word11 cyc = (cpu.cu.APUCycleBits >> 3) & MASK11;
334 SETL (bank_a, 18+3, cyc, 11);
335 }
336 }
337 break;
338
339
340 case 9:
341 {
342 if (cpu.APU_panel_scroll_select_ul_sw)
343 {
344
345
346
347 n &= 7;
348 SETL (bank_a, 3+3, cpu.PAR[n].SNR, 15);
349 SETL (bank_a, 18+3, cpu.PAR[n].RNR, 3);
350 SETL (bank_a, 33+3, cpu.RSDWH_R1, 3);
351 }
352 else
353 {
354
355
356
357
358
359
360 SETL1 (bank_a, 0+3, cpu.SDW0.DF);
361 SETL (bank_a, 1+3, cpu.SDW0.FC, 2);
362
363
364 word16 flts = (word16) cpu.acvFaults;
365 SETL (bank_a, 3+3, flts, 16);
366 SETL (bank_a, 30+3, cpu.TPR.TBR, 6);
367 }
368 }
369 break;
370
371
372 case 10:
373 {
374 if (cpu.APU_panel_scroll_select_ul_sw)
375 {
376
377 SETL (bank_a, 0+3, cpu.PPR.PRR, 3);
378 SETL (bank_a, 3+3, cpu.PPR.PSR, 15);
379 SETL1 (bank_a, 18+3, cpu.PPR.P);
380 SETL1 (bank_a, 19+3, cpu.cu.XSF);
381 SETL1 (bank_a, 20+3, cpu.cu.SDWAMM);
382 SETL1 (bank_a, 21+3, cpu.cu.SD_ON);
383 SETL1 (bank_a, 22+3, cpu.cu.PTWAMM);
384 SETL1 (bank_a, 23+3, cpu.cu.PT_ON);
385 SETL (bank_a, 24+3, cpu.cu.APUCycleBits, 12);
386 }
387 else
388 {
389
390 SETL1 (bank_a, 0+3, cpu.cu.IRO_ISN);
391 SETL1 (bank_a, 1+3, cpu.cu.OEB_IOC);
392 SETL1 (bank_a, 2+3, cpu.cu.EOFF_IAIM);
393 SETL1 (bank_a, 3+3, cpu.cu.ORB_ISP);
394 SETL1 (bank_a, 4+3, cpu.cu.ROFF_IPR);
395 SETL1 (bank_a, 5+3, cpu.cu.OWB_NEA);
396 SETL1 (bank_a, 6+3, cpu.cu.WOFF_OOB);
397 SETL1 (bank_a, 7+3, cpu.cu.NO_GA);
398 SETL1 (bank_a, 8+3, cpu.cu.OCB);
399 SETL1 (bank_a, 9+3, cpu.cu.OCALL);
400 SETL1 (bank_a, 10+3, cpu.cu.BOC);
401 SETL1 (bank_a, 11+3, cpu.cu.PTWAM_ER);
402 SETL1 (bank_a, 12+3, cpu.cu.CRT);
403 SETL1 (bank_a, 13+3, cpu.cu.RALR);
404 SETL1 (bank_a, 14+3, cpu.cu.SDWAM_ER);
405 SETL1 (bank_a, 15+3, cpu.cu.OOSB);
406 SETL1 (bank_a, 16+3, cpu.cu.PARU);
407 SETL1 (bank_a, 17+3, cpu.cu.PARL);
408 SETL1 (bank_a, 18+3, cpu.cu.ONC1);
409 SETL1 (bank_a, 19+3, cpu.cu.ONC2);
410 SETL (bank_a, 20+3, cpu.cu.IA, 4);
411 SETL (bank_a, 24+3, cpu.cu.IACHN, 3);
412 SETL (bank_a, 27+3, cpu.cu.CNCHN, 3);
413 SETL (bank_a, 30+3, cpu.cu.FI_ADDR, 5);
414 word1 fi = cpu.cycle == INTERRUPT_cycle ? 0 : 1;
415 SETL1 (bank_a, 35+3, fi);
416 }
417 }
418 break;
419
420
421 case 11:
422 {
423 if (cpu.APU_panel_scroll_select_ul_sw)
424 {
425
426 SETL (bank_a, 0+3, cpu.TPR.TRR, 3);
427 SETL (bank_a, 3+3, cpu.TPR.TSR, 15);
428 SETL (bank_a, 27+3, (word3) cpu.switches.cpu_num, 3);
429 SETL (bank_a, 30+3, cpu.cu.delta, 6);
430 }
431 else
432 {
433
434
435
436
437
438
439
440 SETL (bank_a, 30+3, cpu.TPR.TBR, 6);
441
442 }
443 }
444 break;
445
446
447 case 12:
448 {
449 if (cpu.APU_panel_scroll_select_ul_sw)
450 {
451
452 }
453 else
454 {
455
456 SETL (bank_a, 0+3, cpu.TPR.CA, 18);
457 SETL1 (bank_a, 18+3, cpu.cu.repeat_first);
458 SETL1 (bank_a, 19+3, cpu.cu.rpt);
459 SETL1 (bank_a, 20+3, cpu.cu.rd);
460 SETL1 (bank_a, 21+3, cpu.cu.rl);
461 SETL1 (bank_a, 22+3, cpu.cu.pot);
462
463 SETL1 (bank_a, 24+3, cpu.cu.xde);
464 SETL1 (bank_a, 25+3, cpu.cu.xdo);
465
466 SETL1 (bank_a, 27+3, cpu.cu.rfi);
467
468 SETL1 (bank_a, 29+3, cpu.cu.FIF);
469 SETL (bank_a, 30+3, cpu.cu.CT_HOLD, 6);
470 }
471 }
472 break;
473
474
475
476
477
478 case 15:
479 {
480 if (cpu.APU_panel_scroll_select_ul_sw)
481 {
482
483 SETL (bank_a, 0+3, cpu.cu.IWB, 36);
484 }
485 else
486 {
487
488 SETL (bank_a, 0+3, cpu.cu.IRODD, 36);
489 }
490 }
491 break;
492
493 default:
494 {
495 time_t t = time (NULL);
496 SETL (bank_a, 0+3, (word36) t, 36);
497 }
498 break;
499 }
500 }
501
502 static void update_cpts (void)
503 {
504
505
506 switch (cpu.CP_panel_wheel_sw)
507 {
508 case 0:
509 SETLA (bank_b, 0+3, cpu.cpt [0], 36);
510 SETLA (bank_c, 0+3, cpu.cpt [1], 36);
511 break;
512 case 1:
513 SETLA (bank_b, 0+3, cpu.cpt [2], 36);
514 SETLA (bank_c, 0+3, cpu.cpt [3], 36);
515 break;
516 case 2:
517 SETLA (bank_b, 0+3, cpu.cpt [4], 36);
518 SETLA (bank_c, 0+3, cpu.cpt [5], 36);
519 break;
520 case 3:
521 SETLA (bank_b, 0+3, cpu.cpt [6], 36);
522 SETLA (bank_c, 0+3, cpu.cpt [7], 36);
523 break;
524 case 4:
525 SETLA (bank_b, 0+3, cpu.cpt [8], 36);
526 SETLA (bank_c, 0+3, cpu.cpt [9], 36);
527 break;
528 case 5:
529 SETLA (bank_b, 0+3, cpu.cpt [10], 36);
530 SETLA (bank_c, 0+3, cpu.cpt [11], 36);
531 break;
532 case 6:
533 SETLA (bank_b, 0+3, cpu.cpt [12], 36);
534 SETLA (bank_c, 0+3, cpu.cpt [13], 36);
535 break;
536 case 7:
537 SETLA (bank_b, 0+3, cpu.cpt [14], 36);
538 SETLA (bank_c, 0+3, cpu.cpt [15], 36);
539 break;
540 case 8:
541 SETLA (bank_b, 0+3, cpu.cpt [16], 36);
542 SETLA (bank_c, 0+3, cpu.cpt [17], 36);
543 break;
544 case 9:
545 SETLA (bank_b, 0+3, cpu.cpt [18], 36);
546 SETLA (bank_c, 0+3, cpu.cpt [19], 36);
547 break;
548 case 10:
549 SETLA (bank_b, 0+3, cpu.cpt [20], 36);
550 SETLA (bank_c, 0+3, cpu.cpt [21], 36);
551 break;
552 case 11:
553 SETLA (bank_b, 0+3, cpu.cpt [22], 36);
554 SETLA (bank_c, 0+3, cpu.cpt [23], 36);
555 break;
556 case 12:
557 SETLA (bank_b, 0+3, cpu.cpt [24], 36);
558 SETLA (bank_c, 0+3, cpu.cpt [25], 36);
559 break;
560 case 13:
561 SETLA (bank_b, 0+3, cpu.cpt [26], 36);
562 SETLA (bank_c, 0+3, cpu.cpt [27], 36);
563 break;
564 }
565
566 SETL1 (bank_b, 36+3, cpu.panel4_red_ready_light_state);
567
568 SETL1 (bank_c, 36+3, cpu.panel7_enabled_light_state);
569 }
570
571 static void update_data_1 (void)
572 {
573
574 SETL (bank_d, 0+3, cpu.portAddr [cpu.DATA_panel_d1_sw], 24);
575 SETL (bank_e, 0+3, cpu.portData [cpu.DATA_panel_d1_sw], 36);
576 }
577
578 static void update_data_2 (void)
579 {
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594 SETL (bank_d, 0+3, cpu.PAR[cpu.DATA_panel_d2_sw].PR_BITNO, 6);
595 SETL (bank_d, 6+3, cpu.PAR[cpu.DATA_panel_d2_sw].SNR, 15);
596 SETL (bank_d, 18+3, cpu.PAR[cpu.DATA_panel_d2_sw].WORDNO, 18);
597
598 SETL (bank_e, 0+3, cpu.PAR[cpu.DATA_panel_d2_sw].WORDNO, 18);
599 SETL (bank_e, 18+3, cpu.PAR[cpu.DATA_panel_d2_sw].AR_CHAR, 2);
600 SETL (bank_e, 20+3, cpu.PAR[cpu.DATA_panel_d2_sw].AR_BITNO, 4);
601 }
602
603 static void update_data_3 (void)
604 {
605
606
607 switch (cpu.DATA_panel_d3_sw)
608 {
609 case 0:
610
611
612
613 SETL (bank_d, 0+3, cpu.du.D1_PTR_W, 18);
614
615
616
617 break;
618 case 1:
619
620
621
622 SETL (bank_d, 0+3, cpu.du.D2_PTR_W, 18);
623
624
625
626 break;
627 case 2:
628
629
630
631 SETL (bank_d, 0+3, cpu.du.D3_PTR_W, 18);
632
633
634
635 break;
636 case 3:
637
638 break;
639 case 4:
640
641 break;
642 case 5:
643
644 break;
645 case 6:
646
647
648 SETL (bank_e, 0+3, cpu.rTR, 27);
649 break;
650 case 7:
651
652 break;
653 case 8:
654
655
656 SETL (bank_d, 0+3, IWB_IRODD, 36);
657 SETL (bank_e, 0+3, cpu.PPR.IC, 18);
658 break;
659 case 9:
660
661 SETL (bank_e, 0+3, cpu.AM_tally, 12);
662 break;
663 }
664 }
665
666 static void update_data_4 (void)
667 {
668
669 }
670
671 static void update_data_5 (void)
672 {
673 switch (cpu.DATA_panel_d3_sw)
674 {
675 case 0:
676
677 break;
678 case 1:
679
680 break;
681 case 2:
682
683 break;
684 case 3:
685
686 break;
687 case 4:
688
689 break;
690 case 5:
691
692 break;
693 case 6:
694
695 break;
696 case 7:
697 SETL (bank_d, 0+3, cpu.du.CHTALLY, 24);
698 break;
699 case 8:
700
701 break;
702 }
703 }
704
705 static void update_data_6 (void)
706 {
707
708 }
709
710 static void update_data_7 (void)
711 {
712
713 }
714
715 static void update_data_scroll (void)
716 {
717 switch (cpu.DATA_panel_wheel_sw)
718 {
719 case 0:
720 {
721 SETL (bank_d, 0+3, cpu.rA, 36);
722 SETL (bank_e, 0+3, cpu.rQ, 36);
723 }
724 break;
725
726 case 1:
727 {
728 SETL (bank_d, 0+3, cpu.rX[0], 18);
729 SETL (bank_d, 18+3, cpu.rX[1], 18);
730 SETL (bank_e, 0+3, cpu.rX[2], 18);
731 SETL (bank_e, 18+3, cpu.rX[3], 18);
732 }
733 break;
734
735 case 2:
736 {
737 SETL (bank_d, 0+3, cpu.rX[4], 18);
738 SETL (bank_d, 18+3, cpu.rX[5], 18);
739 SETL (bank_e, 0+3, cpu.rX[6], 18);
740 SETL (bank_e, 18+3, cpu.rX[7], 18);
741 }
742 break;
743
744 case 3:
745 {
746 SETL (bank_d, 0+3, cpu.rE, 8);
747 SETL (bank_d, 8+3, cpu.rA >> 8, 36 - 8);
748 SETL (bank_e, 0+3, cpu.rA, 8);
749 SETL (bank_e, 0+3, cpu.rQ >> 8, 36 - 8);
750 }
751 break;
752
753 case 4:
754 {
755
756 SETL (bank_d, 0+3, cpu.rE, 8);
757 }
758 break;
759
760 case 5:
761 {
762
763 }
764 break;
765
766 case 6:
767 {
768
769
770 SETL (bank_d, 0+3, cpu.history[L68_APU_HIST_REG][cpu.DATA_panel_hr_sel_sw][0], 36);
771 SETL (bank_e, 0+3, cpu.history[L68_APU_HIST_REG][cpu.DATA_panel_hr_sel_sw][1], 36);
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815 }
816 break;
817
818 case 7:
819 {
820
821
822 SETL (bank_e, 0+3, cpu.ou.directOperand, 36);
823
824 }
825 break;
826
827 case 8:
828 {
829
830 SETL (bank_d, 0+3, cpu.faultRegister [0] & 0777777777760LLU, 36);
831
832 }
833 break;
834
835 case 9:
836 {
837
838 SETL (bank_d, 0+3, cpu.MR.r, 36);
839 memcpy (bank_e, bank_d, sizeof (bank_e));
840 }
841 break;
842
843 case 10:
844 {
845
846 SETL (bank_d, 0+3, cpu.history[CU_HIST_REG][cpu.DATA_panel_hr_sel_sw][0], 36);
847 SETL (bank_e, 0+3, cpu.history[CU_HIST_REG][cpu.DATA_panel_hr_sel_sw][1], 36);
848 }
849 break;
850
851 case 11:
852 {
853
854 SETL (bank_d, 0+3, cpu.history[L68_OU_HIST_REG][cpu.DATA_panel_hr_sel_sw][0], 36);
855 SETL (bank_e, 0+3, cpu.history[L68_OU_HIST_REG][cpu.DATA_panel_hr_sel_sw][1], 36);
856 }
857 break;
858
859 case 12:
860 {
861
862 SETL (bank_d, 0+3, cpu.history[L68_DU_HIST_REG][cpu.DATA_panel_hr_sel_sw][0], 36);
863 SETL (bank_e, 0+3, cpu.history[L68_DU_HIST_REG][cpu.DATA_panel_hr_sel_sw][1], 36);
864 }
865 break;
866
867 case 13:
868 {
869
870 SETL (bank_d, 0+3, cpu.cu.IWB, 36);
871 SETL (bank_e, 0+3, cpu.cu.IRODD, 36);
872 }
873 break;
874 }
875 }
876
877 static void update_data (void)
878 {
879 switch (cpu.DATA_panel_ds_sw)
880 {
881 case 0:
882 update_data_1 ();
883 break;
884 case 1:
885 update_data_2 ();
886 break;
887 case 2:
888 update_data_3 ();
889 break;
890 case 3:
891 update_data_scroll ();
892 break;
893 case 4:
894 update_data_4 ();
895 break;
896 case 5:
897 update_data_5 ();
898 break;
899 case 6:
900 update_data_6 ();
901 break;
902 case 7:
903 update_data_7 ();
904 break;
905 default:
906 break;
907 }
908 }
909
910 static void update_display (void)
911 {
912 SETL (bank_f, 0, cpu.cu.IR, 18);
913 SETL (bank_f, 18, cpu.history_cyclic [0], 4);
914 SETL (bank_f, 22, cpu.history_cyclic [1], 4);
915 SETL (bank_f, 26, cpu.history_cyclic [2], 4);
916 SETL (bank_f, 30, cpu.history_cyclic [3], 4);
917 SETL (bank_g, 0, cpu.PPR.IC, 18);
918
919
920 SETL (bank_g, 18, cpu.portSelect == 0 ? 1 : 0, 1);
921 SETL (bank_g, 19, cpu.portSelect == 1 ? 1 : 0, 1);
922 SETL (bank_g, 20, cpu.portSelect == 2 ? 1 : 0, 1);
923 SETL (bank_g, 21, cpu.portSelect == 3 ? 1 : 0, 1);
924
925
926
927
928 bool exc_int = cpu.cycle == INTERRUPT_cycle ||
929 cpu.cycle == INTERRUPT_EXEC_cycle
930 ;
931 SETL (bank_g, 34, exc_int ? 1 : 0, 1);
932
933
934 bool ins_fch = cpu.cycle == INTERRUPT_cycle ||
935 cpu.cycle == FAULT_cycle ||
936 cpu.cycle == FETCH_cycle;
937 SETL (bank_g, 35, ins_fch ? 1 : 0, 1);
938
939
940
941
942
943
944
945 SETL (bank_h, 3, cpu.cu.IWB, 36);
946
947
948 SETL (bank_i, 3, cpu.IWRAddr, 36);
949
950
951 SETL (bank_j, 3, cpu.PPR.IC, 18);
952
953
954
955 word2 pia_poa = cpu.prepare_state >> 6;
956 SETL (bank_j, 21, pia_poa, 2);
957 SETL (bank_j, 23, cpu.du.POL, 2);
958 SETL (bank_j, 24, cpu.du.POP, 1);
959 SETL (bank_j, 25, cpu.prepare_state, 6);
960
961 SETL (bank_j, 31, cpu.wasXfer, 1);
962 SETL (bank_j, 32, cpu.cu.xde, 1);
963 SETL (bank_j, 33, cpu.cu.xdo, 1);
964 SETL1 (bank_j, 34, USE_IRODD);
965 SETL (bank_j, 35, cpu.cu.rpt, 1);
966 SETL (bank_j, 36, cpu.cu.rl, 1);
967 SETL (bank_j, 37, cpu.cu.rd, 1);
968
969 SETL (bank_j, 38, TSTF (cpu.cu.IR, I_NBAR), 1);
970
971
972
973
974
975 SETL (bank_k, 21, cpu.dataMode, 7);
976
977
978
979
980
981
982
983
984
985 SETL (bank_l, 3, cpu.TPR.CA, 18);
986
987 SETL (bank_m, 3, cpu.ou.RS, 9);
988 SETL (bank_m, 12, cpu.ou.characterOperandSize ? 1 : 0, 1);
989 SETL (bank_m, 13, cpu.ou.characterOperandOffset & MASK3, 3);
990 SETL (bank_m, 16, cpu.ou.crflag, 1);
991 SETL (bank_m, 17, cpu.ou.directOperandFlag ? 1 : 0, 1);
992 SETL (bank_m, 18, cpu.ou.RS, 9);
993 SETL (bank_m, 27, cpu.ou.cycle, 9);
994 SETL (bank_m, 36, cpu.ou.RB1_FULL, 1);
995 SETL (bank_m, 37, cpu.ou.RP_FULL, 1);
996 SETL (bank_m, 38, cpu.ou.RS_FULL, 1);
997
998
999
1000 SETL1 (bank_n, 3, cpu.du.cycle2 & du2_DUD);
1001
1002
1003
1004
1005 SETL1 (bank_n, 7, cpu.du.cycle1 & du1_FA_I1);
1006
1007
1008
1009 SETL1 (bank_n, 10, cpu.du.cycle2 & du2_DGDB);
1010
1011 SETL1 (bank_n, 11, cpu.du.cycle2 & du2_DGBD);
1012
1013
1014
1015 SETL1 (bank_n, 14, cpu.du.cycle1 & du1_FA_I2);
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030 SETL1 (bank_n, 28, cpu.du.cycle1 & du1_FA_I3);
1031
1032
1033
1034 SETL1 (bank_n, 31, cpu.du.cycle2 & du2_GSTR);
1035
1036
1037 SETL1 (bank_n, 32, cpu.du.cycle2 & du2_ANSTR);
1038
1039
1040
1041
1042
1043
1044 SETL1 (bank_n, 39, cpu.du.cycle2 & du2_FRND);
1045
1046
1047 SETL1 (bank_o, 3, cpu.du.cycle2 & du2_ANLD1);
1048
1049 SETL1 (bank_o, 4, cpu.du.cycle2 & du2_ANLD2);
1050
1051 SETL1 (bank_o, 5, cpu.du.cycle2 & du2_NLD1);
1052
1053 SETL1 (bank_o, 6, cpu.du.cycle2 & du2_NLD2);
1054
1055 SETL1 (bank_o, 7, cpu.du.cycle2 & du2_LDWRT1);
1056
1057 SETL1 (bank_o, 8, cpu.du.cycle2 & du2_LDWRT2);
1058
1059
1060
1061
1062 SETL1 (bank_o, 12, cpu.du.cycle2 & du2_FEXOP);
1063
1064 SETL1 (bank_o, 13, cpu.du.cycle2 & du2_FBLNK);
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083 SETL1 (bank_o, 31, !(cpu.du.cycle2 & du2_nFLEN_128));
1084
1085 SETL1 (bank_o, 32, !(cpu.du.cycle2 & du2_nFEND_SEQ));
1086
1087
1088
1089
1090
1091
1092
1093
1094 SETL (bank_p, 3, cpu.apu.state, 34);
1095
1096
1097 }
1098
1099 #define Z(z) (void)memset (z, 0, sizeof (z))
1100 #define O(z) (void)memset (z, 1, sizeof (z))
1101
1102 #define nibble(bank, n) \
1103 '@' + \
1104 (bank [n + 0] ? 020 : 0) + \
1105 (bank [n + 1] ? 010 : 0) + \
1106 (bank [n + 2] ? 004 : 0) + \
1107 (bank [n + 3] ? 002 : 0) + \
1108 (bank [n + 4] ? 001 : 0)
1109
1110 #define nibbles(bank) nibble (bank, 0), nibble (bank, 5), \
1111 nibble (bank, 10), nibble (bank, 15), \
1112 nibble (bank, 20), nibble (bank, 25), \
1113 nibble (bank, 30), nibble (bank, 35)
1114
1115 static void lwrite (FD fd, const void * buf, size_t count)
1116 {
1117 #if defined(__MINGW64__) || defined(__MINGW32__)
1118 DWORD bytes_written;
1119 if(!WriteFile(fd, buf, count, &bytes_written, NULL))
1120 {
1121 (void)fprintf(stderr, "Error\r\n");
1122 CloseHandle(fd);
1123 exit (1);
1124 }
1125 #else
1126 write (fd, buf, count);
1127 #endif
1128 }
1129
1130 static void send_lamp_data (FD fd)
1131 {
1132 char buf [129];
1133 (void)sprintf (buf, "0%c%c%c%c%c%c%c%c\n", nibbles (bank_a));
1134 lwrite (fd, buf, 10);
1135 (void)sprintf (buf, "1%c%c%c%c%c%c%c%c\n", nibbles (bank_b));
1136 lwrite (fd, buf, 10);
1137 (void)sprintf (buf, "2%c%c%c%c%c%c%c%c\n", nibbles (bank_c));
1138 lwrite (fd, buf, 10);
1139 (void)sprintf (buf, "3%c%c%c%c%c%c%c%c\n", nibbles (bank_d));
1140 lwrite (fd, buf, 10);
1141 (void)sprintf (buf, "4%c%c%c%c%c%c%c%c\n", nibbles (bank_e));
1142 lwrite (fd, buf, 10);
1143 (void)sprintf (buf, "5%c%c%c%c%c%c%c%c\n", nibbles (bank_f));
1144 lwrite (fd, buf, 10);
1145 (void)sprintf (buf, "6%c%c%c%c%c%c%c%c\n", nibbles (bank_g));
1146 lwrite (fd, buf, 10);
1147 (void)sprintf (buf, "7%c%c%c%c%c%c%c%c\n", nibbles (bank_h));
1148 lwrite (fd, buf, 10);
1149 (void)sprintf (buf, "8%c%c%c%c%c%c%c%c\n", nibbles (bank_i));
1150 lwrite (fd, buf, 10);
1151 (void)sprintf (buf, "9%c%c%c%c%c%c%c%c\n", nibbles (bank_j));
1152 lwrite (fd, buf, 10);
1153 (void)sprintf (buf, ":%c%c%c%c%c%c%c%c\n", nibbles (bank_k));
1154 lwrite (fd, buf, 10);
1155 (void)sprintf (buf, ";%c%c%c%c%c%c%c%c\n", nibbles (bank_l));
1156 lwrite (fd, buf, 10);
1157 (void)sprintf (buf, "<%c%c%c%c%c%c%c%c\n", nibbles (bank_m));
1158 lwrite (fd, buf, 10);
1159 (void)sprintf (buf, "=%c%c%c%c%c%c%c%c\n", nibbles (bank_n));
1160 lwrite (fd, buf, 10);
1161 (void)sprintf (buf, ">%c%c%c%c%c%c%c%c\n", nibbles (bank_o));
1162 lwrite (fd, buf, 10);
1163 (void)sprintf (buf, "?%c%c%c%c%c%c%c%c\n", nibbles (bank_p));
1164 lwrite (fd, buf, 10);
1165 #if defined(__MINGW64__) || defined(__MINGW32__)
1166 #else
1167 syncfs (fd);
1168 #endif
1169 }
1170
1171 static void set_message (void)
1172 {
1173 int nchars = (int) strlen (message);
1174 int nbits = nchars * 8;
1175 int r, c;
1176
1177 #define start_row 7
1178 for (r = 0; r < 0 + 8; r ++)
1179 {
1180 for (c = 0; c < ncols; c ++)
1181 {
1182 int c2 = (c + c_offset) % nbits;
1183 int char2 = c2 / 8;
1184 unsigned char fontbits = font8x8_basic [(unsigned int) message [(unsigned int) char2]] [r];
1185 int whichbit = c2 % 8;
1186 unsigned char bit1 = fontbits & (1 << ( whichbit));
1187 banks [r + start_row] [c] = !!bit1;
1188
1189 }
1190 }
1191 c_offset = (c_offset + 1) % nbits;
1192 }
1193
1194 static int time_handler (FD fd)
1195 {
1196
1197 if (0)
1198 {
1199 int sec1 = (int) (clock () / CLOCKS_PER_SEC) & 1;
1200 if (sec1)
1201 {
1202 Z (bank_a);
1203 Z (bank_b);
1204 Z (bank_c);
1205 Z (bank_d);
1206 Z (bank_e);
1207 Z (bank_f);
1208 Z (bank_g);
1209 Z (bank_h);
1210 Z (bank_i);
1211 Z (bank_j);
1212 Z (bank_k);
1213 Z (bank_l);
1214 Z (bank_m);
1215 Z (bank_n);
1216 Z (bank_o);
1217 Z (bank_p);
1218 }
1219 else
1220 {
1221 O (bank_a);
1222 O (bank_b);
1223 O (bank_c);
1224 O (bank_d);
1225 O (bank_e);
1226 O (bank_f);
1227 O (bank_g);
1228 O (bank_h);
1229 O (bank_i);
1230 O (bank_j);
1231 O (bank_k);
1232 O (bank_l);
1233 O (bank_m);
1234 O (bank_n);
1235 O (bank_o);
1236 O (bank_p);
1237 }
1238 send_lamp_data (fd);
1239 return TRUE;
1240 }
1241
1242 Z (bank_a);
1243 Z (bank_b);
1244 Z (bank_c);
1245 Z (bank_d);
1246 Z (bank_e);
1247 Z (bank_f);
1248 Z (bank_g);
1249 Z (bank_h);
1250 Z (bank_i);
1251 Z (bank_j);
1252 Z (bank_k);
1253 Z (bank_l);
1254 Z (bank_m);
1255 Z (bank_n);
1256 Z (bank_o);
1257 Z (bank_p);
1258
1259 update_apu ();
1260 update_cpts ();
1261 update_data ();
1262 update_display ();
1263 if (message [0])
1264 set_message ();
1265 send_lamp_data (fd);
1266 return TRUE;
1267 }
1268
1269 static unsigned char port_buf [9];
1270 static bool port_data [40];
1271 static int port_state = 0;
1272
1273 static void update_port (FD port_fd)
1274 {
1275 more:;
1276 #if !defined(__MINGW64__)
1277 # if !defined(__MINGW32__)
1278 if (poll (& (struct pollfd) { .fd = port_fd, .events = POLLIN }, 1, 0) == 1)
1279 # endif
1280 #endif
1281 {
1282 unsigned char ch;
1283 #if defined(__MINGW64__) || defined(__MINGW32__)
1284 DWORD bytes_read;
1285 ReadFile(port_fd, &ch, 1, &bytes_read, NULL);
1286 ssize_t nr = bytes_read;
1287 #else
1288 ssize_t nr = read (port_fd, & ch, 1);
1289 #endif
1290 if (nr != 1)
1291 {
1292 static int first = 1;
1293 if (first)
1294 {
1295 perror ("read");
1296 first = 0;
1297 }
1298 port_state = 0;
1299 return;
1300
1301 }
1302
1303 if (ch & 040)
1304 {
1305 port_state = 0;
1306 }
1307 if (port_state < 0 || port_state > 8)
1308 {
1309
1310 port_state = 0;
1311 return;
1312 }
1313 port_buf [port_state ++] = ch;
1314 if (port_state < 9)
1315 goto more;
1316
1317
1318
1319
1320
1321
1322
1323 port_data [ 0] = !! (port_buf [1] & 020);
1324 port_data [ 1] = !! (port_buf [1] & 010);
1325 port_data [ 2] = !! (port_buf [1] & 004);
1326 port_data [ 3] = !! (port_buf [1] & 002);
1327 port_data [ 4] = !! (port_buf [1] & 001);
1328
1329 port_data [ 5] = !! (port_buf [2] & 020);
1330 port_data [ 6] = !! (port_buf [2] & 010);
1331 port_data [ 7] = !! (port_buf [2] & 004);
1332 port_data [ 8] = !! (port_buf [2] & 002);
1333 port_data [ 9] = !! (port_buf [2] & 001);
1334
1335 port_data [10] = !! (port_buf [3] & 020);
1336 port_data [11] = !! (port_buf [3] & 010);
1337 port_data [12] = !! (port_buf [3] & 004);
1338 port_data [13] = !! (port_buf [3] & 002);
1339 port_data [14] = !! (port_buf [3] & 001);
1340
1341 port_data [15] = !! (port_buf [4] & 020);
1342 port_data [16] = !! (port_buf [4] & 010);
1343 port_data [17] = !! (port_buf [4] & 004);
1344 port_data [18] = !! (port_buf [4] & 002);
1345 port_data [19] = !! (port_buf [4] & 001);
1346
1347 port_data [20] = !! (port_buf [5] & 020);
1348 port_data [21] = !! (port_buf [5] & 010);
1349 port_data [22] = !! (port_buf [5] & 004);
1350 port_data [23] = !! (port_buf [5] & 002);
1351 port_data [24] = !! (port_buf [5] & 001);
1352
1353 port_data [25] = !! (port_buf [6] & 020);
1354 port_data [26] = !! (port_buf [6] & 010);
1355 port_data [27] = !! (port_buf [6] & 004);
1356 port_data [28] = !! (port_buf [6] & 002);
1357 port_data [29] = !! (port_buf [6] & 001);
1358
1359 port_data [30] = !! (port_buf [7] & 020);
1360 port_data [31] = !! (port_buf [7] & 010);
1361 port_data [32] = !! (port_buf [7] & 004);
1362 port_data [33] = !! (port_buf [7] & 002);
1363 port_data [34] = !! (port_buf [7] & 001);
1364
1365 port_data [35] = !! (port_buf [8] & 020);
1366 port_data [36] = !! (port_buf [8] & 010);
1367 port_data [37] = !! (port_buf [8] & 004);
1368 port_data [38] = !! (port_buf [8] & 002);
1369 port_data [39] = !! (port_buf [8] & 001);
1370
1371
1372
1373
1374
1375 port_state = 0;
1376
1377 #define SETS(word, data, from, n) \
1378 for (uint i = 0; i < (n); i ++) \
1379 if (data [from + i]) \
1380 (word) |= 1llu << ((n) - 1 - i); \
1381 else \
1382 (word) &= ~ (1llu << ((n) - 1 - i))
1383
1384 switch (port_buf [0])
1385 {
1386 case '0':
1387 SETS (cpu.APU_panel_segno_sw, port_data, 0, 15);
1388 SETS (cpu.APU_panel_enable_match_ptw_sw, port_data, 15, 1);
1389 SETS (cpu.APU_panel_enable_match_sdw_sw, port_data, 16, 1);
1390 SETS (cpu.APU_panel_scroll_select_ul_sw, port_data, 17, 1);
1391 SETS (cpu.APU_panel_scroll_select_n_sw, port_data, 18, 4);
1392 SETS (cpu.APU_panel_scroll_wheel_sw, port_data, 22, 4);
1393 break;
1394
1395 case '1':
1396 SETS (cpu.switches.data_switches, port_data, 0, 36);
1397 break;
1398
1399 case '2':
1400 SETS (cpu.switches.addr_switches, port_data, 0, 18);
1401 SETS (cpu.APU_panel_enter_sw, port_data, 18, 1);
1402 SETS (cpu.APU_panel_display_sw, port_data, 19, 1);
1403 SETS (cpu.panelInitialize, port_data, 20, 1);
1404 SETS (cpu.CP_panel_wheel_sw, port_data, 21, 4);
1405 break;
1406
1407 case '3':
1408 SETS (cpu.DATA_panel_ds_sw, port_data, 0, 4);
1409
1410
1411
1412
1413 switch (cpu.DATA_panel_ds_sw)
1414 {
1415 case 0:
1416 SETS (cpu.DATA_panel_d1_sw, port_data, 4, 4);
1417 break;
1418 case 1:
1419 SETS (cpu.DATA_panel_d2_sw, port_data, 4, 4);
1420 break;
1421 case 2:
1422 SETS (cpu.DATA_panel_d3_sw, port_data, 4, 4);
1423 break;
1424 case 3:
1425 SETS (cpu.DATA_panel_wheel_sw, port_data, 4, 4);
1426 break;
1427 case 4:
1428 SETS (cpu.DATA_panel_d4_sw, port_data, 4, 4);
1429 break;
1430 case 5:
1431 SETS (cpu.DATA_panel_d5_sw, port_data, 4, 4);
1432 break;
1433 case 6:
1434 SETS (cpu.DATA_panel_d6_sw, port_data, 4, 4);
1435 break;
1436 case 7:
1437 SETS (cpu.DATA_panel_d7_sw, port_data, 4, 4);
1438 break;
1439 }
1440 SETS (cpu.DATA_panel_addr_stop_sw, port_data, 8, 4);
1441 SETS (cpu.DATA_panel_enable_sw, port_data, 12, 1);
1442 SETS (cpu.DATA_panel_validate_sw, port_data, 13, 1);
1443 SETS (cpu.DATA_panel_auto_fast_sw, port_data, 14, 1);
1444 SETS (cpu.DATA_panel_auto_slow_sw, port_data, 15, 1);
1445 SETS (cpu.DATA_panel_cycle_sw, port_data, 16, 3);
1446 SETS (cpu.DATA_panel_step_sw, port_data, 19, 1);
1447 SETS (cpu.DATA_panel_s_trig_sw, port_data, 20, 1);
1448 SETS (cpu.DATA_panel_execute_sw, port_data, 21, 1);
1449 SETS (cpu.DATA_panel_scope_sw, port_data, 22, 1);
1450 SETS (cpu.DATA_panel_init_sw, port_data, 23, 1);
1451 SETS (cpu.DATA_panel_exec_sw, port_data, 24, 1);
1452 SETS (cpu.DATA_panel_hr_sel_sw, port_data, 25, 4);
1453 SETS (cpu.DATA_panel_trackers_sw, port_data, 29, 4);
1454 break;
1455 }
1456 goto more;
1457 }
1458 }
1459
1460 static volatile bool scraperRunning = false;
1461 static volatile bool scraperCancel = false;
1462
1463 static void * scraperThreadMain (void * arg)
1464 {
1465 sim_printf ("panel scraper\r\n");
1466 uint cpuNum = (uint) * (int *) arg;
1467 panel_cpup = cpus + cpuNum;
1468
1469 const char *device = "/dev/ttyUSB1";
1470
1471 struct termios config;
1472 int fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
1473 if(fd == -1)
1474 {
1475 (void)printf( "failed to open port\r\n" );
1476 goto die;
1477 }
1478 if(tcgetattr(fd, &config) < 0)
1479 {
1480 (void)printf ("can't get\r\n");
1481 close (fd);
1482 goto die;
1483 }
1484
1485
1486
1487
1488
1489
1490
1491
1492 config.c_iflag &= ~(unsigned int) (IGNBRK | BRKINT | ICRNL |
1493 INLCR | PARMRK | INPCK | ISTRIP | IXON);
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505 config.c_oflag = 0;
1506
1507
1508
1509
1510
1511
1512
1513 config.c_lflag &= ~(unsigned int) (ECHO | ECHONL | ICANON | IEXTEN | ISIG);
1514
1515
1516
1517
1518
1519
1520
1521 config.c_cflag &= ~(unsigned int) (CSIZE | PARENB);
1522 config.c_cflag |= CS8;
1523
1524
1525
1526
1527
1528 config.c_cc[VMIN] = 1;
1529 config.c_cc[VTIME] = 0;
1530
1531
1532
1533
1534
1535 if(cfsetispeed(&config, B38400) < 0 || cfsetospeed(&config, B38400) < 0)
1536 {
1537 (void)printf ("can't set speed\r\n");
1538 close (fd);
1539 goto die;
1540 }
1541
1542
1543
1544
1545 if(tcsetattr(fd, TCSAFLUSH, &config) < 0)
1546 {
1547 (void)printf ("can't set %d\r\n", errno);
1548 close (fd);
1549 goto die;
1550 }
1551
1552 while (1)
1553 {
1554 if (scraperCancel)
1555 goto die;
1556 time_handler (fd);
1557 update_port (fd);
1558
1559
1560 sim_usleep (80000);
1561 }
1562
1563 die:;
1564 if (fd != -1)
1565 close (fd);
1566 fd = -1;
1567 scraperRunning = false;
1568 return NULL;
1569 }
1570
1571 void panelScraperInit (void)
1572 {
1573 scraperRunning = false;
1574 scraperCancel = false;
1575 }
1576
1577 int panelScraperStart (void)
1578 {
1579 if (scraperRunning)
1580 {
1581 sim_printf ("scraper already running\r\n");
1582 return SCPE_ARG;
1583 }
1584
1585 scraperCancel = false;
1586
1587
1588 scraperThreadArg = 0;
1589
1590 int rc = pthread_create (& scraperThread, NULL, scraperThreadMain,
1591 & scraperThreadArg);
1592 if (rc == 0)
1593 scraperRunning = true;
1594 else
1595 {
1596 sim_printf ("pthread_create returned %d\r\n", rc);
1597 return SCPE_ARG;
1598 }
1599 return SCPE_OK;
1600 }
1601
1602 int panelScraperStop (void)
1603 {
1604 if (! scraperRunning)
1605 {
1606 sim_printf ("scraper not running\r\n");
1607 return SCPE_ARG;
1608 }
1609
1610 scraperCancel = true;
1611
1612 sim_printf ("scraper signaled\r\n");
1613 return SCPE_OK;
1614 }
1615
1616 int panelScraperMsg (const char * msg)
1617 {
1618 c_offset = 0;
1619
1620 if (msg)
1621 {
1622 strncpy (message, msg, sizeof (message));
1623 message [msgLen - 1] = 0;
1624 }
1625 else
1626 message [0] = 0;
1627 return SCPE_OK;
1628 }
1629