source: buchla-68k/rom/romp.c@ 8c8b4e5

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

More volatile hardware accesses.

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