simh-testsetgenerator/Ibm1130/ibm1130_defs.h
Bob Supnik df6475181c Notes For V2.9-11
1. New Features

1.1 GRI-909

- This is a new simulator for the GRI-909.
- It has been hand-tested; so far, no software has been discovered.

1.2 VAX

- SET CPU CONHALT will cause a HALT instruction to return to the
  boot ROM console rather than to SIMH.  SET CPU SIMHALT restores
  the default behavior.
- BRB/W self at IPL 1F stops the simulator.  This is the default
  behavior of VMS at exit.

1.3 PDP-18b

- ATTACH -A PTR/PTP attaches the reader and punch in ASCII mode.
  In ASCII mode, the reader automatically sets the high order bit
  of incoming alphabetic data, and the punch clears the high order
  bit of outgoing data.

1.4 SCP

- DO -V echoes commands from the file as they are executed.
- Under Windows, execution priority is set BELOW_NORMAL when the
  simulator is running.

2. Release Notes

2.1 Bugs Fixed

- PDP-11 CPU: fixed updating of MMR0 on a memory management error.
- VAX FPA: changed function names to avoid conflict with C math library.
- 1401 MT: read end of record generates group mark without word mark.
- 1401 DP: fixed address generation and checking.
- SCP: an EXIT within a DO command will cause the simulator to exit.

3. In Progress

- Interdata 16b/32b: coded, not tested.
- SDS 940: coded, not tested.
- IBM 1620: coded, not tested.

If you would like to help with the debugging of the untested simulators,
they can be made available by special request.
2011-04-15 08:33:43 -07:00

229 lines
8.6 KiB
C

/* 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))
// #define ENABLE_GUI // uncomment to compile the GUI extensions
/* ------------------------------------------------------------------------ */
/* 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 uint16 M[]; /* core memory, up to 32Kwords */
extern uint16 ILSW[]; /* interrupt level status words */
extern int32 IAR; /* instruction address register */
extern int32 CES; /* console entry switches */
extern int32 ACC, EXT; /* accumulator and extension */
extern int32 ipl; /* current interrupt level (-1 = not handling irq) */
extern int32 iplpending; /* bitfield: interrupted IPL's */
extern int32 tbit; /* trace flag (causes level 5 IRQ after each instr) */
extern int32 V, C; /* condition codes: overflow, carry */
extern int32 wait_state; /* wait state (waiting for an IRQ or processor halted) */
extern int32 int_req; /* bitfield: interrupt request levels active */
extern int32 int_mask; /* current active interrupt mask (ipl sensitive) */
extern int32 SR; /* switch register */
extern int32 DR; /* display register */
extern int32 wait_enable; /* wait state enable */
extern int32 mem_mask; /* mem_mask - valid address mask (memsize-1) */
extern int32 ibkpt_addr; /* breakpoint addr */
extern int32 sim_int_char;
#define WAIT_OP 1 /* wait state causes: wait instruction, invalid instruction*/
#define WAIT_INVALID_OP 2
/* ------------------------------------------------------------------------ */
/* 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 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 /* not actually used */
#define ILSW_1_SCA 0x8000
#define ILSW_1_1132_PRINTER 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
//* console DSW bits
#define CON_DSW_PROGRAM_STOP 0x8000
#define CON_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);
void calc_ints (void); /* recalculate interrupt bitmask */
void trace_io (char *fmt, ...); /* debugging printout */
void panic (char *msg); /* bail out of simulator */
char *upcase(char *str);
/* GUI interface routines */
void remark_cmd (char *remark);
void stuff_cmd (char *cmd);
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);
#ifdef ENABLE_GUI
# 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