PDP1, PDP18B: Fixed dt_seterr to handle nx unit select (COVERITY)

This commit is contained in:
Bob Supnik 2017-03-09 20:09:02 -08:00 committed by Mark Pizzolato
parent 3530f0de7d
commit 706de798ba
2 changed files with 22 additions and 18 deletions

View file

@ -1,6 +1,6 @@
/* pdp1_dt.c: 18b DECtape simulator
Copyright (c) 1993-2015, Robert M Supnik
Copyright (c) 1993-2017, 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 @@
dt Type 550/555 DECtape
09-Mar-17 RMS Fixed dt_seterr to handle nx unit select (COVERITY)
28-Mar-15 RMS Revised to use sim_printf
21-Dec-06 RMS Added 16-channel SBS support
23-Jun-06 RMS Fixed conflict in ATTACH switches
@ -856,16 +857,17 @@ return SCPE_OK;
void dt_seterr (UNIT *uptr, int32 e)
{
int32 mot = DTS_GETMOT (uptr->STATE);
dtsa = dtsa & ~DTA_STSTP; /* clear go */
dtsb = dtsb | DTB_ERF | e; /* set error flag */
if (mot >= DTS_ACCF) { /* ~stopped or stopping? */
sim_cancel (uptr); /* cancel activity */
if (dt_setpos (uptr)) /* update position */
return;
sim_activate (uptr, dt_dctime); /* sched decel */
DTS_SETSTA (DTS_DECF | (mot & DTS_DIR), 0); /* state = decel */
if (uptr != NULL) { /* valid unit? */
int32 mot = DTS_GETMOT (uptr->STATE); /* get motion */
if (mot >= DTS_ACCF) { /* ~stopped or stopping? */
sim_cancel (uptr); /* cancel activity */
if (dt_setpos (uptr)) /* update position */
return;
sim_activate (uptr, dt_dctime); /* sched decel */
DTS_SETSTA (DTS_DECF | (mot & DTS_DIR), 0); /* state = decel */
}
}
DT_UPDINT;
return;

View file

@ -1,6 +1,6 @@
/* pdp18b_dt.c: 18b DECtape simulator
Copyright (c) 1993-2016, Robert M Supnik
Copyright (c) 1993-2017, 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"),
@ -27,6 +27,7 @@
(PDP-9) TC02/TU55 DECtape
(PDP-15) TC15/TU56 DECtape
09-Mar-17 RMS Fixed dt_seterr to handle nx unit select (COVERITY)
10-Mar-16 RMS Added 3-cycle databreak set/show entries
07-Mar-16 RMS Revised for dynamically allocated memory
13-Mar-15 RMS Added APIVEC register
@ -1271,16 +1272,17 @@ return SCPE_OK;
void dt_seterr (UNIT *uptr, int32 e)
{
int32 mot = DTS_GETMOT (uptr->STATE);
dtsa = dtsa & ~DTA_STSTP; /* clear go */
dtsb = dtsb | DTB_ERF | e; /* set error flag */
if (mot >= DTS_ACCF) { /* ~stopped or stopping? */
sim_cancel (uptr); /* cancel activity */
if (dt_setpos (uptr)) /* update position */
return;
sim_activate (uptr, dt_dctime); /* sched decel */
DTS_SETSTA (DTS_DECF | (mot & DTS_DIR), 0); /* state = decel */
if (uptr != NULL) { /* valid select? */
int32 mot = DTS_GETMOT (uptr->STATE); /* get motion */
if (mot >= DTS_ACCF) { /* ~stopped or stopping? */
sim_cancel (uptr); /* cancel activity */
if (dt_setpos (uptr)) /* update position */
return;
sim_activate (uptr, dt_dctime); /* sched decel */
DTS_SETSTA (DTS_DECF | (mot & DTS_DIR), 0); /* state = decel */
}
}
DT_UPDINT;
return;