/*
 *
 * debug99  Version 0.0  28NOV83
 *
 * This is the "debug" subtree for the 9900/9989 uP family.
 *
 */

/*
 * TNIX/Unix/VMS Version
 * Keyshell Version Number 1
 */

/*
 * Include files used by the pre-processor.
 */

#include <runmost>
#include <memcmds>
#include <reg8bit>
#include <loadsave>

debug
{
>
>\kstatus\e - Shows the emulator environment.
>
>\krun pgrm\e - Runs your program.
>
>\kmemory\e - Modifies and/or accesses memory.
>
>\kregisters\e - Modifies and/or accesses register contents.
>
>\kload/save\e - Loads or saves your program.

		msg (^);
		f1;status; {
			>
			>\kregisters\e - Show register contents.
			>
			>\kmode\e - Shows which emulation mode is active (0, 1 or 2).
			>
			>\kmemory\e - Show memory partitioning, emulator name and program loaded.
			>
			>\kbreaks\e - Show emulator breakpoints programmed.
			>
			>\kall\e - Show all of the above.
			f1;registers; msg (^Displaying register contents...),
				cmd (^ds; 8540 lb), exec, msg (^), cmd (^);
			f2;mode; msg (^Displaying emulation mode...),
				cmd (^em), exec, msg (^), cmd (^);
			f3;memory; msg (^Displaying memory status...),
				cmd (^map; stat), exec, msg (^), cmd (^);
			f4;breaks; msg (^Displaying breakpoints set...),
				cmd (^tra; bk), exec, msg (^), cmd (^);
			f5;all; msg (^Displaying emulator status...),
				cmd (^em; ds; 8540 lb; map; tra; bk), exec,
				msg (^), cmd (^);
			f8;done; cmd (^), msg (^), break;
		};
		f2;run pgrm; [runmost];
		f3;memory; { 
			>
			>\kdump\e - Shows memory contents over a specified address range.
			>
			>\kfill\e - Fills memory with a specified pattern.
			>
			>\kpatch\e - Changes contents of memory.
			>
			>\kdisassem\e - Disassembles program over a specified address range.
			>
			>\ki/o read\e - Allows you to read the contents of the cru.
			>
			>\ki/o write\e - Allows you to write any bit pattern to the cru.
			f1;dump; [dump];
			f2;fill; [fillmem];
			f3;patch; [patch];
			f4;disassem; [disassemble];
			f5;i/o read; {
				>
				cmd (^rd ), msg (^Address to read? %P), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (rd);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				msg ( Number of bits? %p), exec,
					msg (^), cmd (^), break;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (rd);
				f8;done; msg (^), cmd (^), break;
			};
			f6;i/o write; {
				>
				cmd (^wrt ),
					msg (^Address to write? %P), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (wrt);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				msg ( Number of bits to write? %P), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (wrt);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				msg ( value: %p), exec,
					msg (^), cmd (^), break;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (wrt);
				f8;done; msg (^), cmd (^), break;
			};
			f8;done; msg (^), cmd (^), break;
		};
		f4;registers; {
			>
			>\kshow reg\e - Shows the register contents.
			>
			>\kset\e - Changes the register contents.
			>
			>\kreset\e - Resets the emulator.
			>
			>\klookback\e - Shows the previous execution contexts.
			f1;show reg; msg (^Displaying register contents...),
				 cmd (^ds), exec, msg (^), cmd (^);
			f2;set;  [nrmlset];
			f3;reset; msg (^), cmd (^reset), exec;
			f4;lookback; {
				>
				cmd (^8540 lb -c ),
				msg (^How many levels do you want to look back? %p), exec,
					msg (^), cmd (^), break;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (lb);
				f8;done; msg (^), cmd (^), break;
			};
			f7;manual; man (s), man (reset);
			f8;done; msg (^), cmd (^), break;
		};
		f5;load/save; [loadsave];
		f8;done; msg (^), cmd (^), break;
}
