Skip to content

Commit

Permalink
PDP11: Fix RS device address window size and propagate that through t…
Browse files Browse the repository at this point in the history
…o RH

As discussed  in #396
  • Loading branch information
markpizz committed Feb 11, 2017
1 parent 84f1e71 commit bce72b2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
54 changes: 26 additions & 28 deletions PDP11/pdp11_rh.c
Expand Up @@ -202,11 +202,9 @@ static int32 mba_mapofs[(MBA_OFSMASK + 1) >> 1] = {
mbax_reg RHx register list
*/

#define IOLN_RP 054

DIB mba0_dib = {
IOBA_AUTO, IOLN_RP, &mba_rd, &mba_wr,
1, IVCL (RP), VEC_AUTO, { &mba0_inta }, IOLN_RP,
IOBA_AUTO, 0, &mba_rd, &mba_wr,
1, IVCL (RP), VEC_AUTO, { &mba0_inta }
};

UNIT mba0_unit = { UDATA (NULL, 0, 0) };
Expand Down Expand Up @@ -237,11 +235,9 @@ MTAB mba0_mod[] = {
{ 0 }
};

#define IOLN_TU 040

DIB mba1_dib = {
IOBA_AUTO, IOLN_TU, &mba_rd, &mba_wr,
1, IVCL (TU), VEC_AUTO, { &mba1_inta }, IOLN_TU
IOBA_AUTO, 0, &mba_rd, &mba_wr,
1, IVCL (TU), VEC_AUTO, { &mba1_inta }
};

UNIT mba1_unit = { UDATA (NULL, 0, 0) };
Expand Down Expand Up @@ -272,11 +268,9 @@ MTAB mba1_mod[] = {
{ 0 }
};

#define IOLN_RS 040

DIB mba2_dib = {
IOBA_AUTO, IOLN_RS, &mba_rd, &mba_wr,
1, IVCL (RS), VEC_AUTO, { &mba2_inta }, IOLN_RS
IOBA_AUTO, 0, &mba_rd, &mba_wr,
1, IVCL (RS), VEC_AUTO, { &mba2_inta }
};

UNIT mba2_unit = { UDATA (NULL, 0, 0) };
Expand Down Expand Up @@ -855,6 +849,7 @@ if (dptr->flags & DEV_DIS) { /* Disabling? */
uint32 mb = dibp->ba;

dibp->ba = MBA_AUTO; /* Flag unassigned */
dibp->ulnt = dibp->lnt = 0;
mba_reset (&mba_dev[mb]); /* reset prior MBA */
}
build_dib_tab();
Expand All @@ -874,7 +869,7 @@ if (dptr == NULL)
dibp = (DIB *) dptr->ctxt;
if (dibp == NULL)
return SCPE_IERR;
fprintf (st, "Massbus adapter %d", dibp->ba);
fprintf (st, "Massbus adapter %d (RH%c)", dibp->ba, 'A' + dibp->ba);
return SCPE_OK;
}

Expand Down Expand Up @@ -923,13 +918,12 @@ if ((mbregR[idx] && dibp->rd && /* conflict? */
sim_dname (dptr), dibp->ba);
return SCPE_STOP;
}
if (dibp->rd) /* set rd dispatch */
mbregR[idx] = dibp->rd;
if (dibp->wr) /* set wr dispatch */
mbregW[idx] = dibp->wr;
if (dibp->ack[0]) /* set abort dispatch */
mbabort[idx] = dibp->ack[0];
mbregR[idx] = dibp->rd; /* set rd dispatch */
mbregW[idx] = dibp->wr; /* set wr dispatch */
mbabort[idx] = dibp->ack[0]; /* set abort dispatch */
mba_dev[idx].flags &= ~DEV_DIS; /* mark MBA enabled */
((DIB *)mba_dev[idx].ctxt)->lnt = dibp->lnt;
((DIB *)mba_dev[idx].ctxt)->ulnt = dibp->lnt;
return build_ubus_tab (&mba_dev[idx], (DIB *)mba_dev[idx].ctxt);
}

Expand Down Expand Up @@ -971,6 +965,8 @@ for (idx = active = 0; idx < MBA_NUM; idx++) {
break;
}
}
((DIB *)mba_dev[dibp->ba].ctxt)->lnt = dibp->lnt;
((DIB *)mba_dev[dibp->ba].ctxt)->ulnt = dibp->ulnt;
++active;
}
}
Expand All @@ -981,15 +977,17 @@ const char *const text =
/*567901234567890123456789012345678901234567890123456789012345678901234567890*/
" RH70/RH11 Massbus adapters (RHA, RHB, RHC)\n"
"\n"
" The RH70/RH11 Massbus adapters interface Massbus peripherals to the memory\n"
" bus or Unibus of the CPU. The simulator provides three Massbus adapters.\n"
" The first, RHA, is configured for the RP family of disk drives. The\n"
" second, RHB, is configured for the TU family of tape controllers. The\n"
" third, RHC, is configured for the RS family of fixed head disks. By\n"
" default, RHA is enabled, and RHB and RHC are disabled. In a Unibus system,\n"
" the RH adapters implement 22b addressing for the 11/70 and 18b addressing\n"
" for all other models. In a Qbus system, the RH adapters always implement\n"
" 22b addressing.\n"
" The RH70/RH11 Massbus adapters interface Massbus peripherals to the\n"
" memory bus or Unibus of the CPU. The simulator provides three Massbus\n"
" adapters. These adapters (RHA, RHB, and RHC) are used by (in order):\n"
" 1) the RP family of disk drives.\n"
" 2) the TU family of tape controllers.\n"
" 3) the RS family of fixed head disks.\n"
" Depending on which of the RP, TU, and RS devices are enabled, will\n"
" determine which adapter is assigned to which device.\n"
" In a Unibus system, the RH adapters implement 22b addressing for the\n"
" 11/70 and 18b addressing for all other models. In a Qbus system, the\n"
" RH adapters always implement 22b addressing.\n"
/*567901234567890123456789012345678901234567890123456789012345678901234567890*/
"\n";
fprintf (st, "%s", text);
Expand Down
4 changes: 3 additions & 1 deletion PDP11/pdp11_rp.c
Expand Up @@ -595,7 +595,9 @@ const char *rp_description (DEVICE *dptr);
rp_mod RP modifier list
*/

DIB rp_dib = { MBA_AUTO, 0, &rp_mbrd, &rp_mbwr, 0, 0, 0, { &rp_abort } };
#define IOLN_RP 054

DIB rp_dib = { MBA_AUTO, IOLN_RP, &rp_mbrd, &rp_mbwr, 0, 0, 0, { &rp_abort } };

UNIT rp_unit[] = {
{ UDATA (&rp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_AUTO+
Expand Down
4 changes: 3 additions & 1 deletion PDP11/pdp11_rs.c
Expand Up @@ -197,7 +197,9 @@ const char *rs_description (DEVICE *dptr);
rs_mod RS modifier list
*/

DIB rs_dib = { MBA_AUTO, 0, &rs_mbrd, &rs_mbwr, 0, 0, 0, { &rs_abort } };
#define IOLN_RS 034

DIB rs_dib = { MBA_AUTO, IOLN_RS, &rs_mbrd, &rs_mbwr, 0, 0, 0, { &rs_abort } };

UNIT rs_unit[] = {
{ UDATA (&rs_svc, UNIT_FIX|UNIT_ATTABLE|UNIT_DISABLE|UNIT_AUTO|
Expand Down
3 changes: 2 additions & 1 deletion PDP11/pdp11_tu.c
Expand Up @@ -266,7 +266,8 @@ t_stat tu_map_err (int32 drv, t_stat st, t_bool qdt);
tu_mod TU modifier list
*/

DIB tu_dib = { MBA_AUTO, 0, &tu_mbrd, &tu_mbwr,0, 0, 0, { &tu_abort } };
#define IOLN_TU 040
DIB tu_dib = { MBA_AUTO, IOLN_TU, &tu_mbrd, &tu_mbwr,0, 0, 0, { &tu_abort } };

UNIT tu_unit[] = {
{ UDATA (&tu_svc, UNIT_ATTABLE+UNIT_DISABLE+UNIT_ROABLE, 0) },
Expand Down

2 comments on commit bce72b2

@PDP-1170
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some further testing, it seems that there may be some undesired side-effects of this change.
The following output is directly after starting pdp11 without an .ini file:

sim> sh rha
RHA     address=17776700-17776753, vector=254
sim> set rp dis
sim> set rp ena
sim> sh rha
RHA     address=17776700, vector=254
sim>

Note that after re-enabling RP, the RHA address range has been lost. The line of code at 852 in pdp11_rh.c dibp->ulnt = dibp->lnt = 0; breaks the ability to disable and re-enable Massbus devices. Commenting out this line seems to fix the issue. Moving Massbus devices to different controllers still works with this line commented out.

It is also possible that you wanted to say '=ulnt' instead of '=lnt' in line 926. It seems to work either way, so it may be moot. Before the change, ulnt was set the same as lnt directly in the mba dibs - but this may have been unnecessary.

@markpizz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Good Catch.

Please make the fixes you've outlined and generate a pull request to get it merged.

Thanks.

  • Mark

Please sign in to comment.