mirror of
https://github.com/open-simh/simh.git
synced 2026-05-04 15:16:06 +00:00
Notes For V2.10-4
1. New Features in 2.10-4
1.1 SCP and Libraries
- Added .ini startup file capability (suggested by Hans Pufal).
- Added multiple switch evaluation points (suggested by Hans Pufal).
- Added multiple command per action.
- Added new library, sim_tape.c, for magtape emulation.
1.2 PDP-11
- Added user-defined disk capacity to RQ.
- Addec choice of controllers to TQ.
- Added user-defined tape capacity to TQ.
1.3 Interdata
- Added SHOW SELCH n command to display selector channel state.
1.4 Line Frequency Clocks (H316, Interdata, Nova, PDP-8, PDP-11,
PDP-18B, SDS)
- Added SET <device> {50HZ/60HZ}, to set the line frequency.
1.5 DEC Console Input (PDP-8, PDP-11, PDP-18B, VAX)
- Added SET TTI CTRL-C, to generate ^C from SIMH prompt (^C
crashes simulators compiled with Windows Visual C++).
1.6 Magtapes
- Revised to use magtape library for consistency.
2. Bugs Fixed in 2.10-4
- SCP: fixed bug in multiword deposits to files
- Interdata disks: fixed bug in cylinder overflow on writes
- Interdata tape: fixed bug, read error did not stop selector
channel
- Interdata precision clock: improved autocalibrate algorithm
for UNIX V7.
- Nova fixed head disk: fixed autosize algorithm.
- PDP-11 RQ and TQ: fixed bugs in queue process and in vector
calculation for VAXen.
- PDP-11 TQ: fixed overly strict implementation of illegal
modifiers check.
- PDP-11 RY: fixed autosize algorithm.
- PDP-18B CPU: fixed three EAE bugs (found by Hans Pufal).
- PDP-18B MT: fixed bugs in interrupt handling, BOT error handling.
- PDP-18B RF: removed extra bit from disk address, fixed autosize
algorithm.
- PDP-18B SYS: fixed bug in FMTASC usage (found by Hans Pufal).
- PDP-8 MT: fixed bug in BOT error handling.
- PDP-8 DF, RF, RX: fixed autosize algorithm.
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.
- 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.
- Added dynamic extension of the breakpoint table.
- Added breakpoint actions.
- Added VMS support for ! (from Mark Pizzolato).
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.
- 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)
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.
- The PDP-11 implements a stub DEUNA/DELUA (XU). The real XU
module will be included in a later release.
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.
- The PDP-10 implements a stub DEUNA/DELUA (XU). The real XU
module will be included in a later release.
3.5 PDP-1
- DECtape (then known as MicroTape) support has been added.
- The line printer and DECtape can be disabled and enabled.
- The PDP-1 supports the Type 24 serial drum (based on recently
discovered documents).
3.6 18b PDP's
- The PDP-4 supports the Type 24 serial drum (based on recently
discovered documents).
- Added RB09 fixed head disk for the PDP-9.
- Added LP09 line printer for the PDP-9 and PDP-15.
- Added variable size support and autosizing to the RF15/RF09.
3.7 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.
- Added variable size support and autosizing to the DF32 and RF08.
3.8 Nova
- Added variable size support and autosizing to the Novadisk.
3.9 AltairZ80
- A hard drive has been added for increased storage.
- Several bugs have been fixed.
3.10 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.
- The IOP microinstruction set is supported for the 21MX as well
as the 2100.
- The HP2100 supports the Access Interprocessor Link (IPL).
3.11 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.12 Simulated DECtapes
- Added support for RT11 image file format (256 x 16b) to DECtapes.
3.13 Terminals Multiplexors
- BREAK detection was added to the HP, DEC, and Interdata terminal
multiplexors.
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)
- 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).
- 18b PDP RF15/RF09: fixed IOT decoding and address wraparound
logic (found by Hans Pufal).
- 18b PDP RP15: fixed IOT decoding and command initiation.
- HP2100 IPL: changed to full duplex (found by Mike Gemeny).
- HP2100 CPU: fixed last cycle bug in DMA outpout (found by Mike
Gemeny).
- Interdata 16b CPU: fixed bug in SETM, SETMR (found by Mark
Pizzolato).
5. General Notes
WARNING: 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.
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.
This commit is contained in:
committed by
Mark Pizzolato
parent
f20f5c629d
commit
43385c9616
@@ -159,11 +159,12 @@ Peripherals
|
||||
12965 2883/2884 disk passed 12965 manual no
|
||||
12559 3030 magtape not run no documentation
|
||||
13181 7970B magtape partial in 21MX CE no
|
||||
- initial s = 102030
|
||||
- set MSC CTIME to 180000
|
||||
- do not change MSC XTIME
|
||||
- attach scratch tapes to units 0,1
|
||||
- set s = 2000 (suppress CRC/LRC)
|
||||
- run with test select a = 37737, b = 7767
|
||||
- set s = 1201 (suppress CRC/LRC)
|
||||
- run with test select a = 37757, b = 7767
|
||||
- tests 4, 14, 15 are timing dependent
|
||||
- test 19 uses non-supported read rev
|
||||
13183 7970E magtape not run in 21MX CE no
|
||||
|
||||
@@ -51,16 +51,11 @@
|
||||
*/
|
||||
|
||||
#include "hp2100_defs.h"
|
||||
#include "sim_tape.h"
|
||||
|
||||
#define MS_NUMDR 4 /* number of drives */
|
||||
#define UNIT_V_WLK (UNIT_V_UF + 0) /* write locked */
|
||||
#define UNIT_V_PNU (UNIT_V_UF + 1) /* pos not updated */
|
||||
#define UNIT_WLK (1 << UNIT_V_WLK)
|
||||
#define UNIT_PNU (1 << UNIT_V_PNU)
|
||||
#define DB_N_SIZE 16 /* max data buf */
|
||||
#define DBSIZE (1 << DB_N_SIZE) /* max data cmd */
|
||||
#define DBMASK (DBSIZE - 1)
|
||||
#define UNIT_WPRT (UNIT_WLK | UNIT_RO) /* write protect */
|
||||
#define FNC u3 /* function */
|
||||
#define UST u4 /* unit status */
|
||||
|
||||
@@ -138,12 +133,7 @@ t_stat msc_reset (DEVICE *dptr);
|
||||
t_stat msc_attach (UNIT *uptr, char *cptr);
|
||||
t_stat msc_detach (UNIT *uptr);
|
||||
t_stat msc_boot (int32 unitno, DEVICE *dptr);
|
||||
t_stat msc_vlock (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_bool ms_rdlntf (UNIT *uptr, t_mtrlnt *tbc, int32 *err);
|
||||
t_bool ms_rdlntr (UNIT *uptr, t_mtrlnt *tbc, int32 *err);
|
||||
t_bool ms_forwsp (UNIT *uptr, int32 *err);
|
||||
t_bool ms_backsp (UNIT *uptr, int32 *err);
|
||||
int32 ms_wrtrec (UNIT *uptr, t_mtrlnt lnt);
|
||||
t_stat ms_map_err (UNIT *uptr, t_stat st);
|
||||
t_stat ms_settype (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_stat ms_showtype (FILE *st, UNIT *uptr, int32 val, void *desc);
|
||||
|
||||
@@ -223,8 +213,8 @@ REG msc_reg[] = {
|
||||
{ NULL } };
|
||||
|
||||
MTAB msc_mod[] = {
|
||||
{ UNIT_WLK, 0, "write enabled", "WRITEENABLED", &msc_vlock },
|
||||
{ UNIT_WLK, UNIT_WLK, "write locked", "LOCKED", &msc_vlock },
|
||||
{ MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL },
|
||||
{ MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL },
|
||||
{ MTAB_XTD | MTAB_VDV, 0, NULL, "13181A",
|
||||
&ms_settype, NULL, NULL },
|
||||
{ MTAB_XTD | MTAB_VDV, 1, NULL, "13183A",
|
||||
@@ -285,6 +275,7 @@ return dat;
|
||||
int32 mscio (int32 inst, int32 IR, int32 dat)
|
||||
{
|
||||
int32 i, devc, devd;
|
||||
t_stat st;
|
||||
UNIT *uptr = msc_dev.units + msc_usl;
|
||||
static const uint8 map_sel[16] = {
|
||||
0, 0, 1, 1, 2, 2, 2, 2,
|
||||
@@ -314,7 +305,7 @@ case ioOTX: /* output */
|
||||
uptr = msc_dev.units + msc_usl; }
|
||||
if (((dat & FNF_MOT) && sim_is_active (uptr)) ||
|
||||
((dat & FNF_REV) && (uptr->UST & STA_BOT)) ||
|
||||
((dat & FNF_WRT) && (uptr->flags & UNIT_WPRT)))
|
||||
((dat & FNF_WRT) && sim_tape_wrp (uptr)))
|
||||
msc_sta = msc_sta | STA_REJ; /* reject? */
|
||||
break;
|
||||
case ioLIX: /* load */
|
||||
@@ -324,7 +315,7 @@ case ioMIX: /* merge */
|
||||
if (uptr->flags & UNIT_ATT) { /* online? */
|
||||
if (sim_is_active (uptr)) /* busy */
|
||||
dat = dat | STA_TBSY;
|
||||
if (uptr->flags & UNIT_WPRT) /* write prot? */
|
||||
if (sim_tape_wrp (uptr)) /* write prot? */
|
||||
dat = dat | STA_WLK; }
|
||||
else dat = dat | STA_TBSY | STA_LOCAL;
|
||||
if (ms_ctype) dat = dat | STA_PE | /* 13183A? */
|
||||
@@ -336,8 +327,9 @@ case ioCTL: /* control clear/set */
|
||||
if ((msc_buf & 0377) == FNC_CLR) { /* clear? */
|
||||
for (i = 0; i < MS_NUMDR; i++) { /* loop thru units */
|
||||
if (sim_is_active (&msc_unit[i]) && /* write in prog? */
|
||||
(msc_unit[i].FNC == FNC_WC) && (ms_ptr > 0))
|
||||
ms_wrtrec (uptr, ms_ptr | MTR_ERF);
|
||||
(msc_unit[i].FNC == FNC_WC) && (ms_ptr > 0)) {
|
||||
if (st = sim_tape_wrrecf (uptr, msxb, ms_ptr | MTR_ERF))
|
||||
ms_map_err (uptr, st); }
|
||||
if ((msc_unit[i].UST & STA_REW) == 0)
|
||||
sim_cancel (&msc_unit[i]); } /* stop if now rew */
|
||||
clrCTL (devc); /* init device */
|
||||
@@ -371,10 +363,10 @@ return dat;
|
||||
|
||||
t_stat msc_svc (UNIT *uptr)
|
||||
{
|
||||
int32 devc, devd, err, pnu;
|
||||
static t_mtrlnt i, bceof = { MTR_TMK };
|
||||
int32 devc, devd;
|
||||
t_mtrlnt tbc;
|
||||
t_stat st, r = SCPE_OK;
|
||||
|
||||
err = 0; /* assume no errors */
|
||||
devc = msc_dib.devno; /* get device nos */
|
||||
devd = msd_dib.devno;
|
||||
|
||||
@@ -383,14 +375,11 @@ if ((uptr->flags & UNIT_ATT) == 0) { /* offline? */
|
||||
setFLG (devc); /* set cch flg */
|
||||
return IORETURN (msc_stopioe, SCPE_UNATT); }
|
||||
|
||||
pnu = MT_TST_PNU (uptr); /* get pos not upd */
|
||||
MT_CLR_PNU (uptr); /* and clear */
|
||||
|
||||
switch (uptr->FNC) { /* case on function */
|
||||
case FNC_REW: /* rewind */
|
||||
case FNC_RWS: /* rewind offline */
|
||||
if (uptr->UST & STA_REW) { /* rewind in prog? */
|
||||
uptr->pos = 0; /* done */
|
||||
sim_tape_rewind (uptr); /* done */
|
||||
uptr->UST = STA_BOT; /* set BOT status */
|
||||
if (uptr->FNC & FNF_OFL) detach_unit (uptr);
|
||||
return SCPE_OK; }
|
||||
@@ -400,32 +389,40 @@ case FNC_RWS: /* rewind offline */
|
||||
|
||||
case FNC_GFM: /* gap file mark */
|
||||
case FNC_WFM: /* write file mark */
|
||||
fseek (uptr->fileref, uptr->pos, SEEK_SET);
|
||||
fxwrite (&bceof, sizeof (t_mtrlnt), 1, uptr->fileref);
|
||||
if (st = sim_tape_wrtmk (uptr)) /* write tmk, err? */
|
||||
r = ms_map_err (uptr, st); /* map error */
|
||||
msc_sta = STA_EOF; /* set EOF status */
|
||||
if (err = ferror (uptr->fileref)) MT_SET_PNU (uptr);
|
||||
else uptr->pos = uptr->pos + sizeof (t_mtrlnt); /* update tape pos */
|
||||
break;
|
||||
|
||||
case FNC_GAP: /* erase gap */
|
||||
break;
|
||||
|
||||
case FNC_FSF:
|
||||
while (ms_forwsp (uptr, &err)) ; /* spc until EOF/EOT */
|
||||
case FNC_FSR: /* space forward */
|
||||
if (st = sim_tape_sprecf (uptr, &tbc)) /* space rec fwd, err? */
|
||||
r = ms_map_err (uptr, st); /* map error */
|
||||
if (tbc & 1) msc_sta = msc_sta | STA_ODD;
|
||||
else msc_sta = msc_sta & ~STA_ODD;
|
||||
break;
|
||||
|
||||
case FNC_FSR: /* space forward */
|
||||
ms_forwsp (uptr, &err);
|
||||
case FNC_BSR:
|
||||
if (st = sim_tape_sprecr (uptr, &tbc)) /* space rec rev, err? */
|
||||
r = ms_map_err (uptr, st); /* map error */
|
||||
if (tbc & 1) msc_sta = msc_sta | STA_ODD;
|
||||
else msc_sta = msc_sta & ~STA_ODD;
|
||||
break;
|
||||
|
||||
case FNC_FSF:
|
||||
while ((st = sim_tape_sprecf (uptr, &tbc)) == MTSE_OK) ;
|
||||
if (st == MTSE_TMK) /* stopped by tmk? */
|
||||
msc_sta = msc_sta | STA_EOF | STA_ODD; /* normal status */
|
||||
else r = ms_map_err (uptr, st); /* map error */
|
||||
break;
|
||||
|
||||
case FNC_BSF:
|
||||
while (ms_backsp (uptr, &err)) ; /* spc until EOF/BOT */
|
||||
break;
|
||||
|
||||
case FNC_BSR: /* space reverse */
|
||||
if (!pnu) { /* position ok? */
|
||||
ms_backsp (uptr, &err); /* backspace */
|
||||
if (msc_sta & STA_ODD) msc_sta = msc_sta | STA_PAR; }
|
||||
while ((st = sim_tape_sprecr (uptr, &tbc)) == MTSE_OK) ;
|
||||
if (st == MTSE_TMK) /* stopped by tmk? */
|
||||
msc_sta = msc_sta | STA_EOF | STA_ODD; /* normal status */
|
||||
else r = ms_map_err (uptr, st); /* map error */
|
||||
break;
|
||||
|
||||
/* Unit service, continued */
|
||||
@@ -434,21 +431,16 @@ case FNC_RFF: /* diagnostic read */
|
||||
case FNC_RC: /* read */
|
||||
if (msc_1st) { /* first svc? */
|
||||
msc_1st = ms_ptr = 0; /* clr 1st flop */
|
||||
if (ms_rdlntf (uptr, &ms_max, &err)) { /* read rec lnt */
|
||||
if (!err) { /* tmk or eom? */
|
||||
st = sim_tape_rdrecf (uptr, msxb, &ms_max, DBSIZE); /* read rec */
|
||||
if (st == MTSE_RECE) msc_sta = msc_sta | STA_PAR; /* rec in err? */
|
||||
else if (st != MTSE_OK) { /* other error? */
|
||||
r = ms_map_err (uptr, st); /* map error */
|
||||
if (r == SCPE_OK) { /* recoverable? */
|
||||
sim_activate (uptr, msc_gtime); /* sched IRG */
|
||||
uptr->FNC = 0; /* NOP func */
|
||||
return SCPE_OK; }
|
||||
break; } /* err, done */
|
||||
if (ms_max > DBSIZE) return SCPE_MTRLNT; /* record too long? */
|
||||
i = fxread (msxb, sizeof (int8), ms_max, uptr->fileref);
|
||||
if (err = ferror (uptr->fileref)) { /* error? */
|
||||
msc_sta = msc_sta | STA_PAR; /* set flag */
|
||||
MT_SET_PNU (uptr); /* pos not upd */
|
||||
break; }
|
||||
for ( ; i < ms_max; i++) msxb[i] = 0; /* fill with 0's */
|
||||
uptr->pos = uptr->pos + ((ms_max + 1) & ~1) +
|
||||
(2 * sizeof (t_mtrlnt)); } /* update position */
|
||||
}
|
||||
if (ms_ptr < ms_max) { /* more chars? */
|
||||
if (FLG (devd)) msc_sta = msc_sta | STA_TIM | STA_PAR;
|
||||
msd_buf = ((uint16) msxb[ms_ptr] << 8) | msxb[ms_ptr + 1];
|
||||
@@ -475,7 +467,9 @@ case FNC_WC: /* write */
|
||||
sim_activate (uptr, msc_xtime); /* re-activate */
|
||||
return SCPE_OK; }
|
||||
if (ms_ptr) { /* any data? write */
|
||||
if (err = ms_wrtrec (uptr, ms_ptr)) break; }
|
||||
if (st = sim_tape_wrrecf (uptr, msxb, ms_ptr)) { /* write, err? */
|
||||
r = ms_map_err (uptr, st); /* map error */
|
||||
break; } }
|
||||
sim_activate (uptr, msc_gtime); /* sched IRG */
|
||||
uptr->FNC = 0; /* NOP func */
|
||||
return SCPE_OK;
|
||||
@@ -485,94 +479,40 @@ default: /* unknown */
|
||||
|
||||
setFLG (devc); /* set cch flg */
|
||||
msc_sta = msc_sta & ~STA_BUSY; /* update status */
|
||||
if (err != 0) { /* I/O error */
|
||||
perror ("MT I/O error");
|
||||
clearerr (uptr->fileref);
|
||||
if (msc_stopioe) return SCPE_IOERR; }
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Tape motion routines */
|
||||
/* Map tape error status */
|
||||
|
||||
t_bool ms_rdlntf (UNIT *uptr, t_mtrlnt *tbc, int32 *err)
|
||||
t_stat ms_map_err (UNIT *uptr, t_stat st)
|
||||
{
|
||||
fseek (uptr->fileref, uptr->pos, SEEK_SET); /* position */
|
||||
fxread (tbc, sizeof (t_mtrlnt), 1, uptr->fileref); /* get bc */
|
||||
if ((*err = ferror (uptr->fileref)) || /* error or eom? */
|
||||
feof (uptr->fileref) || (*tbc == MTR_EOM)) {
|
||||
msc_sta = msc_sta | STA_PAR; /* error */
|
||||
MT_SET_PNU (uptr); /* pos not upd */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_TMK) { /* tape mark? */
|
||||
uptr->pos = uptr->pos + sizeof (t_mtrlnt);
|
||||
switch (st) {
|
||||
case MTSE_FMT: /* illegal fmt */
|
||||
case MTSE_UNATT: /* unattached */
|
||||
msc_sta = msc_sta | STA_REJ; /* reject */
|
||||
case MTSE_OK: /* no error */
|
||||
return SCPE_IERR; /* never get here! */
|
||||
case MTSE_TMK: /* end of file */
|
||||
msc_sta = msc_sta | STA_EOF | STA_ODD; /* eof (also sets odd) */
|
||||
return TRUE; }
|
||||
if (MTRF (*tbc)) msc_sta = msc_sta | STA_PAR; /* error in rec? */
|
||||
*tbc = MTRL (*tbc); /* clear err flag */
|
||||
if (*tbc & 1) msc_sta = msc_sta | STA_ODD;
|
||||
else msc_sta = msc_sta & ~STA_ODD;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
t_bool ms_rdlntr (UNIT *uptr, t_mtrlnt *tbc, int32 *err)
|
||||
{
|
||||
if (uptr->pos < sizeof (t_mtrlnt)) { /* at bot? */
|
||||
break;
|
||||
case MTSE_INVRL: /* invalid rec lnt */
|
||||
msc_sta = msc_sta | STA_PAR;
|
||||
return SCPE_MTRLNT;
|
||||
case MTSE_IOERR: /* IO error */
|
||||
msc_sta = msc_sta | STA_PAR; /* error */
|
||||
if (msc_stopioe) return SCPE_IOERR;
|
||||
break;
|
||||
case MTSE_RECE: /* record in error */
|
||||
case MTSE_EOM: /* end of medium */
|
||||
msc_sta = msc_sta | STA_PAR; /* error */
|
||||
break;
|
||||
case MTSE_BOT: /* reverse into BOT */
|
||||
uptr->UST = STA_BOT; /* set status */
|
||||
return TRUE; } /* error */
|
||||
fseek (uptr->fileref, uptr->pos - sizeof (t_mtrlnt), SEEK_SET);
|
||||
fxread (tbc, sizeof (t_mtrlnt), 1, uptr->fileref); /* get bc */
|
||||
if ((*err = ferror (uptr->fileref)) || /* error or eof? */
|
||||
feof (uptr->fileref)) {
|
||||
msc_sta = msc_sta | STA_PAR; /* error */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_EOM) { /* eom? */
|
||||
msc_sta = msc_sta | STA_PAR; /* error */
|
||||
uptr->pos = uptr->pos - sizeof (t_mtrlnt); /* spc over eom */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_TMK) { /* tape mark? */
|
||||
msc_sta = msc_sta | STA_EOF; /* eof */
|
||||
uptr->pos = uptr->pos - sizeof (t_mtrlnt); /* spc over tmk */
|
||||
return TRUE; }
|
||||
if (MTRF (*tbc)) msc_sta = msc_sta | STA_PAR; /* error in rec? */
|
||||
*tbc = MTRL (*tbc); /* clear err flag */
|
||||
if (*tbc & 1) msc_sta = msc_sta | STA_ODD;
|
||||
else msc_sta = msc_sta & ~STA_ODD;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
t_bool ms_forwsp (UNIT *uptr, int32 *err)
|
||||
{
|
||||
t_mtrlnt tbc;
|
||||
|
||||
if (ms_rdlntf (uptr, &tbc, err)) return FALSE; /* read rec lnt, err? */
|
||||
uptr->pos = uptr->pos + ((tbc + 1) & ~1) + /* incr tape position */
|
||||
(2 * sizeof (t_mtrlnt));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
t_bool ms_backsp (UNIT *uptr, int32 *err)
|
||||
{
|
||||
t_mtrlnt tbc;
|
||||
|
||||
if (ms_rdlntr (uptr, &tbc, err)) return FALSE; /* read rec lnt, err? */
|
||||
uptr->pos = uptr->pos - ((MTRL (tbc) + 1) & ~1) - /* decr tape position */
|
||||
(2 * sizeof (t_mtrlnt));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int32 ms_wrtrec (UNIT *uptr, t_mtrlnt lnt)
|
||||
{
|
||||
int32 elnt = MTRL ((lnt + 1) & ~1); /* even lnt, no err */
|
||||
|
||||
fseek (uptr->fileref, uptr->pos, SEEK_SET); /* seek to record */
|
||||
fxwrite (&lnt, sizeof (t_mtrlnt), 1, uptr->fileref); /* write rec lnt */
|
||||
fxwrite (msxb, sizeof (int8), elnt, uptr->fileref); /* write data */
|
||||
fxwrite (&lnt, sizeof (t_mtrlnt), 1, uptr->fileref); /* write rec lnt */
|
||||
if (ferror (uptr->fileref)) { /* error? */
|
||||
MT_SET_PNU (uptr); /* pos not updated */
|
||||
return 1; }
|
||||
else uptr->pos = uptr->pos + elnt + (2 * sizeof (t_mtrlnt)); /* no, upd pos */
|
||||
return 0;
|
||||
break;
|
||||
case MTSE_WRP: /* write protect */
|
||||
msc_sta = msc_sta | STA_REJ; /* reject */
|
||||
break; }
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Reset routine */
|
||||
@@ -592,7 +532,7 @@ msc_dib.flg = msd_dib.flg = 1; /* set flg */
|
||||
msc_dib.fbf = msd_dib.fbf = 1; /* set fbf */
|
||||
for (i = 0; i < MS_NUMDR; i++) {
|
||||
uptr = msc_dev.units + i;
|
||||
MT_CLR_PNU (uptr);
|
||||
sim_tape_reset (uptr);
|
||||
sim_cancel (uptr);
|
||||
uptr->UST = 0; }
|
||||
return SCPE_OK;
|
||||
@@ -604,9 +544,8 @@ t_stat msc_attach (UNIT *uptr, char *cptr)
|
||||
{
|
||||
t_stat r;
|
||||
|
||||
r = attach_unit (uptr, cptr); /* attach unit */
|
||||
r = sim_tape_attach (uptr, cptr); /* attach unit */
|
||||
if (r != SCPE_OK) return r; /* update status */
|
||||
MT_CLR_PNU (uptr);
|
||||
uptr->UST = STA_BOT;
|
||||
return r;
|
||||
}
|
||||
@@ -616,16 +555,7 @@ return r;
|
||||
t_stat msc_detach (UNIT* uptr)
|
||||
{
|
||||
uptr->UST = 0; /* update status */
|
||||
MT_CLR_PNU (uptr);
|
||||
return detach_unit (uptr); /* detach unit */
|
||||
}
|
||||
|
||||
/* Write lock/enable routine */
|
||||
|
||||
t_stat msc_vlock (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
{
|
||||
if (val && (uptr->flags & UNIT_ATT)) return SCPE_ARG;
|
||||
return SCPE_OK;
|
||||
return sim_tape_detach (uptr); /* detach unit */
|
||||
}
|
||||
|
||||
/* Set controller type */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* hp2100_mt.c: HP 2100 12559A magnetic tape simulator
|
||||
|
||||
Copyright (c) 1993-2002, Robert M. Supnik
|
||||
Copyright (c) 1993-2003, 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"),
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
mt 12559A 3030 nine track magnetic tape
|
||||
|
||||
28-Feb-03 RMS Revised for magtape library
|
||||
30-Sep-02 RMS Revamped error handling
|
||||
28-Aug-02 RMS Added end of medium support
|
||||
30-May-02 RMS Widened POS to 32b
|
||||
@@ -54,15 +55,10 @@
|
||||
*/
|
||||
|
||||
#include "hp2100_defs.h"
|
||||
#include "sim_tape.h"
|
||||
|
||||
#define UNIT_V_WLK (UNIT_V_UF + 0) /* write locked */
|
||||
#define UNIT_V_PNU (UNIT_V_UF + 1) /* pos not updated */
|
||||
#define UNIT_WLK (1 << UNIT_V_WLK)
|
||||
#define UNIT_PNU (1 << UNIT_V_PNU)
|
||||
#define DB_V_SIZE 16 /* max data buf */
|
||||
#define DBSIZE (1 << DB_V_SIZE) /* max data cmd */
|
||||
#define DBMASK (DBSIZE - 1)
|
||||
#define UNIT_WPRT (UNIT_WLK | UNIT_RO) /* write protect */
|
||||
|
||||
/* Command - mtc_fnc */
|
||||
|
||||
@@ -108,12 +104,9 @@ int32 mtdio (int32 inst, int32 IR, int32 dat);
|
||||
int32 mtcio (int32 inst, int32 IR, int32 dat);
|
||||
t_stat mtc_svc (UNIT *uptr);
|
||||
t_stat mtc_reset (DEVICE *dptr);
|
||||
t_stat mtc_vlock (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_stat mtc_attach (UNIT *uptr, char *cptr);
|
||||
t_stat mtc_detach (UNIT *uptr);
|
||||
t_bool mt_rdlntf (UNIT *uptr, t_mtrlnt *tbc, int32 *err);
|
||||
t_bool mt_rdlntr (UNIT *uptr, t_mtrlnt *tbc, int32 *err);
|
||||
int32 mt_wrtrec (UNIT *uptr, t_mtrlnt lnt);
|
||||
t_stat mt_map_err (UNIT *uptr, t_stat st);
|
||||
|
||||
/* MTD data structures
|
||||
|
||||
@@ -143,6 +136,8 @@ REG mtd_reg[] = {
|
||||
{ NULL } };
|
||||
|
||||
MTAB mtd_mod[] = {
|
||||
{ MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL },
|
||||
{ MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL },
|
||||
{ MTAB_XTD | MTAB_VDV, 1, "DEVNO", "DEVNO",
|
||||
&hp_setdev, &hp_showdev, &mtd_dev },
|
||||
{ 0 } };
|
||||
@@ -183,8 +178,6 @@ REG mtc_reg[] = {
|
||||
{ NULL } };
|
||||
|
||||
MTAB mtc_mod[] = {
|
||||
{ UNIT_WLK, 0, "write enabled", "WRITEENABLED", &mtc_vlock },
|
||||
{ UNIT_WLK, UNIT_WLK, "write locked", "LOCKED", &mtc_vlock },
|
||||
{ MTAB_XTD | MTAB_VDV, 1, "DEVNO", "DEVNO",
|
||||
&hp_setdev, &hp_showdev, &mtd_dev },
|
||||
{ 0 } };
|
||||
@@ -234,6 +227,7 @@ return dat;
|
||||
int32 mtcio (int32 inst, int32 IR, int32 dat)
|
||||
{
|
||||
int32 i, devc, devd, valid;
|
||||
t_stat st;
|
||||
|
||||
devc = IR & I_DEVMASK; /* get device no */
|
||||
devd = devc - 1;
|
||||
@@ -252,8 +246,9 @@ case ioOTX: /* output */
|
||||
mtc_sta = mtc_sta & ~STA_REJ; /* clear reject */
|
||||
if (dat == FNC_CLR) { /* clear? */
|
||||
if (sim_is_active (&mtc_unit) && /* write in prog? */
|
||||
(mtc_fnc == FNC_WC) && (mt_ptr > 0)) /* yes, bad rec */
|
||||
mt_wrtrec (&mtc_unit, mt_ptr | MTR_ERF);
|
||||
(mtc_fnc == FNC_WC) && (mt_ptr > 0)) { /* yes, bad rec */
|
||||
if (st = sim_tape_wrrecf (&mtc_unit, mtxb, mt_ptr | MTR_ERF))
|
||||
mt_map_err (&mtc_unit, st); }
|
||||
if (((mtc_fnc == FNC_REW) || (mtc_fnc == FNC_RWS)) &&
|
||||
sim_is_active (&mtc_unit)) sim_cancel (&mtc_unit);
|
||||
mtc_1st = mtc_dtf = 0;
|
||||
@@ -267,7 +262,7 @@ case ioOTX: /* output */
|
||||
if (dat == mtc_cmd[i]) valid = 1;
|
||||
if (!valid || sim_is_active (&mtc_unit) || /* is cmd valid? */
|
||||
((mtc_sta & STA_BOT) && (dat == FNC_BSR)) ||
|
||||
((mtc_unit.flags & UNIT_WPRT) &&
|
||||
(sim_tape_wrp (&mtc_unit) &&
|
||||
((dat == FNC_WC) || (dat == FNC_GAP) || (dat == FNC_WFM))))
|
||||
mtc_sta = mtc_sta | STA_REJ;
|
||||
else {
|
||||
@@ -286,7 +281,7 @@ case ioMIX: /* merge */
|
||||
dat = dat | (mtc_sta & ~(STA_LOCAL | STA_WLK | STA_BUSY));
|
||||
if (mtc_unit.flags & UNIT_ATT) { /* construct status */
|
||||
if (sim_is_active (&mtc_unit)) dat = dat | STA_BUSY;
|
||||
if (mtc_unit.flags & UNIT_WPRT) dat = dat | STA_WLK; }
|
||||
if (sim_tape_wrp (&mtc_unit)) dat = dat | STA_WLK; }
|
||||
else dat = dat | STA_BUSY | STA_LOCAL;
|
||||
break;
|
||||
case ioCTL: /* control clear/set */
|
||||
@@ -309,10 +304,10 @@ return dat;
|
||||
|
||||
t_stat mtc_svc (UNIT *uptr)
|
||||
{
|
||||
int32 devc, devd, err, pnu;
|
||||
static t_mtrlnt i, bceof = { MTR_TMK };
|
||||
int32 devc, devd;
|
||||
t_mtrlnt tbc;
|
||||
t_stat st, r = SCPE_OK;
|
||||
|
||||
err = 0; /* assume no errors */
|
||||
devc = mtc_dib.devno; /* get device nos */
|
||||
devd = mtd_dib.devno;
|
||||
if ((mtc_unit.flags & UNIT_ATT) == 0) { /* offline? */
|
||||
@@ -320,66 +315,54 @@ if ((mtc_unit.flags & UNIT_ATT) == 0) { /* offline? */
|
||||
setFLG (devc); /* set cch flg */
|
||||
return IORETURN (mtc_stopioe, SCPE_UNATT); }
|
||||
|
||||
pnu = MT_TST_PNU (uptr); /* get pos not upd */
|
||||
MT_CLR_PNU (uptr); /* and clear */
|
||||
switch (mtc_fnc) { /* case on function */
|
||||
|
||||
case FNC_REW: /* rewind */
|
||||
mtc_unit.pos = 0; /* BOT */
|
||||
sim_tape_rewind (uptr); /* BOT */
|
||||
mtc_sta = STA_BOT; /* update status */
|
||||
break;
|
||||
|
||||
case FNC_RWS: /* rewind and offline */
|
||||
mtc_unit.pos = 0; /* clear position */
|
||||
return detach_unit (uptr); /* don't set cch flg */
|
||||
sim_tape_rewind (uptr); /* clear position */
|
||||
return sim_tape_detach (uptr); /* don't set cch flg */
|
||||
|
||||
case FNC_WFM: /* write file mark */
|
||||
fseek (mtc_unit.fileref, mtc_unit.pos, SEEK_SET);
|
||||
fxwrite (&bceof, sizeof (t_mtrlnt), 1, mtc_unit.fileref);
|
||||
if (st = sim_tape_wrtmk (uptr)) /* write tmk, err? */
|
||||
r = mt_map_err (uptr, st); /* map error */
|
||||
mtc_sta = STA_EOF; /* set EOF status */
|
||||
if (err = ferror (mtc_unit.fileref)) MT_SET_PNU (uptr);
|
||||
else mtc_unit.pos = mtc_unit.pos + sizeof (t_mtrlnt); /* update tape pos */
|
||||
break;
|
||||
|
||||
case FNC_GAP: /* erase gap */
|
||||
break;
|
||||
|
||||
case FNC_FSR: /* space forward */
|
||||
if (mt_rdlntf (uptr, &mt_max, &err)) break; /* read rec lnt, err? */
|
||||
mtc_unit.pos = mtc_unit.pos + ((mt_max + 1) & ~1) +
|
||||
(2 * sizeof (t_mtrlnt)); /* update position */
|
||||
if (st = sim_tape_sprecf (uptr, &tbc)) /* space rec fwd, err? */
|
||||
r = mt_map_err (uptr, st); /* map error */
|
||||
break;
|
||||
|
||||
case FNC_BSR: /* space reverse */
|
||||
if (pnu) break; /* pnu? do nothing */
|
||||
if (mt_rdlntr (uptr, &mt_max, &err)) break; /* read rec lnt, err? */
|
||||
mtc_unit.pos = mtc_unit.pos - ((mt_max + 1) & ~1) -
|
||||
(2 * sizeof (t_mtrlnt)); /* update position */
|
||||
if (st = sim_tape_sprecr (uptr, &tbc)) /* space rec rev, err? */
|
||||
r = mt_map_err (uptr, st); /* map error */
|
||||
break;
|
||||
|
||||
/* Unit service, continued */
|
||||
|
||||
case FNC_RC: /* read */
|
||||
if (mtc_1st) { /* first svc? */
|
||||
mtc_1st = 0; /* clr 1st flop */
|
||||
if (mt_rdlntf (uptr, &mt_max, &err)) { /* read rec lnt */
|
||||
if (!err) { /* tmk or eom? */
|
||||
mtc_1st = mt_ptr = 0; /* clr 1st flop */
|
||||
st = sim_tape_rdrecf (uptr, mtxb, &mt_max, DBSIZE); /* read rec */
|
||||
if (st == MTSE_RECE) mtc_sta = mtc_sta | STA_PAR; /* rec in err? */
|
||||
else if (st != MTSE_OK) { /* other error? */
|
||||
r = mt_map_err (uptr, st); /* map error */
|
||||
if (r == SCPE_OK) { /* recoverable? */
|
||||
sim_activate (uptr, mtc_gtime); /* sched IRG */
|
||||
mtc_fnc = 0; /* NOP func */
|
||||
return SCPE_OK; }
|
||||
break; } /* error, done */
|
||||
if (mt_max > DBSIZE) return SCPE_MTRLNT; /* record too long? */
|
||||
break; } /* non-recov, done */
|
||||
if (mt_max < 12) { /* record too short? */
|
||||
mtc_sta = mtc_sta | STA_PAR; /* set flag */
|
||||
break; }
|
||||
i = fxread (mtxb, sizeof (int8), mt_max, mtc_unit.fileref);
|
||||
for ( ; i < mt_max; i++) mtxb[i] = 0; /* fill with 0's */
|
||||
if (err = ferror (mtc_unit.fileref)) { /* error? */
|
||||
mtc_sta = mtc_sta | STA_PAR; /* set flag */
|
||||
MT_SET_PNU (uptr); /* pos not upd */
|
||||
break; }
|
||||
mtc_unit.pos = mtc_unit.pos + ((mt_max + 1) & ~1) +
|
||||
(2 * sizeof (t_mtrlnt)); } /* update position */
|
||||
}
|
||||
if (mt_ptr < mt_max) { /* more chars? */
|
||||
if (FLG (devd)) mtc_sta = mtc_sta | STA_TIM;
|
||||
mtc_unit.buf = mtxb[mt_ptr++]; /* fetch next */
|
||||
@@ -402,7 +385,9 @@ case FNC_WC: /* write */
|
||||
sim_activate (uptr, mtc_xtime); /* re-activate */
|
||||
return SCPE_OK; }
|
||||
if (mt_ptr) { /* write buffer */
|
||||
if (err = mt_wrtrec (uptr, mt_ptr)) break; }
|
||||
if (st = sim_tape_wrrecf (uptr, mtxb, mt_ptr)) { /* write, err? */
|
||||
r = mt_map_err (uptr, st); /* map error */
|
||||
break; } } /* done */
|
||||
sim_activate (uptr, mtc_gtime); /* schedule gap */
|
||||
mtc_fnc = 0; /* nop */
|
||||
return SCPE_OK;
|
||||
@@ -412,70 +397,40 @@ default: /* unknown */
|
||||
|
||||
setFLG (devc); /* set cch flg */
|
||||
mtc_sta = mtc_sta & ~STA_BUSY; /* not busy */
|
||||
if (err != 0) { /* I/O error */
|
||||
perror ("MT I/O error");
|
||||
clearerr (mtc_unit.fileref);
|
||||
if (mtc_stopioe) return SCPE_IOERR; }
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Tape motion routines */
|
||||
/* Map tape error status */
|
||||
|
||||
t_bool mt_rdlntf (UNIT *uptr, t_mtrlnt *tbc, int32 *err)
|
||||
t_stat mt_map_err (UNIT *uptr, t_stat st)
|
||||
{
|
||||
fseek (uptr->fileref, uptr->pos, SEEK_SET); /* position */
|
||||
fxread (tbc, sizeof (t_mtrlnt), 1, uptr->fileref); /* get bc */
|
||||
if ((*err = ferror (uptr->fileref)) || /* error or eom? */
|
||||
feof (uptr->fileref) || (*tbc == MTR_EOM)) {
|
||||
mtc_sta = mtc_sta | STA_PAR; /* error */
|
||||
MT_SET_PNU (uptr); /* pos not upd */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_TMK) { /* tape mark? */
|
||||
switch (st) {
|
||||
case MTSE_FMT: /* illegal fmt */
|
||||
case MTSE_UNATT: /* unattached */
|
||||
mtc_sta = mtc_sta | STA_REJ; /* reject */
|
||||
case MTSE_OK: /* no error */
|
||||
return SCPE_IERR; /* never get here! */
|
||||
case MTSE_TMK: /* end of file */
|
||||
mtc_sta = mtc_sta | STA_EOF; /* eof */
|
||||
uptr->pos = uptr->pos + sizeof (t_mtrlnt); /* spc over tmk */
|
||||
return TRUE; }
|
||||
if (MTRF (*tbc)) mtc_sta = mtc_sta | STA_PAR; /* error in rec? */
|
||||
*tbc = MTRL (*tbc); /* clear err flag */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
t_bool mt_rdlntr (UNIT *uptr, t_mtrlnt *tbc, int32 *err)
|
||||
{
|
||||
if (uptr->pos < sizeof (t_mtrlnt)) { /* no data to read? */
|
||||
mtc_sta = mtc_sta | STA_BOT; /* update status */
|
||||
return TRUE; }
|
||||
fseek (uptr->fileref, uptr->pos - sizeof (t_mtrlnt), SEEK_SET);
|
||||
fxread (tbc, sizeof (t_mtrlnt), 1, uptr->fileref); /* get bc */
|
||||
if ((*err = ferror (uptr->fileref)) || /* error or eof? */
|
||||
feof (uptr->fileref)) {
|
||||
break;
|
||||
case MTSE_IOERR: /* IO error */
|
||||
mtc_sta = mtc_sta | STA_PAR; /* error */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_EOM) { /* eom? */
|
||||
if (mtc_stopioe) return SCPE_IOERR;
|
||||
break;
|
||||
case MTSE_INVRL: /* invalid rec lnt */
|
||||
mtc_sta = mtc_sta | STA_PAR;
|
||||
return SCPE_MTRLNT;
|
||||
case MTSE_RECE: /* record in error */
|
||||
case MTSE_EOM: /* end of medium */
|
||||
mtc_sta = mtc_sta | STA_PAR; /* error */
|
||||
uptr->pos = uptr->pos - sizeof (t_mtrlnt); /* spc over eom */
|
||||
return TRUE; }
|
||||
if (*tbc == MTR_TMK) { /* tape mark? */
|
||||
mtc_sta = mtc_sta | STA_EOF; /* eof */
|
||||
uptr->pos = uptr->pos - sizeof (t_mtrlnt); /* spc over tmk */
|
||||
return TRUE; }
|
||||
if (MTRF (*tbc)) mtc_sta = mtc_sta | STA_PAR; /* error in rec? */
|
||||
*tbc = MTRL (*tbc); /* clear err flag */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int32 mt_wrtrec (UNIT *uptr, t_mtrlnt lnt)
|
||||
{
|
||||
int32 elnt = MTRL ((lnt + 1) & ~1); /* even lnt, no err */
|
||||
|
||||
fseek (uptr->fileref, uptr->pos, SEEK_SET); /* seek to record */
|
||||
fxwrite (&lnt, sizeof (t_mtrlnt), 1, uptr->fileref); /* write rec lnt */
|
||||
fxwrite (mtxb, sizeof (int8), elnt, uptr->fileref); /* write data */
|
||||
fxwrite (&lnt, sizeof (t_mtrlnt), 1, uptr->fileref); /* write rec lnt */
|
||||
if (ferror (uptr->fileref)) { /* error? */
|
||||
MT_SET_PNU (uptr); /* pos not updated */
|
||||
return 1; }
|
||||
else uptr->pos = uptr->pos + elnt + (2 * sizeof (t_mtrlnt)); /* no, upd pos */
|
||||
return 0;
|
||||
break;
|
||||
case MTSE_BOT: /* reverse into BOT */
|
||||
mtc_sta = mtc_sta | STA_BOT; /* set status */
|
||||
break;
|
||||
case MTSE_WRP: /* write protect */
|
||||
mtc_sta = mtc_sta | STA_REJ; /* reject */
|
||||
break; }
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Reset routine */
|
||||
@@ -490,9 +445,10 @@ mtc_dib.ctl = mtd_dib.ctl = 0; /* clear ctl */
|
||||
mtc_dib.flg = mtd_dib.flg = 0; /* clear flg */
|
||||
mtc_dib.fbf = mtd_dib.fbf = 0; /* clear fbf */
|
||||
sim_cancel (&mtc_unit); /* cancel activity */
|
||||
mtc_unit.flags = mtc_unit.flags & ~UNIT_PNU; /* clear pos flag */
|
||||
if (mtc_unit.flags & UNIT_ATT) mtc_sta = ((mtc_unit.pos)? 0: STA_BOT) |
|
||||
((mtc_unit.flags & UNIT_WPRT)? STA_WLK: 0);
|
||||
sim_tape_reset (&mtc_unit);
|
||||
if (mtc_unit.flags & UNIT_ATT) mtc_sta =
|
||||
(sim_tape_bot (&mtc_unit)? STA_BOT: 0) |
|
||||
(sim_tape_wrp (&mtc_unit)? STA_WLK: 0);
|
||||
else mtc_sta = STA_LOCAL | STA_BUSY;
|
||||
return SCPE_OK;
|
||||
}
|
||||
@@ -503,9 +459,8 @@ t_stat mtc_attach (UNIT *uptr, char *cptr)
|
||||
{
|
||||
t_stat r;
|
||||
|
||||
r = attach_unit (uptr, cptr); /* attach unit */
|
||||
r = sim_tape_attach (uptr, cptr); /* attach unit */
|
||||
if (r != SCPE_OK) return r; /* update status */
|
||||
MT_CLR_PNU (uptr);
|
||||
mtc_sta = STA_BOT;
|
||||
return r;
|
||||
}
|
||||
@@ -515,14 +470,5 @@ return r;
|
||||
t_stat mtc_detach (UNIT* uptr)
|
||||
{
|
||||
mtc_sta = 0; /* update status */
|
||||
MT_CLR_PNU (uptr);
|
||||
return detach_unit (uptr); /* detach unit */
|
||||
}
|
||||
|
||||
/* Write lock/enable routine */
|
||||
|
||||
t_stat mtc_vlock (UNIT *uptr, int32 val, char *cptr, void *desc)
|
||||
{
|
||||
if (val && (uptr->flags & UNIT_ATT)) return SCPE_ARG;
|
||||
return SCPE_OK;
|
||||
return sim_tape_detach (uptr); /* detach unit */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user