Bus-related defines moved to the Bus component
This commit is contained in:
parent
122ca78fd5
commit
a13bb9348a
4 changed files with 29 additions and 38 deletions
|
|
@ -118,8 +118,7 @@ function BusPDP11(parmsBus, cpu, dbg)
|
||||||
* component for details.
|
* component for details.
|
||||||
*
|
*
|
||||||
* UPDATE: The Debugger wants to piggy-back on these arrays to indicate addresses for which it wants
|
* UPDATE: The Debugger wants to piggy-back on these arrays to indicate addresses for which it wants
|
||||||
* notification. In those cases, the registered component/function elements may or may not be set,
|
* notification. In those cases, the following additional element will be set:
|
||||||
* but the following additional element will be set:
|
|
||||||
*
|
*
|
||||||
* [4]: true to break on I/O, false to ignore I/O
|
* [4]: true to break on I/O, false to ignore I/O
|
||||||
*
|
*
|
||||||
|
|
@ -154,9 +153,7 @@ BusPDP11.MAX_ADDRESS = 0x400000; /*020000000*/ // Register addr
|
||||||
BusPDP11.ERROR = {
|
BusPDP11.ERROR = {
|
||||||
RANGE_INUSE: 1,
|
RANGE_INUSE: 1,
|
||||||
RANGE_INVALID: 2,
|
RANGE_INVALID: 2,
|
||||||
NO_CONTROLLER: 3,
|
NO_CONTROLLER: 3
|
||||||
SETACC_INVALID: 4,
|
|
||||||
REMOVE_INVALID: 5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -603,7 +600,7 @@ BusPDP11.prototype.removeMemory = function(addr, size)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.reportError(BusPDP11.ERROR.REMOVE_INVALID, addr, size);
|
return this.reportError(BusPDP11.ERROR.RANGE_INVALID, addr, size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -654,7 +651,7 @@ BusPDP11.prototype.setMemoryAccess = function(addr, size, afn, fQuiet)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.reportError(BusPDP11.ERROR.SETACC_INVALID, addr, size);
|
return this.reportError(BusPDP11.ERROR.RANGE_INVALID, addr, size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ if (NODE) {
|
||||||
var Component = require("../../shared/lib/component");
|
var Component = require("../../shared/lib/component");
|
||||||
var State = require("../../shared/lib/state");
|
var State = require("../../shared/lib/state");
|
||||||
var PDP11 = require("./defines");
|
var PDP11 = require("./defines");
|
||||||
|
var BusPDP11 = require("./bus");
|
||||||
var CPUPDP11 = require("./cpu");
|
var CPUPDP11 = require("./cpu");
|
||||||
var MessagesPDP11 = require("./messages");
|
var MessagesPDP11 = require("./messages");
|
||||||
var MemoryPDP11 = require("./memory");
|
var MemoryPDP11 = require("./memory");
|
||||||
|
|
@ -709,10 +710,10 @@ CPUStatePDP11.prototype.mapUnibus = function(unibusAddress)
|
||||||
if (idx < 31) {
|
if (idx < 31) {
|
||||||
if (this.MMR3 & 0x20) {
|
if (this.MMR3 & 0x20) {
|
||||||
unibusAddress = (this.unibusMap[idx] + (unibusAddress & 0x1ffe)) & 0x3ffffe;
|
unibusAddress = (this.unibusMap[idx] + (unibusAddress & 0x1ffe)) & 0x3ffffe;
|
||||||
if (unibusAddress >= PDP11.IOBASE_UNIBUS && unibusAddress < PDP11.IOBASE_22BIT) this.panic(898);
|
if (unibusAddress >= BusPDP11.IOPAGE_UNIBUS && unibusAddress < BusPDP11.IOPAGE_22BIT) this.panic(898);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unibusAddress |= PDP11.IOBASE_22BIT;
|
unibusAddress |= BusPDP11.IOPAGE_22BIT;
|
||||||
}
|
}
|
||||||
return unibusAddress;
|
return unibusAddress;
|
||||||
};
|
};
|
||||||
|
|
@ -772,8 +773,8 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessMa
|
||||||
if (!(accessMask & this.mmuEnable)) {
|
if (!(accessMask & this.mmuEnable)) {
|
||||||
physicalAddress = virtualAddress & 0xffff; // virtual address without MMU is 16 bit (no I&D)
|
physicalAddress = virtualAddress & 0xffff; // virtual address without MMU is 16 bit (no I&D)
|
||||||
this.mmuLastVirtual = physicalAddress;
|
this.mmuLastVirtual = physicalAddress;
|
||||||
if (physicalAddress >= PDP11.IOBASE_VIRT) {
|
if (physicalAddress >= BusPDP11.IOPAGE_VIRT) {
|
||||||
physicalAddress |= PDP11.IOBASE_22BIT;
|
physicalAddress |= BusPDP11.IOPAGE_22BIT;
|
||||||
} else { // no max_memory check in 16 bit mode
|
} else { // no max_memory check in 16 bit mode
|
||||||
if ((physicalAddress & 1) && !(accessMask & PDP11.BYTE_MODE)) {
|
if ((physicalAddress & 1) && !(accessMask & PDP11.BYTE_MODE)) {
|
||||||
this.CPU_Error |= 0x40;
|
this.CPU_Error |= 0x40;
|
||||||
|
|
@ -787,15 +788,15 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessMa
|
||||||
pdr = this.mmuMap[this.mmuMode][page];
|
pdr = this.mmuMap[this.mmuMode][page];
|
||||||
physicalAddress = ((this.mmuMap[this.mmuMode][page + 16] << 6) + (virtualAddress & 0x1fff)) & 0x3fffff;
|
physicalAddress = ((this.mmuMap[this.mmuMode][page + 16] << 6) + (virtualAddress & 0x1fff)) & 0x3fffff;
|
||||||
if (this.MMR3 & 0x10) { // if 22 bit MM mode
|
if (this.MMR3 & 0x10) { // if 22 bit MM mode
|
||||||
if (physicalAddress >= PDP11.IOBASE_UNIBUS && physicalAddress < PDP11.IOBASE_22BIT) {
|
if (physicalAddress >= BusPDP11.IOPAGE_UNIBUS && physicalAddress < BusPDP11.IOPAGE_22BIT) {
|
||||||
physicalAddress = this.mapUnibus(physicalAddress & 0x3ffff); // 18bit unibus space
|
physicalAddress = this.mapUnibus(physicalAddress & 0x3ffff); // 18bit unibus space
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
physicalAddress &= 0x3ffff; // truncate if only 18 bit mapping
|
physicalAddress &= 0x3ffff; // truncate if only 18 bit mapping
|
||||||
if (physicalAddress >= PDP11.IOBASE_18BIT) physicalAddress |= PDP11.IOBASE_22BIT;
|
if (physicalAddress >= BusPDP11.IOPAGE_18BIT) physicalAddress |= BusPDP11.IOPAGE_22BIT;
|
||||||
}
|
}
|
||||||
if (physicalAddress < PDP11.IOBASE_UNIBUS) {
|
if (physicalAddress < BusPDP11.IOPAGE_UNIBUS) {
|
||||||
if (physicalAddress >= PDP11.MAX_MEMORY) {
|
if (physicalAddress >= BusPDP11.MAX_MEMORY) {
|
||||||
this.CPU_Error |= 0x20;
|
this.CPU_Error |= 0x20;
|
||||||
return this.trap(4, 24); // KB11-EM does this after ABORT handling - KB11-CM before
|
return this.trap(4, 24); // KB11-EM does this after ABORT handling - KB11-CM before
|
||||||
}
|
}
|
||||||
|
|
@ -880,10 +881,10 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessMa
|
||||||
*/
|
*/
|
||||||
CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress)
|
CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress)
|
||||||
{
|
{
|
||||||
if (physicalAddress >= PDP11.MAX_ADDRESS) {
|
if (physicalAddress >= BusPDP11.MAX_ADDRESS) {
|
||||||
return this.regsGen[physicalAddress - PDP11.MAX_ADDRESS];
|
return this.regsGen[physicalAddress - BusPDP11.MAX_ADDRESS];
|
||||||
} else {
|
} else {
|
||||||
// if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
|
// if (physicalAddress >= BusPDP11.IOPAGE_UNIBUS) {
|
||||||
// return this.bus.access_iopage(physicalAddress, -1, 0);
|
// return this.bus.access_iopage(physicalAddress, -1, 0);
|
||||||
// } else {
|
// } else {
|
||||||
if (physicalAddress >= 0) {
|
if (physicalAddress >= 0) {
|
||||||
|
|
@ -905,10 +906,10 @@ CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress)
|
||||||
CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data)
|
CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data)
|
||||||
{
|
{
|
||||||
data &= 0xffff;
|
data &= 0xffff;
|
||||||
if (physicalAddress >= PDP11.MAX_ADDRESS) {
|
if (physicalAddress >= BusPDP11.MAX_ADDRESS) {
|
||||||
return (this.regsGen[physicalAddress - PDP11.MAX_ADDRESS] = data);
|
return (this.regsGen[physicalAddress - BusPDP11.MAX_ADDRESS] = data);
|
||||||
} else {
|
} else {
|
||||||
// if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
|
// if (physicalAddress >= BusPDP11.IOPAGE_UNIBUS) {
|
||||||
// return this.bus.access_iopage(physicalAddress, data, 0);
|
// return this.bus.access_iopage(physicalAddress, data, 0);
|
||||||
// } else {
|
// } else {
|
||||||
if (physicalAddress >= 0) {
|
if (physicalAddress >= 0) {
|
||||||
|
|
@ -930,10 +931,10 @@ CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data)
|
||||||
CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress)
|
CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress)
|
||||||
{
|
{
|
||||||
var result;
|
var result;
|
||||||
if (physicalAddress >= PDP11.MAX_ADDRESS) {
|
if (physicalAddress >= BusPDP11.MAX_ADDRESS) {
|
||||||
return (this.regsGen[physicalAddress - PDP11.MAX_ADDRESS] & 0xff);
|
return (this.regsGen[physicalAddress - BusPDP11.MAX_ADDRESS] & 0xff);
|
||||||
} else {
|
} else {
|
||||||
// if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
|
// if (physicalAddress >= BusPDP11.IOPAGE_UNIBUS) {
|
||||||
// return this.bus.access_iopage(physicalAddress, -1, 1);
|
// return this.bus.access_iopage(physicalAddress, -1, 1);
|
||||||
// } else {
|
// } else {
|
||||||
if (physicalAddress >= 0) {
|
if (physicalAddress >= 0) {
|
||||||
|
|
@ -955,10 +956,10 @@ CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress)
|
||||||
CPUStatePDP11.prototype.writeByteByAddr = function(physicalAddress, data)
|
CPUStatePDP11.prototype.writeByteByAddr = function(physicalAddress, data)
|
||||||
{
|
{
|
||||||
data &= 0xff;
|
data &= 0xff;
|
||||||
if (physicalAddress >= PDP11.MAX_ADDRESS) {
|
if (physicalAddress >= BusPDP11.MAX_ADDRESS) {
|
||||||
return (this.regsGen[physicalAddress - PDP11.MAX_ADDRESS] = (this.regsGen[physicalAddress - PDP11.MAX_ADDRESS] & 0xff00) | data);
|
return (this.regsGen[physicalAddress - BusPDP11.MAX_ADDRESS] = (this.regsGen[physicalAddress - BusPDP11.MAX_ADDRESS] & 0xff00) | data);
|
||||||
} else {
|
} else {
|
||||||
// if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
|
// if (physicalAddress >= BusPDP11.IOPAGE_UNIBUS) {
|
||||||
// return this.bus.access_iopage(physicalAddress, data, 1);
|
// return this.bus.access_iopage(physicalAddress, data, 1);
|
||||||
// } else {
|
// } else {
|
||||||
if (physicalAddress >= 0) {
|
if (physicalAddress >= 0) {
|
||||||
|
|
@ -1169,7 +1170,7 @@ CPUStatePDP11.prototype.getAddrByMode = function(addressMode, accessMode)
|
||||||
{
|
{
|
||||||
var result;
|
var result;
|
||||||
if (!(addressMode & 0x38)) {
|
if (!(addressMode & 0x38)) {
|
||||||
return PDP11.MAX_ADDRESS + (addressMode & 7); // Registers have special addresses above maximum address
|
return BusPDP11.MAX_ADDRESS + (addressMode & 7); // Registers have special addresses above maximum address
|
||||||
} else {
|
} else {
|
||||||
if ((result = this.getVirtualByMode(addressMode, accessMode)) >= 0) {
|
if ((result = this.getVirtualByMode(addressMode, accessMode)) >= 0) {
|
||||||
result = this.mapVirtualToPhysical(result, accessMode);
|
result = this.mapVirtualToPhysical(result, accessMode);
|
||||||
|
|
|
||||||
|
|
@ -183,13 +183,6 @@ var PDP11 = {
|
||||||
// TODO
|
// TODO
|
||||||
},
|
},
|
||||||
|
|
||||||
IOBASE_VIRT: 0x00E000, /*000160000*/
|
|
||||||
IOBASE_18BIT: 0x03E000, /*000760000*/
|
|
||||||
IOBASE_UNIBUS: 0x3C0000, /*017000000*/
|
|
||||||
IOBASE_22BIT: 0x3FE000, /*017760000*/
|
|
||||||
MAX_MEMORY: 0x3C0000 - 16384, // Maximum memory address (need less memory for BSD 2.9 boot)
|
|
||||||
MAX_ADDRESS: 0x400000, /*020000000*/ // Register addresses are above 22 bit addressing
|
|
||||||
|
|
||||||
BYTE_MODE: 1,
|
BYTE_MODE: 1,
|
||||||
READ_MODE: 2,
|
READ_MODE: 2,
|
||||||
WRITE_MODE: 4,
|
WRITE_MODE: 4,
|
||||||
|
|
|
||||||
|
|
@ -636,10 +636,10 @@ DevicePDP11.prototype.mapUnibus = function(unibusAddress)
|
||||||
if (idx < 31) {
|
if (idx < 31) {
|
||||||
if (this.cpu.MMR3 & 0x20) {
|
if (this.cpu.MMR3 & 0x20) {
|
||||||
unibusAddress = (this.cpu.unibusMap[idx] + (unibusAddress & 0x1ffe)) & 0x3ffffe;
|
unibusAddress = (this.cpu.unibusMap[idx] + (unibusAddress & 0x1ffe)) & 0x3ffffe;
|
||||||
if (unibusAddress >= PDP11.IOBASE_UNIBUS && unibusAddress < PDP11.IOBASE_22BIT) this.cpu.panic(898);
|
if (unibusAddress >= BusPDP11.IOPAGE_UNIBUS && unibusAddress < BusPDP11.IOPAGE_22BIT) this.cpu.panic(898);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unibusAddress |= PDP11.IOBASE_22BIT;
|
unibusAddress |= BusPDP11.IOPAGE_22BIT;
|
||||||
}
|
}
|
||||||
return unibusAddress;
|
return unibusAddress;
|
||||||
};
|
};
|
||||||
|
|
@ -916,7 +916,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag)
|
||||||
break;
|
break;
|
||||||
case 0x3FFFF0: /*017777760*/ // Lower size
|
case 0x3FFFF0: /*017777760*/ // Lower size
|
||||||
if (cpu.cpuType !== 70) return cpu.trap(4, 228);
|
if (cpu.cpuType !== 70) return cpu.trap(4, 228);
|
||||||
result = (PDP11.MAX_MEMORY >> 6) - 1;
|
result = (BusPDP11.MAX_MEMORY >> 6) - 1;
|
||||||
break;
|
break;
|
||||||
case 0x3FFFF8: /*017777770*/ // Microprogram break
|
case 0x3FFFF8: /*017777770*/ // Microprogram break
|
||||||
if (data >= 0 && !(physicalAddress & 1)) data &= 0xff; // Required for KB11-CM without MFPT instruction
|
if (data >= 0 && !(physicalAddress & 1)) data &= 0xff; // Required for KB11-CM without MFPT instruction
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue