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).
326 lines
11 KiB
C
326 lines
11 KiB
C
/* pdp1_drm.c: PDP-1 drum simulator
|
||
|
||
Copyright (c) 1993-2002, Robert M Supnik
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a
|
||
copy of this software and associated documentation files (the "Software"),
|
||
to deal in the Software without restriction, including without limitation
|
||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||
and/or sell copies of the Software, and to permit persons to whom the
|
||
Software is furnished to do so, subject to the following conditions:
|
||
|
||
The above copyright notice and this permission notice shall be included in
|
||
all copies or substantial portions of the Software.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
||
Except as contained in this notice, the name of Robert M Supnik shall not
|
||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||
in this Software without prior written authorization from Robert M Supnik.
|
||
|
||
drp Type 23 parallel drum
|
||
drm Type 24 serial drum
|
||
|
||
08-Dec-03 RMS Added parallel drum support
|
||
Fixed bug in DBL/DCN decoding
|
||
26-Oct-03 RMS Cleaned up buffer copy code
|
||
23-Jul-03 RMS Fixed incorrect logical, missing activate
|
||
05-Dec-02 RMS Cloned from pdp18b_drm.c
|
||
*/
|
||
|
||
#include "pdp1_defs.h"
|
||
#include <math.h>
|
||
|
||
/* Serial drum constants */
|
||
|
||
#define DRM_NUMWDS 256 /* words/sector */
|
||
#define DRM_NUMSC 2 /* sectors/track */
|
||
#define DRM_NUMTR 256 /* tracks/drum */
|
||
#define DRM_NUMWDT (DRM_NUMWDS * DRM_NUMSC) /* words/track */
|
||
#define DRM_SIZE (DRM_NUMTR * DRM_NUMWDT) /* words/drum */
|
||
#define DRM_SMASK ((DRM_NUMTR * DRM_NUMSC) - 1) /* sector mask */
|
||
|
||
/* Parallel drum constants */
|
||
|
||
#define DRP_NUMWDT 4096 /* words/track */
|
||
#define DRP_NUMTK 32 /* tracks/drum */
|
||
#define DRP_SIZE (DRP_NUMWDT * DRP_NUMTK) /* words/drum */
|
||
#define DRP_V_RWE 17 /* read/write enable */
|
||
#define DRP_V_FLD 12 /* drum field */
|
||
#define DRP_M_FLD 037
|
||
#define DRP_TAMASK 07777 /* track address */
|
||
#define DRP_WCMASK 07777 /* word count */
|
||
#define DRP_MAINCM 07777 /* mem addr incr */
|
||
#define DRP_GETRWE(x) (((x) >> DRP_V_RWE) & 1)
|
||
#define DRP_GETRWF(x) (((x) >> DRP_V_FLD) & DRP_M_FLD)
|
||
|
||
/* Parameters in the unit descriptor */
|
||
|
||
#define FUNC u4 /* function */
|
||
#define DRM_READ 000 /* read */
|
||
#define DRM_WRITE 010 /* write */
|
||
#define DRP_RW 000 /* read/write */
|
||
#define DRP_BRK 001 /* break on address */
|
||
|
||
#define GET_POS(x) ((int) fmod (sim_gtime() / ((double) (x)), \
|
||
((double) DRM_NUMWDT)))
|
||
|
||
extern int32 M[];
|
||
extern int32 iosta, sbs;
|
||
extern int32 stop_inst;
|
||
extern UNIT cpu_unit;
|
||
|
||
/* Serial drum variables */
|
||
|
||
uint32 drm_da = 0; /* track address */
|
||
uint32 drm_ma = 0; /* memory address */
|
||
uint32 drm_err = 0; /* error flag */
|
||
uint32 drm_wlk = 0; /* write lock */
|
||
int32 drm_time = 4; /* inter-word time */
|
||
int32 drm_stopioe = 1; /* stop on error */
|
||
|
||
/* Parallel drum variables */
|
||
|
||
uint32 drp_rde = 0; /* read enable */
|
||
uint32 drp_wre = 0; /* write enable */
|
||
uint32 drp_rdf = 0; /* read field */
|
||
uint32 drp_wrf = 0; /* write field */
|
||
uint32 drp_ta = 0; /* track address */
|
||
uint32 drp_wc = 0; /* word count */
|
||
uint32 drp_ma = 0; /* memory address */
|
||
uint32 drp_err = 0; /* error */
|
||
int32 drp_time = 2; /* inter-word time */
|
||
int32 drp_stopioe = 1; /* stop on error */
|
||
|
||
/* Forward declarations */
|
||
|
||
t_stat drm_svc (UNIT *uptr);
|
||
t_stat drm_reset (DEVICE *dptr);
|
||
t_stat drp_svc (UNIT *uptr);
|
||
t_stat drp_reset (DEVICE *dptr);
|
||
|
||
/* DRM data structures
|
||
|
||
drm_dev DRM device descriptor
|
||
drm_unit DRM unit descriptor
|
||
drm_reg DRM register list
|
||
*/
|
||
|
||
UNIT drm_unit =
|
||
{ UDATA (&drm_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_BUFABLE+UNIT_MUSTBUF,
|
||
DRM_SIZE) };
|
||
|
||
REG drm_reg[] = {
|
||
{ ORDATA (DA, drm_da, 9) },
|
||
{ ORDATA (MA, drm_ma, 16) },
|
||
{ FLDATA (DONE, iosta, IOS_V_DRM) },
|
||
{ FLDATA (ERR, drm_err, 0) },
|
||
{ ORDATA (WLK, drm_wlk, 32) },
|
||
{ DRDATA (TIME, drm_time, 24), REG_NZ + PV_LEFT },
|
||
{ FLDATA (STOP_IOE, drm_stopioe, 0) },
|
||
{ NULL } };
|
||
|
||
DEVICE drm_dev = {
|
||
"DRM", &drm_unit, drm_reg, NULL,
|
||
1, 8, 20, 1, 8, 18,
|
||
NULL, NULL, &drm_reset,
|
||
NULL, NULL, NULL,
|
||
NULL, DEV_DISABLE };
|
||
|
||
/* DRP data structures
|
||
|
||
drp_dev DRP device descriptor
|
||
drp_unit DRP unit descriptor
|
||
drp_reg DRP register list
|
||
*/
|
||
|
||
UNIT drp_unit =
|
||
{ UDATA (&drp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_BUFABLE+UNIT_MUSTBUF,
|
||
DRM_SIZE) };
|
||
|
||
REG drp_reg[] = {
|
||
{ ORDATA (TA, drp_ta, 12) },
|
||
{ ORDATA (RDF, drp_rdf, 5) },
|
||
{ FLDATA (RDE, drp_rde, 0) },
|
||
{ FLDATA (WRF, drp_wrf, 5) },
|
||
{ FLDATA (WRE, drp_wre, 0) },
|
||
{ ORDATA (MA, drp_ma, 16) },
|
||
{ ORDATA (WC, drp_wc, 12) },
|
||
{ FLDATA (BUSY, iosta, IOS_V_DRP) },
|
||
{ FLDATA (ERR, drp_err, 0) },
|
||
{ DRDATA (TIME, drp_time, 24), REG_NZ + PV_LEFT },
|
||
{ FLDATA (STOP_IOE, drp_stopioe, 0) },
|
||
{ NULL } };
|
||
|
||
DEVICE drp_dev = {
|
||
"DRP", &drp_unit, drp_reg, NULL,
|
||
1, 8, 20, 1, 8, 18,
|
||
NULL, NULL, &drp_reset,
|
||
NULL, NULL, NULL,
|
||
NULL, DEV_DISABLE | DEV_DIS };
|
||
|
||
/* IOT routines */
|
||
|
||
int32 drm (int32 IR, int32 dev, int32 dat)
|
||
{
|
||
int32 t;
|
||
int32 pulse = (IR >> 6) & 037;
|
||
|
||
if ((drm_dev.flags & DEV_DIS) == 0) { /* serial enabled? */
|
||
if ((pulse != 001) && (pulse != 011)) /* invalid pulse? */
|
||
return (stop_inst << IOT_V_REASON) | dat; /* stop if requested */
|
||
switch (dev) { /* switch on device */
|
||
case 061: /* DWR, DRD */
|
||
drm_ma = dat & AMASK; /* load mem addr */
|
||
drm_unit.FUNC = pulse & DRM_WRITE; /* save function */
|
||
break;
|
||
case 062: /* DBL, DCN */
|
||
if ((pulse & 010) == 0) /* DBL? */
|
||
drm_da = dat & DRM_SMASK; /* load sector # */
|
||
iosta = iosta & ~IOS_DRM; /* clear flags */
|
||
drm_err = 0;
|
||
t = ((drm_da % DRM_NUMSC) * DRM_NUMWDS) - GET_POS (drm_time);
|
||
if (t <= 0) t = t + DRM_NUMWDT; /* wrap around? */
|
||
sim_activate (&drm_unit, t); /* start operation */
|
||
break;
|
||
case 063: /* DTD */
|
||
if (pulse == 011) return (stop_inst << IOT_V_REASON) | dat;
|
||
if (iosta & IOS_DRM) return (dat | IOT_SKP); /* skip if done */
|
||
break;
|
||
case 064: /* DSE, DSP */
|
||
if ((drm_err == 0) || (pulse & 010)) /* no error, par test? */
|
||
return (dat | IOT_SKP);
|
||
} /* end case */
|
||
return dat; } /* end if serial */
|
||
|
||
if ((drp_dev.flags & DEV_DIS) == 0) { /* parallel enabled? */
|
||
switch (dev) { /* switch on device */
|
||
case 061: /* DIA, DBA */
|
||
drp_err = 0; /* clear error */
|
||
iosta = iosta & ~IOS_DRP; /* not busy */
|
||
drp_rde = DRP_GETRWE (dat); /* set read enable */
|
||
drp_rdf = DRP_GETRWF (dat); /* set read field */
|
||
drp_ta = dat & DRP_TAMASK; /* set track addr */
|
||
if (IR & 02000) { /* DBA? */
|
||
t = drp_ta - GET_POS (drp_time); /* delta words */
|
||
if (t <= 0) t = t + DRP_NUMWDT; /* wrap around? */
|
||
sim_activate (&drp_unit, t); /* start operation */
|
||
drp_unit.FUNC = DRP_BRK; } /* mark as break */
|
||
else drp_unit.FUNC = DRP_RW; /* no, read/write */
|
||
break;
|
||
case 062: /* DWC, DRA */
|
||
if (IR & 02000) dat = GET_POS (drp_time) | /* DRA, get position */
|
||
(drp_err? 0400000: 0);
|
||
else { /* DWC */
|
||
drp_wre = DRP_GETRWE (dat); /* set write enable */
|
||
drp_wrf = DRP_GETRWF (dat); /* set write field */
|
||
drp_wc = dat & DRP_WCMASK; } /* set word count */
|
||
break;
|
||
case 063: /* DCL */
|
||
drp_ma = dat & AMASK; /* set mem address */
|
||
t = drp_ta - GET_POS (drp_time); /* delta words */
|
||
if (t <= 0) t = t + DRP_NUMWDT; /* wrap around? */
|
||
sim_activate (&drp_unit, t); /* start operation */
|
||
iosta = iosta | IOS_DRP; /* set busy */
|
||
break;
|
||
case 064: /* not assigned */
|
||
return (stop_inst << IOT_V_REASON) | dat; /* stop if requested */
|
||
} /* end case */
|
||
return dat; } /* end if parallel */
|
||
|
||
return (stop_inst << IOT_V_REASON) | dat; /* stop if requested */
|
||
}
|
||
|
||
/* Serial unit service - this code assumes the entire drum is buffered */
|
||
|
||
t_stat drm_svc (UNIT *uptr)
|
||
{
|
||
uint32 i, da;
|
||
uint32 *fbuf = uptr->filebuf;
|
||
|
||
if ((uptr->flags & UNIT_BUF) == 0) { /* not buf? abort */
|
||
drm_err = 1; /* set error */
|
||
iosta = iosta | IOS_DRM; /* set done */
|
||
sbs = sbs | SB_RQ; /* req intr */
|
||
return IORETURN (drm_stopioe, SCPE_UNATT); }
|
||
|
||
da = drm_da * DRM_NUMWDS; /* compute dev addr */
|
||
for (i = 0; i < DRM_NUMWDS; i++, da++) { /* do transfer */
|
||
if (uptr->FUNC == DRM_READ) { /* read? */
|
||
if (MEM_ADDR_OK (drm_ma)) /* if !nxm */
|
||
M[drm_ma] = fbuf[da]; } /* read word */
|
||
else { /* write */
|
||
if ((drm_wlk >> (drm_da >> 4)) & 1) drm_err = 1;
|
||
else { /* not locked */
|
||
fbuf[da] = M[drm_ma]; /* write word */
|
||
if (da >= uptr->hwmark) uptr->hwmark = da + 1; } }
|
||
drm_ma = (drm_ma + 1) & AMASK; } /* incr mem addr */
|
||
drm_da = (drm_da + 1) & DRM_SMASK; /* incr dev addr */
|
||
iosta = iosta | IOS_DRM; /* set done */
|
||
sbs = sbs | SB_RQ; /* req intr */
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* Reset routine */
|
||
|
||
t_stat drm_reset (DEVICE *dptr)
|
||
{
|
||
if ((drm_dev.flags & DEV_DIS) == 0)
|
||
drp_dev.flags = drp_dev.flags | DEV_DIS;
|
||
drm_da = drm_ma = drm_err = 0;
|
||
iosta = iosta & ~IOS_DRM;
|
||
sim_cancel (&drm_unit);
|
||
drm_unit.FUNC = 0;
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* Parallel unit service - this code assumes the entire drum is buffered */
|
||
|
||
t_stat drp_svc (UNIT *uptr)
|
||
{
|
||
uint32 i, lim;
|
||
uint32 *fbuf = uptr->filebuf;
|
||
|
||
if ((uptr->flags & UNIT_BUF) == 0) { /* not buf? abort */
|
||
drp_err = 1; /* set error */
|
||
iosta = iosta & ~IOS_DRP; /* clear busy */
|
||
if (uptr->FUNC) sbs = sbs | SB_RQ; /* req intr */
|
||
return IORETURN (drp_stopioe, SCPE_UNATT); }
|
||
|
||
if (uptr->FUNC == DRP_RW) { /* read/write? */
|
||
lim = drp_wc? drp_wc: DRP_TAMASK + 1; /* eff word count */
|
||
for (i = 0; i < lim; i++) { /* do transfer */
|
||
if (drp_wre) /* write enabled? */
|
||
fbuf[(drp_wrf << DRP_V_FLD) | drp_ta] = M[drp_ma];
|
||
if (drp_rde && MEM_ADDR_OK (drp_ma)) /* read enabled? */
|
||
M[drp_ma] = fbuf[(drp_rdf << DRP_V_FLD) | drp_ta];
|
||
drp_ta = (drp_ta + 1) & DRP_TAMASK; /* incr track addr */
|
||
drp_ma = ((drp_ma & ~DRP_MAINCM) | ((drp_ma + 1) & DRP_MAINCM));
|
||
} /* end for */
|
||
} /* end if */
|
||
iosta = iosta & ~IOS_DRP; /* clear busy */
|
||
if (uptr->FUNC) sbs = sbs | SB_RQ; /* req intr */
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* Reset routine */
|
||
|
||
t_stat drp_reset (DEVICE *dptr)
|
||
{
|
||
if ((drp_dev.flags & DEV_DIS) == 0)
|
||
drm_dev.flags = drm_dev.flags | DEV_DIS;
|
||
drp_ta = 0;
|
||
drp_rde = drp_rdf = drp_wre = drp_wrf = 0;
|
||
drp_err = 0;
|
||
drp_ma = 0;
|
||
drp_wc = 0;
|
||
iosta = iosta & ~IOS_DRP;
|
||
sim_cancel (&drp_unit);
|
||
drp_unit.FUNC = 0;
|
||
return SCPE_OK;
|
||
}
|