Documentation updates to accommodate the PDP-10 work that's starting now
This commit is contained in:
parent
c25ad00c41
commit
8320f58d44
20 changed files with 172 additions and 69 deletions
30
modules/pdp10/README.md
Normal file
30
modules/pdp10/README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
layout: page
|
||||
title: PDPjs Support for PDP-10 Machines
|
||||
permalink: /modules/pdp10/
|
||||
---
|
||||
|
||||
PDPjs Support for PDP-10 Machines
|
||||
=================================
|
||||
|
||||
Overview
|
||||
---
|
||||
|
||||
This PDPjs module for [PDP-10 Machines](/devices/pdp10/machine/) was added to the PCjs Project in 2017.
|
||||
|
||||
The module is currently comprised of the following components, as listed in [package.json](../../package.json)
|
||||
(see the *pdp10Files* property):
|
||||
|
||||
* [bus.js](/modules/pdp10/lib/bus.js)
|
||||
* [computer.js](/modules/pdp10/lib/computer.js)
|
||||
* [cpu.js](/modules/pdp10/lib/cpu.js)
|
||||
* [cpustate.js](/modules/pdp10/lib/cpustate.js)
|
||||
* [debugger.js](/modules/pdp10/lib/debugger.js)
|
||||
* [defines.js](/modules/pdp10/lib/defines.js)
|
||||
* [device.js](/modules/pdp10/lib/device.js)
|
||||
* [memory.js](/modules/pdp10/lib/memory.js)
|
||||
* [messages.js](/modules/pdp10/lib/messages.js)
|
||||
* [panel.js](/modules/pdp10/lib/panel.js)
|
||||
* [ram.js](/modules/pdp10/lib/ram.js)
|
||||
* [rom.js](/modules/pdp10/lib/rom.js)
|
||||
* [serial.js](/modules/pdp10/lib/serial.js)
|
||||
|
|
@ -119,6 +119,9 @@ class BusPDP10 extends Component {
|
|||
this.nBlockMask = this.nBlockTotal - 1;
|
||||
this.assert(this.nBlockMask <= BlockInfoPDP10.num.mask);
|
||||
|
||||
this.nDisableFaults = 0;
|
||||
this.fFault = false;
|
||||
|
||||
/*
|
||||
* Define all the properties to be initialized by initMemory()
|
||||
*/
|
||||
|
|
@ -524,7 +527,9 @@ class BusPDP10 extends Component {
|
|||
var w;
|
||||
var off = addr & this.nBlockLimit;
|
||||
var block = this.getBlockDirect(addr);
|
||||
this.nDisableFaults++;
|
||||
w = block.readWordDirect(off, addr);
|
||||
this.nDisableFaults--;
|
||||
return w;
|
||||
}
|
||||
|
||||
|
|
@ -541,7 +546,9 @@ class BusPDP10 extends Component {
|
|||
{
|
||||
var off = addr & this.nBlockLimit;
|
||||
var block = this.getBlockDirect(addr);
|
||||
this.nDisableFaults++;
|
||||
block.writeWordDirect(off, w & 0xffff, addr);
|
||||
this.nDisableFaults--;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -683,6 +690,42 @@ class BusPDP10 extends Component {
|
|||
return addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* fault(addr, err, access)
|
||||
*
|
||||
* Bus interface for signaling alignment errors, invalid memory, etc.
|
||||
*
|
||||
* @this {BusPDP10}
|
||||
* @param {number} addr
|
||||
* @param {number} [err]
|
||||
* @param {number} [access] (for diagnostic purposes only)
|
||||
*/
|
||||
fault(addr, err, access)
|
||||
{
|
||||
this.fFault = true;
|
||||
if (!this.nDisableFaults) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP10.FAULT)) {
|
||||
this.dbg.printMessage("memory fault on " + this.dbg.toStrBase(addr), true, true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* checkFault()
|
||||
*
|
||||
* This also serves as a clearFault() function.
|
||||
*
|
||||
* @this {BusPDP10}
|
||||
* @return {boolean}
|
||||
*/
|
||||
checkFault()
|
||||
{
|
||||
var f = this.fFault;
|
||||
this.fFault = false;
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* reportError(errNum, addr, size, fQuiet)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
messageInit(sEnable)
|
||||
{
|
||||
this.dbg = this;
|
||||
this.bitsMessage = this.bitsWarning = MessagesPDP10.WARN;
|
||||
this.bitsMessage = this.bitsWarning = MessagesPDP10.FAULT | MessagesPDP10.WARN;
|
||||
this.sMessagePrev = null;
|
||||
this.aMessageBuffer = [];
|
||||
/*
|
||||
|
|
@ -1311,7 +1311,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
*/
|
||||
if (!nState) {
|
||||
opCode = this.cpu.readWord(addr);
|
||||
if (opCode == PDP10.OPCODE.HALT && this.cpu.getLastPC() == addr) {
|
||||
if ((opCode & PDP10.OPCODE.HALTMASK) == PDP10.OPCODE.HALT && this.cpu.getLastPC() == addr) {
|
||||
addr = this.cpu.advancePC(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,10 @@ var PDP10 = {
|
|||
* Assorted common opcodes
|
||||
*/
|
||||
OPCODE: {
|
||||
HALT: 0o000000000000, // TODO: Resolve
|
||||
INSMASK: 0o777000000000,
|
||||
ACCMASK: 0o000740000000,
|
||||
HALTMASK: 0o777740000000,
|
||||
HALT: 0o254200000000,
|
||||
INVALID: 0o777777777777 // TODO: Resolve
|
||||
},
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ class MemoryPDP10 {
|
|||
this.fReadOnly = (type == MemoryPDP10.TYPE.ROM);
|
||||
this.dbg = null;
|
||||
this.readBits = this.readBitsDirect = this.readNone;
|
||||
this.readWord = this.readWordDirect = this.readWordDefault;
|
||||
this.readWord = this.readWordDirect = this.readNone;
|
||||
this.writeBits = this.writeBitsDirect = this.writeNone;
|
||||
this.writeWord = this.writeWordDirect = this.writeWordDefault;
|
||||
this.writeWord = this.writeWordDirect = this.writeNone;
|
||||
this.cReadBreakpoints = this.cWriteBreakpoints = 0;
|
||||
this.copyBreakpoints(); // initialize the block's Debugger info; the caller will reinitialize
|
||||
|
||||
|
|
@ -261,11 +261,11 @@ class MemoryPDP10 {
|
|||
{
|
||||
if (!fDirect || !this.cReadBreakpoints) {
|
||||
this.readBits = afn[0] || this.readNone;
|
||||
this.readWord = afn[2] || this.readWordDefault;
|
||||
this.readWord = afn[2] || this.readNone;
|
||||
}
|
||||
if (fDirect || fDirect === undefined) {
|
||||
this.readBitsDirect = afn[0] || this.readNone;
|
||||
this.readWordDirect = afn[2] || this.readWordDefault;
|
||||
this.readWordDirect = afn[2] || this.readNone;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,11 +280,11 @@ class MemoryPDP10 {
|
|||
{
|
||||
if (!fDirect || !this.cWriteBreakpoints) {
|
||||
this.writeBits = !this.fReadOnly && afn[1] || this.writeNone;
|
||||
this.writeWord = !this.fReadOnly && afn[3] || this.writeWordDefault;
|
||||
this.writeWord = !this.fReadOnly && afn[3] || this.writeNone;
|
||||
}
|
||||
if (fDirect || fDirect === undefined) {
|
||||
this.writeBitsDirect = afn[1] || this.writeNone;
|
||||
this.writeWordDirect = afn[3] || this.writeWordDefault;
|
||||
this.writeWordDirect = afn[3] || this.writeNone;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ class MemoryPDP10 {
|
|||
resetWriteAccess()
|
||||
{
|
||||
this.writeBits = this.fReadOnly? this.writeNone : this.writeBitsDirect;
|
||||
this.writeWord = this.fReadOnly? this.writeWordDefault : this.writeWordDirect;
|
||||
this.writeWord = this.fReadOnly? this.writeNone : this.writeWordDirect;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -393,7 +393,7 @@ class MemoryPDP10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* readNone(off)
|
||||
* readNone(off, addr)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} off
|
||||
|
|
@ -405,6 +405,7 @@ class MemoryPDP10 {
|
|||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP10.MEMORY) /* && !off */) {
|
||||
this.dbg.printMessage("attempt to read invalid address " + this.dbg.toStrBase(addr), true);
|
||||
}
|
||||
this.bus.fault(addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -424,42 +425,16 @@ class MemoryPDP10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* readWordDefault(off, addr)
|
||||
* readBitsMemory(off, addr, offBits, lenBits)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
* @return {number}
|
||||
*/
|
||||
readWordDefault(off, addr)
|
||||
{
|
||||
return this.readWord(off, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* writeWordDefault(w, off, addr)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} w
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
*/
|
||||
writeWordDefault(w, off, addr)
|
||||
{
|
||||
this.writeWord(w, off, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* readBitsMemory(offBits, lenBits, off, addr)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
* @return {number}
|
||||
*/
|
||||
readBitsMemory(offBits, lenBits, off, addr)
|
||||
readBitsMemory(off, addr, offBits, lenBits)
|
||||
{
|
||||
var w = this.aw[off];
|
||||
if (offBits + lenBits <= 32) {
|
||||
|
|
@ -484,16 +459,16 @@ class MemoryPDP10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* writeBitsMemory(offBits, lenBits, bits, off, addr)
|
||||
* writeBitsMemory(bits, off, addr, offBits, lenBits)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
* @param {number} bits (only the right-most lenBits of bits are used, so this value doesn't need to be pre-masked)
|
||||
* @param {number} bits (only the right-most lenBits of bits are used, so it doesn't need to be pre-masked)
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
*/
|
||||
writeBitsMemory(offBits, lenBits, bits, off, addr)
|
||||
writeBitsMemory(bits, off, addr, offBits, lenBits)
|
||||
{
|
||||
var w = this.aw[off];
|
||||
var shiftBits = Math.pow(2, offBits);
|
||||
|
|
@ -521,21 +496,21 @@ class MemoryPDP10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* readBitsChecked(offBits, lenBits, off, addr)
|
||||
* readBitsChecked(off, addr, offBits, lenBits)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
* @return {number}
|
||||
*/
|
||||
readBitsChecked(offBits, lenBits, off, addr)
|
||||
readBitsChecked(off, addr, offBits, lenBits)
|
||||
{
|
||||
if (DEBUGGER && this.dbg && this.addr != null) {
|
||||
this.dbg.checkMemoryRead(this.addr + off);
|
||||
}
|
||||
return this.readBitsDirect(offBits, lenBits, off, addr);
|
||||
return this.readBitsDirect(off, addr, offBits, lenBits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -555,21 +530,21 @@ class MemoryPDP10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* writeBitsChecked(offBits, lenBits, bits, off, addr)
|
||||
* writeBitsChecked(bits, off, addr, offBits, lenBits)
|
||||
*
|
||||
* @this {MemoryPDP10}
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
* @param {number} bits
|
||||
* @param {number} off
|
||||
* @param {number} addr
|
||||
* @param {number} offBits (the bit position of the right-most bit of the result, using modern bit numbering)
|
||||
* @param {number} lenBits
|
||||
*/
|
||||
writeBitsChecked(offBits, lenBits, bits, off, addr)
|
||||
writeBitsChecked(bits, off, addr, offBits, lenBits)
|
||||
{
|
||||
if (DEBUGGER && this.dbg && this.addr != null) {
|
||||
this.dbg.checkMemoryWrite(this.addr + off);
|
||||
}
|
||||
if (this.fReadOnly) this.writeNone(bits, off, addr); else this.writeBitsDirect(offBits, lenBits, bits, off, addr);
|
||||
if (this.fReadOnly) this.writeNone(bits, off, addr); else this.writeBitsDirect(bits, off, addr, offBits, lenBits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -617,8 +592,8 @@ MemoryPDP10.idBlock = 0;
|
|||
MemoryPDP10.afnNone = [
|
||||
MemoryPDP10.prototype.readNone,
|
||||
MemoryPDP10.prototype.writeNone,
|
||||
MemoryPDP10.prototype.readWordDefault,
|
||||
MemoryPDP10.prototype.writeWordDefault
|
||||
MemoryPDP10.prototype.readNone,
|
||||
MemoryPDP10.prototype.writeNone
|
||||
];
|
||||
*/
|
||||
MemoryPDP10.afnNone = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue