1. New Features in 2.10-2 The build procedures have changed. There is only one UNIX makefile. To compile without Ethernet support, simply type gmake {target|all} To compile with Ethernet support, type gmake USE_NETWORK=1 {target|all} The Mingw batch files require Mingw release 2 and invoke the Unix makefile. There are still separate batch files for compilation with or without Ethernet support. 1.1 SCP and Libraries - The EVAL command will evaluate a symbolic type-in and display it in numeric form. - The ! command (with no arguments) will launch the host operating system command shell. The ! command (with an argument) executes the argument as a host operating system command. (Code from Mark Pizzolato) - Telnet sessions now recognize BREAK. How a BREAK is transmitted dependent on the particular Telnet client. (Code from Mark Pizzolato) - The sockets library includes code for active connections as well as listening connections. - The RESTORE command will restore saved memory size, if the simulator supports dynamic memory resizing. 1.2 PDP-1 - The PDP-1 supports the Type 24 serial drum (based on recently discovered documents). 1.3 18b PDP's - The PDP-4 supports the Type 24 serial drum (based on recently discovered documents). 1.4 PDP-11 - The PDP-11 implements a stub DEUNA/DELUA (XU). The real XU module will be included in a later release. 1.5 PDP-10 - The PDP-10 implements a stub DEUNA/DELUA (XU). The real XU module will be included in a later release. 1.6 HP 2100 - The IOP microinstruction set is supported for the 21MX as well as the 2100. - The HP2100 supports the Access Interprocessor Link (IPL). 1.7 VAX - If the VAX console is attached to a Telnet session, BREAK is interpreted as console halt. - The SET/SHOW HISTORY commands enable and display a history of the most recently executed instructions. (Code from Mark Pizzolato) 1.8 Terminals Multiplexors - BREAK detection was added to the HP, DEC, and Interdata terminal multiplexors. 1.9 Interdata 16b and 32b - First release. UNIX is not yet working. 1.10 SDS 940 - First release. 2. Bugs Fixed in 2.10-2 - PDP-11 console must default to 7b for early UNIX compatibility. - PDP-11/VAX TMSCP emulator was using the wrong packet length for read/write end packets. - Telnet IAC+IAC processing was fixed, both for input and output (found by Mark Pizzolato). - PDP-11/VAX Ethernet setting flag bits wrong for chained descriptors (found by Mark Pizzolato). 3. New Features in 2.10 vs prior releases 3.1 SCP and Libraries - The VT emulation package has been replaced by the capability to remote the console to a Telnet session. Telnet clients typically have more complete and robust VT100 emulation. - Simulated devices may now have statically allocated buffers, in addition to dynamically allocated buffers or disk-based data stores. - The DO command now takes substitutable arguments (max 9). In command files, %n represents substitutable argument n. - The initial command line is now interpreted as the command name and substitutable arguments for a DO command. This is backward compatible to prior versions. - The initial command line parses switches. -Q is interpreted as quiet mode; informational messages are suppressed. - The HELP command now takes an optional argument. HELP <cmd> types help on the specified command. - Hooks have been added for implementing GUI-based consoles, as well as simulator-specific command extensions. A few internal data structures and definitions have changed. - Two new routines (tmxr_open_master, tmxr_close_master) have been added to sim_tmxr.c. The calling sequence for sim_accept_conn has been changed in sim_sock.c. - The calling sequence for the VM boot routine has been modified to add an additional parameter. - SAVE now saves, and GET now restores, controller and unit flags. - Library sim_ether.c has been added for Ethernet support. 3.2 VAX - Non-volatile RAM (NVR) can behave either like a memory or like a disk-based peripheral. If unattached, it behaves like memory and is saved and restored by SAVE and RESTORE, respectively. If attached, its contents are loaded from disk by ATTACH and written back to disk at DETACH and EXIT. - SHOW <device> VECTOR displays the device's interrupt vector. A few devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The TK50 (TMSCP tape) has been added. - The DEQNA/DELQA (Qbus Ethernet controllers) have been added. - Autoconfiguration support has been added. - The paper tape reader has been removed from vax_stddev.c and now references a common implementation file, dec_pt.h. - Examine and deposit switches now work on all devices, not just the CPU. - Device address conflicts are not detected until simulation starts. 3.3 PDP-11 - SHOW <device> VECTOR displays the device's interrupt vector. Most devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The TK50 (TMSCP tape), RK611/RK06/RK07 (cartridge disk), RX211 (double density floppy), and KW11P programmable clock have been added. - The DEQNA/DELQA (Qbus Ethernet controllers) have been added. - Autoconfiguration support has been added. - The paper tape reader has been removed from pdp11_stddev.c and now references a common implementation file, dec_pt.h. - Device bootstraps now use the actual CSR specified by the SET ADDRESS command, rather than just the default CSR. Note that PDP-11 operating systems may NOT support booting with non-standard addresses. - Specifying more than 256KB of memory, or changing the bus configuration, causes all peripherals that are not compatible with the current bus configuration to be disabled. - Device address conflicts are not detected until simulation starts. 3.4 PDP-10 - SHOW <device> VECTOR displays the device's interrupt vector. A few devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The RX211 (double density floppy) has been added; it is off by default. - The paper tape now references a common implementation file, dec_pt.h. - Device address conflicts are not detected until simulation starts. 3.5 PDP-1 - DECtape (then known as MicroTape) support has been added. - The line printer and DECtape can be disabled and enabled. 3.6 PDP-8 - The RX28 (double density floppy) has been added as an option to the existing RX8E controller. - SHOW <device> DEVNO displays the device's device number. Most devices allow the device number to be changed with SET <device> DEVNO=nnn. - Device number conflicts are not detected until simulation starts. 3.7 IBM 1620 - The IBM 1620 simulator has been released. 3.8 AltairZ80 - A hard drive has been added for increased storage. - Several bugs have been fixed. 3.9 HP 2100 - The 12845A has been added and made the default line printer (LPT). The 12653A has been renamed LPS and is off by default. It also supports the diagnostic functions needed to run the DCPC and DMS diagnostics. - The 12557A/13210A disk defaults to the 13210A (7900/7901). - The 12559A magtape is off by default. - New CPU options (EAU/NOEAU) enable/disable the extended arithmetic instructions for the 2116. These instructions are standard on the 2100 and 21MX. - New CPU options (MPR/NOMPR) enable/disable memory protect for the 2100 and 21MX. - New CPU options (DMS/NODMS) enable/disable the dynamic mapping instructions for the 21MX. - The 12539 timebase generator autocalibrates. 3.10 Simulated Magtapes - Simulated magtapes recognize end of file and the marker 0xFFFFFFFF as end of medium. Only the TMSCP tape simulator can generate an end of medium marker. - The error handling in simulated magtapes was overhauled to be consistent through all simulators. 3.11 Simulated DECtapes - Added support for RT11 image file format (256 x 16b) to DECtapes. 4. Bugs Fixed in 2.10 vs prior releases - TS11/TSV05 was not simulating the XS0_MOT bit, causing failures under VMS. In addition, two of the CTL options were coded interchanged. - IBM 1401 tape was not setting a word mark under group mark for load mode reads. This caused the diagnostics to crash. - SCP bugs in ssh_break and set_logon were fixed (found by Dave Hittner). - Numerous bugs in the HP 2100 extended arithmetic, floating point, 21MX, DMS, and IOP instructions were fixed. Bugs were also fixed in the memory protect and DMS functions. The moving head disks (DP, DQ) were revised to simulate the hardware more accurately. Missing functions in DQ (address skip, read address) were added. - PDP-10 tape wouldn't boot, and then wouldn't read (reported by Michael Thompson and Harris Newman, respectively) - PDP-1 typewriter is half duplex, with only one shift state for both input and output (found by Derek Peschel) 5. General Notes WARNING: V2.10 has reorganized and renamed some of the definition files for the PDP-10, PDP-11, and VAX. Be sure to delete all previous source files before you unpack the Zip archive, or unpack it into a new directory structure. WARNING: V2.10 has a new, more comprehensive save file format. Restoring save files from previous releases will cause 'invalid register' errors and loss of CPU option flags, device enable/ disable flags, unit online/offline flags, and unit writelock flags. WARNING: If you are using Visual Studio .NET through the IDE, be sure to turn off the /Wp64 flag in the project settings, or dozens of spurious errors will be generated. WARNING: Compiling Ethernet support under Windows requires extra steps; see the Ethernet readme file. Ethernet support is currently available only for Windows, Linux, NetBSD, and OpenBSD.
294 lines
11 KiB
C
294 lines
11 KiB
C
/*
|
|
* (C) Copyright 2002, Brian Knittel.
|
|
* You may freely use this program, but: it offered strictly on an AS-IS, AT YOUR OWN
|
|
* RISK basis, there is no warranty of fitness for any purpose, and the rest of the
|
|
* usual yada-yada. Please keep this notice and the copyright in any distributions
|
|
* or modifications.
|
|
*
|
|
* This is not a supported product, but I welcome bug reports and fixes.
|
|
* Mail to sim@ibm1130.org
|
|
*/
|
|
|
|
/* ibm1130_defs.h: IBM-1130 simulator definitions
|
|
*/
|
|
|
|
#include "sim_defs.h" /* main SIMH defns (include path should include .., or make a copy) */
|
|
#include <setjmp.h>
|
|
#include <assert.h>
|
|
|
|
#if defined(VMS)
|
|
# include <unistd.h> /* to pick up 'unlink' */
|
|
#endif
|
|
|
|
#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
|
|
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))
|
|
|
|
#ifndef WIN32
|
|
int strnicmp (char *a, char *b, int n);
|
|
int strcmpi (char *a, char *b);
|
|
#endif
|
|
|
|
// #define GUI_SUPPORT // uncomment to compile the GUI extensions. It's defined in the windows ibm1130.mak makefile
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* Architectural constants */
|
|
|
|
#define MAXMEMSIZE (32768) /* 32Kwords */
|
|
#define INIMEMSIZE (16384) /* 16Kwords */
|
|
#define MEMSIZE (cpu_unit.capac)
|
|
|
|
#define UNIT_MSIZE (1 << (UNIT_V_UF + 7)) /* flag for memory size setting */
|
|
|
|
#define ILL_ADR_FLAG 0x40000000 /* an impossible 1130 address */
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* Global state */
|
|
|
|
extern int cgi; // TRUE if we are running as a CGI program
|
|
extern int sim_gui;
|
|
|
|
extern uint16 M[]; /* core memory, up to 32Kwords (note: don't even think about trying 64K) */
|
|
extern uint16 ILSW[]; /* interrupt level status words */
|
|
extern int32 IAR; /* instruction address register */
|
|
extern int32 prev_IAR; /* instruction address register at start of current instruction */
|
|
extern int32 SAR, SBR; /* storage address/buffer registers */
|
|
extern int32 OP, TAG, CCC; /* instruction decoded pieces */
|
|
extern int32 CES; /* console entry switches */
|
|
extern int32 ACC, EXT; /* accumulator and extension */
|
|
extern int32 RUNMODE; /* processor run/step mode */
|
|
extern int32 ipl; /* current interrupt level (-1 = not handling irq) */
|
|
extern int32 iplpending; /* interrupted IPL's */
|
|
extern int32 tbit; /* trace flag (causes level 5 IRQ after each instr) */
|
|
extern int32 V, C; /* condition codes */
|
|
extern int32 wait_state; /* wait state (waiting for an IRQ) */
|
|
extern int32 wait_lamp; /* alternate indicator to light the wait lamp on the GUI */
|
|
extern int32 int_req; /* sum of interrupt request levels active */
|
|
extern int32 int_lamps; /* accumulated version of int_req - gives lamp persistence */
|
|
extern int32 int_mask; /* current active interrupt mask (ipl sensitive) */
|
|
extern int32 mem_mask;
|
|
extern int32 cpu_dsw; /* CPU device status word */
|
|
extern int32 sim_int_char; /* interrupt character */
|
|
extern t_bool running;
|
|
extern t_bool power;
|
|
extern t_bool cgi; /* TRUE if we are running as a CGI program */
|
|
extern t_stat reason; /* CPU execution loop control */
|
|
|
|
#define WAIT_OP 1 /* wait state causes: wait instruction, invalid instruction*/
|
|
#define WAIT_INVALID_OP 2
|
|
|
|
#define MODE_SS 3 /* RUNMODE values. SS and SMC are not implemented in this simulator */
|
|
#define MODE_SMC 2
|
|
#define MODE_INT_RUN 1
|
|
#define MODE_RUN 0
|
|
#define MODE_SI -1
|
|
#define MODE_DISP -2
|
|
#define MODE_LOAD -3
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* debugging */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
#define ENABLE_DEBUG_PRINT
|
|
#define ENABLE_DEBUG_TO_LOG
|
|
|
|
#ifdef ENABLE_DEBUG_PRINT
|
|
# define DEBUG_PRINT debug_print
|
|
#else
|
|
# ifdef ENABLE_DEBUG_TO_LOG
|
|
# define DEBUG_PRINT trace_io
|
|
# else
|
|
# define DEBUG_PRINT if (0) debug_print
|
|
# endif
|
|
#endif
|
|
|
|
void debug_print(char *fmt, ...);
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* memory IO routines */
|
|
|
|
int32 ReadW (int32 a);
|
|
void WriteW (int32 a, int32 d);
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* handy macros */
|
|
|
|
#define CLRBIT(v,b) ((v) &= ~(b))
|
|
#define SETBIT(v,b) ((v) |= (b))
|
|
#define BETWEEN(v,a,b) (((v) >= (a)) && ((v) <= (b)))
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* Simulator stop codes */
|
|
|
|
#define STOP_WAIT 1 /* wait, no events */
|
|
#define STOP_INVALID_INSTR 2 /* bad instruction */
|
|
#define STOP_IBKPT 3 /* simulator breakpoint */
|
|
#define STOP_INCOMPLETE 4 /* simulator coding not complete here */
|
|
#define STOP_POWER_OFF 5 /* no power */
|
|
#define STOP_DECK_BREAK 6 /* !BREAK in deck file */
|
|
#define STOP_PHASE_BREAK 7 /* phase load break */
|
|
#define STOP_CRASH 8 /* program has crashed badly */
|
|
#define STOP_TIMED_OUT 9 /* simulation time limit exceeded */
|
|
|
|
#define IORETURN(f,v) ((f)? (v): SCPE_OK) /* cond error return */
|
|
|
|
#define INT_REQ_0 0x01 /* bits for interrupt levels (ipl, iplpending, int_req, int_mask) */
|
|
#define INT_REQ_1 0x02
|
|
#define INT_REQ_2 0x04
|
|
#define INT_REQ_3 0x08
|
|
#define INT_REQ_4 0x10
|
|
#define INT_REQ_5 0x20
|
|
|
|
#define XIO_UNUSED 0x00 /* XIO commands */
|
|
#define XIO_WRITE 0x01
|
|
#define XIO_READ 0x02
|
|
#define XIO_SENSE_IRQ 0x03
|
|
#define XIO_CONTROL 0x04
|
|
#define XIO_INITW 0x05
|
|
#define XIO_INITR 0x06
|
|
#define XIO_SENSE_DEV 0x07
|
|
|
|
#define XIO_FAILED 0x20 /* fake function to record error */
|
|
|
|
/* ILSW bits - set by appropriate device whenever an interrupt is outstanding */
|
|
|
|
#define ILSW_0_1442_CARD 0x8000 /* ILSW 0 is not really defined on the 1130 */
|
|
|
|
#define ILSW_1_1132_PRINTER 0x8000 // had these backwards!
|
|
#define ILSW_1_SCA 0x4000
|
|
|
|
#define ILSW_2_1131_DISK 0x8000
|
|
|
|
#define ILSW_2_2310_DRV_1 0x4000
|
|
#define ILSW_2_2310_DRV_2 0x2000
|
|
#define ILSW_2_2310_DRV_3 0x1000
|
|
#define ILSW_2_2310_DRV_4 0x0800 /* can have 2310 or 2311 */
|
|
|
|
#define ILSW_2_2311_DRV_1_DISK_1 0x4000
|
|
#define ILSW_2_2311_DRV_1_DISK_2 0x2000
|
|
#define ILSW_2_2311_DRV_1_DISK_3 0x1000
|
|
#define ILSW_2_2311_DRV_1_DISK_4 0x0800
|
|
|
|
#define ILSW_2_2311_DRV_1_DISK_5 0x0400
|
|
#define ILSW_2_2311_DRV_2_DISK_1 0x0200
|
|
#define ILSW_2_2311_DRV_2_DISK_2 0x0100
|
|
#define ILSW_2_2311_DRV_2_DISK_3 0x0080
|
|
#define ILSW_2_2311_DRV_2_DISK_4 0x0040
|
|
#define ILSW_2_2311_DRV_2_DISK_5 0x0020
|
|
|
|
#define ILSW_2_SAC_BIT_11 0x0010
|
|
#define ILSW_2_SAC_BIT_12 0x0008
|
|
#define ILSW_2_SAC_BIT_13 0x0004
|
|
#define ILSW_2_SAC_BIT_14 0x0002
|
|
#define ILSW_2_SAC_BIT_15 0x0001
|
|
|
|
#define ILSW_3_1627_PLOTTER 0x8000
|
|
#define ILSW_3_SAC_BIT_01 0x4000
|
|
#define ILSW_3_SAC_BIT_02 0x2000
|
|
#define ILSW_3_SAC_BIT_03 0x1000
|
|
#define ILSW_3_2250_DISPLAY 0x0800
|
|
#define ILSW_3_SYSTEM7 0x0800
|
|
#define ILSW_3_SAC_BIT_05 0x0400
|
|
#define ILSW_3_SAC_BIT_06 0x0200
|
|
#define ILSW_3_SAC_BIT_07 0x0100
|
|
#define ILSW_3_SAC_BIT_08 0x0080
|
|
#define ILSW_3_SAC_BIT_09 0x0040
|
|
#define ILSW_3_SAC_BIT_10 0x0020
|
|
#define ILSW_3_SAC_BIT_11 0x0010
|
|
#define ILSW_3_SAC_BIT_12 0x0008
|
|
#define ILSW_3_SAC_BIT_13 0x0004
|
|
#define ILSW_3_SAC_BIT_14 0x0002
|
|
#define ILSW_3_SAC_BIT_15 0x0001
|
|
|
|
#define ILSW_4_1134_TAPE 0x8000
|
|
#define ILSW_4_1055_TAPE 0x8000
|
|
#define ILSW_4_CONSOLE 0x4000
|
|
#define ILSW_4_1442_CARD 0x2000
|
|
#define ILSW_4_2501_CARD 0x1000
|
|
#define ILSW_4_1403_PRINTER 0x0800
|
|
#define ILSW_4_1231_MARK 0x0400
|
|
#define ILSW_4_SAC_BIT_06 0x0200
|
|
#define ILSW_4_SAC_BIT_07 0x0100
|
|
#define ILSW_4_SAC_BIT_08 0x0080
|
|
#define ILSW_4_SAC_BIT_09 0x0040
|
|
#define ILSW_4_SAC_BIT_10 0x0020
|
|
#define ILSW_4_SAC_BIT_11 0x0010
|
|
#define ILSW_4_SAC_BIT_12 0x0008
|
|
#define ILSW_4_SAC_BIT_13 0x0004
|
|
#define ILSW_4_SAC_BIT_14 0x0002
|
|
#define ILSW_4_SAC_BIT_15 0x0001
|
|
|
|
#define ILSW_5_INT_RUN 0x8000
|
|
#define ILSW_5_PROGRAM_STOP 0x8000
|
|
#define ILSW_5_SAC_BIT_01 0x4000
|
|
#define ILSW_5_SAC_BIT_02 0x2000
|
|
#define ILSW_5_SAC_BIT_03 0x1000
|
|
#define ILSW_5_SAC_BIT_04 0x0800
|
|
#define ILSW_5_SAC_BIT_05 0x0400
|
|
#define ILSW_5_SAC_BIT_06 0x0200
|
|
#define ILSW_5_SAC_BIT_07 0x0100
|
|
#define ILSW_5_SAC_BIT_08 0x0080
|
|
#define ILSW_5_SAC_BIT_09 0x0040
|
|
#define ILSW_5_SAC_BIT_10 0x0020
|
|
#define ILSW_5_SAC_BIT_11 0x0010
|
|
#define ILSW_5_SAC_BIT_12 0x0008
|
|
#define ILSW_5_SAC_BIT_13 0x0004
|
|
#define ILSW_5_SAC_BIT_14 0x0002
|
|
#define ILSW_5_SAC_BIT_15 0x0001
|
|
|
|
//* CPU DSW bits
|
|
|
|
#define CPU_DSW_PROGRAM_STOP 0x8000
|
|
#define CPU_DSW_INT_RUN 0x4000
|
|
|
|
/* prototypes: xio handlers */
|
|
|
|
void xio_1131_console (int32 addr, int32 func, int32 modify); // console keyboard and printer
|
|
void xio_1142_card (int32 addr, int32 func, int32 modify); // standard card reader/punch
|
|
void xio_1134_papertape (int32 addr, int32 func, int32 modify); // paper tape reader/punch
|
|
void xio_disk (int32 addr, int32 func, int32 modify, int drv); // internal CPU disk
|
|
void xio_1627_plotter (int32 addr, int32 func, int32 modify); // XY plotter
|
|
void xio_1132_printer (int32 addr, int32 func, int32 modify); // standard line printer
|
|
void xio_1131_switches (int32 addr, int32 func, int32 modify); // console buttons & switches
|
|
void xio_1231_optical (int32 addr, int32 func, int32 modify); // optical mark page reader
|
|
void xio_2501_card (int32 addr, int32 func, int32 modify); // alternate high-speed card reader
|
|
void xio_1131_synch (int32 addr, int32 func, int32 modify); // synchronous communications adapter
|
|
void xio_system7 (int32 addr, int32 func, int32 modify); // system/7 interprocessor IO link
|
|
void xio_1403_printer (int32 addr, int32 func, int32 modify); // alternate high-speed printer
|
|
void xio_2250_display (int32 addr, int32 func, int32 modify); // vector display processor
|
|
void xio_error (char *msg);
|
|
|
|
void bail (char *msg);
|
|
t_stat load_cr_boot (int drv);
|
|
t_stat cr_boot (int unitno, DEVICE *dptr);
|
|
void calc_ints (void); /* recalculate interrupt bitmask */
|
|
void trace_io (char *fmt, ...); /* debugging printout */
|
|
void scp_panic (char *msg); /* bail out of simulator */
|
|
char *upcase(char *str);
|
|
void break_simulation (t_stat reason); /* let a device halt the simulation */
|
|
char hollerith_to_ascii (int16 hol); /* for debugging use only */
|
|
t_bool gdu_active (void);
|
|
void remark_cmd (char *remark);
|
|
void stuff_cmd (char *cmd);
|
|
void update_gui (t_bool force);
|
|
void sim_init (void);
|
|
t_stat register_cmd (char *name, t_stat (*action)(), int arg, char *help);
|
|
|
|
/* GUI interface routines */
|
|
t_bool keyboard_is_locked (void);
|
|
void forms_check (int set); /* device notification to console lamp display */
|
|
void print_check (int set);
|
|
void keyboard_selected (int select);
|
|
void disk_ready (int ready);
|
|
void disk_unlocked (int unlocked);
|
|
void gui_run(int running);
|
|
char *read_cmdline (char *ptr, int size, FILE *stream);
|
|
|
|
#ifdef GUI_SUPPORT
|
|
# define GUI_BEGIN_CRITICAL_SECTION begin_critical_section();
|
|
# define GUI_END_CRITICAL_SECTION end_critical_section();
|
|
void begin_critical_section (void);
|
|
void end_critical_section (void);
|
|
#else
|
|
# define GUI_BEGIN_CRITICAL_SECTION
|
|
# define GUI_END_CRITICAL_SECTION
|
|
#endif
|