diff --git a/PDP1/pdp1_dt.c b/PDP1/pdp1_dt.c index f9bd69a5..fd8a20ae 100644 --- a/PDP1/pdp1_dt.c +++ b/PDP1/pdp1_dt.c @@ -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; diff --git a/PDP18B/pdp18b_dt.c b/PDP18B/pdp18b_dt.c index 0666e3f6..76bae988 100644 --- a/PDP18B/pdp18b_dt.c +++ b/PDP18B/pdp18b_dt.c @@ -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 @@ -1269,16 +1270,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;