From 45fe20a34bc78b23a1bab570e1a9c1e53c05c8ef Mon Sep 17 00:00:00 2001 From: Sergey Svishchev Date: Wed, 10 Sep 2025 21:52:47 +0300 Subject: [PATCH] PDP11: Changes for Terak 8510/a simulator: Accept devices mapped at IOPAGEBASE -- text buffer/character generator memory on video board starts at 160000. Clear invalid PSW bits in trap handler -- system acceptance test writes PSW 113705 to vector 34 (TRAP instruction). --- PDP11/pdp11_cpu.c | 1 + PDP11/pdp11_io_lib.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PDP11/pdp11_cpu.c b/PDP11/pdp11_cpu.c index 89fa7073..63359927 100644 --- a/PDP11/pdp11_cpu.c +++ b/PDP11/pdp11_cpu.c @@ -929,6 +929,7 @@ while (reason == 0) { } src = ReadCW (trapea | calc_ds (MD_KER)); /* new PC */ src2 = ReadCW ((trapea + 2) | calc_ds (MD_KER));/* new PSW */ + src2 = src2 & cpu_tab[cpu_model].psw; /* mask off invalid bits */ t = (src2 >> PSW_V_CM) & 03; /* new cm */ trapea = ~t; /* flag pushes */ WriteCW (PSW, ((STACKFILE[t] - 2) & 0177777) | calc_ds (t)); diff --git a/PDP11/pdp11_io_lib.c b/PDP11/pdp11_io_lib.c index 0287eac8..32fc8e14 100644 --- a/PDP11/pdp11_io_lib.c +++ b/PDP11/pdp11_io_lib.c @@ -121,7 +121,7 @@ if (dibp == NULL) newba = (uint32) get_uint (cptr, DEV_RDX, IOPAGEBASE+IOPAGEMASK, &r); /* get new */ if (r != SCPE_OK) return r; -if ((newba <= IOPAGEBASE) || /* > IO page base? */ +if ((newba < IOPAGEBASE) || /* > IO page base? */ (newba % ((uint32) val))) /* check modulus */ return sim_messagef (SCPE_ARG, "Invalid bus address value: %s\n", cptr); if (dibp->ba != newba) { /* changed? */ @@ -145,7 +145,7 @@ dptr = find_dev_from_unit (uptr); if (dptr == NULL) return SCPE_IERR; dibp = (DIB *) dptr->ctxt; -if ((dibp == NULL) || (dibp->ba <= IOPAGEBASE)) +if ((dibp == NULL) || (dibp->ba < IOPAGEBASE)) return SCPE_IERR; if ((sim_switches & SWMASK('H')) || (sim_switch_number == 16)) radix = 16;