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