1
0
mirror of https://github.com/simh/simh.git synced 2026-05-15 17:59:58 +00:00

PDP1, PDP8, PDP11 and PDP18b's: Properly detach when tape off reel is detected

- This change avoids the possibility of mangling a tape image if the tape
  type auto detection (12b, 16b, 18b) has changed the in memory tape
  format.
- Anyone who wants the off reel detection to have the simulator drop
  back to a sim> prompt should have a non-zero value in the STOP_OFFR
  register.
This commit is contained in:
Mark Pizzolato
2026-04-07 12:00:48 -10:00
parent b0f160fc5a
commit 5654a8fba0
8 changed files with 20 additions and 12 deletions

View File

@@ -132,7 +132,9 @@
#define IOT_SKP (1 << IOT_V_SKP)
#define IOT_V_REASON (IOT_V_SKP + 1) /* reason */
#define IOT_REASON (1 << IOT_V_REASON)
#define IORETURN(f,v) ((f)? (v): SCPE_OK) /* stop on error */
#define IORETURN(f,v) ((f)? (v): /* stop on error */ \
(((v) != STOP_DTOFF) ? SCPE_OK : \
sim_messagef ((v), "*** DECtape has gone off reel - listen for the flapping tape\r\n"), SCPE_OK)) /* stop on error */
/* I/O status flags */

View File

@@ -680,7 +680,7 @@ if (mot & DTS_DIR) /* update pos */
else uptr->pos = uptr->pos + delta;
if (((int32) uptr->pos < 0) ||
((int32) uptr->pos > (DTU_FWDEZ (uptr) + DT_EZLIN))) {
detach_unit (uptr); /* off reel? */
dt_detach (uptr); /* off reel? */
uptr->STATE = uptr->pos = 0;
unum = (int32) (uptr - dt_dev.units);
if (unum == DTA_GETUNIT (dtsa)) /* if selected, */
@@ -755,7 +755,7 @@ switch (fnc) { /* at speed, check fnc *
return SCPE_OK;
case DTS_OFR: /* off reel */
detach_unit (uptr); /* must be deselected */
dt_detach (uptr); /* must be deselected */
uptr->STATE = uptr->pos = 0; /* no visible action */
break;

View File

@@ -479,7 +479,9 @@ typedef struct {
#define STOP_RQ (TRAP_V_MAX + 6) /* RQDX3 panic */
#define STOP_SANITY (TRAP_V_MAX + 7) /* sanity timer exp */
#define STOP_DTOFF (TRAP_V_MAX + 8) /* DECtape off reel */
#define IORETURN(f,v) ((f)? (v): SCPE_OK) /* cond error return */
#define IORETURN(f,v) ((f)? (v): /* stop on error */ \
(((v) != STOP_DTOFF) ? SCPE_OK : \
sim_messagef ((v), "*** DECtape has gone off reel - listen for the flapping tape\r\n"), SCPE_OK)) /* stop on error */
/* Timers */

View File

@@ -826,7 +826,7 @@ if (mot & DTS_DIR) /* update pos */
else uptr->pos = uptr->pos + delta;
if (((int32) uptr->pos < 0) ||
((int32) uptr->pos > (DTU_FWDEZ (uptr) + DT_EZLIN))) {
detach_unit (uptr); /* off reel? */
dt_detach (uptr); /* off reel? */
uptr->STATE = 0, uptr->pos = 0;
unum = (int32) (uptr - dt_dev.units);
if ((unum == CSR_GETUNIT (tccm)) && (CSR_GETFNC (tccm) != FNC_STOP))
@@ -911,7 +911,7 @@ switch (fnc) { /* at speed, check fnc *
break;
case DTS_OFR: /* off reel */
detach_unit (uptr); /* must be deselected */
dt_detach (uptr); /* must be deselected */
uptr->STATE = 0, uptr->pos = 0; /* no visible action */
break;

View File

@@ -234,7 +234,9 @@
#define IOT_SKP (1 << IOT_V_SKP)
#define IOT_REASON (1 << IOT_V_REASON)
#define IORETURN(f,v) ((f)? (v): SCPE_OK) /* stop on error */
#define IORETURN(f,v) ((f)? (v): /* stop on error */ \
(((v) != STOP_DTOFF) ? SCPE_OK : \
sim_messagef ((v), "*** DECtape has gone off reel - listen for the flapping tape\r\n"), SCPE_OK)) /* stop on error */
/* PC change queue */

View File

@@ -869,7 +869,7 @@ if (mot & DTS_DIR) /* update pos */
else uptr->pos = uptr->pos + delta;
if (((int32) uptr->pos < 0) ||
((int32) uptr->pos > (DTU_FWDEZ (uptr) + DT_EZLIN))) {
detach_unit (uptr); /* off reel? */
dt_detach (uptr); /* off reel? */
uptr->STATE = uptr->pos = 0;
unum = (int32) (uptr - dt_dev.units);
if (unum == DTA_GETUNIT (dtsa)) /* if selected, */
@@ -945,7 +945,7 @@ switch (fnc) { /* at speed, check fnc *
return SCPE_OK;
case DTS_OFR: /* off reel */
detach_unit (uptr); /* must be deselected */
dt_detach (uptr); /* must be deselected */
uptr->STATE = uptr->pos = 0; /* no visible action */
break;

View File

@@ -78,7 +78,9 @@
#define IOT_V_REASON 13 /* reason */
#define IOT_SKP (1 << IOT_V_SKP)
#define IOT_REASON (1 << IOT_V_REASON)
#define IORETURN(f,v) ((f)? (v): SCPE_OK) /* stop on error */
#define IORETURN(f,v) ((f)? (v): /* stop on error */ \
(((v) != STOP_DTOFF) ? SCPE_OK : \
sim_messagef ((v), "*** DECtape has gone off reel - listen for the flapping tape\r\n"), SCPE_OK)) /* stop on error */
/* Timers */

View File

@@ -446,7 +446,7 @@ if (uptr->STATE & STA_DIR) /* update pos */
else uptr->pos = uptr->pos + delta;
if (((int32) uptr->pos < 0) ||
((int32) uptr->pos > (DTU_FWDEZ (uptr) + DT_EZLIN))) {
detach_unit (uptr); /* off reel */
td_detach (uptr); /* off reel */
sim_cancel (uptr); /* no timing pulses */
return TRUE;
}
@@ -503,7 +503,7 @@ switch (mot) { /* case on motion */
uptr->LASTT = sim_grtime (); /* save time */
if (((int32) uptr->pos < 0) || /* off reel? */
(uptr->pos >= (((uint32) DTU_FWDEZ (uptr)) + DT_EZLIN))) {
detach_unit (uptr);
td_detach (uptr);
return IORETURN (td_stopoffr, STOP_DTOFF);
}
break; /* check function */