1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 12:02:14 +00:00

PDP8, PDP18b: Fixed RF, DF, DT device bug if read overwrites WC memory location

This commit is contained in:
Bob Supnik
2021-06-08 01:43:32 -07:00
committed by Mark Pizzolato
parent e039527a34
commit 6edc4994eb
5 changed files with 42 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
/* pdp8_df.c: DF32 fixed head disk simulator
Copyright (c) 1993-2013, Robert M Supnik
Copyright (c) 1993-2021, 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 @@
df DF32 fixed head disk
21-Apr-21 RMS Fixed bug if read overwrites WC memory location
17-Sep-13 RMS Changed to use central set_bootpc routine
03-Sep-13 RMS Added explicit void * cast
15-May-06 RMS Fixed bug in autosize attach (Dave Gesswein)
@@ -252,6 +253,7 @@ t_stat df_svc (UNIT *uptr)
int32 pa, t, mex;
uint32 da;
int16 *fbuf = (int16 *) uptr->filebuf;
uint16 wc = 0;
UPDATE_PCELL; /* update photocell */
if ((uptr->flags & UNIT_BUF) == 0) { /* not buf? abort */
@@ -267,11 +269,12 @@ do {
df_sta = df_sta | DFS_NXD;
break;
}
M[DF_WC] = (M[DF_WC] + 1) & 07777; /* incr word count */
wc = M[DF_WC] = (M[DF_WC] + 1) & 07777; /* incr word count */
M[DF_MA] = (M[DF_MA] + 1) & 07777; /* incr mem addr */
pa = mex | M[DF_MA]; /* add extension */
if (uptr->FUNC == DF_READ) { /* read? */
if (MEM_ADDR_OK (pa)) M[pa] = fbuf[da]; /* if !nxm, read wd */
if (MEM_ADDR_OK (pa)) /* if !nxm, read wd */
M[pa] = fbuf[da];
}
else { /* write */
t = (da >> 14) & 07; /* check wr lock */
@@ -283,9 +286,9 @@ do {
}
}
da = (da + 1) & 0377777; /* incr disk addr */
} while ((M[DF_WC] != 0) && (df_burst != 0)); /* brk if wc, no brst */
} while ((wc != 0) && (df_burst != 0)); /* brk if wc, no brst */
if ((M[DF_WC] != 0) && ((df_sta & DFS_ERR) == 0)) /* more to do? */
if ((wc != 0) && ((df_sta & DFS_ERR) == 0)) /* more to do? */
sim_activate (&df_unit, df_time); /* sched next */
else {
if (uptr->FUNC != DF_READ)

View File

@@ -25,6 +25,7 @@
dt TC08/TU56 DECtape
03-May-21 RMS Fixed bug if read overwrites WC memory location
01-Jul-20 RMS Fixed comments in bootstrap (Bernhard Baehr)
15-Mar-17 RMS Fixed dt_seterr to clear successor states
17-Sep-13 RMS Changed to use central set_bootpc routine
@@ -764,10 +765,10 @@ switch (fnc) { /* at speed, check fnc *
sim_activate (uptr, DTU_LPERB (uptr) * dt_ltime);/* sched next block */
M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr word cnt */
ma = DTB_GETMEX (dtsb) | M[DT_CA]; /* get mem addr */
if (MEM_ADDR_OK (ma)) /* store block # */
M[ma] = blk & 07777;
if (((dtsa & DTA_MODE) == 0) || (M[DT_WC] == 0))
dtsb = dtsb | DTB_DTF; /* set DTF */
if (MEM_ADDR_OK (ma)) /* store block # */
M[ma] = blk & 07777;
break;
case DTS_OFR: /* off reel */
@@ -806,22 +807,22 @@ switch (fnc) { /* at speed, check fnc *
case 0: /* normal read */
M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */
M[DT_CA] = (M[DT_CA] + 1) & 07777;
if (M[DT_WC] == 0) /* wc ovf? */
dt_substate = DTO_WCO;
ma = DTB_GETMEX (dtsb) | M[DT_CA]; /* get mem addr */
ba = (blk * DTU_BSIZE (uptr)) + wrd; /* buffer ptr */
dat = fbuf[ba]; /* get tape word */
if (dir) /* rev? comp obv */
dat = dt_comobv (dat);
if (MEM_ADDR_OK (ma)) /* mem addr legal? */
M[ma] = dat;
if (M[DT_WC] == 0) /* wc ovf? */
dt_substate = DTO_WCO; /* fall through */
M[ma] = dat; /* fall through */
case DTO_WCO: /* wc ovf, not sob */
if (wrd != (dir? 0: DTU_BSIZE (uptr) - 1)) /* not last? */
sim_activate (uptr, DT_WSIZE * dt_ltime);
else {
dt_substate = dt_substate | DTO_SOB;
sim_activate (uptr, ((2 * DT_HTLIN) + DT_WSIZE) * dt_ltime);
if (((dtsa & DTA_MODE) == 0) || (M[DT_WC] == 0))
if (((dtsa & DTA_MODE) == 0) || (dt_substate == DTO_WCO))
dtsb = dtsb | DTB_DTF; /* set DTF */
}
break;
@@ -910,6 +911,8 @@ switch (fnc) { /* at speed, check fnc *
relpos = DT_LIN2OF (uptr->pos, uptr); /* cur pos in blk */
M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */
M[DT_CA] = (M[DT_CA] + 1) & 07777;
if (M[DT_WC] == 0)
dt_substate = DTO_WCO;
ma = DTB_GETMEX (dtsb) | M[DT_CA]; /* get mem addr */
if ((relpos >= DT_HTLIN) && /* in data zone? */
(relpos < (DTU_LPERB (uptr) - DT_HTLIN))) {
@@ -923,9 +926,7 @@ switch (fnc) { /* at speed, check fnc *
sim_activate (uptr, DT_WSIZE * dt_ltime);
if (MEM_ADDR_OK (ma)) /* mem addr legal? */
M[ma] = dat;
if (M[DT_WC] == 0)
dt_substate = DTO_WCO;
if (((dtsa & DTA_MODE) == 0) || (M[DT_WC] == 0))
if (((dtsa & DTA_MODE) == 0) || (dt_substate == DTO_WCO))
dtsb = dtsb | DTB_DTF; /* set DTF */
break;

View File

@@ -1,6 +1,6 @@
/* pdp8_rf.c: RF08 fixed head disk simulator
Copyright (c) 1993-2013, Robert M Supnik
Copyright (c) 1993-2021, 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 @@
rf RF08 fixed head disk
21-Apr-21 RMS Fixed bug if read overwrites WC memory location
17-Sep-13 RMS Changed to use central set_bootpc routine
03-Sep-13 RMS Added explicit void * cast
15-May-06 RMS Fixed bug in autosize attach (Dave Gesswein)
@@ -305,6 +306,7 @@ t_stat rf_svc (UNIT *uptr)
{
int32 pa, t, mex;
int16 *fbuf = (int16 *) uptr->filebuf;
uint16 wc = 0;
UPDATE_PCELL; /* update photocell */
if ((uptr->flags & UNIT_BUF) == 0) { /* not buf? abort */
@@ -320,7 +322,7 @@ do {
rf_sta = rf_sta | RFS_NXD;
break;
}
M[RF_WC] = (M[RF_WC] + 1) & 07777; /* incr word count */
wc = M[RF_WC] = (M[RF_WC] + 1) & 07777; /* incr word count */
M[RF_MA] = (M[RF_MA] + 1) & 07777; /* incr mem addr */
pa = mex | M[RF_MA]; /* add extension */
if (uptr->FUNC == RF_READ) { /* read? */
@@ -338,9 +340,9 @@ do {
}
}
rf_da = (rf_da + 1) & 03777777; /* incr disk addr */
} while ((M[RF_WC] != 0) && (rf_burst != 0)); /* brk if wc, no brst */
} while ((wc != 0) && (rf_burst != 0)); /* brk if wc, no brst */
if ((M[RF_WC] != 0) && ((rf_sta & RFS_ERR) == 0)) /* more to do? */
if ((wc != 0) && ((rf_sta & RFS_ERR) == 0)) /* more to do? */
sim_activate (&rf_unit, rf_time); /* sched next */
else {
rf_done = 1; /* done */