1
0
mirror of https://github.com/simh/simh.git synced 2026-05-03 14:38:45 +00:00

Notes For V3.3

RESTRICTION: The HP DS disk is not debugged.  DO NOT enable this
feature for normal operations.
WARNING: Massive changes in the PDP-11 make all previous SAVEd
file obsolete.  Do not attempt to use a PDP-11 SAVE file from a
prior release with V3.3!

1. New Features in 3.3

1.1 SCP

- Added -p (powerup) qualifier to RESET
- Changed SET <unit> ONLINE/OFFLINE to SET <unit> ENABLED/DISABLED
- Moved SET DEBUG under SET CONSOLE hierarchy
- Added optional parameter value to SHOW command
- Added output file option to SHOW command

1.2 PDP-11

- Separated RH Massbus adapter from RP controller
- Added TU tape support
- Added model emulation framework
- Added model details

1.3 VAX

- Separated out CVAX-specific features from core instruction simulator
- Implemented capability for CIS, octaword, compatibility mode instructions
- Added instruction display and parse for compatibility mode
- Changed SET CPU VIRTUAL=n to SHOW CPU VIRTUAL=n
- Added =n optional parameter to SHOW CPU HISTORY

1.4 Unibus/Qbus simulators (PDP-11, VAX, PDP-10)

- Simplified DMA API's
- Modified DMA peripherals to use simplified API's

1.5 HP2100 (all changes from Dave Bryan)

CPU	- moved MP into its own device; added MP option jumpers
	- modified DMA to allow disabling
	- modified SET CPU 2100/2116 to truncate memory > 32K
	- added -F switch to SET CPU to force memory truncation
	- modified WRU to be REG_HRO
	- added BRK and DEL to save console settings

DR	- provided protected tracks and "Writing Enabled" status bit
	- added "parity error" status return on writes for 12606
	- added track origin test for 12606
	- added SCP test for 12606
	- added "Sector Flag" status bit
	- added "Read Inhibit" status bit for 12606
	- added TRACKPROT modifier

LPS	- added SET OFFLINE/ONLINE, POWEROFF/POWERON
	- added fast/realistic timing
	- added debug printouts

LPT	- added SET OFFLINE/ONLINE, POWEROFF/POWERON

PTR	- added paper tape loop mode, DIAG/READER modifiers to PTR
	- added PV_LEFT to PTR TRLLIM register

CLK	- modified CLK to permit disable

1.6 IBM 1401, IBM 1620, Interdata 16b, SDS 940, PDP-10

- Added instruction history

1.7 H316, PDP-15, PDP-8

- Added =n optional value to SHOW CPU HISTORY

2. Bugs Fixed in 3.3

2.1 SCP

- Fixed comma-separated SET options (from Dave Bryan)
- Fixed duplicate HELP displays with user-specified commands

2.2 PDP-10

- Replicated RP register state per drive
- Fixed TU to set FCE on short record
- Fixed TU to return bit<15> in drive type
- Fixed TU format specification, 1:0 are don't cares
- Fixed TU handling of TMK status
- Fixed TU handling of DONE, ATA at end of operation
- Implemented TU write check

2.3 PDP-11

- Replicated RP register state per drive
- Fixed RQ, TQ to report correct controller type and stage 1 configuration
  flags on a Unibus system
- Fixed HK CS2<output_ready> flag

2.4 VAX

- Fixed parsing of indirect displacement modes in instruction input

2.5 HP2100 (all fixes from Dave Bryan)

CPU	- fixed S-register behavior on 2116
	- fixed LIx/MIx behavior for DMA on 2116 and 2100
	- fixed LIx/MIx behavior for empty I/O card slots

DP	- fixed enable/disable from either device
	- fixed ANY ERROR status for 12557A interface
	- fixed unattached drive status for 12557A interface
	- status cmd without prior STC DC now completes (12557A)
	- OTA/OTB CC on 13210A interface also does CLC CC
	- fixed RAR model
	- fixed seek check on 13210 if sector out of range

DQ	- fixed enable/disable from either device
	- shortened xtime from 5 to 3 (drive avg 156KW/second)
	- fixed not ready/any error status
	- fixed RAR model

DR	- fixed enable/disable from either device
	- fixed sector return in status word
	- fixed DMA last word write, incomplete sector fill value
	- fixed 12610 SFC operation
	- fixed current-sector determination

IPL	- fixed enable/disable from either device

LPS	- fixed status returns for error conditions
	- fixed handling of non-printing characters
	- fixed handling of characters after column 80
	- improved timing model accuracy for RTE

LPT	- fixed status returns for error conditions
	- fixed TOF handling so form remains on line 0

SYS	- fixed display of CCA/CCB/CCE instructions

2.5 PDP-15

FPP	- fixed URFST to mask low 9b of fraction
	- fixed exception PC setting
This commit is contained in:
Bob Supnik
2004-11-23 15:49:00 -08:00
committed by Mark Pizzolato
parent 2e00e1122f
commit b6393b36b4
131 changed files with 20920 additions and 4845 deletions

View File

@@ -75,7 +75,8 @@ BSC32_SBRS= \
$(INTDIR)/ibm1130_fmt.sbr \
$(INTDIR)/sim_console.sbr \
$(INTDIR)/sim_fio.sbr \
$(INTDIR)/sim_timer.sbr
$(INTDIR)/sim_timer.sbr \
$(INTDIR)/ibm1130_ptrp.sbr
$(OUTDIR)/ibm1130.bsc : $(OUTDIR) $(BSC32_SBRS)
$(BSC32) @<<
@@ -105,7 +106,8 @@ LINK32_OBJS= \
$(INTDIR)/ibm1130_fmt.obj \
$(INTDIR)/sim_console.obj \
$(INTDIR)/sim_fio.obj \
$(INTDIR)/sim_timer.obj
$(INTDIR)/sim_timer.obj \
$(INTDIR)/ibm1130_ptrp.obj
$(OUTDIR)/ibm1130.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -158,7 +160,8 @@ BSC32_SBRS= \
$(INTDIR)/ibm1130_fmt.sbr \
$(INTDIR)/sim_console.sbr \
$(INTDIR)/sim_fio.sbr \
$(INTDIR)/sim_timer.sbr
$(INTDIR)/sim_timer.sbr \
$(INTDIR)/ibm1130_ptrp.sbr
$(OUTDIR)/ibm1130.bsc : $(OUTDIR) $(BSC32_SBRS)
$(BSC32) @<<
@@ -189,7 +192,8 @@ LINK32_OBJS= \
$(INTDIR)/ibm1130_fmt.obj \
$(INTDIR)/sim_console.obj \
$(INTDIR)/sim_fio.obj \
$(INTDIR)/sim_timer.obj
$(INTDIR)/sim_timer.obj \
$(INTDIR)/ibm1130_ptrp.obj
$(OUTDIR)/ibm1130.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -377,10 +381,10 @@ DEP_SIM_C=\
\pdp11\supnik\sim_console.h\
\pdp11\supnik\sim_timer.h\
\pdp11\supnik\sim_fio.h\
d:\progra~1\micros~1\include\winsock2.h\
D:\PROGRA~1\MICROS~1\INCLUDE\WinSock2.h\
\MSVC20\INCLUDE\sys\TYPES.H\
d:\progra~1\micros~1\include\qos.h\
d:\winddk\2600\inc\wxp\guiddef.h
D:\PROGRA~1\MICROS~1\INCLUDE\Qos.h\
D:\WINDDK\2600\inc\wxp\guiddef.h
$(INTDIR)/sim_console.obj : $(SOURCE) $(DEP_SIM_C) $(INTDIR)
$(CPP) $(CPP_PROJ) $(SOURCE)
@@ -392,7 +396,7 @@ $(INTDIR)/sim_console.obj : $(SOURCE) $(DEP_SIM_C) $(INTDIR)
SOURCE=\pdp11\supnik\sim_fio.c
DEP_SIM_F=\
..\sim_defs.h\
d:\progra~1\micros~1\include\BASETSD.H\
D:\PROGRA~1\MICROS~1\INCLUDE\BaseTsd.h\
\pdp11\supnik\scp.h\
\pdp11\supnik\sim_console.h\
\pdp11\supnik\sim_timer.h\
@@ -408,7 +412,7 @@ $(INTDIR)/sim_fio.obj : $(SOURCE) $(DEP_SIM_F) $(INTDIR)
SOURCE=\pdp11\supnik\sim_timer.c
DEP_SIM_TI=\
..\sim_defs.h\
d:\progra~1\micros~1\include\BASETSD.H\
D:\PROGRA~1\MICROS~1\INCLUDE\BaseTsd.h\
\pdp11\supnik\scp.h\
\pdp11\supnik\sim_console.h\
\pdp11\supnik\sim_timer.h\
@@ -417,6 +421,14 @@ DEP_SIM_TI=\
$(INTDIR)/sim_timer.obj : $(SOURCE) $(DEP_SIM_TI) $(INTDIR)
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ibm1130_ptrp.c
$(INTDIR)/ibm1130_ptrp.obj : $(SOURCE) $(INTDIR)
# End Source File
# End Group
# End Project

View File

@@ -18,6 +18,8 @@
18-Mar-03 BLK Fixed bug in divide instruction; didn't work with negative values
23-Jul-03 BLK Prevented tti polling in CGI mode
24-Nov-03 BLK Fixed carry bit error in subtract and subtract double, found by Bob Flanders
20-Oct-04 BLK Changed "(unsigned int32)" to "(uint32)" to accomodate improved definitions of simh types
Also commented out my echo command as it's now a standard simh command
The register state for the IBM 1130 CPU is:
@@ -127,6 +129,7 @@
#define UPDATE_BY_TIMER
#define ENABLE_BACKTRACE
#define CGI_SUPPORT
// #define USE_MY_ECHO_CMD /* simh now has echo command built in */
static void cgi_start(void);
static void cgi_stop(t_stat reason);
@@ -888,7 +891,7 @@ t_stat sim_instr (void)
ACC = (dst >> 16) & 0xFFFF;
EXT = dst & 0xFFFF;
C = (unsigned int32) dst < (unsigned int32) src;
C = (uint32) dst < (uint32) src;
if (! V)
V = DWSIGN_BIT((~src ^ src2) & (src ^ dst));
break;
@@ -910,7 +913,7 @@ t_stat sim_instr (void)
ACC = (dst >> 16) & 0xFFFF;
EXT = dst & 0xFFFF;
C = (unsigned int32) src < (unsigned int32) src2;
C = (uint32) src < (uint32) src2;
if (! V)
V = DWSIGN_BIT((src ^ src2) & (src ^ dst));
break;
@@ -1280,6 +1283,7 @@ t_stat register_cmd (char *name, t_stat (*action)(int32 flag, char *ptr), int ar
return SCPE_OK;
}
#ifdef USE_MY_ECHO_CMD
/* ------------------------------------------------------------------------
* echo_cmd - just echo the command line
* ------------------------------------------------------------------------ */
@@ -1289,6 +1293,7 @@ static t_stat echo_cmd (int flag, char *cptr)
printf("%s\n", cptr);
return SCPE_OK;
}
#endif
/* ------------------------------------------------------------------------
* sim_init - initialize simulator upon startup of scp, before reset
@@ -1319,7 +1324,9 @@ void sim_init (void)
register_cmd("CGI", &cgi_cmd, 0, "cgi run simulator in CGI mode\n");
#endif
#ifdef USE_MY_ECHO_CMD
register_cmd("ECHO", &echo_cmd, 0, "echo args... echo arguments passed to command\n");
#endif
}
/* ------------------------------------------------------------------------

View File

@@ -18,6 +18,8 @@
* This is not a supported product, but I welcome bug reports and fixes.
* Mail to simh@ibm1130.org
* Update 2004-06-05: Removed "feedcycle" from cr_reset. Reset should not touch the card reader.
* Update 2004-04-12: Changed ascii field of CPCODE to unsigned char, caught a couple
other potential problems with signed characters used as subscript indexes.
@@ -337,6 +339,7 @@ static t_stat cr_reset (DEVICE *dptr);
static t_stat cr_set_code (UNIT *uptr, int32 match, char *cptr, void *desc);
static t_stat cr_attach (UNIT *uptr, char *cptr);
static int32 guess_cr_code (void);
static void feedcycle (t_bool load, t_bool punching);
static t_stat cp_reset (DEVICE *dptr);
static t_stat cp_set_code (UNIT *uptr, int32 match, char *cptr, void *desc);
@@ -400,7 +403,7 @@ static int32 cp_count= 0;
#define COLUMN u4 /* column field in unit record */
UNIT cr_unit = { UDATA (&cr_svc, UNIT_ATTABLE|UNIT_ROABLE, 0) };
UNIT cr_unit = { UDATA (&cr_svc, UNIT_ATTABLE|UNIT_ROABLE|UNIT_CR_EMPTY, 0) };
UNIT cp_unit = { UDATA (NULL, UNIT_ATTABLE, 0) };
MTAB cr_mod[] = {
@@ -916,7 +919,7 @@ t_stat load_cr_boot (int drvno, int switches)
t_stat cr_boot (int unitno, DEVICE *dptr)
{
t_stat rval;
uint16 buf[80];
// uint16 buf[80];
int i;
if ((rval = reset_all(0)) != SCPE_OK)
@@ -933,13 +936,15 @@ t_stat cr_boot (int unitno, DEVICE *dptr)
if (cr_unit.fileref == NULL) /* this will happen if no file in deck file can be opened */
return SCPE_IOERR;
if (fxread(buf, sizeof(buf[0]), 80, cr_unit.fileref) != 80)
return SCPE_IOERR;
feedcycle(TRUE, FALSE);
// if (fxread(buf, sizeof(buf[0]), 80, cr_unit.fileref) != 80)
// return SCPE_IOERR;
IAR = 0; /* Program Load sets IAR = 0 */
for (i = 0; i < 80; i++) /* shift 12 bits into 16 */
WriteW(i, (buf[i] & 0xF800) | ((buf[i] & 0x0400) ? 0x00C0 : 0x0000) | ((buf[i] & 0x03F0) >> 4));
WriteW(i, (readstation[i] & 0xF800) | ((readstation[i] & 0x0400) ? 0x00C0 : 0x0000) | ((readstation[i] & 0x03F0) >> 4));
return SCPE_OK;
}
@@ -1422,19 +1427,19 @@ static t_stat cr_reset (DEVICE *dptr)
return SCPE_OK;
}
SETBIT(cr_unit.flags, UNIT_CR_EMPTY); /* assume hopper empty */
if (cr_unit.flags & UNIT_ATT) {
// SETBIT(cr_unit.flags, UNIT_CR_EMPTY); /* assume hopper empty */
//
// if (cr_unit.flags & UNIT_ATT) {
// if (deckfile != NULL) { /* do NOT rewind the deck file */
// fseek(deckfile, 0, SEEK_SET);
// nextdeck();
// }
// else
// checkdeck();
if (cr_unit.fileref != NULL)
feedcycle(FALSE, FALSE);
}
//
// if (cr_unit.fileref != NULL)
// feedcycle(FALSE, FALSE);
// }
return SCPE_OK;
}

View File

@@ -775,7 +775,7 @@ static void tracesector (int iswrite, int nwords, int addr, int sector)
}
printf("* %04x: %3d /%04x %c %3d.%d ",
prev_IAR, nwords, addr, iswrite ? '>' : '<', sector/8, sector%8);
prev_IAR, nwords, addr, iswrite ? 'W' : 'R', sector/8, sector%8);
if (name == NULL) { // look up sector in SLET
for (i = 0; i < MAXSLET; i++) {

View File

@@ -46,6 +46,11 @@
#define UNIT_V_PHYSICAL_PTR (UNIT_V_UF + 10) /* NOTE: THESE MUST MATCH THE DEFINITION IN ibm1130_prt.c */
#define UNIT_PHYSICAL_PTR (1u << UNIT_V_PHYSICAL_PTR)
// I think I had it wrong; Program Load actually does start the processor after
// reading in the card?
#define PROGRAM_LOAD_STARTS_CPU
/* ------------------------------------------------------------------------
* Function declarations
* ------------------------------------------------------------------------ */
@@ -1229,9 +1234,12 @@ void HandleCommand (HWND hWnd, WORD wNotify, WORD idCtl, HWND hwCtl)
case IDC_PROGRAM_LOAD:
if (! running) { /* if card reader is attached to a file, do cold start read of one card */
IAR = 0; /* reset IAR */
// stuff_cmd("boot cr");
#ifdef PROGRAM_LOAD_STARTS_CPU
stuff_cmd("boot cr");
#else
if (cr_boot(0, NULL) != SCPE_OK) /* load boot card */
remark_cmd("IPL failed");
#endif
}
break;

309
Ibm1130/ibm1130_ptrp.c Normal file
View File

@@ -0,0 +1,309 @@
/* ibm1130_ptrp.c: IBM 1130 paper tape reader/punch emulation
Based on the SIMH simulator package written by Robert M Supnik
Brian Knittel
Revision History
2004.10.22 - Written.
* (C) Copyright 2004, 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 simh@ibm1130.org
*/
#include "ibm1130_defs.h"
/***************************************************************************************
* 1134 Paper Tape Reader device PTR
* 1055 Paper Tape Punch device PTP (shares DSW with PTR)
***************************************************************************************/
#define PTR1134_DSW_READER_RESPONSE 0x4000
#define PTR1134_DSW_PUNCH_RESPONSE 0x1000
#define PTR1134_DSW_READER_BUSY 0x0800
#define PTR1134_DSW_READER_NOT_READY 0x0400
#define PTR1134_DSW_PUNCH_BUSY 0x0200
#define PTR1134_DSW_PUNCH_NOT_READY 0x0100
#define IS_ONLINE(u) (((u)->flags & (UNIT_ATT|UNIT_DIS)) == UNIT_ATT)
static t_stat ptr_svc (UNIT *uptr);
static t_stat ptr_reset (DEVICE *dptr);
static t_stat ptr_attach (UNIT *uptr, char *cptr);
static t_stat ptr_detach (UNIT *uptr);
static t_stat ptr_boot (int unitno, DEVICE *dptr);
static t_stat ptp_svc (UNIT *uptr);
static t_stat ptp_reset (DEVICE *dptr);
static t_stat ptp_attach (UNIT *uptr, char *cptr);
static t_stat ptp_detach (UNIT *uptr);
static int16 ptr_dsw = 0; /* device status word */
static int32 ptr_wait = 1000; /* character read wait */
static uint8 ptr_char = 0; /* last character read */
static int32 ptp_wait = 1000; /* character punch wait */
UNIT ptr_unit[1] = {
{ UDATA (&ptr_svc, UNIT_ATTABLE, 0) },
};
REG ptr_reg[] = {
{ HRDATA (DSW, ptr_dsw, 16) }, /* device status word */
{ DRDATA (WTIME, ptr_wait, 24), PV_LEFT }, /* character read wait */
{ DRDATA (LASTCHAR, ptr_char, 8), PV_LEFT }, /* last character read */
{ NULL } };
DEVICE ptr_dev = {
"PTR", ptr_unit, ptr_reg, NULL,
1, 16, 16, 1, 16, 16,
NULL, NULL, ptr_reset,
ptr_boot, ptr_attach, ptr_detach};
UNIT ptp_unit[1] = {
{ UDATA (&ptp_svc, UNIT_ATTABLE, 0) },
};
REG ptp_reg[] = {
{ HRDATA (DSW, ptr_dsw, 16) }, /* device status word (this is the same as the reader's!) */
{ DRDATA (WTIME, ptp_wait, 24), PV_LEFT }, /* character punch wait */
{ NULL } };
DEVICE ptp_dev = {
"PTP", ptp_unit, ptp_reg, NULL,
1, 16, 16, 1, 16, 16,
NULL, NULL, ptp_reset,
NULL, ptp_attach, ptp_detach};
/* xio_1134_papertape - XIO command interpreter for the 1134 paper tape reader and 1055 paper tape punch */
void xio_1134_papertape (int iocc_addr, int iocc_func, int iocc_mod)
{
char msg[80];
switch (iocc_func) {
case XIO_READ: /* read: return last character read */
M[iocc_addr & mem_mask] = (uint16) (ptr_char << 8);
break;
case XIO_WRITE: /* write: initiate punch operation */
if ((ptr_dsw & PTR1134_DSW_PUNCH_NOT_READY) == 0 && IS_ONLINE(ptp_unit)) {
putc((M[iocc_addr & mem_mask] >> 8) & 0xFF, ptp_unit->fileref);
ptp_unit->pos++;
}
sim_activate(ptp_unit, ptp_wait); /* schedule interrupt */
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY | PTR1134_DSW_PUNCH_BUSY);
break;
case XIO_SENSE_DEV: /* sense device status */
ACC = ptr_dsw;
if (iocc_mod & 0x01) { /* reset interrupts */
CLRBIT(ptr_dsw, PTR1134_DSW_READER_RESPONSE | PTR1134_DSW_PUNCH_RESPONSE);
CLRBIT(ILSW[4], ILSW_4_1134_TAPE);
}
break;
case XIO_CONTROL: /* control: initiate character read */
sim_activate(ptr_unit, ptr_wait); /* schedule interrupt */
SETBIT(ptr_dsw, PTR1134_DSW_READER_BUSY | PTR1134_DSW_READER_NOT_READY);
break;
default:
sprintf(msg, "Invalid 1134 reader/1055 punch XIO function %x", iocc_func);
xio_error(msg);
}
}
// ptr_svc - emulated timeout - 1134 read operation complete
static t_stat ptr_svc (UNIT *uptr)
{
CLRBIT(ptr_dsw, PTR1134_DSW_READER_BUSY); /* clear reader busy flag */
SETBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY); /* assume at end of file */
if (IS_ONLINE(uptr)) { /* fetch character from file */
ptr_char = getc(uptr->fileref);
uptr->pos++;
if (! feof(uptr->fileref)) /* there's more left */
CLRBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY);
}
SETBIT(ptr_dsw, PTR1134_DSW_READER_RESPONSE); /* indicate read complete */
SETBIT(ILSW[4], ILSW_4_1134_TAPE); /* initiate interrupt */
calc_ints();
return SCPE_OK;
}
// ptp_svc - emulated timeout -- 1055 punch operation complete
static t_stat ptp_svc (UNIT *uptr)
{
CLRBIT(ptr_dsw, PTR1134_DSW_PUNCH_BUSY); /* clear punch busy flag */
if (IS_ONLINE(uptr)) /* update punch ready status */
CLRBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY);
else
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY);
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_RESPONSE); /* indicate punch complete */
SETBIT(ILSW[4], ILSW_4_1134_TAPE); /* initiate interrupt */
calc_ints();
return SCPE_OK;
}
/* ptr_reset - reset emulated paper tape reader */
static t_stat ptr_reset (DEVICE *dptr)
{
sim_cancel(ptr_unit);
CLRBIT(ptr_dsw, PTR1134_DSW_READER_BUSY | PTR1134_DSW_READER_RESPONSE);
SETBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY);
if (IS_ONLINE(ptr_unit) && ! feof(ptr_unit->fileref))
CLRBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY);
if ((ptr_dsw & PTR1134_DSW_PUNCH_RESPONSE) == 0) { /* punch isn't interrupting either */
CLRBIT(ILSW[4], ILSW_4_1134_TAPE);
calc_ints();
}
return SCPE_OK;
}
/* ptp_reset - reset emulated paper tape punch */
static t_stat ptp_reset (DEVICE *dptr)
{
sim_cancel(ptp_unit);
CLRBIT(ptr_dsw, PTR1134_DSW_PUNCH_BUSY | PTR1134_DSW_PUNCH_RESPONSE);
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY);
if (IS_ONLINE(ptp_unit))
CLRBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY);
if ((ptr_dsw & PTR1134_DSW_READER_RESPONSE) == 0) { /* reader isn't interrupting either */
CLRBIT(ILSW[4], ILSW_4_1134_TAPE);
calc_ints();
}
return SCPE_OK;
}
/* ptr_attach - attach file to simulated paper tape reader */
static t_stat ptr_attach (UNIT *uptr, char *cptr)
{
t_stat rval;
SETBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY); /* assume failure */
if ((rval = attach_unit(uptr, cptr)) != SCPE_OK) /* use standard attach */
return rval;
if ((ptr_dsw & PTR1134_DSW_READER_BUSY) == 0 && ! feof(uptr->fileref))
CLRBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY); /* we're in business */
return SCPE_OK;
}
/* ptr_attach - detach file from simulated paper tape reader */
static t_stat ptr_detach (UNIT *uptr)
{
SETBIT(ptr_dsw, PTR1134_DSW_READER_NOT_READY);
return detach_unit(uptr);
}
/* ptr_attach - perform paper tape initial program load */
static t_stat ptr_boot (int unitno, DEVICE *dptr)
{
int ch, nch, val, addr;
t_bool leader = TRUE, start = FALSE;
t_stat rval;
addr = 0;
nch = 0;
val = 0;
for (;;) {
if ((ch = getc(ptr_unit->fileref)) == EOF) {
printf("EOF on paper tape without finding Channel 5 end-of-load mark\n");
break;
}
if (leader) {
if ((ch & 0x7F) == 0x7F) // ignore leading rubouts or "delete" characters
continue;
leader = FALSE; // after first nonrubout, any punch in channel 5 terminates load
}
// this is untested -- not sure of actual byte ordering
val = (val << 4) | (ch & 0x0F); // get next nybble
if (++nch == 4) { // if we now have four nybbles, store the word
M[addr & mem_mask] = (uint16) val;
addr++; // prepare for next word
nch = 0;
val = 0;
}
if (ch & 0x10) { // channel 5 punch terminates load
start = TRUE;
break;
}
}
if (! start) // if we didn't get a valid load, report EOF error
return SCPE_EOF;
if ((rval = reset_all(0)) != SCPE_OK) // force a reset
return rval;
IAR = 0; // start running at address 0
return SCPE_OK;
}
/* ptp_attach - attach file to simulated paper tape punch */
static t_stat ptp_attach (UNIT *uptr, char *cptr)
{
t_stat rval;
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY); /* assume failure */
if ((rval = attach_unit(uptr, cptr)) != SCPE_OK) /* use standard attach */
return rval;
fseek(uptr->fileref, 0, SEEK_END); /* if we opened an existing file, append to it */
uptr->pos = ftell(uptr->fileref);
if ((ptr_dsw & PTR1134_DSW_PUNCH_BUSY) == 0)
CLRBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY); /* we're in business */
return SCPE_OK;
}
/* ptp_detach - detach file from simulated paper tape punch */
static t_stat ptp_detach (UNIT *uptr)
{
SETBIT(ptr_dsw, PTR1134_DSW_PUNCH_NOT_READY);
return detach_unit(uptr);
}

View File

@@ -6,6 +6,8 @@
Revision History:
2004.10.22 - Removed stub for xio_1134_papertape as it's now a supported device
2003.11.23 - Fixed bug in new routine "quotefix" that made sim crash
for all non-Windows builds :(
@@ -90,12 +92,11 @@
static void badio (char *dev)
{
// the real 1130 just ignores attempts to use uninstalled devices. They get tested
// at times, so it's best to be quiet about this
// at times, so it's best to just be quiet about this
// printf("%s I/O is not yet supported", dev);
// wait_state = WAIT_INVALID_OP;
}
void xio_1134_papertape (int32 addr, int32 func, int32 modify) {badio("papertape");}
// void xio_1134_papertape (int32 addr, int32 func, int32 modify) {badio("papertape");}
void xio_1627_plotter (int32 addr, int32 func, int32 modify) {badio("plotter");}
void xio_1231_optical (int32 addr, int32 func, int32 modify) {badio("optical mark");}
void xio_2501_card (int32 addr, int32 func, int32 modify) {badio("2501 card");}

View File

@@ -27,7 +27,7 @@
#include <ctype.h>
#include <stdarg.h>
extern DEVICE cpu_dev, console_dev, dsk_dev, cr_dev, cp_dev;
extern DEVICE cpu_dev, console_dev, dsk_dev, cr_dev, cp_dev, ptr_dev, ptp_dev;
extern DEVICE tti_dev, tto_dev, prt_dev, log_dev;
extern DEVICE gdu_dev, console_dev;
@@ -59,6 +59,8 @@ DEVICE *sim_devices[] = {
&tti_dev, /* console keyboard, selectric printer */
&tto_dev,
&prt_dev, /* 1132 printer */
&ptr_dev, /* 1134 paper tape reader */
&ptp_dev, /* 1055 paper tape punch */
&console_dev, /* console display (windows GUI) */
&gdu_dev, /* 2250 display */
NULL

View File

@@ -59,7 +59,7 @@ ibm1130 = ${ibm1130D}ibm1130_sys.c ${ibm1130D}ibm1130_cpu.c \
${ibm1130D}ibm1130_cr.c ${ibm1130D}ibm1130_disk.c \
${ibm1130D}ibm1130_stddev.c ${ibm1130D}ibm1130_gdu.c \
${ibm1130D}ibm1130_gui.c ${ibm1130D}ibm1130_prt.c \
${ibm1130D}ibm1130_fmt.c
${ibm1130D}ibm1130_ptrp.c ${ibm1130D}ibm1130_fmt.c
ibm1130_INC = ibm1130res.h ibm1130_conin.h ibm1130_conout.h \
ibm1130_defs.h ibm1130_prtwheel.h ibm1130_fmt.h \

View File

@@ -9,10 +9,27 @@
* Mail to sim@ibm1130.org
*/
#define VERSION "ASM1130 CROSS ASSEMBLER V1.14"
// ---------------------------------------------------------------------------------
// ASM1130 - IBM 1130 Cross Assembler
//
// Version
// 1.14 - 2004Oct22 - Fixed problem with BSS complaining about negative
// sizes. This may be a fundamental problem with my using
// 32-bit expressions, but for now, it appears that just
// truncating the BSS size to 16 bits is sufficient to build DMS.
// 1.13 - 2004Jun05 - Fixed sign extension of constants in expressions. Statements
// like LD /FFFF were being assembled incorrectly.
// 1.12 - 2004Jun04 - Made WAIT instruction take a displacement value.
// Doesn't affect operation, but these are used as indicators
// in the IBM one-card diagnostic programs.
// Also -- should mention that the .IPL directive was
// removed some time ago. To create bootable cards,
// use -b flag to create binary output, and post-process the
// binary output with program "mkboot"
// 1.11 - 2004May22 - Added CMP, DCM, and DECS instructions for 1800,
// thanks to Kevin Everets.
// 1.10 - 2003Dec08 - Fixed opcode value for XCH instruction, thanks to
// Roger Simpson.
// 1.09 - 2003Aug03 - Added fxwrite so asm will write little-endian files
@@ -91,28 +108,14 @@
// >>> Look for "bug here" though, for things to check out.
//
// Notes:
// We assume that the computer on which the assembler runs uses ANSI floating point.
// Also, the assembly of floating point values may be incorrect on non-Intel
// architectures, this needs to be investigated.
//
// org_advanced tells whether * in an expression refers to the address AFTER the
// instruction (1 or 2 words, depending on length). This is the case for opcodes
// but not all directives.
//
// Added special coldstart format directives:
//
// .IPL 1130,XXXXXXXX
// .IPL 1800,XXXXXXXX
//
// (these are not standard IBM)
//
// These directives cause the output file to be written in binary in either 1130 or
// 1800 IPL format. In 1130 format, the index bits are lost and the displacement
// is sign extended. In 1800 format, the data are punched 8 bits at a time into
// two columns per word. If an identifier is not given, data are punched into
// all 80 columns. If an identifier is given, data is punched in columns 0 through
// 72, and the identification XXXXXXXX is punched in columns 73 through 80. (If
// there are multiple output cards the last ident character is incremented). A
// warning is issued if 1130 assembly results in lost bits. These directives
// should be the first in the file as you don't want text and binary mixed in
// the same output file.
//
// Revision History
// 16Apr02 1.03 Added sector break, relocation flag output
// 02Apr02 1.02 Fixed bug in BOSC: it CAN be a short instruction.
@@ -133,7 +136,8 @@
// DEFINITIONS
// ---------------------------------------------------------------------------------
// I have found some IBM source code where @ and ' seem interchangable.
// I have found some IBM source code where @ and ' seem interchangable (likely due to the
// use of 026 keypunches).
// Comment out this define to make @ and ' different in symbol names, keep to make equivalent
#if defined(VMS)
@@ -162,8 +166,6 @@
#define TRUE 1
#define FALSE 0
#define VERSION "ASM1130 CROSS ASSEMBLER V1.08"
#define ISTV 0x33 // magic number from DMS R2V12 monitorm symbol @ISTV
#define MAXLITERALS 300
@@ -233,7 +235,7 @@ typedef enum {OUTMODE_LOAD, OUTMODE_1130, OUTMODE_1800, OUTMODE_BINARY} OUTMODE;
// command line syntax
char *usestr =
"Usage: asm1130 [-bpsvwxy] [-o[file]] [-l[file]] [-rN.M] file...\n\n"
"Usage: asm1130 [-bpsvwxy8] [-o[file]] [-l[file]] [-rN.M] file...\n\n"
"-b binary (relocatable format) output; default is simulator LOAD format\n"
"-p count passes required; no assembly output is created with this flag"
"-s add symbol table to listing\n"
@@ -244,10 +246,12 @@ char *usestr =
"-y preload system symbol table SYMBOLS.SYS\n"
"-o set output file; default is first input file + .out or .bin\n"
"-l create listing file; default is first input file + .lst\n"
"-r set dms version to VN RM for system SBRK cards";
"-r set dms version to VN RM for system SBRK cards\n"
"-8 enable IBM 1800 instructions"; // (alternately, rename or link executable to asm1800.exe)
BOOL verbose = FALSE; // verbose mode flag
BOOL tabformat = FALSE; // TRUE if tabs were seen in the file
BOOL enable_1800 = FALSE; // TRUE if 1800 mode is enabled by flag or executable name
int pass; // current assembler pass (1 or 2)
char curfn[256]; // current input file name
char progname[8]; // base name of primary input file
@@ -349,6 +353,7 @@ int ascii_to_1403_table[128] =
// PROTOTYPES
// ---------------------------------------------------------------------------------
void init (int argc, char **argv);
void bail (char *msg);
void flag (char *arg);
void proc (char *fname);
@@ -387,6 +392,7 @@ void bincard_endcard (void);
void handle_sbrk (char *line);
void bincard_typecard (void);
void namecode (unsigned short *words, char *tok);
int signextend (int v);
// ---------------------------------------------------------------------------------
// main routine
@@ -396,9 +402,7 @@ int main (int argc, char **argv)
{
int i, sawfile = FALSE;
for (i = 1; i < argc; i++) // process command line switches
if (*argv[i] == '-')
flag(argv[i]+1);
init(argc, argv); // initialize, process flags
startpass(1); // first pass, process files
@@ -460,6 +464,21 @@ int main (int argc, char **argv)
return 0; // all done
}
// ---------------------------------------------------------------------------------
// init - initialize assembler, process command line flags
// ---------------------------------------------------------------------------------
void init (int argc, char **argv)
{
int i;
enable_1800 = strstr(argv[0], "1800") != NULL; // if "1800" appears in the executable name, enable 1800 extensions
for (i = 1; i < argc; i++) // process command line switches
if (*argv[i] == '-')
flag(argv[i]+1);
}
// ---------------------------------------------------------------------------------
// flag - process one command line switch
// ---------------------------------------------------------------------------------
@@ -512,6 +531,10 @@ void flag (char *arg)
outmode = OUTMODE_BINARY;
break;
case '8':
enable_1800 = TRUE;
break;
case 'r':
if (sscanf(arg, "%d.%d", &major, &minor) != 2)
bail(usestr);
@@ -1194,6 +1217,7 @@ void coltok (char *c, char *tok, int ifrom, int ito, BOOL condense, char *save)
#define IS_ABS 0x0002 // always uses absolute addressing mode (implied X)
#define NO_IDX 0x0004 // even with 1 or 2 modifier, this is not really indexed (for STX/LDX)
#define NO_ARGS 0x0008 // statement takes no arguments
#define IS_1800 0x0010 // 1800-only directive or instruction, flagged if 1800 mode is not enabled
#define TRAP 0x1000 // debug this instruction
struct tag_op { // OPCODE TABLE
@@ -1230,6 +1254,7 @@ void x_bes (struct tag_op *op, char *label, char *mods, char *arg);
void x_bss (struct tag_op *op, char *label, char *mods, char *arg);
void x_dc (struct tag_op *op, char *label, char *mods, char *arg);
void x_dec (struct tag_op *op, char *label, char *mods, char *arg);
void x_decs (struct tag_op *op, char *label, char *mods, char *arg);
void x_ebc (struct tag_op *op, char *label, char *mods, char *arg);
void x_end (struct tag_op *op, char *label, char *mods, char *arg);
void x_ent (struct tag_op *op, char *label, char *mods, char *arg);
@@ -1262,6 +1287,7 @@ struct tag_op ops[] = {
"BSS", 0, x_bss, E, NONE, 0,
"DC", 0, x_dc, NONE, NONE, 0,
"DEC", 0, x_dec, E, E, IS_DBL,
"DECS", 0, x_decs, E, E, IS_DBL, // this is an IBM 1800 directive
"DMES", 0, x_dmes, ANY, NONE, 0,
"DN", 0, x_dn, NONE, NONE, 0,
"DSA", 0, x_dsa, NONE, NONE, 0,
@@ -1293,6 +1319,8 @@ struct tag_op ops[] = {
"AND", 0xE000, std_op, ALL, NONE, 0,
"BSI", 0x4000, bsi_op, ALL, NONE, 0,
"CALL", 0x4000, x_call, ALL, L, 0, // alias for BSI L, or external call
"CMP", 0xB000, std_op, ALL, NONE, IS_1800, // this is an IBM 1800-only instruction
"DCM", 0xB800, std_op, ALL, NONE, IS_1800, // this is an IBM 1800-only instruction
"D" , 0xA800, std_op, ALL, NONE, 0,
"EOR", 0xF000, std_op, ALL, NONE, 0,
"LD", 0xC000, std_op, ALL, NONE, 0,
@@ -1310,7 +1338,7 @@ struct tag_op ops[] = {
"STO", 0xD000, std_op, ALL, NONE, 0,
"STS", 0x2800, std_op, ALL, NONE, 0,
"STX", 0x6800, std_op, ALL, NONE, NO_IDX,
"WAIT", 0x3000, std_op, NONE, NONE, NO_ARGS,
"WAIT", 0x3000, std_op, NONE, NONE, IS_ABS,
"XCH", 0x18D0, std_op, NONE, NONE, 0, // same as RTE 16, 18C0 + 10
"XIO", 0x0800, std_op, ALL, NONE, IS_DBL,
@@ -1850,6 +1878,9 @@ void parse_line (char *line)
org_advanced = strchr(mods, 'L') ? 2 : 1; // by default, * means address + 1 or 2. Sometimes it doesn't
(op->handler)(op, label, mods, arg);
if ((op->flags & IS_1800) && ! enable_1800)
asm_warning("%s is IBM 1800-specific; use the -8 command line option", op->mnem);
}
// ---------------------------------------------------------------------------------
@@ -2178,6 +2209,9 @@ void convert_double_to_extended (double d, unsigned short *wd)
wd[2] = (unsigned short) (mantissa & 0xFFFF);
}
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
void convert_double_to_standard (double d, unsigned short *wd)
{
int neg, exp;
@@ -2222,6 +2256,9 @@ void convert_double_to_standard (double d, unsigned short *wd)
// printf(" D %04x%04x\n", wd[0], wd[1]);
}
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
void convert_double_to_fixed (double d, unsigned short *wd, int bexp)
{
int neg, exp, rshift;
@@ -2232,6 +2269,9 @@ void convert_double_to_fixed (double d, unsigned short *wd, int bexp)
wd[0] = wd[1] = 0;
return;
}
// note: we assume that this computer uses ANSI floating point
// 7 6 5 4 0
// d = ansi real*8 SXXX XXXX XXXX MMMM MMMM MMMM MMMM MMMM ... MMMM MMMM
@@ -2269,6 +2309,9 @@ void convert_double_to_fixed (double d, unsigned short *wd, int bexp)
wd[1] = (unsigned short) (mantissa & 0xFFFF);
}
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
void getDconstant (char *tok, unsigned short *wd)
{
unsigned long l;
@@ -2312,14 +2355,15 @@ void getDconstant (char *tok, unsigned short *wd)
convert_double_to_standard(d, wd);
}
// ---------------------------------------------------------------------------------
// If the input value is an integer with no decimal point and no B or E,
// DEC generates a double INTEGER value.
// IBM documentation ranges from ambiguous to wrong on this point, but
// examination of the DMS microfiche supports this.
// ---------------------------------------------------------------------------------
void x_dec (struct tag_op *op, char *label, char *mods, char *arg)
{
// char *tok;
unsigned short wd[2];
org_advanced = 2; // assume * means address after this location, since it's +1 for dc?
@@ -2343,6 +2387,28 @@ void x_dec (struct tag_op *op, char *label, char *mods, char *arg)
// writew(wd[1], FALSE);
}
// ---------------------------------------------------------------------------------
// DECS directive. Writes just the high word of a DEC value
// ---------------------------------------------------------------------------------
void x_decs (struct tag_op *op, char *label, char *mods, char *arg)
{
unsigned short wd[2];
org_advanced = 1; // assume * means address after this location
setw(0, org, FALSE); // display the origin
if (*label) // define label
set_symbol(label, org, TRUE, relocate);
getDconstant(arg, wd);
writew(wd[0], FALSE); // write hiword ONLY
}
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
void x_xflc (struct tag_op *op, char *label, char *mods, char *arg)
{
char *tok, *b;
@@ -2843,28 +2909,29 @@ void x_bss (struct tag_op *op, char *label, char *mods, char *arg)
else if (getexpr(arg, FALSE, &expr) != S_DEFINED)
return;
if (strchr(mods, 'E') != NULL) // force even address
if (strchr(mods, 'E') != NULL) // force even address
org_even();
if (expr.relative)
asm_error("BSS size must be an absolute value");
setw(0, org, FALSE); // display origin
setw(0, org, FALSE); // display origin
if (*label) // define label
if (*label) // define label
set_symbol(label, org, TRUE, relocate);
if (expr.value < 0)
asm_warning("Negative BSS size");
expr.value &= 0xFFFF; // truncate to 16 bits
if (expr.value & 0x8000)
asm_warning("Negative BSS size");
else if (expr.value > 0) {
if (outmode == OUTMODE_LOAD) {
org += expr.value; // advance the origin by appropriate number of words
if (pass == 2) // emit new load address in output file
org += expr.value; // advance the origin by appropriate number of words
if (pass == 2) // emit new load address in output file
fprintf(fout, "@%04x%s" ENDLINE, org & 0xFFFF, relocate ? "R" : "");
}
else {
org += expr.value; // advance the origin by appropriate number of words
org += expr.value; // advance the origin by appropriate number of words
if (pass == 2)
bincard_setorg(org);
}
@@ -3920,7 +3987,7 @@ void a1130_term (EXPR *ap)
c = GETNEXT;
if (ctype[c] == DIGIT) { /* number */
ap->value = c_number(c,10,-1);
ap->value = signextend(c_number(c,10,-1));
ap->relative = ABSOLUTE;
}
else if (c == '+') { /* unary + */
@@ -3931,7 +3998,7 @@ void a1130_term (EXPR *ap)
ap->value = - ap->value;
}
else if (c == '/') { /* / starts a hex constant */
ap->value = c_number(c,16,-1);
ap->value = signextend(c_number(c,16,-1));
ap->relative = ABSOLUTE;
}
else if (c == '*') { /* asterisk alone = org */
@@ -3970,6 +4037,20 @@ void a1130_term (EXPR *ap)
exprerr(8);
}
// ---------------------------------------------------------------------------------
// signextend - sign-extend a 16-bit constant value to whatever "int" is.
// ---------------------------------------------------------------------------------
int signextend (int v)
{
v &= 0xFFFF; // clip to 16 bits (this may not be necessary, but best to be safe?)
if (v & 0x8000) // if sign bit is set
v |= ~0xFFFF; // sign extend
return v;
}
// ---------------------------------------------------------------------------------
// c_expr - evalate an expression
// ---------------------------------------------------------------------------------
@@ -4168,15 +4249,15 @@ void c_term (EXPR *ap)
ap->value = c_esc(c);
}
else if (ctype[c] == DIGIT) { /* number */
ap->value = c_number(c,10,-1);
ap->value = signextend(c_number(c,10,-1));
}
else if (c == '0') { /* 0 starts a hex or octal constant */
if ((c = GETNEXT) == 'x') {
c = GETNEXT;
ap->value = c_number(c,16,-1);
ap->value = signextend(c_number(c,16,-1));
}
else {
ap->value = c_number(c,8,-1);
ap->value = signextend(c_number(c,8,-1));
}
}
else if (c == '*') { /* asterisk alone = org */
@@ -4501,3 +4582,4 @@ int strcmpi (char *a, char *b)
}
#endif

View File

@@ -30,9 +30,9 @@
// loads somefile.bin, writes object in 1130 IPL format to somefile.ipl
// Up to 80 columns will be written depending on what the object actually uses
//
// mkboot somefile.bin somefile.ipl 1130 0 48 SOMEF
// mkboot somefile.bin somefile.ipl 1130 /0 /47 SOMEF
//
// loads somefile.bin. Writes 72 columns (hex 48), with ident columns 73-80 = SOMEF001
// loads somefile.bin. Writes 72 columns (hex 0 to hex 47), with ident columns 73-80 = SOMEF001
//
// mkboot somefile.bin somefile.dat core 0 0 SOMEF001
//