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