From 69a92622be44641219da1e146b5add7d7ee0c987 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 19 Jul 2022 05:18:37 -1000 Subject: [PATCH] PDP11: Properly validate the number of VH lines after a bus type change If the number of lines on a Qbus system has previously been changed to an odd multiple of and then the bus type changed to Unibus, we to change the number of lines to a multiple of 16 for the DHU. --- PDP11/pdp11_vh.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PDP11/pdp11_vh.c b/PDP11/pdp11_vh.c index 3626c836..fb3f9540 100644 --- a/PDP11/pdp11_vh.c +++ b/PDP11/pdp11_vh.c @@ -1663,6 +1663,15 @@ static t_stat vh_reset ( DEVICE *dptr ) tmxr_set_port_speed_control (&vh_desc); tmxr_set_modem_control_passthru (&vh_desc); + /* If the number of lines on a Qbus system has previously been changed */ + /* to an odd multiple of and then the bus type changed to Unibus, we */ + /* to change the number of lines to a multiple of 16 for the DHU */ + if (vh_desc.lines%VH_LINES != 0) { + char lines[12]; + + snprintf (lines, sizeof (lines), "%d", vh_desc.lines + (VH_LINES / 2)); + return vh_setnl (dptr->units, 0, lines, NULL); + } if (vh_desc.lines > VH_MUXES*VH_LINES) vh_desc.lines = VH_MUXES*VH_LINES; vh_dev.numunits = (vh_desc.lines / VH_LINES) + 3;