3b2: Support software power-off

This commit is contained in:
Seth Morabito 2017-12-15 13:22:53 -08:00
parent 2260eee423
commit 6b8d8b048e
4 changed files with 15 additions and 1 deletions

View file

@ -105,6 +105,7 @@ noret __libc_longjmp (jmp_buf buf, int val);
#define STOP_EX 5 /* Exception */
#define STOP_ESTK 6 /* Exception stack too deep */
#define STOP_MMU 7 /* Unimplemented MMU Feature */
#define STOP_POWER 8 /* System power-off */
/* Exceptional conditions handled within the instruction loop */
#define ABORT_EXC 1 /* CPU exception */

View file

@ -66,6 +66,9 @@ IU_PORT iu_contty;
/* The timer state */
IU_TIMER_STATE iu_timer_state;
/* The power flag */
t_bool iu_killpower = FALSE;
/* Flags for incrementing mode pointers */
t_bool iu_increment_a = FALSE;
t_bool iu_increment_b = FALSE;
@ -632,6 +635,12 @@ void iu_write(uint32 pa, uint32 val, size_t size)
sim_debug(EXECUTE_MSG, &contty_dev,
">>> SOPR written: %02x\n",
(uint8) val);
/* Bit 2 of the IU output register is used as a soft power
* switch. When set, the machine will power down
* immediately. */
if (val & IU_KILLPWR) {
stop_reason = STOP_POWER;
}
break;
case ROPR:
sim_debug(EXECUTE_MSG, &contty_dev,

View file

@ -113,6 +113,9 @@
#define UM_MASK 0x70
#define UM_SHIFT 4
/* Power-off bit */
#define IU_KILLPWR 0x04
#define PORT_A 0
#define PORT_B 1

View file

@ -72,7 +72,8 @@ const char *sim_stop_messages[] = {
"IRQ",
"Exception/Trap",
"Exception Stack Too Deep",
"Unimplemented MMU Feature"
"Unimplemented MMU Feature",
"System Powered Off"
};
void full_reset()