mirror of
https://github.com/simh/simh.git
synced 2026-01-25 19:56:25 +00:00
ALL: Standardize writelock behavior adding global UNIT_WLK & UNIT_WPRT
Historically this functionality was reimplemented within each DEVICE simulator often with slightly different implementations and inconsistencies. Solving this globally within SCP required changes in many places, but should henceforth be reasonably managed. As discussed in #1034
This commit is contained in:
@@ -94,17 +94,14 @@
|
||||
#include "pdp1_defs.h"
|
||||
|
||||
#define DT_NUMDR 8 /* #drives */
|
||||
#define UNIT_V_WLK (UNIT_V_UF + 0) /* write locked */
|
||||
#define UNIT_V_8FMT (UNIT_V_UF + 1) /* 12b format */
|
||||
#define UNIT_V_11FMT (UNIT_V_UF + 2) /* 16b format */
|
||||
#define UNIT_WLK (1 << UNIT_V_WLK)
|
||||
#define UNIT_V_8FMT (UNIT_V_UF + 0) /* 12b format */
|
||||
#define UNIT_V_11FMT (UNIT_V_UF + 1) /* 16b format */
|
||||
#define UNIT_8FMT (1 << UNIT_V_8FMT)
|
||||
#define UNIT_11FMT (1 << UNIT_V_11FMT)
|
||||
#define STATE u3 /* unit state */
|
||||
#define LASTT u4 /* last time update */
|
||||
#define DT_WC 030 /* word count */
|
||||
#define DT_CA 031 /* current addr */
|
||||
#define UNIT_WPRT (UNIT_WLK | UNIT_RO) /* write protect */
|
||||
|
||||
/* System independent DECtape constants */
|
||||
|
||||
@@ -334,8 +331,10 @@ REG dt_reg[] = {
|
||||
MTAB dt_mod[] = {
|
||||
{ MTAB_XTD|MTAB_VDV, 0, "SBSLVL", "SBSLVL",
|
||||
&dev_set_sbs, &dev_show_sbs, (void *) &dt_sbs },
|
||||
{ UNIT_WLK, 0, "write enabled", "WRITEENABLED", NULL },
|
||||
{ UNIT_WLK, UNIT_WLK, "write locked", "LOCKED", NULL },
|
||||
{ MTAB_XTD|MTAB_VUN, 0, "write enabled", "WRITEENABLED",
|
||||
&set_writelock, &show_writelock, NULL, "Write enable tape drive" },
|
||||
{ MTAB_XTD|MTAB_VUN, 1, NULL, "LOCKED",
|
||||
&set_writelock, NULL, NULL, "Write enable tape drive" },
|
||||
{ UNIT_8FMT + UNIT_11FMT, 0, "18b", NULL, NULL },
|
||||
{ UNIT_8FMT + UNIT_11FMT, UNIT_8FMT, "12b", NULL, NULL },
|
||||
{ UNIT_8FMT + UNIT_11FMT, UNIT_11FMT, "16b", NULL, NULL },
|
||||
@@ -385,8 +384,8 @@ if (pulse == 004) { /* MLC */
|
||||
if ((uptr == NULL) || /* invalid? */
|
||||
((uptr->flags) & UNIT_DIS) || /* disabled? */
|
||||
(fnc >= FNC_WMRK) || /* write mark? */
|
||||
((fnc == FNC_WRIT) && (uptr->flags & UNIT_WLK)) ||
|
||||
((fnc == FNC_WALL) && (uptr->flags & UNIT_WLK)))
|
||||
((fnc == FNC_WRIT) && (uptr->flags & UNIT_WPRT)) ||
|
||||
((fnc == FNC_WALL) && (uptr->flags & UNIT_WPRT)))
|
||||
dt_seterr (uptr, DTB_SEL); /* select err */
|
||||
else dt_newsa (dtsa);
|
||||
}
|
||||
@@ -1088,7 +1087,7 @@ if (sim_is_active (uptr)) {
|
||||
}
|
||||
fbuf = (uint32 *) uptr->filebuf; /* file buffer */
|
||||
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */
|
||||
sim_printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
|
||||
sim_printf ("%s: writing buffer to file: %s\n", sim_uname (uptr), uptr->filename);
|
||||
rewind (uptr->fileref); /* start of file */
|
||||
if (uptr->flags & UNIT_8FMT) { /* 12b? */
|
||||
for (ba = 0; ba < uptr->hwmark; ) { /* loop thru file */
|
||||
|
||||
Reference in New Issue
Block a user