Successfully running PCx86 and PC8080 machines on the same page now

This commit is contained in:
Jeff Parsons 2016-08-18 10:29:24 -07:00
commit f0509bc5d1
30 changed files with 2773 additions and 3118 deletions

View file

@ -36,34 +36,34 @@ if (NODE) {
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var Messages = require("./messages");
var State = require("./state");
var CPUDef = require("./cpudef");
var CPUDef8080 = require("./cpudef");
var Messages8080= require("./messages");
var State8080 = require("./state");
}
/**
* ChipSet(parmsChipSet)
* ChipSet8080(parmsChipSet)
*
* The ChipSet component has the following component-specific (parmsChipSet) properties:
* The ChipSet8080 component has the following component-specific (parmsChipSet) properties:
*
* model: eg, "SI1978" (should be a member of ChipSet.MODELS)
* model: eg, "SI1978" (should be a member of ChipSet8080.MODELS)
* swDIP: eg, "00000000", where swDIP[0] is DIP0, swDIP[1] is DIP1, etc.
*
* @constructor
* @extends Component
* @param {Object} parmsChipSet
*/
function ChipSet(parmsChipSet)
function ChipSet8080(parmsChipSet)
{
Component.call(this, "ChipSet", parmsChipSet, ChipSet, Messages.CHIPSET);
Component.call(this, "ChipSet", parmsChipSet, ChipSet8080, Messages8080.CHIPSET);
var model = parmsChipSet['model'];
if (model && !ChipSet.MODELS[model]) {
if (model && !ChipSet8080.MODELS[model]) {
Component.notice("Unrecognized ChipSet model: " + model);
}
this.config = ChipSet.MODELS[model] || {};
this.config = ChipSet8080.MODELS[model] || {};
this.bSwitches = this.parseDIPSwitches(parmsChipSet['swDIP']);
@ -98,7 +98,7 @@ function ChipSet(parmsChipSet)
this.setReady();
}
Component.subclass(ChipSet);
Component.subclass(ChipSet8080);
/*
* NOTE: The STATUS1 port could have been handled entirely by the Keyboard component, but it was just as easy
@ -106,7 +106,7 @@ Component.subclass(ChipSet);
* button press or release. It's a six-of-one, half-a-dozen-of-another choice, since technically, Space Invaders
* doesn't have a keyboard.
*/
ChipSet.SI1978 = {
ChipSet8080.SI1978 = {
MODEL: 1978.1,
STATUS0: { // NOTE: STATUS0 not used by the SI1978 ROMs; refer to STATUS1 instead
PORT: 0,
@ -218,7 +218,7 @@ ChipSet.SI1978 = {
* but some are more appropriately handled by other components; eg, port 0x82 is handled by the Keyboard component,
* so it's defined there instead of here.
*/
ChipSet.VT100 = {
ChipSet8080.VT100 = {
MODEL: 100.0,
FLAGS: {
PORT: 0x42, // read-only
@ -363,20 +363,20 @@ ChipSet.VT100 = {
/*
* Supported models and their configurations
*/
ChipSet.MODELS = {
"SI1978": ChipSet.SI1978,
"VT100": ChipSet.VT100
ChipSet8080.MODELS = {
"SI1978": ChipSet8080.SI1978,
"VT100": ChipSet8080.VT100
};
/**
* parseDIPSwitches(sBits, bDefault)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {string} sBits describing switch settings
* @param {number} [bDefault]
* @return {number|undefined}
*/
ChipSet.prototype.parseDIPSwitches = function(sBits, bDefault)
ChipSet8080.prototype.parseDIPSwitches = function(sBits, bDefault)
{
var b = bDefault;
if (sBits) {
@ -396,14 +396,14 @@ ChipSet.prototype.parseDIPSwitches = function(sBits, bDefault)
/**
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "sw1")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
ChipSet.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
ChipSet8080.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
return false;
};
@ -411,21 +411,21 @@ ChipSet.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
/**
* initBus(cmp, bus, cpu, dbg)
*
* @this {ChipSet}
* @param {Computer} cmp
* @param {Bus} bus
* @param {CPUState} cpu
* @param {Debugger} dbg
* @this {ChipSet8080}
* @param {Computer8080} cmp
* @param {Bus8080} bus
* @param {CPUState8080} cpu
* @param {Debugger8080} dbg
*/
ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
ChipSet8080.prototype.initBus = function(cmp, bus, cpu, dbg)
{
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.cmp = cmp;
this.kbd = /** @type {Keyboard} */ (cmp.getMachineComponent("Keyboard"));
this.serial = /** @type {SerialPort} */ (cmp.getMachineComponent("SerialPort"));
this.video = /** @type {Video} */ (cmp.getMachineComponent("Video"));
this.kbd = /** @type {Keyboard8080} */ (cmp.getMachineComponent("Keyboard"));
this.serial = /** @type {SerialPort8080} */ (cmp.getMachineComponent("SerialPort"));
this.video = /** @type {Video8080} */ (cmp.getMachineComponent("Video"));
bus.addPortInputTable(this, this.config.portsInput);
bus.addPortOutputTable(this, this.config.portsOutput);
};
@ -433,12 +433,12 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
/**
* powerUp(data, fRepower)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {Object|null} data
* @param {boolean} [fRepower]
* @return {boolean} true if successful, false if failure
*/
ChipSet.prototype.powerUp = function(data, fRepower)
ChipSet8080.prototype.powerUp = function(data, fRepower)
{
if (!fRepower) {
if (!data) {
@ -453,39 +453,39 @@ ChipSet.prototype.powerUp = function(data, fRepower)
/**
* powerDown(fSave, fShutdown)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {boolean} [fSave]
* @param {boolean} [fShutdown]
* @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure
*/
ChipSet.prototype.powerDown = function(fSave, fShutdown)
ChipSet8080.prototype.powerDown = function(fSave, fShutdown)
{
return fSave? this.save() : true;
};
ChipSet.SI1978.INIT = [
ChipSet8080.SI1978.INIT = [
[
ChipSet.SI1978.STATUS0.ALWAYS_SET,
ChipSet.SI1978.STATUS1.ALWAYS_SET,
ChipSet.SI1978.STATUS2.ALWAYS_SET,
ChipSet8080.SI1978.STATUS0.ALWAYS_SET,
ChipSet8080.SI1978.STATUS1.ALWAYS_SET,
ChipSet8080.SI1978.STATUS2.ALWAYS_SET,
0, 0, 0, 0
]
];
ChipSet.VT100.INIT = [
ChipSet8080.VT100.INIT = [
[
ChipSet.VT100.BRIGHTNESS.INIT,
ChipSet.VT100.FLAGS.NO_AVO | ChipSet.VT100.FLAGS.NO_GFX
ChipSet8080.VT100.BRIGHTNESS.INIT,
ChipSet8080.VT100.FLAGS.NO_AVO | ChipSet8080.VT100.FLAGS.NO_GFX
],
[
ChipSet.VT100.DC011.INITCOLS,
ChipSet.VT100.DC011.INITRATE
ChipSet8080.VT100.DC011.INITCOLS,
ChipSet8080.VT100.DC011.INITRATE
],
[
ChipSet.VT100.DC012.INITSCROLL,
ChipSet.VT100.DC012.INITBLINK,
ChipSet.VT100.DC012.INITREVERSE,
ChipSet.VT100.DC012.INITATTR
ChipSet8080.VT100.DC012.INITSCROLL,
ChipSet8080.VT100.DC012.INITBLINK,
ChipSet8080.VT100.DC012.INITREVERSE,
ChipSet8080.VT100.DC012.INITATTR
],
[
0, 0, 0, 0,
@ -507,9 +507,9 @@ ChipSet.VT100.INIT = [
/**
* reset()
*
* @this {ChipSet}
* @this {ChipSet8080}
*/
ChipSet.prototype.reset = function()
ChipSet8080.prototype.reset = function()
{
if (this.config.INIT && !this.restore(this.config.INIT)) {
this.notice("reset error");
@ -521,17 +521,17 @@ ChipSet.prototype.reset = function()
*
* This implements save support for the ChipSet component.
*
* @this {ChipSet}
* @this {ChipSet8080}
* @return {Object}
*/
ChipSet.prototype.save = function()
ChipSet8080.prototype.save = function()
{
var state = new State(this);
switch(this.config.MODEL) {
case ChipSet.SI1978.MODEL:
case ChipSet8080.SI1978.MODEL:
state.set(0, [this.bStatus0, this.bStatus1, this.bStatus2, this.wShiftData, this.bShiftCount, this.bSound1, this.bSound2]);
break;
case ChipSet.VT100.MODEL:
case ChipSet8080.VT100.MODEL:
state.set(0, [this.bBrightness, this.bFlags]);
state.set(1, [this.bDC011Cols, this.bDC011Rate]);
state.set(2, [this.bDC012Scroll, this.bDC012Blink, this.bDC012Reverse, this.bDC012Attr]);
@ -546,16 +546,16 @@ ChipSet.prototype.save = function()
*
* This implements restore support for the ChipSet component.
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {Object} data
* @return {boolean} true if successful, false if failure
*/
ChipSet.prototype.restore = function(data)
ChipSet8080.prototype.restore = function(data)
{
var a;
if (data && (a = data[0]) && a.length) {
switch(this.config.MODEL) {
case ChipSet.SI1978.MODEL:
case ChipSet8080.SI1978.MODEL:
this.bStatus0 = a[0];
this.bStatus1 = a[1];
this.bStatus2 = a[2];
@ -564,7 +564,7 @@ ChipSet.prototype.restore = function(data)
this.bSound1 = a[5];
this.bSound2 = a[6];
return true;
case ChipSet.VT100.MODEL:
case ChipSet8080.VT100.MODEL:
this.bBrightness = a[0];
this.bFlags = a[1];
a = data[1];
@ -592,9 +592,9 @@ ChipSet.prototype.restore = function(data)
*
* Notification from the CPU that it's starting.
*
* @this {ChipSet}
* @this {ChipSet8080}
*/
ChipSet.prototype.start = function()
ChipSet8080.prototype.start = function()
{
/*
* Currently, all we (may) do with this notification is allow the speaker to make noise.
@ -606,9 +606,9 @@ ChipSet.prototype.start = function()
*
* Notification from the CPU that it's stopping.
*
* @this {ChipSet}
* @this {ChipSet8080}
*/
ChipSet.prototype.stop = function()
ChipSet8080.prototype.stop = function()
{
/*
* Currently, all we (may) do with this notification is prevent the speaker from making noise.
@ -618,11 +618,11 @@ ChipSet.prototype.stop = function()
/**
* updateStatus0(bit, fSet)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} bit
* @param {boolean} fSet
*/
ChipSet.prototype.updateStatus0 = function(bit, fSet)
ChipSet8080.prototype.updateStatus0 = function(bit, fSet)
{
this.bStatus0 &= ~bit;
if (fSet) this.bStatus0 |= bit;
@ -631,11 +631,11 @@ ChipSet.prototype.updateStatus0 = function(bit, fSet)
/**
* updateStatus1(bit, fSet)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} bit
* @param {boolean} fSet
*/
ChipSet.prototype.updateStatus1 = function(bit, fSet)
ChipSet8080.prototype.updateStatus1 = function(bit, fSet)
{
this.bStatus1 &= ~bit;
if (fSet) this.bStatus1 |= bit;
@ -644,11 +644,11 @@ ChipSet.prototype.updateStatus1 = function(bit, fSet)
/**
* updateStatus2(bit, fSet)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} bit
* @param {boolean} fSet
*/
ChipSet.prototype.updateStatus2 = function(bit, fSet)
ChipSet8080.prototype.updateStatus2 = function(bit, fSet)
{
this.bStatus2 &= ~bit;
if (fSet) this.bStatus2 |= bit;
@ -657,12 +657,12 @@ ChipSet.prototype.updateStatus2 = function(bit, fSet)
/**
* inSIStatus0(port, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x00)
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
* @return {number} simulated port value
*/
ChipSet.prototype.inSIStatus0 = function(port, addrFrom)
ChipSet8080.prototype.inSIStatus0 = function(port, addrFrom)
{
var b = this.bStatus0;
this.printMessageIO(port, null, addrFrom, "STATUS0", b, true);
@ -672,12 +672,12 @@ ChipSet.prototype.inSIStatus0 = function(port, addrFrom)
/**
* inSIStatus1(port, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x01)
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
* @return {number} simulated port value
*/
ChipSet.prototype.inSIStatus1 = function(port, addrFrom)
ChipSet8080.prototype.inSIStatus1 = function(port, addrFrom)
{
var b = this.bStatus1;
this.printMessageIO(port, null, addrFrom, "STATUS1", b, true);
@ -687,12 +687,12 @@ ChipSet.prototype.inSIStatus1 = function(port, addrFrom)
/**
* inSIStatus2(port, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x02)
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
* @return {number} simulated port value
*/
ChipSet.prototype.inSIStatus2 = function(port, addrFrom)
ChipSet8080.prototype.inSIStatus2 = function(port, addrFrom)
{
var b = this.bStatus2;
this.printMessageIO(port, null, addrFrom, "STATUS2", b, true);
@ -702,12 +702,12 @@ ChipSet.prototype.inSIStatus2 = function(port, addrFrom)
/**
* inSIShiftResult(port, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x03)
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
* @return {number} simulated port value
*/
ChipSet.prototype.inSIShiftResult = function(port, addrFrom)
ChipSet8080.prototype.inSIShiftResult = function(port, addrFrom)
{
var b = (this.wShiftData >> (8 - this.bShiftCount)) & 0xff;
this.printMessageIO(port, null, addrFrom, "SHIFT.RESULT", b, true);
@ -717,12 +717,12 @@ ChipSet.prototype.inSIShiftResult = function(port, addrFrom)
/**
* outSIShiftCount(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x02)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outSIShiftCount = function(port, b, addrFrom)
ChipSet8080.prototype.outSIShiftCount = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "SHIFT.COUNT", null, true);
this.bShiftCount = b;
@ -731,12 +731,12 @@ ChipSet.prototype.outSIShiftCount = function(port, b, addrFrom)
/**
* outSISound1(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x03)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outSISound1 = function(port, b, addrFrom)
ChipSet8080.prototype.outSISound1 = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "SOUND1", null, true);
this.bSound1 = b;
@ -745,12 +745,12 @@ ChipSet.prototype.outSISound1 = function(port, b, addrFrom)
/**
* outSIShiftData(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x04)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outSIShiftData = function(port, b, addrFrom)
ChipSet8080.prototype.outSIShiftData = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "SHIFT.DATA", null, true);
this.wShiftData = (b << 8) | (this.wShiftData >> 8);
@ -759,12 +759,12 @@ ChipSet.prototype.outSIShiftData = function(port, b, addrFrom)
/**
* outSISound2(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x05)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outSISound2 = function(port, b, addrFrom)
ChipSet8080.prototype.outSISound2 = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "SOUND2", null, true);
this.bSound2 = b;
@ -773,12 +773,12 @@ ChipSet.prototype.outSISound2 = function(port, b, addrFrom)
/**
* outSIWatchdog(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x06)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outSIWatchdog = function(port, b, addrFrom)
ChipSet8080.prototype.outSIWatchdog = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "WATCHDOG", null, true);
};
@ -796,7 +796,7 @@ ChipSet.prototype.outSIWatchdog = function(port, b, addrFrom)
* @param {number} iBit
* @return {number}
*/
ChipSet.prototype.getVT100LBA = function(iBit)
ChipSet8080.prototype.getVT100LBA = function(iBit)
{
return (this.cpu.getCycles() & (1 << (iBit - 1))) << 1;
};
@ -806,7 +806,7 @@ ChipSet.prototype.getVT100LBA = function(iBit)
*
* @return {number}
*/
ChipSet.prototype.getNVRAddr = function()
ChipSet8080.prototype.getNVRAddr = function()
{
var i;
var tens = 0, ones = 0;
@ -827,54 +827,54 @@ ChipSet.prototype.getNVRAddr = function()
/**
* doNVRCommand()
*/
ChipSet.prototype.doNVRCommand = function()
ChipSet8080.prototype.doNVRCommand = function()
{
var addr, data;
var bit = this.bNVRLatch & 0x1;
var bCmd = (this.bNVRLatch >> 1) & 0x7;
switch(bCmd) {
case ChipSet.VT100.NVR.CMD.STANDBY:
case ChipSet8080.VT100.NVR.CMD.STANDBY:
break;
case ChipSet.VT100.NVR.CMD.ACCEPT_ADDR:
case ChipSet8080.VT100.NVR.CMD.ACCEPT_ADDR:
this.dNVRAddr = (this.dNVRAddr << 1) | bit;
break;
case ChipSet.VT100.NVR.CMD.ERASE:
case ChipSet8080.VT100.NVR.CMD.ERASE:
addr = this.getNVRAddr();
this.aNVRWords[addr] = ChipSet.VT100.NVR.WORDMASK;
this.aNVRWords[addr] = ChipSet8080.VT100.NVR.WORDMASK;
this.printMessage("doNVRCommand(): erase data at addr " + str.toHexWord(addr));
break;
case ChipSet.VT100.NVR.CMD.ACCEPT_DATA:
case ChipSet8080.VT100.NVR.CMD.ACCEPT_DATA:
this.wNVRData = (this.wNVRData << 1) | bit;
break;
case ChipSet.VT100.NVR.CMD.WRITE:
case ChipSet8080.VT100.NVR.CMD.WRITE:
addr = this.getNVRAddr();
data = this.wNVRData & ChipSet.VT100.NVR.WORDMASK;
data = this.wNVRData & ChipSet8080.VT100.NVR.WORDMASK;
this.aNVRWords[addr] = data;
this.printMessage("doNVRCommand(): write data " + str.toHexWord(data) + " to addr " + str.toHexWord(addr));
break;
case ChipSet.VT100.NVR.CMD.READ:
case ChipSet8080.VT100.NVR.CMD.READ:
addr = this.getNVRAddr();
data = this.aNVRWords[addr];
/*
* If we don't explicitly initialize aNVRWords[], pretend any uninitialized words contains WORDMASK.
*/
if (data == null) data = ChipSet.VT100.NVR.WORDMASK;
if (data == null) data = ChipSet8080.VT100.NVR.WORDMASK;
this.wNVRData = data;
this.printMessage("doNVRCommand(): read data " + str.toHexWord(data) + " from addr " + str.toHexWord(addr));
break;
case ChipSet.VT100.NVR.CMD.SHIFT_OUT:
case ChipSet8080.VT100.NVR.CMD.SHIFT_OUT:
this.wNVRData <<= 1;
/*
* Since WORDMASK is 0x3fff, this will mask the shifted data with 0x4000, which is the bit we want to isolate.
*/
this.bNVROut = this.wNVRData & (ChipSet.VT100.NVR.WORDMASK + 1);
this.bNVROut = this.wNVRData & (ChipSet8080.VT100.NVR.WORDMASK + 1);
break;
default:
@ -886,35 +886,35 @@ ChipSet.prototype.doNVRCommand = function()
/**
* inVT100Flags(port, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x42)
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
* @return {number} simulated port value
*/
ChipSet.prototype.inVT100Flags = function(port, addrFrom)
ChipSet8080.prototype.inVT100Flags = function(port, addrFrom)
{
/*
* The NVR_CLK bit is driven by LBA7 (ie, bit 7 from Line Buffer Address generation); see the DC011 discussion above.
*/
var b = this.bFlags;
b &= ~ChipSet.VT100.FLAGS.NVR_CLK;
b &= ~ChipSet8080.VT100.FLAGS.NVR_CLK;
if (this.getVT100LBA(7)) {
b |= ChipSet.VT100.FLAGS.NVR_CLK;
b |= ChipSet8080.VT100.FLAGS.NVR_CLK;
if (b != this.bFlags) {
this.doNVRCommand();
}
}
b &= ~ChipSet.VT100.FLAGS.NVR_DATA;
b &= ~ChipSet8080.VT100.FLAGS.NVR_DATA;
if (this.bNVROut) {
b |= ChipSet.VT100.FLAGS.NVR_DATA;
b |= ChipSet8080.VT100.FLAGS.NVR_DATA;
}
b &= ~ChipSet.VT100.FLAGS.KBD_XMIT;
b &= ~ChipSet8080.VT100.FLAGS.KBD_XMIT;
if (this.kbd && this.kbd.isTransmitterReady()) {
b |= ChipSet.VT100.FLAGS.KBD_XMIT;
b |= ChipSet8080.VT100.FLAGS.KBD_XMIT;
}
b &= ~ChipSet.VT100.FLAGS.UART_XMIT;
b &= ~ChipSet8080.VT100.FLAGS.UART_XMIT;
if (this.serial && this.serial.isTransmitterReady()) {
b |= ChipSet.VT100.FLAGS.UART_XMIT;
b |= ChipSet8080.VT100.FLAGS.UART_XMIT;
}
this.bFlags = b;
this.printMessageIO(port, null, addrFrom, "FLAGS", b);
@ -924,12 +924,12 @@ ChipSet.prototype.inVT100Flags = function(port, addrFrom)
/**
* outVT100Brightness(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x42)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outVT100Brightness = function(port, b, addrFrom)
ChipSet8080.prototype.outVT100Brightness = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "BRIGHTNESS");
this.bBrightness = b;
@ -938,12 +938,12 @@ ChipSet.prototype.outVT100Brightness = function(port, b, addrFrom)
/**
* outVT100NVRLatch(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0x62)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outVT100NVRLatch = function(port, b, addrFrom)
ChipSet8080.prototype.outVT100NVRLatch = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "NVR.LATCH");
this.bNVRLatch = b;
@ -955,12 +955,12 @@ ChipSet.prototype.outVT100NVRLatch = function(port, b, addrFrom)
* TODO: Consider whether we should disable any interrupts (eg, vertical retrace) until
* this port is initialized at runtime.
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0xA2)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outVT100DC012 = function(port, b, addrFrom)
ChipSet8080.prototype.outVT100DC012 = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "DC012");
@ -997,29 +997,29 @@ ChipSet.prototype.outVT100DC012 = function(port, b, addrFrom)
/**
* outVT100DC011(port, b, addrFrom)
*
* @this {ChipSet}
* @this {ChipSet8080}
* @param {number} port (0xC2)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/
ChipSet.prototype.outVT100DC011 = function(port, b, addrFrom)
ChipSet8080.prototype.outVT100DC011 = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "DC011");
if (b & ChipSet.VT100.DC011.RATE60) {
b &= ChipSet.VT100.DC011.RATE50;
if (b & ChipSet8080.VT100.DC011.RATE60) {
b &= ChipSet8080.VT100.DC011.RATE50;
if (this.bDC011Rate != b) {
this.bDC011Rate = b;
if (this.video) {
this.video.updateRate(this.bDC011Rate == ChipSet.VT100.DC011.RATE50? 50 : 60);
this.video.updateRate(this.bDC011Rate == ChipSet8080.VT100.DC011.RATE50? 50 : 60);
}
}
} else {
b &= ChipSet.VT100.DC011.COLS132;
b &= ChipSet8080.VT100.DC011.COLS132;
if (this.bDC011Cols != b) {
this.bDC011Cols = b;
if (this.video) {
var nCols = (this.bDC011Cols == ChipSet.VT100.DC011.COLS132? 132 : 80);
var nRows = (nCols > 80 && (this.bFlags & ChipSet.VT100.FLAGS.NO_AVO)? 14 : 24);
var nCols = (this.bDC011Cols == ChipSet8080.VT100.DC011.COLS132? 132 : 80);
var nRows = (nCols > 80 && (this.bFlags & ChipSet8080.VT100.FLAGS.NO_AVO)? 14 : 24);
this.video.updateDimensions(nCols, nRows);
}
}
@ -1029,47 +1029,47 @@ ChipSet.prototype.outVT100DC011 = function(port, b, addrFrom)
/*
* Port notification tables
*/
ChipSet.SI1978.portsInput = {
0x00: ChipSet.prototype.inSIStatus0,
0x01: ChipSet.prototype.inSIStatus1,
0x02: ChipSet.prototype.inSIStatus2,
0x03: ChipSet.prototype.inSIShiftResult
ChipSet8080.SI1978.portsInput = {
0x00: ChipSet8080.prototype.inSIStatus0,
0x01: ChipSet8080.prototype.inSIStatus1,
0x02: ChipSet8080.prototype.inSIStatus2,
0x03: ChipSet8080.prototype.inSIShiftResult
};
ChipSet.SI1978.portsOutput = {
0x02: ChipSet.prototype.outSIShiftCount,
0x03: ChipSet.prototype.outSISound1,
0x04: ChipSet.prototype.outSIShiftData,
0x05: ChipSet.prototype.outSISound2,
0x06: ChipSet.prototype.outSIWatchdog
ChipSet8080.SI1978.portsOutput = {
0x02: ChipSet8080.prototype.outSIShiftCount,
0x03: ChipSet8080.prototype.outSISound1,
0x04: ChipSet8080.prototype.outSIShiftData,
0x05: ChipSet8080.prototype.outSISound2,
0x06: ChipSet8080.prototype.outSIWatchdog
};
ChipSet.VT100.portsInput = {
0x42: ChipSet.prototype.inVT100Flags
ChipSet8080.VT100.portsInput = {
0x42: ChipSet8080.prototype.inVT100Flags
};
ChipSet.VT100.portsOutput = {
0x42: ChipSet.prototype.outVT100Brightness,
0x62: ChipSet.prototype.outVT100NVRLatch,
0xA2: ChipSet.prototype.outVT100DC012,
0xC2: ChipSet.prototype.outVT100DC011
ChipSet8080.VT100.portsOutput = {
0x42: ChipSet8080.prototype.outVT100Brightness,
0x62: ChipSet8080.prototype.outVT100NVRLatch,
0xA2: ChipSet8080.prototype.outVT100DC012,
0xC2: ChipSet8080.prototype.outVT100DC011
};
/**
* ChipSet.init()
* ChipSet8080.init()
*
* This function operates on every HTML element of class "chipset", extracting the
* JSON-encoded parameters for the ChipSet constructor from the element's "data-value"
* attribute, invoking the constructor to create a ChipSet component, and then binding
* any associated HTML controls to the new component.
*/
ChipSet.init = function()
ChipSet8080.init = function()
{
var aeChipSet = Component.getElementsByClass(document, PC8080.APPCLASS, "chipset");
for (var iChip = 0; iChip < aeChipSet.length; iChip++) {
var eChipSet = aeChipSet[iChip];
var parmsChipSet = Component.getComponentParms(eChipSet);
var chipset = new ChipSet(parmsChipSet);
var chipset = new ChipSet8080(parmsChipSet);
Component.bindComponentControls(chipset, eChipSet, PC8080.APPCLASS);
}
};
@ -1077,6 +1077,6 @@ ChipSet.init = function()
/*
* Initialize every ChipSet module on the page.
*/
web.onInit(ChipSet.init);
web.onInit(ChipSet8080.init);
if (NODE) module.exports = ChipSet;
if (NODE) module.exports = ChipSet8080;