diff --git a/PDP10/kx10_cpu.c b/PDP10/kx10_cpu.c index 4f13244..3bfe4d1 100644 --- a/PDP10/kx10_cpu.c +++ b/PDP10/kx10_cpu.c @@ -230,7 +230,10 @@ uint32 fault_addr; /* Fault address */ uint64 opc; /* Saved PC and Flags */ uint64 mar; /* Memory address compare */ uint32 qua_time; /* Quantum clock value */ -#endif +#if MAGIC_SWITCH +int MAGIC = 1; /* Magic switch. */ +#endif /* MAGIC_SWITCH */ +#endif /* ITS */ #if KL_ITS #define dbr1 FM[(6<<4)|1] #define dbr2 FM[(6<<4)|2] @@ -464,7 +467,10 @@ REG cpu_reg[] = { { ORDATAD (OPC, opc, 36, "Saved PC and flags")}, { ORDATAD (MAR, mar, 18, "Memory address register")}, { ORDATAD (QUA_TIME, qua_time, 36, "Quantum timer"), REG_RO}, -#endif +#if MAGIC_SWITCH + { ORDATAD (MAGIC, MAGIC, 1, "Magic switch"), REG_FIT}, +#endif /* MAGIC_SWITCH */ +#endif /* ITS */ #if KL { ORDATAD (EXT_AC, ext_ac, 4, "Extended Instruction AC"), REG_HRO}, { ORDATAD (PREV_CTX, prev_ctx, 5, "Previous context"), REG_HRO}, @@ -4037,6 +4043,13 @@ if ((reason = build_dev_tab ()) != SCPE_OK) /* build, chk dib_tab */ break; } +#if MAGIC_SWITCH + if (!MAGIC) { + reason = STOP_MAGIC; + break; + } +#endif /* MAGIC_SWITCH */ + check_apr_irq(); /* Normal instruction */ if (f_load_pc) { diff --git a/PDP10/kx10_defs.h b/PDP10/kx10_defs.h index 90db1cf..f7f9434 100644 --- a/PDP10/kx10_defs.h +++ b/PDP10/kx10_defs.h @@ -86,6 +86,10 @@ #define PDP6_DEV PDP6|WAITS #endif +#ifndef MAGIC_SWITCH /* Infamous MIT magic switch. */ +#define MAGIC_SWITCH 0 +#endif + /* MPX interrupt multiplexer for ITS systems */ #define MPX_DEV ITS @@ -132,6 +136,10 @@ typedef t_uint64 uint64; #define STOP_HALT 1 /* halted */ #define STOP_IBKPT 2 /* breakpoint */ +#define STOP_ACCESS 3 /* invalid access */ +#if MAGIC_SWITCH +#define STOP_MAGIC 4 /* low on magic */ +#endif /* Debuging controls */ #define DEBUG_CMD 0x0000001 /* Show device commands */ @@ -628,6 +636,10 @@ int auxcpu_write (t_addr addr, t_uint64); #define NUM_DEVS_DPK ITS #define NUM_DEVS_AI ITS #endif +#if MAGIC_SWITCH && !KA && !ITS +#error "Magic switch only valid on KA10 with ITS mods" +#endif + /* Global data */ diff --git a/PDP10/kx10_sys.c b/PDP10/kx10_sys.c index e0db37b..f5eb1d0 100644 --- a/PDP10/kx10_sys.c +++ b/PDP10/kx10_sys.c @@ -213,7 +213,10 @@ const char *sim_stop_messages[] = { "Unknown error", "HALT instruction", "Breakpoint", - "Invalid access" + "Invalid access", +#if MAGIC_SWITCH + "No magic" +#endif }; /* Simulator debug controls */