simh-testsetgenerator/Ibm1130/ibm1130_defs.h
Bob Supnik 1da2d9452d Notes For V3.1-0
RESTRICTION: The FP15 and XVM features of the PDP-15 are only partially
debugged.  Do NOT enable these features for normal operations.

1. New Features in 3.1-0

1.1 SCP and libraries

- Added simulated Ethernet support for VMS, FreeBSD, Mac OS/X.
- Added status return to tmxr_putc_ln.
- Added sim_putchar_s to handle possible output stalls.

1.2 All DECtapes

- Added "DECtape off reel" error stop.

1.3 All Asynchronous Consoles

- Added support for output congestion stall if using a Telnet connection.

1.4 PDP-1

- Added Type 23 parallel drum support.

1.5 PDP-8

- Added instruction history.
- Added TSC8-75 option support for ETOS.
- Added TD8E DECtape support.

1.6 PDP-18b

- Added instruction history.
- Changed PDP-9, PDP-15 API default to enabled.

1.7 PDP-11

- Added support for 18b only Qbus devices.
- Formalized bus and addressing definitions.
- Added control to enable/disable autoconfiguration.
- Added stub support for second Unibus Ethernet controller.

1.7 Interdata 32b

- Added instruction history.

1.8 Eclipse

- Added floating point support.
- Added programmable interval timer support.

1.9 H316

- Added DMA/DMC support.
- Added fixed head disk support.
- Added moving head disk support.
- Added magtape support.

1.10 IBM 1130 (Brian Knittel)

- Added support for physical card reader, using the Cardread
interface (www.ibm1130.org/sim/downloads).
- Added support for physical printer (flushes output buffer after
each line).

2. Bugs Fixed in 3.1-0

2.1 SCP and libraries

- Fixed numerous bugs in Ethernet library.

2.2 All DECtapes

- Fixed reverse checksum value in 'read all' mode.
- Simplified (and sped up) timing.

2.3 PDP-8

- Fixed bug in RX28 read status (found by Charles Dickman).
- Fixed RX28 double density write.

2.4 PDP-18b

- Fixed autoincrement bug in PDP-4, PDP-7, PDP-9.

2.5 PDP-11/VAX

- Revised RQ MB->LBN conversion for greater accuracy.
- Fixed bug in IO configuration (found by David Hittner).
- Fixed bug with multiple RQ RAUSER drives.
- Fixed bug in second Qbus Ethernet controller interrupts.

2.6 Nova/Eclipse

- Fixed bugs in DKP flag clear, map setup, map usage (Charles Owen).
- Fixed bug in MT, reset completes despite I/O reset (Charles Owen).
- Fixed bug in MT, space operations return word count (Charles Owen).

2.7 IBM 1130 (Brian Knittel)

- Fixed bug in setting carry bit in subtract and subtract double.
- Fixed timing problem in console printer simulation.

2.8 1620

- Fixed bug in branch digit (found by Dave Babcock).

3. New Features in 3.0 vs prior releases

3.1 SCP and Libraries

- Added ASSIGN/DEASSIGN (logical name) commands.
- Changed RESTORE to unconditionally detach files.
- Added E11 and TPC format support to magtape library.
- Fixed bug in SHOW CONNECTIONS.
- Added USE_ADDR64 support.

3.2 All magtapes

- Magtapes support SIMH format, E11 format, and TPC format (read only).
- SET <tape_unit> FORMAT=format sets the specified tape unit's format.
- SHOW <tape_unit> FORMAT displays the specified tape unit's format.
- Tape format can also be set as part of the ATTACH command, using
  the -F switch.

3.3 VAX

- VAX can be compiled without USE_INT64.
- If compiled with USE_INT64 and USE_ADDR64, RQ and TQ controllers support
  files > 2GB.
- VAX ROM has speed control (SET ROM DELAY/NODELAY).

3.4 PDP-1

- Added block loader format support to LOAD.
- Changed BOOT PTR to allow loading of all of the first bank of memory.
- The LOAD command takes an optional argument specifying the memory field
  to be loaded.
- The PTR BOOT command takes its starting memory field from the TA (address
  switch) register.

3.5 PDP-18b Family

- Added PDP-4 EAE support.
- Added PDP-15 FP15 support.
- Added PDP-15 XVM support.
- Added PDP-15 "re-entrancy ECO".
- Added PDP-7, PDP-9, PDP-15 hardware RIM loader support in BOOT PTR.

4. Bugs Fixed in 3.0 vs prior releases

4.1 SCP and Libraries

- Fixed end of file problem in dep, idep.
- Fixed handling of trailing spaces in dep, idep.

4.2 VAX

- Fixed CVTfi bug: integer overflow not set if exponent out of range
- Fixed EMODx bugs:
  o First and second operands reversed
  o Separated fraction received wrong exponent
  o Overflow calculation on separated integer incorrect
  o Fraction not set to zero if exponent out of range
- Fixed interval timer and ROM access to pass power-up self-test even on very
  fast host processors (fixes from Mark Pizzolato).
- Fixed bug in user disk size (found by Chaskiel M Grundman).

4.3 1401

- Fixed mnemonic, instruction lengths, and reverse scan length check bug for MCS.
- Fixed MCE bug, BS off by 1 if zero suppress.
- Fixed chaining bug, D lost if return to SCP.
- Fixed H branch, branch occurs after continue.
- Added check for invalid 8 character MCW, LCA.
- Fixed magtape load-mode end of record response.
- Revised fetch to model hardware more closely.
- Fixed tape read end-of-record handling based on real 1401.
- Added diagnostic read (space forward).

4.4 Nova

- Fixed DSK variable size interaction with restore.
- Fixed bug in DSK set size routine.

4.5 PDP-1

- Fixed DT variable size interaction with restore.
- Updated CPU, line printer, standard devices to detect indefinite I/O wait.
- Fixed incorrect logical, missing activate, break in drum simulator.
- Fixed bugs in instruction decoding, overprinting for line printer.
- Fixed system hang if continue after PTR error.
- Fixed PTR to start/stop on successive rpa instructions.

4.6 PDP-11

- Fixed DT variable size interaction with restore.
- Fixed bug in MMR1 update (found by Tim Stark).
- Added XQ features and fixed bugs:
  o Corrected XQ interrupts on IE state transition (code by Tom Evans).
  o Added XQ interrupt clear on soft reset.
  o Removed XQ interrupt when setting XL or RL (multiple people).
  o Added SET/SHOW XQ STATS.
  o Added SHOW XQ FILTERS.
  o Added ability to split received packet into multiple buffers.
  o Added explicit runt and giant packet processing.
- Fixed bug in user disk size (found by Chaskiel M Grundman).

4.7 PDP-18B

- Fixed DT, RF variable size interaction with restore.
- Fixed MT bug in MTTR.
- Fixed bug in PDP-4 line printer overprinting.
- Fixed bug in PDP-15 memory protect/skip interaction.
- Fixed bug in RF set size routine.
- Increased PTP TIME for PDP-15 operating systems.
- Fixed priorities in PDP-15 API (differs from PDP-9).
- Fixed sign handling in PDP-15 EAE unsigned mul/div (differs from PDP-9).
- Fixed bug in CAF, clears API subsystem.

4.8 PDP-8

- Fixed DT, DF, RF, RX variable size interaction with restore.
- Fixed MT bug in SKTR.
- Fixed bug in DF, RF set size routine.

4.9 HP2100

- Fixed bug in DP (13210A controller only), DQ read status.
- Fixed bug in DP, DQ seek complete.
- Fixed DR drum sizes.
- Fixed DR variable capacity interaction with SAVE/RESTORE.

4.10 GRI

- Fixed bug in SC queue pointer management.

4.11 PDP-10

- Fixed bug in RP read header.

4.12 Ibm1130

- Fixed bugs found by APL 1130.

4.13 Altairz80

- Fixed bug in real-time clock on Windows host.

4.14 1620

- Fixed bug in immediate index add (found by Michael Short).
2011-04-15 08:34:20 -07:00

299 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, int switches);
t_stat cr_boot (int unitno, DEVICE *dptr);
t_stat cr_rewind (void);
t_stat cr_detach (UNIT *uptr);
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 (uint16 hol); /* for debugging use only */
t_bool gdu_active (void);
void remark_cmd (char *remark);
void stuff_cmd (char *cmd);
t_bool stuff_and_wait (char *cmd, int timeout, int delay);
void update_gui (t_bool force);
void sim_init (void);
t_stat register_cmd (char *name, t_stat (*action)(int32 flag, char *ptr), int arg, char *help);
t_stat basic_attach (UNIT *uptr, char *cptr);
char * quotefix (char * cptr);
/* GUI interface routines */
t_bool keyboard_is_busy (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