PDP11: RK11: Complete fix for WC as implemented in V3 + other fixes

This commit is contained in:
Tony Lawrence 2023-06-07 19:56:29 -04:00 committed by Paul Koning
parent fcaf741d19
commit 5b22fcf4c9

View file

@ -105,9 +105,9 @@
#define RK_NUMTR (RK_NUMCY * RK_NUMSF) /* tracks/drive */ #define RK_NUMTR (RK_NUMCY * RK_NUMSF) /* tracks/drive */
#define RK_NUMDR 8 /* drives/controller */ #define RK_NUMDR 8 /* drives/controller */
#define RK_M_NUMDR 07 #define RK_M_NUMDR 07
#define RK_SIZE (RK_NUMCY * RK_NUMSF * RK_NUMSC * RK_NUMWD) #define RK_NUMBL (RK_NUMTR * RK_NUMSC)
#define RK_SIZE (RK_NUMBL * RK_NUMWD) /* words/drive */
#define RK_RSRVSEC (3 * RK_NUMSF * RK_NUMSC) /* reserved (unused) disk area */ #define RK_RSRVSEC (3 * RK_NUMSF * RK_NUMSC) /* reserved (unused) disk area */
/* words/drive */
#define RK_CTLI 1 /* controller int */ #define RK_CTLI 1 /* controller int */
#define RK_SCPI(x) (2u << (x)) /* drive int */ #define RK_SCPI(x) (2u << (x)) /* drive int */
#define RK_MAXFR (1 << 16) /* max transfer */ #define RK_MAXFR (1 << 16) /* max transfer */
@ -122,7 +122,7 @@ struct drvtyp {
}; };
static struct drvtyp drv_tab[] = { static struct drvtyp drv_tab[] = {
{ RK_NUMSC, RK_NUMSF, RK_NUMCY, RK_SIZE, "RK05" }, { RK_NUMSC, RK_NUMSF, RK_NUMCY, RK_NUMBL, "RK05" },
{ 0 } { 0 }
}; };
@ -294,7 +294,7 @@ BITFIELD *rk_reg_bits[] = {
rk_ba_bits, rk_ba_bits,
rk_da_bits, rk_da_bits,
NULL, NULL,
NULL, NULL
}; };
/* Debug detail levels */ /* Debug detail levels */
@ -324,6 +324,7 @@ int32 last_drv = 0; /* last r/w drive */
int32 rk_stopioe = 1; /* stop on error */ int32 rk_stopioe = 1; /* stop on error */
int32 rk_swait = 10; /* seek time */ int32 rk_swait = 10; /* seek time */
int32 rk_rwait = 10; /* rotate time */ int32 rk_rwait = 10; /* rotate time */
static int32 not_impl = 0; /* placeholder for unused regs */
const char *rk_regnames[] = { const char *rk_regnames[] = {
"RKDS", "RKDS",
@ -333,7 +334,7 @@ const char *rk_regnames[] = {
"RKBA", "RKBA",
"RKDA", "RKDA",
"unused", "unused",
"RKDB", "RKDB"
}; };
int32 *rk_regs[] = { int32 *rk_regs[] = {
@ -343,6 +344,8 @@ int32 *rk_regs[] = {
&rkwc, &rkwc,
&rkba, &rkba,
&rkda, &rkda,
&not_impl,
&not_impl
}; };
t_stat rk_rd (int32 *data, int32 PA, int32 access); t_stat rk_rd (int32 *data, int32 PA, int32 access);
@ -750,7 +753,7 @@ if (wc && (err == 0)) { /* seek ok? */
else { /* normal store */ else { /* normal store */
if ((t = MAP_WRW (ma, wc << 1, rkxb))) { /* store buf */ if ((t = MAP_WRW (ma, wc << 1, rkxb))) { /* store buf */
rker = rker | RKER_NXM; /* NXM? set flag */ rker = rker | RKER_NXM; /* NXM? set flag */
wc = wc - t; /* adj wd cnt */ wc = wc - (t >> 1); /* adj wd cnt */
} }
} }
break; /* end read */ break; /* end read */
@ -767,14 +770,14 @@ if (wc && (err == 0)) { /* seek ok? */
else { /* normal fetch */ else { /* normal fetch */
if ((t = MAP_RDW (ma, wc << 1, rkxb))) { /* get buf */ if ((t = MAP_RDW (ma, wc << 1, rkxb))) { /* get buf */
rker = rker | RKER_NXM; /* NXM? set flg */ rker = rker | RKER_NXM; /* NXM? set flg */
wc = wc - t; /* adj wd cnt */ wc = wc - (t >> 1); /* adj wd cnt */
} }
} }
if (wc) { /* any xfer? */ if (wc) { /* any xfer? */
awc = (wc + (RK_NUMWD - 1)) & ~(RK_NUMWD - 1); /* clr to */ awc = (wc + (RK_NUMWD - 1)) & ~(RK_NUMWD - 1); /* clr to */
for (i = wc; i < awc; i++) /* end of blk */ for (i = wc; i < awc; i++) /* end of blk */
rkxb[i] = 0; rkxb[i] = 0;
sim_disk_data_trace (uptr, (uint8 *)rkxb, da/RK_NUMWD, awc, "sim_disk_wrsect", RKDEB_DAT & dptr->dctrl, RKDEB_OPS); sim_disk_data_trace (uptr, (uint8 *)rkxb, da/RK_NUMWD, awc*sizeof(*rkxb), "sim_disk_wrsect", RKDEB_DAT & dptr->dctrl, RKDEB_OPS);
err = sim_disk_wrsect (uptr, da/RK_NUMWD, (uint8 *)rkxb, NULL, awc/RK_NUMWD); err = sim_disk_wrsect (uptr, da/RK_NUMWD, (uint8 *)rkxb, NULL, awc/RK_NUMWD);
} }
break; /* end write */ break; /* end write */
@ -817,7 +820,7 @@ if ((uptr->FUNC == RKCS_READ) && (rkcs & RKCS_FMT)) /* read format? */
else da = da + wc + (RK_NUMWD - 1); /* count by words */ else da = da + wc + (RK_NUMWD - 1); /* count by words */
track = (da / RK_NUMWD) / RK_NUMSC; track = (da / RK_NUMWD) / RK_NUMSC;
sect = (da / RK_NUMWD) % RK_NUMSC; sect = (da / RK_NUMWD) % RK_NUMSC;
uptr->CYL = track / RK_NUMSF; /* update position */ uptr->CYL = track / RK_NUMSF;
rkda = (rkda & RKDA_DRIVE) | (track << RKDA_V_TRACK) | (sect << RKDA_V_SECT); rkda = (rkda & RKDA_DRIVE) | (track << RKDA_V_TRACK) | (sect << RKDA_V_SECT);
rk_set_done (0); rk_set_done (0);
@ -919,13 +922,9 @@ return auto_config (0, 0);
t_stat rk_attach (UNIT *uptr, CONST char *cptr) t_stat rk_attach (UNIT *uptr, CONST char *cptr)
{ {
t_stat r; t_stat r;
static const char *drives[] = {"RK05", NULL};
r = sim_disk_attach_ex2 (uptr, cptr, RK_NUMWD * sizeof (uint16), r = sim_disk_attach_ex2 (uptr, cptr, RK_NUMWD * sizeof (uint16),
sizeof (uint16), TRUE, 0, sizeof (uint16), TRUE, 0,
"RK05", 0, 0, "RK05", 0, 0, NULL, RK_RSRVSEC);
(uptr->flags & UNIT_NOAUTO) ? NULL: drives,
RK_RSRVSEC);
if (r != SCPE_OK) /* error? */ if (r != SCPE_OK) /* error? */
return r; return r;
return SCPE_OK; return SCPE_OK;