Scaffolding for VT100 ChipSet

This commit is contained in:
Jeff Parsons 2016-08-02 06:50:25 -07:00 • committed by Jeff Parsons
commit 843d24c627
6 changed files with 124 additions and 69 deletions

View file

@ -16,7 +16,8 @@
</control> </control>
</menu> </menu>
</video> </video>
<chipset id="chipset" model="VT100"/>
<keyboard id="keyboard"/> <keyboard id="keyboard"/>
<panel ref="/devices/pc8080/panel/wide.xml"/> <panel ref="/devices/pc8080/panel/wide.xml"/>
<debugger id="debugger" messages="mem|halt" commands="s 8086"/> <debugger id="debugger" messages="port|mem|halt" commands="s 8086"/>
</machine> </machine>

View file

@ -794,8 +794,10 @@ Bus.prototype.addPortInputNotify = function(start, end, fn)
Bus.prototype.addPortInputTable = function(component, table, offset) Bus.prototype.addPortInputTable = function(component, table, offset)
{ {
if (offset === undefined) offset = 0; if (offset === undefined) offset = 0;
for (var port in table) { if (table) {
this.addPortInputNotify(+port + offset, +port + offset, table[port].bind(component)); for (var port in table) {
this.addPortInputNotify(+port + offset, +port + offset, table[port].bind(component));
}
} }
}; };
@ -951,8 +953,10 @@ Bus.prototype.addPortOutputNotify = function(start, end, fn)
Bus.prototype.addPortOutputTable = function(component, table, offset) Bus.prototype.addPortOutputTable = function(component, table, offset)
{ {
if (offset === undefined) offset = 0; if (offset === undefined) offset = 0;
for (var port in table) { if (table) {
this.addPortOutputNotify(+port + offset, +port + offset, table[port].bind(component)); for (var port in table) {
this.addPortOutputNotify(+port + offset, +port + offset, table[port].bind(component));
}
} }
}; };

View file

@ -67,7 +67,8 @@ function ChipSet(parmsChipSet)
Component.notice("Unrecognized ChipSet model: " + model); Component.notice("Unrecognized ChipSet model: " + model);
} }
this.model = ChipSet.MODELS[model] || ChipSet.SI_1978.MODEL; this.config = ChipSet.MODELS[model] || ChipSet.SI1978;
this.model = this.config.MODEL;
this.bSwitches = this.parseDIPSwitches(parmsChipSet['swDIP']); this.bSwitches = this.parseDIPSwitches(parmsChipSet['swDIP']);
@ -104,9 +105,9 @@ function ChipSet(parmsChipSet)
Component.subclass(ChipSet); Component.subclass(ChipSet);
ChipSet.SI_1978 = { ChipSet.SI1978 = {
MODEL: 1978.1, MODEL: 1978.1,
STATUS0: { // NOTE: STATUS0 not used by the SI_1978 ROMs; refer to STATUS1 instead STATUS0: { // NOTE: STATUS0 not used by the SI1978 ROMs; refer to STATUS1 instead
PORT: 0, PORT: 0,
DIP4: 0x01, // self-test request at power up? DIP4: 0x01, // self-test request at power up?
FIRE: 0x10, // 1 = fire FIRE: 0x10, // 1 = fire
@ -165,11 +166,22 @@ ChipSet.SI_1978 = {
} }
}; };
ChipSet.VT100 = {
MODEL: 100.0,
BRIGHTNESS_LATCH: {
PORT: 0x42 // write-only
},
NVR_LATCH: {
PORT: 0x62 // write-only
}
};
/* /*
* Supported model strings * Supported model strings
*/ */
ChipSet.MODELS = { ChipSet.MODELS = {
"SI1978": ChipSet.SI_1978.MODEL "SI1978": ChipSet.SI1978,
"VT100": ChipSet.VT100
}; };
/** /**
@ -227,10 +239,8 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
this.cpu = cpu; this.cpu = cpu;
this.dbg = dbg; this.dbg = dbg;
this.cmp = cmp; this.cmp = cmp;
if (this.model == ChipSet.SI_1978.MODEL) { bus.addPortInputTable(this, this.config.portsInput);
bus.addPortInputTable(this, ChipSet.aPortInput); bus.addPortOutputTable(this, this.config.portsOutput);
bus.addPortOutputTable(this, ChipSet.aPortOutput);
}
}; };
/** /**
@ -266,6 +276,21 @@ ChipSet.prototype.powerDown = function(fSave, fShutdown)
return fSave? this.save() : true; return fSave? this.save() : true;
}; };
ChipSet.SI1978.init = [
[
ChipSet.SI1978.STATUS0.ALWAYS_SET,
ChipSet.SI1978.STATUS1.ALWAYS_SET,
ChipSet.SI1978.STATUS2.ALWAYS_SET,
0, 0, 0, 0
]
];
ChipSet.VT100.init = [
[
0, 0
]
];
/** /**
* reset() * reset()
* *
@ -273,12 +298,9 @@ ChipSet.prototype.powerDown = function(fSave, fShutdown)
*/ */
ChipSet.prototype.reset = function() ChipSet.prototype.reset = function()
{ {
this.bStatus0 = ChipSet.SI_1978.STATUS0.ALWAYS_SET; if (!this.restore(this.config.init)) {
this.bStatus1 = ChipSet.SI_1978.STATUS1.ALWAYS_SET; this.notice("reset error");
this.bStatus2 = ChipSet.SI_1978.STATUS2.ALWAYS_SET; }
this.wShiftData = 0;
this.bShiftCount = 0;
this.bSound1 = this.bSound2 = 0;
}; };
/** /**
@ -292,8 +314,13 @@ ChipSet.prototype.reset = function()
ChipSet.prototype.save = function() ChipSet.prototype.save = function()
{ {
var state = new State(this); var state = new State(this);
if (this.model == ChipSet.SI_1978.MODEL) { switch(this.model) {
case ChipSet.SI1978.MODEL:
state.set(0, [this.bStatus0, this.bStatus1, this.bStatus2, this.wShiftData, this.bShiftCount, this.bSound1, this.bSound2]); state.set(0, [this.bStatus0, this.bStatus1, this.bStatus2, this.wShiftData, this.bShiftCount, this.bSound1, this.bSound2]);
break;
case ChipSet.VT100.MODEL:
state.set(0, [this.bBrightnessLatch, this.bNVRLatch]);
break;
} }
return state.data(); return state.data();
}; };
@ -309,18 +336,25 @@ ChipSet.prototype.save = function()
*/ */
ChipSet.prototype.restore = function(data) ChipSet.prototype.restore = function(data)
{ {
var a, i; var a;
a = data[0]; if (data && (a = data[0]) && a.length) {
if (this.model == ChipSet.SI_1978.MODEL) { switch(this.model) {
this.bStatus0 = a[0]; case ChipSet.SI1978.MODEL:
this.bStatus1 = a[1]; this.bStatus0 = a[0];
this.bStatus2 = a[2]; this.bStatus1 = a[1];
this.wShiftData = a[3]; this.bStatus2 = a[2];
this.bShiftCount = a[4]; this.wShiftData = a[3];
this.bSound1 = a[5]; this.bShiftCount = a[4];
this.bSound2 = a[6]; this.bSound1 = a[5];
this.bSound2 = a[6];
return true;
case ChipSet.VT100.MODEL:
this.bBrightnessLatch = a[0];
this.bNVRLatch = a[1];
return true;
}
} }
return true; return false;
}; };
/** /**
@ -519,20 +553,45 @@ ChipSet.prototype.outSIWatchdog = function(port, b, addrFrom)
this.printMessageIO(port, b, addrFrom, "WATCHDOG", null, true); this.printMessageIO(port, b, addrFrom, "WATCHDOG", null, true);
}; };
/* /**
* Port input notification tables * outVT100BrightnessLatch(port, b, addrFrom)
*
* @this {ChipSet}
* @param {number} port (0x42)
* @param {number} b
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
*/ */
ChipSet.aPortInput = { ChipSet.prototype.outVT100BrightnessLatch = function(port, b, addrFrom)
{
this.printMessageIO(port, b, addrFrom, "BRIGHTNESS.LATCH", null, true);
this.bBrightnessLatch = b;
};
/**
* outVT100BrightnessLatch(port, b, addrFrom)
*
* @this {ChipSet}
* @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)
{
this.printMessageIO(port, b, addrFrom, "NVR.LATCH", null, true);
this.bNVRLatch = b;
};
/*
* Port notification tables
*/
ChipSet.SI1978.portsInput = {
0x00: ChipSet.prototype.inSIStatus0, 0x00: ChipSet.prototype.inSIStatus0,
0x01: ChipSet.prototype.inSIStatus1, 0x01: ChipSet.prototype.inSIStatus1,
0x02: ChipSet.prototype.inSIStatus2, 0x02: ChipSet.prototype.inSIStatus2,
0x03: ChipSet.prototype.inSIShiftResult 0x03: ChipSet.prototype.inSIShiftResult
}; };
/* ChipSet.SI1978.portsOutput = {
* Port output notification tables
*/
ChipSet.aPortOutput = {
0x02: ChipSet.prototype.outSIShiftCount, 0x02: ChipSet.prototype.outSIShiftCount,
0x03: ChipSet.prototype.outSISound1, 0x03: ChipSet.prototype.outSISound1,
0x04: ChipSet.prototype.outSIShiftData, 0x04: ChipSet.prototype.outSIShiftData,
@ -540,6 +599,14 @@ ChipSet.aPortOutput = {
0x06: ChipSet.prototype.outSIWatchdog 0x06: ChipSet.prototype.outSIWatchdog
}; };
ChipSet.VT100.portsInput = {
};
ChipSet.VT100.portsOutput = {
0x42: ChipSet.prototype.outVT100BrightnessLatch,
0x62: ChipSet.prototype.outVT100NVRLatch
};
/** /**
* ChipSet.init() * ChipSet.init()
* *

View file

@ -415,27 +415,27 @@ Keyboard.prototype.onSoftKeyDown = function(sSoftCode, fDown)
if (this.chipset) { if (this.chipset) {
switch(sSoftCode) { switch(sSoftCode) {
case '1p': case '1p':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.P1, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.P1, fDown);
break; break;
case '2p': case '2p':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.P2, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.P2, fDown);
break; break;
case 'coin': case 'coin':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.CREDIT, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.CREDIT, fDown);
break; break;
case 'left': case 'left':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.P1_LEFT, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.P1_LEFT, fDown);
break; break;
case 'right': case 'right':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.P1_RIGHT, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.P1_RIGHT, fDown);
break; break;
case 'fire': case 'fire':
this.chipset.updateStatus1(ChipSet.SI_1978.STATUS1.P1_FIRE, fDown); this.chipset.updateStatus1(ChipSet.SI1978.STATUS1.P1_FIRE, fDown);
break; break;
} }
} }

View file

@ -393,7 +393,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
if (!this.nFormat) { if (!this.nFormat) {
this.chipset = cmp.getMachineComponent("ChipSet"); this.chipset = cmp.getMachineComponent("ChipSet");
if (this.chipset && this.chipset.model == ChipSet.SI_1978.MODEL) { if (this.chipset && this.chipset.model == ChipSet.SI1978.MODEL) {
this.nFormat = Video.FORMAT.SI1978; this.nFormat = Video.FORMAT.SI1978;
} }
} }
@ -595,32 +595,15 @@ Video.prototype.powerUp = function(data, fRepower)
if (DEBUG && this.nFormat == Video.FORMAT.VT100) { if (DEBUG && this.nFormat == Video.FORMAT.VT100) {
/* /*
* Build a test screen in the VT100 frame buffer; we'll mimic the "SET-UP A" screen, since it uses * Build a test screen in the VT100 frame buffer; we'll mimic the "SET-UP A" screen, since it uses
* all the font variations. * all the font variations. The process involves iterating over 0-based row numbers -2 (or -5 if 50Hz
* operation is selected) through 24, checking aLineData for a matching row number, and converting the
* corresponding string(s) to appropriate byte values. Negative row numbers correspond to "fill lines"
* and do not require a row entry. If multiple strings are present for a given row, we invert the
* default character attribute for subsequent strings. An empty array ends the screen build process.
*/ */
var aLineData = { var aLineData = {
0: [Video.VT100.FONT.DHIGH, 'SET-UP A'], 0: [Video.VT100.FONT.DHIGH, 'SET-UP A'],
2: [Video.VT100.FONT.DWIDE, 'TO EXIT PRESS "SET-UP"'], 2: [Video.VT100.FONT.DWIDE, 'TO EXIT PRESS "SET-UP"'],
/*
3: [Video.VT100.FONT.NORML, '4'],
4: [Video.VT100.FONT.NORML, '5'],
5: [Video.VT100.FONT.NORML, '6'],
6: [Video.VT100.FONT.NORML, '7'],
7: [Video.VT100.FONT.NORML, '8'],
8: [Video.VT100.FONT.NORML, '9'],
9: [Video.VT100.FONT.NORML, '10'],
10: [Video.VT100.FONT.NORML, '11'],
11: [Video.VT100.FONT.NORML, '12'],
12: [Video.VT100.FONT.NORML, '13'],
13: [Video.VT100.FONT.NORML, '14'],
14: [Video.VT100.FONT.NORML, '15'],
15: [Video.VT100.FONT.NORML, '16'],
16: [Video.VT100.FONT.NORML, '17'],
17: [Video.VT100.FONT.NORML, '18'],
18: [Video.VT100.FONT.NORML, '19'],
19: [Video.VT100.FONT.NORML, '20'],
20: [Video.VT100.FONT.NORML, '21'],
21: [Video.VT100.FONT.NORML, '22'],
*/
22: [Video.VT100.FONT.NORML, ' T T T T T T T T T'], 22: [Video.VT100.FONT.NORML, ' T T T T T T T T T'],
23: [Video.VT100.FONT.NORML, '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890'], 23: [Video.VT100.FONT.NORML, '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890'],
24: [] 24: []

View file

@ -367,7 +367,7 @@ Component.notice = function(s, fPrintOnly, id)
if (DEBUG) { if (DEBUG) {
Component.println(s, "notice", id); Component.println(s, "notice", id);
} }
if (!fPrintOnly) web.alertUser(s); if (!fPrintOnly) web.alertUser((id? (id + ": ") : "") + s);
}; };
/** /**
@ -724,7 +724,7 @@ Component.prototype = {
* @param {string} [id] * @param {string} [id]
*/ */
this.notice = function noticePanel(s, fPrintOnly, id) { this.notice = function noticePanel(s, fPrintOnly, id) {
this.println(s, "notice", id); this.println(s, this.idComponent);
}; };
} }
return true; return true;
@ -838,7 +838,7 @@ Component.prototype = {
* @param {string} [id] is the caller's ID, if any * @param {string} [id] is the caller's ID, if any
*/ */
notice: function(s, fPrintOnly, id) { notice: function(s, fPrintOnly, id) {
Component.notice(s, fPrintOnly, id || this.id); Component.notice(s, fPrintOnly, id || this.type);
}, },
/** /**
* setError(s) * setError(s)