1
0
mirror of https://github.com/simh/simh.git synced 2026-03-02 01:40:43 +00:00

AltairZ80: Fix HALT stop code conflict with ON ERROR

AltairZ80 uses 0 for the VM-specific HLT instruction stop code.
SCP defines SCPE_OK as 0.
SCP uses 0 to mean all errors ("ON ERROR").

The command "ON 0" will generate "%SIM-ERROR: Invalid argument: 0".

This PR changes the HALT stop code from 0 to 5.
This commit is contained in:
Patrick Linstruth
2022-11-27 06:28:03 -08:00
committed by Mark Pizzolato
parent 6fdc5a2a2b
commit 7b104931e0
3 changed files with 5 additions and 4 deletions

View File

@@ -63,11 +63,11 @@ typedef enum {
} ChipType;
/* simulator stop codes */
#define STOP_HALT 0 /* HALT */
#define STOP_IBKPT 1 /* breakpoint (program counter) */
#define STOP_MEM 2 /* breakpoint (memory access) */
#define STOP_INSTR 3 /* breakpoint (instruction access) */
#define STOP_OPCODE 4 /* invalid operation encountered (8080, Z80, 8086) */
#define STOP_HALT 5 /* HALT */
#define UNIT_CPU_V_OPSTOP (UNIT_V_UF+0) /* stop on invalid operation */
#define UNIT_CPU_OPSTOP (1 << UNIT_CPU_V_OPSTOP)

View File

@@ -156,11 +156,12 @@ DEVICE *sim_devices[] = {
static char memoryAccessMessage[256];
static char instructionMessage[256];
const char *sim_stop_messages[SCPE_BASE] = {
"HALT instruction",
"Unknown error", /* 0 is reserved/unknown */
"Breakpoint",
memoryAccessMessage,
instructionMessage,
"Invalid Opcode"
"Invalid Opcode",
"HALT instruction"
};
static const char *const Mnemonics8080[] = {

2
scp.c
View File

@@ -9763,7 +9763,7 @@ t_value pcval;
fputc ('\n', st); /* start on a new line */
if (v >= SCPE_BASE) /* SCP error? */
if (v == SCPE_OK || v >= SCPE_BASE) /* SCP error? */
fputs (sim_error_text (v), st); /* print it from the SCP list */
else { /* VM error */
if (sim_stop_messages [v])