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