[hatari-devel] A few more patches for debuginfo of osheader & system variables

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

attached are 2 patches which should (hopefully) improve debug output. The 
first changes the behaviour of printing the osheader. The current solution 
does not print anything when sysbase does not point to the ROM, which is 
rather contra productive. It does not only happen with MiNT, but also with TOS 
2.x and 3.x while running programs from auto-folder, when using tools that 
relocate the TOS to RAM like GEMRAM, etc.

The 2nd patch adds a new subcommand to info which prints all the system 
variables. The output of it is a bit long however, maybe that should be split 
into exception vectors, and other system variables?
diff -r f4a9180b6858 src/debug/debugInfo.c
--- a/src/debug/debugInfo.c	Mon Dec 03 13:38:12 2018 +0100
+++ b/src/debug/debugInfo.c	Thu Dec 06 09:31:49 2018 +0100
@@ -83,14 +83,13 @@
 		if (warnings) {
 			fprintf(stderr, "Invalid TOS sysbase ROM address (0x%x)!\n", *rombase);
 		}
-		return 0;
+		*rombase = 0;
 	}
 	if (*rombase != TosAddress) {
 		if (warnings) {
 			fprintf(stderr, "os_beg (0x%x) != TOS address (0x%x), header in RAM not set up yet?\n",
 				*rombase, TosAddress);
 		}
-		return 0;
 	}
 	return sysbase;
 }
@@ -293,6 +292,7 @@
 {
 	Uint32 gemblock, basepage;
 	Uint16 osversion, datespec, osconf, langbits;
+	Uint32 osdate;
 	const char *lang;
 	static const char langs[][3] = {
 		"us", "de", "fr", "uk", "es", "it", "se", "ch" /* fr */, "ch" /* de */,
@@ -342,6 +342,9 @@
 	datespec = STMemory_ReadWord(sysbase+0x1E);
 	fprintf(fp, "Build date   : %04d-%02d-%02d\n", (datespec >> 9) + 1980,
 	       (datespec & 0x1E0) >> 5, datespec & 0x1f);
+	osdate = STMemory_ReadLong(sysbase+0x18);
+	fprintf(fp, "OS date      : %04x-%02x-%02x\n", osdate & 0xffff,
+	       (osdate >> 24) & 0xff, (osdate >> 16) & 0xff);
 
 	osconf = STMemory_ReadWord(sysbase+0x1C);
 	langbits = osconf >> 1;
@@ -364,13 +367,13 @@
 {
 	Uint32 sysbase, rombase;
 
-	sysbase = DebugInfo_GetSysbase(&rombase, false);
+	sysbase = DebugInfo_GetSysbase(&rombase, true);
 	if (!sysbase) {
 		return;
 	}
 	fprintf(fp, "OS header information:\n");
 	DebugInfo_PrintOSHeader(fp, sysbase);
-	if (sysbase != rombase) {
+	if (sysbase != rombase && rombase) {
 		fprintf(fp, "\nROM TOS OS header information:\n");
 		DebugInfo_PrintOSHeader(fp, rombase);
 		return;
diff -r f4a9180b6858 src/debug/debugInfo.c
--- a/src/debug/debugInfo.c	Mon Dec 03 13:38:12 2018 +0100
+++ b/src/debug/debugInfo.c	Thu Dec 06 09:34:26 2018 +0100
@@ -377,6 +377,287 @@
 	}
 }
 
+#define SYS_PMMU       0x001 /* print only when MMU is present */
+#define SYS_040        0x002 /* print only when CPU type is 040+ */
+#define SYS_DSP        0x004 /* print only when DSP is available */
+#define SYS_FPU        0x008 /* print only when FPU is available */
+#define SYS_BLITTER    0x010 /* print only when Blitter is present */
+#define SYS_MACHINE_TT 0x020
+
+static struct {
+	uint32_t addr;
+	int size;
+	const char *desc;
+	unsigned int flags;
+} const sysvars[] = {
+	{ 0x0008, SIZE_LONG, "bus error", 0 },
+	{ 0x000C, SIZE_LONG, "address error", 0 },
+	{ 0x0010, SIZE_LONG, "illegal instruction", 0 },
+	{ 0x0014, SIZE_LONG, "zero divide", 0 },
+	{ 0x0018, SIZE_LONG, "CHK", 0 },
+	{ 0x001C, SIZE_LONG, "TRAP", 0 },
+	{ 0x0020, SIZE_LONG, "privilege violation", 0 },
+	{ 0x0024, SIZE_LONG, "trace", 0 },
+	{ 0x0028, SIZE_LONG, "line A", 0 },
+	{ 0x002C, SIZE_LONG, "line F", 0 },
+	{ 0x0034, SIZE_LONG, "coprocessor violation", SYS_PMMU },
+	{ 0x0038, SIZE_LONG, "format error", SYS_PMMU },
+	{ 0x003C, SIZE_LONG, "uninitiaized interrupt", 0 },
+	{ 0x0060, SIZE_LONG, "spurious interrupt", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x0064, SIZE_LONG, "level 1 autovector", 0 },
+	{ 0x0068, SIZE_LONG, "level 2 autovector", 0 },
+	{ 0x006C, SIZE_LONG, "level 3 autovector", 0 },
+	{ 0x0070, SIZE_LONG, "level 4 autovector", 0 },
+	{ 0x0074, SIZE_LONG, "level 5 autovector", 0 },
+	{ 0x0078, SIZE_LONG, "level 6 autovector", 0 },
+	{ 0x007c, SIZE_LONG, "level 7 autovector", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x0080, SIZE_LONG, "trap #0", 0 },
+	{ 0x0084, SIZE_LONG, "trap #1 (GEMDOS)", 0 },
+	{ 0x0088, SIZE_LONG, "trap #2 (AES/VDI)", 0 },
+	{ 0x008C, SIZE_LONG, "trap #3", 0 },
+	{ 0x0090, SIZE_LONG, "trap #4", 0 },
+	{ 0x0094, SIZE_LONG, "trap #5", 0 },
+	{ 0x0098, SIZE_LONG, "trap #6", 0 },
+	{ 0x009C, SIZE_LONG, "trap #7", 0 },
+	{ 0x00A0, SIZE_LONG, "trap #8", 0 },
+	{ 0x00A4, SIZE_LONG, "trap #9", 0 },
+	{ 0x00A8, SIZE_LONG, "trap #10", 0 },
+	{ 0x00AC, SIZE_LONG, "trap #11", 0 },
+	{ 0x00B0, SIZE_LONG, "trap #12", 0 },
+	{ 0x00B4, SIZE_LONG, "trap #13 (BIOS)", 0 },
+	{ 0x00B8, SIZE_LONG, "trap #14 (XBIOS)", 0 },
+	{ 0x00BC, SIZE_LONG, "trap #15", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x00C0, SIZE_LONG, "branch on unordered", SYS_FPU },
+	{ 0x00C4, SIZE_LONG, "inexact result", SYS_FPU },
+	{ 0x00C8, SIZE_LONG, "divide by zero", SYS_FPU },
+	{ 0x00CC, SIZE_LONG, "underflow", SYS_FPU },
+	{ 0x00D0, SIZE_LONG, "operand error", SYS_FPU },
+	{ 0x00D4, SIZE_LONG, "overflow", SYS_FPU },
+	{ 0x00D8, SIZE_LONG, "signaling NaN", SYS_FPU },
+	{ 0x00DC, SIZE_LONG, "unimplemented data type", SYS_FPU|SYS_040 },
+	{ 0x00E0, SIZE_LONG, "MMU configuration error", SYS_PMMU },
+	{ 0x00E4, SIZE_LONG, "illegal operation", SYS_PMMU },
+	{ 0x00E8, SIZE_LONG, "access level violation", SYS_PMMU },
+	{ 0x00F0, SIZE_LONG, "unimplemented EA", SYS_PMMU|SYS_040 },
+	{ 0x00F4, SIZE_LONG, "unimplemented int. inst", SYS_PMMU|SYS_040 },
+	{ 0, 0, 0, 0 },
+	{ 0x0100, SIZE_LONG, "centronics busy", 0 },
+	{ 0x0104, SIZE_LONG, "RS-232 DCD", 0 },
+	{ 0x0108, SIZE_LONG, "RS-232 CTS", 0 },
+	{ 0x010C, SIZE_LONG, "DSP Interrupt", SYS_DSP },
+	{ 0x010C, SIZE_LONG, "Blitter done", SYS_BLITTER },
+	{ 0x0110, SIZE_LONG, "timer D", 0 },
+	{ 0x0114, SIZE_LONG, "timer C", 0 },
+	{ 0x0118, SIZE_LONG, "keyboard/midi", 0 },
+	{ 0x011C, SIZE_LONG, "FDC/HDC/SCSI/IDE", 0 },
+	{ 0x0120, SIZE_LONG, "timer B (HBL)", 0 },
+	{ 0x0124, SIZE_LONG, "RS-232 send error", 0 },
+	{ 0x0128, SIZE_LONG, "RS-232 send buffer empty", 0 },
+	{ 0x012C, SIZE_LONG, "RS-232 receive error", 0 },
+	{ 0x0130, SIZE_LONG, "RS-232 receive buffer full", 0 },
+	{ 0x0134, SIZE_LONG, "timer A", 0 },
+	{ 0x0138, SIZE_LONG, "RS-232 ring detect", 0 },
+	{ 0x013C, SIZE_LONG, "monochrome detect", 0 },
+	{ 0x0140, SIZE_LONG, "TTMFP GPI 0", SYS_MACHINE_TT },
+	{ 0x0144, SIZE_LONG, "TTMFP GPI 1", SYS_MACHINE_TT },
+	{ 0x0148, SIZE_LONG, "SCC DMA", SYS_MACHINE_TT },
+	{ 0x014C, SIZE_LONG, "ring indicator SCC B", SYS_MACHINE_TT },
+	{ 0x0150, SIZE_LONG, "TTMFP timer D", SYS_MACHINE_TT },
+	{ 0x0154, SIZE_LONG, "TTMFP timer C", SYS_MACHINE_TT },
+	{ 0x0158, SIZE_LONG, "TTMFP GPI 4", SYS_MACHINE_TT },
+	{ 0x015C, SIZE_LONG, "SCSI DMA", SYS_MACHINE_TT },
+	{ 0x0160, SIZE_LONG, "TTMFP timer B", SYS_MACHINE_TT },
+	{ 0x0164, SIZE_LONG, "TTMFP send error", SYS_MACHINE_TT },
+	{ 0x0168, SIZE_LONG, "TTMFP send buffer empty", SYS_MACHINE_TT },
+	{ 0x016C, SIZE_LONG, "TTMFP receive error", SYS_MACHINE_TT },
+	{ 0x0170, SIZE_LONG, "TTMFP receive buffer full", SYS_MACHINE_TT },
+	{ 0x0174, SIZE_LONG, "TTMFP timer A", SYS_MACHINE_TT },
+	{ 0x0178, SIZE_LONG, "TTMFP clock", SYS_MACHINE_TT },
+	{ 0x017C, SIZE_LONG, "NCR5380", SYS_MACHINE_TT },
+	{ 0x0180, SIZE_LONG, "SCC B transmit buffer empty", SYS_MACHINE_TT },
+	{ 0x0184, SIZE_LONG, "SCC B external status", SYS_MACHINE_TT },
+	{ 0x0188, SIZE_LONG, "SCC B receive buffer full", SYS_MACHINE_TT },
+	{ 0x018C, SIZE_LONG, "SCC B special receive", SYS_MACHINE_TT },
+	{ 0x0190, SIZE_LONG, "SCC A transmit buffer empty", SYS_MACHINE_TT },
+	{ 0x0194, SIZE_LONG, "SCC A external status", SYS_MACHINE_TT },
+	{ 0x0198, SIZE_LONG, "SCC A receive buffer full", SYS_MACHINE_TT },
+	{ 0x019C, SIZE_LONG, "SCC A special receive", SYS_MACHINE_TT },
+	{ 0x03FC, SIZE_LONG, "DSP io", SYS_DSP },
+	{ 0, 0, 0, 0 },
+	{ 0x0400, SIZE_LONG, "etv_timer: GEM Event timer vector", 0 },
+	{ 0x0404, SIZE_LONG, "etv_critic: GEM Critical error handler", 0 },
+	{ 0x0408, SIZE_LONG, "etv_term: GEM Program termination vector", 0 },
+	{ 0x040c, SIZE_LONG, "etv_xtra[0]: GEM Additional vector #1", 0 },
+	{ 0x0410, SIZE_LONG, "etv_xtra[1]: GEM Additional vector #2", 0 },
+	{ 0x0414, SIZE_LONG, "etv_xtra[2]: GEM Additional vector #3", 0 },
+	{ 0x0418, SIZE_LONG, "etv_xtra[3]: GEM Additional vector #4", 0 },
+	{ 0x041c, SIZE_LONG, "etv_xtra[4]: GEM Additional vector #5", 0 },
+	{ 0x0420, SIZE_LONG, "memvalid: Validates memory configuration", 0 },
+	{ 0x0424, SIZE_BYTE, "memctrl: Copy of contents of $FF8001", 0 },
+	{ 0x0426, SIZE_LONG, "resvalid: Validates resvector if $31415926", 0 },
+	{ 0x042a, SIZE_LONG, "resvector: Reset vector", 0 },
+	{ 0x042e, SIZE_LONG, "phystop: Physical top of RAM", 0 },
+	{ 0x0432, SIZE_LONG, "_membot: Start of TPA (user memory)", 0 },
+	{ 0x0436, SIZE_LONG, "_memtop: End of TPA (user memory)", 0 },
+	{ 0x043a, SIZE_LONG, "memval2: Validates memctrl and memconf if $237698AA", 0 },
+	{ 0x043e, SIZE_WORD, "flock: lock floppy VBL routine", 0 },
+	{ 0x0440, SIZE_WORD, "seekrate: Floppy Seek rate - 0:6ms, 1:12ms, 2:2ms, 3:3ms", 0 },
+	{ 0x0442, SIZE_WORD, "_timer_s: Time between two timer calls", 0 },
+	{ 0x0444, SIZE_WORD, "_fverify: verify floppy disk writes", 0 },
+	{ 0x0446, SIZE_WORD, "_bootdev: Default boot device", 0 },
+	{ 0x0448, SIZE_WORD, "palmode: 0 - NTSC (60hz), <>0 - PAL (50hz)", 0 },
+	{ 0x044a, SIZE_BYTE, "defshiftmod: Default video resolution", 0 },
+	{ 0x044c, SIZE_BYTE, "sshiftmod: Copy of contents of $FF8260", 0 },
+	{ 0x044e, SIZE_LONG, "_v_bas_ad: Pointer to video RAM (logical screen base)", 0 },
+	{ 0x0452, SIZE_WORD, "vblsem: lock VBL routines", 0 },
+	{ 0x0454, SIZE_WORD, "nvbls: Number of vertical blank routines", 0 },
+	{ 0x0456, SIZE_LONG, "_vblqueue: Pointer to list of vertical blank routines", 0 },
+	{ 0x045A, SIZE_LONG, "colorptr: points to color palette to be loaded", 0 },
+	{ 0x045E, SIZE_LONG, "screenptr: points to video ram for next VBL", 0 },
+	{ 0x0462, SIZE_LONG, "_vbclock: Counter for number of VBLs", 0 },
+	{ 0x0466, SIZE_LONG, "_frclock: Number of VBL routines executed", 0 },
+	{ 0x046a, SIZE_LONG, "hdv_init: Vector for hard disk initialization", 0 },
+	{ 0x046e, SIZE_LONG, "swv_vec: Vector for resolution change", 0 },
+	{ 0x0472, SIZE_LONG, "hdv_bpb: Vector for getbpb for hard disk", 0 },
+	{ 0x0476, SIZE_LONG, "hdv_rw: Vector for read/write routine for hard disk", 0 },
+	{ 0x047a, SIZE_LONG, "hdv_boot: Vector for hard disk boot", 0 },
+	{ 0x047e, SIZE_LONG, "hdv_mediach: Vector for hard disk media change", 0 },
+	{ 0x0482, SIZE_WORD, "_cmdload: attempt to load \"COMMAND.PRG\" on boot", 0 },
+	{ 0x0484, SIZE_BYTE, "conterm: Attribute vector for console output", 0 },
+	{ 0x0486, SIZE_LONG, "trp14ret: Return address for TRAP #14", 0 },
+	{ 0x048a, SIZE_LONG, "criticret: Return address for critical error handler", 0 },
+	{ 0x048e, SIZE_LONG, "themd.m_link: Memory descriptor block", 0 },
+	{ 0x0492, SIZE_LONG, "themd.m_start: Memory descriptor block", 0 },
+	{ 0x0496, SIZE_LONG, "themd.m_length: Memory descriptor block", 0 },
+	{ 0x049a, SIZE_LONG, "themd.m_own: Memory descriptor block", 0 },
+	{ 0x049e, SIZE_LONG, "themdmd: Space for additional memory descriptors", 0 },
+	{ 0x04a2, SIZE_LONG, "savptr: Pointer to BIOS save registers block", 0 },
+	{ 0x04a6, SIZE_WORD, "_nflopsNumber of connected floppy drives", 0 },
+	{ 0x04a8, SIZE_LONG, "con_state: Vector for screen output", 0 },
+	{ 0x04ac, SIZE_WORD, "save_row: Temporary storage for cursor line position", 0 },
+	{ 0x04ae, SIZE_LONG, "sav_context: Pointer to save area for exception processing", 0 },
+	{ 0x04b2, SIZE_LONG, "_bufl[0]: Pointer to buffer control block for GEMDOS data", 0 },
+	{ 0x04b6, SIZE_LONG, "_bufl[1]: Pointer to buffer control block for GEMDOS fat/dir", 0 },
+	{ 0x04ba, SIZE_LONG, "_hz_200: Counter for 200hz system clock", 0 },
+	{ 0x04be, SIZE_LONG, "the_env: Pointer to default environment string", 0 },
+	{ 0x04c2, SIZE_LONG, "_drvbits: Bit allocation for physical drives", 0 },
+	{ 0x04c6, SIZE_LONG, "_dskbufp: Pointer to 1024-byte disk buffer", 0 },
+	{ 0x04ca, SIZE_LONG, "_autopath: Pointer to autoexecute path", 0 },
+	{ 0x04ce, SIZE_LONG, "_vbl_lis[0]: Pointer to VBL routine #1", 0 },
+	{ 0x04de, SIZE_LONG, "_vbl_lis[1]: Pointer to VBL routine #2", 0 },
+	{ 0x04d6, SIZE_LONG, "_vbl_lis[2]: Pointer to VBL routine #3", 0 },
+	{ 0x04da, SIZE_LONG, "_vbl_lis[3]: Pointer to VBL routine #4", 0 },
+	{ 0x04de, SIZE_LONG, "_vbl_lis[4]: Pointer to VBL routine #5", 0 },
+	{ 0x04e2, SIZE_LONG, "_vbl_lis[5]: Pointer to VBL routine #6", 0 },
+	{ 0x04e6, SIZE_LONG, "_vbl_lis[6]: Pointer to VBL routine #7", 0 },
+	{ 0x04ea, SIZE_LONG, "_vbl_lis[7]: Pointer to VBL routine #8", 0 },
+	{ 0x04ee, SIZE_WORD, "_dumpflg: Flag for screen -> printer dump", 0 },
+	{ 0x04f0, SIZE_WORD, "_prtabt: Printer abort flag", 0 },
+	{ 0x04f2, SIZE_LONG, "_sysbase: Pointer to start of OS", 0 },
+	{ 0x04f6, SIZE_LONG, "_shell_p: Global shell pointer", 0 },
+	{ 0x04fa, SIZE_LONG, "end_os: Pointer to end of OS", 0 },
+	{ 0x04fe, SIZE_LONG, "exec_os: Pointer to entry point of OS", 0 },
+	{ 0x0502, SIZE_LONG, "scr_dmp: Pointer to screen dump routine", 0 },
+	{ 0x0506, SIZE_LONG, "prt_stat: Pointer to _lstostat()", 0 },
+	{ 0x050a, SIZE_LONG, "prt_vec: Pointer to _lstout()", 0 },
+	{ 0x050e, SIZE_LONG, "aux_stat: Pointer to _auxostat()", 0 },
+	{ 0x0512, SIZE_LONG, "aux_vec: Pointer to _auxout()", 0 },
+	{ 0x0516, SIZE_LONG, "pun_ptr: pointer to pun_info", 0 },
+	{ 0x051a, SIZE_LONG, "memval3: If $5555AAAA, reset", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x051e, SIZE_LONG, "xconstat[0]: 8 Pointers to input-status routines", 0 },
+	{ 0x0522, SIZE_LONG, "xconstat[1]: 8 Pointers to input-status routines", 0 },
+	{ 0x0526, SIZE_LONG, "xconstat[2]: 8 Pointers to input-status routines", 0 },
+	{ 0x052a, SIZE_LONG, "xconstat[3]: 8 Pointers to input-status routines", 0 },
+	{ 0x052e, SIZE_LONG, "xconstat[4]: 8 Pointers to input-status routines", 0 },
+	{ 0x0532, SIZE_LONG, "xconstat[5]: 8 Pointers to input-status routines", 0 },
+	{ 0x0536, SIZE_LONG, "xconstat[6]: 8 Pointers to input-status routines", 0 },
+	{ 0x053a, SIZE_LONG, "xconstat[7]: 8 Pointers to input-status routines", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x053e, SIZE_LONG, "xconin[0]: 8 Pointers to input routines", 0 },
+	{ 0x0542, SIZE_LONG, "xconin[1]: 8 Pointers to input routines", 0 },
+	{ 0x0546, SIZE_LONG, "xconin[2]: 8 Pointers to input routines", 0 },
+	{ 0x054a, SIZE_LONG, "xconin[3]: 8 Pointers to input routines", 0 },
+	{ 0x054e, SIZE_LONG, "xconin[4]: 8 Pointers to input routines", 0 },
+	{ 0x0552, SIZE_LONG, "xconin[5]: 8 Pointers to input routines", 0 },
+	{ 0x0556, SIZE_LONG, "xconin[6]: 8 Pointers to input routines", 0 },
+	{ 0x055a, SIZE_LONG, "xconin[7]: 8 Pointers to input routines", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x055e, SIZE_LONG, "xcostat[0]: 8 Pointers to output-status routines", 0 },
+	{ 0x0562, SIZE_LONG, "xcostat[1]: 8 Pointers to output-status routines", 0 },
+	{ 0x0566, SIZE_LONG, "xcostat[2]: 8 Pointers to output-status routines", 0 },
+	{ 0x056a, SIZE_LONG, "xcostat[3]: 8 Pointers to output-status routines", 0 },
+	{ 0x056e, SIZE_LONG, "xcostat[4]: 8 Pointers to output-status routines", 0 },
+	{ 0x0572, SIZE_LONG, "xcostat[5]: 8 Pointers to output-status routines", 0 },
+	{ 0x0576, SIZE_LONG, "xcostat[6]: 8 Pointers to output-status routines", 0 },
+	{ 0x057a, SIZE_LONG, "xcostat[7]: 8 Pointers to output-status routines", 0 },
+	{ 0x057e, SIZE_LONG, "xconout[0]: 8 Pointers to output routines", 0 },
+	{ 0x0582, SIZE_LONG, "xconout[1]: 8 Pointers to output routines", 0 },
+	{ 0x0586, SIZE_LONG, "xconout[2]: 8 Pointers to output routines", 0 },
+	{ 0x058a, SIZE_LONG, "xconout[3]: 8 Pointers to output routines", 0 },
+	{ 0x058e, SIZE_LONG, "xconout[4]: 8 Pointers to output routines", 0 },
+	{ 0x0592, SIZE_LONG, "xconout[5]: 8 Pointers to output routines", 0 },
+	{ 0x0596, SIZE_LONG, "xconout[6]: 8 Pointers to output routines", 0 },
+	{ 0x059a, SIZE_LONG, "xconout[7]: 8 Pointers to output routines", 0 },
+	{ 0, 0, 0, 0 },
+	{ 0x059e, SIZE_WORD, "_longframe: If not 0, then not 68000", 0 },
+	{ 0x05a0, SIZE_LONG, "_p_cookies: Pointer to cookie jar", 0 },
+	{ 0x05a4, SIZE_LONG, "ramtop: Pointer to end of FastRam", 0 },
+	{ 0x05a8, SIZE_LONG, "ramvalid: Validates ramtop if $1357BD13", 0 },
+	{ 0x05ac, SIZE_LONG, "bell_hook: Pointer to routine for system bell", 0 },
+	{ 0x05b2, SIZE_LONG, "kcl_hook: Pointer to routine for system keyclick", 0 },
+};
+
+
+/**
+ * DebugInfo_SysVars: display contents of system variables
+ */
+static void DebugInfo_SysVars(FILE *fp, Uint32 dummy)
+{
+	unsigned int i;
+	
+	fprintf(fp, "System variables:\n");
+	for (i = 0; i < sizeof(sysvars) / sizeof(sysvars[0]); i++)
+	{
+		if (sysvars[i].size == 0 && sysvars[i].desc == 0)
+		{
+			fprintf(fp, "---------------------------------------------------------------------------------\n");
+			continue;
+		}
+		if ((sysvars[i].flags & SYS_PMMU) && !ConfigureParams.System.bMMU)
+			continue;
+		if ((sysvars[i].flags & SYS_040) && ConfigureParams.System.nCpuLevel < 4)
+			continue;
+		if ((sysvars[i].flags & SYS_DSP) && !bDspEnabled)
+			continue;
+		if ((sysvars[i].flags & SYS_FPU) && ConfigureParams.System.n_FPUType == FPU_NONE)
+			continue;
+		if ((sysvars[i].flags & SYS_BLITTER) && bDspEnabled)
+			continue;
+		fprintf(fp, "0x%04x: %-62s ", sysvars[i].addr, sysvars[i].desc);
+		switch (sysvars[i].size)
+		{
+		case SIZE_BYTE:
+			fprintf(fp, "0x%02x", STMemory_ReadByte(sysvars[i].addr));
+			break;
+		case SIZE_WORD:
+			fprintf(fp, "0x%04x", STMemory_ReadWord(sysvars[i].addr));
+			break;
+		case SIZE_LONG:
+			fprintf(fp, "0x%08x", STMemory_ReadLong(sysvars[i].addr));
+			break;
+		default:
+			abort();
+			break;
+		}
+		fprintf(fp, "\n");
+	}
+	
+}
+
 /**
  * DebugInfo_Cookiejar: display TOS Cookiejar content
  */
@@ -676,6 +957,7 @@
 	{ false,"osheader",  DebugInfo_OSHeader,   NULL, "Show TOS OS header contents" },
 	{ true, "regaddr",   DebugInfo_RegAddr, DebugInfo_RegAddrArgs, "Show <disasm|memdump> from CPU/DSP address pointed by <register>" },
 	{ true, "registers", DebugInfo_CpuRegister,NULL, "Show CPU register contents" },
+	{ false,"sysvars",   DebugInfo_SysVars,    NULL, "Show system variables" },
 	{ false,"vdi",       VDI_Info,             NULL, "Show VDI vector contents (with <value>, show opcodes)" },
 	{ false,"videl",     Videl_Info,           NULL, "Show Falcon Videl register contents" },
 	{ false,"video",     Video_Info,           NULL, "Show Video information" },


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/