From c5cf64c439f72df6aac978ac3e3dff0bdf0dec3d Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 5 Jan 2016 04:05:04 -0800 Subject: [PATCH] PDP11, VAX: Allow autoconfigure to allocate fixed address and vectors properly. When an auto configuration table entry contains multiple devices be sure to account for earlier devices which may be disabled while allocating fixed address and vector values. Examples: XQ, XQB, RB, RQB, RQC, RQD, RX, RY This problem is discussed in #263 --- PDP11/pdp11_io_lib.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/PDP11/pdp11_io_lib.c b/PDP11/pdp11_io_lib.c index ea2ab357..5f53f188 100644 --- a/PDP11/pdp11_io_lib.c +++ b/PDP11/pdp11_io_lib.c @@ -832,7 +832,7 @@ extern UNIT cpu_unit; AUTO_CON *autp; DEVICE *dptr; DIB *dibp; -uint32 j, vmask, amask; +uint32 j, k, jdis, vmask, amask; if (autcon_enb == 0) /* enabled? */ return SCPE_OK; @@ -879,16 +879,24 @@ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ return SCPE_IERR; ilvl = dibp->vloc / 32; ibit = dibp->vloc % 32; - if (autp->fixa[j]) /* fixed csr avail? */ - dibp->ba = IOPAGEBASE + autp->fixa[j]; /* use it */ + /* Identify how many devices earlier in the device list are + disabled and use that info to determine fixed address assignments */ + for (k=jdis=0; kdnam[k]); + + if (kdptr->flags & DEV_DIS) + ++jdis; + } + if (autp->fixa[j-jdis]) /* fixed csr avail? */ + dibp->ba = IOPAGEBASE + autp->fixa[j-jdis]; /* use it */ else { /* no fixed left */ dibp->ba = csr; /* set CSR */ csr += (autp->numc * autp->amod); /* next CSR */ } /* end else */ if (autp->numv) { /* vec needed? */ - if (autp->fixv[j]) { /* fixed vec avail? */ + if (autp->fixv[j-jdis]) { /* fixed vec avail? */ if (autp->numv > 0) - dibp->vec = autp->fixv[j]; /* use it */ + dibp->vec = autp->fixv[j-jdis]; /* use it */ } else { /* no fixed left */ uint32 numv = abs (autp->numv); /* get num vec */