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