From c8c071e3e194575f554955b0a10cc167dd8731d2 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 25 Jan 2016 07:03:30 -0800 Subject: [PATCH] PDP11: Fix DL11 & TU58 autoconfigure limitation checks --- PDP11/pdp11_dl.c | 14 ++++++++++---- PDP11/pdp11_td.c | 12 ++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/PDP11/pdp11_dl.c b/PDP11/pdp11_dl.c index e65300a9..80b237b1 100644 --- a/PDP11/pdp11_dl.c +++ b/PDP11/pdp11_dl.c @@ -612,10 +612,16 @@ if (dis) { dlo_dev.flags = dlo_dev.flags | DEV_DIS; } else { - if (((dli_dev.flags & DEV_DIS) || (dlo_dev.flags & DEV_DIS)) && - (dlx_tu58_count() < 16)) { - if ((dlx_desc.lines + dlx_tu58_count()) > 16) - dlx_desc.lines = 16 - dlx_tu58_count(); + if (dlx_tu58_count() < 16) { + if ((dlx_desc.lines + dlx_tu58_count()) > 16) { + char lines[16]; + int32 saved_switches = sim_switches; + + sprintf (lines, "%d", 16 - dlx_tu58_count()); + sim_switches |= SWMASK('Y'); + dlx_set_lines (NULL, 0, lines, NULL); + sim_switches = saved_switches; + } dli_dev.flags = dli_dev.flags & ~DEV_DIS; dlo_dev.flags = dlo_dev.flags & ~DEV_DIS; } diff --git a/PDP11/pdp11_td.c b/PDP11/pdp11_td.c index 5f68bb08..e5197b01 100644 --- a/PDP11/pdp11_td.c +++ b/PDP11/pdp11_td.c @@ -1441,12 +1441,12 @@ td_ctrls = newln; td_dib.lnt = td_ctrls * td_dib.ulnt; /* upd IO page lnt */ /* Make sure that the number of TU58 controllers plus DL devices is 16 or less */ if ((dli_dptr != NULL) && !(dli_dptr->flags & DEV_DIS) && - ((((DIB *)dli_dptr->ctxt)->numc + td_ctrls) > 16)) { - dli_dptr->flags |= DEV_DIS; - dli_dptr->reset (dli_dptr); - if (td_ctrls < 16) { - dli_dptr->flags &= ~DEV_DIS; - dli_dptr->reset (dli_dptr); + ((((DIB *)dli_dptr->ctxt)->numc + td_ctrls) > 16)) { /* Too many? */ + dli_dptr->flags |= DEV_DIS; /* First disable DL devices */ + dli_dptr->reset (dli_dptr); /* Notify of the disable */ + if (td_ctrls < 16) { /* Room for some DL devices? */ + dli_dptr->flags &= ~DEV_DIS; /* Re-Enable DL devices */ + dli_dptr->reset (dli_dptr); /* Notify of the enable which forces sizing */ } } return td_reset (&tdc_dev);