v1.19.4: I/O bug fixes (16-bit input could trash EAX, and support for true 16-bit/32-bit I/O was lacking)

This commit is contained in:
Jeff Parsons 2015-09-08 21:19:18 -07:00
commit cea314d7e8
30 changed files with 9220 additions and 2210 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -159,6 +159,13 @@ function Bus(parmsBus, cpu, dbg)
this.aPortOutputNotify = [];
this.fPortInputBreakAll = this.fPortOutputBreakAll = false;
/*
* By default, all I/O ports are 1 byte wide; ports that are wider must add themselves to one or both of
* these lists, using addPortInputWidth() and/or addPortOutputWidth().
*/
this.aPortInputWidth = [];
this.aPortOutputWidth = [];
/*
* Allocate empty Memory blocks to span the entire physical address space.
*/
@ -1376,43 +1383,84 @@ Bus.prototype.addPortInputTable = function(component, table, offset)
};
/**
* checkPortInputNotify(port, addrLIP)
* addPortInputWidth(port, size)
*
* By default, all input ports are 1 byte wide; ports that are wider must call this function.
*
* @this {Bus}
* @param {number} port
* @param {number} size (1, 2 or 4)
*/
Bus.prototype.addPortInputWidth = function(port, size)
{
this.aPortInputWidth[port] = size;
};
/**
* checkPortInputNotify(port, size, addrLIP)
*
* @this {Bus}
* @param {number} port
* @param {number} size (1, 2 or 4)
* @param {number} [addrLIP] is the LIP value at the time of the input
* @return {number} simulated port value (0xff if none)
* @return {number} simulated port data
*
* NOTE: It seems that parts of the ROM BIOS (like the RS-232 probes around F000:E5D7 in the 5150 BIOS)
* assume that ports for non-existent hardware return 0xff rather than 0x00, hence my new default (0xff) below.
*/
Bus.prototype.checkPortInputNotify = function(port, addrLIP)
Bus.prototype.checkPortInputNotify = function(port, size, addrLIP)
{
var bIn = 0xff;
var aNotify = this.aPortInputNotify[port];
var data = 0, shift = 0;
if (BACKTRACK) {
this.cpu.backTrack.btiIO = 0;
}
if (aNotify !== undefined) {
if (aNotify[0]) {
var b = aNotify[0]( port, addrLIP);
if (b !== undefined) {
this.assert(!(b & ~0xff));
bIn = b;
while (size > 0) {
var aNotify = this.aPortInputNotify[port];
var sizePort = this.aPortInputWidth[port] || 1;
var maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
var dataPort = maskPort;
/*
* TODO: We need to decide what to do about 8-bit I/O to a 16-bit port
* (ditto for 16-bit I/O to a 32-bit port). We probably should pass the
* size through to the aNotify[0] handler, and let it decide what to do,
* but I don't feel like changing all the I/O handlers right now. The
* good news, at least, is that the 8-bit handlers would not have to do
* anything special. This assert will warn us if this is a pressing need.
*/
this.assert(size >= sizePort);
if (BACKTRACK) {
this.cpu.backTrack.btiIO = 0;
}
if (aNotify !== undefined) {
if (aNotify[0]) {
dataPort = aNotify[0](port, addrLIP);
if (dataPort === undefined) {
dataPort = maskPort;
} else {
dataPort &= maskPort;
}
}
if (DEBUGGER && this.dbg && this.fPortInputBreakAll != aNotify[1]) {
this.dbg.checkPortInput(port, size, dataPort);
}
}
if (DEBUGGER && this.dbg && this.fPortInputBreakAll != aNotify[1]) {
this.dbg.checkPortInput(port, bIn);
else {
if (DEBUGGER && this.dbg) {
this.dbg.messageIO(this, port, null, addrLIP);
if (this.fPortInputBreakAll) this.dbg.checkPortInput(port, size, dataPort);
}
}
data |= dataPort << shift;
shift += (sizePort << 3);
port += sizePort;
size -= sizePort;
}
else {
if (DEBUGGER && this.dbg) {
this.dbg.messageIO(this, port, null, addrLIP);
if (this.fPortInputBreakAll) this.dbg.checkPortInput(port, bIn);
}
}
return bIn;
this.assert(!size);
return data;
};
/**
@ -1497,31 +1545,69 @@ Bus.prototype.addPortOutputTable = function(component, table, offset)
};
/**
* checkPortOutputNotify(port, bOut, addrLIP)
* addPortOutputWidth(port, size)
*
* By default, all output ports are 1 byte wide; ports that are wider must call this function.
*
* @this {Bus}
* @param {number} port
* @param {number} bOut
* @param {number} size (1, 2 or 4)
*/
Bus.prototype.addPortOutputWidth = function(port, size)
{
this.aPortOutputWidth[port] = size;
};
/**
* checkPortOutputNotify(port, size, data, addrLIP)
*
* @this {Bus}
* @param {number} port
* @param {number} size
* @param {number} data
* @param {number} [addrLIP] is the LIP value at the time of the output
*/
Bus.prototype.checkPortOutputNotify = function(port, bOut, addrLIP)
Bus.prototype.checkPortOutputNotify = function(port, size, data, addrLIP)
{
var aNotify = this.aPortOutputNotify[port];
if (aNotify !== undefined) {
if (aNotify[0]) {
this.assert(!(bOut & ~0xff));
aNotify[0](port, bOut, addrLIP);
var shift = 0;
while (size > 0) {
var aNotify = this.aPortOutputNotify[port];
var sizePort = this.aPortOutputWidth[port] || 1;
var maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
var dataPort = (data >>>= shift) & maskPort;
/*
* TODO: We need to decide what to do about 8-bit I/O to a 16-bit port
* (ditto for 16-bit I/O to a 32-bit port). We probably should pass the
* size through to the aNotify[0] handler, and let it decide what to do,
* but I don't feel like changing all the I/O handlers right now. The
* good news, at least, is that the 8-bit handlers would not have to do
* anything special. This assert will warn us if this is a pressing need.
*/
this.assert(size >= sizePort);
if (aNotify !== undefined) {
if (aNotify[0]) {
aNotify[0](port, dataPort, addrLIP);
}
if (DEBUGGER && this.dbg && this.fPortOutputBreakAll != aNotify[1]) {
this.dbg.checkPortOutput(port, size, dataPort);
}
}
if (DEBUGGER && this.dbg && this.fPortOutputBreakAll != aNotify[1]) {
this.dbg.checkPortOutput(port, bOut);
}
}
else {
if (DEBUGGER && this.dbg) {
this.dbg.messageIO(this, port, bOut, addrLIP);
if (this.fPortOutputBreakAll) this.dbg.checkPortOutput(port, bOut);
else {
if (DEBUGGER && this.dbg) {
this.dbg.messageIO(this, port, dataPort, addrLIP);
if (this.fPortOutputBreakAll) this.dbg.checkPortOutput(port, size, dataPort);
}
}
shift += (sizePort << 3);
port += sizePort;
size -= sizePort;
}
this.assert(!size);
};
/**

View file

@ -953,10 +953,10 @@ if (DEBUGGER) {
/* 0xE9 */ [Debugger.INS.JMP, Debugger.TYPE_IMMREL | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
/* 0xEA */ [Debugger.INS.JMP, Debugger.TYPE_IMM | Debugger.TYPE_FARP | Debugger.TYPE_IN],
/* 0xEB */ [Debugger.INS.JMP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
/* 0xEC */ [Debugger.INS.IN, Debugger.TYPE_AL | Debugger.TYPE_OUT, Debugger.TYPE_DX | Debugger.TYPE_IN],
/* 0xED */ [Debugger.INS.IN, Debugger.TYPE_AX | Debugger.TYPE_OUT, Debugger.TYPE_DX | Debugger.TYPE_IN],
/* 0xEE */ [Debugger.INS.OUT, Debugger.TYPE_DX | Debugger.TYPE_IN, Debugger.TYPE_AL | Debugger.TYPE_IN],
/* 0xEF */ [Debugger.INS.OUT, Debugger.TYPE_DX | Debugger.TYPE_IN, Debugger.TYPE_AX | Debugger.TYPE_IN],
/* 0xEC */ [Debugger.INS.IN, Debugger.TYPE_AL | Debugger.TYPE_OUT, Debugger.TYPE_DX | Debugger.TYPE_WORD | Debugger.TYPE_IN],
/* 0xED */ [Debugger.INS.IN, Debugger.TYPE_AX | Debugger.TYPE_OUT, Debugger.TYPE_DX | Debugger.TYPE_WORD | Debugger.TYPE_IN],
/* 0xEE */ [Debugger.INS.OUT, Debugger.TYPE_DX | Debugger.TYPE_WORD | Debugger.TYPE_IN, Debugger.TYPE_AL | Debugger.TYPE_IN],
/* 0xEF */ [Debugger.INS.OUT, Debugger.TYPE_DX | Debugger.TYPE_WORD | Debugger.TYPE_IN, Debugger.TYPE_AX | Debugger.TYPE_IN],
/* 0xF0 */ [Debugger.INS.LOCK, Debugger.TYPE_PREFIX],
/* 0xF1 */ [Debugger.INS.NONE],
@ -3254,7 +3254,7 @@ if (DEBUGGER) {
*/
Debugger.prototype.init = function()
{
this.println("Type ? for list of debugger commands");
this.println("Type ? for help with PCjs Debugger commands");
this.updateStatus();
if (this.sInitCommands) {
var a = this.parseCommand(this.sInitCommands);
@ -3719,41 +3719,43 @@ if (DEBUGGER) {
};
/**
* checkPortInput(port, bIn)
* checkPortInput(port, size, data)
*
* This "check" function is called by the Bus component to inform us that port input occurred.
*
* @this {Debugger}
* @param {number} port
* @param {number} bIn
* @param {number} size
* @param {number} data
* @return {boolean} true if breakpoint hit, false if not
*/
Debugger.prototype.checkPortInput = function(port, bIn)
Debugger.prototype.checkPortInput = function(port, size, data)
{
/*
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally
*/
this.println("break on input from port " + str.toHexWord(port) + ": " + str.toHexByte(bIn));
this.println("break on input from port " + str.toHexWord(port) + ": " + str.toHex(data));
this.stopCPU(true);
return true;
};
/**
* checkPortOutput(port, bOut)
* checkPortOutput(port, size, data)
*
* This "check" function is called by the Bus component to inform us that port output occurred.
*
* @this {Debugger}
* @param {number} port
* @param {number} bOut
* @param {number} size
* @param {number} data
* @return {boolean} true if breakpoint hit, false if not
*/
Debugger.prototype.checkPortOutput = function(port, bOut)
Debugger.prototype.checkPortOutput = function(port, size, data)
{
/*
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally
*/
this.println("break on output to port " + str.toHexWord(port) + ": " + str.toHexByte(bOut));
this.println("break on output to port " + str.toHexWord(port) + ": " + str.toHex(data));
this.stopCPU(true);
return true;
};
@ -5940,6 +5942,8 @@ if (DEBUGGER) {
/**
* doInput(sPort)
*
* Simulate a 1-byte port input operation.
*
* @this {Debugger}
* @param {string|undefined} sPort
*/
@ -5961,7 +5965,7 @@ if (DEBUGGER) {
}
var port = this.parseValue(sPort);
if (port !== undefined) {
var bIn = this.bus.checkPortInputNotify(port);
var bIn = this.bus.checkPortInputNotify(port, 1);
this.println(str.toHexWord(port) + ": " + str.toHexByte(bIn));
}
};
@ -6341,6 +6345,8 @@ if (DEBUGGER) {
/**
* doOutput(sPort, sByte)
*
* Simulate a 1-byte port output operation.
*
* @this {Debugger}
* @param {string|undefined} sPort
* @param {string|undefined} sByte (string representation of 1 byte)
@ -6364,33 +6370,11 @@ if (DEBUGGER) {
var port = this.parseValue(sPort, "port #");
var bOut = this.parseValue(sByte);
if (port !== undefined && bOut !== undefined) {
this.bus.checkPortOutputNotify(port, bOut);
this.bus.checkPortOutputNotify(port, 1, bOut);
this.println(str.toHexWord(port) + ": " + str.toHexByte(bOut));
}
};
/**
* shiftArgs(asArgs)
*
* @this {Debugger}
* @param {Array.<string>} [asArgs]
*/
Debugger.prototype.shiftArgs = function(asArgs)
{
if (asArgs && asArgs.length) {
var s0 = asArgs[0];
var ch0 = s0.charAt(0);
for (var i = 1; i < s0.length; i++) {
var ch = s0.charAt(i);
if (ch0 == '?' || ch0 == 'r' || ch < 'a' || ch > 'z') {
asArgs[0] = s0.substr(i);
asArgs.unshift(s0.substr(0, i));
break;
}
}
}
};
/**
* doRegisters(asArgs, fInstruction)
*
@ -7122,6 +7106,31 @@ if (DEBUGGER) {
return a;
};
/**
* shiftArgs(asArgs)
*
* This is used with commands (eg, "b") that have suffixed variations (eg, "bp", "br", "bw");
* we extract the suffix from the command and insert it into the argument array as a separate element.
*
* @this {Debugger}
* @param {Array.<string>} [asArgs]
*/
Debugger.prototype.shiftArgs = function(asArgs)
{
if (asArgs && asArgs.length) {
var s0 = asArgs[0];
var ch0 = s0.charAt(0);
for (var i = 1; i < s0.length; i++) {
var ch = s0.charAt(i);
if (ch0 == '?' || ch0 == 'r' || ch < 'a' || ch > 'z') {
asArgs[0] = s0.substr(i);
asArgs.unshift(s0.substr(0, i));
break;
}
}
}
};
/**
* doCommand(sCmd, fQuiet)
*
@ -7155,6 +7164,9 @@ if (DEBUGGER) {
var ch = sCmd.charAt(0);
if (ch == '"' || ch == "'") return true;
/*
* Zap the previous message buffer to ensure the new command's output is not tossed out as a repeat.
*/
this.sMessagePrev = null;
/*

View file

@ -1726,7 +1726,7 @@ FDC.prototype.outFDCData = function(port, bOut, addrFrom)
}
if (DEBUG && this.messageEnabled()) {
this.printMessage("unsupported FDC command: " + str.toHexByte(bCmd));
this.dbg.stopCPU();
if (MAXDEBUG) this.dbg.stopCPU();
}
};
@ -1954,8 +1954,8 @@ FDC.prototype.doCmd = function()
default:
if (DEBUG && this.messageEnabled()) {
this.printMessage("FDC operation unsupported (command=" + str.toHexByte(bCmd) + ")");
this.dbg.stopCPU();
this.printMessage("unsupported FDC operation: " + str.toHexByte(bCmd));
if (MAXDEBUG) this.dbg.stopCPU();
}
break;
}

View file

@ -513,6 +513,11 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg)
bus.addPortInputTable(this, this.fATC? HDC.aATCPortInput : HDC.aXTCPortInput);
bus.addPortOutputTable(this, this.fATC? HDC.aATCPortOutput : HDC.aXTCPortOutput);
if (this.fATC) {
bus.addPortInputWidth(HDC.ATC.DATA.PORT, 2);
bus.addPortOutputWidth(HDC.ATC.DATA.PORT, 2);
}
cpu.addIntNotify(Interrupts.DISK, this.intBIOSDisk.bind(this));
cpu.addIntNotify(Interrupts.ALT_DISK, this.intBIOSDiskette.bind(this));
@ -1371,14 +1376,14 @@ HDC.prototype.outXTCNoise = function(port, bOut, addrFrom)
};
/**
* inATCData(port, addrFrom)
* inATCByte(port, addrFrom)
*
* @this {HDC}
* @param {number} port (0x1F0)
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
* @return {number} simulated port value
*/
HDC.prototype.inATCData = function(port, addrFrom)
HDC.prototype.inATCByte = function(port, addrFrom)
{
var bIn = -1;
@ -1429,7 +1434,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
this.regSecCnt = (this.regSecCnt - 1) & 0xff;
/*
* TODO: If the WITH_ECC bit is set in the READ_DATA command, then we need to support "stuffing" 4
* additional bytes into the inATCData() stream. And we must first set DATA_REQ in the STATUS register.
* additional bytes into the inATCByte() stream. And we must first set DATA_REQ in the STATUS register.
*/
if (this.drive.nBytes >= this.drive.cbSector) {
/*
@ -1454,7 +1459,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
*/
hdc.regStatus = HDC.ATC.STATUS.ERROR;
hdc.regError = HDC.ATC.ERROR.NO_CHS;
if (DEBUG) hdc.printMessage("HDC.inATCData(): read failed");
if (DEBUG) hdc.printMessage("HDC.inATCByte(): read failed");
}
}, false);
} else {
@ -1468,14 +1473,29 @@ HDC.prototype.inATCData = function(port, addrFrom)
};
/**
* outATCData(port, bOut, addrFrom)
* inATCData(port, addrFrom)
*
* Wrapper around inATCByte() to treat this as a 16-bit port; see addPortInputWidth(HDC.ATC.DATA.PORT, 2).
*
* @this {HDC}
* @param {number} port (0x1F0)
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
* @return {number} simulated port data
*/
HDC.prototype.inATCData = function(port, addrFrom)
{
return this.inATCByte(port, addrFrom) | (this.inATCByte(port, addrFrom) << 8);
};
/**
* outATCByte(port, bOut, addrFrom)
*
* @this {HDC}
* @param {number} port (0x1F0)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
HDC.prototype.outATCData = function(port, bOut, addrFrom)
HDC.prototype.outATCByte = function(port, bOut, addrFrom)
{
if (this.drive) {
if (this.drive.nBytes >= this.drive.cbSector) {
@ -1487,7 +1507,7 @@ HDC.prototype.outATCData = function(port, bOut, addrFrom)
this.regStatus = HDC.ATC.STATUS.ERROR;
this.regError = HDC.ATC.ERROR.NO_CHS;
if (DEBUG && this.messageEnabled()) {
this.printMessage("HDC.outATCData(" + str.toHexByte(bOut) + "): write failed");
this.printMessage("HDC.outATCByte(" + str.toHexByte(bOut) + "): write failed");
}
}
else if (this.drive.ibSector == 1 || this.drive.ibSector == this.drive.cbSector) {
@ -1519,7 +1539,7 @@ HDC.prototype.outATCData = function(port, bOut, addrFrom)
* TODO: What to do about unexpected writes? The number of bytes has exceeded what the command specified.
*/
if (DEBUG && this.messageEnabled()) {
this.printMessage("HDC.outATCData(" + str.toHexByte(bOut) + "): write exceeds count (" + this.drive.nBytes + ")");
this.printMessage("HDC.outATCByte(" + str.toHexByte(bOut) + "): write exceeds count (" + this.drive.nBytes + ")");
}
}
} else {
@ -1527,11 +1547,27 @@ HDC.prototype.outATCData = function(port, bOut, addrFrom)
* TODO: What to do about unexpected writes? No command was specified.
*/
if (DEBUG && this.messageEnabled()) {
this.printMessage("HDC.outATCData(" + str.toHexByte(bOut) + "): write without command");
this.printMessage("HDC.outATCByte(" + str.toHexByte(bOut) + "): write without command");
}
}
};
/**
* outATCData(port, data, addrFrom)
*
* Wrapper around outATCByte() to treat this as a 16-bit port; see addPortOutputWidth(HDC.ATC.DATA.PORT, 2)
*
* @this {HDC}
* @param {number} port (0x1F0)
* @param {number} data
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
HDC.prototype.outATCData = function(port, data, addrFrom)
{
this.outATCByte(port, data & 0xff, addrFrom);
this.outATCByte(port, (data >> 8) & 0xff, addrFrom);
};
/**
* inATCError(port, addrFrom)
*
@ -1839,7 +1875,7 @@ HDC.prototype.doATC = function()
bCmd = (bCmd >= HDC.ATC.COMMAND.DIAGNOSE? bCmd : (bCmd & HDC.ATC.COMMAND.MASK));
/*
* Since the ATC doesn't use DMA, we must now set some additional Drive state for the benefit of any
* follow-up I/O instructions. For example, any subsequent inATCData() and outATCData() calls need to
* follow-up I/O instructions. For example, any subsequent inATCByte() and outATCByte() calls need to
* know which drive to talk to ("this.drive"), to issue their own readData() and writeData() calls.
*
* The XTC didn't need this, because it used doDMARead(), doDMAWrite(), doDMAFormat() helper functions,
@ -1873,14 +1909,14 @@ HDC.prototype.doATC = function()
/*
* We're using a call to readData() that disables auto-increment, so that once we've got the first
* byte of the next sector, we can signal an interrupt without also consuming the first byte, allowing
* inATCData() to begin with that byte.
* inATCByte() to begin with that byte.
*/
hdc.regStatus = HDC.ATC.STATUS.BUSY;
this.readData(drive, function onATCReadDataFirst(b, fAsync) {
if (b >= 0 && hdc.chipset) {
hdc.setATCIRR();
/*
* Bytes from the requested sector(s) will now be delivered via inATCData().
* Bytes from the requested sector(s) will now be delivered via inATCByte().
*
* FYI, I'm taking a shotgun approach to these status bits: I need to clear STATUS.BUSY and
* set STATUS.DATA_REQ, because otherwise CompaqDeskPro386 reads will fail, and I need to set
@ -1952,7 +1988,7 @@ HDC.prototype.doATC = function()
default:
if (DEBUG && this.messageEnabled()) {
this.printMessage("HDC.doATC(" + str.toHexByte(this.regCommand) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
if (bCmd >= 0) this.dbg.stopCPU();
if (MAXDEBUG && bCmd >= 0) this.dbg.stopCPU();
}
break;
}
@ -2155,7 +2191,7 @@ HDC.prototype.doXTC = function()
this.beginResult(HDC.XTC.DATA.STATUS.ERROR | bDrive);
if (DEBUG && this.messageEnabled()) {
this.printMessage("HDC.doXTC(" + str.toHexByte(bCmdOrig) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
if (bCmd >= 0) this.dbg.stopCPU();
if (MAXDEBUG && bCmd >= 0) this.dbg.stopCPU();
}
break;
}

View file

@ -3022,14 +3022,15 @@ X86CPU.prototype.setPS = function(regPS, cpl)
};
/**
* checkIOPM(port, nPorts)
* checkIOPM(port, nPorts, fInput)
*
* @this {X86CPU}
* @param {number} port (0x0000 to 0xffff)
* @param {number} nPorts (1 to 4)
* @param {boolean} [fInput] (true if input, false if output; output assumed if not specified)
* @return {boolean} true if allowed, false if not
*/
X86CPU.prototype.checkIOPM = function(port, nPorts)
X86CPU.prototype.checkIOPM = function(port, nPorts, fInput)
{
var bitsPorts = 0;
if (I386 && (this.regCR0 & X86.CR0.MSW.PE) && (this.nCPL > this.nIOPL || (this.regPS & X86.PS.VM)) && this.segTSS.addrIOPM) {
@ -3044,7 +3045,7 @@ X86CPU.prototype.checkIOPM = function(port, nPorts)
}
}
if (bitsPorts) {
if (this.messageEnabled(Messages.PORT)) this.printMessage("checkIOPM(" + str.toHexWord(port) + "," + nPorts + "): trapped", true, true);
if (this.messageEnabled(Messages.PORT)) this.printMessage("checkIOPM(" + str.toHexWord(port) + "," + nPorts + "," + (fInput? "input" : "output") + "): trapped", true, true);
X86.fnFault.call(this, X86.EXCEPTION.GP_FAULT, 0, false);
return false;
}

View file

@ -1510,8 +1510,8 @@ X86.opINSb = function INSb()
if (nReps--) {
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
var b = this.bus.checkPortInputNotify(port, this.regLIP - nDelta - 1);
if (!this.checkIOPM(port, 1, true)) return;
var b = this.bus.checkPortInputNotify(port, 1, this.regLIP - nDelta - 1);
this.setSOByte(this.segES, this.regEDI & maskAddr, b);
if (this.opFlags & X86.OPFLAG.FAULT) return;
if (BACKTRACK) this.backTrack.btiMem0 = this.backTrack.btiIO;
@ -1559,20 +1559,12 @@ X86.opINSw = function INSw()
if (this.opPrefixes & X86.OPFLAG.REPEAT) nCycles = 4;
}
if (nReps--) {
var addrFrom = this.regLIP - nDelta - 1;
var w = 0, shift = 0;
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
for (var n = 0; n < this.sizeData; n++) {
w |= this.bus.checkPortInputNotify(port, addrFrom) << shift;
shift += 8;
if (BACKTRACK) {
if (!n) {
this.backTrack.btiMem0 = this.backTrack.btiIO;
} else if (n == 1) {
this.backTrack.btiMem1 = this.backTrack.btiIO;
}
}
if (!this.checkIOPM(port, this.sizeData, true)) return;
var w = this.bus.checkPortInputNotify(port, this.sizeData, this.regLIP - nDelta - 1);
if (BACKTRACK) {
this.backTrack.btiMem0 = this.backTrack.btiIO;
this.backTrack.btiMem1 = this.backTrack.btiIO;
}
this.setSOWord(this.segES, this.regEDI & maskAddr, w);
if (this.opFlags & X86.OPFLAG.FAULT) return;
@ -1620,11 +1612,11 @@ X86.opOUTSb = function OUTSb()
}
if (nReps--) {
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
if (!this.checkIOPM(port, 1, false)) return;
var b = this.getSOByte(this.segDS, this.regESI & maskAddr);
if (this.opFlags & X86.OPFLAG.FAULT) return;
if (BACKTRACK) this.backTrack.btiIO = this.backTrack.btiMem0;
this.bus.checkPortOutputNotify(port, b, this.regLIP - nDelta - 1);
this.bus.checkPortOutputNotify(port, 1, b, this.regLIP - nDelta - 1);
this.regESI = (this.regESI & ~maskAddr) | ((this.regESI + ((this.regPS & X86.PS.DF)? -1 : 1)) & maskAddr);
this.regECX = (this.regECX & ~maskAddr) | ((this.regECX - nDelta) & maskAddr);
this.nStepCycles -= nCycles;
@ -1670,20 +1662,13 @@ X86.opOUTSw = function OUTSw()
if (nReps--) {
var w = this.getSOWord(this.segDS, this.regESI & maskAddr);
if (this.opFlags & X86.OPFLAG.FAULT) return;
var addrFrom = this.regLIP - nDelta - 1, shift = 0;
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
for (var n = 0; n < this.sizeData; n++) {
if (BACKTRACK) {
if (!n) {
this.backTrack.btiIO = this.backTrack.btiMem0;
} else if (n == 1) {
this.backTrack.btiIO = this.backTrack.btiMem1;
}
}
this.bus.checkPortOutputNotify(port, (w >> shift) & 0xff, addrFrom);
shift += 8;
if (!this.checkIOPM(port, this.sizeData, false)) return;
if (BACKTRACK) {
this.backTrack.btiIO = this.backTrack.btiMem0;
this.backTrack.btiIO = this.backTrack.btiMem1;
}
this.bus.checkPortOutputNotify(port, this.sizeData, w, this.regLIP - nDelta - 1);
this.regESI = (this.regESI & ~maskAddr) | ((this.regESI + ((this.regPS & X86.PS.DF)? -this.sizeData : this.sizeData)) & maskAddr);
this.regECX = (this.regECX & ~maskAddr) | ((this.regECX - nDelta) & maskAddr);
this.nStepCycles -= nCycles;
@ -3771,8 +3756,8 @@ X86.opJCXZ = function JCXZ()
X86.opINb = function INb()
{
var port = this.getIPByte();
if (!this.checkIOPM(port, 1)) return;
this.regEAX = (this.regEAX & ~0xff) | this.bus.checkPortInputNotify(port, this.regLIP - 2);
if (!this.checkIOPM(port, 1, true)) return;
this.regEAX = (this.regEAX & ~0xff) | (this.bus.checkPortInputNotify(port, 1, this.regLIP - 2) & 0xff);
if (BACKTRACK) this.backTrack.btiAL = this.backTrack.btiIO;
this.nStepCycles -= this.cycleCounts.nOpCyclesInP;
};
@ -3785,16 +3770,12 @@ X86.opINb = function INb()
X86.opINw = function INw()
{
var port = this.getIPByte();
if (!this.checkIOPM(port, 2)) return;
this.regEAX = this.bus.checkPortInputNotify(port, this.regLIP - 2);
if (BACKTRACK) this.backTrack.btiAL = this.backTrack.btiIO;
/*
* TODO: Specs are clear that bits 8-15 of the port address for the FIRST byte of I/O will be zero, but
* what about the SECOND byte? If the port is 0xff, will the SECOND byte of I/O use port 0x00 or 0x100?
* Our code (below) assumes the latter. Mask (port + 1) with 0xff if it turns out the former is true.
*/
this.regEAX |= (this.bus.checkPortInputNotify(port + 1, this.regLIP - 2) << 8);
if (BACKTRACK) this.backTrack.btiAH = this.backTrack.btiIO;
if (!this.checkIOPM(port, this.sizeData, true)) return;
this.regEAX = (this.regEAX & ~this.maskData) | (this.bus.checkPortInputNotify(port, this.sizeData, this.regLIP - 2) & this.maskData);
if (BACKTRACK) {
this.backTrack.btiAL = this.backTrack.btiIO;
this.backTrack.btiAH = this.backTrack.btiIO;
}
this.nStepCycles -= this.cycleCounts.nOpCyclesInP;
};
@ -3806,8 +3787,8 @@ X86.opINw = function INw()
X86.opOUTb = function OUTb()
{
var port = this.getIPByte();
if (!this.checkIOPM(port, 1)) return;
this.bus.checkPortOutputNotify(port, this.regEAX & 0xff, this.regLIP - 2);
if (!this.checkIOPM(port, 1, false)) return;
this.bus.checkPortOutputNotify(port, 1, this.regEAX & 0xff, this.regLIP - 2);
this.nStepCycles -= this.cycleCounts.nOpCyclesOutP;
};
@ -3819,14 +3800,8 @@ X86.opOUTb = function OUTb()
X86.opOUTw = function OUTw()
{
var port = this.getIPByte();
if (!this.checkIOPM(port, 2)) return;
this.bus.checkPortOutputNotify(port, this.regEAX & 0xff, this.regLIP - 2);
/*
* TODO: Specs are clear that bits 8-15 of the port address for the FIRST byte of I/O will be zero, but
* what about the SECOND byte? If the port is 0xff, will the SECOND byte of I/O use port 0x00 or 0x100?
* Our code (below) assumes the latter. Mask (port + 1) with 0xff if it turns out the former is true.
*/
this.bus.checkPortOutputNotify(port + 1, (this.regEAX >> 8) & 0xff, this.regLIP - 2);
if (!this.checkIOPM(port, this.sizeData, false)) return;
this.bus.checkPortOutputNotify(port, this.sizeData, this.regEAX & this.maskData, this.regLIP - 2);
this.nStepCycles -= this.cycleCounts.nOpCyclesOutP;
};
@ -3891,8 +3866,8 @@ X86.opJMPs = function JMPs()
X86.opINDXb = function INDXb()
{
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
this.regEAX = (this.regEAX & ~0xff) | this.bus.checkPortInputNotify(port, this.regLIP - 1);
if (!this.checkIOPM(port, 1, true)) return;
this.regEAX = (this.regEAX & ~0xff) | (this.bus.checkPortInputNotify(port, 1, this.regLIP - 1) & 0xff);
if (BACKTRACK) this.backTrack.btiAL = this.backTrack.btiIO;
this.nStepCycles -= this.cycleCounts.nOpCyclesInDX;
};
@ -3905,11 +3880,12 @@ X86.opINDXb = function INDXb()
X86.opINDXw = function INDXw()
{
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 2)) return;
this.regEAX = this.bus.checkPortInputNotify(port, this.regLIP - 1);
if (BACKTRACK) this.backTrack.btiAL = this.backTrack.btiIO;
this.regEAX |= (this.bus.checkPortInputNotify((port + 1) & 0xffff, this.regLIP - 1) << 8);
if (BACKTRACK) this.backTrack.btiAH = this.backTrack.btiIO;
if (!this.checkIOPM(port, this.sizeData, true)) return;
this.regEAX = (this.regEAX & ~this.maskData) | (this.bus.checkPortInputNotify(port, this.sizeData, this.regLIP - 1) & this.maskData);
if (BACKTRACK) {
this.backTrack.btiAL = this.backTrack.btiIO;
this.backTrack.btiAH = this.backTrack.btiIO;
}
this.nStepCycles -= this.cycleCounts.nOpCyclesInDX;
};
@ -3921,9 +3897,9 @@ X86.opINDXw = function INDXw()
X86.opOUTDXb = function OUTDXb()
{
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 1)) return;
if (!this.checkIOPM(port, 1, false)) return;
if (BACKTRACK) this.backTrack.btiIO = this.backTrack.btiAL;
this.bus.checkPortOutputNotify(port, this.regEAX & 0xff, this.regLIP - 1);
this.bus.checkPortOutputNotify(port, 1, this.regEAX & 0xff, this.regLIP - 1);
this.nStepCycles -= this.cycleCounts.nOpCyclesOutDX;
};
@ -3935,11 +3911,12 @@ X86.opOUTDXb = function OUTDXb()
X86.opOUTDXw = function OUTDXw()
{
var port = this.regEDX & 0xffff;
if (!this.checkIOPM(port, 2)) return;
if (BACKTRACK) this.backTrack.btiIO = this.backTrack.btiAL;
this.bus.checkPortOutputNotify(port, this.regEAX & 0xff, this.regLIP - 1);
if (BACKTRACK) this.backTrack.btiIO = this.backTrack.btiAH;
this.bus.checkPortOutputNotify((port + 1) & 0xffff, (this.regEAX >> 8) & 0xff, this.regLIP - 1);
if (!this.checkIOPM(port, 2, false)) return;
if (BACKTRACK) {
this.backTrack.btiIO = this.backTrack.btiAL;
this.backTrack.btiIO = this.backTrack.btiAH;
}
this.bus.checkPortOutputNotify(port, this.sizeData, this.regEAX & this.maskData, this.regLIP - 1);
this.nStepCycles -= this.cycleCounts.nOpCyclesOutDX;
};

View file

@ -0,0 +1,165 @@
(function(){var f;function n(a,b){var c="";void 0===b?b=8:8<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function p(a){return"0x"+n(a,2)}function q(a){return"0x"+n(a,4)}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}var ba={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};
function ca(a){return a.replace(/[&<>"']/g,function(a){return ba[a]})}var t=Date.now||function(){return+new Date};
function u(a,b,c){var d;d=!0;var e=0,g=null,h=aa(a),k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(k.onreadystatechange=function(){4===k.readyState&&(g=k.responseText,200==k.status||!k.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),c&&(b?c.call(b,h,g,e,void 0):c(h,g,e,void 0)))});k.open("GET",a,d);k.send();d||(g=k.responseText,200!=k.status&&(e=k.status||-1),c&&(b?c.call(b,h,g,e,void 0):c(h,g,e,void 0)))}
function v(a){window&&window.alert(a)}function w(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function da(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function ea(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,g=!1;a.onmousedown=function(){g||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);g=!0}}var x={init:[],show:[],exit:[]},fa=!1,ga=!0;function ha(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function y(a){x.init.push(a)}
function ia(a){if(ga)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){v("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function z(a){!ga&&a?(ga=!0,fa&&ja("init")):ga=a}function ja(a){x[a]&&ia(x[a])}ha("onload",function(){fa=!0;ia(x.init)});ha("onpageshow",function(){ia(x.show)});ha(w("Opera")||w("iOS")?"onunload":"onbeforeunload",function(){ia(x.exit)});
function A(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.sb=this.id.substr(0,b),this.rb=this.id.substr(b+1)):this.rb=this.id;this[a]=c;this.C={$a:!1,Ca:!1,kb:!1,M:!1,Da:!1};this.eb=null;this.C.Da=!1;this.H={};this.u=null;this.ma=d||0;B[B.length]=this}var ka=void 0;
if(window){ka||(ka=window.location.search.substr(1));for(var la,ma=/\+/g,na=/([^&=]+)=?([^&]*)/g;la=na.exec(ka);)la[1].replace(ma," "),la[2].replace(ma," ")}function oa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}function C(a){var b;b||(b=A);a.prototype=oa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var B=[];
function pa(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<B.length;c++)if(B[c].id===a)return B[c]}return null}function D(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("({"+a+"})")}catch(c){v(c.message+" ("+a+")")}return b}window&&!window.document.ELEMENT_NODE&&(window.document.ELEMENT_NODE=1);
function E(a,b){for(var c=F(b.parentNode,"c1pjs-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,g=0;g<e.length;g++){var h=e[g];if(h.nodeType===window.document.ELEMENT_NODE){var k=h.getAttribute("class");if(k)for(var l=k.split(" "),m=0;m<l.length;m++)switch(k=l[m],k){case "c1pjs-binding":(k=D(h))&&k.binding&&a.T(k.type,k.binding,h),m=l.length}}}}
function F(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
A.prototype={constructor:A,parent:null,toString:function(){return this.name?this.name:this.id||this.type},T:function(a,b,c){switch(b){case "clear":return this.H[b]||(this.H[b]=c,c.onclick=function(a){return function(){a.H.print&&(a.H.print.value="")}}(this)),!0;case "print":return this.H[b]||(this.hb=this.H[b]=c,c.value="",this.l=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.ab=function(a,b,c){this.l(a,"notice",c)}),!0;default:return!1}},log:function(){},l:function(){},status:function(a){this.l(this.rb+": "+a)},ab:function(a,b){b||v(a)},X:function(a){this.C.Da||(this.C.$a=!1!==a,this.C.$a&&(a=this.eb,this.eb=null,a&&a()))}};function G(a,b){if(a.u){a===a.u?b|=0:b=b||a.ma;var c=a.u.ma&b;return!!b&&c===b||!!(c&a.u.Se)}return!1}function H(a,b){if(a.C.kb)return a.C.Ca&&(a.C.Ca=!1),a.C.kb=!1;if(a.C.Da)return a.l(a.toString()+" error"),!1;a.C.Ca=b;return a.C.Ca}
function J(a,b){a.C.Ca&&(b?a.C.kb=!0:void 0===b&&a.l(a.toString()+" busy"));return a.C.Ca}function K(a,b){b&&(a.C.$a?b():a.eb=b);return a.C.$a}function qa(a,b){a.C.Da=!0;a.ab(b)}function ra(a){A.call(this,"C1PPanel",a);this.C.M=!1}C(ra);ra.prototype.T=function(a,b,c){return this.J&&this.J.T(a,b,c)||this.s&&this.s.T(a,b,c)||this.b&&this.b.T(a,b,c)||this.u&&this.u.T(a,b,c)?!0:A.prototype.T.call(this,a,b,c)};
ra.prototype.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.J=b,this.s=L(b,"cpu"),this.b=L(b,"keyboard"),this.u=L(b,"debugger"),sa())};function sa(){for(var a=!1,b=F(window.document,"c1pjs","panel"),c=0;c<b.length;c++){var d=b[c],e=D(d),g=pa(e.id);g||(a=!0,g=new ra(e));E(g,d);a&&g.X()}}y(sa);
function ta(a){A.call(this,"C1PCPU",a);ua(this);this.C.M=!1;this.C.na=!1;this.Ua=a.autoStart;this.Sa=0;this.Pb=1;this.fb=2;this.speed=this.Sa;this.Ka=30;this.Ja=5;this.Na=8;this.Ta=["Slow","Fast","Max"];this.jb=["(1Mhz)","(up to "+this.Na+"Mhz)","(unlimited)"];this.P=[];this.K=[];this.pa=65536;this.qa=0;this.da=65536;this.ja=0;this.Ra=32;this.cb=2;this.Ob=1;this.o=[this.zc,this.Td,this.Ke,this.m,this.m,this.Vd,this.pc,this.m,this.Yd,this.Sd,this.oc,this.m,this.m,this.Pd,this.mc,this.m,this.yc,this.Ud,
this.m,this.m,this.m,this.Wd,this.qc,this.m,this.Cc,this.Rd,this.m,this.m,this.m,this.Qd,this.nc,this.m,this.qd,this.ic,this.m,this.m,this.vc,this.kc,this.de,this.m,this.$d,this.hc,this.ce,this.m,this.uc,this.ec,this.ae,this.m,this.wc,this.jc,this.m,this.m,this.m,this.lc,this.ee,this.m,this.ue,this.gc,this.m,this.m,this.m,this.fc,this.be,this.m,this.ke,this.dd,this.m,this.m,this.m,this.fd,this.Md,this.m,this.Xd,this.cd,this.Ld,this.m,this.pd,this.$c,this.Jd,this.m,this.Ac,this.ed,this.m,this.m,this.m,
this.gd,this.Nd,this.m,this.Ec,this.bd,this.m,this.m,this.m,this.ad,this.Kd,this.m,this.le,this.zb,this.m,this.m,this.m,this.Bb,this.ie,this.m,this.Zd,this.yb,this.he,this.m,this.od,this.vb,this.fe,this.m,this.Bc,this.Ab,this.m,this.m,this.m,this.Cb,this.je,this.m,this.we,this.xb,this.m,this.m,this.m,this.wb,this.ge,this.m,this.m,this.Ae,this.m,this.m,this.Ie,this.Ce,this.Fe,this.m,this.Zc,this.m,this.Oe,this.m,this.He,this.xe,this.Ee,this.m,this.rc,this.Be,this.m,this.m,this.Je,this.De,this.Ge,this.m,
this.Qe,this.ze,this.Pe,this.m,this.m,this.ye,this.m,this.m,this.Gd,this.vd,this.Bd,this.m,this.Hd,this.xd,this.Cd,this.m,this.Me,this.ud,this.Le,this.m,this.Ed,this.rd,this.zd,this.m,this.sc,this.wd,this.m,this.m,this.Id,this.yd,this.Dd,this.m,this.Fc,this.td,this.Ne,this.m,this.Fd,this.sd,this.Ad,this.m,this.Sc,this.Kc,this.m,this.m,this.Tc,this.Mc,this.Wc,this.m,this.nd,this.Jc,this.Yc,this.m,this.Rc,this.Gc,this.Uc,this.m,this.xc,this.Lc,this.m,this.m,this.m,this.Nc,this.Xc,this.m,this.Dc,this.Ic,
this.m,this.m,this.m,this.Hc,this.Vc,this.m,this.Pc,this.Hb,this.m,this.m,this.Qc,this.Jb,this.kd,this.m,this.md,this.Gb,this.Od,this.m,this.Oc,this.Db,this.hd,this.m,this.tc,this.Ib,this.m,this.m,this.m,this.Kb,this.ld,this.m,this.ve,this.Fb,this.m,this.m,this.m,this.Eb,this.jd,this.m];this.gb=[7,6,0,0,0,3,5,0,3,2,2,0,0,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,3,6,0,0,3,3,5,0,4,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,3,2,2,0,3,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,
5,0,4,2,2,0,5,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,0,6,0,0,3,3,3,0,2,0,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,0,4,0,0,2,6,2,0,3,3,3,0,2,2,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,4,4,4,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0]}C(ta);f=ta.prototype;
f.reset=function(a){this.C.na&&this.aa();ua(this);this.f=this.a[65532]|this.a[65533]<<8;this.C.Da=!1;this.u?this.u.reset():a&&(!0===this.Ua||null===this.Ua&&!this.u&&void 0===this.H.run)&&this.wa()};
f.T=function(a,b,c){a=!1;switch(b){case "run":this.H[b]=c;c.onclick=function(a){return function(){a.C.na?a.aa():a.wa()}}(this);a=!0;break;case "A":case "X":case "Y":case "S":case "PC":case "C":case "Z":case "I":case "D":case "B":case "V":case "N":case "speed":this.H[b]=c;a=!0;break;case "setSpeed":this.H[b]=c,c.onclick=function(a){return function(){M(a,2<=a.speed?a.Sa:a.speed+1,!0)}}(this),a=!0}return a};
f.ba=function(a,b,c){this.a=a;this.O=b;this.ra=c-b+1;this.Ha=this.O+this.ra;this.O?v("unsupported CPU address buffer offset ("+this.O+")"):this.X()};f.ia=function(a,b){if(a&&!this.C.M){this.J=b;(this.u=L(b,"debugger"))&&this.u.Ub();var c=L(b,"video");c&&(this.ib=function(a){return function(){va(a)}}(c),this.ca=function(a){return function(){a.ca()}}(c));this.C.M=!0;this.reset(!0);this.update()}};function wa(a,b,c,d,e){0>xa(a.P,b,c,d,e)&&(a.pa>b&&(a.pa=b),a.qa<c&&(a.qa=c),a.P.push([b,c,d,e]))}
function ya(a,b,c){for(var d=0;d<a.P.length;d++)b>=a.P[d][0]&&b<=a.P[d][1]&&a.P[d][3].call(a.P[d][2],b,c)}function N(a,b,c,d,e){0>xa(a.K,b,c,d,e)&&(a.da>b&&(a.da=b),a.ja<c&&(a.ja=c),a.K.push([b,c,d,e]))}function za(a,b,c){for(var d=0;d<a.K.length;d++)b>=a.K[d][0]&&b<=a.K[d][1]&&a.K[d][3].call(a.K[d][2],b,c)}function xa(a,b,c,d,e){for(var g=0;g<a.length;g++)if(a[g][0]==b&&a[g][1]==c&&a[g][2]==d&&a[g][3]==e)return g;return-1}
function M(a,b,c){void 0!==b&&(a.speed=b,a.H.setSpeed&&(a.H.setSpeed.innerHTML=a.Ta[2<=b?0:b+1]),a.l("running at "+a.Ta[b].toLowerCase()+" speed "+a.jb[b]),c&&a.ca());a.U=0;a.Pa=t();Aa(a)}f.ib=function(){};f.ca=function(){};function O(a,b,c,d){void 0!==a.H[b]&&(void 0===d&&(d=1),c="0000"+c.toString(16),a.H[b].innerHTML=c.slice(c.length-d).toUpperCase())}
function Ba(a){O(a,"A",a.h,2);O(a,"X",a.w,2);O(a,"Y",a.F,2);var b=Ca(a);O(a,"C",b&1?1:0);O(a,"Z",b&2?1:0);O(a,"I",b&4?1:0);O(a,"D",b&8?1:0);O(a,"B",b&16?1:0);O(a,"V",b&64?1:0);O(a,"N",b&128?1:0);O(a,"S",a.G,4);O(a,"PC",a.f,4);a.H.speed&&a.ua&&(a.H.speed.innerHTML=a.ua.toFixed(1)+"Mhz")}
function Aa(a,b){var c=30;c<a.Ka&&(c=a.Ka);c<a.Ja&&(c=a.Ja);var d=1;b&&a.speed>a.Sa&&a.ua&&(d=a.ua);d>a.Na&&2>a.speed&&(d=a.Na);a.lb=Math.round(1E3/30);a.ka=Math.floor(1E6/c*d);a.sa=Math.floor(1E6/30*d);a.Ya=Math.floor(1E6/a.Ka*d);a.Xa=Math.floor(1E6/a.Ja*d);b||(a.R=a.sa,a.Z=a.Ya,a.V=a.Xa);a.Ba=0}
function Da(a){var b=t(),c=a.lb;a.$&&(c=Math.round(c*a.$/a.sa));c=c-(b-a.mb);if(b=b-a.Pa)a.ua=Math.round(a.U/(100*b))/10,864E5<=b&&M(a);0>c?c=0:1==a.speed?a.ua<=a.Na&&(c=0):2==a.speed&&(c=0);a.Ba+=a.$;return c}
f.wa=function(){if(H(this,!0)){this.C.na||(M(this),this.J&&this.J.start(),this.C.na=!0,this.H.run&&(this.H.run.innerHTML="Halt"),this.ca());1E6<=this.Ba&&Aa(this,!0);this.$=0;this.mb=t();try{do{this.step(this.ka);var a=this.L-this.D;this.U+=a;this.$+=a;this.L=this.D=0;this.Z-=this.ka;0>=this.Z&&(this.Z+=this.Ya,this.ib());this.V-=this.ka;0>=this.V&&(this.V+=this.Xa,Ba(this));this.R-=this.ka;if(0>=this.R){this.R+=this.sa;break}}while(this.C.na)}catch(b){this.aa();this.update();H(this,!1);qa(this,b.stack||
b.message);return}setTimeout(function(a){return function(){a.wa()}}(this),Da(this))}else this.update(),this.J&&this.J.stop(this.Pa,this.U)};
f.step=function(a){var b=!0;this.b=this.g=-1;var c;if(c=a&&this.u)c=this.u,c=0<c.ta.length||0<c.xa.length||0<c.za.length;this.L=this.D=a;do{a=this.a[this.f];var d;if(d=c){d=this.u;var e=a,g=!1;Ea(d,this.f,d.ta,"exec")?g=!0:(d.L++,d.B[e][1]++,d.ya[d.Ma++]=d.s.f,d.Ma>=d.ya.length&&(d.Ma=0));d=!!g}if(d){b=void 0;this.aa();break}this.f++;this.o[a].call(this);if(0<=this.b){this.b>=this.pa&&this.b<=this.qa&&ya(this,this.b,this.f);if(d=c)d=this.u,e=!1,Ea(d,this.b,d.xa,"read")&&(e=!0),d=!!e;if(d){b=!1;this.aa();
break}this.b=-1}else if(0<=this.g){this.g>=this.da&&this.g<=this.ja&&za(this,this.g,this.f);if(d=c){d=this.u;var e=this.g,g=this.a[this.g],h=!1;(g&255)!=g&&(d.l("invalid value at "+q(e)+": "+g),h=!0);Ea(d,e,d.za,"write")&&(h=!0);d=!!h}if(d){b=!1;this.aa();break}this.g=-1}this.D-=this.gb[a]}while(0<this.D);return b};function Fa(a){a.R=0;a.L-=a.D;a.D=0}f.aa=function(){J(this,!0);this.L-=this.D;this.D=0;this.C.na&&(this.C.na=!1,this.H.run&&(this.H.run.innerHTML="Run"))};
f.update=function(){this.ib();Ba(this)};function Ga(a){return a.C.na?a.U+a.L-a.D:0}f.S=function(a){return this.a[a]};f.W=function(a,b){this.a[a]=b};function Ca(a){var b=a.c&256?1:0,b=b|(a.j&255?0:2),b=b|((a.v&255^a.A^a.v>>1)&128?64:0),b=b|(a.i&128?128:0);return a.B&60|b}
function Ha(a){a.B|=8;a.o[97]=a.ac;a.o[101]=a.cc;a.o[105]=a.$b;a.o[109]=a.Xb;a.o[113]=a.bc;a.o[117]=a.dc;a.o[121]=a.Zb;a.o[125]=a.Yb;a.o[225]=a.qe;a.o[229]=a.se;a.o[233]=a.pe;a.o[237]=a.me;a.o[241]=a.re;a.o[245]=a.te;a.o[249]=a.oe;a.o[253]=a.ne}function Ia(a){a.B&=-9;a.o[97]=a.zb;a.o[101]=a.Bb;a.o[105]=a.yb;a.o[109]=a.vb;a.o[113]=a.Ab;a.o[117]=a.Cb;a.o[121]=a.xb;a.o[125]=a.wb;a.o[225]=a.Hb;a.o[229]=a.Jb;a.o[233]=a.Gb;a.o[237]=a.Db;a.o[241]=a.Ib;a.o[245]=a.Kb;a.o[249]=a.Fb;a.o[253]=a.Eb}
function P(a,b,c){var d=a.c&256?1:0,e=(b&15)+(c&15)+d;10<=e&&(e=e+6&15|16);e+=(b&240)+(c&240);a.A=b^c;a.v=e;a.i=e&255;160<=e&&(e+=96);512<=e&&(e-=256);a.c=e;a.j=b+c+d&255;a.D--;return e&255}function Q(a,b,c){var d=a.c&256?0:1,e=(b&15)-(c&15)-d;0>e&&(e=(e-6&15)-16);e+=(b&240)-(c&240);0>e&&(e-=96);a.i=a.j=(a.c=b-c-d)&255;a.A=b^c;a.v=a.c;a.c^=256;a.D--;return e&255}function ua(a){a.h=0;a.w=0;a.F=0;a.G=256;a.B=0;a.i=0;a.j=0;a.A=0;a.v=0;a.c=0;a.f=0;a.b=-1;a.g=-1;a.ua=0;a.U=a.L=a.D=0}
f.zc=function(){this.f++;this.a[this.G--]=this.f>>8;this.G|=256;this.a[this.G--]=this.f&255;this.G|=256;this.B|=16;this.B=Ca(this);this.a[this.G--]=this.B;this.G|=256;this.B&=239;this.b=65534;this.f=this.a[this.b]|this.a[this.b+1]<<8};f.Td=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.i=this.j=this.h|=this.a[this.b]};f.Vd=function(){this.b=this.a[this.f++];this.i=this.j=this.h|=this.a[this.b]};
f.pc=function(){this.g=this.a[this.f++];this.c=this.a[this.g]<<1;this.i=this.j=this.a[this.g]=this.c&255};f.Yd=function(){this.B=Ca(this);this.a[this.G--]=this.B;this.G|=256};f.Sd=function(){this.b=this.f++;this.i=this.j=this.h|=this.a[this.b]};f.oc=function(){this.c=this.h<<1;this.i=this.j=this.h=this.c&255};f.Pd=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.h|=this.a[this.b]};
f.mc=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.a[this.g]<<1;this.i=this.j=this.a[this.g]=this.c&255};f.yc=function(){this.f+=(this.i&128?0:(this.D--,this.a[this.f]<<24>>24))+1};f.Ud=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.i=this.j=this.h|=this.a[this.b]};f.Wd=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.h|=this.a[this.b]};
f.qc=function(){this.g=this.a[this.f++]+this.w&255;this.c=this.a[this.g]<<1;this.i=this.j=this.a[this.g]=this.c&255};f.Cc=function(){this.c=0};f.Rd=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.h|=this.a[this.b]};f.Qd=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.h|=this.a[this.b]};f.nc=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.a[this.g]<<1;this.i=this.j=this.a[this.g]=this.c&255};
f.qd=function(){this.b=this.f++;this.a[this.G--]=this.f>>8;this.G|=256;this.a[this.G--]=this.f&255;this.G|=256;this.f=this.a[this.b]|this.a[this.b+1]<<8};f.ic=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.i=this.j=this.h&=this.a[this.b]};f.vc=function(){this.b=this.a[this.f++];this.j=this.h&this.a[this.b];this.i=this.i&127|this.a[this.b]&128;this.v=0;this.A=this.a[this.b]&64?128:0};f.kc=function(){this.b=this.a[this.f++];this.i=this.j=this.h&=this.a[this.b]};
f.de=function(){this.g=this.a[this.f++];this.c=this.c&65280|this.a[this.g];this.c<<=1;this.c=this.c&65534|(this.c&512?1:0);this.i=this.j=this.a[this.g]=this.c&255};f.$d=function(){this.G=this.G+1&255|256;this.B=this.a[this.G];this.c=this.B&1?256:0;this.j=this.B&2?0:1;this.i=this.B&128;this.v=0;this.A=this.B&64?128:0};f.hc=function(){this.b=this.f++;this.i=this.j=this.h&=this.a[this.b]};
f.ce=function(){this.c=this.c&65280|this.h;this.c<<=1;this.c=this.c&65534|(this.c&512?1:0);this.i=this.j=this.h=this.c&255};f.uc=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.j=this.h&this.a[this.b];this.i=this.i&127|this.a[this.b]&128;this.v=0;this.A=this.a[this.b]&64?128:0};f.ec=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.h&=this.a[this.b]};
f.ae=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.c&65280|this.a[this.g];this.c<<=1;this.c=this.c&65534|(this.c&512?1:0);this.i=this.j=this.a[this.g]=this.c&255};f.wc=function(){this.f+=(this.i&128?(this.D--,this.a[this.f]<<24>>24):0)+1};f.jc=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.i=this.j=this.h&=this.a[this.b]};f.lc=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.h&=this.a[this.b]};
f.ee=function(){this.g=this.a[this.f++]+this.w&255;this.c=this.c&65280|this.a[this.g];this.c<<=1;this.c=this.c&65534|(this.c&512?1:0);this.i=this.j=this.a[this.g]=this.c&255};f.ue=function(){this.c=256};f.gc=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.h&=this.a[this.b]};f.fc=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.h&=this.a[this.b]};
f.be=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.c&65280|this.a[this.g];this.c<<=1;this.c=this.c&65534|(this.c&512?1:0);this.i=this.j=this.a[this.g]=this.c&255};f.ke=function(){this.G=this.G+1&255|256;this.B=this.a[this.G];this.c=this.B&1?256:0;this.j=this.B&2?0:1;this.i=this.B&128;this.v=0;this.A=this.B&64?128:0;this.G=this.G+2&255|256;this.f=this.a[this.G-1|256]|this.a[this.G]<<8};
f.dd=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.i=this.j=this.h^=this.a[this.b]};f.fd=function(){this.b=this.a[this.f++];this.i=this.j=this.h^=this.a[this.b]};f.Md=function(){this.g=this.a[this.f++];this.c=this.c&65279|(this.a[this.g]&1?256:0);this.a[this.g]=(this.c=this.c&65280|this.a[this.g]>>1)&255;this.i=this.j=this.c&255};f.Xd=function(){this.a[this.G--]=this.h;this.G|=256};f.cd=function(){this.b=this.f++;this.i=this.j=this.h^=this.a[this.b]};
f.Ld=function(){this.c=this.c&65279|(this.h&1?256:0);this.h=(this.c=this.c&65280|this.h>>1)&255;this.i=this.j=this.c&255};f.pd=function(){this.b=this.f;this.f=this.a[this.b]|this.a[this.b+1]<<8};f.$c=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.h^=this.a[this.b]};f.Jd=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.c&65279|(this.a[this.g]&1?256:0);this.a[this.g]=(this.c=this.c&65280|this.a[this.g]>>1)&255;this.i=this.j=this.c&255};
f.Ac=function(){this.f+=((this.v&255^this.A^this.v>>1)&128?0:(this.D--,this.a[this.f]<<24>>24))+1};f.ed=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.i=this.j=this.h^=this.a[this.b]};f.gd=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.h^=this.a[this.b]};f.Nd=function(){this.g=this.a[this.f++]+this.w&255;this.c=this.c&65279|(this.a[this.g]&1?256:0);this.a[this.g]=(this.c=this.c&65280|this.a[this.g]>>1)&255;this.i=this.j=this.c&255};
f.Ec=function(){this.B&=251};f.bd=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.h^=this.a[this.b]};f.ad=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.h^=this.a[this.b]};f.Kd=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.c&65279|(this.a[this.g]&1?256:0);this.a[this.g]=(this.c=this.c&65280|this.a[this.g]>>1)&255;this.i=this.j=this.c&255};
f.le=function(){this.G=this.G+2&255|256;this.f=(this.a[this.G-1|256]|this.a[this.G]<<8)+1};f.zb=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.ac=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=P(this,this.h,this.a[this.b])};
f.Bb=function(){this.b=this.a[this.f++];this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.cc=function(){this.b=this.a[this.f++];this.h=P(this,this.h,this.a[this.b])};f.ie=function(){this.g=this.a[this.f++];this.c=this.c&65280|this.a[this.g];this.c=this.c&65023|(this.c&1?512:0);this.c>>=1;this.i=this.j=this.a[this.g]=this.c&255};f.Zd=function(){this.G=this.G+1&255|256;this.i=this.j=this.h=this.a[this.G]};
f.yb=function(){this.b=this.f++;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.$b=function(){this.b=this.f++;this.h=P(this,this.h,this.a[this.b])};f.he=function(){this.c=this.c&65280|this.h;this.c=this.c&65023|(this.c&1?512:0);this.c>>=1;this.i=this.j=this.h=this.c&255};f.od=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.f=this.a[this.b]|this.a[this.b+1]<<8};
f.vb=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.Xb=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.h=P(this,this.h,this.a[this.b])};f.fe=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.c&65280|this.a[this.g];this.c=this.c&65023|(this.c&1?512:0);this.c>>=1;this.i=this.j=this.a[this.g]=this.c&255};
f.Bc=function(){this.f+=((this.v&255^this.A^this.v>>1)&128?(this.D--,this.a[this.f]<<24>>24):0)+1};f.Ab=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.bc=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.h=P(this,this.h,this.a[this.b])};
f.Cb=function(){this.b=this.a[this.f++]+this.w&255;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.dc=function(){this.b=this.a[this.f++]+this.w&255;this.h=P(this,this.h,this.a[this.b])};f.je=function(){this.g=this.a[this.f++]+this.w&255;this.c=this.c&65280|this.a[this.g];this.c=this.c&65023|(this.c&1?512:0);this.c>>=1;this.i=this.j=this.a[this.g]=this.c&255};f.we=function(){this.B|=4};
f.xb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};f.Zb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.h=P(this,this.h,this.a[this.b])};f.wb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.h+this.a[this.b]+(this.c&256?1:0);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255};
f.Yb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.h=P(this,this.h,this.a[this.b])};f.ge=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.c&65280|this.a[this.g];this.c=this.c&65023|(this.c&1?512:0);this.c>>=1;this.i=this.j=this.a[this.g]=this.c&255};f.Ae=function(){this.g=this.a[this.f++]+this.w&255;this.g=this.a[this.g]|this.a[this.g+1]<<8;this.a[this.g]=this.h};f.Ie=function(){this.g=this.a[this.f++];this.a[this.g]=this.F};
f.Ce=function(){this.g=this.a[this.f++];this.a[this.g]=this.h};f.Fe=function(){this.g=this.a[this.f++];this.a[this.g]=this.w};f.Zc=function(){this.i=this.j=this.F=this.F-1&255};f.Oe=function(){this.i=this.j=this.h=this.w};f.He=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.a[this.g]=this.F};f.xe=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.a[this.g]=this.h};f.Ee=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.a[this.g]=this.w};
f.rc=function(){this.f+=(this.c&256?0:(this.D--,this.a[this.f]<<24>>24))+1};f.Be=function(){this.g=this.a[this.f++];this.g=(this.a[this.g]|this.a[this.g+1]<<8)+this.F;this.a[this.g]=this.h};f.Je=function(){this.g=this.a[this.f++]+this.w&255;this.a[this.g]=this.F};f.De=function(){this.g=this.a[this.f++]+this.w&255;this.a[this.g]=this.h};f.Ge=function(){this.g=this.a[this.f++]+this.F&255;this.a[this.g]=this.w};f.Qe=function(){this.i=this.j=this.h=this.F};
f.ze=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.a[this.g]=this.h};f.Pe=function(){this.G=this.w|256};f.ye=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.a[this.g]=this.h};f.Gd=function(){this.b=this.f++;this.i=this.j=this.F=this.a[this.b]};f.vd=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.i=this.j=this.h=this.a[this.b]};f.Bd=function(){this.b=this.f++;this.i=this.j=this.w=this.a[this.b]};
f.Hd=function(){this.b=this.a[this.f++];this.i=this.j=this.F=this.a[this.b]};f.xd=function(){this.b=this.a[this.f++];this.i=this.j=this.h=this.a[this.b]};f.Cd=function(){this.b=this.a[this.f++];this.i=this.j=this.w=this.a[this.b]};f.Me=function(){this.i=this.j=this.F=this.h};f.ud=function(){this.b=this.f++;this.i=this.j=this.h=this.a[this.b]};f.Le=function(){this.i=this.j=this.w=this.h};f.Ed=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.F=this.a[this.b]};
f.rd=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.h=this.a[this.b]};f.zd=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.w=this.a[this.b]};f.sc=function(){this.f+=(this.c&256?(this.D--,this.a[this.f]<<24>>24):0)+1};f.wd=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.i=this.j=this.h=this.a[this.b]};f.Id=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.F=this.a[this.b]};
f.yd=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.h=this.a[this.b]};f.Dd=function(){this.b=this.a[this.f++]+this.F&255;this.i=this.j=this.w=this.a[this.b]};f.Fc=function(){this.A=this.v=0};f.td=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.h=this.a[this.b]};f.Ne=function(){this.i=this.j=this.w=this.G&255};f.Fd=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.F=this.a[this.b]};
f.sd=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.h=this.a[this.b]};f.Ad=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.w=this.a[this.b]};f.Sc=function(){this.b=this.f++;this.i=this.j=this.c=this.F-this.a[this.b];this.c^=256};f.Kc=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};
f.Tc=function(){this.b=this.a[this.f++];this.i=this.j=this.c=this.F-this.a[this.b];this.c^=256};f.Mc=function(){this.b=this.a[this.f++];this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Wc=function(){this.g=this.a[this.f++];this.i=this.j=this.a[this.g]=this.a[this.g]-1&255};f.nd=function(){this.i=this.j=this.F=this.F+1&255};f.Jc=function(){this.b=this.f++;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Yc=function(){this.i=this.j=this.w=this.w-1&255};
f.Rc=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.c=this.F-this.a[this.b];this.c^=256};f.Gc=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Uc=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.a[this.g]=this.a[this.g]-1&255};f.xc=function(){this.f+=(this.j&255?(this.D--,this.a[this.f]<<24>>24):0)+1};
f.Lc=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Nc=function(){this.b=this.a[this.f++]+this.w&255;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Xc=function(){this.g=this.a[this.f++]+this.w&255;this.i=this.j=this.a[this.g]=this.a[this.g]-1&255};f.Dc=function(){Ia(this)};
f.Ic=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Hc=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.c=this.h-this.a[this.b];this.c^=256};f.Vc=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.a[this.g]=this.a[this.g]-1&255};f.Pc=function(){this.b=this.f++;this.i=this.j=this.c=this.w-this.a[this.b];this.c^=256};
f.Hb=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.qe=function(){this.b=this.a[this.f++]+this.w&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=Q(this,this.h,this.a[this.b])};f.Qc=function(){this.b=this.a[this.f++];this.i=this.j=this.c=this.w-this.a[this.b];this.c^=256};
f.Jb=function(){this.b=this.a[this.f++];this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.se=function(){this.b=this.a[this.f++];this.h=Q(this,this.h,this.a[this.b])};f.kd=function(){this.g=this.a[this.f++];this.i=this.j=this.a[this.g]=this.a[this.g]+1&255};f.md=function(){this.i=this.j=this.w=this.w+1&255};
f.Gb=function(){this.b=this.f++;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.pe=function(){this.b=this.f++;this.h=Q(this,this.h,this.a[this.b])};f.Od=function(){};f.Oc=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.c=this.w-this.a[this.b];this.c^=256};
f.Db=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.me=function(){this.b=this.a[this.f++]|this.a[this.f++]<<8;this.h=Q(this,this.h,this.a[this.b])};f.hd=function(){this.g=this.a[this.f++]|this.a[this.f++]<<8;this.i=this.j=this.a[this.g]=this.a[this.g]+1&255};f.tc=function(){this.f+=(this.j&255?0:(this.D--,this.a[this.f]<<24>>24))+1};
f.Ib=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.re=function(){this.b=this.a[this.f++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.F;this.h=Q(this,this.h,this.a[this.b])};
f.Kb=function(){this.b=this.a[this.f++]+this.w&255;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.te=function(){this.b=this.a[this.f++]+this.w&255;this.h=Q(this,this.h,this.a[this.b])};f.ld=function(){this.g=this.a[this.f++]+this.w&255;this.i=this.j=this.a[this.g]=this.a[this.g]+1&255};f.ve=function(){Ha(this)};
f.Fb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.oe=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.F;this.h=Q(this,this.h,this.a[this.b])};
f.Eb=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.c=this.h-this.a[this.b]-(this.c&256?0:1);this.A=this.h^this.a[this.b];this.v=this.c;this.i=this.j=this.h=this.c&255;this.c^=256};f.ne=function(){this.b=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.h=Q(this,this.h,this.a[this.b])};f.jd=function(){this.g=(this.a[this.f++]|this.a[this.f++]<<8)+this.w;this.i=this.j=this.a[this.g]=this.a[this.g]+1&255};
f.Ke=function(){var a;a=this.a[this.f++];switch(a){case 0:this.l("HALT");this.aa();break;case 1:a=this.f;for(var b="";a<this.a.length;){var c=this.a[a++];if(!c)break;b+=String.fromCharCode(c)}this.f=a;b=b.replace(/%A/g,n(this.h,2)).replace(/%X/g,n(this.w,2)).replace(/%Y/g,n(this.F,2));this.l(b);Fa(this);break;default:this.f-=2,this.l("undefined opSim: "+p(a)+" at "+q(this.f)),this.aa()}};f.m=function(){var a=this.a[--this.f];this.l("undefined opcode: "+p(a)+" at "+q(this.f));this.aa()};
y(function(){for(var a=F(window.document,"c1pjs","cpu"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new ta(d);E(d,c)}});function R(a){A.call(this,"C1PROM",a);this.b=this.a=null;this.g=a.size;if(this.o=a.image){a=this.o;var b;b=this.o;var c="",d=b.lastIndexOf(".");0<=d&&(c=b.substr(d+1).toLowerCase());b=c;"json"!=b&&"hex"!=b&&(a="http://"+(window?window.location.host:"www.pcjs.org")+"/api/v1/dump?file="+this.o+"&format=bytes");u(a,this,this.A)}}C(R);
R.prototype.ba=function(a,b,c,d){this.a=a;this.v=b;a=c-b+1;this.g||(this.g=a);a!=this.g?qa(this,"computer-specified ROM size ("+q(a)+") does not match component-specified size ("+q(this.g)+")"):(d&&(this.s=d,N(d,b,c,this,this.W)),Ja(this))};R.prototype.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.u=L(b,"debugger"))};R.prototype.W=function(a,b){if(void 0!==b){this.u&&S(this.u,this,a,b,this.u.qb,!0);var c=a-this.v;this.a[this.v+c]=this.b?this.b[c]:0}};
R.prototype.A=function(a,b,c){if(c)this.l('Error loading ROM "'+a+'" ('+c+")");else{if("["==b.charAt(0)||"{"==b.charAt(0))try{var d=eval("("+b+")"),e=d.bytes;e?this.b=e:this.b=d}catch(g){this.l('Error processing ROM "'+a+'": '+g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.b=Array(a.length),b=0;b<a.length;b++)this.b[b]=parseInt(a[b],16);Ja(this)}};
function Ja(a){if(!K(a))if(!a.o)a.X();else if(a.b&&a.a){var b=a.b.length;if(b!=a.g)qa(a,"ROM image size ("+q(b)+") does not match component-specified size ("+q(a.g)+")");else{for(var c=0;c<b;c++)a.a[a.v+c]=a.b[c];a.X()}}}y(function(){for(var a=F(window.document,"c1pjs","rom"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new R(d);E(d,c)}});function Ka(a){A.call(this,"C1PRAM",a)}C(Ka);Ka.prototype.ba=function(a){this.a=a;this.X()};
y(function(){for(var a=F(window.document,"c1pjs","ram"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Ka(d);E(d,c)}});
function La(a){A.call(this,"C1PKeyboard",a);this.C.M=!1;this.Ja=a.model;this.da=8;this.gb=10;this.Ya=13;this.ja=27;this.Pa=this.da;this.Xa=this.gb;this.Ka=this.Ya;this.$=this.ja;this.L=241;this.Z=224;this.Ta=3;this.Ua=15;this.K=1;this.D=[];this.D["break"]=this.Z;this.D.esc=this.$;this.D["ctrl-c"]=this.Ta;this.D["ctrl-o"]=this.Ua;this.b=[];this.b[49]=30464;this.b[33]=30704;this.b[50]=30208;this.b[34]=30448;this.b[51]=29952;this.b[35]=30192;this.b[52]=29696;this.b[36]=29936;this.b[53]=29440;this.b[37]=
29680;this.b[54]=29184;this.b[38]=29424;this.b[55]=28928;this.b[39]=29168;this.b[56]=26368;this.b[40]=26608;this.b[57]=26112;this.b[41]=26352;this.b[48]=25856;this.b[58]=25600;this.b[42]=25840;this.b[45]=25344;this.b[61]=25584;this.b[46]=22272;this.b[62]=22512;this.b[108]=22016;this.b[76]=22256;this.b[92]=22256;this.b[111]=21760;this.b[79]=22E3;this.b[this.Pa]=22E3;this.b[this.Xa]=21504;this.b[this.Ka]=21248;this.b[119]=18176;this.b[87]=18416;this.b[101]=17920;this.b[69]=18160;this.b[114]=17664;this.b[82]=
17904;this.b[116]=17408;this.b[84]=17648;this.b[121]=17152;this.b[89]=17392;this.b[117]=16896;this.b[85]=17136;this.b[105]=16640;this.b[73]=16880;this.b[115]=14080;this.b[83]=14320;this.b[100]=13824;this.b[68]=14064;this.b[102]=13568;this.b[70]=13808;this.b[103]=13312;this.b[71]=13552;this.b[104]=13056;this.b[72]=13296;this.b[106]=12800;this.b[74]=13040;this.b[107]=12544;this.b[75]=12784;this.b[91]=12784;this.b[120]=9984;this.b[88]=10224;this.b[99]=9728;this.b[67]=9968;this.b[118]=9472;this.b[86]=
9712;this.b[98]=9216;this.b[66]=9456;this.b[110]=8960;this.b[78]=9200;this.b[94]=9200;this.b[109]=8704;this.b[77]=8944;this.b[93]=8944;this.b[44]=8448;this.b[60]=8688;this.b[113]=5888;this.b[81]=6128;this.b[97]=5632;this.b[65]=5872;this.b[122]=5376;this.b[90]=5616;this.b[32]=5120;this.b[47]=4864;this.b[63]=5104;this.b[59]=4608;this.b[43]=4848;this.b[112]=4352;this.b[80]=4592;this.b[64]=4592;this.b[this.L]=1536;this.b[this.$]=1280;this.b[240]=512;this.b[242]=256;this.b[244]=0;this.reset()}C(La);
f=La.prototype;f.reset=function(){this.Oa(this.Ja);this.g=this.K;this.pa=0;this.o=[this.K,0,0,0,0,0,0,0];this.P=[];if(this.v)for(var a in this.v)isNaN(a)||this.v[a]&&clearTimeout(this.v[a]);this.v=[];this.Ba=this.A=0;this.qa=-1;this.ka=this.o;this.ra=this.V=0;this.B=""};
f.T=function(a,b,c){if(void 0===this.H[b])switch(b){case "keyDown":return this.H[b]=c,c.onkeydown=function(a){return function(b){return Ma(a,b,!0)}}(this),!0;case "keyPress":return this.H[b]=c,c.onkeypress=function(a){return function(b){var c=!0;b=b||window.event;b=b.which||b.keyCode;a.B="";a.g&8?a.g&=-9:c=!Na(a,b);a.u&&G(a.u,a.u.Aa)&&a.u.message("keyPress("+p(b)+"): "+(c?"pass":"consume"));return c}}(this),!0;case "keyUp":return this.H[b]=c,c.onkeyup=function(a){return function(b){return Ma(a,b,
!1)}}(this),!0;case "break":return this.H[b]=c,c.onclick=function(a){return function(){a.J&&a.J.reset(!0)}}(this),!0;default:if(void 0!==this.D[b])return this.H[b]=c,c.onclick=function(a,b,c){return function(){a.s&&a.s.ca();return!Na(a,c)}}(this,b,this.D[b]),!0}return!1};f.ba=function(a,b,c,d){this.a=a;this.sa=b;this.jb=c-b+1;this.mb=this.sa+this.jb;d&&(this.s=d,N(d,b,c,this,this.W));this.X()};f.Oa=function(a){this.O=a;this.R=255;600!=this.O&&(this.R=0,this.l("updated keyboard model: "+this.O))};
f.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.J=b,this.u=L(b,"debugger"))};f.X=function(){this.U=(this.lb=w("iOS"))||w("Android");this.u&&G(this.u,this.u.Aa)&&this.u.message("mobile keyboard support: "+(this.U?"true":"false")+" ("+window.navigator.userAgent+")");A.prototype.X.call(this)};function Oa(a,b){var c=b?100:250;a.s&&a.s.ua&&(c/=a.s.ua);return c}function Pa(a,b){!a.A||void 0!==b&&b==a.A||(a.u&&G(a.u,a.u.Aa)&&a.u.message("autoClear("+p(a.A)+")"),clearTimeout(a.v[a.A]),T(a,a.A,!1,4))}
function U(a,b,c){a.B=b;Qa(a,c||300)}function Qa(a,b){if(0<a.B.length){var c=a.B.charCodeAt(0);10==c&&(c=13);65<=c&&90>=c&&(c+=32);a.B=a.B.substr(1);Na(a,c)}0<a.B.length&&setTimeout(function(a){return function(){Qa(a,b)}}(a),b)}
function Ma(a,b,c){var d,e=!c;b=b.keyCode;c&&(a.Ba=b);16==b?(a.g&=-5,c&&(a.g|=4),b+=224,e=!1):18==b?(a.g&=-3,c&&(a.g|=2),b+=224,e=!1):b==a.L-224?(a.g&=-65,c&&(a.g|=64),b+=224,e=!1):20==b?(c=!c,a.g&=~a.K,c&&(a.g|=a.K),b+=224,e=!1):91==b?(a.g&=-9,c&&(a.g|=8),e=!1,d=!0):d=9==b?e=!1:b==a.ja||b==a.da?c?!Na(a,b):!1:!0;e&&(a.g&=-9,a.U||b!=a.Ba||Pa(a));void 0===d&&(d=!T(a,b,c,2));a.u&&G(a.u,a.u.Aa)&&a.u.message("key"+(c?"Down":"Up")+"("+p(b)+"): "+(d?"pass":"consume"));return d}
function Na(a,b){var c=!1;b==a.Z?a.J&&(a.J.reset(!0),c=!0):(a.U&&65<=b&&90>=b&&(b+=32),Pa(a,b),T(a,b,!0,0)&&(a.s.speed==a.s.fb?T(a,b,!1,1):(c=!1,a.v[b]&&(clearTimeout(a.v[b]),c=!0),c=Oa(a,c),a.v[a.A=b]=setTimeout(function(a){return function(){T(a,b,!1,3)}}(a),c),a.u&&G(a.u,a.u.Aa)&&a.u.message("keyPressSimulate("+p(b)+"): setTimeout()")),c=!0));a.u&&G(a.u,a.u.Aa)&&a.u.message("keyPressSimulate("+p(b)+"): "+(c?"true":"false"));return c}
function T(a,b,c,d){var e=!1;c||(a.v[b]=null,a.A==b&&(a.A=0));var g=0,h=a.b[b];void 0===h&&(1<=b&&26>=b&&(b+=64,g=a.L),h=a.b[b]);void 0!==h&&(b=h>>12,e=h>>8&15,g||(g=h&255),c?(a.o[b]|=1<<e,a.o[0]=g==a.L?a.o[0]|64:240==g?a.o[0]|4:242==g?a.o[0]|2:a.o[0]&-71):(a.o[b]&=~(1<<e),a.o[0]&=-71,a.o[0]|=a.g&70),c=0==d&&!a.P.length,a.P.push(a.o.slice()),Ra(a,c),e=!0);return e}f.S=function(){};f.W=function(a){this.pa=this.s.S(a)^this.R;this.V++;Ra(this,!1,a)};
function Ra(a,b,c){var d=Ga(a.s);b||(a.s.speed==a.s.fb?b=void 0!==c&&32<=a.V:(b=d-a.ra,b=0>b||8192<=b));b&&(b=a.P.shift(),void 0!==b&&(a.ka=b),a.V=0,a.ra=d);for(b=d=0;8>b;b++)a.pa&1<<b&&(d|=a.ka[b]);d^=a.R;if(void 0!==c)a.a[c]=d;else if(c=a.sa,d!=a.qa)for(;c<a.mb;c++)a.a[c]=d;a.qa=d}y(function(){for(var a=F(window.document,"c1pjs","keyboard"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new La(d);E(d,c)}});
function Sa(a,b,c,d){A.call(this,"C1PVideo",a);this.ka=a.model;this.Z=a.charCols;this.$=a.charRows;this.qa=a.screenWidth;this.ra=a.screenHeight;this.A=a.charWidth;this.B=a.charHeight;Ta(this);this.D=b;this.ja=c;this.o=d}C(Sa);f=Sa.prototype;f.reset=function(a){this.Oa(this.ka);if(this.a)for(var b=this.K;b<this.P;b++)this.a[b]=a?Math.floor(256*Math.random()):32};f.T=function(a,b,c){switch(b){case "refresh":return this.H[b]=c,c.onclick=function(a){return function(){Ua(a);va(a)}}(this),!0}return!1};
f.ba=function(a,b,c,d){this.a=a;this.K=b;this.pa=c-b+1;this.P=this.K+this.pa;d&&(this.s=d,wa(d,56832,56832,this,this.S),N(d,56832,56832,this,this.W));this.reset(!0)};function Ta(a,b,c,d,e){a.J=void 0!==b?b:a.Z;a.sa=void 0!==c?c:a.$;a.g=a.J*a.sa;a.P=a.K+a.g;a.V=void 0!==d?d:0;a.da=void 0!==e?e:c;a.R=Math.floor(a.qa/a.J);a.U=Math.floor(a.ra/a.da)}f.ca=function(){this.D.focus()};
f.Oa=function(a){this.O=a;600==this.O?(Ta(this,this.Z,this.$,3,25),1024==this.g&&this.s&&(this.v=this.P+this.g-1,N(this.s,this.v,this.v,this,this.Nb))):(this.l("updated video model: "+this.O),Ta(this,64,32));Ua(this);va(this)};f.ia=function(a,b){if(a&&!this.C.M&&K(this)){if(this.C.M=!0,this.u=L(b,"debugger"),this.b=L(b,"keyboard"))this.b.T("canvas","keyDown",this.D),this.b.T("canvas","keyPress",this.D),this.b.T("canvas","keyUp",this.D)}else!a&&this.C.M&&(this.C.M=!1)};
f.X=function(){this.A||(this.A=Math.floor(this.o.width/16));this.B||(this.B=Math.floor(this.o.height/16));A.prototype.X.call(this)};f.S=function(a,b){var c=this.s.S(a);void 0!==b&&this.u&&S(this.u,this,a,b,this.u.bb);this.s.W(a,c&127|(Math.floor(Ga(this.s)/8333)&1?128:0))};f.W=function(a,b){void 0!==b&&this.u&&S(this.u,this,a,b,this.u.bb)};
f.Nb=function(a,b){if(void 0!==b){this.u&&S(this.u,this,a,b,this.u.bb,!0);this.Oa(540);this.b&&this.b.Oa(542);var c=this.s,d=c.K,e=[],g=xa(d,this.v,this.v,this,this.Nb);if(0<=g){e.push(d[g][0]);e.push(d[g][1]);d.splice(g,1);for(var h=65536,k=0,g=0;g<d.length;g++)h>d[g][0]&&(h=d[g][0]),k<d[g][1]&&(k=d[g][1]);e.push(h);e.push(k)}4==e.length&&(c.da=e[2],c.ja=e[3])}};function Ua(a){a.L=Array(a.g);for(var b=0;b<=a.g;b++)a.L[b]=-1}
function va(a){var b=0;if(a.C.M)for(;b<a.g;){var c=a.a[a.K+b];if(a.L[b]!=c){var d=Math.floor(b/a.J);if(d>=a.V&&(d-=a.V,d<a.da)){var e=c*a.A;a.ja.drawImage(a.o,e%a.o.width,Math.floor(e/a.o.width)*a.B,a.A,a.B,b%a.J*a.R,d*a.U,a.R,a.U)}a.L[b]=c}b++}}
y(function(){for(var a=F(window.document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=D(c),e=window.document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","c1pjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.setAttribute("contenteditable","true");e.setAttribute("autocapitalize","off");e.setAttribute("autocorrect","off");e.style.backgroundColor=
d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(e.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight));c.appendChild(e);var g=new Image,h=e.getContext("2d"),e=new Sa(d,e,h,g);g.onload=function(a){return function(){a.X()}}(e,d.charSet);g.src=d.charSet;E(e,c)}});
function Va(a){A.call(this,"C1PSerialPort",a);this.C.M=!1;this.O=a.demo;this.reset()}C(Va);f=Va.prototype;f.reset=function(){if(2!=this.g){this.v=this.B=0;var a=1;if(this.sb){var b=this.sb.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.o='10 PRINT "HELLO OSI #'+a+'"\n';this.g=this.A=0}};f.start=function(){this.b&&this.O&&(U(this.b," C\n\n",3E3),setTimeout(function(a){return function(){a.g=1;U(a.b,"LOAD\n")}}(this),12E3));this.O=!1};
f.T=function(a,b,c){var d=this;switch(b){case "listSerial":return this.H[b]=c,!0;case "loadSerial":return this.H[b]=c,c.onclick=function(){d.H.listSerial&&u(d.H.listSerial.value,d,d.tb)},!0;case "mountSerial":return!w("Mobi")&&window&&"FileReader"in window?(this.H[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){d.tb(b.name,c.result.toString(),
0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};f.ba=function(a,b,c,d){this.a=a;this.D=b;this.L=c-b+1;this.K=this.D+this.L;if(this.s=d)wa(d,b,c,this,this.S),N(d,b,c,this,this.W);this.X()};f.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.J=b,this.b=L(b,"keyboard"),this.u=L(b,"debugger"))};
f.tb=function(a,b,c){b?(this.o=b,this.g=this.A=0,this.J&&this.b&&this.s.C.na?(this.l("auto-loading "+a),this.s.ca(),"."!=this.o.charAt(0)?(this.g=1,U(this.b,"NEW\nLOAD\n")):(this.g=2,this.J.reset(!0),U(this.b,"ML"))):this.l(a+" ready to load")):this.l(a+" load error ("+c+")")};f.S=function(a,b){void 0!==b&&(a&1?Wa(this):this.o&&!this.A&&Wa(this))};f.W=function(a,b){void 0!==b&&this.u&&S(this.u,this,a,b,this.u.Sb,!0)};
function Wa(a){if(void 0!==a.o){a.B=0;a.v=0;if(a.A<a.o.length){var b=a.o.charCodeAt(a.A++);10==b&&(b=13);a.B=b;a.v=1}else 1==a.g&&a.b&&U(a.b," \nRUN\n"),a.g=0;for(b=a.D+0;b<a.K;b+=2)a.a[b]=a.v?1:0;for(b=a.D+1;b<a.K;b+=2)a.a[b]=a.v?a.B:0}}y(function(){for(var a=F(window.document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Va(d);E(d,c)}});function Xa(a){A.call(this,"C1PDiskController",a);this.C.M=!1;this.reset(!0)}C(Xa);f=Xa.prototype;
f.reset=function(a){Ya(this);this.b=-1;a&&(this.g=[],this.g[0]={Te:0,ub:40,Tb:!0,Ga:20,oa:0,Fa:-1,Wa:[]})};
function Ya(a){a.K={I:64,ha:function(){},update:function(a){return function(c){void 0!==c&&(this.I=c);a.B.I&4||V(a,0,this)}}(a)};a.o={I:255,ha:function(){this.update()},update:function(a){return function(c){void 0===c?c=a.o.I:Za(a,c,a.A.I);c=(c|190)&-2;if(0<=a.b&&a.g[a.b].Wa.length){var d=a.g[a.b];d.Tb&&(c&=-33);d.oa||(c&=-3);10>=--d.Ga&&(0<d.Ga?(c&=-129,$a(a)):(d.Ga=100,0<=a.b&&(a.g[a.b].Fa=0,ab(a))))}this.I=c;a.B.I&4&&V(a,0,this)}}(a)};a.B={I:0,ha:function(){},update:function(a){return function(c){void 0!==
c&&(this.I=c&-193);V(a,1,this);a.o.update();a.K.update()}}(a)};a.L={I:255,ha:function(){},update:function(a){return function(c){void 0!==c&&(this.I=c);a.D.I&4||V(a,2,this)}}(a)};a.A={I:255,ha:function(){},update:function(a){return function(c){void 0===c?c=a.A.I:Za(a,a.o.I,c);if(0<=a.b&&a.b<a.g.length){var d=a.g[a.b];d.Wa.length&&a.A.I&8&&!(c&8)&&(c&4?d.oa--:d.oa++,a.u&&G(a.u,a.u.Ia)&&a.u.message("stepping "+(c&4?"down":"up")+" to track "+d.oa),d.oa>=d.ub&&(d.oa=d.ub),0>d.oa&&(d.oa=0),d.Ga=20,a.o.update(a.o.I|
128),$a(a))}this.I=c;a.D.I&4&&V(a,2,this)}}(a)};a.D={I:0,ha:function(){},update:function(a){return function(c){void 0!==c&&(this.I=c&-193);V(a,3,this);a.A.update();a.L.update()}}(a)};a.P={I:0,ha:function(){},update:function(a){return function(c){void 0!==c&&(3==(c&3)&&(a.v.I=14),this.I=c);a.v.update()}}(a)};a.v={I:14,ha:function(){},update:function(a){return function(c){void 0===c&&(c=a.v.I);c&=-2;0<=a.b&&0<=a.g[a.b].Fa&&(c|=1);this.I=c;V(a,16,this)}}(a)};a.O={I:0,ha:function(a){return function(){ab(a)}}(a),
update:function(a){return function(c){void 0!==c&&(this.I=c);V(a,17,this)}}(a)};a.R={I:0,ha:function(){},update:function(){return function(){}}(a)}}f.T=function(a,b,c){switch(b){case "listDisk":return this.H[b]=c,!0;case "loadDisk":return this.H[b]=c,c.onclick=function(a){return function(){if(a.H.listDisk){var b=a.H.listDisk.value,c=b;".json"!=b.substr(b.length-5)&&(c="http://"+window.location.host+"/api/v1/dump?disk="+b);a.l("loading "+aa(b)+"...");u(c,a,a.Vb)}}}(this),!0}return!1};
f.ba=function(a,b,c,d){this.a=a;this.J=b;if(this.s=d)wa(d,b,c,this,this.S),N(d,b,c,this,this.W);this.X()};f.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.u=L(b,"debugger"))};
f.Vb=function(a,b,c){if(c)this.l("disk load error ("+c+")");else{c=[];this.l("mounting "+a+"...");try{if(c=eval("("+b+")"),c.length)if(c[0].length){var d=c[0];if(void 0===d[0].trackNum)this.l("data error: "+d[0]);else if(this.g[0]){for(b=0;b<d.length;b++){var e,g=d[b],h=g.sectors;if(void 0===(e=g.trackNum)||void 0===h)throw Error("track "+b+" missing data");e!=b&&v("track "+e+" out of order (expected "+b+")");c=[];var k,l,m;if(e){bb(c,g,"trackSig");cb(c,g);W(c,g,"trackType");for(var r=0;r<h.length;r++){k=
h[r];l=k.sectorData;W(c,k,"sectorSig");W(c,k,"sectorNum");W(c,k,"sectorPages");for(m=0;m<l.length;m++)c.push(l[m]);bb(c,k,"sectorEndSig")}}else for(k=h[0],l=k.sectorData,W(c,g,"trackLoad",2),W(c,k,"sectorPages"),m=0;m<l.length;m++)c.push(l[m]);d[e].Mb=c;this.u&&G(this.u,this.u.Ia)&&this.u.message("track "+e+": "+c.length+" bytes")}this.g[0].Wa=d;this.l("mount of "+a+" complete")}else this.l("no available drives")}else this.l("no tracks: "+a);else this.l("no data: "+a)}catch(I){this.l("disk data error: "+
I.message)}}};function cb(a,b){var c=b.trackNum;if(void 0===c)throw Error("missing bcd value: trackNum");a.push(Math.floor(c/10)<<4|c%10)}function W(a,b,c,d){b=b[c];if(void 0===b)throw Error("missing binary value: "+c);2==d&&a.push(b>>8&255);a.push(b&255)}function bb(a,b,c){b=b[c];if(void 0===b)throw Error("missing signature: "+c);for(c=0;c<b.length;c++)a.push(b.charCodeAt(c))}
function db(a,b,c){b&=63;16>b?b&=3:32>b&&(b&=17);switch(b){case 0:a=a.B.I&4?a.o:a.K;break;case 1:a=a.B;break;case 2:a=a.D.I&4?a.A:a.L;break;case 3:a=a.D;break;case 16:a=c?a.P:a.v;break;case 17:a=a.O;break;default:a=a.R}return a}f.S=function(a,b){if(void 0!==b){var c=db(this,a-this.J,!1);this.u&&S(this.u,this,a,b,this.u.Ia,!1,c.Lb);c.ha()}};
f.W=function(a,b){if(void 0!==b){var c=this.s.S(a),d=db(this,a-this.J,!0);if(this.u&&G(this.u,this.u.Ia|this.u.qb)&&(S(this.u,this,a,b,this.u.Ia,!0,d.Lb),d.Qb))for(var e=128,g=d.I^c;g&&e;)g&e&&this.u.message(" changed "+d.Lb+"."+d.Qb[e]+" to "+(c&e?"1":"0")),e>>=1;d.update(c)}};function Za(a,b,c){var d=-1;void 0!==b&&void 0!==c&&(d=0,c&32||(d|=2),a.o.I&64||(d|=1));a.b!=d&&(a.b=d,a.v.update())}function $a(a){0<=a.b&&(a.g[a.b].Fa=-1,a.O.update(255),a.v.update())}
function ab(a){var b=null;if(0<=a.b){var b=a.g[a.b],c=b.Wa[b.oa];void 0!==c&&(0<=b.Fa&&b.Fa<c.Mb.length?(b.Ga=100,b=c.Mb[b.Fa++],a.O.update(b),a.v.update()):(b.Ga=10,$a(a)))}}function V(a,b,c){a.s.W(b+a.J,c.I)}y(function(){for(var a=F(window.document,"c1pjs","disk"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Xa(d);E(d,c)}});
function eb(a){A.call(this,"C1PDebugger",a);this.u=this;this.L=-1;this.va=0;this.ob=null;this.Za=!1;this.ga=0;this.ta=[];this.xa=[];this.za=[];this.Ma=0;this.ya=[];this.B=[];this.qb=1;this.Aa=16;this.bb=32;this.Ia=64;this.Sb=128;this.ma=this.Z=0;this.Va={port:1,kbd:16,video:32,disk:64,serial:128};this.Ra=28;this.cb=56;this.La="ADC AND ASL BCC BCS BEQ BIT BMI BNE BPL BRK BVC BVS CLC CLD CLI CLV CMP CPX CPY DEC DEX DEY EOR INC INX INY JMP JSR LDA LDX LDY LSR NOP ORA PHA PHP PLA PLP ROL ROR RTI RTS SBC SEC SED SEI STA STX STY TAX TAY TSX TXA TXS TYA SIM .DB".split(" ");
this.V=["HLT","MSG"];fb(this,!0);this.fa=[[10],[34,1,this.D],[this.cb,1],[],[],[34,1,this.b],[2,1,this.b],[],[36],[34,1,this.v],[2,0,this.P],[],[],[34,2,this.N],[2,2,this.N],[],[9,1,this.ea],[34,1,this.J],[],[],[],[34,1,this.g],[2,1,this.g],[],[13],[34,2,this.A],[],[],[],[34,2,this.o],[2,2,this.o],[],[this.Ra,2,this.Qa],[1,1,this.D],[],[],[6,1,this.b],[1,1,this.b],[39,1,this.b],[],[38],[1,1,this.v],[39,0,this.P],[],[6,2,this.N],[1,2,this.N],[39,2,this.N],[],[7,1,this.ea],[1,1,this.J],[],[],[],[1,
1,this.g],[39,1,this.g],[],[44],[1,2,this.A],[],[],[],[1,2,this.o],[39,2,this.o],[],[41],[23,1,this.D],[],[],[],[23,1,this.b],[32,1,this.b],[],[35],[23,1,this.v],[32,0,this.P],[],[27,2,this.Qa],[23,2,this.N],[32,2,this.N],[],[11,1,this.ea],[23,1,this.J],[],[],[],[23,1,this.g],[32,1,this.g],[],[15],[23,2,this.A],[],[],[],[23,2,this.o],[32,2,this.o],[],[42],[0,1,this.D],[],[],[],[0,1,this.b],[40,1,this.b],[],[37],[0,1,this.v],[40,0,this.P],[],[27,2,this.pb],[0,2,this.N],[40,2,this.N],[],[12,1,this.ea],
[0,1,this.J],[],[],[],[0,1,this.g],[40,1,this.g],[],[46],[0,2,this.A],[],[],[],[0,2,this.o],[40,2,this.o],[],[],[47,1,this.D],[],[],[49,1,this.b],[47,1,this.b],[48,1,this.b],[],[22],[],[53],[],[49,2,this.N],[47,2,this.N],[48,2,this.N],[],[3,1,this.ea],[47,1,this.J],[],[],[49,1,this.g],[47,1,this.g],[48,1,this.U],[],[55],[47,2,this.A],[54],[],[],[47,2,this.o],[],[],[31,1,this.v],[29,1,this.D],[30,1,this.v],[],[31,1,this.b],[29,1,this.b],[30,1,this.b],[],[51],[29,1,this.v],[50],[],[31,2,this.N],[29,
2,this.N],[30,2,this.N],[],[4,1,this.ea],[29,1,this.J],[],[],[31,1,this.g],[29,1,this.g],[30,1,this.U],[],[16],[29,2,this.A],[52],[],[31,2,this.o],[29,2,this.o],[30,2,this.A],[],[19,1,this.v],[17,1,this.D],[],[],[19,1,this.b],[17,1,this.b],[20,1,this.b],[],[26],[17,1,this.v],[21],[],[19,2,this.N],[17,2,this.N],[20,2,this.N],[],[8,1,this.ea],[17,1,this.J],[],[],[],[17,1,this.g],[20,1,this.g],[],[14],[17,2,this.A],[],[],[],[17,2,this.o],[20,2,this.o],[],[18,1,this.v],[43,1,this.D],[],[],[18,1,this.b],
[43,1,this.b],[24,1,this.b],[],[25],[43,1,this.v],[33],[],[18,2,this.N],[43,2,this.N],[24,2,this.N],[],[5,1,this.ea],[43,1,this.J],[],[],[],[43,1,this.g],[24,1,this.g],[],[45],[43,2,this.A],[],[],[],[43,2,this.o],[24,2,this.o],[]]}C(eb);f=eb.prototype;
f.T=function(a,b,c){var d=this;switch(b){case "debugInput":return this.R=this.H[b]=c,this.R.focus(),c.onkeypress=function(a,c){return function(d){13==d.keyCode&&(b=c.value,c.value="",gb(a,b))}}(this,c),!0;case "debugEnter":return this.H[b]=c,ea(c,function(){return d.R?(b=d.R.value,gb(d,b),!0):!1}),!0;case "step":return this.H[b]=c,ea(c,function(a){var b=!1;J(d,!0)||(H(d,!0),b=d.step(a?1:0),H(d,!1));return b}),!0}return!1};
f.ba=function(a,b,c){this.a=a;this.O=b;this.ra=c-b+1;this.Ha=this.O+this.ra;this.X()};f.ia=function(a,b){a&&!this.C.M&&(this.C.M=!0,this.s=L(b,"cpu"))};f.ca=function(){this.R.focus()};
function fb(a,b){a.P=0;a.v=1;a.o=2;a.A=3;a.Qa=4;a.pb=5;a.g=6;a.U=7;a.D=8;a.J=9;a.N=10;a.b=11;a.ea=a.Qa;var c="",d,e;if(b)for(a.la="A #$nn $nnnn,X $nnnn,Y $nnnn ($nnnn) $nn,X $nn,Y ($nn,X) ($nn),Y $nnnn $nn".split(" "),d=0;d<a.la.length;d++)e=a.la[d],c+="("+e.replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/nnnn/g,"[0-9A-F][0-9A-F][0-9A-F][0-9A-F]?").replace(/nn/g,"[0-9A-F][0-9A-F]?").replace(/\$/g,"\\$")+"|)";else for(a.la="A nn [nnnn+X] [nnnn+Y] nnnn [nnnn] [nn+X] [nn+Y] [[nn+X]] [[nn]+Y] [nnnn] [nn]".split(" "),
d=0;d<a.la.length;d++)e=a.la[d],c+="("+e.replace(/\[/g,"\\[").replace(/]/g,"\\]").replace(/nnnn/g,"[0-9A-F][0-9A-F][0-9A-F][0-9A-F]?").replace(/nn/g,"[0-9A-F][0-9A-F]?").replace(/\+/g,"\\+")+"|)";a.Re=new RegExp(c);a.Rb=[27,a.Ra,9,7,11,12,3,4,8,5]}f.aa=function(){this.s.aa()};function S(a,b,c,d,e,g,h){(a.ma&e)==e&&(e=a.s.S(c),a.message(b.id+"."+(g?"setByte":"getByte")+"("+q(c)+")"+(void 0!==d?" @"+q(d):"")+": "+(h?h+"=":"")+p(e)))}f.message=function(a){this.l(a);Fa(this.s)};f.Ub=function(){this.l("Type ? for list of debugger commands\n")};
f.wa=function(){if(!hb(this))return!1;this.s.wa();return!0};f.step=function(a){if(!hb(this))return!1;var b;try{b=this.s.step(a)}catch(c){b=void 0,qa(this.s,c.stack||c.message)}void 0!==b&&this.L++;this.s.update(!0);this.update(!0);return b};f.update=function(a){this.va=this.s.f;a||this.Ea?ib(this):jb(this)};function hb(a){a.s&&K(a.s)&&!J(a.s)?(a=a.s,a.C.Da?(a.l(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}
f.reset=function(){var a;this.ya.length||(this.ya=Array(1E3));for(a=0;a<this.ya.length;a++)this.ya[a]=-1;this.B.length||(this.B=Array(256));for(a=0;a<this.B.length;a++)this.B[a]=[a,0];this.L&&this.update();this.L=0};f.start=function(){this.Ea||this.l("running")};f.stop=function(a,b){if(!this.Ea&&(this.l("stopped"),b)){var c=t();this.l(c-a+"ms ("+b+" cycles)")}this.update();this.ca();this.Ea||(this.L=0);kb(this,this.s.f)};function lb(a,b){return a+(b<<24>>24)}
f.S=function(a){var b;a>=this.O&&a<this.Ha&&(ya(this.s,a),b=this.a[this.O+a],b&=255);return b};f.W=function(a,b){a<this.O||a>=this.Ha?this.l("invalid address: "+q(a)):(this.a[this.O+a]=b&255,za(this.s,a),this.s.update())};function mb(a,b){X(a.ta,b,void 0)||a.ta.push(b);return!0}function X(a,b,c){for(var d=!1,e=0;e<a.length;e++)if(a[e]==b){c&&a.splice(e,1);d=!0;break}return d}function nb(a,b){void 0!==b&&(kb(a,a.K),mb(a,b)&&(a.K=b))}
function kb(a,b){void 0!==a.K&&b==a.K&&X(a.ta,a.K,!0)&&(a.K=void 0);a.Ea=!1}function Ea(a,b,c,d){for(var e=!1,g=0;g<c.length;g++)if(c[g]==b){b!=a.K&&a.l("breakpoint hit: "+q(b)+" ("+d+")");e=!0;break}return e}
function ob(a,b,c){var d=n(b,4),e=a.S(b++),g=a.fa[e],h=void 0===e?0:e,k=[],l=void 0===g[1]?0:g[1];do{d+=" "+n(h,2);if(!l--)break;h=a.S(b++);if(void 0===h)break;k.push(h)}while(1);void 0===g[0]&&(g=[57,1,a.v],k.push(e));var d=(d+" ").substr(0,15),d=d+a.La[g[0]],m=null;if(void 0!==g[2]){l=g[2];m=a.la[l];if(1==g[1]&&l==a.ea)m=m.replace(/nnnn/,n(lb(b,h=k.pop()),4));else for(;k.length;)m=m.replace(/nn/,n(h=k.pop(),2));l==a.v&&1==g[1]&&32<=h&&128>h&&(m+=" ;'"+String.fromCharCode(h)+"'")}if(e==a.s.cb&&
(h<a.V.length&&(m=a.V[h]),h==a.s.Ob)){l=0;for(m='"';h=a.S(b++);)16>l?m+=String.fromCharCode(h):16==l&&(m+="\u2026"),l++;m+='"'}m&&(d+=" "+m);c&&(d=(d+" ").substr(0,30),d+=";"+c.toString());a.$=b;return d}
function Y(a,b){var c=a.va;if(void 0!==b){var d=16;"$"==b.charAt(0)?b=b.substr(1):"0x"==b.substr(0,2)?b=b.substr(2):"."==b.charAt(b.length-1)&&(d=10,b=b.substr(0,b.length-1));c=parseInt(b,d);isNaN(c)&&(a.l("invalid base-"+d+" address: "+b),c=void 0)}void 0!==c&&(c<a.O||c>=a.Ha)&&(a.l("address out of range: "+n(c)),c=void 0);return c}
function pb(a,b){if("?"==b)a.l("\nfrequency commands:"),a.l("clear\tclear all frequency counts");else{var c=0,d;if(a.B)if("clear"==b){for(d=0;d<a.B.length;d++)a.B[d]=[d,0];a.l("frequency data cleared");c++}else if(void 0!==b)a.l("unknown frequency command: "+b),c++;else{var e=a.B.slice();e.sort(function(a,b){return b[1]-a[1]});for(d=0;d<e.length;d++){var g=e[d][0],h=e[d][1];h&&(a.l(a.La[a.fa[g][0]]+" ("+p(g)+"): "+h+" times"),c++)}}c||a.l("no frequency data available")}}
function ib(a,b,c,d){var e=Y(a,b);if(void 0!==e){void 0===d&&(d=1);b=a.Ha;if(void 0!==c){b=Y(a,c);if(void 0===b||b<e)return;if(256<b-e){a.l("range too large");return}b++;d=-1}for(e!=a.va&&a.l();d--&&e<b;)c=ob(a,e,J(a,!1)||a.Ea?a.L:0),a.l(c),a.va=e=a.$}}
function jb(a,b){if(b&&"?"==b[1])a.l("\nregister commands:"),a.l("r to display all"),a.l("r [target=value] to modify"),a.l("supported targets:"),a.l("A,X,Y,S,PC and flags C,Z,D,V,N");else{var c=!0;if(void 0!==b&&1<b.length){var c=!1,d=b[1],e=null,g=d.indexOf("=");if(0<g)e=d.substr(g+1),d=d.substr(0,g);else if(2<b.length)e=b[2];else{a.l("missing value for "+b[1]);return}g=parseInt(e,16);if(isNaN(g)){a.l("invalid value: "+e);return}switch(d.toUpperCase()){case "A":a.s.h=g&255;break;case "X":a.s.w=g&
255;break;case "Y":a.s.F=g&255;break;case "C":a.s.c=g?256:0;break;case "Z":a.s.j=g?0:1;break;case "D":g?Ha(a.s):Ia(a.s);break;case "V":g?(d=a.s,d.v=0,d.A=128):(d=a.s,d.v=0,d.A=0);break;case "N":a.s.i=g?128:0;break;case "S":if(256!=(g&-256)){a.l("invalid stack pointer: "+e);return}a.s.G=g;break;case "PC":c=!0;a.s.f=g&65535;a.va=a.s.f;break;default:a.l("unknown register: "+d);return}a.s.update()}a.l("A="+n(a.s.h,2)+" X="+n(a.s.w,2)+" Y="+n(a.s.F,2)+" P="+n(Ca(a.s),2)+" S="+n(a.s.G,4)+" PC="+n(a.s.f,
4));c&&ib(a,n(a.va=a.s.f,4))}}function qb(a,b){var c=void 0===b?1:parseInt(b,10),d=1==c?0:1;da(c,function(a){return function(){return H(a,!0)&&a.step(d)}}(a),function(a){return function(){H(a,!1)}}(a))}
function gb(a,b){b.length||(a.Za?(a.l("ended assemble @"+n(a.ga,4)),a.va=a.ga,a.Za=!1):a.ob&&(b=a.ob));if(K(a)&&!J(a,!0)&&0<b.length){a.Za?b="a "+n(a.ga,4)+" "+b:1<b.length&&1!=b.indexOf(" ")&&(b=b.charAt(0).toLowerCase()+" "+b.substr(1));var c=b.split(" ");a.ob=c[0];switch(c[0].toLowerCase()){case "a":var d=Y(a,c[1]);if(void 0!==d)if(a.ga=d,void 0===c[2])a.l("begin assemble @"+q(a.ga)),a.Za=!0,a.s.update();else{var e,g=c[2],h=c[3],c=a.ga,d=[];if(void 0!==g){var k,g=g.toUpperCase();"?"==g.charAt(g.length-
1)&&(h="?",g=g.substr(0,g.length-1));for(k=0;k<a.La.length&&g!=a.La[k];k++);k==a.La.length&&(a.l("unknown operation: "+g),k=-1);var l="",m;if(0<=k&&void 0!==h)if(l=h.toUpperCase(),"?"==l){for(h=m=0;h<a.fa.length;h++)a.fa[h][0]===k&&(m||a.l("supported opcodes:"),a.l(" "+n(h,2)+": "+g+(void 0!==a.fa[h][2]?" "+a.la[a.fa[h][2]]:"")),m++);k=-1}else if(m=l.match(a.Re),null!==m&&m[0]==l){for(h=1;h<m.length;h++)if(m[h]==l)if(void 0===e)e=h-1;else{a.l("too many operand matches (both "+a.la[e]+" and "+
a.la[h-1]+")");k=-1;break}e==a.Qa&&0>a.Rb.indexOf(k)&&(e=a.N);e==a.pb&&27!=k&&(e=a.N)}else a.l("unknown operand: "+l),k=-1;if(0<=k){m=-1;for(h=0;h<a.fa.length;h++)if(a.fa[h][0]===k&&a.fa[h][2]===e)if(0>m)m=h;else{a.l("too many instruction matches (both "+p(m)+" and "+p(h)+")");m=-2;break}if(0<=m){if(d.push(m),void 0!==e)if(g=a.fa[m][1],l=l.match(/[0-9A-F]+/),null!==l)for(l=parseInt(l[0],16),1==g&&e==a.ea&&(l-=c+2,-128>l||127<l)&&(a.l("branch out of range ("+l+")"),d=[],g=0),h=0;h<g;h++)d.push(l&255),
l>>>=8;else g&&a.l("instruction missing "+g+" bytes")}else a.l("unknown instruction: "+g+" "+l+"")}}e=d;if(e.length){for(c=0;c<e.length;c++)a.W(a.ga+c,e[c]);a.l(ob(a,a.ga));a.ga+=e.length}}break;case "b":e=c[1];c=c[2];if(void 0===e||"?"==e)a.l("\nbreakpoint commands:"),a.l("bp [a]\tset exec breakpoint at [a]"),a.l("br [a]\tset read breakpoint at [a]"),a.l("bw [a]\tset write breakpoint at [a]"),a.l("bc [a]\tclear breakpoint at [a]"),a.l("bl\tlist all breakpoints");else if(void 0===c&&1<e.length&&(c=
e.substr(1),e=e.substr(0,1)),"l"==e){e=0;d=a.ta;for(c=0;c<d.length;c++)a.l("breakpoint enabled: "+q(d[c])+" (exec)"),e++;d=a.xa;for(c=0;c<d.length;c++)a.l("breakpoint enabled: "+q(d[c])+" (read)"),e++;d=a.za;for(c=0;c<d.length;c++)a.l("breakpoint enabled: "+q(d[c])+" (write)"),e++;e||a.l("no breakpoints")}else void 0===c?a.l("missing breakpoint address"):"c"==e&&"*"==c?(a.ta=[],a.xa=[],a.za=[],a.l("all breakpoints cleared")):(c=Y(a,c),void 0!==c&&("p"==e?mb(a,c)?a.l("breakpoint enabled: "+q(c)+" (exec)"):
a.l("breakpoint not set: "+q(c)):"c"==e?X(a.ta,c,!0)?a.l("breakpoint cleared: "+q(c)+" (exec)"):X(a.xa,c,!0)?a.l("breakpoint cleared: "+q(c)+" (read)"):X(a.za,c,!0)?a.l("breakpoint cleared: "+q(c)+" (write)"):a.l("breakpoint missing: "+q(c)):"r"==e?(X(a.xa,c,void 0)||a.xa.push(c),a.l("breakpoint enabled: "+q(c)+" (read)")):"w"==e?(X(a.za,c,void 0)||a.za.push(c),a.l("breakpoint enabled: "+q(c)+" (write)")):a.l("unknown breakpoint command: "+e)));break;case "d":e=c[1];d=c[2];if("?"==e)a.l("\ndump commands:"),
a.l("d [a] [#] dump # lines of memory");else if(e=Y(a,e),void 0!==e){c=0;void 0!==d&&("l"==d.charAt(0)&&(d=d.substr(1)),c=parseInt(d,10));c||(c=1);for(d=0;d<c;d++){l=g="";h=e;for(k=0;8>k&&e<a.Ha;k++)m=a.S(e),void 0===m&&(m=0),g+=n(m,2)+" ",l+=32<=m&&128>m?String.fromCharCode(m):".",e++;a.l(n(h,4)+" "+g+l)}a.va=e}break;case "e":e=c[1];if(void 0===e)a.l("missing address");else if(e=Y(a,e),void 0!==e)for(d=2;d<c.length;d++)g=parseInt(c[d],16),a.W(e++,g);break;case "f":pb(a,c[1]);break;case "g":e=
c[1];void 0!==e&&nb(a,Y(a,e));a.wa()||a.s.ca();break;case "h":a.aa();break;case "o":if(void 0===c[1]||"?"==c[1])a.l("\noption commands:"),a.l("max\trun at maximum speed"),a.l("fast\trun faster (up to "+a.s.Na+"Mhz)"),a.l("slow\trun at normal speed (1Mhz)"),a.l("classic\tuse classic operand syntax"),a.l("modern\tuse modern operand syntax"),a.l("msg\tenable message categories");else switch(e=c[1],e){case "slow":M(a.s,a.s.Sa);break;case "fast":M(a.s,a.s.Pb);break;case "max":M(a.s,a.s.fb);break;case "classic":fb(a,
!0);a.l("classic syntax enabled");break;case "modern":fb(a,!1);a.l("modern syntax enabled");break;case "msg":e=0;void 0!==c[2]&&("all"==c[2]?e=255:void 0!==a.Va[c[2]]&&(e=a.Va[c[2]]),e&&("on"==c[3]?a.ma|=e:"off"==c[3]&&(a.ma&=~e)));for(d in a.Va)if(void 0===c[2]||"all"==c[2]||c[2]==d)e=a.Va[d],a.l(d+" messages: "+(a.ma&e?"on":"off"));break;default:a.l("unknown option: "+e)}break;case "p":l=c[1];e=10;c=a.Ma;d=a.ya;if(void 0!==d){g=void 0===l?a.Wb:parseInt(l,10);void 0===g&&(g=10);g>d.length&&(a.l("note: only "+
d.length+" available"),g=d.length);void 0!==l&&(a.nb=0,a.l(g+" instructions earlier:"));l=a.nb?a.nb:1;c-=g;for(0>c&&(c=d.length-1);e&&c!=a.Ma;){h=d[c];if(0>h)break;a.l(ob(a,h,l++));++c==d.length&&(c=0);e--;g--}a.Wb=g;a.nb=l}10==e&&a.l("no history available");break;case "r":jb(a,c);break;case "s":a.S(a.s.f)==a.s.Ra?(nb(a,a.s.f+3),a.Ea=!0,a.wa()||a.s.ca()):qb(a);break;case "t":qb(a,c[1]);break;case "u":ib(a,c[1],c[2],8);break;case "?":case "help":a.l("\ncommands:\n?\thelp\na [#]\tassemble\nb [#]\tbreakpoint\nd [#]\tdump memory\ne [#]\tedit memory\nf\tdump frequencies\ng [#]\trun to [#]\nh\thalt\no\toptions\np [#]\tdump history\nr\tdump/edit registers\ns\tstep over instruction\nt [#]\tstep instruction(s)\nu [#]\tunassemble");
a.l("note: frequency and history commands operate only when breakpoints are set");break;default:a.l("unknown command: "+b)}}}y(function(){for(var a=F(window.document,"c1pjs","debugger"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new eb(d);E(d,c)}});function Z(a,b){A.call(this,"C1PComputer",a);this.Y=b}C(Z);Z.prototype.reset=function(a){var b=null,c;for(c in this.Y)for(var d=0;d<this.Y[c].length;d++){var e=this.Y[c][d];e&&e.reset&&(e.reset(),"cpu"==c&&(b=e))}b&&(b.update(),a&&b.wa())};
Z.prototype.start=function(){for(var a in this.Y)if("cpu"!=a)for(var b=0;b<this.Y[a].length;b++){var c=this.Y[a][b];c&&c.start&&c.start()}};Z.prototype.stop=function(a,b){for(var c in this.Y)if("cpu"!=c)for(var d=0;d<this.Y[c].length;d++){var e=this.Y[c][d];e&&e.stop&&e.stop(a,b)}};Z.prototype.T=function(a,b,c){switch(b){case "reset":return this.H[b]=c,c.onclick=function(a){return function(){a.reset()}}(this),!0}return!1};function L(a,b){return a.Y[b]?a.Y[b][0]:null}
function rb(a){var b=null,c;for(c in a.Y)for(var d=0;d<a.Y[c].length;d++){var e=a.Y[c][d];if(e){if(!K(e)){K(e,function(a){return function(){rb(a)}}(a));return}"cpu"==c?b=e:e.ia&&e.ia(!0,a)}}a.X();a.l("C1Pjs v1.19.4\nCopyright \u00a9 2012-2015 Jeff Parsons <Jeff@pcjs.org>");b&&b.ia(!0,a)}
y(function(){for(var a=F(window.document,"c1pjs","computer"),b=0;b<a.length;b++){for(var c=a[b],d=D(c),e,g={},h,k=0,l=0,m=0;m<d.modules.length;m++){var r=d.modules[m];if(!m){if("cpu"!=r.type)break;k=r.start;l=r.end;h=Array(l+1-k);for(e=k;e<h.length;e++)h[e]=0}if(e=pa(r.refID,d.id)){var I=r.type;void 0===g[I]&&(g[I]=[]);g[I].push(e);e.ba&&void 0!==r.start&&e.ba(h,r.start,r.end,g.cpu[0])}else{v('no component for <module refid="'+r.refID+'">');return}}if(void 0===h){v('<module type="cpu"> definition must appear first in the <computer> specification');
break}if(e=pa("debugger",d.id))g["debugger"]=[e],e.ba&&e.ba(h,k,l,g.cpu[0]);k=new Z(d,g);if(l=pa("panel",d.id))if(g.panel=[l],l.hb){e=d.id;d=void 0;g=[];e&&(e=0<(d=e.indexOf("."))?e.substr(0,d+1):"");for(d=0;d<B.length;d++)m=B[d],e&&m.id.indexOf(e)||g.push(m);d=g;for(g=0;g<d.length;g++)e=d[g],e!=l&&(e.ab=l.ab,e.l=l.l,e.hb=l.hb)}E(k,c);rb(k)}});var sb=0;function tb(a,b,c,d,e,g){e("Loading "+a+"...");u(a,null,function(h,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),g(k,null)):ub(k,a,b,c,d,e,g)})}
function ub(a,b,c,d,e,g,h){function k(a,g){if(g)h(g,null);else{if(c){var k=b;k&&0>k.indexOf("/")&&(k=window.location.pathname+k);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" state=$2"+d+"$2":"")+(k?" url=$2"+k+"$2":""))}k=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(k=new window.ActiveXObject("Microsoft.XMLDOM"),k.async=!1,k.loadXML(a)):k=(new window.DOMParser).parseFromString(a,"text/xml")}catch(I){k=
null,a=I.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,k)}}a?e?vb(a,g,k):k(a,null):h("no data"+(b?" for file: "+b:""),null)}
function vb(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");u(e,null,function(g,h,k){if(k||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(g=d[3])if(k=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,r=/( [a-z]+=)(['"])(.*?)\2/g;m=r.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(h=h.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],h);vb(a,b,c)}})}else c(a,null)}
function wb(a,b,c){function d(a){if(void 0===h){var b=g&&F(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ca(a))}function e(a){d("Error: "+a);k&&(--sb||z(!0));k=!1}var g,h,k=!0;sb++;try{if(g=window.document.getElementById(a)){c||(c="/versions/c1pjs/1.19.4/components.xsl");var l=function(h,k){if(k){var l=function(h,l){if(l)if(l)if(d("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=k.transformNode(l);m?(g.outerHTML=m,--sb||z(!0)):e("transformNodeToObject failed")}else window.document.implementation&&
window.document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(k,window.document))?g.parentNode?(g.parentNode.replaceChild(m,g),--sb||z(!0)):e("invalid machine element: "+a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser");else e("failed to load XSL file: "+c);else e(h)};k?tb(c,null,null,!1,d,l):e("failed to load XML file: "+b)}else e(h)};"<"!=b.charAt(0)?tb(b,a,void 0,!0,d,l):ub(b,null,a,void 0,!1,d,l)}else e("missing machine element: "+
a)}catch(m){e(m.message)}return k}window.embedC1P=function(a,b,c){z(!1);return wb(a,b,c)};window.enableEvents=z;window.sendEvent=ja;})();

View file

@ -0,0 +1,125 @@
(function(){var e;function n(a,b){var c="";void 0===b?b=8:8<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}var ba={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ca(a){return a.replace(/[&<>"']/g,function(a){return ba[a]})}var q=Date.now||function(){return+new Date};
function r(a,b,c){var d;d=!0;var f=0,g=null,k=aa(a),h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(h.onreadystatechange=function(){4===h.readyState&&(g=h.responseText,200==h.status||!h.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),c&&(b?c.call(b,k,g,f,void 0):c(k,g,f,void 0)))});h.open("GET",a,d);h.send();d||(g=h.responseText,200!=h.status&&(f=h.status||-1),c&&(b?c.call(b,k,g,f,void 0):c(k,g,f,void 0)))}
function t(a){window&&window.alert(a)}function u(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},da=!1,w=!0;function x(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function y(a){v.init.push(a)}
function z(a){if(w)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function A(a){!w&&a?(w=!0,da&&ea("init")):w=a}function ea(a){v[a]&&z(v[a])}x("onload",function(){da=!0;z(v.init)});x("onpageshow",function(){z(v.show)});x(u("Opera")||u("iOS")?"onunload":"onbeforeunload",function(){z(v.exit)});
function B(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Ea=this.id.substr(0,b),this.Da=this.id.substr(b+1)):this.Da=this.id;this[a]=c;this.u={wa:!1,qa:!1,Ba:!1,H:!1,ra:!1};this.ya=null;this.u.ra=!1;this.A={};C[C.length]=this}var fa=void 0;if(window){fa||(fa=window.location.search.substr(1));for(var ga,ha=/\+/g,ia=/([^&=]+)=?([^&]*)/g;ga=ia.exec(fa);)ga[1].replace(ha," "),ga[2].replace(ha," ")}
function ja(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}function E(a){var b;b||(b=B);a.prototype=ja(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var C=[];function F(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<C.length;c++)if(C[c].id===a)return C[c]}return null}
function G(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("({"+a+"})")}catch(c){t(c.message+" ("+a+")")}return b}window&&!window.document.ELEMENT_NODE&&(window.document.ELEMENT_NODE=1);
function H(a,b){for(var c=I(b.parentNode,"c1pjs-control"),d=0;d<c.length;d++)for(var f=c[d].childNodes,g=0;g<f.length;g++){var k=f[g];if(k.nodeType===window.document.ELEMENT_NODE){var h=k.getAttribute("class");if(h)for(var l=h.split(" "),m=0;m<l.length;m++)switch(h=l[m],h){case "c1pjs-binding":(h=G(k))&&h.binding&&a.J(h.type,h.binding,k),m=l.length}}}}
function I(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
B.prototype={constructor:B,parent:null,toString:function(){return this.name?this.name:this.id||this.type},J:function(a,b,c){switch(b){case "clear":return this.A[b]||(this.A[b]=c,c.onclick=function(a){return function(){a.A.print&&(a.A.print.value="")}}(this)),!0;case "print":return this.A[b]||(this.za=this.A[b]=c,c.value="",this.F=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.xa=function(a,b,c){this.F(a,"notice",c)}),!0;default:return!1}},log:function(){},F:function(){},status:function(a){this.F(this.Da+": "+a)},xa:function(a,b){b||t(a)},N:function(a){this.u.ra||(this.u.wa=!1!==a,this.u.wa&&(a=this.ya,this.ya=null,a&&a()))}};function ka(a,b){if(a.u.Ba)return a.u.qa&&(a.u.qa=!1),a.u.Ba=!1;if(a.u.ra)return a.F(a.toString()+" error"),!1;a.u.qa=b;return a.u.qa}function J(a,b){b&&(a.u.wa?b():a.ya=b);return a.u.wa}function la(a,b){a.u.ra=!0;a.xa(b)}
function K(a){B.call(this,"C1PPanel",a);this.u.H=!1}E(K);K.prototype.J=function(a,b,c){return this.I&&this.I.J(a,b,c)||this.f&&this.f.J(a,b,c)||this.b&&this.b.J(a,b,c)?!0:B.prototype.J.call(this,a,b,c)};K.prototype.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.f=L(b,"cpu"),this.b=L(b,"keyboard"),ma())};function ma(){for(var a=!1,b=I(window.document,"c1pjs","panel"),c=0;c<b.length;c++){var d=b[c],f=G(d),g=F(f.id);g||(a=!0,g=new K(f));H(g,d);a&&g.N()}}y(ma);
function na(a){B.call(this,"C1PCPU",a);oa(this);this.u.H=!1;this.u.$=!1;this.ta=a.autoStart;this.ja=0;this.Ca=2;this.speed=this.ja;this.pa=30;this.oa=5;this.fa=8;this.ua=["Slow","Fast","Max"];this.fb=["(1Mhz)","(up to "+this.fa+"Mhz)","(unlimited)"];this.O=[];this.K=[];this.ka=65536;this.la=0;this.Z=65536;this.da=0;this.v=[this.Mb,this.ed,this.Xd,this.l,this.l,this.gd,this.Cb,this.l,this.kd,this.dd,this.Bb,this.l,this.l,this.ad,this.zb,this.l,this.Lb,this.fd,this.l,this.l,this.l,this.hd,this.Db,this.l,
this.Pb,this.cd,this.l,this.l,this.l,this.bd,this.Ab,this.l,this.Cc,this.vb,this.l,this.l,this.Ib,this.xb,this.qd,this.l,this.md,this.ub,this.pd,this.l,this.Hb,this.rb,this.nd,this.l,this.Jb,this.wb,this.l,this.l,this.l,this.yb,this.rd,this.l,this.Hd,this.tb,this.l,this.l,this.l,this.sb,this.od,this.l,this.xd,this.qc,this.l,this.l,this.l,this.sc,this.Yc,this.l,this.jd,this.pc,this.Xc,this.l,this.Bc,this.mc,this.Vc,this.l,this.Nb,this.rc,this.l,this.l,this.l,this.tc,this.Zc,this.l,this.Rb,this.oc,
this.l,this.l,this.l,this.nc,this.Wc,this.l,this.yd,this.Pa,this.l,this.l,this.l,this.Ra,this.vd,this.l,this.ld,this.Oa,this.ud,this.l,this.Ac,this.La,this.sd,this.l,this.Ob,this.Qa,this.l,this.l,this.l,this.Sa,this.wd,this.l,this.Jd,this.Na,this.l,this.l,this.l,this.Ma,this.td,this.l,this.l,this.Nd,this.l,this.l,this.Vd,this.Pd,this.Sd,this.l,this.lc,this.l,this.ae,this.l,this.Ud,this.Kd,this.Rd,this.l,this.Eb,this.Od,this.l,this.l,this.Wd,this.Qd,this.Td,this.l,this.ce,this.Md,this.be,this.l,this.l,
this.Ld,this.l,this.l,this.Sc,this.Hc,this.Nc,this.l,this.Tc,this.Jc,this.Oc,this.l,this.Zd,this.Gc,this.Yd,this.l,this.Qc,this.Dc,this.Lc,this.l,this.Fb,this.Ic,this.l,this.l,this.Uc,this.Kc,this.Pc,this.l,this.Sb,this.Fc,this.$d,this.l,this.Rc,this.Ec,this.Mc,this.l,this.ec,this.Xb,this.l,this.l,this.fc,this.Zb,this.ic,this.l,this.zc,this.Wb,this.kc,this.l,this.dc,this.Tb,this.gc,this.l,this.Kb,this.Yb,this.l,this.l,this.l,this.$b,this.jc,this.l,this.Qb,this.Vb,this.l,this.l,this.l,this.Ub,this.hc,
this.l,this.bc,this.Xa,this.l,this.l,this.cc,this.Za,this.wc,this.l,this.yc,this.Wa,this.$c,this.l,this.ac,this.Ta,this.uc,this.l,this.Gb,this.Ya,this.l,this.l,this.l,this.$a,this.xc,this.l,this.Id,this.Va,this.l,this.l,this.l,this.Ua,this.vc,this.l];this.eb=[7,6,0,0,0,3,5,0,3,2,2,0,0,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,3,6,0,0,3,3,5,0,4,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,3,2,2,0,3,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,4,2,2,0,5,4,6,0,2,5,0,0,0,4,6,0,2,
4,0,0,0,4,7,0,0,6,0,0,3,3,3,0,2,0,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,0,4,0,0,2,6,2,0,3,3,3,0,2,2,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,4,4,4,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0]}E(na);e=na.prototype;e.reset=function(a){this.u.$&&M(this);oa(this);this.c=this.a[65532]|this.a[65533]<<8;this.u.ra=!1;a&&(!0===this.ta||null===this.ta&&void 0===this.A.run)&&N(this)};
e.J=function(a,b,c){a=!1;switch(b){case "run":this.A[b]=c;c.onclick=function(a){return function(){a.u.$?M(a):N(a)}}(this);a=!0;break;case "A":case "X":case "Y":case "S":case "PC":case "C":case "Z":case "I":case "D":case "B":case "V":case "N":case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(a){return function(){pa(a,2<=a.speed?a.ja:a.speed+1,!0)}}(this),a=!0}return a};e.Y=function(a,b){this.a=a;(this.Ia=b)?t("unsupported CPU address buffer offset ("+this.Ia+")"):this.N()};
e.aa=function(a,b){if(a&&!this.u.H){this.I=b;var c=L(b,"video");c&&(this.Aa=function(a){return function(){qa(a)}}(c),this.ea=function(a){return function(){a.ea()}}(c));this.u.H=!0;this.reset(!0);this.update()}};function ra(a,b,c,d,f){0>sa(a.O,b,c,d,f)&&(a.ka>b&&(a.ka=b),a.la<c&&(a.la=c),a.O.push([b,c,d,f]))}function O(a,b,c,d,f){0>sa(a.K,b,c,d,f)&&(a.Z>b&&(a.Z=b),a.da<c&&(a.da=c),a.K.push([b,c,d,f]))}
function sa(a,b,c,d,f){for(var g=0;g<a.length;g++)if(a[g][0]==b&&a[g][1]==c&&a[g][2]==d&&a[g][3]==f)return g;return-1}function pa(a,b,c){void 0!==b&&(a.speed=b,a.A.setSpeed&&(a.A.setSpeed.innerHTML=a.ua[2<=b?0:b+1]),a.F("running at "+a.ua[b].toLowerCase()+" speed "+a.fb[b]),c&&a.ea());a.S=0;a.Fa=q();ta(a)}e.Aa=function(){};e.ea=function(){};function P(a,b,c,d){void 0!==a.A[b]&&(void 0===d&&(d=1),c="0000"+c.toString(16),a.A[b].innerHTML=c.slice(c.length-d).toUpperCase())}
function ua(a){P(a,"A",a.g,2);P(a,"X",a.m,2);P(a,"Y",a.s,2);var b=va(a);P(a,"C",b&1?1:0);P(a,"Z",b&2?1:0);P(a,"I",b&4?1:0);P(a,"D",b&8?1:0);P(a,"B",b&16?1:0);P(a,"V",b&64?1:0);P(a,"N",b&128?1:0);P(a,"S",a.o,4);P(a,"PC",a.c,4);a.A.speed&&a.ca&&(a.A.speed.innerHTML=a.ca.toFixed(1)+"Mhz")}
function ta(a,b){var c=30;c<a.pa&&(c=a.pa);c<a.oa&&(c=a.oa);var d=1;b&&a.speed>a.ja&&a.ca&&(d=a.ca);d>a.fa&&2>a.speed&&(d=a.fa);a.gb=Math.round(1E3/30);a.ga=Math.floor(1E6/c*d);a.ma=Math.floor(1E6/30*d);a.Ha=Math.floor(1E6/a.pa*d);a.Ga=Math.floor(1E6/a.oa*d);b||(a.R=a.ma,a.U=a.Ha,a.T=a.Ga);a.na=0}function wa(a){1E6<=a.na&&ta(a,!0);a.V=0;a.hb=q()}
function xa(a){var b=q(),c=a.gb;a.V&&(c=Math.round(c*a.V/a.ma));c=c-(b-a.hb);if(b=b-a.Fa)a.ca=Math.round(a.S/(100*b))/10,864E5<=b&&pa(a);0>c?c=0:1==a.speed?a.ca<=a.fa&&(c=0):2==a.speed&&(c=0);a.na+=a.V;return c}
function N(a){if(ka(a,!0)){a.u.$||(pa(a),a.I&&a.I.start(),a.u.$=!0,a.A.run&&(a.A.run.innerHTML="Halt"),a.ea());wa(a);try{do{a.step(a.ga);var b=a.L-a.G;a.S+=b;a.V+=b;a.L=a.G=0;a.U-=a.ga;0>=a.U&&(a.U+=a.Ha,a.Aa());a.T-=a.ga;0>=a.T&&(a.T+=a.Ga,ua(a));a.R-=a.ga;if(0>=a.R){a.R+=a.ma;break}}while(a.u.$)}catch(c){M(a);a.update();ka(a,!1);la(a,c.stack||c.message);return}setTimeout(function(a){return function(){N(a)}}(a),xa(a))}else a.update(),a.I&&a.I.stop(a.Fa,a.S)}
e.step=function(a){this.b=this.j=-1;this.L=this.G=a;do{a=this.a[this.c];this.c++;this.v[a].call(this);if(0<=this.b){if(this.b>=this.ka&&this.b<=this.la)for(var b=this.b,c=this.c,d=0;d<this.O.length;d++)b>=this.O[d][0]&&b<=this.O[d][1]&&this.O[d][3].call(this.O[d][2],b,c);this.b=-1}else if(0<=this.j){if(this.j>=this.Z&&this.j<=this.da)for(b=this.j,c=this.c,d=0;d<this.K.length;d++)b>=this.K[d][0]&&b<=this.K[d][1]&&this.K[d][3].call(this.K[d][2],b,c);this.j=-1}this.G-=this.eb[a]}while(0<this.G);return!0};
function M(a){a.u.qa&&(a.u.Ba=!0);a.L-=a.G;a.G=0;a.u.$&&(a.u.$=!1,a.A.run&&(a.A.run.innerHTML="Run"))}e.update=function(){this.Aa();ua(this)};function ya(a){return a.u.$?a.S+a.L-a.G:0}e.W=function(a){return this.a[a]};e.P=function(a,b){this.a[a]=b};function va(a){var b=a.f&256?1:0,b=b|(a.i&255?0:2),b=b|((a.w&255^a.C^a.w>>1)&128?64:0),b=b|(a.h&128?128:0);return a.B&60|b}
function Q(a,b,c){var d=a.f&256?1:0,f=(b&15)+(c&15)+d;10<=f&&(f=f+6&15|16);f+=(b&240)+(c&240);a.C=b^c;a.w=f;a.h=f&255;160<=f&&(f+=96);512<=f&&(f-=256);a.f=f;a.i=b+c+d&255;a.G--;return f&255}function R(a,b,c){var d=a.f&256?0:1,f=(b&15)-(c&15)-d;0>f&&(f=(f-6&15)-16);f+=(b&240)-(c&240);0>f&&(f-=96);a.h=a.i=(a.f=b-c-d)&255;a.C=b^c;a.w=a.f;a.f^=256;a.G--;return f&255}function oa(a){a.g=0;a.m=0;a.s=0;a.o=256;a.B=0;a.h=0;a.i=0;a.C=0;a.w=0;a.f=0;a.c=0;a.b=-1;a.j=-1;a.ca=0;a.S=a.L=a.G=0}
e.Mb=function(){this.c++;this.a[this.o--]=this.c>>8;this.o|=256;this.a[this.o--]=this.c&255;this.o|=256;this.B|=16;this.B=va(this);this.a[this.o--]=this.B;this.o|=256;this.B&=239;this.b=65534;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.ed=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g|=this.a[this.b]};e.gd=function(){this.b=this.a[this.c++];this.h=this.i=this.g|=this.a[this.b]};
e.Cb=function(){this.j=this.a[this.c++];this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.kd=function(){this.B=va(this);this.a[this.o--]=this.B;this.o|=256};e.dd=function(){this.b=this.c++;this.h=this.i=this.g|=this.a[this.b]};e.Bb=function(){this.f=this.g<<1;this.h=this.i=this.g=this.f&255};e.ad=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g|=this.a[this.b]};
e.zb=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Lb=function(){this.c+=(this.h&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.fd=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g|=this.a[this.b]};e.hd=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g|=this.a[this.b]};
e.Db=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Pb=function(){this.f=0};e.cd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g|=this.a[this.b]};e.bd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g|=this.a[this.b]};e.Ab=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};
e.Cc=function(){this.b=this.c++;this.a[this.o--]=this.c>>8;this.o|=256;this.a[this.o--]=this.c&255;this.o|=256;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.vb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g&=this.a[this.b]};e.Ib=function(){this.b=this.a[this.c++];this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.xb=function(){this.b=this.a[this.c++];this.h=this.i=this.g&=this.a[this.b]};
e.qd=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.md=function(){this.o=this.o+1&255|256;this.B=this.a[this.o];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0};e.ub=function(){this.b=this.c++;this.h=this.i=this.g&=this.a[this.b]};
e.pd=function(){this.f=this.f&65280|this.g;this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.g=this.f&255};e.Hb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.rb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g&=this.a[this.b]};
e.nd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Jb=function(){this.c+=(this.h&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.wb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g&=this.a[this.b]};e.yb=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g&=this.a[this.b]};
e.rd=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Hd=function(){this.f=256};e.tb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g&=this.a[this.b]};e.sb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g&=this.a[this.b]};
e.od=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.xd=function(){this.o=this.o+1&255|256;this.B=this.a[this.o];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0;this.o=this.o+2&255|256;this.c=this.a[this.o-1|256]|this.a[this.o]<<8};
e.qc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g^=this.a[this.b]};e.sc=function(){this.b=this.a[this.c++];this.h=this.i=this.g^=this.a[this.b]};e.Yc=function(){this.j=this.a[this.c++];this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};e.jd=function(){this.a[this.o--]=this.g;this.o|=256};e.pc=function(){this.b=this.c++;this.h=this.i=this.g^=this.a[this.b]};
e.Xc=function(){this.f=this.f&65279|(this.g&1?256:0);this.g=(this.f=this.f&65280|this.g>>1)&255;this.h=this.i=this.f&255};e.Bc=function(){this.b=this.c;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.mc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g^=this.a[this.b]};e.Vc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Nb=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.rc=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g^=this.a[this.b]};e.tc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g^=this.a[this.b]};e.Zc=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Rb=function(){this.B&=251};e.oc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g^=this.a[this.b]};e.nc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g^=this.a[this.b]};e.Wc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.yd=function(){this.o=this.o+2&255|256;this.c=(this.a[this.o-1|256]|this.a[this.o]<<8)+1};e.Pa=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.nb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=Q(this,this.g,this.a[this.b])};
e.Ra=function(){this.b=this.a[this.c++];this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.pb=function(){this.b=this.a[this.c++];this.g=Q(this,this.g,this.a[this.b])};e.vd=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.ld=function(){this.o=this.o+1&255|256;this.h=this.i=this.g=this.a[this.o]};
e.Oa=function(){this.b=this.c++;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.mb=function(){this.b=this.c++;this.g=Q(this,this.g,this.a[this.b])};e.ud=function(){this.f=this.f&65280|this.g;this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.g=this.f&255};e.Ac=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.c=this.a[this.b]|this.a[this.b+1]<<8};
e.La=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.jb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=Q(this,this.g,this.a[this.b])};e.sd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};
e.Ob=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Qa=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.ob=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.g=Q(this,this.g,this.a[this.b])};
e.Sa=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.qb=function(){this.b=this.a[this.c++]+this.m&255;this.g=Q(this,this.g,this.a[this.b])};e.wd=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Jd=function(){this.B|=4};
e.Na=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.lb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.g=Q(this,this.g,this.a[this.b])};e.Ma=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};
e.kb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=Q(this,this.g,this.a[this.b])};e.td=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Nd=function(){this.j=this.a[this.c++]+this.m&255;this.j=this.a[this.j]|this.a[this.j+1]<<8;this.a[this.j]=this.g};e.Vd=function(){this.j=this.a[this.c++];this.a[this.j]=this.s};
e.Pd=function(){this.j=this.a[this.c++];this.a[this.j]=this.g};e.Sd=function(){this.j=this.a[this.c++];this.a[this.j]=this.m};e.lc=function(){this.h=this.i=this.s=this.s-1&255};e.ae=function(){this.h=this.i=this.g=this.m};e.Ud=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.s};e.Kd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.g};e.Rd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.m};
e.Eb=function(){this.c+=(this.f&256?0:(this.G--,this.a[this.c]<<24>>24))+1};e.Od=function(){this.j=this.a[this.c++];this.j=(this.a[this.j]|this.a[this.j+1]<<8)+this.s;this.a[this.j]=this.g};e.Wd=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.s};e.Qd=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.g};e.Td=function(){this.j=this.a[this.c++]+this.s&255;this.a[this.j]=this.m};e.ce=function(){this.h=this.i=this.g=this.s};
e.Md=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.a[this.j]=this.g};e.be=function(){this.o=this.m|256};e.Ld=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.a[this.j]=this.g};e.Sc=function(){this.b=this.c++;this.h=this.i=this.s=this.a[this.b]};e.Hc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g=this.a[this.b]};e.Nc=function(){this.b=this.c++;this.h=this.i=this.m=this.a[this.b]};
e.Tc=function(){this.b=this.a[this.c++];this.h=this.i=this.s=this.a[this.b]};e.Jc=function(){this.b=this.a[this.c++];this.h=this.i=this.g=this.a[this.b]};e.Oc=function(){this.b=this.a[this.c++];this.h=this.i=this.m=this.a[this.b]};e.Zd=function(){this.h=this.i=this.s=this.g};e.Gc=function(){this.b=this.c++;this.h=this.i=this.g=this.a[this.b]};e.Yd=function(){this.h=this.i=this.m=this.g};e.Qc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.s=this.a[this.b]};
e.Dc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g=this.a[this.b]};e.Lc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.m=this.a[this.b]};e.Fb=function(){this.c+=(this.f&256?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Ic=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g=this.a[this.b]};e.Uc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.s=this.a[this.b]};
e.Kc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g=this.a[this.b]};e.Pc=function(){this.b=this.a[this.c++]+this.s&255;this.h=this.i=this.m=this.a[this.b]};e.Sb=function(){this.C=this.w=0};e.Fc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g=this.a[this.b]};e.$d=function(){this.h=this.i=this.m=this.o&255};e.Rc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.s=this.a[this.b]};
e.Ec=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g=this.a[this.b]};e.Mc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.m=this.a[this.b]};e.ec=function(){this.b=this.c++;this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Xb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.fc=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Zb=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.ic=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.zc=function(){this.h=this.i=this.s=this.s+1&255};e.Wb=function(){this.b=this.c++;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.kc=function(){this.h=this.i=this.m=this.m-1&255};
e.dc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Tb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.gc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.Kb=function(){this.c+=(this.i&255?(this.G--,this.a[this.c]<<24>>24):0)+1};
e.Yb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.$b=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.jc=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};
e.Qb=function(){this.B&=-9;this.v[97]=this.Pa;this.v[101]=this.Ra;this.v[105]=this.Oa;this.v[109]=this.La;this.v[113]=this.Qa;this.v[117]=this.Sa;this.v[121]=this.Na;this.v[125]=this.Ma;this.v[225]=this.Xa;this.v[229]=this.Za;this.v[233]=this.Wa;this.v[237]=this.Ta;this.v[241]=this.Ya;this.v[245]=this.$a;this.v[249]=this.Va;this.v[253]=this.Ua};e.Vb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.Ub=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.hc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.bc=function(){this.b=this.c++;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Xa=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Dd=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=R(this,this.g,this.a[this.b])};e.cc=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Za=function(){this.b=this.a[this.c++];this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Fd=function(){this.b=this.a[this.c++];this.g=R(this,this.g,this.a[this.b])};e.wc=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.yc=function(){this.h=this.i=this.m=this.m+1&255};
e.Wa=function(){this.b=this.c++;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Cd=function(){this.b=this.c++;this.g=R(this,this.g,this.a[this.b])};e.$c=function(){};e.ac=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Ta=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.zd=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=R(this,this.g,this.a[this.b])};e.uc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.Gb=function(){this.c+=(this.i&255?0:(this.G--,this.a[this.c]<<24>>24))+1};
e.Ya=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Ed=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.g=R(this,this.g,this.a[this.b])};
e.$a=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Gd=function(){this.b=this.a[this.c++]+this.m&255;this.g=R(this,this.g,this.a[this.b])};e.xc=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Id=function(){this.B|=8;this.v[97]=this.nb;this.v[101]=this.pb;this.v[105]=this.mb;this.v[109]=this.jb;this.v[113]=this.ob;this.v[117]=this.qb;this.v[121]=this.lb;this.v[125]=this.kb;this.v[225]=this.Dd;this.v[229]=this.Fd;this.v[233]=this.Cd;this.v[237]=this.zd;this.v[241]=this.Ed;this.v[245]=this.Gd;this.v[249]=this.Bd;this.v[253]=this.Ad};
e.Va=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Bd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.g=R(this,this.g,this.a[this.b])};
e.Ua=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Ad=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=R(this,this.g,this.a[this.b])};e.vc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Xd=function(){var a;a=this.a[this.c++];switch(a){case 0:this.F("HALT");M(this);break;case 1:a=this.c;for(var b="";a<this.a.length;){var c=this.a[a++];if(!c)break;b+=String.fromCharCode(c)}this.c=a;b=b.replace(/%A/g,n(this.g,2)).replace(/%X/g,n(this.m,2)).replace(/%Y/g,n(this.s,2));this.F(b);this.R=0;this.L-=this.G;this.G=0;break;default:this.c-=2,this.F("undefined opSim: 0x"+n(a,2)+" at "+("0x"+n(this.c,4))),M(this)}};
e.l=function(){var a=this.a[--this.c];this.F("undefined opcode: 0x"+n(a,2)+" at "+("0x"+n(this.c,4)));M(this)};y(function(){for(var a=I(window.document,"c1pjs","cpu"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new na(d);H(d,c)}});
function S(a){B.call(this,"C1PROM",a);this.b=this.a=null;this.c=a.size;if(this.g=a.image){a=this.g;var b;b=this.g;var c="",d=b.lastIndexOf(".");0<=d&&(c=b.substr(d+1).toLowerCase());b=c;"json"!=b&&"hex"!=b&&(a="http://"+(window?window.location.host:"www.pcjs.org")+"/api/v1/dump?file="+this.g+"&format=bytes");r(a,this,this.i)}}E(S);
S.prototype.Y=function(a,b,c,d){this.a=a;this.h=b;a=c-b+1;this.c||(this.c=a);a!=this.c?la(this,"computer-specified ROM size (0x"+n(a,4)+") does not match component-specified size ("+("0x"+n(this.c,4))+")"):(d&&(this.f=d,O(d,b,c,this,this.P)),za(this))};S.prototype.aa=function(a){a&&!this.u.H&&(this.u.H=!0)};S.prototype.P=function(a,b){if(void 0!==b){var c=a-this.h;this.a[this.h+c]=this.b?this.b[c]:0}};
S.prototype.i=function(a,b,c){if(c)this.F('Error loading ROM "'+a+'" ('+c+")");else{if("["==b.charAt(0)||"{"==b.charAt(0))try{var d=eval("("+b+")"),f=d.bytes;f?this.b=f:this.b=d}catch(g){this.F('Error processing ROM "'+a+'": '+g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.b=Array(a.length),b=0;b<a.length;b++)this.b[b]=parseInt(a[b],16);za(this)}};
function za(a){if(!J(a))if(!a.g)a.N();else if(a.b&&a.a){var b=a.b.length;if(b!=a.c)la(a,"ROM image size (0x"+n(b,4)+") does not match component-specified size ("+("0x"+n(a.c,4))+")");else{for(var c=0;c<b;c++)a.a[a.h+c]=a.b[c];a.N()}}}y(function(){for(var a=I(window.document,"c1pjs","rom"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new S(d);H(d,c)}});function Aa(a){B.call(this,"C1PRAM",a)}E(Aa);Aa.prototype.Y=function(a){this.a=a;this.N()};
y(function(){for(var a=I(window.document,"c1pjs","ram"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Aa(d);H(d,c)}});
function Ba(a){B.call(this,"C1PKeyboard",a);this.u.H=!1;this.fa=a.model;this.L=8;this.oa=10;this.na=13;this.O=27;this.la=this.L;this.ma=this.oa;this.ga=this.na;this.K=this.O;this.v=241;this.G=224;this.ja=3;this.ka=15;this.o=1;this.m=[];this.m["break"]=this.G;this.m.esc=this.K;this.m["ctrl-c"]=this.ja;this.m["ctrl-o"]=this.ka;this.b=[];this.b[49]=30464;this.b[33]=30704;this.b[50]=30208;this.b[34]=30448;this.b[51]=29952;this.b[35]=30192;this.b[52]=29696;this.b[36]=29936;this.b[53]=29440;this.b[37]=
29680;this.b[54]=29184;this.b[38]=29424;this.b[55]=28928;this.b[39]=29168;this.b[56]=26368;this.b[40]=26608;this.b[57]=26112;this.b[41]=26352;this.b[48]=25856;this.b[58]=25600;this.b[42]=25840;this.b[45]=25344;this.b[61]=25584;this.b[46]=22272;this.b[62]=22512;this.b[108]=22016;this.b[76]=22256;this.b[92]=22256;this.b[111]=21760;this.b[79]=22E3;this.b[this.la]=22E3;this.b[this.ma]=21504;this.b[this.ga]=21248;this.b[119]=18176;this.b[87]=18416;this.b[101]=17920;this.b[69]=18160;this.b[114]=17664;this.b[82]=
17904;this.b[116]=17408;this.b[84]=17648;this.b[121]=17152;this.b[89]=17392;this.b[117]=16896;this.b[85]=17136;this.b[105]=16640;this.b[73]=16880;this.b[115]=14080;this.b[83]=14320;this.b[100]=13824;this.b[68]=14064;this.b[102]=13568;this.b[70]=13808;this.b[103]=13312;this.b[71]=13552;this.b[104]=13056;this.b[72]=13296;this.b[106]=12800;this.b[74]=13040;this.b[107]=12544;this.b[75]=12784;this.b[91]=12784;this.b[120]=9984;this.b[88]=10224;this.b[99]=9728;this.b[67]=9968;this.b[118]=9472;this.b[86]=
9712;this.b[98]=9216;this.b[66]=9456;this.b[110]=8960;this.b[78]=9200;this.b[94]=9200;this.b[109]=8704;this.b[77]=8944;this.b[93]=8944;this.b[44]=8448;this.b[60]=8688;this.b[113]=5888;this.b[81]=6128;this.b[97]=5632;this.b[65]=5872;this.b[122]=5376;this.b[90]=5616;this.b[32]=5120;this.b[47]=4864;this.b[63]=5104;this.b[59]=4608;this.b[43]=4848;this.b[112]=4352;this.b[80]=4592;this.b[64]=4592;this.b[this.v]=1536;this.b[this.K]=1280;this.b[240]=512;this.b[242]=256;this.b[244]=0;this.reset()}E(Ba);
e=Ba.prototype;e.reset=function(){this.sa(this.fa);this.c=this.o;this.S=0;this.g=[this.o,0,0,0,0,0,0,0];this.w=[];if(this.h)for(var a in this.h)isNaN(a)||this.h[a]&&clearTimeout(this.h[a]);this.h=[];this.da=this.i=0;this.T=-1;this.R=this.g;this.V=this.C=0;this.j=""};
e.J=function(a,b,c){if(void 0===this.A[b])switch(b){case "keyDown":return this.A[b]=c,c.onkeydown=function(a){return function(b){return Ca(a,b,!0)}}(this),!0;case "keyPress":return this.A[b]=c,c.onkeypress=function(a){return function(b){var c=!0;b=b||window.event;b=b.which||b.keyCode;a.j="";a.c&8?a.c&=-9:c=!T(a,b);return c}}(this),!0;case "keyUp":return this.A[b]=c,c.onkeyup=function(a){return function(b){return Ca(a,b,!1)}}(this),!0;case "break":return this.A[b]=c,c.onclick=function(a){return function(){a.I&&
a.I.reset(!0)}}(this),!0;default:if(void 0!==this.m[b])return this.A[b]=c,c.onclick=function(a,b,c){return function(){a.f&&a.f.ea();return!T(a,c)}}(this,b,this.m[b]),!0}return!1};e.Y=function(a,b,c,d){this.a=a;this.Z=b;this.pa=c-b+1;this.ta=this.Z+this.pa;d&&(this.f=d,O(d,b,c,this,this.P));this.N()};e.sa=function(a){this.s=a;this.B=255;600!=this.s&&(this.B=0,this.F("updated keyboard model: "+this.s))};e.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b)};
e.N=function(){this.U=(this.ua=u("iOS"))||u("Android");B.prototype.N.call(this)};function Da(a,b){var c=b?100:250;a.f&&a.f.ca&&(c/=a.f.ca);return c}function Ea(a,b){!a.i||void 0!==b&&b==a.i||(clearTimeout(a.h[a.i]),U(a,a.i,!1,4))}function V(a,b,c){a.j=b;Fa(a,c||300)}function Fa(a,b){if(0<a.j.length){var c=a.j.charCodeAt(0);10==c&&(c=13);65<=c&&90>=c&&(c+=32);a.j=a.j.substr(1);T(a,c)}0<a.j.length&&setTimeout(function(a){return function(){Fa(a,b)}}(a),b)}
function Ca(a,b,c){var d,f=!c;b=b.keyCode;c&&(a.da=b);16==b?(a.c&=-5,c&&(a.c|=4),b+=224,f=!1):18==b?(a.c&=-3,c&&(a.c|=2),b+=224,f=!1):b==a.v-224?(a.c&=-65,c&&(a.c|=64),b+=224,f=!1):20==b?(c=!c,a.c&=~a.o,c&&(a.c|=a.o),b+=224,f=!1):91==b?(a.c&=-9,c&&(a.c|=8),f=!1,d=!0):d=9==b?f=!1:b==a.O||b==a.L?c?!T(a,b):!1:!0;f&&(a.c&=-9,a.U||b!=a.da||Ea(a));void 0===d&&(d=!U(a,b,c,2));return d}
function T(a,b){var c=!1;b==a.G?a.I&&(a.I.reset(!0),c=!0):(a.U&&65<=b&&90>=b&&(b+=32),Ea(a,b),U(a,b,!0,0)&&(a.f.speed==a.f.Ca?U(a,b,!1,1):(c=!1,a.h[b]&&(clearTimeout(a.h[b]),c=!0),c=Da(a,c),a.h[a.i=b]=setTimeout(function(a){return function(){U(a,b,!1,3)}}(a),c)),c=!0));return c}
function U(a,b,c,d){var f=!1;c||(a.h[b]=null,a.i==b&&(a.i=0));var g=0,k=a.b[b];void 0===k&&(1<=b&&26>=b&&(b+=64,g=a.v),k=a.b[b]);void 0!==k&&(b=k>>12,f=k>>8&15,g||(g=k&255),c?(a.g[b]|=1<<f,a.g[0]=g==a.v?a.g[0]|64:240==g?a.g[0]|4:242==g?a.g[0]|2:a.g[0]&-71):(a.g[b]&=~(1<<f),a.g[0]&=-71,a.g[0]|=a.c&70),c=0==d&&!a.w.length,a.w.push(a.g.slice()),Ga(a,c),f=!0);return f}e.W=function(){};e.P=function(a){this.S=this.f.W(a)^this.B;this.C++;Ga(this,!1,a)};
function Ga(a,b,c){var d=ya(a.f);b||(a.f.speed==a.f.Ca?b=void 0!==c&&32<=a.C:(b=d-a.V,b=0>b||8192<=b));b&&(b=a.w.shift(),void 0!==b&&(a.R=b),a.C=0,a.V=d);for(b=d=0;8>b;b++)a.S&1<<b&&(d|=a.R[b]);d^=a.B;if(void 0!==c)a.a[c]=d;else if(c=a.Z,d!=a.T)for(;c<a.ta;c++)a.a[c]=d;a.T=d}y(function(){for(var a=I(window.document,"c1pjs","keyboard"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ba(d);H(d,c)}});
function Ha(a,b,c,d){B.call(this,"C1PVideo",a);this.S=a.model;this.K=a.charCols;this.L=a.charRows;this.U=a.screenWidth;this.V=a.screenHeight;this.i=a.charWidth;this.j=a.charHeight;Ia(this);this.m=b;this.R=c;this.g=d}E(Ha);e=Ha.prototype;e.reset=function(a){this.sa(this.S);if(this.a)for(var b=this.v;b<this.B;b++)this.a[b]=a?Math.floor(256*Math.random()):32};e.J=function(a,b,c){switch(b){case "refresh":return this.A[b]=c,c.onclick=function(a){return function(){Ja(a);qa(a)}}(this),!0}return!1};
e.Y=function(a,b,c,d){this.a=a;this.v=b;this.T=c-b+1;this.B=this.v+this.T;d&&(this.f=d,ra(d,56832,56832,this,this.W),O(d,56832,56832,this,this.P));this.reset(!0)};function Ia(a,b,c,d,f){a.o=void 0!==b?b:a.K;a.Z=void 0!==c?c:a.L;a.c=a.o*a.Z;a.B=a.v+a.c;a.I=void 0!==d?d:0;a.O=void 0!==f?f:c;a.C=Math.floor(a.U/a.o);a.G=Math.floor(a.V/a.O)}e.ea=function(){this.m.focus()};
e.sa=function(a){this.s=a;600==this.s?(Ia(this,this.K,this.L,3,25),1024==this.c&&this.f&&(this.h=this.B+this.c-1,O(this.f,this.h,this.h,this,this.bb))):(this.F("updated video model: "+this.s),Ia(this,64,32));Ja(this);qa(this)};e.aa=function(a,b){if(a&&!this.u.H&&J(this)){if(this.u.H=!0,this.b=L(b,"keyboard"))this.b.J("canvas","keyDown",this.m),this.b.J("canvas","keyPress",this.m),this.b.J("canvas","keyUp",this.m)}else!a&&this.u.H&&(this.u.H=!1)};
e.N=function(){this.i||(this.i=Math.floor(this.g.width/16));this.j||(this.j=Math.floor(this.g.height/16));B.prototype.N.call(this)};e.W=function(a){var b=this.f.W(a);this.f.P(a,b&127|(Math.floor(ya(this.f)/8333)&1?128:0))};e.P=function(){};
e.bb=function(a,b){if(void 0!==b){this.sa(540);this.b&&this.b.sa(542);var c=this.f,d=c.K,f=[],g=sa(d,this.h,this.h,this,this.bb);if(0<=g){f.push(d[g][0]);f.push(d[g][1]);d.splice(g,1);for(var k=65536,h=0,g=0;g<d.length;g++)k>d[g][0]&&(k=d[g][0]),h<d[g][1]&&(h=d[g][1]);f.push(k);f.push(h)}4==f.length&&(c.Z=f[2],c.da=f[3])}};function Ja(a){a.w=Array(a.c);for(var b=0;b<=a.c;b++)a.w[b]=-1}
function qa(a){var b=0;if(a.u.H)for(;b<a.c;){var c=a.a[a.v+b];if(a.w[b]!=c){var d=Math.floor(b/a.o);if(d>=a.I&&(d-=a.I,d<a.O)){var f=c*a.i;a.R.drawImage(a.g,f%a.g.width,Math.floor(f/a.g.width)*a.j,a.i,a.j,b%a.o*a.C,d*a.G,a.C,a.G)}a.w[b]=c}b++}}
y(function(){for(var a=I(window.document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=G(c),f=window.document.createElement("canvas");if(void 0===f||!f.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}f.setAttribute("class","c1pjs-canvas");f.setAttribute("width",d.screenWidth);f.setAttribute("height",d.screenHeight);f.setAttribute("contenteditable","true");f.setAttribute("autocapitalize","off");f.setAttribute("autocorrect","off");f.style.backgroundColor=
d.screenColor;f.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(f.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,f,d.screenWidth,d.screenHeight));c.appendChild(f);var g=new Image,k=f.getContext("2d"),f=new Ha(d,f,k,g);g.onload=function(a){return function(){a.N()}}(f,d.charSet);g.src=d.charSet;H(f,c)}});
function Ka(a){B.call(this,"C1PSerialPort",a);this.u.H=!1;this.s=a.demo;this.reset()}E(Ka);e=Ka.prototype;e.reset=function(){if(2!=this.c){this.h=this.j=0;var a=1;if(this.Ea){var b=this.Ea.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.g='10 PRINT "HELLO OSI #'+a+'"\n';this.c=this.i=0}};e.start=function(){this.b&&this.s&&(V(this.b," C\n\n",3E3),setTimeout(function(a){return function(){a.c=1;V(a.b,"LOAD\n")}}(this),12E3));this.s=!1};
e.J=function(a,b,c){var d=this;switch(b){case "listSerial":return this.A[b]=c,!0;case "loadSerial":return this.A[b]=c,c.onclick=function(){d.A.listSerial&&r(d.A.listSerial.value,d,d.Ja)},!0;case "mountSerial":return!u("Mobi")&&window&&"FileReader"in window?(this.A[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){d.Ja(b.name,c.result.toString(),
0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};e.Y=function(a,b,c,d){this.a=a;this.m=b;this.v=c-b+1;this.o=this.m+this.v;if(this.f=d)ra(d,b,c,this,this.W),O(d,b,c,this,this.P);this.N()};e.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.b=L(b,"keyboard"))};
e.Ja=function(a,b,c){b?(this.g=b,this.c=this.i=0,this.I&&this.b&&this.f.u.$?(this.F("auto-loading "+a),this.f.ea(),"."!=this.g.charAt(0)?(this.c=1,V(this.b,"NEW\nLOAD\n")):(this.c=2,this.I.reset(!0),V(this.b,"ML"))):this.F(a+" ready to load")):this.F(a+" load error ("+c+")")};e.W=function(a,b){void 0!==b&&(a&1?La(this):this.g&&!this.i&&La(this))};e.P=function(){};
function La(a){if(void 0!==a.g){a.j=0;a.h=0;if(a.i<a.g.length){var b=a.g.charCodeAt(a.i++);10==b&&(b=13);a.j=b;a.h=1}else 1==a.c&&a.b&&V(a.b," \nRUN\n"),a.c=0;for(b=a.m+0;b<a.o;b+=2)a.a[b]=a.h?1:0;for(b=a.m+1;b<a.o;b+=2)a.a[b]=a.h?a.j:0}}y(function(){for(var a=I(window.document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ka(d);H(d,c)}});function Ma(a){B.call(this,"C1PDiskController",a);this.u.H=!1;this.reset(!0)}E(Ma);e=Ma.prototype;
e.reset=function(a){Na(this);this.b=-1;a&&(this.c=[],this.c[0]={de:0,Ka:40,cb:!0,ia:20,ba:0,ha:-1,va:[]})};
function Na(a){a.v={D:64,X:function(){},update:function(a){return function(c){void 0!==c&&(this.D=c);a.j.D&4||W(a,0,this)}}(a)};a.g={D:255,X:function(){this.update()},update:function(a){return function(c){void 0===c?c=a.g.D:Oa(a,c,a.i.D);c=(c|190)&-2;if(0<=a.b&&a.c[a.b].va.length){var d=a.c[a.b];d.cb&&(c&=-33);d.ba||(c&=-3);10>=--d.ia&&(0<d.ia?(c&=-129,Pa(a)):(d.ia=100,0<=a.b&&(a.c[a.b].ha=0,Qa(a))))}this.D=c;a.j.D&4&&W(a,0,this)}}(a)};a.j={D:0,X:function(){},update:function(a){return function(c){void 0!==
c&&(this.D=c&-193);W(a,1,this);a.g.update();a.v.update()}}(a)};a.w={D:255,X:function(){},update:function(a){return function(c){void 0!==c&&(this.D=c);a.m.D&4||W(a,2,this)}}(a)};a.i={D:255,X:function(){},update:function(a){return function(c){void 0===c?c=a.i.D:Oa(a,a.g.D,c);if(0<=a.b&&a.b<a.c.length){var d=a.c[a.b];d.va.length&&a.i.D&8&&!(c&8)&&(c&4?d.ba--:d.ba++,d.ba>=d.Ka&&(d.ba=d.Ka),0>d.ba&&(d.ba=0),d.ia=20,a.g.update(a.g.D|128),Pa(a))}this.D=c;a.m.D&4&&W(a,2,this)}}(a)};a.m={D:0,X:function(){},
update:function(a){return function(c){void 0!==c&&(this.D=c&-193);W(a,3,this);a.i.update();a.w.update()}}(a)};a.B={D:0,X:function(){},update:function(a){return function(c){void 0!==c&&(3==(c&3)&&(a.h.D=14),this.D=c);a.h.update()}}(a)};a.h={D:14,X:function(){},update:function(a){return function(c){void 0===c&&(c=a.h.D);c&=-2;0<=a.b&&0<=a.c[a.b].ha&&(c|=1);this.D=c;W(a,16,this)}}(a)};a.o={D:0,X:function(a){return function(){Qa(a)}}(a),update:function(a){return function(c){void 0!==c&&(this.D=c);W(a,
17,this)}}(a)};a.C={D:0,X:function(){},update:function(){return function(){}}(a)}}e.J=function(a,b,c){switch(b){case "listDisk":return this.A[b]=c,!0;case "loadDisk":return this.A[b]=c,c.onclick=function(a){return function(){if(a.A.listDisk){var b=a.A.listDisk.value,c=b;".json"!=b.substr(b.length-5)&&(c="http://"+window.location.host+"/api/v1/dump?disk="+b);a.F("loading "+aa(b)+"...");r(c,a,a.ib)}}}(this),!0}return!1};
e.Y=function(a,b,c,d){this.a=a;this.s=b;if(this.f=d)ra(d,b,c,this,this.W),O(d,b,c,this,this.P);this.N()};e.aa=function(a){a&&!this.u.H&&(this.u.H=!0)};
e.ib=function(a,b,c){if(c)this.F("disk load error ("+c+")");else{c=[];this.F("mounting "+a+"...");try{if(c=eval("("+b+")"),c.length)if(c[0].length){var d=c[0];if(void 0===d[0].trackNum)this.F("data error: "+d[0]);else if(this.c[0]){for(b=0;b<d.length;b++){var f,g=d[b],k=g.sectors;if(void 0===(f=g.trackNum)||void 0===k)throw Error("track "+b+" missing data");f!=b&&t("track "+f+" out of order (expected "+b+")");c=[];var h,l,m;if(f){Ra(c,g,"trackSig");Sa(c,g);X(c,g,"trackType");for(var p=0;p<k.length;p++){h=
k[p];l=h.sectorData;X(c,h,"sectorSig");X(c,h,"sectorNum");X(c,h,"sectorPages");for(m=0;m<l.length;m++)c.push(l[m]);Ra(c,h,"sectorEndSig")}}else for(h=k[0],l=h.sectorData,X(c,g,"trackLoad",2),X(c,h,"sectorPages"),m=0;m<l.length;m++)c.push(l[m]);d[f].ab=c}this.c[0].va=d;this.F("mount of "+a+" complete")}else this.F("no available drives")}else this.F("no tracks: "+a);else this.F("no data: "+a)}catch(D){this.F("disk data error: "+D.message)}}};
function Sa(a,b){var c=b.trackNum;if(void 0===c)throw Error("missing bcd value: trackNum");a.push(Math.floor(c/10)<<4|c%10)}function X(a,b,c,d){b=b[c];if(void 0===b)throw Error("missing binary value: "+c);2==d&&a.push(b>>8&255);a.push(b&255)}function Ra(a,b,c){b=b[c];if(void 0===b)throw Error("missing signature: "+c);for(c=0;c<b.length;c++)a.push(b.charCodeAt(c))}
function Ta(a,b,c){b&=63;16>b?b&=3:32>b&&(b&=17);switch(b){case 0:a=a.j.D&4?a.g:a.v;break;case 1:a=a.j;break;case 2:a=a.m.D&4?a.i:a.w;break;case 3:a=a.m;break;case 16:a=c?a.B:a.h;break;case 17:a=a.o;break;default:a=a.C}return a}e.W=function(a,b){void 0!==b&&Ta(this,a-this.s,!1).X()};e.P=function(a,b){if(void 0!==b){var c=this.f.W(a);Ta(this,a-this.s,!0).update(c)}};function Oa(a,b,c){var d=-1;void 0!==b&&void 0!==c&&(d=0,c&32||(d|=2),a.g.D&64||(d|=1));a.b!=d&&(a.b=d,a.h.update())}
function Pa(a){0<=a.b&&(a.c[a.b].ha=-1,a.o.update(255),a.h.update())}function Qa(a){var b=null;if(0<=a.b){var b=a.c[a.b],c=b.va[b.ba];void 0!==c&&(0<=b.ha&&b.ha<c.ab.length?(b.ia=100,b=c.ab[b.ha++],a.o.update(b),a.h.update()):(b.ia=10,Pa(a)))}}function W(a,b,c){a.f.P(b+a.s,c.D)}y(function(){for(var a=I(window.document,"c1pjs","disk"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ma(d);H(d,c)}});function Y(a,b){B.call(this,"C1PComputer",a);this.M=b}E(Y);
Y.prototype.reset=function(a){var b=null,c;for(c in this.M)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.reset&&(f.reset(),"cpu"==c&&(b=f))}b&&(b.update(),a&&N(b))};Y.prototype.start=function(){for(var a in this.M)if("cpu"!=a)for(var b=0;b<this.M[a].length;b++){var c=this.M[a][b];c&&c.start&&c.start()}};Y.prototype.stop=function(a,b){for(var c in this.M)if("cpu"!=c)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.stop&&f.stop(a,b)}};
Y.prototype.J=function(a,b,c){switch(b){case "reset":return this.A[b]=c,c.onclick=function(a){return function(){a.reset()}}(this),!0}return!1};function L(a,b){return a.M[b]?a.M[b][0]:null}function Ua(a){var b=null,c;for(c in a.M)for(var d=0;d<a.M[c].length;d++){var f=a.M[c][d];if(f){if(!J(f)){J(f,function(a){return function(){Ua(a)}}(a));return}"cpu"==c?b=f:f.aa&&f.aa(!0,a)}}a.N();a.F("C1Pjs v1.19.4\nCopyright \u00a9 2012-2015 Jeff Parsons <Jeff@pcjs.org>");b&&b.aa(!0,a)}
y(function(){for(var a=I(window.document,"c1pjs","computer"),b=0;b<a.length;b++){for(var c=a[b],d=G(c),f,g={},k,h=0,l=0,m=0;m<d.modules.length;m++){var p=d.modules[m];if(!m){if("cpu"!=p.type)break;h=p.start;l=p.end;k=Array(l+1-h);for(f=h;f<k.length;f++)k[f]=0}if(f=F(p.refID,d.id)){var D=p.type;void 0===g[D]&&(g[D]=[]);g[D].push(f);f.Y&&void 0!==p.start&&f.Y(k,p.start,p.end,g.cpu[0])}else{t('no component for <module refid="'+p.refID+'">');return}}if(void 0===k){t('<module type="cpu"> definition must appear first in the <computer> specification');
break}if(f=F("debugger",d.id))g["debugger"]=[f],f.Y&&f.Y(k,h,l,g.cpu[0]);h=new Y(d,g);if(l=F("panel",d.id))if(g.panel=[l],l.za){f=d.id;d=void 0;g=[];f&&(f=0<(d=f.indexOf("."))?f.substr(0,d+1):"");for(d=0;d<C.length;d++)m=C[d],f&&m.id.indexOf(f)||g.push(m);d=g;for(g=0;g<d.length;g++)f=d[g],f!=l&&(f.xa=l.xa,f.F=l.F,f.za=l.za)}H(h,c);Ua(h)}});var Z=0;function Va(a,b,c,d,f,g){f("Loading "+a+"...");r(a,null,function(k,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),g(h,null)):Wa(h,a,b,c,d,f,g)})}
function Wa(a,b,c,d,f,g,k){function h(a,g){if(g)k(g,null);else{if(c){var h=b;h&&0>h.indexOf("/")&&(h=window.location.pathname+h);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" state=$2"+d+"$2":"")+(h?" url=$2"+h+"$2":""))}h=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(D){h=
null,a=D.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,h)}}a?f?Xa(a,g,h):h(a,null):k("no data"+(b?" for file: "+b:""),null)}
function Xa(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,null,function(g,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(g=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],k);Xa(a,b,c)}})}else c(a,null)}
function Ya(a,b,c){function d(a){if(void 0===k){var b=g&&I(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=ca(a))}function f(a){d("Error: "+a);h&&(--Z||A(!0));h=!1}var g,k,h=!0;Z++;try{if(g=window.document.getElementById(a)){c||(c="/versions/c1pjs/1.19.4/components.xsl");var l=function(h,k){if(k){var l=function(h,l){if(l)if(l)if(d("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=k.transformNode(l);m?(g.outerHTML=m,--Z||A(!0)):f("transformNodeToObject failed")}else window.document.implementation&&
window.document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(k,window.document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Z||A(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f("failed to load XSL file: "+c);else f(h)};k?Va(c,null,null,!1,d,l):f("failed to load XML file: "+b)}else f(h)};"<"!=b.charAt(0)?Va(b,a,void 0,!0,d,l):Wa(b,null,a,void 0,!1,d,l)}else f("missing machine element: "+
a)}catch(m){f(m.message)}return h}window.embedC1P=function(a,b,c){A(!1);return Ya(a,b,c)};window.enableEvents=A;window.sendEvent=ea;})();

View file

@ -0,0 +1,262 @@
@CHARSET "UTF-8";
/**
@author Jeff Parsons (@jeffpar)
@website http://www.pcjs.org/
@created 2013-05-05
@modified 2014-02-23
@license http://www.gnu.org/licenses/gpl.html
*/
body {
margin: 0;
background: #202020;
}
h1, h2 {
margin-top: 0;
color: #cccccc;
}
h1, h2, h3, h4 {
word-wrap: break-word;
}
h4 a {
color: #cccccc !important;
}
p {
line-height: 1.5em;
}
img {
max-width: 100%;
}
a img {
vertical-align: bottom;
}
pre, code {
color: #000000;
background-color: #cccccc;
font-family: Monaco, Consolas, "Lucida Console", monospace;
font-size: 12px;
}
pre {
margin: 1em 2em;
padding: 1em;
border-radius: 5px;
overflow: auto;
}
code {
padding: 1px;
}
pre a, code a {
color: #006400 !important;
}
.common {
width: 100%;
margin: 0 auto;
color: #cccccc;
}
.common a {
color: #7fc07f;
text-decoration: none;
}
.common hr {
border-color: #808080;
}
.common a:hover {
text-decoration: underline;
}
.common, .machine {
font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
font-size: 15px;
}
.machine {
margin: 15px;
overflow: hidden;
}
.c1pjs {
overflow: visible;
}
.machine-placeholder {
text-align: center;
font-weight: bold;
}
.common-top {
background: #202020;
font-size: small;
}
.common-top-left {
float: left;
width: 60%;
}
.common-top-left ul {
line-height: 1.5em;
list-style-type: none;
margin: 0;
padding: 1em 1em 1em 9px;
overflow: hidden;
}
.common-top-left ul li {
display: block;
float: left;
}
.common-top-left ul li a {
border-right: 1px solid #6f6f6f;
padding: 2px 6px 2px 6px;
}
.common-top-left ul li:last-child a {
border-right: none;
}
.common-top-right {
float: right;
width: 40%;
}
.common-top-right p {
float: right;
margin: 0;
padding: 1em;
}
.common-middle {
clear: both;
padding: 1px 1em 1px 1em;
background: #404040;
}
.common-sidebar {
float: left;
font-size: small;
width: 140px;
padding-bottom: 20px;
overflow: hidden;
white-space: nowrap;
word-wrap: break-word;
}
.common-list {
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.common-list li {
padding-bottom: 7px;
}
.common-list-data {
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.common-list-data li {
line-height: 1.5em;
}
.common-list-data-items, .common-list-data-subitems {
font-size: x-small;
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 2em;
}
.common-list-data-items li, .common-list-data-subitems li {
padding-bottom: 0;
}
.common-main {
margin-left: 150px;
}
.common-image-gallery {
margin: 0 auto;
text-align: center;
}
.common-image-gallery:after {
content: '';
display: block;
}
.common-image-frame {
display: inline-block;
margin: 8px;
text-align: center;
}
.common-image-link {
padding: 5px;
border: 1px solid black;
border-radius: 5px;
background-color: #FAEBD7;
}
.common-image-label {
font-size: x-small;
}
.common-bottom {
clear: both;
padding-top: 1em;
}
.common-bottom:after {
content: '';
display: block;
clear: both;
}
.common-reference {
float: left;
font-size: x-small;
}
.common-reference a {
text-decoration: none;
}
.common-copyright {
float: right;
font-size: x-small;
}
.common-copyright a {
text-decoration: none;
}
.md-list {
}
.md-list li {
line-height: 1.5em;
margin-bottom: 1em;
}
.md-list li p {
padding-left: 2em;
}
.md-list-compact {
}
.md-list-compact li {
margin-bottom: 0;
}
.md-list-none {
list-style-type: none;
padding-left: 2em;
}
.md-list-none li {
margin-bottom: 0;
}
@media screen and (max-width: 900px) {
.common-sidebar {
width: 100%;
white-space: normal;
}
.common-list {
padding-left: 0;
}
.common-list-data {
padding-left: 0;
}
.common-sidebar h4, .common-list li, .common-list-data li, .common-list-data-items li {
width: 130px;
float: left;
overflow: hidden;
vertical-align: top;
padding-right: 1em;
margin-top: 0;
}
.common-list-data-subitems {
display: none;
}
.common-main {
clear: both;
margin-left: 0;
padding-left: 0;
padding-right: 0;
}
.md-list-none {
padding-left: 1em;
}
}

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY ne "&#8800;"> <!ENTITY le "&#8804;"> <!ENTITY ge "&#8805;">
<!ENTITY times "&#215;"> <!ENTITY sdot "&#8901;"> <!ENTITY divide "&#247;">
<!ENTITY copy "&#169;"> <!ENTITY Sigma "&#931;"> <!ENTITY sigma "&#963;"> <!ENTITY sum "&#8721;"> <!ENTITY lbrace "&#123;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="commonStyles">
<meta charset="utf-8"/>
<link rel="shortcut icon" href="/versions/images/current/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/versions/c1pjs/1.19.4/common.css"/>
</xsl:template>
<xsl:template name="commonTop">
<div class="common-top">
<div class="common-top-left">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/apps/pc/">Apps</a></li>
<li><a href="/disks/pc/">Disks</a></li>
<li><a href="/devices/pc/machine/">Machines</a></li>
<li><a href="/docs/">Docs</a></li>
<li><a href="/pubs/">Pubs</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="/docs/about/">About</a></li>
</ul>
</div>
<div class="common-top-right">
<p>Powered by <a href="http://nodejs.org" target="_blank">Node.js</a> and <a href="http://aws.amazon.com/elasticbeanstalk/" target="_blank">AWS</a> | <a href="http://github.com/jeffpar/pcjs" target="_blank">GitHub</a></p>
</div>
</div>
</xsl:template>
<xsl:template name="commonBottom">
<div class="common-bottom">
<p class="common-reference"></p>
<p class="common-copyright">
<span class="common-copyright"><a href="http://www.pcjs.org/">pcjs.org</a> website © 2012-2015 by <a href="http://twitter.com/jeffpar">@jeffpar</a></span><br/>
<span class="common-copyright">PCjs and C1Pjs released under <a href="http://gnu.org/licenses/gpl.html">GPL version 3 or later</a></span>
</p>
</div>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,106 @@
@CHARSET "UTF-8";
*:not(input,textarea) {
-webkit-user-select: none;
}
.c1pjs-embed {
}
.c1pjs-embed:after {
clear:both;
}
.c1pjs-name {
clear: both;
font-weight: bold;
padding-bottom: 4px;
}
.c1pjs-canvas {
width: 100%;
height: auto;
}
.c1pjs-container {
color: #000000;
position: relative;
}
.c1pjs-label {
font-size: small;
line-height: 19px;
vertical-align: middle;
float: left;
font-family: "Lucida Console", monospace;
}
.c1pjs-control textarea {
font-family: Monaco, monospace;
font-size: x-small;
}
.c1pjs-fieldset {
border: none;
margin: 0;
padding: 0;
}
.c1pjs-flag {
font-family: "Lucida Console", monospace;
font-size: small;
text-align: center;
line-height: 19px;
vertical-align: middle;
}
.c1pjs-register {
font-family: "Lucida Console", monospace;
font-size: small;
text-align: center;
line-height: 19px;
vertical-align: middle;
border: 1px solid black;
}
.c1pjs-switches {
float: left;
}
.c1pjs-bitBucket {
float: left;
width: 19px;
height: 38px;
}
.c1pjs-bitCell {
float: left;
width: 19px;
height: 19px;
margin-right: -1px;
margin-bottom: -1px;
border: 1px solid black;
text-align: center;
line-height: 19px;
}
.c1pjs-bitCellLeft {
border-left: 1px solid black;
}
.c1pjs-bitLabel {
font-size: xx-small;
text-align: center;
}
.c1pjs-description, .c1pjs-status {
font-size: small;
line-height: 2em;
}
.c1pjs-key {
border: 1px solid black;
font-size: x-small;
text-align: center;
position: absolute;
height: 34px;
line-height: 34px;
}
.c1pjs-reference {
float: left;
font-size: x-small;
}
.c1pjs-reference a {
text-decoration: none;
}
.c1pjs-copyright {
float: right;
font-size: x-small;
}
.c1pjs-copyright a {
text-decoration: none;
}

View file

@ -0,0 +1,572 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2013-01-29" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="rootDir" select="''"/>
<xsl:param name="generator" select="'client'"/>
<xsl:variable name="MACHINECLASS">c1p</xsl:variable>
<xsl:variable name="APPCLASS">c1pjs</xsl:variable>
<xsl:variable name="APPVERSION">1.19.4</xsl:variable>
<xsl:variable name="SITEHOST">www.pcjs.org</xsl:variable>
<xsl:template name="componentStyles">
<link rel="stylesheet" type="text/css" href="/versions/{$APPCLASS}/{$APPVERSION}/components.css"/>
</xsl:template>
<xsl:template name="componentScripts">
<xsl:param name="component"/>
<script type="text/javascript" src="/versions/{$APPCLASS}/{$APPVERSION}/{$component}.js"></script>
</xsl:template>
<xsl:template name="componentIncludes">
<xsl:param name="component"/>
<xsl:call-template name="componentScripts"><xsl:with-param name="component" select="$component"/></xsl:call-template>
</xsl:template>
<xsl:template match="machine[@ref]">
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/machine"><xsl:with-param name="machine" select="@id"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="machine[not(@ref)]">
<xsl:param name="machine"><xsl:value-of select="@id"/></xsl:param>
<div id="{$machine}" class="machine {@class}js">
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="component" select="'machine'"/>
<xsl:with-param name="class"><xsl:value-of select="@class"/>js</xsl:with-param>
<xsl:with-param name="parms"><xsl:if test="@parms">,<xsl:value-of select="@parms"/></xsl:if></xsl:with-param>
<xsl:with-param name="url"><xsl:value-of select="@url"/></xsl:with-param>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template match="component[@ref]">
<xsl:param name="machine"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/component"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="component[not(@ref)]">
<xsl:param name="machine"/>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class" select="@class"/>
<xsl:with-param name="parms"><xsl:if test="@parms">,<xsl:value-of select="@parms"/></xsl:if></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="component">
<xsl:param name="machine" select="''"/>
<xsl:param name="component" select="name(.)"/>
<xsl:param name="class" select="''"/>
<xsl:param name="parms" select="''"/>
<xsl:param name="url" select="''"/>
<xsl:variable name="id">
<xsl:choose>
<xsl:when test="$component = 'machine'"><xsl:value-of select="$machine"/>.machine</xsl:when>
<xsl:when test="$machine != ''"><xsl:value-of select="$machine"/><xsl:if test="@id">.<xsl:value-of select="@id"/></xsl:if></xsl:when>
<xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="name"><xsl:value-of select="name"/></xsl:when>
<xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="border">
<xsl:choose>
<xsl:when test="@border = '1'">border:1px solid black;border-radius:10px;</xsl:when>
<xsl:when test="@border">border:<xsl:value-of select="@border"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="left">
<xsl:choose>
<xsl:when test="@left">left:<xsl:value-of select="@left"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="top">
<xsl:choose>
<xsl:when test="@top">top:<xsl:value-of select="@top"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="width">
<xsl:choose>
<xsl:when test="@width">
<xsl:choose>
<xsl:when test="$left != '' or $top != ''">width:<xsl:value-of select="@width"/>;</xsl:when>
<xsl:otherwise>width:auto;max-width:<xsl:value-of select="@width"/>;</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="height">
<xsl:choose>
<xsl:when test="@height">height:<xsl:value-of select="@height"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="padding">
<xsl:choose>
<xsl:when test="@padding">padding:<xsl:value-of select="@padding"/>;</xsl:when>
<xsl:otherwise>
<xsl:if test="@padtop">padding-top:<xsl:value-of select="@padtop"/>;</xsl:if>
<xsl:if test="@padright">padding-right:<xsl:value-of select="@padright"/>;</xsl:if>
<xsl:if test="@padbottom">padding-bottom:<xsl:value-of select="@padbottom"/>;</xsl:if>
<xsl:if test="@padleft">padding-left:<xsl:value-of select="@padleft"/>;</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pos">
<xsl:choose>
<xsl:when test="@pos = 'left'">float:left;</xsl:when>
<xsl:when test="@pos = 'right'">float:right;</xsl:when>
<xsl:when test="@pos = 'center'">margin:0 auto;</xsl:when>
<xsl:when test="@pos">position:<xsl:value-of select="@pos"/>;</xsl:when>
<xsl:when test="$left != '' or $top != ''">position:absolute;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="style">
<xsl:if test="$component = 'machine'">overflow:auto;width:100%;</xsl:if>
<xsl:if test="@background">background-color:<xsl:value-of select="@background"/>;</xsl:if>
<xsl:if test="@style"><xsl:value-of select="@style"/></xsl:if>
</xsl:variable>
<xsl:variable name="componentClass">
<xsl:value-of select="$APPCLASS"/><xsl:text>-</xsl:text><xsl:value-of select="$component"/><xsl:text> </xsl:text><xsl:value-of select="$APPCLASS"/><xsl:text>-component</xsl:text>
</xsl:variable>
<div id="{$id}" class="{$componentClass}" style="{$width}{$height}{$pos}{$left}{$top}{$padding}">
<xsl:if test="$component = 'machine'">
<xsl:apply-templates select="name" mode="machine"/>
</xsl:if>
<xsl:if test="$component != 'machine'">
<xsl:apply-templates select="name" mode="component"/>
</xsl:if>
<div class="{$APPCLASS}-container" style="{$border}{$style}">
<xsl:if test="$class != '' and $component != 'machine'">
<div class="{$APPCLASS}-{$class}-object" data-value="id:'{$id}',name:'{$name}'{$parms}"></div>
</xsl:if>
<xsl:if test="control">
<div class="{$APPCLASS}-controls">
<xsl:apply-templates select="control" mode="component"/>
</div>
</xsl:if>
<xsl:apply-templates><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</div>
<xsl:if test="$component = 'machine'">
<xsl:choose>
<xsl:when test="$url != ''"><div class="{$APPCLASS}-reference">[<a href="{$url}">XML</a>]</div></xsl:when>
<xsl:otherwise/>
</xsl:choose>
<div class="{$APPCLASS}-copyright">
<a href="http://{$SITEHOST}/{$APPCLASS}" target="_blank">C1Pjs</a> v<xsl:value-of select="$APPVERSION"/> © 2012-2015 by <a href="http://twitter.com/jeffpar" target="_blank">@jeffpar</a>
</div>
<div style="clear:both"></div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="name" mode="machine">
<xsl:variable name="pos">
<xsl:choose>
<xsl:when test="@pos = 'center'">text-align:center;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<h2 style="{$pos}"><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="name" mode="component">
<div class="{$APPCLASS}-name"><xsl:apply-templates/></div>
</xsl:template>
<xsl:template match="control" mode="component">
<xsl:variable name="type">
type:'<xsl:value-of select="@type"/>'
</xsl:variable>
<xsl:variable name="binding">
binding:'<xsl:value-of select="@binding"/>'
</xsl:variable>
<xsl:variable name="border">
<xsl:choose>
<xsl:when test="@border = '1'">border:1px solid black;</xsl:when>
<xsl:when test="@border">border:<xsl:value-of select="@border"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="width">
<xsl:choose>
<xsl:when test="@width">width:<xsl:value-of select="@width"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="height">
<xsl:choose>
<xsl:when test="@height">height:<xsl:value-of select="@height"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="left">
<xsl:choose>
<xsl:when test="@left">left:<xsl:value-of select="@left"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="top">
<xsl:choose>
<xsl:when test="@top">top:<xsl:value-of select="@top"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pos">
<xsl:choose>
<xsl:when test="$left != '' or $top != ''">position:absolute;</xsl:when>
<xsl:when test="@pos = 'left'">float:left;</xsl:when>
<xsl:when test="@pos = 'right'">float:right;</xsl:when>
<xsl:when test="@pos = 'center'">margin:0 auto;</xsl:when>
<xsl:when test="@pos"><xsl:value-of select="@pos"/>;</xsl:when>
<xsl:otherwise><xsl:if test="$left = ''">float:left;</xsl:if></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="style">
<xsl:choose>
<xsl:when test="@style"><xsl:value-of select="@style"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<div class="{$APPCLASS}-control" style="{$pos}{$left}{$top}">
<xsl:variable name="fontsize">
<xsl:choose>
<xsl:when test="@size = 'large'">font-size:<xsl:value-of select="@size"/>;</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="subclass">
<xsl:if test="@label"><xsl:text> </xsl:text><xsl:value-of select="$APPCLASS"/><xsl:text>-label</xsl:text></xsl:if>
</xsl:variable>
<xsl:variable name="labelwidth">
<xsl:if test="@labelwidth">width:<xsl:value-of select="@labelwidth"/>;</xsl:if>
</xsl:variable>
<xsl:variable name="labelstyle">
<xsl:if test="@labelstyle"><xsl:value-of select="@labelstyle"/></xsl:if>
</xsl:variable>
<xsl:if test="@label">
<xsl:if test="not(@labelpos) or @labelpos = 'left'">
<div class="{$APPCLASS}-label" style="{$labelwidth}{$labelstyle}"><xsl:value-of select="@label"/></div>
</xsl:if>
</xsl:if>
<xsl:choose>
<xsl:when test="@type = 'button'">
<button class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></button>
</xsl:when>
<xsl:when test="@type = 'list'">
<select class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}">
<xsl:apply-templates select="item" mode="component"/>
</select>
</xsl:when>
<xsl:when test="@type = 'text'">
<input class="{$APPCLASS}-binding" type="text" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}" value="" autocapitalize="off" autocorrect="off"/>
</xsl:when>
<xsl:when test="@type = 'submit'">
<input class="{$APPCLASS}-binding" type="submit" style="{$border}{$fontsize}{$style}" data-value="{$type},{$binding}" value="{.}"/>
</xsl:when>
<xsl:when test="@type = 'textarea'">
<textarea class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}" readonly="readonly"></textarea>
</xsl:when>
<xsl:when test="@type = 'heading'">
<div><xsl:value-of select="."/></div>
</xsl:when>
<xsl:when test="@type = 'file'">
<form class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}">
<fieldset class="{$APPCLASS}-fieldset">
<input type="file"/>
<input type="submit" value="Mount" disabled="true"/>
</fieldset>
</form>
</xsl:when>
<xsl:when test="@type = 'separator'">
<hr/>
</xsl:when>
<xsl:when test="not(@type)">
<div style="clear:both"></div><br/>
</xsl:when>
<xsl:otherwise>
<div class="{$APPCLASS}-binding{$subclass}" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></div>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@label">
<xsl:if test="@labelpos = 'right'">
<div class="{$APPCLASS}-label" style="{$labelwidth}{$labelstyle}"><xsl:value-of select="@label"/></div>
</xsl:if>
<div style="clear:both"></div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="item" mode="component">
<option value="{@ref}"><xsl:value-of select="."/></option>
</xsl:template>
<xsl:template match="name">
</xsl:template>
<xsl:template match="control">
</xsl:template>
<xsl:template match="cpu[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/cpu"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="cpu[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="autoStart">
<xsl:choose>
<xsl:when test="@autostart"><xsl:value-of select="@autostart"/></xsl:when>
<xsl:otherwise>null</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class" select="'cpu'"/>
<xsl:with-param name="parms">,autoStart:<xsl:value-of select="$autoStart"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="keyboard[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/keyboard"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="keyboard[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="model">
<xsl:choose>
<xsl:when test="@model"><xsl:value-of select="@model"/></xsl:when>
<xsl:otherwise>600</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">keyboard</xsl:with-param>
<xsl:with-param name="parms">,model:<xsl:value-of select="$model"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="serial[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/serial"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="serial[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="demo">
<xsl:choose>
<xsl:when test="@demo"><xsl:value-of select="@demo"/></xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">serial</xsl:with-param>
<xsl:with-param name="parms">,demo:<xsl:value-of select="$demo"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="disk[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/disk"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="disk[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">disk</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="rom[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/rom"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="rom[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="size">
<xsl:choose>
<xsl:when test="@size"><xsl:value-of select="@size"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="image">
<xsl:choose>
<xsl:when test="@image"><xsl:value-of select="@image"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">rom</xsl:with-param>
<xsl:with-param name="parms">,size:<xsl:value-of select="$size"/>,image:'<xsl:value-of select="$image"/>'</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="ram[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/ram"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="ram[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="size">
<xsl:choose>
<xsl:when test="@size"><xsl:value-of select="@size"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">ram</xsl:with-param>
<xsl:with-param name="parms">,size:<xsl:value-of select="$size"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="video[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/video"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="video[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="model">
<xsl:choose>
<xsl:when test="@model"><xsl:value-of select="@model"/></xsl:when>
<xsl:otherwise>600</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="screenWidth">
<xsl:choose>
<xsl:when test="@screenwidth"><xsl:value-of select="@screenwidth"/></xsl:when>
<xsl:otherwise>256</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="screenHeight">
<xsl:choose>
<xsl:when test="@screenheight"><xsl:value-of select="@screenheight"/></xsl:when>
<xsl:otherwise>224</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="charCols">
<xsl:choose>
<xsl:when test="@cols"><xsl:value-of select="@cols"/></xsl:when>
<xsl:otherwise>32</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="charRows">
<xsl:choose>
<xsl:when test="@rows"><xsl:value-of select="@rows"/></xsl:when>
<xsl:otherwise>32</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="charWidth">
<xsl:choose>
<xsl:when test="@charwidth"><xsl:value-of select="@charwidth"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="charHeight">
<xsl:choose>
<xsl:when test="@charheight"><xsl:value-of select="@charheight"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="charSet">
<xsl:choose>
<xsl:when test="@charset"><xsl:value-of select="@charset"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="screenColor">
<xsl:choose>
<xsl:when test="@screencolor"><xsl:value-of select="@screencolor"/></xsl:when>
<xsl:otherwise>black</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">video</xsl:with-param>
<xsl:with-param name="parms">,model:<xsl:value-of select="$model"/>,screenWidth:<xsl:value-of select="$screenWidth"/>,screenHeight:<xsl:value-of select="$screenHeight"/>,charCols:<xsl:value-of select="$charCols"/>,charRows:<xsl:value-of select="$charRows"/>,charWidth:<xsl:value-of select="$charWidth"/>,charHeight:<xsl:value-of select="$charHeight"/>,charSet:'<xsl:value-of select="$charSet"/>',screenColor:'<xsl:value-of select="$screenColor"/>'</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="debugger[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/debugger"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="debugger[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">debugger</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="panel[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/panel"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="panel[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">panel</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="computer[@ref]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/computer"><xsl:with-param name="machine" select="$machine"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="computer[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="modules">
[<xsl:for-each select="module">
{<xsl:call-template name="module"/>}
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>]
</xsl:variable>
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">computer</xsl:with-param>
<xsl:with-param name="parms">,modules:<xsl:value-of select="$modules"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="module">
type:'<xsl:value-of select="@type"/>',refID:'<xsl:value-of select="@refid"/>'<xsl:if test="@start">,start:<xsl:value-of select="@start"/>,end:<xsl:value-of select="@end"/></xsl:if>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,162 @@
@CHARSET "UTF-8";
.page {
margin: 2% 2%;
padding: 2% 2%;
min-width: 30em;
overflow: auto;
font-size: large;
font-family: Helvetica, Arial, sans-serif;
background: #303030;
color: #ccc;
}
.page-header {
}
.page-header-title {
text-align: center;
}
.page a {
color: #7fc07f;
text-decoration: none;
}
a.footlink, a.paralink {
text-decoration: none;
}
a.footlink:link, a.paralink:link {
color: blue;
}
a.footlink:visited, a.paralink:visited {
color: blue;
}
.galleryitem {
float: left;
width: 200px;
}
.item {
float: left;
width: 2em;
text-indent: 1em;
}
.list {
margin-left: 3em;
text-indent: 0;
text-align: justify;
}
ul {
list-style: none;
}
div.pnumber {
float: left;
width: 2em;
text-indent: 1em;
}
div.pitem {
margin-left: 10em;
}
p.indent, .justified p {
text-indent: 2em;
text-align: justify;
line-height: 1.5em;
}
p.noindent {
text-indent: 0;
text-align: justify;
}
p.center, .center {
text-align: center;
}
li.para {
margin-top: 1em;
margin-bottom: 1em;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
blockquote.tag {
font-size: small;
font-family: Monaco, Fixed, monospace;
margin-top: 0;
margin-bottom: 0;
}
.blockquote {
padding-left: 1em;
text-indent: 0;
text-align: justify;
}
.italics {
font-style: italic;
}
.medium {
font-size: medium;
}
.small {
font-size: x-small;
}
.smallcaps {
font-variant: small-caps;
}
.strike {
text-decoration: line-through;
}
.summation, .bracelist {
display: inline-block;
position: relative;
vertical-align: middle;
text-align: center;
margin-bottom: 0.5ex;
text-indent: 0;
}
.bracelist-symbol {
font-size: 3em;
vertical-align: -40%;
}
.summation .summation-lower, .summation .summation-upper, .bracelist-item {
display: block;
font-size: 75%;
text-align: center;
}
.summation .summation-upper {
margin-bottom: 0;
margin-left: 0.8ex;
font-style: italic;
}
.summation .summation-lower{
margin-bottom: -0.6ex;
font-style: italic;
}
.summation .summation-symbol {
font-size: 2em;
}
p sup {
vertical-align: baseline;
position: relative;
bottom: .5em;
font-size: small;
}
p sub {
vertical-align: baseline;
position: relative;
bottom: -.5em;
font-size: small;
}
.footnote {
font-size: medium;
text-indent: 1em;
text-align: justify;
margin-top: .5em;
}
.image-right {
float: right;
margin-left: 1em;
margin-top: 1em;
margin-bottom: 1em;
}
.image-caption {
font-size: small;
text-align: center;
}

View file

@ -0,0 +1,450 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY ne "&#8800;"> <!ENTITY le "&#8804;"> <!ENTITY ge "&#8805;">
<!ENTITY times "&#215;"> <!ENTITY sdot "&#8901;"> <!ENTITY divide "&#247;">
<!ENTITY copy "&#169;"> <!ENTITY Sigma "&#931;"> <!ENTITY sigma "&#963;"> <!ENTITY sum "&#8721;"> <!ENTITY lbrace "&#123;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="documentStyles">
<link rel="stylesheet" type="text/css" href="/versions/c1pjs/1.19.4/document.css"/>
</xsl:template>
<xsl:template match="title">
<h1><xsl:apply-templates/></h1>
</xsl:template>
<xsl:template name="p">
<xsl:if test="@id">
<a name="{@id}"></a>
</xsl:if>
<xsl:choose>
<xsl:when test="not(@class)">
<p><xsl:apply-templates/></p>
</xsl:when>
<xsl:otherwise>
<p class="{@class}"><xsl:apply-templates/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="p">
<xsl:call-template name="p"/>
</xsl:template>
<xsl:template match="br">
<br/>
</xsl:template>
<xsl:template match="p[@number]">
<div class="pnumber">
<xsl:choose>
<xsl:when test="not(@number) or @number = ''">&nbsp;</xsl:when>
<xsl:otherwise><xsl:value-of select="@number"/></xsl:otherwise>
</xsl:choose>
</div>
<div class="pitem">
<xsl:call-template name="p"/>
</div>
</xsl:template>
<xsl:template match="span">
<xsl:choose>
<xsl:when test="not(@class)">
<span><xsl:apply-templates/></span>
</xsl:when>
<xsl:when test="@class = 'italics'">
<em><xsl:apply-templates/></em>
</xsl:when>
<xsl:otherwise>
<span class="{@class}"><xsl:apply-templates/></span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="h2">
<h2><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="h3">
<h3><xsl:apply-templates/></h3>
</xsl:template>
<xsl:template match="h4">
<h4><xsl:apply-templates/></h4>
</xsl:template>
<xsl:template match="h5">
<h5><xsl:apply-templates/></h5>
</xsl:template>
<xsl:template match="h6">
<h6><xsl:apply-templates/></h6>
</xsl:template>
<xsl:template match="em">
<em><xsl:apply-templates/></em>
</xsl:template>
<xsl:template match="strong">
<strong><xsl:apply-templates/></strong>
</xsl:template>
<xsl:template match="a">
<a href="{@href}" target="{@target}"><xsl:apply-templates/></a>
</xsl:template>
<xsl:template match="ol">
<blockquote><ol><xsl:apply-templates/></ol></blockquote>
</xsl:template>
<xsl:template match="ul">
<blockquote><ul><xsl:apply-templates/></ul></blockquote>
</xsl:template>
<xsl:template match="li">
<li><xsl:apply-templates/></li>
</xsl:template>
<xsl:template match="img">
<div><img src="{@src}" alt="image"/></div>
</xsl:template>
<xsl:template match="pre">
<pre><xsl:apply-templates/></pre>
</xsl:template>
<xsl:template match="figure">
<xsl:choose>
<xsl:when test="@pos">
<div class="{@pos}"><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
</xsl:when>
<xsl:otherwise>
<div><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="sub">
<sub><xsl:apply-templates/></sub>
</xsl:template>
<xsl:template match="sup">
<sup><xsl:apply-templates/></sup>
</xsl:template>
<xsl:template match="lt">&lt;</xsl:template>
<xsl:template match="gt">&gt;</xsl:template>
<xsl:template match="ne">&ne;</xsl:template>
<xsl:template match="le">&le;</xsl:template>
<xsl:template match="ge">&ge;</xsl:template>
<xsl:template match="times">&times;</xsl:template>
<xsl:template match="dot">&sdot;</xsl:template>
<xsl:template match="divide">&divide;</xsl:template>
<xsl:template match="sigma">&sigma;</xsl:template>
<xsl:template match="summation">
<span class="summation">
<span class="summation-upper"><xsl:value-of select="@upper"/></span>
<span class="summation-symbol">&sum;</span>
<span class="summation-lower"><xsl:value-of select="@lower"/></span>
</span>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="bracelist">
<span class="bracelist-symbol">&lbrace;</span>
<span class="bracelist">
<xsl:for-each select="item">
<span class="bracelist-item"><xsl:apply-templates/></span>
</xsl:for-each>
</span>
</xsl:template>
<xsl:template match="footlink">
<xsl:variable name="docID" select="/document/@id"/>
<a class="footlink" id="fn{$docID}_ref{@n}" href="#fn{$docID}_{@n}"><sup><xsl:if test="@quoted"><xsl:text>[</xsl:text></xsl:if><xsl:value-of select="@n"/><xsl:if test="@quoted"><xsl:text>]</xsl:text></xsl:if></sup></a>
</xsl:template>
<xsl:template match="footnote">
<xsl:variable name="docID" select="/document/@id"/>
<div class="footnote"><a id="fn{$docID}_{@n}" href="#fn{$docID}_ref{@n}"><sup><xsl:value-of select="@n"/></sup></a><xsl:text> </xsl:text>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template name="authors">
<xsl:for-each select="author"><xsl:if test="position() != 1"><xsl:text>, </xsl:text></xsl:if><xsl:if test="position() != 1 and position() = last()"><xsl:text>and </xsl:text></xsl:if><xsl:value-of select="."/></xsl:for-each>
</xsl:template>
<xsl:template name="formatDate">
<xsl:param name="date"/>
<xsl:param name="format">MDY</xsl:param>
<xsl:variable name="year">
<xsl:value-of select="substring-before($date,'-')"/>
</xsl:variable>
<xsl:variable name="mon-day">
<xsl:value-of select="substring-after($date,'-')"/>
</xsl:variable>
<xsl:variable name="mon">
<xsl:value-of select="substring-before($mon-day,'-')"/>
</xsl:variable>
<xsl:variable name="full-day">
<xsl:value-of select="substring-after($mon-day,'-')"/>
</xsl:variable>
<xsl:variable name="day">
<xsl:choose>
<xsl:when test="substring($full-day,1,1) = '0'"><xsl:value-of select="substring($full-day,2)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$full-day"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$mon = '01'">January </xsl:when>
<xsl:when test="$mon = '02'">February </xsl:when>
<xsl:when test="$mon = '03'">March </xsl:when>
<xsl:when test="$mon = '04'">April </xsl:when>
<xsl:when test="$mon = '05'">May </xsl:when>
<xsl:when test="$mon = '06'">June </xsl:when>
<xsl:when test="$mon = '07'">July </xsl:when>
<xsl:when test="$mon = '08'">August </xsl:when>
<xsl:when test="$mon = '09'">September </xsl:when>
<xsl:when test="$mon = '10'">October </xsl:when>
<xsl:when test="$mon = '11'">November </xsl:when>
<xsl:when test="$mon = '12'">December </xsl:when>
<xsl:when test="$mon = '00'"/> </xsl:choose>
<xsl:if test="$day != '0' and $format = 'MDY'">
<xsl:value-of select="$day"/><xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="$year"/>
</xsl:template>
<xsl:template match="gallery">
<h2><xsl:value-of select="description"/></h2>
<div class="gallery">
<xsl:apply-templates select="item" mode="gallery"/>
</div>
<div style="clear:both;"></div>
</xsl:template>
<xsl:template match="item" mode="gallery">
<div class="galleryitem">
<a href="{@ref}"><img src="/versions/images/current/pdf-192.jpg" alt="{.}"/></a><br/>
<div style="font-size:small; text-align:center;"><xsl:value-of select="."/></div>
</div>
</xsl:template>
<xsl:template match="list[@type = 'timeline']">
<xsl:if test="not(description)">
<h2>Timeline</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="timeline"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="timeline">
<xsl:if test="@ref">
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($documentFile)/document" mode="withDate">
<xsl:with-param name="itemRef" select="@ref"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="not(@ref)">
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="@date"/></xsl:call-template></h3>
<blockquote>
<xsl:value-of select="."/>
</blockquote>
</xsl:if>
</xsl:template>
<xsl:template match="list[@type = 'people']">
<xsl:if test="not(description)">
<h2>People</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="people"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="people">
<h3><xsl:value-of select="name"/></h3>
<xsl:apply-templates select="list"/>
</xsl:template>
<xsl:template match="list[@type = 'documents']">
<xsl:if test="description"><h2><xsl:value-of select="description"/></h2></xsl:if>
<ul>
<xsl:apply-templates select="item" mode="document"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="document">
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($documentFile)/document">
<xsl:with-param name="itemRef" select="@ref"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="document">
<xsl:param name="itemRef"/>
<li>
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/></xsl:call-template>
</li>
</xsl:template>
<xsl:template match="document" mode="withDate">
<xsl:param name="itemRef"/>
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="date"/><xsl:with-param name="format" select="MY"/></xsl:call-template></h3>
<blockquote>
<p>
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/><xsl:with-param name="multiLine" select="'true'"/></xsl:call-template>
</p>
</blockquote>
</xsl:template>
<xsl:template name="documentSummary">
<xsl:param name="itemRef"/>
<xsl:param name="multiLine">false</xsl:param>
<xsl:choose>
<xsl:when test="content|include">
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
<xsl:if test="@ref">
<span class="small">
<xsl:text> [</xsl:text><a href="{@ref}">Original</a><xsl:text>]</xsl:text>
</span>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="copy">
<span class="small">
<xsl:text> [</xsl:text><a href="{copy/@ref}"><xsl:value-of select="copy"/></a><xsl:text>]</xsl:text>
</span>
</xsl:if>
<xsl:if test="author"><xsl:if test="$multiLine = 'true'"><br/></xsl:if><span class="medium"><xsl:text> by </xsl:text><xsl:call-template name="authors"/></span></xsl:if>
<xsl:if test="source">
<span class="small">
<br/>
<xsl:text>[Source: </xsl:text>
<xsl:if test="site">
<a href="{site/@url}"><xsl:value-of select="site"/></a>
</xsl:if>
<xsl:if test="not(site)">
<a href="{source/@url}"><xsl:value-of select="source"/></a>
</xsl:if>
<xsl:text>]</xsl:text>
</span>
</xsl:if>
</xsl:template>
<xsl:template match="list[@type = 'resources']">
<xsl:if test="not(description)">
<h2>Resources</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="resources"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="resources">
<h3><xsl:value-of select="description"/></h3>
<xsl:apply-templates select="list"/>
</xsl:template>
<xsl:template match="list[@type = 'links']">
<xsl:if test="description">
<h4><xsl:value-of select="description"/></h4>
</xsl:if>
<ul>
<xsl:apply-templates select="item" mode="links"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="links">
<li><a href="{@ref}"><xsl:value-of select="."/></a></li>
</xsl:template>
<xsl:template match="list[not(@type)]">
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item|tag" mode="outer"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="outer">
<xsl:if test="description">
<h3><xsl:value-of select="description"/></h3>
</xsl:if>
<xsl:apply-templates select="list|item|tag" mode="inner"/>
</xsl:template>
<xsl:template match="list" mode="inner">
<xsl:if test="description">
<h4><xsl:value-of select="description"/></h4>
</xsl:if>
<ul>
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
</ul>
</xsl:template>
<xsl:template name="innerlist">
<xsl:if test="description">
<xsl:value-of select="description"/>
</xsl:if>
<ul>
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="inner">
<xsl:choose>
<xsl:when test="@ref">
<li><a href="{@ref}"><xsl:apply-templates/></a></li>
</xsl:when>
<xsl:when test="description">
<li><xsl:call-template name="innerlist"/></li>
</xsl:when>
<xsl:otherwise>
<li><xsl:apply-templates/></li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="para" mode="inner">
<li class="para"><xsl:apply-templates/></li>
</xsl:template>
<xsl:template match="tag" mode="outer">
<xsl:call-template name="tag"/>
</xsl:template>
<xsl:template match="tag" mode="inner">
<xsl:call-template name="tag"/>
</xsl:template>
<xsl:template name="tag">
<blockquote class="tag">
<xsl:text>&lt;</xsl:text><xsl:if test="@href"><a href="{@href}"><xsl:value-of select="@name"/></a></xsl:if><xsl:if test="not(@href)"><xsl:value-of select="@name"/></xsl:if><xsl:for-each select="attr"><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>="</xsl:text><xsl:value-of select="@value"/><xsl:text>"</xsl:text></xsl:for-each>
<xsl:choose>
<xsl:when test="tag"><xsl:text>&gt;</xsl:text><xsl:apply-templates mode="inner"/><xsl:text>&lt;/</xsl:text><xsl:value-of select="@name"/><xsl:text>&gt;</xsl:text></xsl:when>
<xsl:when test="normalize-space(.) != ''"><xsl:text>&gt;</xsl:text><xsl:value-of select="."/><xsl:text>&lt;/</xsl:text><xsl:value-of select="@name"/><xsl:text>&gt;</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>/&gt;</xsl:text></xsl:otherwise>
</xsl:choose>
</blockquote>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/c1pjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/c1pjs/1.19.4/components.xsl"/>
<xsl:template match="/machine">
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<p></p>
<div id="{@id}" class="machine {@class}js">
<xsl:call-template name="component">
<xsl:with-param name="machine" select="@id"/>
<xsl:with-param name="component" select="'machine'"/>
<xsl:with-param name="class"><xsl:value-of select="@class"/>js</xsl:with-param>
<xsl:with-param name="parms"><xsl:if test="@parms">,<xsl:value-of select="@parms"/></xsl:if></xsl:with-param>
</xsl:call-template>
</div>
</div>
<xsl:call-template name="commonBottom"/>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="debugger"><xsl:value-of select="@class"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2014-04-10" modified="2014-04-10" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/c1pjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/c1pjs/1.19.4/components.xsl"/>
<xsl:template match="/manifest[@type = 'document']">
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<h4>Document Manifest</h4>
<div class="common-sidebar">
<ul class="common-list-data">
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Title'"/>
<xsl:with-param name="node" select="title"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Version'"/>
<xsl:with-param name="node" select="version"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Source'"/>
<xsl:with-param name="node" select="source"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Documents'"/>
<xsl:with-param name="node" select="document"/>
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
</xsl:call-template>
</ul>
</div>
<div class="common-main">
<p><xsl:value-of select="desc"/></p>
<xsl:call-template name="commonBottom"/>
</div>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="/manifest[@type = 'software' or not(@type)]">
<xsl:variable name="machineClass">
<xsl:choose>
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<h4>Software Manifest</h4>
<div class="common-sidebar">
<ul class="common-list-data">
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Title'"/>
<xsl:with-param name="node" select="title"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Version'"/>
<xsl:with-param name="node" select="version"/>
<xsl:with-param name="default">Unknown</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Type'"/>
<xsl:with-param name="node" select="type"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Category'"/>
<xsl:with-param name="node" select="category"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Created'"/>
<xsl:with-param name="node" select="creationDate"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Creators'"/>
<xsl:with-param name="node" select="creator"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label"><xsl:if test="creationDate">Updated</xsl:if><xsl:if test="not(creationDate)">Released</xsl:if></xsl:with-param>
<xsl:with-param name="node" select="releaseDate"/>
<xsl:with-param name="default">Unknown</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Company'"/>
<xsl:with-param name="node" select="company"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Authors'"/>
<xsl:with-param name="node" select="author"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Contributors'"/>
<xsl:with-param name="node" select="contributor"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Publisher'"/>
<xsl:with-param name="node" select="publisher"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'License'"/>
<xsl:with-param name="node" select="license"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Source'"/>
<xsl:with-param name="node" select="source"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Disks'"/>
<xsl:with-param name="node" select="disk"/>
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
</xsl:call-template>
</ul>
</div>
<div class="common-main">
<xsl:for-each select="machine[not(@type) or @type = 'default']">
<xsl:call-template name="machine">
<xsl:with-param name="href" select="@href"/>
<xsl:with-param name="state" select="@state"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="not(machine[not(@type) or @type = 'default'])">
<p>No default machine specified for '<xsl:value-of select="title"/>' in manifest.xml</p>
</xsl:if>
<xsl:call-template name="commonBottom"/>
</div>
</div>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="machine/@debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="listItem">
<xsl:param name="label"/>
<xsl:param name="node"/>
<xsl:param name="default">Unknown</xsl:param>
<xsl:if test="$node != '' or $default != ''">
<li><xsl:value-of select="$label"/>
<ul class="common-list-data-items">
<xsl:for-each select="$node">
<xsl:variable name="desc">
<xsl:choose>
<xsl:when test="desc"><xsl:value-of select="desc"/></xsl:when>
<xsl:when test="org"><xsl:value-of select="org"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<li title="{$desc}">
<xsl:variable name="value">
<xsl:choose>
<xsl:when test="name">
<xsl:value-of select="name"/>
</xsl:when>
<xsl:when test="normalize-space(./text()) != ''">
<xsl:value-of select="normalize-space(./text())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="href">
<xsl:if test="@href"><xsl:value-of select="@href"/></xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$href != ''">
<a href="{$href}"><xsl:value-of select="$value"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="page">
<ul class="common-list-data-subitems">
<xsl:for-each select="page">
<li>
<xsl:if test="@href">
<a href="{$href}{@href}"><xsl:value-of select="."/></a>
</xsl:if>
<xsl:if test="not(@href)">
<xsl:value-of select="."/>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
<xsl:if test="not($node)">
<xsl:if test="@href">
<a href="{@href}"><xsl:value-of select="$default"/></a>
</xsl:if>
<xsl:if test="not(@href)">
<xsl:value-of select="$default"/>
</xsl:if>
</xsl:if>
</ul>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/c1pjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/c1pjs/1.19.4/document.xsl"/>
<xsl:include href="/versions/c1pjs/1.19.4/components.xsl"/>
<xsl:template match="/outline">
<xsl:variable name="machineClass">
<xsl:choose>
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="en">
<head>
<title><xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="documentStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<div class="page justified">
<xsl:apply-templates/>
</div>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,262 @@
@CHARSET "UTF-8";
/**
@author Jeff Parsons (@jeffpar)
@website http://www.pcjs.org/
@created 2013-05-05
@modified 2014-02-23
@license http://www.gnu.org/licenses/gpl.html
*/
body {
margin: 0;
background: #202020;
}
h1, h2 {
margin-top: 0;
color: #cccccc;
}
h1, h2, h3, h4 {
word-wrap: break-word;
}
h4 a {
color: #cccccc !important;
}
p {
line-height: 1.5em;
}
img {
max-width: 100%;
}
a img {
vertical-align: bottom;
}
pre, code {
color: #000000;
background-color: #cccccc;
font-family: Monaco, Consolas, "Lucida Console", monospace;
font-size: 12px;
}
pre {
margin: 1em 2em;
padding: 1em;
border-radius: 5px;
overflow: auto;
}
code {
padding: 1px;
}
pre a, code a {
color: #006400 !important;
}
.common {
width: 100%;
margin: 0 auto;
color: #cccccc;
}
.common a {
color: #7fc07f;
text-decoration: none;
}
.common hr {
border-color: #808080;
}
.common a:hover {
text-decoration: underline;
}
.common, .machine {
font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
font-size: 15px;
}
.machine {
margin: 15px;
overflow: hidden;
}
.c1pjs {
overflow: visible;
}
.machine-placeholder {
text-align: center;
font-weight: bold;
}
.common-top {
background: #202020;
font-size: small;
}
.common-top-left {
float: left;
width: 60%;
}
.common-top-left ul {
line-height: 1.5em;
list-style-type: none;
margin: 0;
padding: 1em 1em 1em 9px;
overflow: hidden;
}
.common-top-left ul li {
display: block;
float: left;
}
.common-top-left ul li a {
border-right: 1px solid #6f6f6f;
padding: 2px 6px 2px 6px;
}
.common-top-left ul li:last-child a {
border-right: none;
}
.common-top-right {
float: right;
width: 40%;
}
.common-top-right p {
float: right;
margin: 0;
padding: 1em;
}
.common-middle {
clear: both;
padding: 1px 1em 1px 1em;
background: #404040;
}
.common-sidebar {
float: left;
font-size: small;
width: 140px;
padding-bottom: 20px;
overflow: hidden;
white-space: nowrap;
word-wrap: break-word;
}
.common-list {
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.common-list li {
padding-bottom: 7px;
}
.common-list-data {
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.common-list-data li {
line-height: 1.5em;
}
.common-list-data-items, .common-list-data-subitems {
font-size: x-small;
list-style-type: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 2em;
}
.common-list-data-items li, .common-list-data-subitems li {
padding-bottom: 0;
}
.common-main {
margin-left: 150px;
}
.common-image-gallery {
margin: 0 auto;
text-align: center;
}
.common-image-gallery:after {
content: '';
display: block;
}
.common-image-frame {
display: inline-block;
margin: 8px;
text-align: center;
}
.common-image-link {
padding: 5px;
border: 1px solid black;
border-radius: 5px;
background-color: #FAEBD7;
}
.common-image-label {
font-size: x-small;
}
.common-bottom {
clear: both;
padding-top: 1em;
}
.common-bottom:after {
content: '';
display: block;
clear: both;
}
.common-reference {
float: left;
font-size: x-small;
}
.common-reference a {
text-decoration: none;
}
.common-copyright {
float: right;
font-size: x-small;
}
.common-copyright a {
text-decoration: none;
}
.md-list {
}
.md-list li {
line-height: 1.5em;
margin-bottom: 1em;
}
.md-list li p {
padding-left: 2em;
}
.md-list-compact {
}
.md-list-compact li {
margin-bottom: 0;
}
.md-list-none {
list-style-type: none;
padding-left: 2em;
}
.md-list-none li {
margin-bottom: 0;
}
@media screen and (max-width: 900px) {
.common-sidebar {
width: 100%;
white-space: normal;
}
.common-list {
padding-left: 0;
}
.common-list-data {
padding-left: 0;
}
.common-sidebar h4, .common-list li, .common-list-data li, .common-list-data-items li {
width: 130px;
float: left;
overflow: hidden;
vertical-align: top;
padding-right: 1em;
margin-top: 0;
}
.common-list-data-subitems {
display: none;
}
.common-main {
clear: both;
margin-left: 0;
padding-left: 0;
padding-right: 0;
}
.md-list-none {
padding-left: 1em;
}
}

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY ne "&#8800;"> <!ENTITY le "&#8804;"> <!ENTITY ge "&#8805;">
<!ENTITY times "&#215;"> <!ENTITY sdot "&#8901;"> <!ENTITY divide "&#247;">
<!ENTITY copy "&#169;"> <!ENTITY Sigma "&#931;"> <!ENTITY sigma "&#963;"> <!ENTITY sum "&#8721;"> <!ENTITY lbrace "&#123;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="commonStyles">
<meta charset="utf-8"/>
<link rel="shortcut icon" href="/versions/images/current/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/versions/pcjs/1.19.4/common.css"/>
</xsl:template>
<xsl:template name="commonTop">
<div class="common-top">
<div class="common-top-left">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/apps/pc/">Apps</a></li>
<li><a href="/disks/pc/">Disks</a></li>
<li><a href="/devices/pc/machine/">Machines</a></li>
<li><a href="/docs/">Docs</a></li>
<li><a href="/pubs/">Pubs</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="/docs/about/">About</a></li>
</ul>
</div>
<div class="common-top-right">
<p>Powered by <a href="http://nodejs.org" target="_blank">Node.js</a> and <a href="http://aws.amazon.com/elasticbeanstalk/" target="_blank">AWS</a> | <a href="http://github.com/jeffpar/pcjs" target="_blank">GitHub</a></p>
</div>
</div>
</xsl:template>
<xsl:template name="commonBottom">
<div class="common-bottom">
<p class="common-reference"></p>
<p class="common-copyright">
<span class="common-copyright"><a href="http://www.pcjs.org/">pcjs.org</a> website © 2012-2015 by <a href="http://twitter.com/jeffpar">@jeffpar</a></span><br/>
<span class="common-copyright">PCjs and C1Pjs released under <a href="http://gnu.org/licenses/gpl.html">GPL version 3 or later</a></span>
</p>
</div>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,146 @@
@CHARSET "UTF-8";
*:not(input,textarea) {
-webkit-user-select: none;
}
.pcjs-embed {
}
.pcjs-embed:after {
clear:both;
}
.pcjs-name, .pcjs-menu {
clear: both;
font-weight: bold;
padding-bottom: 4px;
}
.pcjs-menu {
float: left;
}
.pcjs-canvas {
width: 100%;
height: auto;
}
.pcjs-container {
color: #000000;
position: relative;
}
.pcjs-label {
font-size: small;
line-height: 19px;
vertical-align: middle;
float: left;
font-family: "Lucida Console", monospace;
}
.pcjs-control textarea {
font-family: Monaco, monospace;
font-size: x-small;
}
.pcjs-fieldset {
border: none;
margin: 0;
padding: 0;
}
.pcjs-flag {
font-family: "Lucida Console", monospace;
font-size: small;
text-align: center;
line-height: 19px;
vertical-align: middle;
}
.pcjs-register {
font-family: "Lucida Console", monospace;
font-size: small;
text-align: center;
line-height: 19px;
vertical-align: middle;
border: 1px solid black;
}
.pcjs-switches {
float: left;
}
.pcjs-bitBucket {
float: left;
width: 19px;
height: 38px;
}
.pcjs-bitCell {
float: left;
width: 19px;
height: 19px;
margin-right: -1px;
margin-bottom: -1px;
border: 1px solid black;
text-align: center;
line-height: 19px;
}
.pcjs-bitCellLeft {
border-left: 1px solid black;
}
.pcjs-bitLabel {
font-size: xx-small;
text-align: center;
}
.pcjs-description, .pcjs-status {
font-size: x-small;
line-height: 2em;
}
.pcjs-key {
border: 1px solid black;
font-size: x-small;
text-align: center;
position: absolute;
height: 34px;
line-height: 34px;
background-color: #ffffff;
}
.pcjs-led {
float: left;
width: 8px;
height: 8px;
margin: 4px;
border: 1px solid black;
text-align: center;
line-height: 19px;
background-color: #000000;
}
.pcjs-video-object {
clear: both;
height: auto;
position: relative;
line-height: 0;
}
.pcjs-video-object textarea {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
border: 0;
padding: 0;
line-height: 0;
}
.pcjs-reference {
float: left;
font-size: x-small;
}
.pcjs-reference a {
text-decoration: none;
}
.pcjs-copyright {
float: right;
font-size: x-small;
}
.pcjs-copyright a {
text-decoration: none;
}
@media screen and (max-width: 900px) {
.pcjs-textarea {
width: 100% !important;
}
.pcjs-registers {
width: 100% !important;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,162 @@
@CHARSET "UTF-8";
.page {
margin: 2% 2%;
padding: 2% 2%;
min-width: 30em;
overflow: auto;
font-size: large;
font-family: Helvetica, Arial, sans-serif;
background: #303030;
color: #ccc;
}
.page-header {
}
.page-header-title {
text-align: center;
}
.page a {
color: #7fc07f;
text-decoration: none;
}
a.footlink, a.paralink {
text-decoration: none;
}
a.footlink:link, a.paralink:link {
color: blue;
}
a.footlink:visited, a.paralink:visited {
color: blue;
}
.galleryitem {
float: left;
width: 200px;
}
.item {
float: left;
width: 2em;
text-indent: 1em;
}
.list {
margin-left: 3em;
text-indent: 0;
text-align: justify;
}
ul {
list-style: none;
}
div.pnumber {
float: left;
width: 2em;
text-indent: 1em;
}
div.pitem {
margin-left: 10em;
}
p.indent, .justified p {
text-indent: 2em;
text-align: justify;
line-height: 1.5em;
}
p.noindent {
text-indent: 0;
text-align: justify;
}
p.center, .center {
text-align: center;
}
li.para {
margin-top: 1em;
margin-bottom: 1em;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
blockquote.tag {
font-size: small;
font-family: Monaco, Fixed, monospace;
margin-top: 0;
margin-bottom: 0;
}
.blockquote {
padding-left: 1em;
text-indent: 0;
text-align: justify;
}
.italics {
font-style: italic;
}
.medium {
font-size: medium;
}
.small {
font-size: x-small;
}
.smallcaps {
font-variant: small-caps;
}
.strike {
text-decoration: line-through;
}
.summation, .bracelist {
display: inline-block;
position: relative;
vertical-align: middle;
text-align: center;
margin-bottom: 0.5ex;
text-indent: 0;
}
.bracelist-symbol {
font-size: 3em;
vertical-align: -40%;
}
.summation .summation-lower, .summation .summation-upper, .bracelist-item {
display: block;
font-size: 75%;
text-align: center;
}
.summation .summation-upper {
margin-bottom: 0;
margin-left: 0.8ex;
font-style: italic;
}
.summation .summation-lower{
margin-bottom: -0.6ex;
font-style: italic;
}
.summation .summation-symbol {
font-size: 2em;
}
p sup {
vertical-align: baseline;
position: relative;
bottom: .5em;
font-size: small;
}
p sub {
vertical-align: baseline;
position: relative;
bottom: -.5em;
font-size: small;
}
.footnote {
font-size: medium;
text-indent: 1em;
text-align: justify;
margin-top: .5em;
}
.image-right {
float: right;
margin-left: 1em;
margin-top: 1em;
margin-bottom: 1em;
}
.image-caption {
font-size: small;
text-align: center;
}

View file

@ -0,0 +1,450 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY ne "&#8800;"> <!ENTITY le "&#8804;"> <!ENTITY ge "&#8805;">
<!ENTITY times "&#215;"> <!ENTITY sdot "&#8901;"> <!ENTITY divide "&#247;">
<!ENTITY copy "&#169;"> <!ENTITY Sigma "&#931;"> <!ENTITY sigma "&#963;"> <!ENTITY sum "&#8721;"> <!ENTITY lbrace "&#123;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="documentStyles">
<link rel="stylesheet" type="text/css" href="/versions/pcjs/1.19.4/document.css"/>
</xsl:template>
<xsl:template match="title">
<h1><xsl:apply-templates/></h1>
</xsl:template>
<xsl:template name="p">
<xsl:if test="@id">
<a name="{@id}"></a>
</xsl:if>
<xsl:choose>
<xsl:when test="not(@class)">
<p><xsl:apply-templates/></p>
</xsl:when>
<xsl:otherwise>
<p class="{@class}"><xsl:apply-templates/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="p">
<xsl:call-template name="p"/>
</xsl:template>
<xsl:template match="br">
<br/>
</xsl:template>
<xsl:template match="p[@number]">
<div class="pnumber">
<xsl:choose>
<xsl:when test="not(@number) or @number = ''">&nbsp;</xsl:when>
<xsl:otherwise><xsl:value-of select="@number"/></xsl:otherwise>
</xsl:choose>
</div>
<div class="pitem">
<xsl:call-template name="p"/>
</div>
</xsl:template>
<xsl:template match="span">
<xsl:choose>
<xsl:when test="not(@class)">
<span><xsl:apply-templates/></span>
</xsl:when>
<xsl:when test="@class = 'italics'">
<em><xsl:apply-templates/></em>
</xsl:when>
<xsl:otherwise>
<span class="{@class}"><xsl:apply-templates/></span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="h2">
<h2><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="h3">
<h3><xsl:apply-templates/></h3>
</xsl:template>
<xsl:template match="h4">
<h4><xsl:apply-templates/></h4>
</xsl:template>
<xsl:template match="h5">
<h5><xsl:apply-templates/></h5>
</xsl:template>
<xsl:template match="h6">
<h6><xsl:apply-templates/></h6>
</xsl:template>
<xsl:template match="em">
<em><xsl:apply-templates/></em>
</xsl:template>
<xsl:template match="strong">
<strong><xsl:apply-templates/></strong>
</xsl:template>
<xsl:template match="a">
<a href="{@href}" target="{@target}"><xsl:apply-templates/></a>
</xsl:template>
<xsl:template match="ol">
<blockquote><ol><xsl:apply-templates/></ol></blockquote>
</xsl:template>
<xsl:template match="ul">
<blockquote><ul><xsl:apply-templates/></ul></blockquote>
</xsl:template>
<xsl:template match="li">
<li><xsl:apply-templates/></li>
</xsl:template>
<xsl:template match="img">
<div><img src="{@src}" alt="image"/></div>
</xsl:template>
<xsl:template match="pre">
<pre><xsl:apply-templates/></pre>
</xsl:template>
<xsl:template match="figure">
<xsl:choose>
<xsl:when test="@pos">
<div class="{@pos}"><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
</xsl:when>
<xsl:otherwise>
<div><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="sub">
<sub><xsl:apply-templates/></sub>
</xsl:template>
<xsl:template match="sup">
<sup><xsl:apply-templates/></sup>
</xsl:template>
<xsl:template match="lt">&lt;</xsl:template>
<xsl:template match="gt">&gt;</xsl:template>
<xsl:template match="ne">&ne;</xsl:template>
<xsl:template match="le">&le;</xsl:template>
<xsl:template match="ge">&ge;</xsl:template>
<xsl:template match="times">&times;</xsl:template>
<xsl:template match="dot">&sdot;</xsl:template>
<xsl:template match="divide">&divide;</xsl:template>
<xsl:template match="sigma">&sigma;</xsl:template>
<xsl:template match="summation">
<span class="summation">
<span class="summation-upper"><xsl:value-of select="@upper"/></span>
<span class="summation-symbol">&sum;</span>
<span class="summation-lower"><xsl:value-of select="@lower"/></span>
</span>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="bracelist">
<span class="bracelist-symbol">&lbrace;</span>
<span class="bracelist">
<xsl:for-each select="item">
<span class="bracelist-item"><xsl:apply-templates/></span>
</xsl:for-each>
</span>
</xsl:template>
<xsl:template match="footlink">
<xsl:variable name="docID" select="/document/@id"/>
<a class="footlink" id="fn{$docID}_ref{@n}" href="#fn{$docID}_{@n}"><sup><xsl:if test="@quoted"><xsl:text>[</xsl:text></xsl:if><xsl:value-of select="@n"/><xsl:if test="@quoted"><xsl:text>]</xsl:text></xsl:if></sup></a>
</xsl:template>
<xsl:template match="footnote">
<xsl:variable name="docID" select="/document/@id"/>
<div class="footnote"><a id="fn{$docID}_{@n}" href="#fn{$docID}_ref{@n}"><sup><xsl:value-of select="@n"/></sup></a><xsl:text> </xsl:text>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template name="authors">
<xsl:for-each select="author"><xsl:if test="position() != 1"><xsl:text>, </xsl:text></xsl:if><xsl:if test="position() != 1 and position() = last()"><xsl:text>and </xsl:text></xsl:if><xsl:value-of select="."/></xsl:for-each>
</xsl:template>
<xsl:template name="formatDate">
<xsl:param name="date"/>
<xsl:param name="format">MDY</xsl:param>
<xsl:variable name="year">
<xsl:value-of select="substring-before($date,'-')"/>
</xsl:variable>
<xsl:variable name="mon-day">
<xsl:value-of select="substring-after($date,'-')"/>
</xsl:variable>
<xsl:variable name="mon">
<xsl:value-of select="substring-before($mon-day,'-')"/>
</xsl:variable>
<xsl:variable name="full-day">
<xsl:value-of select="substring-after($mon-day,'-')"/>
</xsl:variable>
<xsl:variable name="day">
<xsl:choose>
<xsl:when test="substring($full-day,1,1) = '0'"><xsl:value-of select="substring($full-day,2)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$full-day"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$mon = '01'">January </xsl:when>
<xsl:when test="$mon = '02'">February </xsl:when>
<xsl:when test="$mon = '03'">March </xsl:when>
<xsl:when test="$mon = '04'">April </xsl:when>
<xsl:when test="$mon = '05'">May </xsl:when>
<xsl:when test="$mon = '06'">June </xsl:when>
<xsl:when test="$mon = '07'">July </xsl:when>
<xsl:when test="$mon = '08'">August </xsl:when>
<xsl:when test="$mon = '09'">September </xsl:when>
<xsl:when test="$mon = '10'">October </xsl:when>
<xsl:when test="$mon = '11'">November </xsl:when>
<xsl:when test="$mon = '12'">December </xsl:when>
<xsl:when test="$mon = '00'"/> </xsl:choose>
<xsl:if test="$day != '0' and $format = 'MDY'">
<xsl:value-of select="$day"/><xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="$year"/>
</xsl:template>
<xsl:template match="gallery">
<h2><xsl:value-of select="description"/></h2>
<div class="gallery">
<xsl:apply-templates select="item" mode="gallery"/>
</div>
<div style="clear:both;"></div>
</xsl:template>
<xsl:template match="item" mode="gallery">
<div class="galleryitem">
<a href="{@ref}"><img src="/versions/images/current/pdf-192.jpg" alt="{.}"/></a><br/>
<div style="font-size:small; text-align:center;"><xsl:value-of select="."/></div>
</div>
</xsl:template>
<xsl:template match="list[@type = 'timeline']">
<xsl:if test="not(description)">
<h2>Timeline</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="timeline"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="timeline">
<xsl:if test="@ref">
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($documentFile)/document" mode="withDate">
<xsl:with-param name="itemRef" select="@ref"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="not(@ref)">
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="@date"/></xsl:call-template></h3>
<blockquote>
<xsl:value-of select="."/>
</blockquote>
</xsl:if>
</xsl:template>
<xsl:template match="list[@type = 'people']">
<xsl:if test="not(description)">
<h2>People</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="people"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="people">
<h3><xsl:value-of select="name"/></h3>
<xsl:apply-templates select="list"/>
</xsl:template>
<xsl:template match="list[@type = 'documents']">
<xsl:if test="description"><h2><xsl:value-of select="description"/></h2></xsl:if>
<ul>
<xsl:apply-templates select="item" mode="document"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="document">
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
<xsl:apply-templates select="document($documentFile)/document">
<xsl:with-param name="itemRef" select="@ref"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="document">
<xsl:param name="itemRef"/>
<li>
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/></xsl:call-template>
</li>
</xsl:template>
<xsl:template match="document" mode="withDate">
<xsl:param name="itemRef"/>
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="date"/><xsl:with-param name="format" select="MY"/></xsl:call-template></h3>
<blockquote>
<p>
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/><xsl:with-param name="multiLine" select="'true'"/></xsl:call-template>
</p>
</blockquote>
</xsl:template>
<xsl:template name="documentSummary">
<xsl:param name="itemRef"/>
<xsl:param name="multiLine">false</xsl:param>
<xsl:choose>
<xsl:when test="content|include">
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
<xsl:if test="@ref">
<span class="small">
<xsl:text> [</xsl:text><a href="{@ref}">Original</a><xsl:text>]</xsl:text>
</span>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="copy">
<span class="small">
<xsl:text> [</xsl:text><a href="{copy/@ref}"><xsl:value-of select="copy"/></a><xsl:text>]</xsl:text>
</span>
</xsl:if>
<xsl:if test="author"><xsl:if test="$multiLine = 'true'"><br/></xsl:if><span class="medium"><xsl:text> by </xsl:text><xsl:call-template name="authors"/></span></xsl:if>
<xsl:if test="source">
<span class="small">
<br/>
<xsl:text>[Source: </xsl:text>
<xsl:if test="site">
<a href="{site/@url}"><xsl:value-of select="site"/></a>
</xsl:if>
<xsl:if test="not(site)">
<a href="{source/@url}"><xsl:value-of select="source"/></a>
</xsl:if>
<xsl:text>]</xsl:text>
</span>
</xsl:if>
</xsl:template>
<xsl:template match="list[@type = 'resources']">
<xsl:if test="not(description)">
<h2>Resources</h2>
</xsl:if>
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item" mode="resources"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="resources">
<h3><xsl:value-of select="description"/></h3>
<xsl:apply-templates select="list"/>
</xsl:template>
<xsl:template match="list[@type = 'links']">
<xsl:if test="description">
<h4><xsl:value-of select="description"/></h4>
</xsl:if>
<ul>
<xsl:apply-templates select="item" mode="links"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="links">
<li><a href="{@ref}"><xsl:value-of select="."/></a></li>
</xsl:template>
<xsl:template match="list[not(@type)]">
<xsl:if test="description">
<h2><xsl:value-of select="description"/></h2>
</xsl:if>
<blockquote>
<xsl:apply-templates select="item|tag" mode="outer"/>
</blockquote>
</xsl:template>
<xsl:template match="item" mode="outer">
<xsl:if test="description">
<h3><xsl:value-of select="description"/></h3>
</xsl:if>
<xsl:apply-templates select="list|item|tag" mode="inner"/>
</xsl:template>
<xsl:template match="list" mode="inner">
<xsl:if test="description">
<h4><xsl:value-of select="description"/></h4>
</xsl:if>
<ul>
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
</ul>
</xsl:template>
<xsl:template name="innerlist">
<xsl:if test="description">
<xsl:value-of select="description"/>
</xsl:if>
<ul>
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
</ul>
</xsl:template>
<xsl:template match="item" mode="inner">
<xsl:choose>
<xsl:when test="@ref">
<li><a href="{@ref}"><xsl:apply-templates/></a></li>
</xsl:when>
<xsl:when test="description">
<li><xsl:call-template name="innerlist"/></li>
</xsl:when>
<xsl:otherwise>
<li><xsl:apply-templates/></li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="para" mode="inner">
<li class="para"><xsl:apply-templates/></li>
</xsl:template>
<xsl:template match="tag" mode="outer">
<xsl:call-template name="tag"/>
</xsl:template>
<xsl:template match="tag" mode="inner">
<xsl:call-template name="tag"/>
</xsl:template>
<xsl:template name="tag">
<blockquote class="tag">
<xsl:text>&lt;</xsl:text><xsl:if test="@href"><a href="{@href}"><xsl:value-of select="@name"/></a></xsl:if><xsl:if test="not(@href)"><xsl:value-of select="@name"/></xsl:if><xsl:for-each select="attr"><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>="</xsl:text><xsl:value-of select="@value"/><xsl:text>"</xsl:text></xsl:for-each>
<xsl:choose>
<xsl:when test="tag"><xsl:text>&gt;</xsl:text><xsl:apply-templates mode="inner"/><xsl:text>&lt;/</xsl:text><xsl:value-of select="@name"/><xsl:text>&gt;</xsl:text></xsl:when>
<xsl:when test="normalize-space(.) != ''"><xsl:text>&gt;</xsl:text><xsl:value-of select="."/><xsl:text>&lt;/</xsl:text><xsl:value-of select="@name"/><xsl:text>&gt;</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>/&gt;</xsl:text></xsl:otherwise>
</xsl:choose>
</blockquote>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/pcjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/pcjs/1.19.4/components.xsl"/>
<xsl:template match="/machine">
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<p></p>
<div id="{@id}" class="machine {@class}js">
<xsl:call-template name="component">
<xsl:with-param name="machine" select="@id"/>
<xsl:with-param name="component" select="'machine'"/>
<xsl:with-param name="class"><xsl:value-of select="@class"/>js</xsl:with-param>
<xsl:with-param name="parms"><xsl:if test="@parms">,<xsl:value-of select="@parms"/></xsl:if></xsl:with-param>
</xsl:call-template>
</div>
</div>
<xsl:call-template name="commonBottom"/>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="debugger"><xsl:value-of select="@class"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2014-04-10" modified="2014-04-10" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/pcjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/pcjs/1.19.4/components.xsl"/>
<xsl:template match="/manifest[@type = 'document']">
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<h4>Document Manifest</h4>
<div class="common-sidebar">
<ul class="common-list-data">
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Title'"/>
<xsl:with-param name="node" select="title"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Version'"/>
<xsl:with-param name="node" select="version"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Source'"/>
<xsl:with-param name="node" select="source"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Documents'"/>
<xsl:with-param name="node" select="document"/>
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
</xsl:call-template>
</ul>
</div>
<div class="common-main">
<p><xsl:value-of select="desc"/></p>
<xsl:call-template name="commonBottom"/>
</div>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="/manifest[@type = 'software' or not(@type)]">
<xsl:variable name="machineClass">
<xsl:choose>
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="en">
<head>
<title><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<xsl:call-template name="commonTop"/>
<div class="common-middle">
<h4>Software Manifest</h4>
<div class="common-sidebar">
<ul class="common-list-data">
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Title'"/>
<xsl:with-param name="node" select="title"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Version'"/>
<xsl:with-param name="node" select="version"/>
<xsl:with-param name="default">Unknown</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Type'"/>
<xsl:with-param name="node" select="type"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Category'"/>
<xsl:with-param name="node" select="category"/>
<xsl:with-param name="default">None</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Created'"/>
<xsl:with-param name="node" select="creationDate"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Creators'"/>
<xsl:with-param name="node" select="creator"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label"><xsl:if test="creationDate">Updated</xsl:if><xsl:if test="not(creationDate)">Released</xsl:if></xsl:with-param>
<xsl:with-param name="node" select="releaseDate"/>
<xsl:with-param name="default">Unknown</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Company'"/>
<xsl:with-param name="node" select="company"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Authors'"/>
<xsl:with-param name="node" select="author"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Contributors'"/>
<xsl:with-param name="node" select="contributor"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Publisher'"/>
<xsl:with-param name="node" select="publisher"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'License'"/>
<xsl:with-param name="node" select="license"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Source'"/>
<xsl:with-param name="node" select="source"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
<xsl:call-template name="listItem">
<xsl:with-param name="label" select="'Disks'"/>
<xsl:with-param name="node" select="disk"/>
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
</xsl:call-template>
</ul>
</div>
<div class="common-main">
<xsl:for-each select="machine[not(@type) or @type = 'default']">
<xsl:call-template name="machine">
<xsl:with-param name="href" select="@href"/>
<xsl:with-param name="state" select="@state"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="not(machine[not(@type) or @type = 'default'])">
<p>No default machine specified for '<xsl:value-of select="title"/>' in manifest.xml</p>
</xsl:if>
<xsl:call-template name="commonBottom"/>
</div>
</div>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="machine/@debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="listItem">
<xsl:param name="label"/>
<xsl:param name="node"/>
<xsl:param name="default">Unknown</xsl:param>
<xsl:if test="$node != '' or $default != ''">
<li><xsl:value-of select="$label"/>
<ul class="common-list-data-items">
<xsl:for-each select="$node">
<xsl:variable name="desc">
<xsl:choose>
<xsl:when test="desc"><xsl:value-of select="desc"/></xsl:when>
<xsl:when test="org"><xsl:value-of select="org"/></xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<li title="{$desc}">
<xsl:variable name="value">
<xsl:choose>
<xsl:when test="name">
<xsl:value-of select="name"/>
</xsl:when>
<xsl:when test="normalize-space(./text()) != ''">
<xsl:value-of select="normalize-space(./text())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="href">
<xsl:if test="@href"><xsl:value-of select="@href"/></xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$href != ''">
<a href="{$href}"><xsl:value-of select="$value"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="page">
<ul class="common-list-data-subitems">
<xsl:for-each select="page">
<li>
<xsl:if test="@href">
<a href="{$href}{@href}"><xsl:value-of select="."/></a>
</xsl:if>
<xsl:if test="not(@href)">
<xsl:value-of select="."/>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
<xsl:if test="not($node)">
<xsl:if test="@href">
<a href="{@href}"><xsl:value-of select="$default"/></a>
</xsl:if>
<xsl:if test="not(@href)">
<xsl:value-of select="$default"/>
</xsl:if>
</xsl:if>
</ul>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!ENTITY sect "&#167;"> <!ENTITY copy "&#169;"> <!ENTITY para "&#182;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;">
<!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="about:legacy-compat"/>
<xsl:include href="/versions/pcjs/1.19.4/common.xsl"/>
<xsl:include href="/versions/pcjs/1.19.4/document.xsl"/>
<xsl:include href="/versions/pcjs/1.19.4/components.xsl"/>
<xsl:template match="/outline">
<xsl:variable name="machineClass">
<xsl:choose>
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="en">
<head>
<title><xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/></title>
<xsl:call-template name="commonStyles"/>
<xsl:call-template name="documentStyles"/>
<xsl:call-template name="componentStyles"/>
</head>
<body>
<div class="common">
<div class="page justified">
<xsl:apply-templates/>
</div>
</div>
<xsl:call-template name="componentScripts">
<xsl:with-param name="component">
<xsl:choose>
<xsl:when test="debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load diff

1048
versions/pcjs/1.19.4/pc.js Normal file

File diff suppressed because it is too large Load diff