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_goto, /* goto parameter */
|
---|
249 | *p_to, /* to parameter */
|
---|
250 | *sptr; /* string scan pointer */
|
---|
251 |
|
---|
252 | int16_t argln, /* argument length */
|
---|
253 | b0flag, /* breakpoint 0 flag */
|
---|
254 | b1flag, /* breakpoint 1 flag */
|
---|
255 | cmdunit, /* command unit */
|
---|
256 | dflag, /* dump limit flag */
|
---|
257 | exflag, /* exit do_cmd flag */
|
---|
258 | first1, /* first time flag */
|
---|
259 | goflag, /* pc set flag */
|
---|
260 | ilast, /* index of last command */
|
---|
261 | inext, /* command index for "next" command */
|
---|
262 | iplev, /* ROMP IPL level */
|
---|
263 | monsw, /* monitor switch */
|
---|
264 | redo, /* re-doable command flag */
|
---|
265 | rnum, /* register number */
|
---|
266 | vrnum; /* video register number */
|
---|
267 |
|
---|
268 | /* |
---|
269 |
|
---|
270 | */
|
---|
271 |
|
---|
272 | #if ON_B700
|
---|
273 | int16_t asig, /* signal number */
|
---|
274 | aval, /* signal value */
|
---|
275 | astat, /* signal status */
|
---|
276 | aflag, /* signal activity flag */
|
---|
277 | baseled, /* base LED for scan */
|
---|
278 | ledcntr; /* LED scan counter */
|
---|
279 |
|
---|
280 | int16_t sigtab[128][2]; /* signal table */
|
---|
281 |
|
---|
282 | int32_t afi, /* analog FIFO input */
|
---|
283 | ftimer; /* analog FIFO clear timer */
|
---|
284 |
|
---|
285 | uint16_t baron, /* bar 'on' color */
|
---|
286 | baroff, /* bar 'off' color */
|
---|
287 | swon, /* switch 'on' color */
|
---|
288 | swoff, /* switch 'off' color */
|
---|
289 | *obj0; /* object pointer */
|
---|
290 | #endif
|
---|
291 |
|
---|
292 | uint16_t *tba0, /* breakpoint 0 temporary */
|
---|
293 | *tba1; /* breakpoint 1 temporary */
|
---|
294 |
|
---|
295 | uint16_t p_bv0, /* breakpoint 0 value */
|
---|
296 | p_bv1; /* breakpoint 1 value */
|
---|
297 |
|
---|
298 | uint16_t *p_ba0, /* breakpoint 0 address */
|
---|
299 | *p_ba1; /* breakpoint 1 address */
|
---|
300 |
|
---|
301 | jmp_buf restart; /* jmp environment */
|
---|
302 |
|
---|
303 | int32_t 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(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 = 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 = 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 | */
|
---|
972 |
|
---|
973 | /*
|
---|
974 | ============================================================================
|
---|
975 | putn -- output a decimal number
|
---|
976 | ============================================================================
|
---|
977 | */
|
---|
978 |
|
---|
979 | void putn(uint32_t num, int16_t cw, int16_t unit)
|
---|
980 | {
|
---|
981 | register int16_t d;
|
---|
982 |
|
---|
983 | if (!cw)
|
---|
984 | return;
|
---|
985 |
|
---|
986 | putn(num/10, cw-1, unit);
|
---|
987 |
|
---|
988 | d = num % 10;
|
---|
989 |
|
---|
990 | BIOS(B_PUTC, unit, (d + '0'));
|
---|
991 |
|
---|
992 | return;
|
---|
993 | }
|
---|
994 |
|
---|
995 | /* |
---|
996 |
|
---|
997 | */
|
---|
998 |
|
---|
999 | /*
|
---|
1000 | ============================================================================
|
---|
1001 | puthn -- output a hex number
|
---|
1002 | ============================================================================
|
---|
1003 | */
|
---|
1004 |
|
---|
1005 | void puthn(uint32_t num, int16_t cw, int16_t unit)
|
---|
1006 | {
|
---|
1007 | register int16_t d;
|
---|
1008 |
|
---|
1009 | if (!cw)
|
---|
1010 | return;
|
---|
1011 |
|
---|
1012 | puthn(num >> 4, cw-1, unit);
|
---|
1013 |
|
---|
1014 | d = 0x0F & num;
|
---|
1015 |
|
---|
1016 | if (d > 9)
|
---|
1017 | BIOS(B_PUTC, unit, (d - 10 + 'A'));
|
---|
1018 | else
|
---|
1019 | BIOS(B_PUTC, unit, (d + '0'));
|
---|
1020 |
|
---|
1021 | return;
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | /* |
---|
1025 |
|
---|
1026 | */
|
---|
1027 |
|
---|
1028 | /*
|
---|
1029 | ============================================================================
|
---|
1030 | ddump -- do the hex portion of a dump
|
---|
1031 | ============================================================================
|
---|
1032 | */
|
---|
1033 |
|
---|
1034 | int16_t ddump(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
|
---|
1035 | {
|
---|
1036 | while (nwide--) {
|
---|
1037 |
|
---|
1038 | puthn((uint32_t)(0xFF & *loc), 2, unit);
|
---|
1039 | BIOS(B_PUTC, unit, ' ');
|
---|
1040 |
|
---|
1041 | if (BIOS(B_RDAV, unit)) {
|
---|
1042 |
|
---|
1043 | BIOS(B_GETC, unit);
|
---|
1044 | return(TRUE);
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 | if (loc EQ lastloc) {
|
---|
1048 |
|
---|
1049 | dflag = TRUE;
|
---|
1050 | return(FALSE);
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | ++loc;
|
---|
1054 | }
|
---|
1055 |
|
---|
1056 |
|
---|
1057 | return(FALSE);
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | /* |
---|
1061 |
|
---|
1062 | */
|
---|
1063 |
|
---|
1064 | /*
|
---|
1065 | ============================================================================
|
---|
1066 | padr -- print dump address
|
---|
1067 | ============================================================================
|
---|
1068 | */
|
---|
1069 |
|
---|
1070 | void padr(int32_t adr, int16_t unit)
|
---|
1071 | {
|
---|
1072 | puthn((uint32_t)adr, 8, unit);
|
---|
1073 | BIOS(B_PUTC, unit, ' ');
|
---|
1074 | BIOS(B_PUTC, unit, '-');
|
---|
1075 | BIOS(B_PUTC, unit, ' ');
|
---|
1076 | }
|
---|
1077 |
|
---|
1078 | /* |
---|
1079 |
|
---|
1080 | */
|
---|
1081 |
|
---|
1082 | /*
|
---|
1083 | ============================================================================
|
---|
1084 | dtext -- do the text portion of a dump
|
---|
1085 | ============================================================================
|
---|
1086 | */
|
---|
1087 |
|
---|
1088 | int16_t dtext(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
|
---|
1089 | {
|
---|
1090 | register int16_t c;
|
---|
1091 |
|
---|
1092 | BIOS(B_PUTC, unit, ' ');
|
---|
1093 | BIOS(B_PUTC, unit, '|');
|
---|
1094 |
|
---|
1095 | while (nwide--) {
|
---|
1096 |
|
---|
1097 | c = 0xFF & *loc;
|
---|
1098 |
|
---|
1099 | if (isascii(c) AND isprint(c))
|
---|
1100 | BIOS(B_PUTC, unit, c);
|
---|
1101 | else
|
---|
1102 | BIOS(B_PUTC, unit, '.');
|
---|
1103 |
|
---|
1104 | if (BIOS(B_RDAV, unit)) {
|
---|
1105 |
|
---|
1106 | BIOS(B_GETC, unit);
|
---|
1107 | BIOS(B_PUTC, unit, '|');
|
---|
1108 | return(TRUE);
|
---|
1109 | }
|
---|
1110 |
|
---|
1111 | if (loc EQ lastloc) {
|
---|
1112 |
|
---|
1113 | BIOS(B_PUTC, unit, '|');
|
---|
1114 | return(FALSE);
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 | ++loc;
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | BIOS(B_PUTC, unit, '|');
|
---|
1121 | return(FALSE);
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | /* |
---|
1125 |
|
---|
1126 | */
|
---|
1127 |
|
---|
1128 | /*
|
---|
1129 | ============================================================================
|
---|
1130 | cp_mset -- parse parameters for mset command
|
---|
1131 | ============================================================================
|
---|
1132 | */
|
---|
1133 |
|
---|
1134 | int16_t cp_mset(void)
|
---|
1135 | {
|
---|
1136 | redo = FALSE;
|
---|
1137 |
|
---|
1138 | if (0 EQ getarg())
|
---|
1139 | return(FALSE);
|
---|
1140 |
|
---|
1141 | if (argsep NE ',')
|
---|
1142 | return(FALSE);
|
---|
1143 |
|
---|
1144 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1145 | return(FALSE);
|
---|
1146 |
|
---|
1147 | return(TRUE);
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 | /*
|
---|
1151 | ============================================================================
|
---|
1152 | cx_mset -- execute the mset command
|
---|
1153 | ============================================================================
|
---|
1154 | */
|
---|
1155 |
|
---|
1156 | int16_t cx_mset(void)
|
---|
1157 | {
|
---|
1158 | while (TRUE) {
|
---|
1159 |
|
---|
1160 | if (getarg())
|
---|
1161 | if (setvar(&p_value, p_value) EQ FALSE)
|
---|
1162 | return(FALSE);
|
---|
1163 |
|
---|
1164 | if (p_value & ~0xFFL)
|
---|
1165 | return(FALSE);
|
---|
1166 |
|
---|
1167 | *p_from++ = 0xFF & p_value;
|
---|
1168 |
|
---|
1169 | if (argsep EQ A_CR)
|
---|
1170 | return(TRUE);
|
---|
1171 | }
|
---|
1172 | }
|
---|
1173 | /* |
---|
1174 |
|
---|
1175 | */
|
---|
1176 |
|
---|
1177 | /*
|
---|
1178 | ============================================================================
|
---|
1179 | cp_wset -- parse parameters for wset command
|
---|
1180 | ============================================================================
|
---|
1181 | */
|
---|
1182 |
|
---|
1183 | int16_t cp_wset(void)
|
---|
1184 | {
|
---|
1185 | redo = FALSE;
|
---|
1186 |
|
---|
1187 | if (0 EQ getarg())
|
---|
1188 | return(FALSE);
|
---|
1189 |
|
---|
1190 | if (argsep NE ',')
|
---|
1191 | return(FALSE);
|
---|
1192 |
|
---|
1193 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1194 | return(FALSE);
|
---|
1195 |
|
---|
1196 | if ((int32_t)p_from & 1L)
|
---|
1197 | return(FALSE);
|
---|
1198 |
|
---|
1199 | return(TRUE);
|
---|
1200 | }
|
---|
1201 |
|
---|
1202 | /* |
---|
1203 |
|
---|
1204 | */
|
---|
1205 |
|
---|
1206 | /*
|
---|
1207 | ============================================================================
|
---|
1208 | cx_wset -- execute the wset command
|
---|
1209 | ============================================================================
|
---|
1210 | */
|
---|
1211 |
|
---|
1212 | int16_t cx_wset(void)
|
---|
1213 | {
|
---|
1214 | uint16_t *p_uint;
|
---|
1215 |
|
---|
1216 | p_uint = (uint16_t *)p_from;
|
---|
1217 |
|
---|
1218 | while (TRUE) {
|
---|
1219 |
|
---|
1220 | if (getarg())
|
---|
1221 | if (setvar(&p_value, p_value) EQ FALSE)
|
---|
1222 | return(FALSE);
|
---|
1223 |
|
---|
1224 | if (p_value & ~0xFFFFL)
|
---|
1225 | return(FALSE);
|
---|
1226 |
|
---|
1227 | *p_uint++ = 0xFFFF & p_value;
|
---|
1228 |
|
---|
1229 | if (argsep EQ A_CR)
|
---|
1230 | return(TRUE);
|
---|
1231 | }
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | /* |
---|
1235 |
|
---|
1236 | */
|
---|
1237 |
|
---|
1238 | /*
|
---|
1239 | ============================================================================
|
---|
1240 | cp_mtst -- parse mtest command arguments
|
---|
1241 | ============================================================================
|
---|
1242 | */
|
---|
1243 |
|
---|
1244 | int16_t cp_mtst(void)
|
---|
1245 | {
|
---|
1246 | inext = ilast;
|
---|
1247 |
|
---|
1248 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
1249 |
|
---|
1250 | p_from = (int8_t *)0x00000008L;
|
---|
1251 | p_to = (int8_t *)USER_RAM - 2L;
|
---|
1252 | return(TRUE);
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 | if (getarg())
|
---|
1256 | if (setvar(&p_from, USER_RAM) EQ FALSE)
|
---|
1257 | return(FALSE);
|
---|
1258 |
|
---|
1259 | if (argsep NE ',')
|
---|
1260 | return(FALSE);
|
---|
1261 |
|
---|
1262 | if (getarg())
|
---|
1263 | if (setvar(&p_to, RAM_TOP) EQ FALSE)
|
---|
1264 | return(FALSE);
|
---|
1265 |
|
---|
1266 | if ((int32_t)p_from & 1L)
|
---|
1267 | return(FALSE);
|
---|
1268 |
|
---|
1269 | if ((int32_t)p_to & 1L)
|
---|
1270 | return(FALSE);
|
---|
1271 |
|
---|
1272 | if (p_from GT p_to)
|
---|
1273 | return(FALSE);
|
---|
1274 |
|
---|
1275 | return(TRUE);
|
---|
1276 | }
|
---|
1277 |
|
---|
1278 | /* |
---|
1279 |
|
---|
1280 | */
|
---|
1281 |
|
---|
1282 | /*
|
---|
1283 | ============================================================================
|
---|
1284 | cx_mtst -- execute the mtest command
|
---|
1285 | ============================================================================
|
---|
1286 | */
|
---|
1287 |
|
---|
1288 | int16_t cx_mtst(void)
|
---|
1289 | {
|
---|
1290 | register int16_t mask, was, *loc, *eloc, *oldloc;
|
---|
1291 |
|
---|
1292 | mask = 0x0001;
|
---|
1293 | loc = (int16_t *)p_from;
|
---|
1294 | eloc = (int16_t *)p_to;
|
---|
1295 | oldloc = loc;
|
---|
1296 |
|
---|
1297 | if (p_from LT (int8_t *)USER_RAM)
|
---|
1298 | setipl(7);
|
---|
1299 |
|
---|
1300 | do {
|
---|
1301 |
|
---|
1302 | while (mask) {
|
---|
1303 |
|
---|
1304 | *loc = mask;
|
---|
1305 |
|
---|
1306 | if (mask NE (was = *loc))
|
---|
1307 | if (p_from LT (int8_t *)USER_RAM)
|
---|
1308 | halt();
|
---|
1309 | else
|
---|
1310 | printf("%08lX was %04X, expected %04X\r\n",
|
---|
1311 | loc, was, mask);
|
---|
1312 |
|
---|
1313 | *loc = ~mask;
|
---|
1314 |
|
---|
1315 | if (~mask NE (was = *loc))
|
---|
1316 | if (p_from LT (int8_t *)USER_RAM)
|
---|
1317 | halt();
|
---|
1318 | else
|
---|
1319 | printf("%08lX was %04X, expected %04X\r\n",
|
---|
1320 | loc, was, ~mask);
|
---|
1321 |
|
---|
1322 | mask <<= 1;
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | mask = 0x0001;
|
---|
1326 | loc++;
|
---|
1327 |
|
---|
1328 | } while (loc LE eloc);
|
---|
1329 |
|
---|
1330 | if (oldloc LT (int16_t *)USER_RAM)
|
---|
1331 | rjumpto((int32_t)ROMADDR);
|
---|
1332 |
|
---|
1333 | return(TRUE);
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | /* |
---|
1337 |
|
---|
1338 | */
|
---|
1339 |
|
---|
1340 | /*
|
---|
1341 | ============================================================================
|
---|
1342 | cp_go -- parse parameters for go command
|
---|
1343 | ============================================================================
|
---|
1344 | */
|
---|
1345 |
|
---|
1346 | int16_t cp_go(void)
|
---|
1347 | {
|
---|
1348 | redo = FALSE;
|
---|
1349 | b0flag = FALSE;
|
---|
1350 | b1flag = FALSE;
|
---|
1351 | goflag = FALSE;
|
---|
1352 |
|
---|
1353 | if (getarg()) {
|
---|
1354 |
|
---|
1355 | if (setvar(&p_goto, p_goto) EQ FALSE)
|
---|
1356 | return(FALSE);
|
---|
1357 |
|
---|
1358 | if (1L & (int32_t)p_goto)
|
---|
1359 | return(FALSE);
|
---|
1360 |
|
---|
1361 | goflag = TRUE;
|
---|
1362 |
|
---|
1363 | }
|
---|
1364 |
|
---|
1365 | if (getarg()) {
|
---|
1366 |
|
---|
1367 | if (setvar(&tba0, 0L) EQ FALSE)
|
---|
1368 | return(FALSE);
|
---|
1369 |
|
---|
1370 | if (1L & (int32_t)tba0)
|
---|
1371 | return(FALSE);
|
---|
1372 |
|
---|
1373 | b0flag = TRUE;
|
---|
1374 | }
|
---|
1375 |
|
---|
1376 | if (getarg()) {
|
---|
1377 |
|
---|
1378 | if (setvar(&tba1, 0L) EQ FALSE)
|
---|
1379 | return(FALSE);
|
---|
1380 |
|
---|
1381 | if (1L & (int32_t)tba1)
|
---|
1382 | return(FALSE);
|
---|
1383 |
|
---|
1384 | b1flag = TRUE;
|
---|
1385 | }
|
---|
1386 |
|
---|
1387 | return(TRUE);
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | /* |
---|
1391 |
|
---|
1392 | */
|
---|
1393 |
|
---|
1394 | #if ON_B700
|
---|
1395 |
|
---|
1396 | /*
|
---|
1397 | ============================================================================
|
---|
1398 | cx_dini() -- execute the dinit command
|
---|
1399 | ============================================================================
|
---|
1400 | */
|
---|
1401 |
|
---|
1402 | int16_t cx_dini(void)
|
---|
1403 | {
|
---|
1404 | redo = TRUE;
|
---|
1405 | hdvini();
|
---|
1406 | return(TRUE);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | #endif
|
---|
1410 |
|
---|
1411 | /*
|
---|
1412 | ============================================================================
|
---|
1413 | cx_zap -- execute the zap command
|
---|
1414 | ============================================================================
|
---|
1415 | */
|
---|
1416 |
|
---|
1417 | int16_t cx_zap(void)
|
---|
1418 | {
|
---|
1419 | register int16_t *p, *q;
|
---|
1420 |
|
---|
1421 | p = (int16_t *)USER_RAM;
|
---|
1422 | q = (int16_t *)RAM_TOP;
|
---|
1423 |
|
---|
1424 | setipl(7);
|
---|
1425 |
|
---|
1426 | while (p LE q)
|
---|
1427 | *p++ = 0;
|
---|
1428 |
|
---|
1429 | rjumpto(ROMADDR);
|
---|
1430 | return(TRUE); /* not reached */
|
---|
1431 | }
|
---|
1432 |
|
---|
1433 | /* |
---|
1434 |
|
---|
1435 | */
|
---|
1436 |
|
---|
1437 | /*
|
---|
1438 | ============================================================================
|
---|
1439 | cx_omap() -- execute the omap command
|
---|
1440 | ============================================================================
|
---|
1441 | */
|
---|
1442 |
|
---|
1443 | int16_t cx_omap(void)
|
---|
1444 | {
|
---|
1445 | register int16_t i, width, xloc;
|
---|
1446 |
|
---|
1447 | printf("Pr B/C Locn Wd Xloc Flags\r\n");
|
---|
1448 |
|
---|
1449 | for (i = 0; i < 16; i++) {
|
---|
1450 |
|
---|
1451 | xloc = v_odtab[i][1] & 0x03FF;
|
---|
1452 |
|
---|
1453 | if (xloc & 0x0200) /* sign extend xloc */
|
---|
1454 | xloc |= 0xFC00;
|
---|
1455 |
|
---|
1456 | width = (v_odtab[i][1] >> 10) & 0x003F;
|
---|
1457 |
|
---|
1458 | printf("%2d %s ",
|
---|
1459 | i, ((v_odtab[i][0] & V_CBS) ? "Chr" : "Bit"));
|
---|
1460 |
|
---|
1461 | printf("$%08lX %2d %4d ",
|
---|
1462 | ((int32_t)v_odtab[i][2] << 1), width, xloc);
|
---|
1463 |
|
---|
1464 | printf("$%04X\r\n", v_odtab[i][0]);
|
---|
1465 | }
|
---|
1466 |
|
---|
1467 | return(TRUE);
|
---|
1468 | }
|
---|
1469 |
|
---|
1470 | /* |
---|
1471 |
|
---|
1472 | */
|
---|
1473 |
|
---|
1474 | /*
|
---|
1475 | ============================================================================
|
---|
1476 | cx_help -- execute the help command
|
---|
1477 | ============================================================================
|
---|
1478 | */
|
---|
1479 |
|
---|
1480 | int16_t cx_help(void)
|
---|
1481 | {
|
---|
1482 | int16_t i, j;
|
---|
1483 |
|
---|
1484 | j = 0;
|
---|
1485 |
|
---|
1486 | writeln(cmdunit, CRLF);
|
---|
1487 |
|
---|
1488 | for (i = 0; i < NCMDS; i++) {
|
---|
1489 |
|
---|
1490 | if (j++ EQ 22) {
|
---|
1491 |
|
---|
1492 | j = 0;
|
---|
1493 |
|
---|
1494 | if (waitcr2())
|
---|
1495 | return(TRUE);
|
---|
1496 | }
|
---|
1497 |
|
---|
1498 | writeln(cmdunit, " ");
|
---|
1499 | writeln(cmdunit, cmtab[i].cname);
|
---|
1500 | writeln(cmdunit, " ");
|
---|
1501 | writeln(cmdunit, cmtab[i].hstr);
|
---|
1502 | writeln(cmdunit, CRLF);
|
---|
1503 | }
|
---|
1504 |
|
---|
1505 | writeln(cmdunit, CRLF);
|
---|
1506 | return(TRUE);
|
---|
1507 | }
|
---|
1508 |
|
---|
1509 | /* |
---|
1510 |
|
---|
1511 | * /
|
---|
1512 |
|
---|
1513 | /*
|
---|
1514 | ============================================================================
|
---|
1515 | cx_bpb -- execute bpb command
|
---|
1516 | ============================================================================
|
---|
1517 | */
|
---|
1518 |
|
---|
1519 | int16_t cx_bpb(void)
|
---|
1520 | {
|
---|
1521 | register struct bpb *bpp;
|
---|
1522 |
|
---|
1523 | if (0L EQ (bpp = (struct bpb *)BIOS(B_GBPB, 0) ) ) {
|
---|
1524 |
|
---|
1525 | writeln(cmdunit, "\r\n\nERROR -- Unable to read BPB\r\n\n");
|
---|
1526 | return(FALSE);
|
---|
1527 |
|
---|
1528 | } else {
|
---|
1529 |
|
---|
1530 | writeln(cmdunit, "\r\n\nBPB values:\r\n");
|
---|
1531 | writeln(cmdunit, "\r\n recsiz ");
|
---|
1532 | putn((uint32_t)bpp->recsiz, 5, cmdunit);
|
---|
1533 | writeln(cmdunit, "\r\n clsiz ");
|
---|
1534 | putn((uint32_t)bpp->clsiz, 4, cmdunit);
|
---|
1535 | writeln(cmdunit, "\r\n clsizb ");
|
---|
1536 | putn((uint32_t)bpp->clsizb, 5, cmdunit);
|
---|
1537 | writeln(cmdunit, "\r\n rdlen ");
|
---|
1538 | putn((uint32_t)bpp->rdlen, 4, cmdunit);
|
---|
1539 | writeln(cmdunit, "\r\n fsiz ");
|
---|
1540 | putn((uint32_t)bpp->fsiz, 4, cmdunit);
|
---|
1541 | writeln(cmdunit, "\r\n fatrec ");
|
---|
1542 | putn((uint32_t)bpp->fatrec, 5, cmdunit);
|
---|
1543 | writeln(cmdunit, "\r\n datrec ");
|
---|
1544 | putn((uint32_t)bpp->datrec, 5, cmdunit);
|
---|
1545 | writeln(cmdunit, "\r\n numcl ");
|
---|
1546 | putn((uint32_t)bpp->numcl, 5, cmdunit);
|
---|
1547 | writeln(cmdunit, "\r\n bflags ");
|
---|
1548 | puthn((uint32_t)bpp->bflags, 4, cmdunit);
|
---|
1549 | writeln(cmdunit, "\r\n ntracks ");
|
---|
1550 | putn((uint32_t)bpp->ntracks, 4, cmdunit);
|
---|
1551 | writeln(cmdunit, "\r\n nsides ");
|
---|
1552 | putn((uint32_t)bpp->nsides, 4, cmdunit);
|
---|
1553 | writeln(cmdunit, "\r\n sec/cyl ");
|
---|
1554 | putn((uint32_t)bpp->dspc, 5, cmdunit);
|
---|
1555 | writeln(cmdunit, "\r\n sec/trk ");
|
---|
1556 | putn((uint32_t)bpp->dspt, 5, cmdunit);
|
---|
1557 | writeln(cmdunit, "\r\n hidden ");
|
---|
1558 | putn((uint32_t)bpp->hidden, 4, cmdunit);
|
---|
1559 | writeln(cmdunit, "\r\n\n");
|
---|
1560 | return(TRUE);
|
---|
1561 | }
|
---|
1562 | }
|
---|
1563 |
|
---|
1564 | /* |
---|
1565 |
|
---|
1566 | */
|
---|
1567 |
|
---|
1568 | /*
|
---|
1569 | ============================================================================
|
---|
1570 | cx_go -- execute the go command
|
---|
1571 | ============================================================================
|
---|
1572 | */
|
---|
1573 |
|
---|
1574 | int16_t cx_go(void)
|
---|
1575 | {
|
---|
1576 | redo = FALSE;
|
---|
1577 | exflag = TRUE;
|
---|
1578 | wzcrsh = FALSE;
|
---|
1579 |
|
---|
1580 | if (goflag)
|
---|
1581 | regptr->reg_pc = p_goto;
|
---|
1582 |
|
---|
1583 | if (b0flag ) {
|
---|
1584 |
|
---|
1585 | if (p_ba0) {
|
---|
1586 |
|
---|
1587 | if (*p_ba0 NE (uint16_t)BPINST) {
|
---|
1588 |
|
---|
1589 | writeln(cmdunit, "\r\n\n** Breakpoint 0 at ");
|
---|
1590 | puthn((uint32_t)p_ba0, 8, cmdunit);
|
---|
1591 | writeln(cmdunit, " was ");
|
---|
1592 | puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
|
---|
1593 | writeln(cmdunit, " instead of ");
|
---|
1594 | puthn(0xFFFFL & (uint32_t)BPINST, 4, cmdunit);
|
---|
1595 | writeln(cmdunit, " **\r\n\n");
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 | *p_ba0 = p_bv0;
|
---|
1599 | }
|
---|
1600 |
|
---|
1601 | p_ba0 = tba0;
|
---|
1602 | p_bv0 = *p_ba0;
|
---|
1603 | *p_ba0 = (uint16_t)BPINST;
|
---|
1604 | }
|
---|
1605 |
|
---|
1606 | /* |
---|
1607 |
|
---|
1608 | */
|
---|
1609 |
|
---|
1610 | if (b1flag ) {
|
---|
1611 |
|
---|
1612 | if (p_ba1) {
|
---|
1613 |
|
---|
1614 | if (*p_ba1 NE (uint16_t)BPINST) {
|
---|
1615 |
|
---|
1616 | writeln(cmdunit, "\r\n\n** Breakpoint 1 at ");
|
---|
1617 | puthn((uint32_t)p_ba1, 8, cmdunit);
|
---|
1618 | writeln(cmdunit, " was ");
|
---|
1619 | puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
|
---|
1620 | writeln(cmdunit, " instead of ");
|
---|
1621 | puthn(0xFFFFL & (uint32_t)BPINST, 4, cmdunit);
|
---|
1622 | writeln(cmdunit, " **\r\n\n");
|
---|
1623 | }
|
---|
1624 |
|
---|
1625 | *p_ba1 = p_bv1;
|
---|
1626 | }
|
---|
1627 |
|
---|
1628 | p_ba1 = tba1;
|
---|
1629 | p_bv1 = *p_ba1;
|
---|
1630 | *p_ba1 = (uint16_t)BPINST;
|
---|
1631 | }
|
---|
1632 |
|
---|
1633 | return(TRUE);
|
---|
1634 | }
|
---|
1635 |
|
---|
1636 | /* |
---|
1637 |
|
---|
1638 | */
|
---|
1639 |
|
---|
1640 | /*
|
---|
1641 | ============================================================================
|
---|
1642 | cp_dump -- parse dump parameters
|
---|
1643 | ============================================================================
|
---|
1644 | */
|
---|
1645 |
|
---|
1646 | int16_t cp_dump(void)
|
---|
1647 | {
|
---|
1648 | inext = ilast;
|
---|
1649 |
|
---|
1650 | if (getarg())
|
---|
1651 | if (setvar(&p_from, p_from) EQ FALSE) {
|
---|
1652 |
|
---|
1653 | redo = FALSE;
|
---|
1654 | return(FALSE);
|
---|
1655 | }
|
---|
1656 |
|
---|
1657 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
1658 |
|
---|
1659 | p_to = p_from;
|
---|
1660 | p_width = 16L;
|
---|
1661 | redo = TRUE;
|
---|
1662 | return(TRUE);
|
---|
1663 | }
|
---|
1664 |
|
---|
1665 | if (getarg())
|
---|
1666 | if (setvar(&p_to, p_to) EQ FALSE) {
|
---|
1667 |
|
---|
1668 | redo = FALSE;
|
---|
1669 | return(FALSE);
|
---|
1670 | }
|
---|
1671 |
|
---|
1672 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
1673 |
|
---|
1674 | p_width = 16L;
|
---|
1675 | redo = TRUE;
|
---|
1676 | return(TRUE);
|
---|
1677 | }
|
---|
1678 |
|
---|
1679 | if (getarg())
|
---|
1680 | if (setvar(&p_width, p_width) EQ FALSE) {
|
---|
1681 |
|
---|
1682 | redo = FALSE;
|
---|
1683 | return(FALSE);
|
---|
1684 | }
|
---|
1685 |
|
---|
1686 | if ((p_width LE 0L) OR (p_width GT 16L)) {
|
---|
1687 |
|
---|
1688 | p_width = 16L;
|
---|
1689 | redo = FALSE;
|
---|
1690 | return(FALSE);
|
---|
1691 | }
|
---|
1692 |
|
---|
1693 | redo = TRUE;
|
---|
1694 | return(TRUE);
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | /* |
---|
1698 |
|
---|
1699 | */
|
---|
1700 |
|
---|
1701 | /*
|
---|
1702 | ============================================================================
|
---|
1703 | cp_fill -- parse parameters for fill command
|
---|
1704 | ============================================================================
|
---|
1705 | */
|
---|
1706 |
|
---|
1707 | int16_t cp_fill(void)
|
---|
1708 | {
|
---|
1709 | redo = FALSE;
|
---|
1710 |
|
---|
1711 | if (getarg())
|
---|
1712 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1713 | return(FALSE);
|
---|
1714 |
|
---|
1715 | if (getarg())
|
---|
1716 | if (setvar(&p_len, p_len) EQ FALSE)
|
---|
1717 | return(FALSE);
|
---|
1718 |
|
---|
1719 | if (getarg())
|
---|
1720 | if (setvar(&p_value, p_value) EQ FALSE)
|
---|
1721 | return(FALSE);
|
---|
1722 |
|
---|
1723 | if (p_value & ~0xFFL)
|
---|
1724 | return(FALSE);
|
---|
1725 |
|
---|
1726 | return(TRUE);
|
---|
1727 | }
|
---|
1728 |
|
---|
1729 | /* |
---|
1730 |
|
---|
1731 | */
|
---|
1732 |
|
---|
1733 | /*
|
---|
1734 | ============================================================================
|
---|
1735 | cp_wfil -- parse parameters for wfill command
|
---|
1736 | ============================================================================
|
---|
1737 | */
|
---|
1738 |
|
---|
1739 | int16_t cp_wfil(void)
|
---|
1740 | {
|
---|
1741 | redo = FALSE;
|
---|
1742 |
|
---|
1743 | if (getarg())
|
---|
1744 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1745 | return(FALSE);
|
---|
1746 |
|
---|
1747 | if (getarg())
|
---|
1748 | if (setvar(&p_len, p_len) EQ FALSE)
|
---|
1749 | return(FALSE);
|
---|
1750 |
|
---|
1751 | if (getarg())
|
---|
1752 | if (setvar(&p_value, p_value) EQ FALSE)
|
---|
1753 | return(FALSE);
|
---|
1754 |
|
---|
1755 | if ((int32_t)p_from & 1L)
|
---|
1756 | return(FALSE);
|
---|
1757 |
|
---|
1758 | if (p_value & ~0xFFFFL)
|
---|
1759 | return(FALSE);
|
---|
1760 |
|
---|
1761 | return(TRUE);
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | /* |
---|
1765 |
|
---|
1766 | */
|
---|
1767 |
|
---|
1768 | /*
|
---|
1769 | ============================================================================
|
---|
1770 | cp_copy -- parse parameters for copy command
|
---|
1771 | ============================================================================
|
---|
1772 | */
|
---|
1773 |
|
---|
1774 | int16_t cp_copy(void)
|
---|
1775 | {
|
---|
1776 | redo = FALSE;
|
---|
1777 |
|
---|
1778 | if (getarg())
|
---|
1779 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1780 | return(FALSE);
|
---|
1781 |
|
---|
1782 | if (getarg())
|
---|
1783 | if (setvar(&p_to, p_to) EQ FALSE)
|
---|
1784 | return(FALSE);
|
---|
1785 |
|
---|
1786 | if (getarg())
|
---|
1787 | if (setvar(&p_len, p_len) EQ FALSE)
|
---|
1788 | return(FALSE);
|
---|
1789 |
|
---|
1790 | return(TRUE);
|
---|
1791 | }
|
---|
1792 | /* |
---|
1793 |
|
---|
1794 | */
|
---|
1795 |
|
---|
1796 | /*
|
---|
1797 | ============================================================================
|
---|
1798 | cp_chek -- parse parameters for chek command
|
---|
1799 | ============================================================================
|
---|
1800 | */
|
---|
1801 |
|
---|
1802 | int16_t cp_chek(void)
|
---|
1803 | {
|
---|
1804 | redo = FALSE;
|
---|
1805 |
|
---|
1806 | if (getarg())
|
---|
1807 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1808 | return(FALSE);
|
---|
1809 |
|
---|
1810 | if (getarg())
|
---|
1811 | if (setvar(&p_to, p_to) EQ FALSE)
|
---|
1812 | return(FALSE);
|
---|
1813 |
|
---|
1814 | return(TRUE);
|
---|
1815 | }
|
---|
1816 |
|
---|
1817 | /* |
---|
1818 |
|
---|
1819 | */
|
---|
1820 |
|
---|
1821 | /*
|
---|
1822 | ============================================================================
|
---|
1823 | cp_read -- parse parameters for read command
|
---|
1824 | ============================================================================
|
---|
1825 | */
|
---|
1826 |
|
---|
1827 | int16_t cp_read(void)
|
---|
1828 | {
|
---|
1829 | redo = FALSE;
|
---|
1830 |
|
---|
1831 | if (getarg())
|
---|
1832 | if (setvar(&p_from, p_from) EQ FALSE)
|
---|
1833 | return(FALSE);
|
---|
1834 |
|
---|
1835 | if (getarg())
|
---|
1836 | if (setvar(&p_to, p_to) EQ FALSE)
|
---|
1837 | return(FALSE);
|
---|
1838 |
|
---|
1839 | if (getarg())
|
---|
1840 | if (setvar(&p_len, p_len) EQ FALSE)
|
---|
1841 | return(FALSE);
|
---|
1842 |
|
---|
1843 | if ((~0x7FFFL) & p_len)
|
---|
1844 | return(FALSE);
|
---|
1845 |
|
---|
1846 | if ((~0xFFFFL) & (int32_t)p_from)
|
---|
1847 | return(FALSE);
|
---|
1848 |
|
---|
1849 | return(TRUE);
|
---|
1850 | }
|
---|
1851 |
|
---|
1852 | /*
|
---|
1853 | ============================================================================
|
---|
1854 | cp_null -- parse null parameter line
|
---|
1855 | ============================================================================
|
---|
1856 | */
|
---|
1857 |
|
---|
1858 | int16_t cp_null(void)
|
---|
1859 | {
|
---|
1860 | return(TRUE);
|
---|
1861 | }
|
---|
1862 |
|
---|
1863 | /* |
---|
1864 |
|
---|
1865 | */
|
---|
1866 |
|
---|
1867 | /*
|
---|
1868 | ============================================================================
|
---|
1869 | cp_rset -- parse rset command parameters
|
---|
1870 | ============================================================================
|
---|
1871 | */
|
---|
1872 |
|
---|
1873 | int16_t cp_rset(void)
|
---|
1874 | {
|
---|
1875 | int16_t rc;
|
---|
1876 |
|
---|
1877 | rc = 0;
|
---|
1878 | redo = FALSE;
|
---|
1879 |
|
---|
1880 | if (0 EQ getarg())
|
---|
1881 | return(FALSE);
|
---|
1882 |
|
---|
1883 | str2lc(argstr);
|
---|
1884 |
|
---|
1885 | if (0 EQ (rc = strlcmp(argstr, rlist)))
|
---|
1886 | return(FALSE);
|
---|
1887 |
|
---|
1888 | if (0 EQ getarg())
|
---|
1889 | return(FALSE);
|
---|
1890 |
|
---|
1891 | if (FALSE EQ setvar(&p_value, 0L))
|
---|
1892 | return(FALSE);
|
---|
1893 |
|
---|
1894 | rnum = rc;
|
---|
1895 | return(TRUE);
|
---|
1896 | }
|
---|
1897 |
|
---|
1898 | /* |
---|
1899 |
|
---|
1900 | */
|
---|
1901 | /*
|
---|
1902 | ============================================================================
|
---|
1903 | cx_chek -- process chek command
|
---|
1904 | ============================================================================
|
---|
1905 | */
|
---|
1906 |
|
---|
1907 | int16_t cx_chek(void)
|
---|
1908 | {
|
---|
1909 | register int32_t csum;
|
---|
1910 | register int8_t *cp;
|
---|
1911 |
|
---|
1912 | redo = FALSE;
|
---|
1913 | csum = 0L;
|
---|
1914 |
|
---|
1915 | for (cp = p_from; cp LE p_to; cp++)
|
---|
1916 | csum += 0x000000FFL & *cp;
|
---|
1917 |
|
---|
1918 | printf("Checksum = 0x%08lX\r\n", csum);
|
---|
1919 |
|
---|
1920 | return(TRUE);
|
---|
1921 | }
|
---|
1922 |
|
---|
1923 | /* |
---|
1924 |
|
---|
1925 | */
|
---|
1926 |
|
---|
1927 | /*
|
---|
1928 | ============================================================================
|
---|
1929 | cx_rset -- process rset command
|
---|
1930 | ============================================================================
|
---|
1931 | */
|
---|
1932 |
|
---|
1933 | int16_t cx_rset(void)
|
---|
1934 | {
|
---|
1935 | redo = FALSE;
|
---|
1936 |
|
---|
1937 | if (rnum < 1)
|
---|
1938 | return(FALSE);
|
---|
1939 |
|
---|
1940 | if (rnum < 9) { /* d0..d7 -- data register */
|
---|
1941 |
|
---|
1942 | regptr->d_reg[rnum-1] = p_value;
|
---|
1943 | return(TRUE);
|
---|
1944 | }
|
---|
1945 |
|
---|
1946 | if (rnum < 17) { /* a0..a7 -- address register */
|
---|
1947 |
|
---|
1948 | regptr->a_reg[rnum-9] = p_value;
|
---|
1949 | return(TRUE);
|
---|
1950 | }
|
---|
1951 |
|
---|
1952 | /* |
---|
1953 |
|
---|
1954 | */
|
---|
1955 |
|
---|
1956 | if (rnum EQ 17) { /* sr -- status register */
|
---|
1957 |
|
---|
1958 | if ((~0xFFFFL) & p_value)
|
---|
1959 | return(FALSE);
|
---|
1960 |
|
---|
1961 | regptr->reg_sr = (uint16_t)p_value;
|
---|
1962 | return(TRUE);
|
---|
1963 | }
|
---|
1964 |
|
---|
1965 | if (rnum EQ 18) { /* pc -- program counter */
|
---|
1966 |
|
---|
1967 | if (1L & p_value)
|
---|
1968 | return(FALSE);
|
---|
1969 |
|
---|
1970 | regptr->reg_pc = p_value;
|
---|
1971 | return(TRUE);
|
---|
1972 | }
|
---|
1973 |
|
---|
1974 | if (rnum EQ 19) { /* sp -- stack pointer */
|
---|
1975 |
|
---|
1976 | if (1L & p_value)
|
---|
1977 | return(FALSE);
|
---|
1978 |
|
---|
1979 | regptr->a_reg[7] = p_value;
|
---|
1980 | return(TRUE);
|
---|
1981 | }
|
---|
1982 |
|
---|
1983 | return(FALSE);
|
---|
1984 | }
|
---|
1985 |
|
---|
1986 | /* |
---|
1987 |
|
---|
1988 | */
|
---|
1989 |
|
---|
1990 | /*
|
---|
1991 | ============================================================================
|
---|
1992 | cp_vrst -- parse vrset command parameters
|
---|
1993 | ============================================================================
|
---|
1994 | */
|
---|
1995 |
|
---|
1996 | int16_t cp_vrst(void)
|
---|
1997 | {
|
---|
1998 | int16_t rc;
|
---|
1999 |
|
---|
2000 | rc = 0;
|
---|
2001 | redo = FALSE;
|
---|
2002 |
|
---|
2003 | if (0 EQ getarg())
|
---|
2004 | return(FALSE);
|
---|
2005 |
|
---|
2006 | str2lc(argstr);
|
---|
2007 |
|
---|
2008 | if (0 EQ (rc = strlcmp(argstr, vrlist)))
|
---|
2009 | return(FALSE);
|
---|
2010 |
|
---|
2011 | if (0 EQ getarg())
|
---|
2012 | return(FALSE);
|
---|
2013 |
|
---|
2014 | if (FALSE EQ setvar(&p_value, 0L))
|
---|
2015 | return(FALSE);
|
---|
2016 |
|
---|
2017 | if (vrnum < 17) { /* complete register */
|
---|
2018 |
|
---|
2019 | vrnum = rc;
|
---|
2020 | return(TRUE);
|
---|
2021 | }
|
---|
2022 |
|
---|
2023 | if (vrnum < 21) { /* horizontal register */
|
---|
2024 |
|
---|
2025 | if (p_value & ~0x003F)
|
---|
2026 | return(FALSE);
|
---|
2027 |
|
---|
2028 | vrnum = rc;
|
---|
2029 | return(TRUE);
|
---|
2030 | }
|
---|
2031 |
|
---|
2032 | if (vrnum < 25) { /* vertical register */
|
---|
2033 |
|
---|
2034 | if (p_value & ~0x03FF)
|
---|
2035 | return(FALSE);
|
---|
2036 |
|
---|
2037 | vrnum = rc;
|
---|
2038 | return(TRUE);
|
---|
2039 | }
|
---|
2040 |
|
---|
2041 | return(FALSE);
|
---|
2042 | }
|
---|
2043 |
|
---|
2044 | /* |
---|
2045 |
|
---|
2046 | */
|
---|
2047 |
|
---|
2048 | /*
|
---|
2049 | ============================================================================
|
---|
2050 | cx_vrst -- process vrset command
|
---|
2051 | ============================================================================
|
---|
2052 | */
|
---|
2053 |
|
---|
2054 | int16_t cx_vrst(void)
|
---|
2055 | {
|
---|
2056 | redo = FALSE;
|
---|
2057 |
|
---|
2058 | if (vrnum < 1)
|
---|
2059 | return(FALSE);
|
---|
2060 |
|
---|
2061 | if (vrnum < 17) { /* 1..16 -- r0..r15 -- complete register */
|
---|
2062 |
|
---|
2063 | v_regs[vrnum-1] = p_value;
|
---|
2064 | return(TRUE);
|
---|
2065 | }
|
---|
2066 |
|
---|
2067 | if (vrnum < 21) { /* 17..20 -- h0..h3 -- horizontal register */
|
---|
2068 |
|
---|
2069 | v_regs[vrnum-5] = (v_regs[vrnum-5] & 0x03FF) |
|
---|
2070 | ((p_value << 10) & 0xFC00);
|
---|
2071 | return(TRUE);
|
---|
2072 | }
|
---|
2073 |
|
---|
2074 | if (vrnum < 25) { /* 21..24 -- v0..v3 -- vertical register */
|
---|
2075 |
|
---|
2076 | v_regs[vrnum-9] = (v_regs[vrnum-9] & 0xFC00) | p_value;
|
---|
2077 | return(TRUE);
|
---|
2078 | }
|
---|
2079 |
|
---|
2080 | return(FALSE);
|
---|
2081 | }
|
---|
2082 |
|
---|
2083 | /* |
---|
2084 |
|
---|
2085 | */
|
---|
2086 |
|
---|
2087 | /*
|
---|
2088 | ============================================================================
|
---|
2089 | cx_vreg -- process vregs command
|
---|
2090 | ============================================================================
|
---|
2091 | */
|
---|
2092 |
|
---|
2093 | int16_t cx_vreg(void)
|
---|
2094 | {
|
---|
2095 | register int16_t i, j, k, l;
|
---|
2096 | register uint16_t *rp;
|
---|
2097 |
|
---|
2098 | rp = &v_regs[0];
|
---|
2099 | l = 0;
|
---|
2100 |
|
---|
2101 | for (i = 0; i < 2; i++) {
|
---|
2102 |
|
---|
2103 | for (j = 0; j < 2; j++) {
|
---|
2104 |
|
---|
2105 | for (k = 0; k < 4; k++) {
|
---|
2106 |
|
---|
2107 | writeln(cmdunit, " ");
|
---|
2108 | putn((uint32_t)l++, 2, cmdunit);
|
---|
2109 | writeln(cmdunit, ":");
|
---|
2110 | puthn((uint32_t)*rp++, 4, cmdunit);
|
---|
2111 | }
|
---|
2112 |
|
---|
2113 | writeln(cmdunit, " ");
|
---|
2114 | }
|
---|
2115 |
|
---|
2116 | writeln(cmdunit, "\r\n");
|
---|
2117 | }
|
---|
2118 |
|
---|
2119 | return(TRUE);
|
---|
2120 | }
|
---|
2121 |
|
---|
2122 | /* |
---|
2123 |
|
---|
2124 | */
|
---|
2125 |
|
---|
2126 | /*
|
---|
2127 | ============================================================================
|
---|
2128 | do_srec -- load a Motorola S record
|
---|
2129 | ============================================================================
|
---|
2130 | */
|
---|
2131 |
|
---|
2132 | int16_t do_srec(int8_t *line)
|
---|
2133 | {
|
---|
2134 | register int8_t *ldadr;
|
---|
2135 | register int16_t c, csum, i, len;
|
---|
2136 | register uint16_t val;
|
---|
2137 |
|
---|
2138 | if ('S' NE (c = *line++))
|
---|
2139 | return(-1); /* error 1 = missing initial S */
|
---|
2140 |
|
---|
2141 | switch (c = *line++) {
|
---|
2142 |
|
---|
2143 | case '2':
|
---|
2144 |
|
---|
2145 | csum = 0;
|
---|
2146 |
|
---|
2147 | if (isxdigit(c = *line++))
|
---|
2148 | len = xdtoi(c);
|
---|
2149 | else
|
---|
2150 | return(-2); /* error 2 = bad length byte */
|
---|
2151 |
|
---|
2152 | if (isxdigit(c = *line++))
|
---|
2153 | len = (len << 4) + xdtoi(c);
|
---|
2154 | else
|
---|
2155 | return(-2);
|
---|
2156 |
|
---|
2157 | csum += (len & 0xFF);
|
---|
2158 | ldadr = (int8_t *)0;
|
---|
2159 | len -= 4;
|
---|
2160 |
|
---|
2161 | for (i = 0; i < 3; i++) {
|
---|
2162 |
|
---|
2163 | if (isxdigit(c = *line++))
|
---|
2164 | val = xdtoi(c);
|
---|
2165 | else
|
---|
2166 | return(-3); /* error 3 = bad address byte */
|
---|
2167 |
|
---|
2168 | if (isxdigit(c = *line++))
|
---|
2169 | val = (val << 4) + xdtoi(c);
|
---|
2170 | else
|
---|
2171 | return(-3);
|
---|
2172 |
|
---|
2173 | ldadr = (int8_t *)(((int32_t)ldadr << 8) + (int32_t)val);
|
---|
2174 | csum += (val & 0xFF);
|
---|
2175 | }
|
---|
2176 |
|
---|
2177 | for (i = 0; i < len; i++) {
|
---|
2178 |
|
---|
2179 | if (isxdigit(c = *line++))
|
---|
2180 | val = xdtoi(c);
|
---|
2181 | else
|
---|
2182 | return(-4); /* error 4 = bad data byte */
|
---|
2183 |
|
---|
2184 | if (isxdigit(c = *line++))
|
---|
2185 | val = (val << 4) + xdtoi(c);
|
---|
2186 | else
|
---|
2187 | return(-4);
|
---|
2188 |
|
---|
2189 | csum += (val & 0xFF);
|
---|
2190 | *ldadr = val & 0xFF;
|
---|
2191 |
|
---|
2192 | if ((*ldadr & 0xFF) NE (val & 0xFF))
|
---|
2193 | return(-5); /* error 5 = store failed */
|
---|
2194 |
|
---|
2195 | ldadr++;
|
---|
2196 | }
|
---|
2197 |
|
---|
2198 | csum = 0xFF & ~csum;
|
---|
2199 |
|
---|
2200 | if (isxdigit(c = *line++))
|
---|
2201 | val = xdtoi(c);
|
---|
2202 | else
|
---|
2203 | return(-6); /* error 6 = bad checksum byte */
|
---|
2204 |
|
---|
2205 | if (isxdigit(c = *line++))
|
---|
2206 | val = (val << 4) + xdtoi(c);
|
---|
2207 | else
|
---|
2208 | return(-6);
|
---|
2209 |
|
---|
2210 | if (csum NE (val & 0xFF))
|
---|
2211 | return(-7); /* error 7 = bad checksum */
|
---|
2212 |
|
---|
2213 | return(1);
|
---|
2214 |
|
---|
2215 | case '9':
|
---|
2216 |
|
---|
2217 | if (memcmpu(line, SREC9, 10) EQ 0)
|
---|
2218 | return(0);
|
---|
2219 | else
|
---|
2220 | return(-8); /* error 8 = bad end record */
|
---|
2221 |
|
---|
2222 | default:
|
---|
2223 |
|
---|
2224 | return(-9); /* error 9 = unknown s type */
|
---|
2225 | }
|
---|
2226 |
|
---|
2227 | return(-10); /* error 10 = switch failed */
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 | /* |
---|
2231 |
|
---|
2232 | */
|
---|
2233 |
|
---|
2234 | /*
|
---|
2235 | ============================================================================
|
---|
2236 | cx_load -- process load command
|
---|
2237 | ============================================================================
|
---|
2238 | */
|
---|
2239 |
|
---|
2240 | int16_t cx_load(void)
|
---|
2241 | {
|
---|
2242 | register int16_t rc;
|
---|
2243 |
|
---|
2244 | do {
|
---|
2245 |
|
---|
2246 | rc = getrln(cmdunit, MAXCMDLN, cmdline);
|
---|
2247 |
|
---|
2248 | switch (rc) {
|
---|
2249 |
|
---|
2250 | case A_CR:
|
---|
2251 |
|
---|
2252 | rc = do_srec(cmdline);
|
---|
2253 |
|
---|
2254 | if (rc LT 0) {
|
---|
2255 |
|
---|
2256 | rc = -rc;
|
---|
2257 | writeln(cmdunit, NACK);
|
---|
2258 | writeln(cmdunit, "** Load error ");
|
---|
2259 | putn((uint32_t)rc, 3, cmdunit);
|
---|
2260 | writeln(cmdunit, " **\r\n\n");
|
---|
2261 | return(FALSE);
|
---|
2262 |
|
---|
2263 | } else {
|
---|
2264 |
|
---|
2265 | writeln(cmdunit, TACK);
|
---|
2266 | }
|
---|
2267 |
|
---|
2268 | continue;
|
---|
2269 |
|
---|
2270 | case CTL('X'):
|
---|
2271 |
|
---|
2272 | rc = 1;
|
---|
2273 | writeln(cmdunit, TACK);
|
---|
2274 | continue;
|
---|
2275 |
|
---|
2276 | /* |
---|
2277 |
|
---|
2278 | */
|
---|
2279 |
|
---|
2280 | default:
|
---|
2281 |
|
---|
2282 | writeln(cmdunit, NACK);
|
---|
2283 | writeln(cmdunit, "** Load aborted on ");
|
---|
2284 | puthn((uint32_t)rc, 2, cmdunit);
|
---|
2285 | writeln(cmdunit, " **\r\n\n");
|
---|
2286 | return(FALSE);
|
---|
2287 | }
|
---|
2288 |
|
---|
2289 | } while (rc);
|
---|
2290 |
|
---|
2291 | return(TRUE);
|
---|
2292 | }
|
---|
2293 |
|
---|
2294 | /* |
---|
2295 |
|
---|
2296 | */
|
---|
2297 |
|
---|
2298 | /*
|
---|
2299 | ============================================================================
|
---|
2300 | cx_fill -- execute the fill command
|
---|
2301 | ============================================================================
|
---|
2302 | */
|
---|
2303 |
|
---|
2304 | int16_t cx_fill(void)
|
---|
2305 | {
|
---|
2306 | register int8_t *cp = p_from;
|
---|
2307 | register int32_t count;
|
---|
2308 |
|
---|
2309 | redo = FALSE;
|
---|
2310 |
|
---|
2311 | for (count = p_len; count > 0L; count--) {
|
---|
2312 |
|
---|
2313 | *cp = (int8_t)(0xFFL & p_value);
|
---|
2314 |
|
---|
2315 | if (*cp NE (int8_t)(0xFFL & p_value)) {
|
---|
2316 |
|
---|
2317 | writeln(cmdunit, "\r\n** FILL failed at ");
|
---|
2318 | puthn((uint32_t)cp, 8, cmdunit);
|
---|
2319 | writeln(cmdunit, " **\r\n");
|
---|
2320 | return(FALSE);
|
---|
2321 | }
|
---|
2322 |
|
---|
2323 | ++cp;
|
---|
2324 | }
|
---|
2325 |
|
---|
2326 | return(TRUE);
|
---|
2327 | }
|
---|
2328 |
|
---|
2329 | /* |
---|
2330 |
|
---|
2331 | */
|
---|
2332 |
|
---|
2333 | /*
|
---|
2334 | ============================================================================
|
---|
2335 | cx_wfill -- execute the wfill command
|
---|
2336 | ============================================================================
|
---|
2337 | */
|
---|
2338 |
|
---|
2339 | int16_t cx_wfil(void)
|
---|
2340 | {
|
---|
2341 | register uint16_t *cp = (uint16_t *)p_from;
|
---|
2342 | register int32_t count;
|
---|
2343 |
|
---|
2344 | redo = FALSE;
|
---|
2345 |
|
---|
2346 | for (count = p_len; count > 0L; count--)
|
---|
2347 | *cp++ = (uint16_t)(0xFFFFL & p_value);
|
---|
2348 |
|
---|
2349 | return(TRUE);
|
---|
2350 | }
|
---|
2351 |
|
---|
2352 | /* |
---|
2353 |
|
---|
2354 | */
|
---|
2355 |
|
---|
2356 | /*
|
---|
2357 | ============================================================================
|
---|
2358 | cx_copy -- execute the copy command
|
---|
2359 | ============================================================================
|
---|
2360 | */
|
---|
2361 |
|
---|
2362 | int16_t cx_copy(void)
|
---|
2363 | {
|
---|
2364 | register int8_t *from = p_from,
|
---|
2365 | *to = p_to;
|
---|
2366 | register int32_t count = p_len;
|
---|
2367 |
|
---|
2368 | redo = FALSE;
|
---|
2369 |
|
---|
2370 | if (to GT from) {
|
---|
2371 |
|
---|
2372 | from = from + count;
|
---|
2373 | to = to + count;
|
---|
2374 |
|
---|
2375 | while (count--) {
|
---|
2376 |
|
---|
2377 | --from;
|
---|
2378 | --to;
|
---|
2379 | *to = *from;
|
---|
2380 |
|
---|
2381 | if (*from NE *to) {
|
---|
2382 |
|
---|
2383 | writeln(cmdunit, "\r\n** COPY failed from ");
|
---|
2384 | puthn((uint32_t)from, 8, cmdunit);
|
---|
2385 | writeln(cmdunit, " to ");
|
---|
2386 | puthn((uint32_t)to, 8, cmdunit);
|
---|
2387 | writeln(cmdunit, " with (from) = ");
|
---|
2388 | puthn((uint32_t)(*from), 2, cmdunit);
|
---|
2389 | writeln(cmdunit, " and (to) = ");
|
---|
2390 | puthn((uint32_t)(*to), 2, cmdunit);
|
---|
2391 | writeln(cmdunit, " **\r\n");
|
---|
2392 | return(FALSE);
|
---|
2393 | }
|
---|
2394 | }
|
---|
2395 |
|
---|
2396 | /* |
---|
2397 |
|
---|
2398 | */
|
---|
2399 |
|
---|
2400 | } else {
|
---|
2401 |
|
---|
2402 | while (count--) {
|
---|
2403 |
|
---|
2404 | *to = *from;
|
---|
2405 |
|
---|
2406 | if (*from NE *to) {
|
---|
2407 |
|
---|
2408 | writeln(cmdunit, "\r\n** COPY failed from ");
|
---|
2409 | puthn((uint32_t)from, 8, cmdunit);
|
---|
2410 | writeln(cmdunit, " to ");
|
---|
2411 | puthn((uint32_t)to, 8, cmdunit);
|
---|
2412 | writeln(cmdunit, " with (from) = ");
|
---|
2413 | puthn((uint32_t)(*from), 2, cmdunit);
|
---|
2414 | writeln(cmdunit, " and (to) = ");
|
---|
2415 | puthn((uint32_t)(*to), 2, cmdunit);
|
---|
2416 | writeln(cmdunit, " **\r\n");
|
---|
2417 | return(FALSE);
|
---|
2418 | }
|
---|
2419 |
|
---|
2420 | ++from;
|
---|
2421 | ++to;
|
---|
2422 | }
|
---|
2423 | }
|
---|
2424 |
|
---|
2425 | return(TRUE);
|
---|
2426 | }
|
---|
2427 |
|
---|
2428 | /* |
---|
2429 |
|
---|
2430 | */
|
---|
2431 |
|
---|
2432 | /*
|
---|
2433 | ============================================================================
|
---|
2434 | cx_dump -- execute the dump command
|
---|
2435 | ============================================================================
|
---|
2436 | */
|
---|
2437 |
|
---|
2438 | int16_t cx_dump(void)
|
---|
2439 | {
|
---|
2440 | register int16_t nw, rc;
|
---|
2441 |
|
---|
2442 | redo= TRUE;
|
---|
2443 | d_cur = p_from;
|
---|
2444 | d_next = p_to + 1;
|
---|
2445 | d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
|
---|
2446 | nw = p_width;
|
---|
2447 | rc = TRUE;
|
---|
2448 |
|
---|
2449 | do {
|
---|
2450 |
|
---|
2451 | writeln(cmdunit, CRLF);
|
---|
2452 | padr(p_from, cmdunit);
|
---|
2453 |
|
---|
2454 | dflag = FALSE;
|
---|
2455 |
|
---|
2456 | if (ddump(p_from, p_to, nw, cmdunit))
|
---|
2457 | rc = FALSE;
|
---|
2458 |
|
---|
2459 | if (rc)
|
---|
2460 | if (dtext(p_from, p_to, nw, cmdunit))
|
---|
2461 | rc = FALSE;
|
---|
2462 |
|
---|
2463 | p_from = p_from + p_width;
|
---|
2464 |
|
---|
2465 | if (dflag)
|
---|
2466 | rc = FALSE;
|
---|
2467 |
|
---|
2468 | } while (rc);
|
---|
2469 |
|
---|
2470 | p_from = d_cur;
|
---|
2471 |
|
---|
2472 | writeln(cmdunit, CRLF);
|
---|
2473 | writeln(cmdunit, CRLF);
|
---|
2474 |
|
---|
2475 | return(TRUE);
|
---|
2476 | }
|
---|
2477 |
|
---|
2478 | /* |
---|
2479 |
|
---|
2480 | */
|
---|
2481 |
|
---|
2482 | /*
|
---|
2483 | ============================================================================
|
---|
2484 | wdump -- dump words in hex (no ASCII)
|
---|
2485 | ============================================================================
|
---|
2486 | */
|
---|
2487 |
|
---|
2488 | int16_t wdump(uint16_t *loc, uint16_t *lastloc, int16_t nwide, int16_t unit)
|
---|
2489 | {
|
---|
2490 | while (nwide--) {
|
---|
2491 |
|
---|
2492 | puthn((uint32_t)(0xFFFFL & *loc), 4, unit);
|
---|
2493 | BIOS(B_PUTC,unit, ' ');
|
---|
2494 |
|
---|
2495 | if (BIOS(B_RDAV, unit))
|
---|
2496 | return(TRUE);
|
---|
2497 |
|
---|
2498 | if (loc EQ lastloc) {
|
---|
2499 |
|
---|
2500 | dflag = TRUE;
|
---|
2501 | return(FALSE);
|
---|
2502 | }
|
---|
2503 |
|
---|
2504 | ++loc;
|
---|
2505 | }
|
---|
2506 |
|
---|
2507 | return(FALSE);
|
---|
2508 | }
|
---|
2509 |
|
---|
2510 | /* |
---|
2511 |
|
---|
2512 | */
|
---|
2513 |
|
---|
2514 | /*
|
---|
2515 | ============================================================================
|
---|
2516 | ldump -- dump longs in hex (no ASCII)
|
---|
2517 | ============================================================================
|
---|
2518 | */
|
---|
2519 |
|
---|
2520 | int16_t ldump(int32_t *loc, int32_t *lastloc, int16_t nwide, int16_t unit)
|
---|
2521 | {
|
---|
2522 | while (nwide--) {
|
---|
2523 |
|
---|
2524 | puthn((uint32_t)*loc, 8, unit);
|
---|
2525 | BIOS(B_PUTC,unit, ' ');
|
---|
2526 |
|
---|
2527 | if (BIOS(B_RDAV, unit))
|
---|
2528 | return(TRUE);
|
---|
2529 |
|
---|
2530 | if (loc EQ lastloc) {
|
---|
2531 |
|
---|
2532 | dflag = TRUE;
|
---|
2533 | return(FALSE);
|
---|
2534 | }
|
---|
2535 |
|
---|
2536 | ++loc;
|
---|
2537 | }
|
---|
2538 |
|
---|
2539 | return(FALSE);
|
---|
2540 | }
|
---|
2541 |
|
---|
2542 | /* |
---|
2543 |
|
---|
2544 | */
|
---|
2545 |
|
---|
2546 | /*
|
---|
2547 | ============================================================================
|
---|
2548 | cp_wdmp -- process parameters for wdump command
|
---|
2549 | ============================================================================
|
---|
2550 | */
|
---|
2551 |
|
---|
2552 | int16_t cp_wdmp(void)
|
---|
2553 | {
|
---|
2554 | inext = ilast;
|
---|
2555 |
|
---|
2556 | if (getarg())
|
---|
2557 | if (setvar(&p_from, p_from) EQ FALSE) {
|
---|
2558 |
|
---|
2559 | redo = FALSE;
|
---|
2560 | return(FALSE);
|
---|
2561 | }
|
---|
2562 |
|
---|
2563 | if ((int32_t)p_from & 1L) {
|
---|
2564 |
|
---|
2565 | redo = FALSE;
|
---|
2566 | return(FALSE);
|
---|
2567 | }
|
---|
2568 |
|
---|
2569 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
2570 |
|
---|
2571 | p_to = p_from;
|
---|
2572 | p_width = 8;
|
---|
2573 | redo = TRUE;
|
---|
2574 | return(TRUE);
|
---|
2575 | }
|
---|
2576 |
|
---|
2577 | if (getarg())
|
---|
2578 | if (setvar(&p_to, p_to) EQ FALSE) {
|
---|
2579 |
|
---|
2580 | redo = FALSE;
|
---|
2581 | return(FALSE);
|
---|
2582 | }
|
---|
2583 |
|
---|
2584 | if ((int32_t)p_to & 1L) {
|
---|
2585 |
|
---|
2586 | redo = FALSE;
|
---|
2587 | return(FALSE);
|
---|
2588 | }
|
---|
2589 |
|
---|
2590 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
2591 |
|
---|
2592 | p_width = 8;
|
---|
2593 | redo = TRUE;
|
---|
2594 | return(TRUE);
|
---|
2595 | }
|
---|
2596 |
|
---|
2597 | if (getarg())
|
---|
2598 | if (setvar(&p_width, p_width) EQ FALSE) {
|
---|
2599 |
|
---|
2600 | redo = FALSE;
|
---|
2601 | return(FALSE);
|
---|
2602 | }
|
---|
2603 |
|
---|
2604 | redo = TRUE;
|
---|
2605 | return(TRUE);
|
---|
2606 | }
|
---|
2607 |
|
---|
2608 | /* |
---|
2609 |
|
---|
2610 | */
|
---|
2611 |
|
---|
2612 | /*
|
---|
2613 | ============================================================================
|
---|
2614 | cp_ldmp -- process parameters for ldump command
|
---|
2615 | ============================================================================
|
---|
2616 | */
|
---|
2617 |
|
---|
2618 | int16_t cp_ldmp(void)
|
---|
2619 | {
|
---|
2620 | inext = ilast;
|
---|
2621 |
|
---|
2622 | if (getarg())
|
---|
2623 | if (setvar(&p_from, p_from) EQ FALSE) {
|
---|
2624 |
|
---|
2625 | redo = FALSE;
|
---|
2626 | return(FALSE);
|
---|
2627 | }
|
---|
2628 |
|
---|
2629 | if ((int32_t)p_from & 1L) {
|
---|
2630 |
|
---|
2631 | redo = FALSE;
|
---|
2632 | return(FALSE);
|
---|
2633 | }
|
---|
2634 |
|
---|
2635 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
2636 |
|
---|
2637 | p_to = p_from;
|
---|
2638 | p_width = 4;
|
---|
2639 | redo = TRUE;
|
---|
2640 | return(TRUE);
|
---|
2641 | }
|
---|
2642 |
|
---|
2643 | if (getarg())
|
---|
2644 | if (setvar(&p_to, p_to) EQ FALSE) {
|
---|
2645 |
|
---|
2646 | redo = FALSE;
|
---|
2647 | return(FALSE);
|
---|
2648 | }
|
---|
2649 |
|
---|
2650 | if ((int32_t)p_to & 1L) {
|
---|
2651 |
|
---|
2652 | redo = FALSE;
|
---|
2653 | return(FALSE);
|
---|
2654 | }
|
---|
2655 |
|
---|
2656 | if (argsep EQ A_CR OR argsep EQ '\0') {
|
---|
2657 |
|
---|
2658 | p_width = 4;
|
---|
2659 | redo = TRUE;
|
---|
2660 | return(TRUE);
|
---|
2661 | }
|
---|
2662 |
|
---|
2663 | if (getarg())
|
---|
2664 | if (setvar(&p_width, p_width) EQ FALSE) {
|
---|
2665 |
|
---|
2666 | redo = FALSE;
|
---|
2667 | return(FALSE);
|
---|
2668 | }
|
---|
2669 |
|
---|
2670 | redo = TRUE;
|
---|
2671 | return(TRUE);
|
---|
2672 | }
|
---|
2673 |
|
---|
2674 | /* |
---|
2675 |
|
---|
2676 | */
|
---|
2677 |
|
---|
2678 | /*
|
---|
2679 | ============================================================================
|
---|
2680 | cp_ilev -- parse the ipl command
|
---|
2681 | ============================================================================
|
---|
2682 | */
|
---|
2683 |
|
---|
2684 | int16_t cp_ilev(void)
|
---|
2685 | {
|
---|
2686 | int32_t iplevl;
|
---|
2687 |
|
---|
2688 | if (argsep EQ A_CR OR argsep EQ '\0')
|
---|
2689 | return(TRUE);
|
---|
2690 |
|
---|
2691 | if (getarg())
|
---|
2692 | if (setvar(&iplevl, iplevl) EQ FALSE)
|
---|
2693 | return(FALSE);
|
---|
2694 |
|
---|
2695 | if (iplevl GT 7)
|
---|
2696 | return(FALSE);
|
---|
2697 |
|
---|
2698 | iplev = iplevl;
|
---|
2699 |
|
---|
2700 | return(TRUE);
|
---|
2701 | }
|
---|
2702 |
|
---|
2703 | /*
|
---|
2704 | ============================================================================
|
---|
2705 | cx_ilev -- execute ipl command
|
---|
2706 | ============================================================================
|
---|
2707 | */
|
---|
2708 |
|
---|
2709 | int16_t cx_ilev(void)
|
---|
2710 | {
|
---|
2711 | if (-1 EQ setipl(iplev)) {
|
---|
2712 |
|
---|
2713 | printf("ERROR -- Could not set IPL to %d\r\n", iplev);
|
---|
2714 | return(FALSE);
|
---|
2715 | } else
|
---|
2716 | printf("ROMP IPL now set to %d\r\n", iplev);
|
---|
2717 |
|
---|
2718 | return(TRUE);
|
---|
2719 | }
|
---|
2720 |
|
---|
2721 | /* |
---|
2722 |
|
---|
2723 | */
|
---|
2724 |
|
---|
2725 | /*
|
---|
2726 | ============================================================================
|
---|
2727 | cp_monc() -- parse the monc command
|
---|
2728 | ============================================================================
|
---|
2729 | */
|
---|
2730 |
|
---|
2731 | int16_t cp_monc(void)
|
---|
2732 | {
|
---|
2733 | if (getarg())
|
---|
2734 | if (setvar(&monptr, monptr) EQ FALSE)
|
---|
2735 | return(FALSE);
|
---|
2736 |
|
---|
2737 | monsw = MON_C;
|
---|
2738 | redo = TRUE;
|
---|
2739 | return(TRUE);
|
---|
2740 | }
|
---|
2741 |
|
---|
2742 | /*
|
---|
2743 | ============================================================================
|
---|
2744 | cp_mons() -- parse the mons command
|
---|
2745 | ============================================================================
|
---|
2746 | */
|
---|
2747 |
|
---|
2748 | int16_t cp_mons(void)
|
---|
2749 | {
|
---|
2750 | if (getarg())
|
---|
2751 | if (setvar(&monptr, monptr) EQ FALSE)
|
---|
2752 | return(FALSE);
|
---|
2753 |
|
---|
2754 | monsw = MON_S;
|
---|
2755 | redo = TRUE;
|
---|
2756 | return(TRUE);
|
---|
2757 | }
|
---|
2758 |
|
---|
2759 | /* |
---|
2760 |
|
---|
2761 | */
|
---|
2762 |
|
---|
2763 | /*
|
---|
2764 | ============================================================================
|
---|
2765 | cp_monl() -- parse the monl command
|
---|
2766 | ============================================================================
|
---|
2767 | */
|
---|
2768 |
|
---|
2769 | int16_t cp_monl(void)
|
---|
2770 | {
|
---|
2771 | if (getarg())
|
---|
2772 | if (setvar(&monptr, monptr) EQ FALSE)
|
---|
2773 | return(FALSE);
|
---|
2774 |
|
---|
2775 | monsw = MON_L;
|
---|
2776 | redo = TRUE;
|
---|
2777 | return(TRUE);
|
---|
2778 | }
|
---|
2779 |
|
---|
2780 | /* |
---|
2781 |
|
---|
2782 | */
|
---|
2783 |
|
---|
2784 | /*
|
---|
2785 | ============================================================================
|
---|
2786 | cx_mon() -- process the mon commands
|
---|
2787 | ============================================================================
|
---|
2788 | */
|
---|
2789 |
|
---|
2790 | int16_t cx_mon(void)
|
---|
2791 | {
|
---|
2792 | register int8_t vc, vcc;
|
---|
2793 | register int16_t vs, vss, *vsp;
|
---|
2794 | register int32_t vl, vll, *vlp;
|
---|
2795 |
|
---|
2796 | switch (monsw) {
|
---|
2797 |
|
---|
2798 | case MON_C:
|
---|
2799 |
|
---|
2800 | vc = *monptr & 0x0FF;
|
---|
2801 | puthn((uint32_t)vc, 2, cmdunit);
|
---|
2802 | writeln(cmdunit, "\r\n");
|
---|
2803 |
|
---|
2804 | while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
|
---|
2805 |
|
---|
2806 | vcc = *monptr & 0x0FF;
|
---|
2807 |
|
---|
2808 | if (vc NE vcc) {
|
---|
2809 |
|
---|
2810 | vc = vcc;
|
---|
2811 | puthn((uint32_t)vc, 2, cmdunit);
|
---|
2812 | writeln(cmdunit, "\r\n");
|
---|
2813 | }
|
---|
2814 | }
|
---|
2815 |
|
---|
2816 | BIOS(B_GETC, CON_DEV);
|
---|
2817 | return(TRUE);
|
---|
2818 |
|
---|
2819 | case MON_S:
|
---|
2820 |
|
---|
2821 | vsp = (int16_t *)monptr;
|
---|
2822 | vs = *vsp;
|
---|
2823 | puthn((uint32_t)vs, 4, cmdunit);
|
---|
2824 | writeln(cmdunit, "\r\n");
|
---|
2825 |
|
---|
2826 | while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
|
---|
2827 |
|
---|
2828 | vss = *vsp;
|
---|
2829 |
|
---|
2830 | if (vs NE vss) {
|
---|
2831 |
|
---|
2832 | vs = vss;
|
---|
2833 | puthn((uint32_t)vs, 4, cmdunit);
|
---|
2834 | writeln(cmdunit, "\r\n");
|
---|
2835 | }
|
---|
2836 | }
|
---|
2837 |
|
---|
2838 | BIOS(B_GETC, CON_DEV);
|
---|
2839 | return(TRUE);
|
---|
2840 |
|
---|
2841 | /* |
---|
2842 |
|
---|
2843 | */
|
---|
2844 | case MON_L:
|
---|
2845 |
|
---|
2846 | vlp = (int32_t *)monptr;
|
---|
2847 | vl = *vlp;
|
---|
2848 | puthn((uint32_t)vl, 8, cmdunit);
|
---|
2849 | writeln(cmdunit, "\r\n");
|
---|
2850 |
|
---|
2851 | while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
|
---|
2852 |
|
---|
2853 | vll = *vlp;
|
---|
2854 |
|
---|
2855 | if (vl NE vll) {
|
---|
2856 |
|
---|
2857 | vl = vll;
|
---|
2858 | puthn((uint32_t)vl, 8, cmdunit);
|
---|
2859 | writeln(cmdunit, "\r\n");
|
---|
2860 | }
|
---|
2861 | }
|
---|
2862 |
|
---|
2863 | BIOS(B_GETC, CON_DEV);
|
---|
2864 | return(TRUE);
|
---|
2865 |
|
---|
2866 | default:
|
---|
2867 | return(FALSE);
|
---|
2868 | }
|
---|
2869 | }
|
---|
2870 |
|
---|
2871 | /* |
---|
2872 |
|
---|
2873 | */
|
---|
2874 |
|
---|
2875 | /*
|
---|
2876 | ============================================================================
|
---|
2877 | cx_wdmp -- process wdump command
|
---|
2878 | ============================================================================
|
---|
2879 | */
|
---|
2880 |
|
---|
2881 | int16_t cx_wdmp(void)
|
---|
2882 | {
|
---|
2883 | int16_t nw, rc;
|
---|
2884 |
|
---|
2885 | d_cur = p_from;
|
---|
2886 | d_next = p_to + 2;
|
---|
2887 | d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
|
---|
2888 | nw = p_width;
|
---|
2889 | rc = TRUE;
|
---|
2890 |
|
---|
2891 | do {
|
---|
2892 |
|
---|
2893 | writeln(cmdunit, CRLF);
|
---|
2894 | padr(p_from, cmdunit);
|
---|
2895 | dflag = FALSE;
|
---|
2896 |
|
---|
2897 | if (wdump(p_from, p_to, nw, cmdunit))
|
---|
2898 | rc = FALSE;
|
---|
2899 |
|
---|
2900 | p_from = p_from + (p_width << 1);
|
---|
2901 |
|
---|
2902 | if (dflag)
|
---|
2903 | rc = FALSE;
|
---|
2904 |
|
---|
2905 | } while (rc);
|
---|
2906 |
|
---|
2907 | p_from = d_cur;
|
---|
2908 |
|
---|
2909 | writeln(cmdunit, CRLF);
|
---|
2910 | writeln(cmdunit, CRLF);
|
---|
2911 | return(TRUE);
|
---|
2912 | }
|
---|
2913 |
|
---|
2914 | /* |
---|
2915 |
|
---|
2916 | */
|
---|
2917 |
|
---|
2918 | /*
|
---|
2919 | ============================================================================
|
---|
2920 | cx_ldmp -- process ldump command
|
---|
2921 | ============================================================================
|
---|
2922 | */
|
---|
2923 |
|
---|
2924 | int16_t cx_ldmp(void)
|
---|
2925 | {
|
---|
2926 | int16_t nw, rc;
|
---|
2927 |
|
---|
2928 | d_cur = p_from;
|
---|
2929 | d_next = p_to + 4;
|
---|
2930 | d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
|
---|
2931 | nw = p_width;
|
---|
2932 | rc = TRUE;
|
---|
2933 |
|
---|
2934 | do {
|
---|
2935 |
|
---|
2936 | writeln(cmdunit, CRLF);
|
---|
2937 | padr(p_from, cmdunit);
|
---|
2938 | dflag = FALSE;
|
---|
2939 |
|
---|
2940 | if (ldump(p_from, p_to, nw, cmdunit))
|
---|
2941 | rc = FALSE;
|
---|
2942 |
|
---|
2943 | p_from = p_from + (p_width << 2);
|
---|
2944 |
|
---|
2945 | if (dflag)
|
---|
2946 | rc = FALSE;
|
---|
2947 |
|
---|
2948 | } while (rc);
|
---|
2949 |
|
---|
2950 | p_from = d_cur;
|
---|
2951 |
|
---|
2952 | writeln(cmdunit, CRLF);
|
---|
2953 | writeln(cmdunit, CRLF);
|
---|
2954 | return(TRUE);
|
---|
2955 | }
|
---|
2956 |
|
---|
2957 | /* |
---|
2958 |
|
---|
2959 | */
|
---|
2960 |
|
---|
2961 | /*
|
---|
2962 | ============================================================================
|
---|
2963 | do_cmd -- process a command line
|
---|
2964 | ============================================================================
|
---|
2965 | */
|
---|
2966 |
|
---|
2967 | void do_cmd(void)
|
---|
2968 | {
|
---|
2969 | int16_t rc, i;
|
---|
2970 |
|
---|
2971 | /* prompt for a command line */
|
---|
2972 |
|
---|
2973 | #if TINYMSG
|
---|
2974 | writeln(cmdunit, "R: ");
|
---|
2975 | #else
|
---|
2976 | writeln(cmdunit, "ROMP: ");
|
---|
2977 | #endif
|
---|
2978 |
|
---|
2979 | /* get a command line */
|
---|
2980 |
|
---|
2981 | rc = getln(cmdunit, MAXCMDLN, cmdline);
|
---|
2982 |
|
---|
2983 | /* |
---|
2984 |
|
---|
2985 | */
|
---|
2986 |
|
---|
2987 | /* dispatch based on rc */
|
---|
2988 |
|
---|
2989 | switch (rc) {
|
---|
2990 |
|
---|
2991 | case A_CR:
|
---|
2992 |
|
---|
2993 | writeln(cmdunit, CRLF);
|
---|
2994 |
|
---|
2995 | if (getcmd()) {
|
---|
2996 |
|
---|
2997 | for (i = 0; i < NCMDS; i++) {
|
---|
2998 |
|
---|
2999 | if (0 EQ strcmp(argstr, cmtab[i].cname)) {
|
---|
3000 |
|
---|
3001 | ilast = i;
|
---|
3002 |
|
---|
3003 | if ((*cmtab[i].cp)()) {
|
---|
3004 |
|
---|
3005 | if (FALSE EQ (*cmtab[i].cx)())
|
---|
3006 | writeln(cmdunit, EMSG1);
|
---|
3007 |
|
---|
3008 | } else {
|
---|
3009 |
|
---|
3010 | writeln(cmdunit, EMSG2);
|
---|
3011 | }
|
---|
3012 |
|
---|
3013 | return;
|
---|
3014 | }
|
---|
3015 | }
|
---|
3016 |
|
---|
3017 | writeln(cmdunit, EMSG3);
|
---|
3018 | return;
|
---|
3019 |
|
---|
3020 | } else {
|
---|
3021 |
|
---|
3022 | /* |
---|
3023 |
|
---|
3024 | */
|
---|
3025 |
|
---|
3026 | if (redo) {
|
---|
3027 |
|
---|
3028 | if (FALSE EQ (*cmtab[ilast].cx)())
|
---|
3029 | writeln(cmdunit, EMSG1);
|
---|
3030 |
|
---|
3031 | } else {
|
---|
3032 |
|
---|
3033 | writeln(cmdunit, EMSG5);
|
---|
3034 | }
|
---|
3035 |
|
---|
3036 | return;
|
---|
3037 | }
|
---|
3038 |
|
---|
3039 | case CTL('X'):
|
---|
3040 |
|
---|
3041 | writeln(cmdunit, CANNED);
|
---|
3042 | return;
|
---|
3043 |
|
---|
3044 | default:
|
---|
3045 |
|
---|
3046 | writeln(cmdunit, EMSG6);
|
---|
3047 | return;
|
---|
3048 | }
|
---|
3049 |
|
---|
3050 | writeln(cmdunit, EMSG7);
|
---|
3051 | return;
|
---|
3052 | }
|
---|
3053 |
|
---|
3054 | /* |
---|
3055 |
|
---|
3056 | */
|
---|
3057 |
|
---|
3058 | /*
|
---|
3059 | ============================================================================
|
---|
3060 | cx_next -- process the next command
|
---|
3061 | ============================================================================
|
---|
3062 | */
|
---|
3063 |
|
---|
3064 | int16_t cx_next(void)
|
---|
3065 | {
|
---|
3066 | p_to = d_last;
|
---|
3067 | p_from = d_next;
|
---|
3068 | return((*cmtab[inext].cx)());
|
---|
3069 | }
|
---|
3070 |
|
---|
3071 | /* |
---|
3072 |
|
---|
3073 | */
|
---|
3074 |
|
---|
3075 | /*
|
---|
3076 | ============================================================================
|
---|
3077 | cx_read() -- process the read command
|
---|
3078 | ============================================================================
|
---|
3079 | */
|
---|
3080 |
|
---|
3081 | int16_t cx_read(void)
|
---|
3082 | {
|
---|
3083 | int32_t rc;
|
---|
3084 | int16_t ns, recno;
|
---|
3085 |
|
---|
3086 | ns = p_len & 0x7FFFL;
|
---|
3087 | recno = (int32_t)p_from & 0xFFFFL;
|
---|
3088 |
|
---|
3089 | rc = BIOS(B_RDWR, 2, p_to, ns, recno, 0);
|
---|
3090 |
|
---|
3091 | if (rc & 0xFFFFL) {
|
---|
3092 |
|
---|
3093 | writeln(cmdunit, "\r\nERROR reading disk: ");
|
---|
3094 | puthn((uint32_t)rc, 8, cmdunit);
|
---|
3095 | writeln(cmdunit, "\r\n\n");
|
---|
3096 | return(FALSE);
|
---|
3097 |
|
---|
3098 | } else {
|
---|
3099 |
|
---|
3100 | return(TRUE);
|
---|
3101 | }
|
---|
3102 | }
|
---|
3103 |
|
---|
3104 | /* |
---|
3105 |
|
---|
3106 | */
|
---|
3107 |
|
---|
3108 | /*
|
---|
3109 | ============================================================================
|
---|
3110 | cx_writ() -- process the write command
|
---|
3111 | ============================================================================
|
---|
3112 | */
|
---|
3113 |
|
---|
3114 | int16_t cx_writ(void)
|
---|
3115 | {
|
---|
3116 | int32_t rc;
|
---|
3117 | int16_t ns, recno;
|
---|
3118 |
|
---|
3119 | ns = p_len & 0x7FFFL;
|
---|
3120 | recno = (int32_t)p_from & 0xFFFFL;
|
---|
3121 |
|
---|
3122 | rc = BIOS(B_RDWR, 3, p_to, ns, recno, 0);
|
---|
3123 |
|
---|
3124 | if (rc & 0xFFFFL) {
|
---|
3125 |
|
---|
3126 | writeln(cmdunit, "\r\nERROR writing disk: ");
|
---|
3127 | puthn((uint32_t)rc, 8, cmdunit);
|
---|
3128 | writeln(cmdunit, "\r\n\n");
|
---|
3129 | return(FALSE);
|
---|
3130 |
|
---|
3131 | } else {
|
---|
3132 |
|
---|
3133 | return(TRUE);
|
---|
3134 | }
|
---|
3135 | }
|
---|
3136 |
|
---|
3137 | /* |
---|
3138 |
|
---|
3139 | */
|
---|
3140 |
|
---|
3141 | /*
|
---|
3142 | ============================================================================
|
---|
3143 | showrs() -- show registers
|
---|
3144 | ============================================================================
|
---|
3145 | */
|
---|
3146 |
|
---|
3147 | void showrs(struct regs *rp)
|
---|
3148 | {
|
---|
3149 | int16_t i;
|
---|
3150 | uint16_t srtemp;
|
---|
3151 |
|
---|
3152 | writeln(cmdunit, " ");
|
---|
3153 |
|
---|
3154 | for (i = 0; i < 8; i++) {
|
---|
3155 |
|
---|
3156 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3157 | BIOS(B_PUTC, cmdunit, '0'+i);
|
---|
3158 | writeln(cmdunit, "_______");
|
---|
3159 | }
|
---|
3160 |
|
---|
3161 | writeln(cmdunit, "\r\nd0..d7 ");
|
---|
3162 |
|
---|
3163 | for (i = 0; i < 8; i++) {
|
---|
3164 |
|
---|
3165 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3166 | puthn(rp->d_reg[i], 8, cmdunit);
|
---|
3167 | }
|
---|
3168 |
|
---|
3169 | writeln(cmdunit, "\r\na0..a7 ");
|
---|
3170 |
|
---|
3171 | for (i = 0; i < 8; i++) {
|
---|
3172 |
|
---|
3173 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3174 | puthn(rp->a_reg[i], 8, cmdunit);
|
---|
3175 | }
|
---|
3176 |
|
---|
3177 | writeln(cmdunit, "\r\nPC = ");
|
---|
3178 | puthn((uint32_t)rp->reg_pc, 8, cmdunit);
|
---|
3179 |
|
---|
3180 | srtemp = rp->reg_sr;
|
---|
3181 | writeln(cmdunit, ", SR = ");
|
---|
3182 | puthn((uint32_t)srtemp & 0xFFFFL, 4, cmdunit);
|
---|
3183 |
|
---|
3184 | /* |
---|
3185 |
|
---|
3186 | */
|
---|
3187 |
|
---|
3188 | writeln(cmdunit, " (IPL = ");
|
---|
3189 | puthn((uint32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
|
---|
3190 | writeln(cmdunit, ", ");
|
---|
3191 |
|
---|
3192 | if (srtemp & 0x8000)
|
---|
3193 | BIOS(B_PUTC, cmdunit, 'T');
|
---|
3194 | else
|
---|
3195 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3196 |
|
---|
3197 | if (srtemp & 0x2000)
|
---|
3198 | BIOS(B_PUTC, cmdunit, 'S');
|
---|
3199 | else
|
---|
3200 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3201 |
|
---|
3202 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3203 |
|
---|
3204 | if (srtemp & 0x10)
|
---|
3205 | BIOS(B_PUTC, cmdunit, 'X');
|
---|
3206 | else
|
---|
3207 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3208 |
|
---|
3209 | if (srtemp & 0x8)
|
---|
3210 | BIOS(B_PUTC, cmdunit, 'N');
|
---|
3211 | else
|
---|
3212 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3213 |
|
---|
3214 | if (srtemp & 0x4)
|
---|
3215 | BIOS(B_PUTC, cmdunit, 'Z');
|
---|
3216 | else
|
---|
3217 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3218 |
|
---|
3219 | if (srtemp & 0x2)
|
---|
3220 | BIOS(B_PUTC, cmdunit, 'V');
|
---|
3221 | else
|
---|
3222 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3223 |
|
---|
3224 | if (srtemp & 0x1)
|
---|
3225 | BIOS(B_PUTC, cmdunit, 'C');
|
---|
3226 | else
|
---|
3227 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3228 |
|
---|
3229 | writeln(cmdunit, " )\r\n");
|
---|
3230 | }
|
---|
3231 |
|
---|
3232 | /* |
---|
3233 |
|
---|
3234 | */
|
---|
3235 |
|
---|
3236 | /*
|
---|
3237 | ============================================================================
|
---|
3238 | showcr() -- show crash registers
|
---|
3239 | ============================================================================
|
---|
3240 | */
|
---|
3241 |
|
---|
3242 | void showcr(void)
|
---|
3243 | {
|
---|
3244 | register int16_t i;
|
---|
3245 | register int8_t *cause;
|
---|
3246 | register uint16_t srtemp;
|
---|
3247 |
|
---|
3248 | writeln(cmdunit, "BIOS Crash Area Dump\r\n");
|
---|
3249 | writeln(cmdunit, " ");
|
---|
3250 |
|
---|
3251 | for (i = 0; i < 8; i++) {
|
---|
3252 |
|
---|
3253 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3254 | BIOS(B_PUTC, cmdunit, '0'+i);
|
---|
3255 | writeln(cmdunit, "_______");
|
---|
3256 | }
|
---|
3257 |
|
---|
3258 | writeln(cmdunit, "\r\nd0..d7 ");
|
---|
3259 |
|
---|
3260 | for (i = 0; i < 8; i++) {
|
---|
3261 |
|
---|
3262 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3263 | puthn(crshrg[i], 8, cmdunit);
|
---|
3264 | }
|
---|
3265 |
|
---|
3266 | writeln(cmdunit, "\r\na0..a7 ");
|
---|
3267 |
|
---|
3268 | for (i = 8; i < 16; i++) {
|
---|
3269 |
|
---|
3270 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3271 | puthn(crshrg[i], 8, cmdunit);
|
---|
3272 | }
|
---|
3273 |
|
---|
3274 | writeln(cmdunit, "\r\n\nPC = ");
|
---|
3275 | puthn(crshpc, 8, cmdunit);
|
---|
3276 |
|
---|
3277 | srtemp = crshsr;
|
---|
3278 | writeln(cmdunit, ", SR = ");
|
---|
3279 | puthn((uint32_t)srtemp & 0xFFFFL, 4, cmdunit);
|
---|
3280 |
|
---|
3281 | /* |
---|
3282 |
|
---|
3283 | */
|
---|
3284 |
|
---|
3285 | writeln(cmdunit, " (IPL = ");
|
---|
3286 | puthn((uint32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
|
---|
3287 | writeln(cmdunit, ", ");
|
---|
3288 |
|
---|
3289 | if (srtemp & 0x8000)
|
---|
3290 | BIOS(B_PUTC, cmdunit, 'T');
|
---|
3291 | else
|
---|
3292 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3293 |
|
---|
3294 | if (srtemp & 0x2000)
|
---|
3295 | BIOS(B_PUTC, cmdunit, 'S');
|
---|
3296 | else
|
---|
3297 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3298 |
|
---|
3299 | BIOS(B_PUTC, cmdunit, ' ');
|
---|
3300 |
|
---|
3301 | if (srtemp & 0x10)
|
---|
3302 | BIOS(B_PUTC, cmdunit, 'X');
|
---|
3303 | else
|
---|
3304 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3305 |
|
---|
3306 | if (srtemp & 0x8)
|
---|
3307 | BIOS(B_PUTC, cmdunit, 'N');
|
---|
3308 | else
|
---|
3309 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3310 |
|
---|
3311 | if (srtemp & 0x4)
|
---|
3312 | BIOS(B_PUTC, cmdunit, 'Z');
|
---|
3313 | else
|
---|
3314 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3315 |
|
---|
3316 | if (srtemp & 0x2)
|
---|
3317 | BIOS(B_PUTC, cmdunit, 'V');
|
---|
3318 | else
|
---|
3319 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3320 |
|
---|
3321 | if (srtemp & 0x1)
|
---|
3322 | BIOS(B_PUTC, cmdunit, 'C');
|
---|
3323 | else
|
---|
3324 | BIOS(B_PUTC, cmdunit, '-');
|
---|
3325 |
|
---|
3326 | writeln(cmdunit, " )\r\n");
|
---|
3327 |
|
---|
3328 | /* |
---|
3329 |
|
---|
3330 | */
|
---|
3331 | writeln(cmdunit, "TRAP vector number = ");
|
---|
3332 | putn((uint32_t)crshvc[0], 2, cmdunit);
|
---|
3333 |
|
---|
3334 | cause = " (no handler for interrupt)";
|
---|
3335 |
|
---|
3336 | switch (crshvc[0] & 0xFF) {
|
---|
3337 |
|
---|
3338 | case 2: /* 2: bus error */
|
---|
3339 |
|
---|
3340 | cause = " (Bus error)";
|
---|
3341 | break;
|
---|
3342 |
|
---|
3343 | case 3: /* 3: address error */
|
---|
3344 |
|
---|
3345 | cause = " (Address error)";
|
---|
3346 | break;
|
---|
3347 |
|
---|
3348 | case 4: /* 4: illegal instruction */
|
---|
3349 |
|
---|
3350 | cause = " (Illegal instruction)";
|
---|
3351 | break;
|
---|
3352 |
|
---|
3353 | case 5: /* 5: zero divide */
|
---|
3354 |
|
---|
3355 | cause = " (Zero divide)";
|
---|
3356 | break;
|
---|
3357 |
|
---|
3358 | case 6: /* 6: CHK instruction */
|
---|
3359 |
|
---|
3360 | cause = " (CHK instruction)";
|
---|
3361 | break;
|
---|
3362 |
|
---|
3363 | case 7: /* 7: TRAPV instruction */
|
---|
3364 |
|
---|
3365 | cause = " (TRAPV instruction)";
|
---|
3366 | break;
|
---|
3367 |
|
---|
3368 | case 8: /* 8: privilege violation */
|
---|
3369 |
|
---|
3370 | cause = " (Privilege violation)";
|
---|
3371 | break;
|
---|
3372 |
|
---|
3373 | case 9: /* 9: trace */
|
---|
3374 |
|
---|
3375 | cause = " (Trace -- not implemented)";
|
---|
3376 | break;
|
---|
3377 |
|
---|
3378 | case 10: /* 10: line 1010 emulator */
|
---|
3379 |
|
---|
3380 | cause = " (Line 1010 Emulator -- not implemented)";
|
---|
3381 | break;
|
---|
3382 |
|
---|
3383 | case 11: /* 11: line 1111 emulator */
|
---|
3384 |
|
---|
3385 | cause = " (Line 1111 Emulator -- not implemented";
|
---|
3386 | break;
|
---|
3387 |
|
---|
3388 | case 15: /* 15: uninitialized interrupt vector */
|
---|
3389 |
|
---|
3390 | cause = " (Uninitialized interrupt)";
|
---|
3391 | break;
|
---|
3392 |
|
---|
3393 | case 24: /* 24: spurious interrupt */
|
---|
3394 |
|
---|
3395 | cause = " (Spurious interrupt)";
|
---|
3396 | break;
|
---|
3397 |
|
---|
3398 | case 25: /* 25: Autovector Level 1*/
|
---|
3399 |
|
---|
3400 | cause = " (Level 1 Interrupt -- unimplmented)";
|
---|
3401 | break;
|
---|
3402 |
|
---|
3403 | case 26: /* 26: Autovector Level 2 */
|
---|
3404 |
|
---|
3405 | cause = " (Level 2 Interrupt -- unimplmented)";
|
---|
3406 | break;
|
---|
3407 |
|
---|
3408 | case 27: /* 27: Autovector Level 3 */
|
---|
3409 |
|
---|
3410 | cause = " (Level 3 Interrupt -- unimplmented)";
|
---|
3411 | break;
|
---|
3412 |
|
---|
3413 | case 28: /* 28: Autovector Level 4 */
|
---|
3414 |
|
---|
3415 | cause = " (Level 4 Interrupt -- unimplmented)";
|
---|
3416 | break;
|
---|
3417 |
|
---|
3418 | case 29: /* 29: Autovector Level 5 */
|
---|
3419 |
|
---|
3420 | cause = " (Level 5 Interrupt -- unimplmented)";
|
---|
3421 | break;
|
---|
3422 |
|
---|
3423 | case 30: /* 30: Autovector Level 6 */
|
---|
3424 |
|
---|
3425 | cause = " (Level 6 Interrupt -- unimplmented)";
|
---|
3426 | break;
|
---|
3427 |
|
---|
3428 | case 31: /* 31: Autovector Level 7 */
|
---|
3429 |
|
---|
3430 | cause = " (Level 7 Interrupt -- unimplmented)";
|
---|
3431 | break;
|
---|
3432 |
|
---|
3433 | }
|
---|
3434 |
|
---|
3435 | writeln(cmdunit, cause);
|
---|
3436 | writeln(cmdunit, "\r\n");
|
---|
3437 | }
|
---|
3438 |
|
---|
3439 | /* |
---|
3440 |
|
---|
3441 | */
|
---|
3442 |
|
---|
3443 | /*
|
---|
3444 | ============================================================================
|
---|
3445 | cx_crsh -- process the crash command
|
---|
3446 | ============================================================================
|
---|
3447 | */
|
---|
3448 |
|
---|
3449 | int16_t cx_crsh(void)
|
---|
3450 | {
|
---|
3451 | if (!wzcrsh)
|
---|
3452 | printf("** Crash switch NOT set **\r\n");
|
---|
3453 |
|
---|
3454 | redo = FALSE;
|
---|
3455 | showcr();
|
---|
3456 | return(TRUE);
|
---|
3457 | }
|
---|
3458 |
|
---|
3459 | /* |
---|
3460 |
|
---|
3461 | */
|
---|
3462 |
|
---|
3463 | /*
|
---|
3464 | ============================================================================
|
---|
3465 | bphit -- clear breakpoints, see if any were hit
|
---|
3466 | ============================================================================
|
---|
3467 | */
|
---|
3468 |
|
---|
3469 | int16_t bphit(void)
|
---|
3470 | {
|
---|
3471 | int16_t rc;
|
---|
3472 |
|
---|
3473 | rc = FALSE;
|
---|
3474 |
|
---|
3475 | if (p_ba0 EQ regptr->reg_pc) {
|
---|
3476 |
|
---|
3477 | if (*p_ba0 EQ BPINST) {
|
---|
3478 |
|
---|
3479 | *p_ba0 = p_bv0;
|
---|
3480 | p_ba0 = 0L;
|
---|
3481 | p_bv0 = BPINST;
|
---|
3482 | rc = TRUE;
|
---|
3483 |
|
---|
3484 | } else {
|
---|
3485 |
|
---|
3486 | writeln(cmdunit, "** Breakpoint word at ");
|
---|
3487 | puthn((uint32_t)p_ba0, 8 , cmdunit);
|
---|
3488 | writeln(cmdunit, " was ");
|
---|
3489 | puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
|
---|
3490 | writeln(cmdunit, " instead of ");
|
---|
3491 | puthn((uint32_t)BPINST, 4, cmdunit);
|
---|
3492 | writeln(cmdunit, " **\r\n\n");
|
---|
3493 | rc = TRUE;
|
---|
3494 | }
|
---|
3495 | }
|
---|
3496 |
|
---|
3497 | /* |
---|
3498 |
|
---|
3499 | */
|
---|
3500 |
|
---|
3501 | if (p_ba1 EQ regptr->reg_pc) {
|
---|
3502 |
|
---|
3503 | if (*p_ba1 EQ BPINST) {
|
---|
3504 |
|
---|
3505 | *p_ba1 = p_bv1;
|
---|
3506 | p_ba1 = 0L;
|
---|
3507 | p_bv1 = BPINST;
|
---|
3508 | rc = TRUE;
|
---|
3509 |
|
---|
3510 | } else {
|
---|
3511 |
|
---|
3512 | writeln(cmdunit, "** Breakpoint word at ");
|
---|
3513 | puthn((uint32_t)p_ba0, 8 , cmdunit);
|
---|
3514 | writeln(cmdunit, " was ");
|
---|
3515 | puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
|
---|
3516 | writeln(cmdunit, " instead of ");
|
---|
3517 | puthn((uint32_t)BPINST, 4, cmdunit);
|
---|
3518 | writeln(cmdunit, " **\r\n\n");
|
---|
3519 | rc = TRUE;
|
---|
3520 | }
|
---|
3521 | }
|
---|
3522 | /* |
---|
3523 |
|
---|
3524 | */
|
---|
3525 | if (p_ba0) {
|
---|
3526 |
|
---|
3527 | if (*p_ba0 EQ BPINST) {
|
---|
3528 |
|
---|
3529 | *p_ba0 = p_bv0;
|
---|
3530 | p_ba0 = 0L;
|
---|
3531 | p_bv0 = BPINST;
|
---|
3532 | rc = TRUE;
|
---|
3533 |
|
---|
3534 | } else {
|
---|
3535 |
|
---|
3536 | writeln(cmdunit, "** Breakpoint word at ");
|
---|
3537 | puthn((uint32_t)p_ba0, 8 , cmdunit);
|
---|
3538 | writeln(cmdunit, " was ");
|
---|
3539 | puthn(0xFFFFL & (uint32_t)(*p_ba0), 4, cmdunit);
|
---|
3540 | writeln(cmdunit, " instead of ");
|
---|
3541 | puthn((uint32_t)BPINST, 4, cmdunit);
|
---|
3542 | writeln(cmdunit, " **\r\n\n");
|
---|
3543 | rc = TRUE;
|
---|
3544 | }
|
---|
3545 | }
|
---|
3546 |
|
---|
3547 | /* |
---|
3548 |
|
---|
3549 | */
|
---|
3550 |
|
---|
3551 | if (p_ba1) {
|
---|
3552 |
|
---|
3553 | if (*p_ba1 EQ BPINST) {
|
---|
3554 |
|
---|
3555 | *p_ba1 = p_bv1;
|
---|
3556 | p_ba1 = 0L;
|
---|
3557 | p_bv1 = BPINST;
|
---|
3558 | rc = TRUE;
|
---|
3559 |
|
---|
3560 | } else {
|
---|
3561 |
|
---|
3562 | writeln(cmdunit, "** Breakpoint word at ");
|
---|
3563 | puthn((uint32_t)p_ba0, 8 , cmdunit);
|
---|
3564 | writeln(cmdunit, " was ");
|
---|
3565 | puthn(0xFFFFL & (uint32_t)(*p_ba1), 4, cmdunit);
|
---|
3566 | writeln(cmdunit, " instead of ");
|
---|
3567 | puthn((uint32_t)BPINST, 4, cmdunit);
|
---|
3568 | writeln(cmdunit, " **\r\n\n");
|
---|
3569 | rc = TRUE;
|
---|
3570 | }
|
---|
3571 | }
|
---|
3572 |
|
---|
3573 | if (rc)
|
---|
3574 | return(rc);
|
---|
3575 |
|
---|
3576 | writeln(cmdunit, "\r\n** Program invoked ROMP trap **\r\n");
|
---|
3577 | return(FALSE);
|
---|
3578 | }
|
---|
3579 |
|
---|
3580 | /* |
---|
3581 |
|
---|
3582 | */
|
---|
3583 |
|
---|
3584 | /*
|
---|
3585 | ============================================================================
|
---|
3586 | cx_regs() -- process the regs command
|
---|
3587 | ============================================================================
|
---|
3588 | */
|
---|
3589 |
|
---|
3590 | int16_t cx_regs(void)
|
---|
3591 | {
|
---|
3592 | showrs(regptr);
|
---|
3593 | return(TRUE);
|
---|
3594 | }
|
---|
3595 |
|
---|
3596 | /* |
---|
3597 |
|
---|
3598 | */
|
---|
3599 |
|
---|
3600 | /*
|
---|
3601 | ============================================================================
|
---|
3602 | rompbp() -- process a breakpoint for ROMP
|
---|
3603 | ============================================================================
|
---|
3604 | */
|
---|
3605 |
|
---|
3606 | 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)
|
---|
3607 | {
|
---|
3608 | register int16_t i;
|
---|
3609 |
|
---|
3610 | regptr = (struct regs *)&d0; /* make registers accessable */
|
---|
3611 | pc -= 2L; /* adjust pc */
|
---|
3612 |
|
---|
3613 | if (-1 EQ setipl(iplev)) /* enable interrupts */
|
---|
3614 | writeln(cmdunit, "\r\n\n***** setipl() failed *****\r\n\n");
|
---|
3615 |
|
---|
3616 | if (first1) { /* initial entry from xtrap15() */
|
---|
3617 |
|
---|
3618 | for (i = 0; i < 8; i++) /* clear d0..d7 */
|
---|
3619 | regptr->d_reg[i] = 0L;
|
---|
3620 |
|
---|
3621 | for (i = 0; i < 7; i++) /* clear a0..a6 */
|
---|
3622 | regptr->a_reg[i] = 0L;
|
---|
3623 |
|
---|
3624 | regptr->a_reg[7] = ISTACK; /* setup initial stack */
|
---|
3625 |
|
---|
3626 | sr = INITSR; /* setup sr */
|
---|
3627 | pc += 2L; /* adjust pc past TRAP 15 */
|
---|
3628 |
|
---|
3629 | } else { /* breakpoint */
|
---|
3630 |
|
---|
3631 | writeln(cmdunit, "\r\n\n** ROMP Breakpoint TRAP **\r\n");
|
---|
3632 |
|
---|
3633 | showrs(regptr); /* show registers */
|
---|
3634 |
|
---|
3635 | if (bphit() EQ FALSE) /* fixup breakpoints */
|
---|
3636 | pc += 2L; /* and maybe the pc */
|
---|
3637 |
|
---|
3638 | }
|
---|
3639 |
|
---|
3640 | first1 = FALSE; /* not first time any more */
|
---|
3641 | exflag = FALSE; /* clear exit flag */
|
---|
3642 |
|
---|
3643 | do {
|
---|
3644 |
|
---|
3645 | do_cmd(); /* process commands ... */
|
---|
3646 |
|
---|
3647 | } while (!exflag); /* ... until exit flag is set */
|
---|
3648 |
|
---|
3649 | return; /* return to xtrap15 */
|
---|
3650 | }
|
---|
3651 |
|
---|
3652 | /* |
---|
3653 |
|
---|
3654 | */
|
---|
3655 |
|
---|
3656 | /*
|
---|
3657 | ============================================================================
|
---|
3658 | progid() -- identify the program
|
---|
3659 | ============================================================================
|
---|
3660 | */
|
---|
3661 |
|
---|
3662 | void progid(void)
|
---|
3663 | {
|
---|
3664 | register int8_t *pcptr;
|
---|
3665 |
|
---|
3666 | #if TINYMSG
|
---|
3667 |
|
---|
3668 | #if ON_B700
|
---|
3669 | writeln(cmdunit, "\r\n\nB\r\n");
|
---|
3670 | #else
|
---|
3671 | writeln(cmdunit, "\r\n\nN\r\n");
|
---|
3672 | #endif
|
---|
3673 |
|
---|
3674 | #else
|
---|
3675 |
|
---|
3676 | #if ON_B700
|
---|
3677 | writeln(cmdunit, "\r\n\nBuchla 700 BIOS / Debug PROM\r\n");
|
---|
3678 | #else
|
---|
3679 | writeln(cmdunit, "\r\n\nNASA 3D Helmet Display BIOS / Debug PROM\r\n");
|
---|
3680 | #endif
|
---|
3681 |
|
---|
3682 | writeln(cmdunit, " ROMP Version ");
|
---|
3683 | writeln(cmdunit, ROMPVER);
|
---|
3684 |
|
---|
3685 | writeln(cmdunit, "\r\n BIOS Version ");
|
---|
3686 | pcptr = (int8_t *)PRM_VERS;
|
---|
3687 | putn((uint32_t)*pcptr++, 2, cmdunit);
|
---|
3688 | BIOS(B_PUTC, cmdunit, '.');
|
---|
3689 | putn((uint32_t)*pcptr++, 2, cmdunit);
|
---|
3690 | writeln(cmdunit, promdate);
|
---|
3691 |
|
---|
3692 | #endif
|
---|
3693 | }
|
---|
3694 |
|
---|
3695 | /* |
---|
3696 |
|
---|
3697 | */
|
---|
3698 |
|
---|
3699 | #if ON_B700
|
---|
3700 |
|
---|
3701 |
|
---|
3702 | /*
|
---|
3703 | ============================================================================
|
---|
3704 | pclr() -- clear the panel FIFO
|
---|
3705 | ============================================================================
|
---|
3706 | */
|
---|
3707 |
|
---|
3708 | int16_t pclr(void)
|
---|
3709 | {
|
---|
3710 | register int16_t i;
|
---|
3711 |
|
---|
3712 | ftimer = FIFOLIM;
|
---|
3713 |
|
---|
3714 | while (-1L NE (afi = XBIOS(X_ANALOG))) { /* check panel inputs */
|
---|
3715 |
|
---|
3716 | asig = 0x007F & (afi >> 8); /* signal number */
|
---|
3717 |
|
---|
3718 | if (0 EQ asig) {
|
---|
3719 |
|
---|
3720 | /* all keys up */
|
---|
3721 |
|
---|
3722 | for (i = 0; i < 128; i++) {
|
---|
3723 |
|
---|
3724 | sigtab[i][0] = 0;
|
---|
3725 | sigtab[i][1] = 0;
|
---|
3726 | }
|
---|
3727 |
|
---|
3728 | break;
|
---|
3729 | }
|
---|
3730 |
|
---|
3731 | if (ftimer-- < 0)
|
---|
3732 | return(FAILURE);
|
---|
3733 | }
|
---|
3734 |
|
---|
3735 | return(SUCCESS);
|
---|
3736 | }
|
---|
3737 |
|
---|
3738 | /* |
---|
3739 |
|
---|
3740 | */
|
---|
3741 |
|
---|
3742 | /*
|
---|
3743 | ============================================================================
|
---|
3744 | pscan() -- scan the panel and maybe even load a program from diskette
|
---|
3745 | ============================================================================
|
---|
3746 | */
|
---|
3747 |
|
---|
3748 | int16_t pscan(void)
|
---|
3749 | {
|
---|
3750 | register int16_t i, c;
|
---|
3751 |
|
---|
3752 | if (0 EQ ledcntr--) {
|
---|
3753 |
|
---|
3754 | if ((baseled + 3) > 23) /* turn on a LED */
|
---|
3755 | io_leds = baseled - 21;
|
---|
3756 | else
|
---|
3757 | io_leds = baseled + 3;
|
---|
3758 |
|
---|
3759 | io_leds = 0x80 + baseled; /* turn off a LED */
|
---|
3760 |
|
---|
3761 | if (++baseled > 23) /* update LED number */
|
---|
3762 | baseled = 0;
|
---|
3763 |
|
---|
3764 | ledcntr = 200;
|
---|
3765 | }
|
---|
3766 |
|
---|
3767 | aflag = FALSE;
|
---|
3768 |
|
---|
3769 | if (-1L NE (afi = XBIOS(X_ANALOG))) { /* check panel inputs */
|
---|
3770 |
|
---|
3771 | asig = 0x007F & (afi >> 8); /* signal number */
|
---|
3772 | astat = 0x0001 & (afi >> 7); /* status */
|
---|
3773 | aval = 0x007F & afi; /* value */
|
---|
3774 |
|
---|
3775 | if (asig) { /* active signal */
|
---|
3776 |
|
---|
3777 | aflag = TRUE;
|
---|
3778 |
|
---|
3779 | sigtab[asig][0] = aval;
|
---|
3780 | sigtab[asig][1] = astat;
|
---|
3781 |
|
---|
3782 | } else { /* all keys up */
|
---|
3783 |
|
---|
3784 | aflag = FALSE;
|
---|
3785 |
|
---|
3786 | for (i = 0; i < 128; i++)
|
---|
3787 | sigtab[i][1] = 0;
|
---|
3788 | }
|
---|
3789 | }
|
---|
3790 | /* |
---|
3791 |
|
---|
3792 | */
|
---|
3793 | if (aflag) { /* anything changed ? */
|
---|
3794 |
|
---|
3795 | if (astat AND (asig EQ BOOTKEY)) { /* BOOT key */
|
---|
3796 |
|
---|
3797 | for (i = 0; i < 24; i++) /* turn off LEDs */
|
---|
3798 | io_leds = 0x80 + i;
|
---|
3799 |
|
---|
3800 | io_leds = 0x1F; /* turn off LCD lamp */
|
---|
3801 |
|
---|
3802 | /* load and run BOOTFILE */
|
---|
3803 |
|
---|
3804 | B_log_s = FALSE;
|
---|
3805 | B_dbg_s = FALSE;
|
---|
3806 |
|
---|
3807 | hdvini();
|
---|
3808 | _bpbin = FALSE;
|
---|
3809 |
|
---|
3810 | if (booter(BOOTFILE, 0L))
|
---|
3811 | return(FALSE);
|
---|
3812 | else
|
---|
3813 | sjumpto(B_buf_a, ISTACK);
|
---|
3814 |
|
---|
3815 | } else if (astat AND (asig EQ ROMPKEY)) { /* ROMP key */
|
---|
3816 |
|
---|
3817 | for (i = 0; i < 24; i++) /* turn off LEDs */
|
---|
3818 | io_leds = 0x80 + i;
|
---|
3819 |
|
---|
3820 | return(TRUE);
|
---|
3821 | }
|
---|
3822 | }
|
---|
3823 |
|
---|
3824 | /* |
---|
3825 |
|
---|
3826 | */
|
---|
3827 |
|
---|
3828 | if (BIOS(B_RDAV, CON_DEV)) {
|
---|
3829 |
|
---|
3830 | c = 0x007F & BIOS(B_GETC, CON_DEV);
|
---|
3831 |
|
---|
3832 | if ((c EQ 'r') OR (c EQ 'R'))
|
---|
3833 | return(TRUE);
|
---|
3834 | }
|
---|
3835 |
|
---|
3836 | return(FALSE);
|
---|
3837 | }
|
---|
3838 | #endif
|
---|
3839 |
|
---|
3840 | /* |
---|
3841 |
|
---|
3842 | */
|
---|
3843 |
|
---|
3844 | /*
|
---|
3845 | ============================================================================
|
---|
3846 | romp main routine
|
---|
3847 | ============================================================================
|
---|
3848 | */
|
---|
3849 |
|
---|
3850 | void main(void)
|
---|
3851 | {
|
---|
3852 | register int16_t i;
|
---|
3853 | register int8_t *pdptr, *pcptr;
|
---|
3854 |
|
---|
3855 | /* unpack PROM date */
|
---|
3856 |
|
---|
3857 | pcptr = (int8_t *)PRM_DATE; /* prom date: yyyymmdd */
|
---|
3858 | pdptr = promdate; /* -- yyyy-mm-dd */
|
---|
3859 | *pdptr++ = ' ';
|
---|
3860 | *pdptr++ = '-';
|
---|
3861 | *pdptr++ = '-';
|
---|
3862 | *pdptr++ = ' ';
|
---|
3863 | *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
|
---|
3864 | *pdptr++ = (*pcptr++ & 0x0F) + '0';
|
---|
3865 | *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
|
---|
3866 | *pdptr++ = (*pcptr++ & 0x0F) + '0';
|
---|
3867 | *pdptr++ = '-';
|
---|
3868 | *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
|
---|
3869 | *pdptr++ = (*pcptr++ & 0x0F) + '0';
|
---|
3870 | *pdptr++ = '-';
|
---|
3871 | *pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
|
---|
3872 | *pdptr++ = (*pcptr++ & 0x0F) + '0';
|
---|
3873 | *pdptr++ = '\0';
|
---|
3874 |
|
---|
3875 | /* initialize variables */
|
---|
3876 |
|
---|
3877 | sprintf(hs_mtst, "[[start=$%lX],[end=$%lx]] (or $8..$%lX)",
|
---|
3878 | USER_RAM, RAM_TOP, (USER_RAM - 2L));
|
---|
3879 |
|
---|
3880 | cmdunit = CON_DEV;
|
---|
3881 |
|
---|
3882 | ilast = 0;
|
---|
3883 | inext = 0;
|
---|
3884 | iplev = DEFIPL;
|
---|
3885 |
|
---|
3886 | dflag = FALSE;
|
---|
3887 | exflag = FALSE;
|
---|
3888 | redo = FALSE;
|
---|
3889 | goflag = FALSE;
|
---|
3890 | b0flag = FALSE;
|
---|
3891 | b1flag = FALSE;
|
---|
3892 |
|
---|
3893 | p_goto = (int8_t *)ROMADDR;
|
---|
3894 | p_len = 0L;
|
---|
3895 | p_width = 16L;
|
---|
3896 | p_value = 0L;
|
---|
3897 |
|
---|
3898 | p_ba0 = 0L;
|
---|
3899 | p_bv0 = BPINST;
|
---|
3900 |
|
---|
3901 | p_ba1 = 0L;
|
---|
3902 | p_bv1 = BPINST;
|
---|
3903 |
|
---|
3904 | tba0 = 0L;
|
---|
3905 | tba1 = 0L;
|
---|
3906 |
|
---|
3907 | inext = 0;
|
---|
3908 |
|
---|
3909 | tsetup(); /* patch the timer interrupt code */
|
---|
3910 |
|
---|
3911 | #if ON_B700
|
---|
3912 | baseled = 21; /* setup LED scan */
|
---|
3913 | ledcntr = 0; /* ... */
|
---|
3914 | io_leds = 0x9F; /* turn on LCD lamp */
|
---|
3915 | GLCinit(); /* reset LCD display */
|
---|
3916 |
|
---|
3917 | GLCtext(0, 1, "Load GoTo");
|
---|
3918 | GLCtext(1, 1, "Disk ROMP");
|
---|
3919 |
|
---|
3920 | GLCtext(3, 15, "Buchla 700 -- BIOS/ROMP Firmware by D.N. Lynx Crowe");
|
---|
3921 |
|
---|
3922 | sprintf(idbuf, "BIOS Version %02d.%02d%s",
|
---|
3923 | *(int8_t *)PRM_VERS, *(int8_t *)(PRM_VERS+1), promdate);
|
---|
3924 | GLCtext(5, 30, idbuf);
|
---|
3925 |
|
---|
3926 | sprintf(idbuf, "ROMP Version %s", ROMPVER);
|
---|
3927 | GLCtext(6, 30, idbuf);
|
---|
3928 | GLCcrc(0, 0);
|
---|
3929 |
|
---|
3930 | (int8_t *)BIOS(B_SETV, 47, trap15); /* set ROMP trap vec */
|
---|
3931 |
|
---|
3932 | for (i = 0; i < 128; i++) {
|
---|
3933 |
|
---|
3934 | sigtab[i][0] = 0;
|
---|
3935 | sigtab[i][1] = 0;
|
---|
3936 | }
|
---|
3937 |
|
---|
3938 | XBIOS(X_CLRAFI); /* clear the panel FIFO */
|
---|
3939 | setipl(KB_EI); /* enable interrupts */
|
---|
3940 | pclr(); /* empty the panel FIFO */
|
---|
3941 | XBIOS(X_CLRAFI); /* clear the panel FIFO */
|
---|
3942 |
|
---|
3943 | while (FALSE EQ pscan()) ; /* do the panel scan */
|
---|
3944 | #endif
|
---|
3945 |
|
---|
3946 | /* |
---|
3947 |
|
---|
3948 | */
|
---|
3949 | if (setjmp(&restart)) /* setup restart point */
|
---|
3950 | writeln(cmdunit, "\r\n***** ROMP Re-starting *****\r\n\n");
|
---|
3951 |
|
---|
3952 | tsetup(); /* patch the timer interrupt code */
|
---|
3953 | progid(); /* identify the program */
|
---|
3954 |
|
---|
3955 | (int8_t *)BIOS(B_SETV, 47, trap15); /* set ROMP trap vec */
|
---|
3956 | writeln(cmdunit, "\r\n\n");
|
---|
3957 |
|
---|
3958 | /* process commands */
|
---|
3959 |
|
---|
3960 | first1 = TRUE; /* set break init flag */
|
---|
3961 |
|
---|
3962 | while (TRUE) {
|
---|
3963 |
|
---|
3964 | xtrap15(); /* trap into ROMP bp processor */
|
---|
3965 | writeln(cmdunit, "\r\n** xtrap15() returned to ROMP **\r\n\n");
|
---|
3966 | }
|
---|
3967 | }
|
---|
3968 |
|
---|