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