1
0
mirror of https://github.com/open-simh/simh.git synced 2026-02-02 06:51:42 +00:00

HP2100: Release 30

This commit is contained in:
J. David Bryan
2021-01-19 19:28:56 -08:00
committed by Mark Pizzolato
parent 685ca317a3
commit 0e119d70bb
12 changed files with 12579 additions and 10491 deletions

View File

@@ -1,7 +1,7 @@
/* hp2100_cpu.c: HP 21xx/1000 Central Processing Unit simulator
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -28,6 +28,10 @@
I/O subsystem
Power Fail Recovery System
26-Aug-20 JDB Fixed tracing for I/O error simulation stops
Corrected line ends for trace to stdout
"set_model" now clears the X and Y registers for 21xx CPUs
04-Jul-20 JDB Postlude trace now calls "sim_error_text" unconditionally
08-Dec-19 JDB Added "hp_reset_poll" call to "cpu_reset"
03-Jul-19 JDB Substituted BP_EXEC for explicit 'E' switch in sim_brk_test
08-Apr-19 JDB Suppress stop messages for step and breakpoints in DO files
@@ -2140,6 +2144,9 @@ while (status == SCPE_OK) { /* execute until simulat
fprint_val (sim_deb, sim_eval [0], cpu_dev.dradix, /* then print the numeric */
cpu_dev.dwidth, PV_RZRO); /* value again */
if (sim_deb == stdout) /* if debug output is to the (raw) console */
fputc ('\r', sim_deb); /* then insert a carriage return */
fputc ('\n', sim_deb); /* end the trace with a newline */
}
@@ -2190,12 +2197,20 @@ pcq_r->qptr = pcq_p; /* update the PC queue p
sim_brk_dflt = meu_breakpoint_type (FALSE); /* base the default breakpoint type on the current MEM state */
if (TRACING (cpu_dev, cpu_dev.dctrl) /* if instruction tracing is enabled */
&& status <= SCPE_LAST) /* and the status is valid */
&& status <= SCPE_LAST) { /* and the status is valid */
hp_trace (&cpu_dev, cpu_dev.dctrl, /* then output the simulation stop reason */
DMS_FORMAT "simulation stop: %s\n",
DMS_FORMAT "simulation stop: %s",
meu_indicator, meu_page, MR, TR,
status >= SCPE_BASE ? sim_error_text (status)
: sim_stop_messages [status]);
sim_error_text (status));
if (cpu_ioerr_uptr) /* if this is an I/O error stop */
sim_vm_fprint_stopped (sim_deb, status); /* then add additional information */
if (sim_deb == stdout) /* if debug output is to the (raw) console */
fputc ('\r', sim_deb); /* then insert a carriage return */
fputc ('\n', sim_deb); /* tie off the line */
}
if (sim_switches & SIM_SW_HIDE /* if executing in a non-echoing command file */
&& (status == SCPE_STEP || status == STOP_BRKPNT)) /* and a step or breakpoint stop occurs */
@@ -3795,6 +3810,10 @@ return SCPE_OK;
For logical tests that depend on this, it is faster (by one x86 machine
instruction) to test the "cpu_configuration" variable for the presence of
one of the three 1000 model flags.
3. The index registers (X and Y) are cleared when the model is set to a 21xx
CPU, which does not have index registers. This is required for the
"mem_trace_registers" routine to omit the registers from the trace.
*/
static t_stat set_model (UNIT *uptr, int32 new_model, char *cptr, void *desc)
@@ -3836,6 +3855,8 @@ if (result == SCPE_OK) { /* if the change succeed
else { /* otherwise this is a 2100 or 211x */
is_1000 = FALSE; /* so set the model index */
mem_end = mem_size - IBL_SIZE; /* and reserve memory for the loader */
XR = YR = 0; /* clear the (non-existent) index registers */
}
}

View File

@@ -1,7 +1,7 @@
/* hp2100_defs.h: HP 2100 simulator architectural declarations
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,7 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the authors.
17-Aug-20 JDB Corrected "cputc" definition
08-Dec-19 JDB Added "hp_reset_poll" routine declaration
28-Mar-19 JDB Added extensions
18-Mar-19 JDB Added include for SCP extensions
@@ -308,7 +309,7 @@
#define cputc(ch) \
do { \
putc (ch); \
putchar (ch); \
if (sim_log) \
fputc (ch, sim_log); \
} \

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
/* hp2100_lpt.c: HP 2100 12845B Line Printer Interface simulator
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@
LPT HP 12845B Line Printer Interface
16-Mar-20 JDB Corrected introductory comments.
09-Dec-19 JDB Removed redundant SIM_SW_REST check in "lp_attach"
01-Oct-19 JDB DETACH -F now flushes the print buffer if not empty
26-Jun-18 JDB Revised I/O model
@@ -221,6 +222,7 @@
The format commands recognized by the printers are:
0 0 0 0 0 0 0 -- slew 0 lines (suppress spacing) after printing *
0 0 0 0 0 0 1 -- slew 1 line after printing
...
0 0 0 1 1 1 1 -- slew 15 lines after printing
@@ -228,7 +230,7 @@
...
0 1 1 1 1 1 1 -- slew 63 lines after printing **
* slew 1 line on the 2607A, which cannot suppress printing.
* slew 1 line on the 2607A, which cannot suppress spacing after printing
** available only on the 2610A and 2614A
and:

View File

@@ -1,7 +1,7 @@
/* hp2100_mem.c: HP 21xx/1000 Main Memory/Memory Expansion Module/Memory Protect simulator
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -29,6 +29,7 @@
MEM 12731A Memory Expansion Module
MP 12581A/12892B Memory Protect
26-Aug-20 JDB Consolidated "mem_trace_registers" E/O/I output
27-Mar-19 JDB "dm_violation" now correctly freezes the violation register
02-Aug-18 JDB Added MEM device
30-Jul-18 JDB Renamed "iop_sp" to "SPR" (stack pointer register)
@@ -321,25 +322,29 @@ static const uint32 tbg = 0001674u; /* (RTE) TBG address */
/* Main memory tracing constants */
static const char * const register_values [] = { /* register values, indexed by EOI concatenation */
"e o i", /* E = 0, O = 0, interrupt_system = off */
"e o I", /* E = 0, O = 0, interrupt_system = on */
"e O i", /* E = 0, O = 1, interrupt_system = off */
"e O I", /* E = 0, O = 1, interrupt_system = on */
"E o i", /* E = 1, O = 0, interrupt_system = off */
"E o I", /* E = 1, O = 0, interrupt_system = on */
"E O i", /* E = 1, O = 1, interrupt_system = off */
"E O I" /* E = 1, O = 1, interrupt_system = on */
};
static const char mp_value [] = { /* memory protection value, indexed by mp_control */
'-', /* MP is off */
'P' /* MP is on */
};
static const char * const register_formats [] = { /* CPU register formats, indexed by is_1000 */
REGA_FORMAT " A %06o, B %06o, ", /* is_1000 = FALSE format */
REGA_FORMAT " A %06o, B %06o, X %06o, Y %06o, " /* is_1000 = TRUE format */
static const char e_value [] = { /* extend register value */
'e', /* E is 0 */
'E' /* E is 1 */
};
static const char o_value [] = { /* overflow register value */
'o', /* O is 0 */
'O' /* O is 1 */
};
static const char i_value [] = { /* interrupt system value */
'i', /* interrupt system is off */
'I' /* interrupt system is on */
};
static const char * const register_formats [] = { /* CPU register formats, indexed by is_1000 */
REGA_FORMAT " A %06o, B %06o, %.0u%.0u%c %c %c\n", /* is_1000 = FALSE format */
REGA_FORMAT " A %06o, B %06o, X %06o, Y %06o, %c %c %c\n" /* is_1000 = TRUE format */
};
static const char * const mp_mem_formats [] = { /* MP/MEM register formats, indexed by is_1000 */
@@ -1252,6 +1257,9 @@ else /* otherwise */
1. The "is_1000" flag is used to include or omit, based on the CPU model,
the X and Y registers from the working register trace and the MEVR and
MESR from the memory protection trace.
2. The "%.0u" print specifications in the trace call absorb the zero X and Y
register values without printing them when the CPU is not a 1000.
*/
void mem_trace_registers (FLIP_FLOP interrupt_system)
@@ -1260,10 +1268,9 @@ hp_trace (&cpu_dev, TRACE_REG, /* output the working registers */
register_formats [is_1000], /* using a format appropriate for the CPU model */
mp_value [mp_control],
meu_status & MEST_FENCE_MASK,
SR, AR, BR, XR, YR);
fputs (register_values [E << 2 | O << 1 | interrupt_system], sim_deb); /* output E, O, and interrupt system */
fputc ('\n', sim_deb);
SR, AR, BR, XR, YR,
e_value [E], o_value [O],
i_value [interrupt_system]);
if (mp_mem_changed) { /* if the MP/MEM registers have been altered */
hp_trace (&cpu_dev, TRACE_REG, /* then output the register values */

View File

@@ -26,6 +26,7 @@
MUX,MUXL,MUXC 12920A Asynchronous Multiplexer Interface
21-Oct-20 JDB ATTACH/DETACH MUXL <port> command is now rejected
03-Jan-20 JDB Revised modem control operation, added "muxc_reset"
23-Oct-19 JDB Fixed "muxl_ibuf" value for send interrupts
Fixed "lower_input_format" starting bit number
@@ -1985,7 +1986,7 @@ static t_stat muxl_attach (UNIT *uptr, char *cptr)
{
t_stat status;
status = tmxr_attach_unit (&mux_desc, &mux_poll, uptr, cptr); /* try to attach to the serial port */
status = tmxr_attach_unit (&mux_desc, NULL, uptr, cptr); /* try to attach to the serial port */
if (status == SCPE_OK) { /* if the attach succeeded */
muxu_unit [0].wait = POLL_FIRST; /* then set up the poll */
@@ -2003,7 +2004,7 @@ static t_stat muxl_detach (UNIT *uptr)
t_stat status;
int32 line;
status = tmxr_detach_unit (&mux_desc, &mux_poll, uptr); /* try to detach the serial port */
status = tmxr_detach_unit (&mux_desc, NULL, uptr); /* try to detach the serial port */
if (status == SCPE_OK) { /* if the detach succeeded */
line = uptr - muxl_unit; /* then determine the line number */

View File

@@ -1,7 +1,7 @@
/* hp2100_sys.c: HP 2100 system common interface
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,8 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the authors.
26-Aug-20 JDB Modified "hp_trace" to output CR LFs to stdout
25-Aug-20 JDB Now sets SCP hooks in "one_time_init" routine
08-Dec-19 JDB Added "hp_reset_poll" and "poll_name" routines
04-Mar-19 JDB Added "sim_vm_release" character string declaration
04-Oct-18 JDB Reordered the device list alphabetically
@@ -117,9 +119,9 @@
/* Global release string */
/* Release string */
char *sim_vm_release = "29"; /* HP 2100 simulator release number */
static char *hp_release = "30"; /* HP 2100 simulator release number */
/* Command-line switch parsing from scp.c */
@@ -3395,6 +3397,11 @@ return;
name among the devices enabled for tracing to ensure that all trace lines
will align for easier reading.
Because the prefix is output only once, embedded newlines should not be
present in the format string. If multiple output lines are desired, then
this routine should be called multiple times, so that each line receives an
identifying trace prefix.
Implementation notes:
@@ -3403,6 +3410,23 @@ return;
the latter, we must allocate "sufficiently large" arrays for the flag
name and format, rather than arrays of the exact size required by the
call parameters.
2. If the trace output is being written to stdout, a terminating LF must
be translated to CR LF. This is because the console is in "raw" mode
while the CPU is executing instructions. Output to a file does not need
this processing, as text mode handles the host line-end convention.
3. Handling embedded newlines properly would require multiple calls to
"vfprintf", each preceded by the prefix, and each having a format string
consisting of the next segment that ends with an embedded newline.
However, multiple calls are not allowed. The C standard says:
"As the functions vfprintf [etc.] invoke the va_arg macro, the value of
arg after the return is indeterminate."
So there is no way to have the second (e.g.) call start with those
(variable) parameters not consumed by the prior call. Consequently, the
terminating LF check need only be done at the end of the format string.
*/
#define FLAG_SIZE 32 /* sufficiently large to accommodate all flag names */
@@ -3434,15 +3458,25 @@ if (sim_deb != NULL && dptr != NULL) { /* if the output stream
(int) device_size, sim_dname (dptr), /* while padding the device and flag names */
(int) flag_size, flag_name); /* as needed for proper alignment */
va_start (argptr, flag); /* set up the argument list */
va_start (argptr, flag); /* set up the argument list */
format = va_arg (argptr, char *); /* get the format string parameter */
strcat (header_fmt, format); /* append the supplied format */
format = va_arg (argptr, char *); /* get the format string parameter */
strcat (header_fmt, format); /* append the supplied format */
vfprintf (sim_deb, header_fmt, argptr); /* format and print to the debug stream */
if (sim_deb == stdout) { /* if debug output is to the (raw) console */
fptr = header_fmt + strlen (header_fmt) - 1; /* then find the end of the string */
va_end (argptr); /* clean up the argument list */
break; /* and exit with the job complete */
if (*fptr == '\n') { /* if the format ends with a LF */
*fptr++ = '\r'; /* then replace it */
*fptr++ = '\n'; /* with a CR LF sequence */
*fptr = '\0'; /* and terminate with a NUL */
}
}
vfprintf (sim_deb, header_fmt, argptr); /* format and print to the debug stream */
va_end (argptr); /* clean up the argument list */
break; /* and exit with the job complete */
}
else /* otherwise */
@@ -3453,14 +3487,22 @@ return;
}
/* Make a pair of devices consistent */
/* Make a pair of devices consistent.
Most of the disc and tape devices use two interface cards, designated the
command channel and the data channel. These are simulated with two DEVICE
structures. When a SET <dev> ENABLE or DISABLE command is directed to one of
the cards, the other chard wants to be set to the same state. Calling this
routine with the target card as the first parameter and the other card as the
second parameter will do it.
*/
void hp_enbdis_pair (DEVICE *ccptr, DEVICE *dcptr)
{
if (ccptr->flags & DEV_DIS)
dcptr->flags |= DEV_DIS;
else
dcptr->flags &= ~DEV_DIS;
if (ccptr->flags & DEV_DIS) /* if the target device is disabled */
dcptr->flags |= DEV_DIS; /* then disable the other device */
else /* otherwise */
dcptr->flags &= ~DEV_DIS; /* enable the other device */
return;
}
@@ -3547,12 +3589,13 @@ run_handler = find_cmd ("RUN")->action; /* and the RUN/GO comm
break_handler = find_cmd ("BREAK")->action; /* and the BREAK/NOBREAK command handler */
load_handler = find_cmd ("LOAD")->action; /* and the LOAD command handler */
sim_vm_release = hp_release; /* set up the release string */
sim_vm_cmd = aux_cmds; /* set up the auxiliary command table */
sim_vm_fprint_stopped = fprint_stopped; /* set up the simulation-stop printer */
sim_vm_fprint_addr = fprint_addr; /* set up the address printer */
sim_vm_parse_addr = parse_addr; /* set up the address parser */
sim_vm_post = cpu_post_cmd; /* set up the command post-processor */
sim_vm_unit_name = poll_name; /* set up the custom unit name handler */
sim_vm_fprint_stopped = fprint_stopped; /* set up the simulation-stop printer */
sim_vm_fprint_addr = fprint_addr; /* set up the address printer */
sim_vm_parse_addr = parse_addr; /* set up the address parser */
sim_vm_post = cpu_post_cmd; /* set up the command post-processor */
sim_vm_unit_name = poll_name; /* set up the custom unit name handler */
sim_brk_types = BP_SUPPORTED; /* register the supported breakpoint types */
sim_brk_dflt = BP_ENONE; /* the default breakpoint type is "execution" */

View File

@@ -1,7 +1,7 @@
/* hp2100_tty.c: HP 12531C Buffered Teleprinter Interface simulator
Copyright (c) 1993-2016, Robert M. Supnik
Copyright (c) 2017-2019, J. David Bryan
Copyright (c) 2017-2020, J. David Bryan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@
TTY 12531C Buffered Teleprinter Interface
25-Aug-20 JDB Reset routine now sets up VM unit pointer hooks
03-May-19 JDB Output stall now doubles rescheduling wait
26-Apr-19 JDB Added "vm_console_[in/out]put_unit" declarations
22-Sep-18 JDB RESET -P now resets to original FASTTIME timing
@@ -276,9 +277,6 @@ static UNIT tty_unit [] = {
#define print_unit tty_unit [printer] /* teleprinter printer unit */
#define punch_unit tty_unit [punch] /* teleprinter punch unit */
UNIT *vm_console_input_unit = &key_unit; /* console input unit pointer */
UNIT *vm_console_output_unit = &print_unit; /* console output unit pointer */
/* Device information block */
@@ -576,7 +574,7 @@ return outbound; /* return the outbound s
/* TTY local SCP support routines */
/* Set the keyboad input and print output filters.
/* Set the keyboard input and print output filters.
This validation routine is called to configure the character input filter for
the keyboard unit and the output filter for the print unit. The "value"
@@ -664,7 +662,7 @@ return SCPE_OK; /* mode changes always s
rejected; the unit must be detached first. Otherwise, the device is disabled
by setting the DEV_DIS flag.
In either case, the device is reset, which will restart or cancel the keyboad
In either case, the device is reset, which will restart or cancel the keyboard
poll, as appropriate.
*/
@@ -728,6 +726,9 @@ if (sim_switches & SWMASK ('P')) { /* if this is a power-on
tty.shift_in_data = MARK; /* and preset the input shift register */
fast_data_time = TTY_FAST_TIME; /* restore the initial fast data time */
vm_console_input_unit = &key_unit; /* set up the console input */
vm_console_output_unit = &print_unit; /* and console output unit pointers */
}
if (tty_dev.flags & DEV_DIS) /* if the device is disabled */
@@ -843,7 +844,7 @@ if (tty.mode & CN_INPUT) { /* if the card is set fo
io_assert (&tty_dev, ioa_ENF); /* and the flag */
if (tty.mode & (CN_PRINT | CN_PUNCH)) /* if the printer or punch is enabled */
status = output ((int32) input); /* then scho the received character */
status = output ((int32) input); /* then echo the received character */
else /* otherwise */
status = SCPE_OK; /* silently indicate success */
}