1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-23 10:58:12 +00:00

KA10: Updated KI paging, added WAITS support and PMP disk controller.

This commit is contained in:
Richard Cornwell 2019-06-16 22:34:04 -04:00
parent faac9f1d72
commit a5e967d803
6 changed files with 2611 additions and 25 deletions

View File

@ -206,6 +206,7 @@ uint64 mar; /* Memory address compare */
uint32 qua_time; /* Quantum clock value */
#endif
int watch_stop; /* Stop at memory watch point */
int maoff = 0; /* Offset for traps */
uint16 dev_irq[128]; /* Pending irq by device */
t_stat (*dev_tab[128])(uint32 dev, uint64 *data);
@ -429,6 +430,10 @@ MTAB cpu_mod[] = {
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "SERIAL", "SERIAL",
&cpu_set_serial, &cpu_show_serial, NULL, "CPU Serial Number" },
#endif
{ UNIT_MAOFF, 0, NULL, "NOMAOFF", NULL, NULL, NULL,
"No interrupt relocation"},
{ UNIT_MAOFF, UNIT_MAOFF, "MAOFF", "MAOFF", NULL, NULL,
NULL, "Interrupts relocated to 140"},
#if KA
{ UNIT_M_PAGE, 0, "ONESEG", "ONESEG", NULL, NULL, NULL,
"One Relocation Register"},
@ -1270,7 +1275,7 @@ t_stat dev_apr(uint32 dev, uint64 *data) {
res |= (((FLAGS & FLTOVR) != 0) << 6) | (fov_irq << 7) ;
res |= (clk_flg << 9) | (((uint64)clk_en) << 10) | (nxm_flag << 12);
res |= (mem_prot << 13) | (((FLAGS & USERIO) != 0) << 15);
res |= (push_ovf << 16);
res |= (push_ovf << 16) | (maoff >> 1);
*data = res;
sim_debug(DEBUG_CONI, &cpu_dev, "CONI APR %012llo\n", *data);
break;
@ -2168,22 +2173,13 @@ int Mem_write_bbn(int flag, int cur_context) {
int page_lookup_waits(int addr, int flag, int *loc, int wr, int cur_context, int fetch) {
int uf = (FLAGS & USER) != 0;
if (page_fault)
return 0;
/* If paging is not enabled, address is direct */
if (!page_enable) {
*loc = addr;
return 1;
}
/* If this is modify instruction use write access */
wr |= modify;
/* Figure out if this is a user space access */
if (flag)
uf = 0;
else if (xct_flag != 0) {
else if (xct_flag != 0 && !fetch) {
if (xct_flag & 010 && cur_context) /* Indirect */
uf = 1;
if (xct_flag & 004 && wr == 0) /* XR */
@ -2678,7 +2674,7 @@ st_pi:
pi_rq = 0;
pi_hold = 0;
pi_ov = 0;
AB = 040 | (pi_enc << 1);
AB = 040 | (pi_enc << 1) | maoff;
#if KI | KL
xct_flag = 0;
/*
@ -2828,11 +2824,10 @@ unasign:
Mem_read_nopage();
FLAGS = (MB >> 23) & 017777;
/* If transistioning from user to executive adjust flags */
if ((FLAGS & USER) != 0 && (AB & 4) != 0) {
if ((FLAGS & USER) != 0 && (AB & 4) != 0)
FLAGS |= USERIO;
if (AB & 2)
FLAGS |= PRV_PUB;
}
if ((FLAGS & USER) == 0 && (AB & 2 || (FLAGS & OVR) != 0))
FLAGS |= PRV_PUB|OVR;
PC = MB & RMASK;
f_pc_inh = 1;
break;
@ -2865,6 +2860,8 @@ unasign:
}
#endif
AB = 040;
if (maoff && (IR & 0140) == 040)
AB |= maoff;
Mem_write(uuo_cycle, 1);
AB += 1;
f_load_pc = 0;
@ -3554,6 +3551,21 @@ dpnorm:
break;
}
#endif
#if WAITS
if (QWAITS) { /* WAITS FIX instruction */
if (Mem_read(0, 0, 0))
goto last;
AR = MB;
BR = get_reg(AC);
if (hst_lnt) {
hst[hst_p].mb = AR;
}
MQ = 0;
AR = SWAP_AR;
goto ufa;
}
#endif
/* UUO */
case 0105: case 0106: case 0107:
case 0110: case 0111: case 0112: case 0113:
@ -3567,7 +3579,7 @@ dpnorm:
unasign:
#if !PDP6
MB = ((uint64)(IR) << 27) | ((uint64)(AC) << 23) | (uint64)(AB);
AB = 060;
AB = 060 | maoff;
uuo_cycle = 1;
Mem_write(uuo_cycle, 0);
AB += 1;
@ -3725,6 +3737,9 @@ ldb_ptr:
#if !PDP6
case 0130: /* UFA */
#endif
#if WAITS
ufa:
#endif
case 0140: /* FAD */
case 0141: /* FADL */
@ -4398,7 +4413,7 @@ left:
break; /* Done */
}
#if !PDP6
#if !PDP6
if (AR == SMASK && BR == 1) {
FLAGS |= OVR|NODIV; /* Overflow and No Divide */
sac_inh=1; /* Don't touch AC */
@ -4806,12 +4821,15 @@ left:
#endif
FLAGS |= AR & (OVR|NODIV|FLTUND|BYTI|FLTOVR|CRY1|CRY0|\
TRP1|TRP2|PUBLIC|PCHNG);
#if KI
FLAGS |= (FLAGS & OVR) ? PRV_PUB : 0;
#endif
#if ITS
if (QITS)
FLAGS |= AR & (PURE|ONEP);
#endif
#if KI
if ((FLAGS & USER) == 0) {
FLAGS &= ~PRV_PUB;
FLAGS |= (AR & OVR) ? PRV_PUB : 0;
}
#endif
check_apr_irq();
}
@ -5811,7 +5829,7 @@ last:
if (!pi_hold & f_inst_fetch) {
pi_cycle = 0;
} else {
AB = 040 | (pi_enc << 1) | pi_ov;
AB = 040 | (pi_enc << 1) | pi_ov | maoff;
#if KI | KL
AB |= eb_ptr;
Mem_read_nopage();
@ -5824,7 +5842,7 @@ last:
if ((IR & 0700) == 0700) {
(void)check_irq_level();
}
AB = 040 | (pi_enc << 1) | pi_ov;
AB = 040 | (pi_enc << 1) | pi_ov | maoff;
pi_ov = 0;
pi_hold = 0;
#if KI | KL
@ -6027,6 +6045,9 @@ DEVICE *dptr;
DIB *dibp;
uint32 i, j, d;
/* Set trap offset based on MAOFF flag */
maoff = (cpu_unit[0].flags & UNIT_MAOFF)? 0100 : 0;
#if KA
/* Set up memory access routines based on current CPU type. */

View File

@ -306,7 +306,9 @@ extern DEBTAB crd_debug[];
/* Flags for CPU unit */
#define UNIT_V_MSIZE (UNIT_V_UF + 0)
#define UNIT_MSIZE (0177 << UNIT_V_MSIZE)
#define UNIT_V_PAGE (UNIT_V_MSIZE + 8)
#define UNIT_V_MAOFF (UNIT_V_MSIZE + 8)
#define UNIT_V_PAGE (UNIT_V_MAOFF + 1)
#define UNIT_MAOFF (1 << UNIT_V_MAOFF)
#define UNIT_TWOSEG (1 << UNIT_V_PAGE)
#define UNIT_ITSPAGE (2 << UNIT_V_PAGE)
#define UNIT_BBNPAGE (4 << UNIT_V_PAGE)
@ -365,6 +367,7 @@ extern DEVICE stk_dev;
extern DEVICE tk10_dev;
extern DEVICE mty_dev;
extern DEVICE ten11_dev;
extern DEVICE dkb_dev;
extern DEVICE auxcpu_dev;
extern DEVICE wcnsls_dev; /* MIT Spacewar Consoles */
extern DEVICE dct_dev; /* PDP6 devices. */
@ -457,6 +460,7 @@ int auxcpu_write (int addr, t_uint64);
#define NUM_DEVS_RS 1
#define NUM_DEVS_TU 1
#define NUM_DEVS_PMP WAITS
#define NUM_DEVS_DKB WAITS
#define NUM_DEVS_PD ITS
#define NUM_DEVS_IMX ITS
#define NUM_DEVS_STK ITS

98
PDP10/ka10_dkb.c Normal file
View File

@ -0,0 +1,98 @@
/* ka10_dkb.c:Stanford Microswitch scanner.
Copyright (c) 2013-2017, Richard Cornwell
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
RICHARD CORNWELL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Richard Cornwell shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Richard Cornwell
*/
#include "ka10_defs.h"
#ifndef NUM_DEVS_DKB
#define NUM_DEVS_DKB 0
#endif
#if NUM_DEVS_DKB > 0
t_stat dkb_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr);
const char *dkb_description (DEVICE *dptr);
#define DKB_DEVNUM 0310
#define STATUS u3
#define DATA u4
#define PIA u5
t_stat dkb_devio(uint32 dev, uint64 *data);
DIB dkb_dib = { DKB_DEVNUM, 1, dkb_devio, NULL};
UNIT dkb_unit[] = {
{ 0 }
};
MTAB dkb_mod[] = {
{ 0 }
};
DEVICE dkb_dev = {
"DKB", dkb_unit, NULL, dkb_mod,
2, 10, 31, 1, 8, 8,
NULL, NULL, NULL,
NULL, NULL, NULL, &dkb_dib, DEV_DEBUG, 0, dev_debug,
NULL, NULL, &dkb_help, NULL, NULL, &dkb_description
};
int status;
t_stat dkb_devio(uint32 dev, uint64 *data) {
uint64 res;
switch(dev & 3) {
case CONI:
*data = status;
sim_debug(DEBUG_CONI, &dkb_dev, "DKB %03o CONI %06o\n", dev, (uint32)*data);
break;
case CONO:
status = (int)(*data&7);
sim_debug(DEBUG_CONO, &dkb_dev, "DKB %03o CONO %06o\n", dev, (uint32)*data);
break;
case DATAI:
sim_debug(DEBUG_DATAIO, &dkb_dev, "DKB %03o DATAI %06o\n", dev, (uint32)*data);
break;
case DATAO:
sim_debug(DEBUG_DATAIO, &dkb_dev, "DKB %03o DATAO %06o\n", dev, (uint32)*data);
break;
}
return SCPE_OK;
}
t_stat dkb_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
{
return SCPE_OK;
}
const char *dkb_description (DEVICE *dptr)
{
return "Console TTY Line";
}
#endif

2455
PDP10/ka10_pmp.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -125,6 +125,11 @@ t_stat ptp_devio(uint32 dev, uint64 *data) {
switch(dev & 3) {
case CONI:
*data = uptr->STATUS;
#if WAITS
/* The NXM stop switch is always off */
if (cpu_unit[0].flags & UNIT_WAITSPG)
*data |= 0200;
#endif
sim_debug(DEBUG_CONI, &ptp_dev, "PP: CONI %012llo\n\r", *data);
break;

View File

@ -178,6 +178,9 @@ DEVICE *sim_devices[] = {
#endif
#if NUM_DEVS_AUXCPU > 0
&auxcpu_dev,
#endif
#if NUM_DEVS_DKB > 0
&dkb_dev,
#endif
NULL
};
@ -236,7 +239,7 @@ t_stat load_dmp (FILE *fileref)
{
char buffer[100];
char *p;
uint32 addr = 075;
uint32 addr = 074;
uint64 data;
while (fgets((char *)buffer, 80, fileref) != 0) {