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