source: buchla-68k/rom/romp.c@ 7ecfb7b

Last change on this file since 7ecfb7b was 7ecfb7b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Unused variables and parameters.

  • Property mode set to 100644
File size: 68.0 KB
Line 
1/*
2 ============================================================================
3 romp.c -- ROMP debug monitor
4 (c) Copyright 1987,1988 -- D.N. Lynx Crowe
5
6 See ROMPVER, below, for version number and date.
7
8 CAUTION: This code is designed to live in PROM, so initialized
9 variables are PERMANENTLY initialized, since the compiler assigns
10 initialized variables to the data segment, which ends up in PROM.
11
12 Un-initialized variables go into the bss segment, which ends up in RAM.
13
14 Set ON_B700 non-zero to get a Buchla 700 PROM,
15 or zero to get a NASA 3D Helmet Display PROM.
16 ============================================================================
17*/
18
19#define ROMPVER "22.00 -- 1988-06-20"
20
21#define TINYMSG 0 /* 1 for short messages, 0 for normal ones */
22
23#define ON_B700 1 /* 1 for Buchla 700, 0 for NASA */
24#define ONEMEG 1 /* 1 if 1024K, 0 if 512K RAM space (Buchla 700) */
25
26#include "rom.h"
27
28#if ON_B700
29#define USER_RAM 0x00010000L /* Start of user RAM (TPA) */
30#if ONEMEG
31#define RAM_TOP 0x000FFFFEL /* Default top word of memory */
32#define ISTACK 0x000FFFFEL /* Default initial stack */
33#else
34#define RAM_TOP 0x0007FFFEL /* Default top word of memory */
35#define ISTACK 0x0007FFFEL /* Default initial stack */
36#endif
37#define KB_EI 2 /* Enable level for panel */
38#define DEFIPL 2 /* Default internal processor level */
39#define INITSR 0x2200 /* Default initial status register */
40#define BOOTFILE "midas.abs" /* Boot file name */
41#define BOOTKEY 39 /* Boot panel key */
42#define ROMPKEY 40 /* ROMP panel key */
43#define FIFOLIM 60000 /* FIFO clear limit */
44#define I_TABX 53 /* Tablet X */
45#define I_TABY 54 /* Tablet Y */
46#define I_CURX 55 /* Cursor X */
47#define I_CURY 56 /* Cursor Y */
48#define I_LONGL 57 /* LongPot Left */
49#define I_LONGR 58 /* LongPot Right */
50#define I_SCROLL 59 /* Scroll */
51#define I_TEMPO 73 /* Tempo Multiplier */
52#define I_TIME 74 /* Time Scaling */
53#define I_TUNE 75 /* Fine Tuning */
54#define I_LEVEL 76 /* Amplitude */
55#define BARBASE 5120L /* Base of bars in VSDD RAM */
56#define SWBASE 38400L /* Base of switches in VSDD RAM */
57#define MARGIN 4 /* Offset from left edge of screen */
58#else
59#define DEFIPL 3
60#define USER_RAM 0x00008000L
61#define RAM_TOP 0x0001FFFEL
62#define ISTACK 0x0001FFFEL
63#define INITSR 0x2300
64#endif
65
66#define ROMADDR 0x00100000L
67
68#define PRM_DATE 0x0100008L
69#define PRM_VERS 0x0100002L
70
71#define BPINST 0x4E4F /* breakpoint instruction */
72
73#define CRLF "\r\n"
74
75#define TACK "K\r" /* good response from load command */
76#define NACK "?\r" /* bad response from load command */
77
78#define SREC9 "04000000FB" /* tail of a type 9 Motorola S-Record */
79
80#define MON_C 1 /* monitor character code */
81#define MON_S 2 /* monitor short code */
82#define MON_L 4 /* monitor long code */
83
84/*
85 ============================================================================
86 error message string definitions
87 ============================================================================
88*/
89
90#define EMSG1 "\r\n** Command error **\r\n"
91#define EMSG2 "\r\n** Invalid parameter **\r\n"
92#define EMSG3 "\r\n** Unrecognized command **\r\n"
93
94#define EMSG5 "\r\n** Command not repeatable **\r\n"
95#define EMSG6 "\r\n** Invalid line terminator **\r\n"
96#define EMSG7 "\r\n** do_cmd() switch failed **\r\n"
97
98#define CANNED "\r\n----- Cancelled -----\r\n"
99
100/*
101 ============================================================================
102 initialized variables (These end up in the data segment in PROM)
103 ============================================================================
104*/
105
106struct cmdent { /* command table entry */
107
108 int8_t *cname; /* command name pointer */
109 int16_t (*cp)(void); /* command parser function pointer */
110 int16_t (*cx)(void); /* command execution function pointer */
111 int8_t *hstr; /* help string pointer */
112};
113
114static struct cmdent cmtab[] = {
115
116#if ON_B700
117 {"adisp", cp_null, cx_adsp, ""},
118 {"boot", cp_boot, cx_boot, ""},
119 {"bpb", cp_null, cx_bpb, ""},
120#endif
121
122 {"check", cp_chek, cx_chek, "start,end"},
123 {"copy", cp_copy, cx_copy, "from,to,len"},
124
125#if ON_B700
126 {"crash", cp_null, cx_crsh, ""},
127 {"dinit", cp_null, cx_dini, ""},
128#endif
129
130 {"dump", cp_dump, cx_dump, "from[,[to=from][,width=16]]"},
131 {"exit", cp_null, cx_exit, ""},
132 {"fill", cp_fill, cx_fill, "loc,count,byte"},
133 {"go", cp_go, cx_go, "[addr][,[brk1][,brk2]]"},
134 {"help", cp_null, cx_help, ""},
135 {"ipl", cp_ilev, cx_ilev, "level"},
136 {"ldump", cp_ldmp, cx_ldmp, "from[,[to=from][,width=4]]"},
137 {"load", cp_null, cx_load, ""},
138
139#if ON_B700
140 {"midas", cp_null, cx_mlod, ""},
141#endif
142
143 {"monc", cp_monc, cx_mon, "addr"},
144 {"mons", cp_mons, cx_mon, "addr"},
145 {"monl", cp_monl, cx_mon, "addr"},
146 {"mset", cp_mset, cx_mset, "addr,b1[,...,bn]"},
147 {"mtest", cp_mtst, cx_mtst, hs_mtst},
148 {"next", cp_null, cx_next, ""},
149 {"obmap", cp_null, cx_omap, ""},
150
151#if ON_B700
152 {"read", cp_read, cx_read, "sector,buffer,count"},
153#endif
154
155 {"regs", cp_null, cx_regs, ""},
156 {"reset", cp_null, cx_rest, ""},
157 {"rset", cp_rset, cx_rset, "register,value"},
158 {"vregs", cp_null, cx_vreg, ""},
159 {"vrset", cp_vrst, cx_vrst, "register,value"},
160 {"wdump", cp_wdmp, cx_wdmp, "from[,[to=from][,width=8]]"},
161 {"wfill", cp_wfil, cx_wfil, "loc,count,word"},
162
163#if ON_B700
164 {"write", cp_read, cx_writ, "sector,buffer,count"},
165#endif
166
167 {"wset", cp_wset, cx_wset, "addr,w1[,...,wn]"},
168 {"zap", cp_null, cx_zap, ""}
169};
170
171#define NCMDS ((sizeof cmtab) / (sizeof cmtab[0]))
172
173int8_t ahex[] = "0123456789abcdefABCDEF";
174
175int8_t *rlist[] = { /* register name list */
176
177 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
178 "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
179 "sr", "pc", "sp",
180 (int8_t *)0
181};
182
183int8_t *vrlist[] = { /* video register name list */
184
185 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
186 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
187 "h0", "h1", "h2", "h3", "v0", "v1", "v2", "v3",
188 (int8_t *)0
189};
190
191#if ON_B700
192int16_t sigadr[] = { /* display offsets for signals */
193
194 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /* keys */
195 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
196 4, 4, 4, 4,
197 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, /* sliders */
198 9, 9, 9, 9,
199 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, /* switches */
200 14, 14, 14, 14,
201 17, 17, /* tablet */
202 20, 20, /* cursor */
203 23, 23, /* longpot */
204 26, /* scrollpot */
205 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, /* digits */
206 32, 32, 32, /* x, e, m */
207 35, 35, 35, 35, /* pots */
208 37, 37, /* pedals */
209 39, 39, 39, 39 /* analog in */
210};
211#endif
212
213/*
214 ============================================================================
215 un-initialized variables (These end up in the bss segment in RAM)
216 ============================================================================
217*/
218
219int8_t argsep; /* argument separator */
220
221int8_t *aptr, /* argument pointer */
222 *monptr, /* monitored variable pointer */
223 *d_cur, /* dump current from */
224 *d_next, /* dump next from */
225 *d_last, /* dump next to */
226 *p_end, /* end parameter */
227 *p_from, /* from parameter */
228 *p_to, /* to parameter */
229 *sptr; /* string scan pointer */
230
231int16_t argln, /* argument length */
232 b0flag, /* breakpoint 0 flag */
233 b1flag, /* breakpoint 1 flag */
234 cmdunit, /* command unit */
235 dflag, /* dump limit flag */
236 exflag, /* exit do_cmd flag */
237 first1, /* first time flag */
238 goflag, /* pc set flag */
239 ilast, /* index of last command */
240 inext, /* command index for "next" command */
241 iplev, /* ROMP IPL level */
242 monsw, /* monitor switch */
243 redo, /* re-doable command flag */
244 rnum, /* register number */
245 vrnum; /* video register number */
246
247#if ON_B700
248int16_t asig, /* signal number */
249 aval, /* signal value */
250 astat, /* signal status */
251 aflag, /* signal activity flag */
252 baseled, /* base LED for scan */
253 ledcntr; /* LED scan counter */
254
255int16_t sigtab[128][2]; /* signal table */
256
257int32_t afi, /* analog FIFO input */
258 ftimer; /* analog FIFO clear timer */
259
260uint16_t baron, /* bar 'on' color */
261 baroff, /* bar 'off' color */
262 swon, /* switch 'on' color */
263 swoff, /* switch 'off' color */
264 *obj0; /* object pointer */
265#endif
266
267uint16_t *tba0, /* breakpoint 0 temporary */
268 *tba1; /* breakpoint 1 temporary */
269
270uint16_t p_bv0, /* breakpoint 0 value */
271 p_bv1; /* breakpoint 1 value */
272
273uint16_t *p_ba0, /* breakpoint 0 address */
274 *p_ba1; /* breakpoint 1 address */
275
276jmp_buf restart; /* jmp environment */
277
278int32_t p_goto, /* goto parameter */
279 p_len, /* length parameter */
280 p_value, /* value parameter */
281 p_width; /* width parameter */
282
283struct regs *regptr; /* register save area pointer */
284
285int8_t argstr[MAXARGLN+1], /* argument string */
286 cmdline[MAXCMDLN+1], /* command line */
287 bfname[MAXFNLN+1], /* boot file name */
288 hs_mtst[MAXHS+1], /* mtest help string */
289 idbuf[MAXID+1], /* ID string */
290 promdate[PDATELN+1]; /* PROM date area */
291
292/*
293 ============================================================================
294 cx_exit -- restart ROMP
295 ============================================================================
296*/
297
298int16_t cx_exit(void)
299{
300 longjmp(&restart, 1); /* restart ROMP */
301 return(TRUE); /* not reached */
302}
303
304/*
305 ============================================================================
306 cx_rest -- execute the reset command
307 ============================================================================
308*/
309
310int16_t cx_rest(void)
311{
312 rjumpto((void *)ROMADDR);
313 return(TRUE); /* not reached */
314}
315
316/*
317 ============================================================================
318 cx_mlod() -- execute the midas command
319 ============================================================================
320*/
321
322int16_t cx_mlod(void)
323{
324 register int16_t i;
325
326 B_log_s = TRUE;
327 B_dbg_s = FALSE;
328 redo = FALSE;
329
330 hdvini();
331 _bpbin = FALSE;
332
333 if (booter("midas.abs", 0L)) {
334
335 return(FALSE);
336
337 } else {
338
339 for (i = 0; i < 8; i++) /* clear d0..d7 */
340 regptr->d_reg[i] = 0L;
341
342 for (i = 0; i < 7; i++) /* clear a0..a6 */
343 regptr->a_reg[i] = 0L;
344
345 regptr->a_reg[7] = ISTACK; /* setup initial stack */
346
347 regptr->reg_sr = INITSR; /* setup sr */
348 regptr->reg_pc = (uint32_t)B_buf_a; /* setup pc */
349
350 return(TRUE);
351 }
352}
353
354/*
355 ============================================================================
356 cp_boot() -- parse boot command
357 ============================================================================
358*/
359
360int16_t cp_boot(void)
361{
362 register int16_t i;
363 register int8_t endc;
364
365 redo = FALSE;
366
367 for (;;) {
368
369 writeln(cmdunit, "File name: ");
370 endc = getln(cmdunit, MAXFNLN+1, bfname);
371 writeln(cmdunit, CRLF);
372
373 if (endc EQ A_CR)
374 break;
375
376 if (endc EQ CTL('X')) {
377
378 writeln(cmdunit, CANNED);
379 return(FALSE);
380 }
381
382 if (endc EQ ERR01)
383 writeln(cmdunit, EMSG2);
384 }
385
386 for (i = 0; i < MAXFNLN+1; i++)
387 if (bfname[i] EQ A_CR)
388 bfname[i] = '\0';
389
390 return(TRUE);
391}
392
393/*
394 ============================================================================
395 cx_boot() -- execute boot command
396 ============================================================================
397*/
398
399int16_t cx_boot(void)
400{
401 register int16_t i;
402
403 B_log_s = TRUE;
404 B_dbg_s = FALSE;
405
406 hdvini();
407 _bpbin = FALSE;
408
409 if (booter(bfname, 0L)) {
410
411 return(FALSE);
412
413 } else {
414
415 for (i = 0; i < 8; i++) /* clear d0..d7 */
416 regptr->d_reg[i] = 0L;
417
418 for (i = 0; i < 7; i++) /* clear a0..a6 */
419 regptr->a_reg[i] = 0L;
420
421 regptr->a_reg[7] = ISTACK; /* setup initial stack */
422
423 regptr->reg_sr = INITSR; /* setup sr */
424 regptr->reg_pc = (uint32_t)B_buf_a; /* setup pc */
425
426 return(TRUE);
427 }
428}
429
430/*
431 =============================================================================
432 dobar(nb, bv) -- draw bar 'nb' with value 'bv'
433 =============================================================================
434*/
435
436void dobar(int16_t nb, int16_t bv)
437{
438 register uint16_t *bp;
439 register int16_t i;
440
441 if ((nb LT 1) OR (nb GT 82))
442 return;
443
444 --nb;
445 bp = obj0 + BARBASE + (int32_t)(sigadr[nb] + MARGIN + nb);
446
447 for (i = 127; i GE 0; --i) {
448
449 if (i GT bv) {
450
451 *bp = baroff;
452 bp += 128L;
453 *bp = baroff;
454
455 } else {
456
457 *bp = baron;
458 bp += 128L;
459 *bp = baron;
460 }
461
462 bp += 128L;
463 }
464}
465
466/*
467 =============================================================================
468 dosw(nb, sv) -- display value 'sv' of switch 'nb'
469 =============================================================================
470*/
471
472void dosw(int16_t nb, int16_t sv)
473{
474 register uint16_t *bp;
475 register int16_t i, j;
476
477 if ((nb LT 1) OR (nb GT 82))
478 return;
479
480 --nb;
481 bp = obj0 + SWBASE + (int32_t)(sigadr[nb] + MARGIN + nb);
482
483 if (sv)
484 j = swon;
485 else
486 j = swoff;
487
488 for (i = 0; i < 8; i++) {
489
490 *bp = j;
491 bp += 128L;
492 }
493}
494
495/*
496 =============================================================================
497 exp_c() -- expand a 4 bit color into a 16 bit word
498 =============================================================================
499*/
500
501uint16_t exp_c(uint16_t c)
502{
503 c &= 0x000F;
504 c |= c << 4;
505 c |= c << 8;
506
507 return(c);
508}
509
510/*
511 =============================================================================
512 cx_adsp() -- display values of analog processor variables as a bar graph
513 =============================================================================
514*/
515
516int16_t cx_adsp(void)
517{
518 register int16_t xasig, xastat, xaval;
519 register int32_t xafi;
520 register int32_t lc;
521 register uint16_t *bp;
522 int16_t i, j, k;
523 int16_t oldi;
524
525 memsetw(sigtab, 0, sizeof sigtab / 2);
526
527 VHinit();
528 VSinit();
529 vsndpal(dfltpal);
530
531 obj0 = (uint16_t *)0x200400L;
532
533 SetObj(0, 0, 0, obj0, 512, 350, 0, 0, (V_RES3 | V_TDE), -1);
534
535 bp = obj0;
536
537 for (lc = 0; lc < 44800; lc++)
538 *bp++ = 0x0000;
539
540 baron = 0x0FFF & exp_c(P_WHT);
541 baroff = 0x0FFF & exp_c(P_DKGRY);
542 swon = 0x0FFF & exp_c(P_YEL);
543 swoff = 0x0FFF & exp_c(P_DKGRY);
544
545 SetPri(0, 7);
546
547 for (i = 1; i < 83; i++) {
548
549 dobar(i, 0);
550 dosw(i, 0);
551 }
552
553 oldi = setipl(2);
554
555 while (0L EQ BIOS(B_RDAV, CON_DEV)) {
556
557 if (-1L NE (xafi = XBIOS(X_ANALOG))) {
558
559 xasig = 0x007F & (xafi >> 8);
560 xastat = 0x0001 & (xafi >> 7);
561 xaval = 0x007F & xafi;
562
563 if (xasig) {
564
565 sigtab[xasig][0] = xaval;
566 sigtab[xasig][1] = xastat;
567
568 if (xasig LT 83) {
569
570 dobar(xasig, xaval);
571 dosw(xasig, xastat);
572 }
573
574 } else {
575
576 for (i = 0; i < 83; i++)
577 sigtab[i][1] = 0;
578 }
579 }
580 }
581
582 BIOS(B_GETC, CON_DEV);
583
584 for (j = 1; j < 83; j++) {
585
586 dobar(j, sigtab[j][0]);
587 dosw(j, sigtab[j][1]);
588 }
589
590 k = 0;
591
592 printf("\n");
593 printf(" x0 x1 x2 x3 x4 x5 x6 x7 x8 x9\r\n");
594 printf(" ----- ----- ----- ----- ----- ----- ----- ----- ----- -----\r\n");
595
596 for (i = 0; i < 9; i++ ) {
597
598 printf("%01dx ", k/10);
599
600 for (j = 0; j < 10; j++) {
601
602 if (k)
603 printf("%1d:%3d ", sigtab[k][1], sigtab[k][0]);
604 else
605 printf(" ");
606
607 if (++k EQ 83)
608 goto outofit;
609 }
610
611 printf("\n");
612 }
613
614outofit:
615
616 printf("\nTempo = %3d, Time = %3d, Tuning = %3d, Level = %3d\n",
617 sigtab[I_TEMPO][0], sigtab[I_TIME][0],
618 sigtab[I_TUNE][0], sigtab[I_LEVEL][0]);
619
620 printf("LongPot L = %3d, LongPot R = %3d, Scroll = %3d\n",
621 sigtab[I_LONGL][0], sigtab[I_LONGR][0],
622 sigtab[I_SCROLL][0]);
623
624 printf("Tablet X = %3d, Tablet Y = %3d\n",
625 sigtab[I_TABX][0], sigtab[I_TABY][0]);
626
627 printf("Cursor X = %3d, Cursor Y = %3d\n",
628 sigtab[I_CURX][0], sigtab[I_CURY][0]);
629
630 setipl(oldi);
631 return(TRUE);
632}
633
634/*
635 =============================================================================
636 waitcr2() -- wait for a CR from CON_DEV
637 Returns: 0 = continue
638 1 = ^G hit - abort
639 =============================================================================
640*/
641
642int16_t waitcr2(void)
643{
644 int8_t c;
645
646 BIOS(B_PUTC, CON_DEV, '\007');
647
648 while ('\r' NE (c = (0x7F & BIOS(B_GETC, CON_DEV)))) {
649
650 if (c EQ '\007')
651 return(1);
652 }
653
654 return(0);
655}
656
657/*
658 ============================================================================
659 xdtoi -- convert hex ASCII to an int digit
660 ============================================================================
661*/
662
663int16_t xdtoi(int16_t c)
664{
665 register int16_t i;
666 register int8_t *ap = &ahex[0];
667
668 for (i = 0; i < 22; i++)
669 if (c EQ *ap++)
670 if (i >15)
671 return(i - 6);
672 else
673 return(i);
674
675 return(-1);
676}
677
678/*
679 ============================================================================
680 getcmd -- parse command from input line
681 ============================================================================
682*/
683
684int16_t getcmd(void)
685{
686 register int16_t c;
687
688 sptr = cmdline;
689 argln = 0;
690 aptr = argstr;
691 memset(argstr, 0, MAXARGLN+1);
692
693 do {
694
695 switch (c = 0x00FF & *sptr) {
696
697 case '\0':
698 case A_CR:
699 case A_LF:
700
701 argsep = c;
702 return(argln);
703
704 case ' ':
705
706 ++sptr;
707
708 while (*sptr EQ ' ')
709 ++sptr;
710
711 if (*sptr EQ A_CR OR *sptr EQ A_LF OR *sptr EQ '\0')
712 c = 0x00FF & *sptr;
713
714 argsep = c;
715 return(argln);
716
717 default:
718
719 if (isupper(c))
720 c = _tolower(c);
721
722 *aptr++ = c;
723 ++sptr;
724 ++argln;
725 }
726
727 } while (*sptr);
728
729 argsep = 0;
730 return(argln);
731}
732
733/*
734 ============================================================================
735 getarg -- parse out an argument to analyze
736 ============================================================================
737*/
738
739int16_t getarg(void)
740{
741 register int16_t c;
742
743 argln = 0;
744 aptr = argstr;
745 memset(argstr, 0, MAXARGLN+1);
746
747 do {
748
749 switch (c = 0x00FF & *sptr) {
750
751 case '\0':
752 case A_CR:
753 case A_LF:
754
755 argsep = c;
756 return(argln);
757
758 case ' ':
759
760 ++sptr;
761
762 while (*sptr EQ ' ')
763 ++sptr;
764
765 if (*sptr EQ A_CR OR *sptr EQ A_LF OR *sptr EQ '\0')
766 c = 0x00FF & *sptr;
767
768 argsep = c;
769 return(argln);
770
771 case ',':
772
773 ++sptr;
774 argsep = c;
775 return(argln);
776
777 default:
778
779 *aptr++ = c;
780 ++sptr;
781 ++argln;
782 }
783
784 } while (*sptr);
785
786 argsep = 0;
787 return(argln);
788}
789
790/*
791 ============================================================================
792 getlong -- get a long integer (either hex or decimal)
793 ============================================================================
794*/
795
796int16_t getlong(int32_t *var)
797{
798 register int32_t temp = 0L;
799 register int16_t csw = FALSE,
800 c;
801
802 if (*aptr EQ '$') {
803
804 ++aptr;
805
806 while (isxdigit(c = *aptr++)) {
807
808 temp = (temp << 4) + xdtoi(c);
809 csw = TRUE;
810 }
811
812 } else {
813
814 while (isdigit(c = *aptr++)) {
815
816 temp = (temp * 10) + (c - '0');
817 csw = TRUE;
818 }
819 }
820
821 if (csw)
822 *var = temp;
823
824 return(c);
825}
826
827/*
828 ============================================================================
829 setvar -- parse an expression and set a long variable
830 ============================================================================
831*/
832
833int16_t setvar(int32_t *var, int32_t deflt)
834{
835 int16_t rc;
836 int32_t temp;
837
838 *var = deflt;
839 aptr = argstr;
840
841 rc = getlong(var);
842
843 if (rc) {
844
845 do {
846
847 switch (rc) {
848
849 case '+':
850
851 temp = 0L;
852 rc = getlong(&temp);
853 *var = *var + temp;
854 continue;
855
856 case '-':
857
858 temp = 0L;
859 rc = getlong(&temp);
860 *var = *var - temp;
861 continue;
862
863 default:
864
865 *var = deflt;
866 return(FALSE);
867 }
868
869 } while (rc);
870
871 return(TRUE);
872 }
873
874 return(TRUE);
875}
876
877/*
878 ============================================================================
879 setp -- parse an expression and set a pointer variable
880 ============================================================================
881*/
882
883int16_t setp(void *var, void *deflt)
884{
885 return setvar((int32_t *)var, (int32_t)deflt);
886}
887
888/*
889 ============================================================================
890 putn -- output a decimal number
891 ============================================================================
892*/
893
894void putn(uint32_t num, int16_t cw, int16_t unit)
895{
896 register int16_t d;
897
898 if (!cw)
899 return;
900
901 putn(num/10, cw-1, unit);
902
903 d = num % 10;
904
905 BIOS(B_PUTC, unit, (d + '0'));
906
907 return;
908}
909
910/*
911 ============================================================================
912 puthn -- output a hex number
913 ============================================================================
914*/
915
916void puthn(uint32_t num, int16_t cw, int16_t unit)
917{
918 register int16_t d;
919
920 if (!cw)
921 return;
922
923 puthn(num >> 4, cw-1, unit);
924
925 d = 0x0F & num;
926
927 if (d > 9)
928 BIOS(B_PUTC, unit, (d - 10 + 'A'));
929 else
930 BIOS(B_PUTC, unit, (d + '0'));
931
932 return;
933}
934
935/*
936 ============================================================================
937 ddump -- do the hex portion of a dump
938 ============================================================================
939*/
940
941int16_t ddump(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
942{
943 while (nwide--) {
944
945 puthn((uint32_t)(0xFF & *loc), 2, unit);
946 BIOS(B_PUTC, unit, ' ');
947
948 if (BIOS(B_RDAV, unit)) {
949
950 BIOS(B_GETC, unit);
951 return(TRUE);
952 }
953
954 if (loc EQ lastloc) {
955
956 dflag = TRUE;
957 return(FALSE);
958 }
959
960 ++loc;
961 }
962
963
964 return(FALSE);
965}
966
967/*
968 ============================================================================
969 padr -- print dump address
970 ============================================================================
971*/
972
973void padr(void *adr, int16_t unit)
974{
975 puthn((uint32_t)adr, 8, unit);
976 BIOS(B_PUTC, unit, ' ');
977 BIOS(B_PUTC, unit, '-');
978 BIOS(B_PUTC, unit, ' ');
979}
980
981/*
982 ============================================================================
983 dtext -- do the text portion of a dump
984 ============================================================================
985*/
986
987int16_t dtext(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
988{
989 register int16_t c;
990
991 BIOS(B_PUTC, unit, ' ');
992 BIOS(B_PUTC, unit, '|');
993
994 while (nwide--) {
995
996 c = 0xFF & *loc;
997
998 if (isascii(c) AND isprint(c))
999 BIOS(B_PUTC, unit, c);
1000 else
1001 BIOS(B_PUTC, unit, '.');
1002
1003 if (BIOS(B_RDAV, unit)) {
1004
1005 BIOS(B_GETC, unit);
1006 BIOS(B_PUTC, unit, '|');
1007 return(TRUE);
1008 }
1009
1010 if (loc EQ lastloc) {
1011
1012 BIOS(B_PUTC, unit, '|');
1013 return(FALSE);
1014 }
1015
1016 ++loc;
1017 }
1018
1019 BIOS(B_PUTC, unit, '|');
1020 return(FALSE);
1021}
1022
1023/*
1024 ============================================================================
1025 cp_mset -- parse parameters for mset command
1026 ============================================================================
1027*/
1028
1029int16_t cp_mset(void)
1030{
1031 redo = FALSE;
1032
1033 if (0 EQ getarg())
1034 return(FALSE);
1035
1036 if (argsep NE ',')
1037 return(FALSE);
1038
1039 if (setp(&p_from, p_from) EQ FALSE)
1040 return(FALSE);
1041
1042 return(TRUE);
1043}
1044
1045/*
1046 ============================================================================
1047 cx_mset -- execute the mset command
1048 ============================================================================
1049*/
1050
1051int16_t cx_mset(void)
1052{
1053 while (TRUE) {
1054
1055 if (getarg())
1056 if (setvar(&p_value, p_value) EQ FALSE)
1057 return(FALSE);
1058
1059 if (p_value & ~0xFFL)
1060 return(FALSE);
1061
1062 *p_from++ = 0xFF & p_value;
1063
1064 if (argsep EQ A_CR)
1065 return(TRUE);
1066 }
1067}
1068
1069/*
1070 ============================================================================
1071 cp_wset -- parse parameters for wset command
1072 ============================================================================
1073*/
1074
1075int16_t cp_wset(void)
1076{
1077 redo = FALSE;
1078
1079 if (0 EQ getarg())
1080 return(FALSE);
1081
1082 if (argsep NE ',')
1083 return(FALSE);
1084
1085 if (setp(&p_from, p_from) EQ FALSE)
1086 return(FALSE);
1087
1088 if ((int32_t)p_from & 1L)
1089 return(FALSE);
1090
1091 return(TRUE);
1092}
1093
1094/*
1095 ============================================================================
1096 cx_wset -- execute the wset command
1097 ============================================================================
1098*/
1099
1100int16_t cx_wset(void)
1101{
1102 uint16_t *p_uint;
1103
1104 p_uint = (uint16_t *)p_from;
1105
1106 while (TRUE) {
1107
1108 if (getarg())
1109 if (setvar(&p_value, p_value) EQ FALSE)
1110 return(FALSE);
1111
1112 if (p_value & ~0xFFFFL)
1113 return(FALSE);
1114
1115 *p_uint++ = 0xFFFF & p_value;
1116
1117 if (argsep EQ A_CR)
1118 return(TRUE);
1119 }
1120}
1121
1122/*
1123 ============================================================================
1124 cp_mtst -- parse mtest command arguments
1125 ============================================================================
1126*/
1127
1128int16_t cp_mtst(void)
1129{
1130 inext = ilast;
1131
1132 if (argsep EQ A_CR OR argsep EQ '\0') {
1133
1134 p_from = (int8_t *)0x00000008L;
1135 p_to = (int8_t *)USER_RAM - 2L;
1136 return(TRUE);
1137 }
1138
1139 if (getarg())
1140 if (setp(&p_from, (int8_t *)USER_RAM) EQ FALSE)
1141 return(FALSE);
1142
1143 if (argsep NE ',')
1144 return(FALSE);
1145
1146 if (getarg())
1147 if (setp(&p_to, (int8_t *)RAM_TOP) EQ FALSE)
1148 return(FALSE);
1149
1150 if ((int32_t)p_from & 1L)
1151 return(FALSE);
1152
1153 if ((int32_t)p_to & 1L)
1154 return(FALSE);
1155
1156 if (p_from GT p_to)
1157 return(FALSE);
1158
1159 return(TRUE);
1160}
1161
1162/*
1163 ============================================================================
1164 cx_mtst -- execute the mtest command
1165 ============================================================================
1166*/
1167
1168int16_t cx_mtst(void)
1169{
1170 register int16_t mask, was, *loc, *eloc, *oldloc;
1171
1172 mask = 0x0001;
1173 loc = (int16_t *)p_from;
1174 eloc = (int16_t *)p_to;
1175 oldloc = loc;
1176
1177 if (p_from LT (int8_t *)USER_RAM)
1178 setipl(7);
1179
1180 do {
1181
1182 while (mask) {
1183
1184 *loc = mask;
1185
1186 if (mask NE (was = *loc))
1187 if (p_from LT (int8_t *)USER_RAM)
1188 halt();
1189 else
1190 printf("%08lX was %04X, expected %04X\r\n",
1191 loc, was, mask);
1192
1193 *loc = ~mask;
1194
1195 if (~mask NE (was = *loc))
1196 if (p_from LT (int8_t *)USER_RAM)
1197 halt();
1198 else
1199 printf("%08lX was %04X, expected %04X\r\n",
1200 loc, was, ~mask);
1201
1202 mask <<= 1;
1203 }
1204
1205 mask = 0x0001;
1206 loc++;
1207
1208 } while (loc LE eloc);
1209
1210 if (oldloc LT (int16_t *)USER_RAM)
1211 rjumpto((void *)ROMADDR);
1212
1213 return(TRUE);
1214}
1215
1216/*
1217 ============================================================================
1218 cp_go -- parse parameters for go command
1219 ============================================================================
1220*/
1221
1222int16_t cp_go(void)
1223{
1224 redo = FALSE;
1225 b0flag = FALSE;
1226 b1flag = FALSE;
1227 goflag = FALSE;
1228
1229 if (getarg()) {
1230
1231 if (setvar(&p_goto, p_goto) EQ FALSE)
1232 return(FALSE);
1233
1234 if (1L & p_goto)
1235 return(FALSE);
1236
1237 goflag = TRUE;
1238
1239 }
1240
1241 if (getarg()) {
1242
1243 if (setp(&tba0, NULL) EQ FALSE)
1244 return(FALSE);
1245
1246 if (1L & (int32_t)tba0)
1247 return(FALSE);
1248
1249 b0flag = TRUE;
1250 }
1251
1252 if (getarg()) {
1253
1254 if (setp(&tba1, NULL) EQ FALSE)
1255 return(FALSE);
1256
1257 if (1L & (int32_t)tba1)
1258 return(FALSE);
1259
1260 b1flag = TRUE;
1261 }
1262
1263 return(TRUE);
1264}
1265
1266#if ON_B700
1267
1268/*
1269 ============================================================================
1270 cx_dini() -- execute the dinit command
1271 ============================================================================
1272*/
1273
1274int16_t cx_dini(void)
1275{
1276 redo = TRUE;
1277 hdvini();
1278 return(TRUE);
1279}
1280
1281#endif
1282
1283/*
1284 ============================================================================
1285 cx_zap -- execute the zap command
1286 ============================================================================
1287*/
1288
1289int16_t cx_zap(void)
1290{
1291 register int16_t *p, *q;
1292
1293 p = (int16_t *)USER_RAM;
1294 q = (int16_t *)RAM_TOP;
1295
1296 setipl(7);
1297
1298 while (p LE q)
1299 *p++ = 0;
1300
1301 rjumpto((void *)ROMADDR);
1302 return(TRUE); /* not reached */
1303}
1304
1305/*
1306 ============================================================================
1307 cx_omap() -- execute the omap command
1308 ============================================================================
1309*/
1310
1311int16_t cx_omap(void)
1312{
1313 register int16_t i, width, xloc;
1314
1315 printf("Pr B/C Locn Wd Xloc Flags\r\n");
1316
1317 for (i = 0; i < 16; i++) {
1318
1319 xloc = v_odtab[i][1] & 0x03FF;
1320
1321 if (xloc & 0x0200) /* sign extend xloc */
1322 xloc |= 0xFC00;
1323
1324 width = (v_odtab[i][1] >> 10) & 0x003F;
1325
1326 printf("%2d %s ",
1327 i, ((v_odtab[i][0] & V_CBS) ? "Chr" : "Bit"));
1328
1329 printf("$%08lX %2d %4d ",
1330 ((int32_t)v_odtab[i][2] << 1), width, xloc);
1331
1332 printf("$%04X\r\n", v_odtab[i][0]);
1333 }
1334
1335 return(TRUE);
1336}
1337
1338/*
1339 ============================================================================
1340 cx_help -- execute the help command
1341 ============================================================================
1342*/
1343
1344int16_t cx_help(void)
1345{
1346 int16_t i, j;
1347
1348 j = 0;
1349
1350 writeln(cmdunit, CRLF);
1351
1352 for (i = 0; i < NCMDS; i++) {
1353
1354 if (j++ EQ 22) {
1355
1356 j = 0;
1357
1358 if (waitcr2())
1359 return(TRUE);
1360 }
1361
1362 writeln(cmdunit, " ");
1363 writeln(cmdunit, cmtab[i].cname);
1364 writeln(cmdunit, " ");
1365 writeln(cmdunit, cmtab[i].hstr);
1366 writeln(cmdunit, CRLF);
1367 }
1368
1369 writeln(cmdunit, CRLF);
1370 return(TRUE);
1371}
1372
1373/*
1374 ============================================================================
1375 cx_bpb -- execute bpb command
1376 ============================================================================
1377*/
1378
1379int16_t cx_bpb(void)
1380{
1381 register struct bpb *bpp;
1382
1383 if (0L EQ (bpp = (struct bpb *)BIOS(B_GBPB, 0) ) ) {
1384
1385 writeln(cmdunit, "\r\n\nERROR -- Unable to read BPB\r\n\n");
1386 return(FALSE);
1387
1388 } else {
1389
1390 writeln(cmdunit, "\r\n\nBPB values:\r\n");
1391 writeln(cmdunit, "\r\n recsiz ");
1392 putn((uint32_t)bpp->recsiz, 5, cmdunit);
1393 writeln(cmdunit, "\r\n clsiz ");
1394 putn((uint32_t)bpp->clsiz, 4, cmdunit);
1395 writeln(cmdunit, "\r\n clsizb ");
1396 putn((uint32_t)bpp->clsizb, 5, cmdunit);
1397 writeln(cmdunit, "\r\n rdlen ");
1398 putn((uint32_t)bpp->rdlen, 4, cmdunit);
1399 writeln(cmdunit, "\r\n fsiz ");
1400 putn((uint32_t)bpp->fsiz, 4, cmdunit);
1401 writeln(cmdunit, "\r\n fatrec ");
1402 putn((uint32_t)bpp->fatrec, 5, cmdunit);
1403 writeln(cmdunit, "\r\n datrec ");
1404 putn((uint32_t)bpp->datrec, 5, cmdunit);
1405 writeln(cmdunit, "\r\n numcl ");
1406 putn((uint32_t)bpp->numcl, 5, cmdunit);
1407 writeln(cmdunit, "\r\n bflags ");
1408 puthn((uint32_t)bpp->bflags, 4, cmdunit);
1409 writeln(cmdunit, "\r\n ntracks ");
1410 putn((uint32_t)bpp->ntracks, 4, cmdunit);
1411 writeln(cmdunit, "\r\n nsides ");
1412 putn((uint32_t)bpp->nsides, 4, cmdunit);
1413 writeln(cmdunit, "\r\n sec/cyl ");
1414 putn((uint32_t)bpp->dspc, 5, cmdunit);
1415 writeln(cmdunit, "\r\n sec/trk ");
1416 putn((uint32_t)bpp->dspt, 5, cmdunit);
1417 writeln(cmdunit, "\r\n hidden ");
1418 putn((uint32_t)bpp->hidden, 4, cmdunit);
1419 writeln(cmdunit, "\r\n\n");
1420 return(TRUE);
1421 }
1422}
1423
1424/*
1425 ============================================================================
1426 cx_go -- execute the go command
1427 ============================================================================
1428*/
1429
1430int16_t cx_go(void)
1431{
1432 redo = FALSE;
1433 exflag = TRUE;
1434 wzcrsh = FALSE;
1435
1436 if (goflag)
1437 regptr->reg_pc = p_goto;
1438
1439 if (b0flag ) {
1440
1441 if (p_ba0) {
1442
1443 if (*p_ba0 NE (uint16_t)BPINST) {
1444
1445 writeln(cmdunit, "\r\n\n** Breakpoint 0 at ");
1446 puthn((uint32_t)p_ba0, 8, cmdunit);
1447 writeln(cmdunit, " was ");
1448 puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
1449 writeln(cmdunit, " instead of ");
1450 puthn(0xFFFFL & (uint32_t)BPINST, 4, cmdunit);
1451 writeln(cmdunit, " **\r\n\n");
1452 }
1453
1454 *p_ba0 = p_bv0;
1455 }
1456
1457 p_ba0 = tba0;
1458 p_bv0 = *p_ba0;
1459 *p_ba0 = (uint16_t)BPINST;
1460 }
1461
1462 if (b1flag ) {
1463
1464 if (p_ba1) {
1465
1466 if (*p_ba1 NE (uint16_t)BPINST) {
1467
1468 writeln(cmdunit, "\r\n\n** Breakpoint 1 at ");
1469 puthn((uint32_t)p_ba1, 8, cmdunit);
1470 writeln(cmdunit, " was ");
1471 puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
1472 writeln(cmdunit, " instead of ");
1473 puthn(0xFFFFL & (uint32_t)BPINST, 4, cmdunit);
1474 writeln(cmdunit, " **\r\n\n");
1475 }
1476
1477 *p_ba1 = p_bv1;
1478 }
1479
1480 p_ba1 = tba1;
1481 p_bv1 = *p_ba1;
1482 *p_ba1 = (uint16_t)BPINST;
1483 }
1484
1485 return(TRUE);
1486}
1487
1488/*
1489 ============================================================================
1490 cp_dump -- parse dump parameters
1491 ============================================================================
1492*/
1493
1494int16_t cp_dump(void)
1495{
1496 inext = ilast;
1497
1498 if (getarg())
1499 if (setp(&p_from, p_from) EQ FALSE) {
1500
1501 redo = FALSE;
1502 return(FALSE);
1503 }
1504
1505 if (argsep EQ A_CR OR argsep EQ '\0') {
1506
1507 p_to = p_from;
1508 p_width = 16L;
1509 redo = TRUE;
1510 return(TRUE);
1511 }
1512
1513 if (getarg())
1514 if (setp(&p_to, p_to) EQ FALSE) {
1515
1516 redo = FALSE;
1517 return(FALSE);
1518 }
1519
1520 if (argsep EQ A_CR OR argsep EQ '\0') {
1521
1522 p_width = 16L;
1523 redo = TRUE;
1524 return(TRUE);
1525 }
1526
1527 if (getarg())
1528 if (setvar(&p_width, p_width) EQ FALSE) {
1529
1530 redo = FALSE;
1531 return(FALSE);
1532 }
1533
1534 if ((p_width LE 0L) OR (p_width GT 16L)) {
1535
1536 p_width = 16L;
1537 redo = FALSE;
1538 return(FALSE);
1539 }
1540
1541 redo = TRUE;
1542 return(TRUE);
1543}
1544
1545/*
1546 ============================================================================
1547 cp_fill -- parse parameters for fill command
1548 ============================================================================
1549*/
1550
1551int16_t cp_fill(void)
1552{
1553 redo = FALSE;
1554
1555 if (getarg())
1556 if (setp(&p_from, p_from) EQ FALSE)
1557 return(FALSE);
1558
1559 if (getarg())
1560 if (setvar(&p_len, p_len) EQ FALSE)
1561 return(FALSE);
1562
1563 if (getarg())
1564 if (setvar(&p_value, p_value) EQ FALSE)
1565 return(FALSE);
1566
1567 if (p_value & ~0xFFL)
1568 return(FALSE);
1569
1570 return(TRUE);
1571}
1572
1573/*
1574 ============================================================================
1575 cp_wfil -- parse parameters for wfill command
1576 ============================================================================
1577*/
1578
1579int16_t cp_wfil(void)
1580{
1581 redo = FALSE;
1582
1583 if (getarg())
1584 if (setp(&p_from, p_from) EQ FALSE)
1585 return(FALSE);
1586
1587 if (getarg())
1588 if (setvar(&p_len, p_len) EQ FALSE)
1589 return(FALSE);
1590
1591 if (getarg())
1592 if (setvar(&p_value, p_value) EQ FALSE)
1593 return(FALSE);
1594
1595 if ((int32_t)p_from & 1L)
1596 return(FALSE);
1597
1598 if (p_value & ~0xFFFFL)
1599 return(FALSE);
1600
1601 return(TRUE);
1602}
1603
1604/*
1605 ============================================================================
1606 cp_copy -- parse parameters for copy command
1607 ============================================================================
1608*/
1609
1610int16_t cp_copy(void)
1611{
1612 redo = FALSE;
1613
1614 if (getarg())
1615 if (setp(&p_from, p_from) EQ FALSE)
1616 return(FALSE);
1617
1618 if (getarg())
1619 if (setp(&p_to, p_to) EQ FALSE)
1620 return(FALSE);
1621
1622 if (getarg())
1623 if (setvar(&p_len, p_len) EQ FALSE)
1624 return(FALSE);
1625
1626 return(TRUE);
1627}
1628
1629/*
1630 ============================================================================
1631 cp_chek -- parse parameters for chek command
1632 ============================================================================
1633*/
1634
1635int16_t cp_chek(void)
1636{
1637 redo = FALSE;
1638
1639 if (getarg())
1640 if (setp(&p_from, p_from) EQ FALSE)
1641 return(FALSE);
1642
1643 if (getarg())
1644 if (setp(&p_to, p_to) EQ FALSE)
1645 return(FALSE);
1646
1647 return(TRUE);
1648}
1649
1650/*
1651 ============================================================================
1652 cp_read -- parse parameters for read command
1653 ============================================================================
1654*/
1655
1656int16_t cp_read(void)
1657{
1658 redo = FALSE;
1659
1660 if (getarg())
1661 if (setp(&p_from, p_from) EQ FALSE)
1662 return(FALSE);
1663
1664 if (getarg())
1665 if (setp(&p_to, p_to) EQ FALSE)
1666 return(FALSE);
1667
1668 if (getarg())
1669 if (setvar(&p_len, p_len) EQ FALSE)
1670 return(FALSE);
1671
1672 if ((~0x7FFFL) & p_len)
1673 return(FALSE);
1674
1675 if ((~0xFFFFL) & (int32_t)p_from)
1676 return(FALSE);
1677
1678 return(TRUE);
1679}
1680
1681/*
1682 ============================================================================
1683 cp_null -- parse null parameter line
1684 ============================================================================
1685*/
1686
1687int16_t cp_null(void)
1688{
1689 return(TRUE);
1690}
1691
1692/*
1693 ============================================================================
1694 cp_rset -- parse rset command parameters
1695 ============================================================================
1696*/
1697
1698int16_t cp_rset(void)
1699{
1700 int16_t rc;
1701
1702 rc = 0;
1703 redo = FALSE;
1704
1705 if (0 EQ getarg())
1706 return(FALSE);
1707
1708 str2lc(argstr);
1709
1710 if (0 EQ (rc = strlcmp(argstr, rlist)))
1711 return(FALSE);
1712
1713 if (0 EQ getarg())
1714 return(FALSE);
1715
1716 if (FALSE EQ setvar(&p_value, 0L))
1717 return(FALSE);
1718
1719 rnum = rc;
1720 return(TRUE);
1721}
1722
1723
1724/*
1725 ============================================================================
1726 cx_chek -- process chek command
1727 ============================================================================
1728*/
1729
1730int16_t cx_chek(void)
1731{
1732 register int32_t csum;
1733 register int8_t *cp;
1734
1735 redo = FALSE;
1736 csum = 0L;
1737
1738 for (cp = p_from; cp LE p_to; cp++)
1739 csum += 0x000000FFL & *cp;
1740
1741 printf("Checksum = 0x%08lX\r\n", csum);
1742
1743 return(TRUE);
1744}
1745
1746/*
1747 ============================================================================
1748 cx_rset -- process rset command
1749 ============================================================================
1750*/
1751
1752int16_t cx_rset(void)
1753{
1754 redo = FALSE;
1755
1756 if (rnum < 1)
1757 return(FALSE);
1758
1759 if (rnum < 9) { /* d0..d7 -- data register */
1760
1761 regptr->d_reg[rnum-1] = p_value;
1762 return(TRUE);
1763 }
1764
1765 if (rnum < 17) { /* a0..a7 -- address register */
1766
1767 regptr->a_reg[rnum-9] = p_value;
1768 return(TRUE);
1769 }
1770
1771 if (rnum EQ 17) { /* sr -- status register */
1772
1773 if ((~0xFFFFL) & p_value)
1774 return(FALSE);
1775
1776 regptr->reg_sr = (uint16_t)p_value;
1777 return(TRUE);
1778 }
1779
1780 if (rnum EQ 18) { /* pc -- program counter */
1781
1782 if (1L & p_value)
1783 return(FALSE);
1784
1785 regptr->reg_pc = p_value;
1786 return(TRUE);
1787 }
1788
1789 if (rnum EQ 19) { /* sp -- stack pointer */
1790
1791 if (1L & p_value)
1792 return(FALSE);
1793
1794 regptr->a_reg[7] = p_value;
1795 return(TRUE);
1796 }
1797
1798 return(FALSE);
1799}
1800
1801/*
1802 ============================================================================
1803 cp_vrst -- parse vrset command parameters
1804 ============================================================================
1805*/
1806
1807int16_t cp_vrst(void)
1808{
1809 int16_t rc;
1810
1811 rc = 0;
1812 redo = FALSE;
1813
1814 if (0 EQ getarg())
1815 return(FALSE);
1816
1817 str2lc(argstr);
1818
1819 if (0 EQ (rc = strlcmp(argstr, vrlist)))
1820 return(FALSE);
1821
1822 if (0 EQ getarg())
1823 return(FALSE);
1824
1825 if (FALSE EQ setvar(&p_value, 0L))
1826 return(FALSE);
1827
1828 if (vrnum < 17) { /* complete register */
1829
1830 vrnum = rc;
1831 return(TRUE);
1832 }
1833
1834 if (vrnum < 21) { /* horizontal register */
1835
1836 if (p_value & ~0x003F)
1837 return(FALSE);
1838
1839 vrnum = rc;
1840 return(TRUE);
1841 }
1842
1843 if (vrnum < 25) { /* vertical register */
1844
1845 if (p_value & ~0x03FF)
1846 return(FALSE);
1847
1848 vrnum = rc;
1849 return(TRUE);
1850 }
1851
1852 return(FALSE);
1853}
1854
1855/*
1856 ============================================================================
1857 cx_vrst -- process vrset command
1858 ============================================================================
1859*/
1860
1861int16_t cx_vrst(void)
1862{
1863 redo = FALSE;
1864
1865 if (vrnum < 1)
1866 return(FALSE);
1867
1868 if (vrnum < 17) { /* 1..16 -- r0..r15 -- complete register */
1869
1870 v_regs[vrnum-1] = p_value;
1871 return(TRUE);
1872 }
1873
1874 if (vrnum < 21) { /* 17..20 -- h0..h3 -- horizontal register */
1875
1876 v_regs[vrnum-5] = (v_regs[vrnum-5] & 0x03FF) |
1877 ((p_value << 10) & 0xFC00);
1878 return(TRUE);
1879 }
1880
1881 if (vrnum < 25) { /* 21..24 -- v0..v3 -- vertical register */
1882
1883 v_regs[vrnum-9] = (v_regs[vrnum-9] & 0xFC00) | p_value;
1884 return(TRUE);
1885 }
1886
1887 return(FALSE);
1888}
1889
1890/*
1891 ============================================================================
1892 cx_vreg -- process vregs command
1893 ============================================================================
1894*/
1895
1896int16_t cx_vreg(void)
1897{
1898 register int16_t i, j, k, l;
1899 register uint16_t *rp;
1900
1901 rp = &v_regs[0];
1902 l = 0;
1903
1904 for (i = 0; i < 2; i++) {
1905
1906 for (j = 0; j < 2; j++) {
1907
1908 for (k = 0; k < 4; k++) {
1909
1910 writeln(cmdunit, " ");
1911 putn((uint32_t)l++, 2, cmdunit);
1912 writeln(cmdunit, ":");
1913 puthn((uint32_t)*rp++, 4, cmdunit);
1914 }
1915
1916 writeln(cmdunit, " ");
1917 }
1918
1919 writeln(cmdunit, "\r\n");
1920 }
1921
1922 return(TRUE);
1923}
1924
1925/*
1926 ============================================================================
1927 do_srec -- load a Motorola S record
1928 ============================================================================
1929*/
1930
1931int16_t do_srec(int8_t *line)
1932{
1933 register int8_t *ldadr;
1934 register int16_t c, csum, i, len;
1935 register uint16_t val;
1936
1937 if ('S' NE (c = *line++))
1938 return(-1); /* error 1 = missing initial S */
1939
1940 switch (c = *line++) {
1941
1942 case '2':
1943
1944 csum = 0;
1945
1946 if (isxdigit(c = *line++))
1947 len = xdtoi(c);
1948 else
1949 return(-2); /* error 2 = bad length byte */
1950
1951 if (isxdigit(c = *line++))
1952 len = (len << 4) + xdtoi(c);
1953 else
1954 return(-2);
1955
1956 csum += (len & 0xFF);
1957 ldadr = (int8_t *)0;
1958 len -= 4;
1959
1960 for (i = 0; i < 3; i++) {
1961
1962 if (isxdigit(c = *line++))
1963 val = xdtoi(c);
1964 else
1965 return(-3); /* error 3 = bad address byte */
1966
1967 if (isxdigit(c = *line++))
1968 val = (val << 4) + xdtoi(c);
1969 else
1970 return(-3);
1971
1972 ldadr = (int8_t *)(((int32_t)ldadr << 8) + (int32_t)val);
1973 csum += (val & 0xFF);
1974 }
1975
1976 for (i = 0; i < len; i++) {
1977
1978 if (isxdigit(c = *line++))
1979 val = xdtoi(c);
1980 else
1981 return(-4); /* error 4 = bad data byte */
1982
1983 if (isxdigit(c = *line++))
1984 val = (val << 4) + xdtoi(c);
1985 else
1986 return(-4);
1987
1988 csum += (val & 0xFF);
1989 *ldadr = val & 0xFF;
1990
1991 if ((*ldadr & 0xFF) NE (val & 0xFF))
1992 return(-5); /* error 5 = store failed */
1993
1994 ldadr++;
1995 }
1996
1997 csum = 0xFF & ~csum;
1998
1999 if (isxdigit(c = *line++))
2000 val = xdtoi(c);
2001 else
2002 return(-6); /* error 6 = bad checksum byte */
2003
2004 if (isxdigit(c = *line++))
2005 val = (val << 4) + xdtoi(c);
2006 else
2007 return(-6);
2008
2009 if (csum NE (val & 0xFF))
2010 return(-7); /* error 7 = bad checksum */
2011
2012 return(1);
2013
2014 case '9':
2015
2016 if (memcmpu(line, SREC9, 10) EQ 0)
2017 return(0);
2018 else
2019 return(-8); /* error 8 = bad end record */
2020
2021 default:
2022
2023 return(-9); /* error 9 = unknown s type */
2024 }
2025
2026 return(-10); /* error 10 = switch failed */
2027}
2028
2029/*
2030 ============================================================================
2031 cx_load -- process load command
2032 ============================================================================
2033*/
2034
2035int16_t cx_load(void)
2036{
2037 register int16_t rc;
2038
2039 do {
2040
2041 rc = getrln(cmdunit, MAXCMDLN, cmdline);
2042
2043 switch (rc) {
2044
2045 case A_CR:
2046
2047 rc = do_srec(cmdline);
2048
2049 if (rc LT 0) {
2050
2051 rc = -rc;
2052 writeln(cmdunit, NACK);
2053 writeln(cmdunit, "** Load error ");
2054 putn((uint32_t)rc, 3, cmdunit);
2055 writeln(cmdunit, " **\r\n\n");
2056 return(FALSE);
2057
2058 } else {
2059
2060 writeln(cmdunit, TACK);
2061 }
2062
2063 continue;
2064
2065 case CTL('X'):
2066
2067 rc = 1;
2068 writeln(cmdunit, TACK);
2069 continue;
2070
2071 default:
2072
2073 writeln(cmdunit, NACK);
2074 writeln(cmdunit, "** Load aborted on ");
2075 puthn((uint32_t)rc, 2, cmdunit);
2076 writeln(cmdunit, " **\r\n\n");
2077 return(FALSE);
2078 }
2079
2080 } while (rc);
2081
2082 return(TRUE);
2083}
2084
2085/*
2086 ============================================================================
2087 cx_fill -- execute the fill command
2088 ============================================================================
2089*/
2090
2091int16_t cx_fill(void)
2092{
2093 register int8_t *cp = p_from;
2094 register int32_t count;
2095
2096 redo = FALSE;
2097
2098 for (count = p_len; count > 0L; count--) {
2099
2100 *cp = (int8_t)(0xFFL & p_value);
2101
2102 if (*cp NE (int8_t)(0xFFL & p_value)) {
2103
2104 writeln(cmdunit, "\r\n** FILL failed at ");
2105 puthn((uint32_t)cp, 8, cmdunit);
2106 writeln(cmdunit, " **\r\n");
2107 return(FALSE);
2108 }
2109
2110 ++cp;
2111 }
2112
2113 return(TRUE);
2114}
2115
2116/*
2117 ============================================================================
2118 cx_wfill -- execute the wfill command
2119 ============================================================================
2120*/
2121
2122int16_t cx_wfil(void)
2123{
2124 register uint16_t *cp = (uint16_t *)p_from;
2125 register int32_t count;
2126
2127 redo = FALSE;
2128
2129 for (count = p_len; count > 0L; count--)
2130 *cp++ = (uint16_t)(0xFFFFL & p_value);
2131
2132 return(TRUE);
2133}
2134
2135/*
2136 ============================================================================
2137 cx_copy -- execute the copy command
2138 ============================================================================
2139*/
2140
2141int16_t cx_copy(void)
2142{
2143 register int8_t *from = p_from,
2144 *to = p_to;
2145 register int32_t count = p_len;
2146
2147 redo = FALSE;
2148
2149 if (to GT from) {
2150
2151 from = from + count;
2152 to = to + count;
2153
2154 while (count--) {
2155
2156 --from;
2157 --to;
2158 *to = *from;
2159
2160 if (*from NE *to) {
2161
2162 writeln(cmdunit, "\r\n** COPY failed from ");
2163 puthn((uint32_t)from, 8, cmdunit);
2164 writeln(cmdunit, " to ");
2165 puthn((uint32_t)to, 8, cmdunit);
2166 writeln(cmdunit, " with (from) = ");
2167 puthn((uint32_t)(*from), 2, cmdunit);
2168 writeln(cmdunit, " and (to) = ");
2169 puthn((uint32_t)(*to), 2, cmdunit);
2170 writeln(cmdunit, " **\r\n");
2171 return(FALSE);
2172 }
2173 }
2174
2175 } else {
2176
2177 while (count--) {
2178
2179 *to = *from;
2180
2181 if (*from NE *to) {
2182
2183 writeln(cmdunit, "\r\n** COPY failed from ");
2184 puthn((uint32_t)from, 8, cmdunit);
2185 writeln(cmdunit, " to ");
2186 puthn((uint32_t)to, 8, cmdunit);
2187 writeln(cmdunit, " with (from) = ");
2188 puthn((uint32_t)(*from), 2, cmdunit);
2189 writeln(cmdunit, " and (to) = ");
2190 puthn((uint32_t)(*to), 2, cmdunit);
2191 writeln(cmdunit, " **\r\n");
2192 return(FALSE);
2193 }
2194
2195 ++from;
2196 ++to;
2197 }
2198 }
2199
2200 return(TRUE);
2201}
2202
2203
2204/*
2205 ============================================================================
2206 cx_dump -- execute the dump command
2207 ============================================================================
2208*/
2209
2210int16_t cx_dump(void)
2211{
2212 register int16_t nw, rc;
2213
2214 redo= TRUE;
2215 d_cur = p_from;
2216 d_next = p_to + 1;
2217 d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
2218 nw = p_width;
2219 rc = TRUE;
2220
2221 do {
2222
2223 writeln(cmdunit, CRLF);
2224 padr(p_from, cmdunit);
2225
2226 dflag = FALSE;
2227
2228 if (ddump(p_from, p_to, nw, cmdunit))
2229 rc = FALSE;
2230
2231 if (rc)
2232 if (dtext(p_from, p_to, nw, cmdunit))
2233 rc = FALSE;
2234
2235 p_from = p_from + p_width;
2236
2237 if (dflag)
2238 rc = FALSE;
2239
2240 } while (rc);
2241
2242 p_from = d_cur;
2243
2244 writeln(cmdunit, CRLF);
2245 writeln(cmdunit, CRLF);
2246
2247 return(TRUE);
2248}
2249
2250/*
2251 ============================================================================
2252 wdump -- dump words in hex (no ASCII)
2253 ============================================================================
2254*/
2255
2256int16_t wdump(uint16_t *loc, uint16_t *lastloc, int16_t nwide, int16_t unit)
2257{
2258 while (nwide--) {
2259
2260 puthn((uint32_t)(0xFFFFL & *loc), 4, unit);
2261 BIOS(B_PUTC,unit, ' ');
2262
2263 if (BIOS(B_RDAV, unit))
2264 return(TRUE);
2265
2266 if (loc EQ lastloc) {
2267
2268 dflag = TRUE;
2269 return(FALSE);
2270 }
2271
2272 ++loc;
2273 }
2274
2275 return(FALSE);
2276}
2277
2278/*
2279 ============================================================================
2280 ldump -- dump longs in hex (no ASCII)
2281 ============================================================================
2282*/
2283
2284int16_t ldump(int32_t *loc, int32_t *lastloc, int16_t nwide, int16_t unit)
2285{
2286 while (nwide--) {
2287
2288 puthn((uint32_t)*loc, 8, unit);
2289 BIOS(B_PUTC,unit, ' ');
2290
2291 if (BIOS(B_RDAV, unit))
2292 return(TRUE);
2293
2294 if (loc EQ lastloc) {
2295
2296 dflag = TRUE;
2297 return(FALSE);
2298 }
2299
2300 ++loc;
2301 }
2302
2303 return(FALSE);
2304}
2305
2306/*
2307 ============================================================================
2308 cp_wdmp -- process parameters for wdump command
2309 ============================================================================
2310*/
2311
2312int16_t cp_wdmp(void)
2313{
2314 inext = ilast;
2315
2316 if (getarg())
2317 if (setp(&p_from, p_from) EQ FALSE) {
2318
2319 redo = FALSE;
2320 return(FALSE);
2321 }
2322
2323 if ((int32_t)p_from & 1L) {
2324
2325 redo = FALSE;
2326 return(FALSE);
2327 }
2328
2329 if (argsep EQ A_CR OR argsep EQ '\0') {
2330
2331 p_to = p_from;
2332 p_width = 8;
2333 redo = TRUE;
2334 return(TRUE);
2335 }
2336
2337 if (getarg())
2338 if (setp(&p_to, p_to) EQ FALSE) {
2339
2340 redo = FALSE;
2341 return(FALSE);
2342 }
2343
2344 if ((int32_t)p_to & 1L) {
2345
2346 redo = FALSE;
2347 return(FALSE);
2348 }
2349
2350 if (argsep EQ A_CR OR argsep EQ '\0') {
2351
2352 p_width = 8;
2353 redo = TRUE;
2354 return(TRUE);
2355 }
2356
2357 if (getarg())
2358 if (setvar(&p_width, p_width) EQ FALSE) {
2359
2360 redo = FALSE;
2361 return(FALSE);
2362 }
2363
2364 redo = TRUE;
2365 return(TRUE);
2366}
2367
2368/*
2369 ============================================================================
2370 cp_ldmp -- process parameters for ldump command
2371 ============================================================================
2372*/
2373
2374int16_t cp_ldmp(void)
2375{
2376 inext = ilast;
2377
2378 if (getarg())
2379 if (setp(&p_from, p_from) EQ FALSE) {
2380
2381 redo = FALSE;
2382 return(FALSE);
2383 }
2384
2385 if ((int32_t)p_from & 1L) {
2386
2387 redo = FALSE;
2388 return(FALSE);
2389 }
2390
2391 if (argsep EQ A_CR OR argsep EQ '\0') {
2392
2393 p_to = p_from;
2394 p_width = 4;
2395 redo = TRUE;
2396 return(TRUE);
2397 }
2398
2399 if (getarg())
2400 if (setp(&p_to, p_to) EQ FALSE) {
2401
2402 redo = FALSE;
2403 return(FALSE);
2404 }
2405
2406 if ((int32_t)p_to & 1L) {
2407
2408 redo = FALSE;
2409 return(FALSE);
2410 }
2411
2412 if (argsep EQ A_CR OR argsep EQ '\0') {
2413
2414 p_width = 4;
2415 redo = TRUE;
2416 return(TRUE);
2417 }
2418
2419 if (getarg())
2420 if (setvar(&p_width, p_width) EQ FALSE) {
2421
2422 redo = FALSE;
2423 return(FALSE);
2424 }
2425
2426 redo = TRUE;
2427 return(TRUE);
2428}
2429
2430/*
2431 ============================================================================
2432 cp_ilev -- parse the ipl command
2433 ============================================================================
2434*/
2435
2436int16_t cp_ilev(void)
2437{
2438 int32_t iplevl;
2439
2440 if (argsep EQ A_CR OR argsep EQ '\0')
2441 return(TRUE);
2442
2443 if (getarg())
2444 if (setvar(&iplevl, iplevl) EQ FALSE)
2445 return(FALSE);
2446
2447 if (iplevl GT 7)
2448 return(FALSE);
2449
2450 iplev = iplevl;
2451
2452 return(TRUE);
2453}
2454
2455/*
2456 ============================================================================
2457 cx_ilev -- execute ipl command
2458 ============================================================================
2459*/
2460
2461int16_t cx_ilev(void)
2462{
2463 if (-1 EQ setipl(iplev)) {
2464
2465 printf("ERROR -- Could not set IPL to %d\r\n", iplev);
2466 return(FALSE);
2467 } else
2468 printf("ROMP IPL now set to %d\r\n", iplev);
2469
2470 return(TRUE);
2471}
2472
2473/*
2474 ============================================================================
2475 cp_monc() -- parse the monc command
2476 ============================================================================
2477*/
2478
2479int16_t cp_monc(void)
2480{
2481 if (getarg())
2482 if (setp(&monptr, monptr) EQ FALSE)
2483 return(FALSE);
2484
2485 monsw = MON_C;
2486 redo = TRUE;
2487 return(TRUE);
2488}
2489
2490/*
2491 ============================================================================
2492 cp_mons() -- parse the mons command
2493 ============================================================================
2494*/
2495
2496int16_t cp_mons(void)
2497{
2498 if (getarg())
2499 if (setp(&monptr, monptr) EQ FALSE)
2500 return(FALSE);
2501
2502 monsw = MON_S;
2503 redo = TRUE;
2504 return(TRUE);
2505}
2506
2507/*
2508 ============================================================================
2509 cp_monl() -- parse the monl command
2510 ============================================================================
2511*/
2512
2513int16_t cp_monl(void)
2514{
2515 if (getarg())
2516 if (setp(&monptr, monptr) EQ FALSE)
2517 return(FALSE);
2518
2519 monsw = MON_L;
2520 redo = TRUE;
2521 return(TRUE);
2522}
2523
2524/*
2525 ============================================================================
2526 cx_mon() -- process the mon commands
2527 ============================================================================
2528*/
2529
2530int16_t cx_mon(void)
2531{
2532 register int8_t vc, vcc;
2533 register int16_t vs, vss, *vsp;
2534 register int32_t vl, vll, *vlp;
2535
2536 switch (monsw) {
2537
2538 case MON_C:
2539
2540 vc = *monptr & 0x0FF;
2541 puthn((uint32_t)vc, 2, cmdunit);
2542 writeln(cmdunit, "\r\n");
2543
2544 while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
2545
2546 vcc = *monptr & 0x0FF;
2547
2548 if (vc NE vcc) {
2549
2550 vc = vcc;
2551 puthn((uint32_t)vc, 2, cmdunit);
2552 writeln(cmdunit, "\r\n");
2553 }
2554 }
2555
2556 BIOS(B_GETC, CON_DEV);
2557 return(TRUE);
2558
2559 case MON_S:
2560
2561 vsp = (int16_t *)monptr;
2562 vs = *vsp;
2563 puthn((uint32_t)vs, 4, cmdunit);
2564 writeln(cmdunit, "\r\n");
2565
2566 while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
2567
2568 vss = *vsp;
2569
2570 if (vs NE vss) {
2571
2572 vs = vss;
2573 puthn((uint32_t)vs, 4, cmdunit);
2574 writeln(cmdunit, "\r\n");
2575 }
2576 }
2577
2578 BIOS(B_GETC, CON_DEV);
2579 return(TRUE);
2580
2581
2582 case MON_L:
2583
2584 vlp = (int32_t *)monptr;
2585 vl = *vlp;
2586 puthn((uint32_t)vl, 8, cmdunit);
2587 writeln(cmdunit, "\r\n");
2588
2589 while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
2590
2591 vll = *vlp;
2592
2593 if (vl NE vll) {
2594
2595 vl = vll;
2596 puthn((uint32_t)vl, 8, cmdunit);
2597 writeln(cmdunit, "\r\n");
2598 }
2599 }
2600
2601 BIOS(B_GETC, CON_DEV);
2602 return(TRUE);
2603
2604 default:
2605 return(FALSE);
2606 }
2607}
2608
2609
2610/*
2611 ============================================================================
2612 cx_wdmp -- process wdump command
2613 ============================================================================
2614*/
2615
2616int16_t cx_wdmp(void)
2617{
2618 int16_t nw, rc;
2619
2620 d_cur = p_from;
2621 d_next = p_to + 2;
2622 d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
2623 nw = p_width;
2624 rc = TRUE;
2625
2626 do {
2627
2628 writeln(cmdunit, CRLF);
2629 padr(p_from, cmdunit);
2630 dflag = FALSE;
2631
2632 if (wdump(p_from, p_to, nw, cmdunit))
2633 rc = FALSE;
2634
2635 p_from = p_from + (p_width << 1);
2636
2637 if (dflag)
2638 rc = FALSE;
2639
2640 } while (rc);
2641
2642 p_from = d_cur;
2643
2644 writeln(cmdunit, CRLF);
2645 writeln(cmdunit, CRLF);
2646 return(TRUE);
2647}
2648
2649/*
2650 ============================================================================
2651 cx_ldmp -- process ldump command
2652 ============================================================================
2653*/
2654
2655int16_t cx_ldmp(void)
2656{
2657 int16_t nw, rc;
2658
2659 d_cur = p_from;
2660 d_next = p_to + 4;
2661 d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
2662 nw = p_width;
2663 rc = TRUE;
2664
2665 do {
2666
2667 writeln(cmdunit, CRLF);
2668 padr(p_from, cmdunit);
2669 dflag = FALSE;
2670
2671 if (ldump(p_from, p_to, nw, cmdunit))
2672 rc = FALSE;
2673
2674 p_from = p_from + (p_width << 2);
2675
2676 if (dflag)
2677 rc = FALSE;
2678
2679 } while (rc);
2680
2681 p_from = d_cur;
2682
2683 writeln(cmdunit, CRLF);
2684 writeln(cmdunit, CRLF);
2685 return(TRUE);
2686}
2687
2688/*
2689 ============================================================================
2690 do_cmd -- process a command line
2691 ============================================================================
2692*/
2693
2694void do_cmd(void)
2695{
2696 int16_t rc, i;
2697
2698 /* prompt for a command line */
2699
2700#if TINYMSG
2701 writeln(cmdunit, "R: ");
2702#else
2703 writeln(cmdunit, "ROMP: ");
2704#endif
2705
2706 /* get a command line */
2707
2708 rc = getln(cmdunit, MAXCMDLN, cmdline);
2709
2710 /* dispatch based on rc */
2711
2712 switch (rc) {
2713
2714 case A_CR:
2715
2716 writeln(cmdunit, CRLF);
2717
2718 if (getcmd()) {
2719
2720 for (i = 0; i < NCMDS; i++) {
2721
2722 if (0 EQ strcmp(argstr, cmtab[i].cname)) {
2723
2724 ilast = i;
2725
2726 if ((*cmtab[i].cp)()) {
2727
2728 if (FALSE EQ (*cmtab[i].cx)())
2729 writeln(cmdunit, EMSG1);
2730
2731 } else {
2732
2733 writeln(cmdunit, EMSG2);
2734 }
2735
2736 return;
2737 }
2738 }
2739
2740 writeln(cmdunit, EMSG3);
2741 return;
2742
2743 } else {
2744
2745 if (redo) {
2746
2747 if (FALSE EQ (*cmtab[ilast].cx)())
2748 writeln(cmdunit, EMSG1);
2749
2750 } else {
2751
2752 writeln(cmdunit, EMSG5);
2753 }
2754
2755 return;
2756 }
2757
2758 case CTL('X'):
2759
2760 writeln(cmdunit, CANNED);
2761 return;
2762
2763 default:
2764
2765 writeln(cmdunit, EMSG6);
2766 return;
2767 }
2768
2769 writeln(cmdunit, EMSG7);
2770 return;
2771}
2772
2773/*
2774 ============================================================================
2775 cx_next -- process the next command
2776 ============================================================================
2777*/
2778
2779int16_t cx_next(void)
2780{
2781 p_to = d_last;
2782 p_from = d_next;
2783 return((*cmtab[inext].cx)());
2784}
2785
2786/*
2787 ============================================================================
2788 cx_read() -- process the read command
2789 ============================================================================
2790*/
2791
2792int16_t cx_read(void)
2793{
2794 int32_t rc;
2795 int16_t ns, recno;
2796
2797 ns = p_len & 0x7FFFL;
2798 recno = (int32_t)p_from & 0xFFFFL;
2799
2800 rc = BIOS(B_RDWR, 2, p_to, ns, recno, 0);
2801
2802 if (rc & 0xFFFFL) {
2803
2804 writeln(cmdunit, "\r\nERROR reading disk: ");
2805 puthn((uint32_t)rc, 8, cmdunit);
2806 writeln(cmdunit, "\r\n\n");
2807 return(FALSE);
2808
2809 } else {
2810
2811 return(TRUE);
2812 }
2813}
2814
2815/*
2816 ============================================================================
2817 cx_writ() -- process the write command
2818 ============================================================================
2819*/
2820
2821int16_t cx_writ(void)
2822{
2823 int32_t rc;
2824 int16_t ns, recno;
2825
2826 ns = p_len & 0x7FFFL;
2827 recno = (int32_t)p_from & 0xFFFFL;
2828
2829 rc = BIOS(B_RDWR, 3, p_to, ns, recno, 0);
2830
2831 if (rc & 0xFFFFL) {
2832
2833 writeln(cmdunit, "\r\nERROR writing disk: ");
2834 puthn((uint32_t)rc, 8, cmdunit);
2835 writeln(cmdunit, "\r\n\n");
2836 return(FALSE);
2837
2838 } else {
2839
2840 return(TRUE);
2841 }
2842}
2843
2844/*
2845 ============================================================================
2846 showrs() -- show registers
2847 ============================================================================
2848*/
2849
2850void showrs(struct regs *rp)
2851{
2852 int16_t i;
2853 uint16_t srtemp;
2854
2855 writeln(cmdunit, " ");
2856
2857 for (i = 0; i < 8; i++) {
2858
2859 BIOS(B_PUTC, cmdunit, ' ');
2860 BIOS(B_PUTC, cmdunit, '0'+i);
2861 writeln(cmdunit, "_______");
2862 }
2863
2864 writeln(cmdunit, "\r\nd0..d7 ");
2865
2866 for (i = 0; i < 8; i++) {
2867
2868 BIOS(B_PUTC, cmdunit, ' ');
2869 puthn(rp->d_reg[i], 8, cmdunit);
2870 }
2871
2872 writeln(cmdunit, "\r\na0..a7 ");
2873
2874 for (i = 0; i < 8; i++) {
2875
2876 BIOS(B_PUTC, cmdunit, ' ');
2877 puthn(rp->a_reg[i], 8, cmdunit);
2878 }
2879
2880 writeln(cmdunit, "\r\nPC = ");
2881 puthn((uint32_t)rp->reg_pc, 8, cmdunit);
2882
2883 srtemp = rp->reg_sr;
2884 writeln(cmdunit, ", SR = ");
2885 puthn((uint32_t)srtemp & 0xFFFFL, 4, cmdunit);
2886
2887 writeln(cmdunit, " (IPL = ");
2888 puthn((uint32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
2889 writeln(cmdunit, ", ");
2890
2891 if (srtemp & 0x8000)
2892 BIOS(B_PUTC, cmdunit, 'T');
2893 else
2894 BIOS(B_PUTC, cmdunit, '-');
2895
2896 if (srtemp & 0x2000)
2897 BIOS(B_PUTC, cmdunit, 'S');
2898 else
2899 BIOS(B_PUTC, cmdunit, '-');
2900
2901 BIOS(B_PUTC, cmdunit, ' ');
2902
2903 if (srtemp & 0x10)
2904 BIOS(B_PUTC, cmdunit, 'X');
2905 else
2906 BIOS(B_PUTC, cmdunit, '-');
2907
2908 if (srtemp & 0x8)
2909 BIOS(B_PUTC, cmdunit, 'N');
2910 else
2911 BIOS(B_PUTC, cmdunit, '-');
2912
2913 if (srtemp & 0x4)
2914 BIOS(B_PUTC, cmdunit, 'Z');
2915 else
2916 BIOS(B_PUTC, cmdunit, '-');
2917
2918 if (srtemp & 0x2)
2919 BIOS(B_PUTC, cmdunit, 'V');
2920 else
2921 BIOS(B_PUTC, cmdunit, '-');
2922
2923 if (srtemp & 0x1)
2924 BIOS(B_PUTC, cmdunit, 'C');
2925 else
2926 BIOS(B_PUTC, cmdunit, '-');
2927
2928 writeln(cmdunit, " )\r\n");
2929}
2930
2931/*
2932 ============================================================================
2933 showcr() -- show crash registers
2934 ============================================================================
2935*/
2936
2937void showcr(void)
2938{
2939 register int16_t i;
2940 register int8_t *cause;
2941 register uint16_t srtemp;
2942
2943 writeln(cmdunit, "BIOS Crash Area Dump\r\n");
2944 writeln(cmdunit, " ");
2945
2946 for (i = 0; i < 8; i++) {
2947
2948 BIOS(B_PUTC, cmdunit, ' ');
2949 BIOS(B_PUTC, cmdunit, '0'+i);
2950 writeln(cmdunit, "_______");
2951 }
2952
2953 writeln(cmdunit, "\r\nd0..d7 ");
2954
2955 for (i = 0; i < 8; i++) {
2956
2957 BIOS(B_PUTC, cmdunit, ' ');
2958 puthn(crshrg[i], 8, cmdunit);
2959 }
2960
2961 writeln(cmdunit, "\r\na0..a7 ");
2962
2963 for (i = 8; i < 16; i++) {
2964
2965 BIOS(B_PUTC, cmdunit, ' ');
2966 puthn(crshrg[i], 8, cmdunit);
2967 }
2968
2969 writeln(cmdunit, "\r\n\nPC = ");
2970 puthn(crshpc, 8, cmdunit);
2971
2972 srtemp = crshsr;
2973 writeln(cmdunit, ", SR = ");
2974 puthn((uint32_t)srtemp & 0xFFFFL, 4, cmdunit);
2975
2976 writeln(cmdunit, " (IPL = ");
2977 puthn((uint32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
2978 writeln(cmdunit, ", ");
2979
2980 if (srtemp & 0x8000)
2981 BIOS(B_PUTC, cmdunit, 'T');
2982 else
2983 BIOS(B_PUTC, cmdunit, '-');
2984
2985 if (srtemp & 0x2000)
2986 BIOS(B_PUTC, cmdunit, 'S');
2987 else
2988 BIOS(B_PUTC, cmdunit, '-');
2989
2990 BIOS(B_PUTC, cmdunit, ' ');
2991
2992 if (srtemp & 0x10)
2993 BIOS(B_PUTC, cmdunit, 'X');
2994 else
2995 BIOS(B_PUTC, cmdunit, '-');
2996
2997 if (srtemp & 0x8)
2998 BIOS(B_PUTC, cmdunit, 'N');
2999 else
3000 BIOS(B_PUTC, cmdunit, '-');
3001
3002 if (srtemp & 0x4)
3003 BIOS(B_PUTC, cmdunit, 'Z');
3004 else
3005 BIOS(B_PUTC, cmdunit, '-');
3006
3007 if (srtemp & 0x2)
3008 BIOS(B_PUTC, cmdunit, 'V');
3009 else
3010 BIOS(B_PUTC, cmdunit, '-');
3011
3012 if (srtemp & 0x1)
3013 BIOS(B_PUTC, cmdunit, 'C');
3014 else
3015 BIOS(B_PUTC, cmdunit, '-');
3016
3017 writeln(cmdunit, " )\r\n");
3018
3019
3020 writeln(cmdunit, "TRAP vector number = ");
3021 putn((uint32_t)crshvc[0], 2, cmdunit);
3022
3023 cause = " (no handler for interrupt)";
3024
3025 switch (crshvc[0] & 0xFF) {
3026
3027 case 2: /* 2: bus error */
3028
3029 cause = " (Bus error)";
3030 break;
3031
3032 case 3: /* 3: address error */
3033
3034 cause = " (Address error)";
3035 break;
3036
3037 case 4: /* 4: illegal instruction */
3038
3039 cause = " (Illegal instruction)";
3040 break;
3041
3042 case 5: /* 5: zero divide */
3043
3044 cause = " (Zero divide)";
3045 break;
3046
3047 case 6: /* 6: CHK instruction */
3048
3049 cause = " (CHK instruction)";
3050 break;
3051
3052 case 7: /* 7: TRAPV instruction */
3053
3054 cause = " (TRAPV instruction)";
3055 break;
3056
3057 case 8: /* 8: privilege violation */
3058
3059 cause = " (Privilege violation)";
3060 break;
3061
3062 case 9: /* 9: trace */
3063
3064 cause = " (Trace -- not implemented)";
3065 break;
3066
3067 case 10: /* 10: line 1010 emulator */
3068
3069 cause = " (Line 1010 Emulator -- not implemented)";
3070 break;
3071
3072 case 11: /* 11: line 1111 emulator */
3073
3074 cause = " (Line 1111 Emulator -- not implemented";
3075 break;
3076
3077 case 15: /* 15: uninitialized interrupt vector */
3078
3079 cause = " (Uninitialized interrupt)";
3080 break;
3081
3082 case 24: /* 24: spurious interrupt */
3083
3084 cause = " (Spurious interrupt)";
3085 break;
3086
3087 case 25: /* 25: Autovector Level 1*/
3088
3089 cause = " (Level 1 Interrupt -- unimplmented)";
3090 break;
3091
3092 case 26: /* 26: Autovector Level 2 */
3093
3094 cause = " (Level 2 Interrupt -- unimplmented)";
3095 break;
3096
3097 case 27: /* 27: Autovector Level 3 */
3098
3099 cause = " (Level 3 Interrupt -- unimplmented)";
3100 break;
3101
3102 case 28: /* 28: Autovector Level 4 */
3103
3104 cause = " (Level 4 Interrupt -- unimplmented)";
3105 break;
3106
3107 case 29: /* 29: Autovector Level 5 */
3108
3109 cause = " (Level 5 Interrupt -- unimplmented)";
3110 break;
3111
3112 case 30: /* 30: Autovector Level 6 */
3113
3114 cause = " (Level 6 Interrupt -- unimplmented)";
3115 break;
3116
3117 case 31: /* 31: Autovector Level 7 */
3118
3119 cause = " (Level 7 Interrupt -- unimplmented)";
3120 break;
3121
3122 }
3123
3124 writeln(cmdunit, cause);
3125 writeln(cmdunit, "\r\n");
3126}
3127
3128/*
3129 ============================================================================
3130 cx_crsh -- process the crash command
3131 ============================================================================
3132*/
3133
3134int16_t cx_crsh(void)
3135{
3136 if (!wzcrsh)
3137 printf("** Crash switch NOT set **\r\n");
3138
3139 redo = FALSE;
3140 showcr();
3141 return(TRUE);
3142}
3143
3144/*
3145 ============================================================================
3146 bphit -- clear breakpoints, see if any were hit
3147 ============================================================================
3148*/
3149
3150int16_t bphit(void)
3151{
3152 int16_t rc;
3153
3154 rc = FALSE;
3155
3156 if (p_ba0 EQ regptr->reg_pc) {
3157
3158 if (*p_ba0 EQ BPINST) {
3159
3160 *p_ba0 = p_bv0;
3161 p_ba0 = 0L;
3162 p_bv0 = BPINST;
3163 rc = TRUE;
3164
3165 } else {
3166
3167 writeln(cmdunit, "** Breakpoint word at ");
3168 puthn((uint32_t)p_ba0, 8 , cmdunit);
3169 writeln(cmdunit, " was ");
3170 puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
3171 writeln(cmdunit, " instead of ");
3172 puthn((uint32_t)BPINST, 4, cmdunit);
3173 writeln(cmdunit, " **\r\n\n");
3174 rc = TRUE;
3175 }
3176 }
3177
3178 if (p_ba1 EQ regptr->reg_pc) {
3179
3180 if (*p_ba1 EQ BPINST) {
3181
3182 *p_ba1 = p_bv1;
3183 p_ba1 = 0L;
3184 p_bv1 = BPINST;
3185 rc = TRUE;
3186
3187 } else {
3188
3189 writeln(cmdunit, "** Breakpoint word at ");
3190 puthn((uint32_t)p_ba0, 8 , cmdunit);
3191 writeln(cmdunit, " was ");
3192 puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
3193 writeln(cmdunit, " instead of ");
3194 puthn((uint32_t)BPINST, 4, cmdunit);
3195 writeln(cmdunit, " **\r\n\n");
3196 rc = TRUE;
3197 }
3198 }
3199
3200 if (p_ba0) {
3201
3202 if (*p_ba0 EQ BPINST) {
3203
3204 *p_ba0 = p_bv0;
3205 p_ba0 = 0L;
3206 p_bv0 = BPINST;
3207 rc = TRUE;
3208
3209 } else {
3210
3211 writeln(cmdunit, "** Breakpoint word at ");
3212 puthn((uint32_t)p_ba0, 8 , cmdunit);
3213 writeln(cmdunit, " was ");
3214 puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
3215 writeln(cmdunit, " instead of ");
3216 puthn((uint32_t)BPINST, 4, cmdunit);
3217 writeln(cmdunit, " **\r\n\n");
3218 rc = TRUE;
3219 }
3220 }
3221
3222 if (p_ba1) {
3223
3224 if (*p_ba1 EQ BPINST) {
3225
3226 *p_ba1 = p_bv1;
3227 p_ba1 = 0L;
3228 p_bv1 = BPINST;
3229 rc = TRUE;
3230
3231 } else {
3232
3233 writeln(cmdunit, "** Breakpoint word at ");
3234 puthn((uint32_t)p_ba0, 8 , cmdunit);
3235 writeln(cmdunit, " was ");
3236 puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
3237 writeln(cmdunit, " instead of ");
3238 puthn((uint32_t)BPINST, 4, cmdunit);
3239 writeln(cmdunit, " **\r\n\n");
3240 rc = TRUE;
3241 }
3242 }
3243
3244 if (rc)
3245 return(rc);
3246
3247 writeln(cmdunit, "\r\n** Program invoked ROMP trap **\r\n");
3248 return(FALSE);
3249}
3250
3251/*
3252 ============================================================================
3253 cx_regs() -- process the regs command
3254 ============================================================================
3255*/
3256
3257int16_t cx_regs(void)
3258{
3259 showrs(regptr);
3260 return(TRUE);
3261}
3262
3263/*
3264 ============================================================================
3265 rompbp() -- process a breakpoint for ROMP
3266 ============================================================================
3267*/
3268
3269void rompbp(uint32_t d0, ...)
3270{
3271 register int16_t i;
3272
3273 regptr = (struct regs *)&d0; /* make registers accessable */
3274 regptr->reg_pc -= 2L; /* adjust pc */
3275
3276 if (-1 EQ setipl(iplev)) /* enable interrupts */
3277 writeln(cmdunit, "\r\n\n***** setipl() failed *****\r\n\n");
3278
3279 if (first1) { /* initial entry from xtrap15() */
3280
3281 for (i = 0; i < 8; i++) /* clear d0..d7 */
3282 regptr->d_reg[i] = 0L;
3283
3284 for (i = 0; i < 7; i++) /* clear a0..a6 */
3285 regptr->a_reg[i] = 0L;
3286
3287 regptr->a_reg[7] = ISTACK; /* setup initial stack */
3288
3289 regptr->reg_sr = INITSR; /* setup sr */
3290 regptr->reg_pc += 2L; /* adjust pc past TRAP 15 */
3291
3292 } else { /* breakpoint */
3293
3294 writeln(cmdunit, "\r\n\n** ROMP Breakpoint TRAP **\r\n");
3295
3296 showrs(regptr); /* show registers */
3297
3298 if (bphit() EQ FALSE) /* fixup breakpoints */
3299 regptr->reg_pc += 2L; /* and maybe the pc */
3300
3301 }
3302
3303 first1 = FALSE; /* not first time any more */
3304 exflag = FALSE; /* clear exit flag */
3305
3306 do {
3307
3308 do_cmd(); /* process commands ... */
3309
3310 } while (!exflag); /* ... until exit flag is set */
3311
3312 return; /* return to xtrap15 */
3313}
3314
3315/*
3316 ============================================================================
3317 progid() -- identify the program
3318 ============================================================================
3319*/
3320
3321void progid(void)
3322{
3323 register int8_t *pcptr;
3324
3325#if TINYMSG
3326
3327#if ON_B700
3328 writeln(cmdunit, "\r\n\nB\r\n");
3329#else
3330 writeln(cmdunit, "\r\n\nN\r\n");
3331#endif
3332
3333#else
3334
3335#if ON_B700
3336 writeln(cmdunit, "\r\n\nBuchla 700 BIOS / Debug PROM\r\n");
3337#else
3338 writeln(cmdunit, "\r\n\nNASA 3D Helmet Display BIOS / Debug PROM\r\n");
3339#endif
3340
3341 writeln(cmdunit, " ROMP Version ");
3342 writeln(cmdunit, ROMPVER);
3343
3344 writeln(cmdunit, "\r\n BIOS Version ");
3345 pcptr = (int8_t *)PRM_VERS;
3346 putn((uint32_t)*pcptr++, 2, cmdunit);
3347 BIOS(B_PUTC, cmdunit, '.');
3348 putn((uint32_t)*pcptr++, 2, cmdunit);
3349 writeln(cmdunit, promdate);
3350
3351#endif
3352}
3353
3354#if ON_B700
3355
3356
3357/*
3358 ============================================================================
3359 pclr() -- clear the panel FIFO
3360 ============================================================================
3361*/
3362
3363int16_t pclr(void)
3364{
3365 register int16_t i;
3366
3367 ftimer = FIFOLIM;
3368
3369 while (-1L NE (afi = XBIOS(X_ANALOG))) { /* check panel inputs */
3370
3371 asig = 0x007F & (afi >> 8); /* signal number */
3372
3373 if (0 EQ asig) {
3374
3375 /* all keys up */
3376
3377 for (i = 0; i < 128; i++) {
3378
3379 sigtab[i][0] = 0;
3380 sigtab[i][1] = 0;
3381 }
3382
3383 break;
3384 }
3385
3386 if (ftimer-- < 0)
3387 return(FAILURE);
3388 }
3389
3390 return(SUCCESS);
3391}
3392
3393/*
3394 ============================================================================
3395 pscan() -- scan the panel and maybe even load a program from diskette
3396 ============================================================================
3397*/
3398
3399int16_t pscan(void)
3400{
3401 register int16_t i, c;
3402
3403 if (0 EQ ledcntr--) {
3404
3405 if ((baseled + 3) > 23) /* turn on a LED */
3406 io_leds = baseled - 21;
3407 else
3408 io_leds = baseled + 3;
3409
3410 io_leds = 0x80 + baseled; /* turn off a LED */
3411
3412 if (++baseled > 23) /* update LED number */
3413 baseled = 0;
3414
3415 ledcntr = 200;
3416 }
3417
3418 aflag = FALSE;
3419
3420 if (-1L NE (afi = XBIOS(X_ANALOG))) { /* check panel inputs */
3421
3422 asig = 0x007F & (afi >> 8); /* signal number */
3423 astat = 0x0001 & (afi >> 7); /* status */
3424 aval = 0x007F & afi; /* value */
3425
3426 if (asig) { /* active signal */
3427
3428 aflag = TRUE;
3429
3430 sigtab[asig][0] = aval;
3431 sigtab[asig][1] = astat;
3432
3433 } else { /* all keys up */
3434
3435 aflag = FALSE;
3436
3437 for (i = 0; i < 128; i++)
3438 sigtab[i][1] = 0;
3439 }
3440 }
3441
3442 if (aflag) { /* anything changed ? */
3443
3444 if (astat AND (asig EQ BOOTKEY)) { /* BOOT key */
3445
3446 for (i = 0; i < 24; i++) /* turn off LEDs */
3447 io_leds = 0x80 + i;
3448
3449 io_leds = 0x1F; /* turn off LCD lamp */
3450
3451 /* load and run BOOTFILE */
3452
3453 B_log_s = FALSE;
3454 B_dbg_s = FALSE;
3455
3456 hdvini();
3457 _bpbin = FALSE;
3458
3459 if (booter(BOOTFILE, 0L))
3460 return(FALSE);
3461 else
3462 sjumpto((void *)B_buf_a, (void *)ISTACK);
3463
3464 } else if (astat AND (asig EQ ROMPKEY)) { /* ROMP key */
3465
3466 for (i = 0; i < 24; i++) /* turn off LEDs */
3467 io_leds = 0x80 + i;
3468
3469 return(TRUE);
3470 }
3471 }
3472
3473 if (BIOS(B_RDAV, CON_DEV)) {
3474
3475 c = 0x007F & BIOS(B_GETC, CON_DEV);
3476
3477 if ((c EQ 'r') OR (c EQ 'R'))
3478 return(TRUE);
3479 }
3480
3481 return(FALSE);
3482}
3483#endif
3484
3485/*
3486 ============================================================================
3487 romp main routine
3488 ============================================================================
3489*/
3490
3491void main(void)
3492{
3493 register int16_t i;
3494 register int8_t *pdptr, *pcptr;
3495
3496 /* unpack PROM date */
3497
3498 pcptr = (int8_t *)PRM_DATE; /* prom date: yyyymmdd */
3499 pdptr = promdate; /* -- yyyy-mm-dd */
3500 *pdptr++ = ' ';
3501 *pdptr++ = '-';
3502 *pdptr++ = '-';
3503 *pdptr++ = ' ';
3504 *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
3505 *pdptr++ = (*pcptr++ & 0x0F) + '0';
3506 *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
3507 *pdptr++ = (*pcptr++ & 0x0F) + '0';
3508 *pdptr++ = '-';
3509 *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
3510 *pdptr++ = (*pcptr++ & 0x0F) + '0';
3511 *pdptr++ = '-';
3512 *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
3513 *pdptr++ = (*pcptr++ & 0x0F) + '0';
3514 *pdptr++ = '\0';
3515
3516 /* initialize variables */
3517
3518 sprintf(hs_mtst, "[[start=$%lX],[end=$%lx]] (or $8..$%lX)",
3519 USER_RAM, RAM_TOP, (USER_RAM - 2L));
3520
3521 cmdunit = CON_DEV;
3522
3523 ilast = 0;
3524 inext = 0;
3525 iplev = DEFIPL;
3526
3527 dflag = FALSE;
3528 exflag = FALSE;
3529 redo = FALSE;
3530 goflag = FALSE;
3531 b0flag = FALSE;
3532 b1flag = FALSE;
3533
3534 p_goto = ROMADDR;
3535 p_len = 0L;
3536 p_width = 16L;
3537 p_value = 0L;
3538
3539 p_ba0 = 0L;
3540 p_bv0 = BPINST;
3541
3542 p_ba1 = 0L;
3543 p_bv1 = BPINST;
3544
3545 tba0 = 0L;
3546 tba1 = 0L;
3547
3548 inext = 0;
3549
3550 tsetup(); /* patch the timer interrupt code */
3551
3552#if ON_B700
3553 baseled = 21; /* setup LED scan */
3554 ledcntr = 0; /* ... */
3555 io_leds = 0x9F; /* turn on LCD lamp */
3556 GLCinit(); /* reset LCD display */
3557
3558 GLCtext(0, 1, "Load GoTo");
3559 GLCtext(1, 1, "Disk ROMP");
3560
3561 GLCtext(3, 15, "Buchla 700 -- BIOS/ROMP Firmware by D.N. Lynx Crowe");
3562
3563 sprintf(idbuf, "BIOS Version %02d.%02d%s",
3564 *(int8_t *)PRM_VERS, *(int8_t *)(PRM_VERS+1), promdate);
3565 GLCtext(5, 30, idbuf);
3566
3567 sprintf(idbuf, "ROMP Version %s", ROMPVER);
3568 GLCtext(6, 30, idbuf);
3569 GLCcrc(0, 0);
3570
3571 BIOS(B_SETV, 47, trap15); /* set ROMP trap vec */
3572
3573 for (i = 0; i < 128; i++) {
3574
3575 sigtab[i][0] = 0;
3576 sigtab[i][1] = 0;
3577 }
3578
3579 XBIOS(X_CLRAFI); /* clear the panel FIFO */
3580 setipl(KB_EI); /* enable interrupts */
3581 pclr(); /* empty the panel FIFO */
3582 XBIOS(X_CLRAFI); /* clear the panel FIFO */
3583
3584 while (FALSE EQ pscan()) ; /* do the panel scan */
3585#endif
3586
3587
3588 if (setjmp(&restart)) /* setup restart point */
3589 writeln(cmdunit, "\r\n***** ROMP Re-starting *****\r\n\n");
3590
3591 tsetup(); /* patch the timer interrupt code */
3592 progid(); /* identify the program */
3593
3594 BIOS(B_SETV, 47, trap15); /* set ROMP trap vec */
3595 writeln(cmdunit, "\r\n\n");
3596
3597 /* process commands */
3598
3599 first1 = TRUE; /* set break init flag */
3600
3601 while (TRUE) {
3602
3603 xtrap15(); /* trap into ROMP bp processor */
3604 writeln(cmdunit, "\r\n** xtrap15() returned to ROMP **\r\n\n");
3605 }
3606}
3607
Note: See TracBrowser for help on using the repository browser.