Completed Keys factoring
This commit is contained in:
parent
5398064ec4
commit
5f622303b4
17 changed files with 3367 additions and 3853 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -38,10 +38,10 @@ if (DEBUGGER) {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("../../shared/lib/debugger");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var PC6502 = require("./defines");
|
||||
var Messages = require("./messages");
|
||||
var Memory = require("./memory");
|
||||
var Keyboard = require("./keyboard");
|
||||
var State = require("./state");
|
||||
var CPU = require("./cpu");
|
||||
var CPUDef = require("./cpudef");
|
||||
|
|
@ -719,19 +719,19 @@ if (DEBUGGER) {
|
|||
*/
|
||||
control.onkeydown = function onKeyDownDebugInput(event) {
|
||||
var sCmd;
|
||||
if (event.keyCode == Keyboard.KEYCODE.CR) {
|
||||
if (event.keyCode == Keys.KEYCODE.CR) {
|
||||
sCmd = control.value;
|
||||
control.value = "";
|
||||
dbg.doCommands(sCmd, true);
|
||||
}
|
||||
else if (event.keyCode == Keyboard.KEYCODE.ESC) {
|
||||
else if (event.keyCode == Keys.KEYCODE.ESC) {
|
||||
control.value = sCmd = "";
|
||||
}
|
||||
else {
|
||||
if (event.keyCode == Keyboard.KEYCODE.UP) {
|
||||
if (event.keyCode == Keys.KEYCODE.UP) {
|
||||
sCmd = dbg.getPrevCommand();
|
||||
}
|
||||
else if (event.keyCode == Keyboard.KEYCODE.DOWN) {
|
||||
else if (event.keyCode == Keys.KEYCODE.DOWN) {
|
||||
sCmd = dbg.getNextCommand();
|
||||
}
|
||||
if (sCmd != null) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ if (NODE) {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var Messages = require("./messages");
|
||||
var State = require("./state");
|
||||
var CPU = require("./cpu");
|
||||
|
|
@ -56,159 +57,6 @@ function Keyboard(parmsKbd)
|
|||
|
||||
Component.subclass(Keyboard);
|
||||
|
||||
/**
|
||||
* Alphanumeric and other common (printable) ASCII codes.
|
||||
*
|
||||
* TODO: Determine what we can do to get ALL constants like these inlined (enum doesn't seem to
|
||||
* get the job done); the problem seems to be limited to property references that use quotes, which
|
||||
* is why I've 'unquoted' as many of them as possible.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Keyboard.ASCII = {
|
||||
CTRL_A: 1, CTRL_C: 3, CTRL_Z: 26,
|
||||
' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39,
|
||||
'(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47,
|
||||
'0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55,
|
||||
'8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63,
|
||||
'@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71,
|
||||
H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79,
|
||||
P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87,
|
||||
X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95,
|
||||
'`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103,
|
||||
h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111,
|
||||
p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119,
|
||||
x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126
|
||||
};
|
||||
|
||||
/**
|
||||
* Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric
|
||||
* or function keys, some which may require special treatment (eg, preventDefault() if returning false on
|
||||
* the initial keyDown event is insufficient).
|
||||
*
|
||||
* keyCodes for most common ASCII keys can simply use the appropriate ASCII code above.
|
||||
*
|
||||
* Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined
|
||||
* them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). This conflict is
|
||||
* discussed further in the definition of CLICKCODE below.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Keyboard.KEYCODE = {
|
||||
/* 0x08 */ BS: 8,
|
||||
/* 0x09 */ TAB: 9,
|
||||
/* 0x0A */ LF: 10,
|
||||
/* 0x0D */ CR: 13,
|
||||
/* 0x10 */ SHIFT: 16,
|
||||
/* 0x11 */ CTRL: 17,
|
||||
/* 0x12 */ ALT: 18,
|
||||
/* 0x13 */ PAUSE: 19, // PAUSE/BREAK
|
||||
/* 0x14 */ CAPS_LOCK: 20,
|
||||
/* 0x1B */ ESC: 27,
|
||||
/* 0x20 */ SPACE: 32,
|
||||
/* 0x21 */ PGUP: 33,
|
||||
/* 0x22 */ PGDN: 34,
|
||||
/* 0x23 */ END: 35,
|
||||
/* 0x24 */ HOME: 36,
|
||||
/* 0x25 */ LEFT: 37,
|
||||
/* 0x26 */ UP: 38,
|
||||
/* 0x27 */ RIGHT: 39,
|
||||
/* 0x27 */ FF_QUOTE: 39,
|
||||
/* 0x28 */ DOWN: 40,
|
||||
/* 0x2C */ FF_COMMA: 44,
|
||||
/* 0x2C */ PRTSC: 44,
|
||||
/* 0x2D */ INS: 45,
|
||||
/* 0x2E */ DEL: 46,
|
||||
/* 0x2E */ FF_PERIOD: 46,
|
||||
/* 0x2F */ FF_SLASH: 47,
|
||||
/* 0x3B */ FF_SEMI: 59,
|
||||
/* 0x3D */ FF_EQUALS: 61,
|
||||
/* 0x5B */ CMD: 91, // aka WIN
|
||||
/* 0x5B */ FF_LBRACK: 91,
|
||||
/* 0x5C */ FF_BSLASH: 92,
|
||||
/* 0x5D */ RCMD: 93, // aka MENU
|
||||
/* 0x5D */ FF_RBRACK: 93,
|
||||
/* 0x60 */ NUM_INS: 96, // 0
|
||||
/* 0x60 */ FF_BQUOTE: 96,
|
||||
/* 0x61 */ NUM_END: 97, // 1
|
||||
/* 0x62 */ NUM_DOWN: 98, // 2
|
||||
/* 0x63 */ NUM_PGDN: 99, // 3
|
||||
/* 0x64 */ NUM_LEFT: 100, // 4
|
||||
/* 0x65 */ NUM_CENTER: 101, // 5
|
||||
/* 0x66 */ NUM_RIGHT: 102, // 6
|
||||
/* 0x67 */ NUM_HOME: 103, // 7
|
||||
/* 0x68 */ NUM_UP: 104, // 8
|
||||
/* 0x69 */ NUM_PGUP: 105, // 9
|
||||
/* 0x6A */ NUM_MUL: 106,
|
||||
/* 0x6B */ NUM_ADD: 107,
|
||||
/* 0x6D */ NUM_SUB: 109,
|
||||
/* 0x6E */ NUM_DEL: 110, // .
|
||||
/* 0x6F */ NUM_DIV: 111,
|
||||
/* 0x70 */ F1: 112,
|
||||
/* 0x71 */ F2: 113,
|
||||
/* 0x72 */ F3: 114,
|
||||
/* 0x73 */ F4: 115,
|
||||
/* 0x74 */ F5: 116,
|
||||
/* 0x75 */ F6: 117,
|
||||
/* 0x76 */ F7: 118,
|
||||
/* 0x77 */ F8: 119,
|
||||
/* 0x78 */ F9: 120,
|
||||
/* 0x79 */ F10: 121,
|
||||
/* 0x7A */ F11: 122,
|
||||
/* 0x7B */ F12: 123,
|
||||
/* 0x90 */ NUM_LOCK: 144,
|
||||
/* 0x91 */ SCROLL_LOCK: 145,
|
||||
/* 0xAD */ FF_DASH: 173,
|
||||
/* 0xBA */ SEMI: 186, // Firefox: 59
|
||||
/* 0xBB */ EQUALS: 187, // Firefox: 61
|
||||
/* 0xBC */ COMMA: 188, // Firefox: 44
|
||||
/* 0xBD */ DASH: 189, // Firefox: 173
|
||||
/* 0xBE */ PERIOD: 190, // Firefox: 46
|
||||
/* 0xBF */ SLASH: 191, // Firefox: 47
|
||||
/* 0xC0 */ BQUOTE: 192, // Firefox: 96
|
||||
/* 0xDB */ LBRACK: 219, // Firefox: 91
|
||||
/* 0xDC */ BSLASH: 220, // Firefox: 92
|
||||
/* 0xDD */ RBRACK: 221, // Firefox: 93
|
||||
/* 0xDE */ QUOTE: 222, // Firefox: 39
|
||||
/* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD)
|
||||
//
|
||||
// The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD),
|
||||
// where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4.
|
||||
//
|
||||
// Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really
|
||||
// been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I.
|
||||
//
|
||||
// ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press".
|
||||
//
|
||||
ONDOWN: 1000,
|
||||
//
|
||||
// ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left")
|
||||
//
|
||||
ONRIGHT: 2000,
|
||||
//
|
||||
// FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations.
|
||||
// The actual values are for internal use only and merely need to be unique and used consistently.
|
||||
//
|
||||
FAKE: 4000
|
||||
};
|
||||
|
||||
/*
|
||||
* Maps "stupid" keyCodes to their "non-stupid" counterparts
|
||||
*/
|
||||
Keyboard.STUPID_KEYCODES = {};
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.SEMI] = Keyboard.ASCII[';']; // 186 -> 59
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.EQUALS] = Keyboard.ASCII['=']; // 187 -> 61
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.COMMA] = Keyboard.ASCII[',']; // 188 -> 44
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.DASH] = Keyboard.ASCII['-']; // 189 -> 45
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.PERIOD] = Keyboard.ASCII['.']; // 190 -> 46
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.SLASH] = Keyboard.ASCII['/']; // 191 -> 47
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.BQUOTE] = Keyboard.ASCII['`']; // 192 -> 96
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.LBRACK] = Keyboard.ASCII['[']; // 219 -> 91
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.BSLASH] = Keyboard.ASCII['\\']; // 220 -> 92
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.RBRACK] = Keyboard.ASCII[']']; // 221 -> 93
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.QUOTE] = Keyboard.ASCII["'"]; // 222 -> 39
|
||||
Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.FF_DASH] = Keyboard.ASCII['-'];
|
||||
|
||||
/**
|
||||
* Keyboard.init()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ if (DEBUGGER) {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("../../shared/lib/debugger");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var State = require("../../shared/lib/state");
|
||||
var PC8080 = require("./defines");
|
||||
var CPUDef8080 = require("./cpudef");
|
||||
var CPU8080 = require("./cpu");
|
||||
var Keyboard8080= require("./keyboard");
|
||||
var Messages8080= require("./messages");
|
||||
var Memory8080 = require("./memory");
|
||||
}
|
||||
|
|
@ -683,19 +683,19 @@ if (DEBUGGER) {
|
|||
*/
|
||||
control.onkeydown = function onKeyDownDebugInput(event) {
|
||||
var sCmd;
|
||||
if (event.keyCode == Keyboard8080.KEYCODE.CR) {
|
||||
if (event.keyCode == Keys.KEYCODE.CR) {
|
||||
sCmd = control.value;
|
||||
control.value = "";
|
||||
dbg.doCommands(sCmd, true);
|
||||
}
|
||||
else if (event.keyCode == Keyboard8080.KEYCODE.ESC) {
|
||||
else if (event.keyCode == Keys.KEYCODE.ESC) {
|
||||
control.value = sCmd = "";
|
||||
}
|
||||
else {
|
||||
if (event.keyCode == Keyboard8080.KEYCODE.UP) {
|
||||
if (event.keyCode == Keys.KEYCODE.UP) {
|
||||
sCmd = dbg.getPrevCommand();
|
||||
}
|
||||
else if (event.keyCode == Keyboard8080.KEYCODE.DOWN) {
|
||||
else if (event.keyCode == Keys.KEYCODE.DOWN) {
|
||||
sCmd = dbg.getNextCommand();
|
||||
}
|
||||
if (sCmd != null) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ if (NODE) {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var PC8080 = require("./defines");
|
||||
var ChipSet8080 = require("./chipset");
|
||||
var Messages8080= require("./messages");
|
||||
|
|
@ -70,183 +71,6 @@ function Keyboard8080(parmsKbd)
|
|||
|
||||
Component.subclass(Keyboard8080);
|
||||
|
||||
/**
|
||||
* Alphanumeric and other common (printable) ASCII codes.
|
||||
*
|
||||
* TODO: Determine what we can do to get ALL constants like these inlined by the Closure Compiler
|
||||
* (enum doesn't seem to get the job done); the problem seems to be limited to property references
|
||||
* that use quotes, which is why I've 'unquoted' as many of them as possible.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Keyboard8080.ASCII = {
|
||||
CTRL_A: 1, CTRL_C: 3, CTRL_Z: 26,
|
||||
' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39,
|
||||
'(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47,
|
||||
'0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55,
|
||||
'8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63,
|
||||
'@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71,
|
||||
H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79,
|
||||
P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87,
|
||||
X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95,
|
||||
'`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103,
|
||||
h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111,
|
||||
p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119,
|
||||
x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126
|
||||
};
|
||||
|
||||
/**
|
||||
* Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric
|
||||
* or function keys, some which may require special treatment (eg, preventDefault() if returning false on
|
||||
* the initial keyDown event is insufficient).
|
||||
*
|
||||
* keyCodes for most common ASCII keys can simply use the appropriate ASCII code above.
|
||||
*
|
||||
* Most of these represent non-ASCII characters (eg, the LEFT arrow key), yet for some reason, browsers
|
||||
* defined them using ASCII codes (eg, the LEFT arrow key uses 37, which is the ASCII code for '%').
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Keyboard8080.KEYCODE = {
|
||||
/* 0x08 */ BS: 8,
|
||||
/* 0x09 */ TAB: 9,
|
||||
/* 0x0A */ LF: 10, // TODO: Determine if any key actually generates this (I suspect there is none)
|
||||
/* 0x0D */ CR: 13,
|
||||
/* 0x10 */ SHIFT: 16,
|
||||
/* 0x11 */ CTRL: 17,
|
||||
/* 0x12 */ ALT: 18,
|
||||
/* 0x13 */ PAUSE: 19, // PAUSE/BREAK
|
||||
/* 0x14 */ CAPSLOCK: 20,
|
||||
/* 0x1B */ ESC: 27,
|
||||
/* 0x20 */ SPACE: 32,
|
||||
/* 0x21 */ PGUP: 33,
|
||||
/* 0x22 */ PGDN: 34,
|
||||
/* 0x23 */ END: 35,
|
||||
/* 0x24 */ HOME: 36,
|
||||
/* 0x25 */ LEFT: 37,
|
||||
/* 0x26 */ UP: 38,
|
||||
/* 0x27 */ RIGHT: 39,
|
||||
/* 0x27 */ FF_QUOTE: 39,
|
||||
/* 0x28 */ DOWN: 40,
|
||||
/* 0x2C */ FF_COMMA: 44,
|
||||
/* 0x2C */ PRTSC: 44,
|
||||
/* 0x2D */ INS: 45,
|
||||
/* 0x2E */ DEL: 46,
|
||||
/* 0x2E */ FF_PERIOD: 46,
|
||||
/* 0x2F */ FF_SLASH: 47,
|
||||
/* 0x30 */ ZERO: 48,
|
||||
/* 0x31 */ ONE: 49,
|
||||
/* 0x32 */ TWO: 50,
|
||||
/* 0x33 */ THREE: 51,
|
||||
/* 0x34 */ FOUR: 52,
|
||||
/* 0x35 */ FIVE: 53,
|
||||
/* 0x36 */ SIX: 54,
|
||||
/* 0x37 */ SEVEN: 55,
|
||||
/* 0x38 */ EIGHT: 56,
|
||||
/* 0x39 */ NINE: 57,
|
||||
/* 0x3B */ FF_SEMI: 59,
|
||||
/* 0x3D */ FF_EQUALS: 61,
|
||||
/* 0x5B */ CMD: 91, // aka WIN
|
||||
/* 0x5B */ FF_LBRACK: 91,
|
||||
/* 0x5C */ FF_BSLASH: 92,
|
||||
/* 0x5D */ RCMD: 93, // aka MENU
|
||||
/* 0x5D */ FF_RBRACK: 93,
|
||||
/* 0x60 */ NUM_0: 96,
|
||||
/* 0x60 */ NUM_INS: 96,
|
||||
/* 0x60 */ FF_BQUOTE: 96,
|
||||
/* 0x61 */ NUM_1: 97,
|
||||
/* 0x61 */ NUM_END: 97,
|
||||
/* 0x62 */ NUM_2: 98,
|
||||
/* 0x62 */ NUM_DOWN: 98,
|
||||
/* 0x63 */ NUM_3: 99,
|
||||
/* 0x63 */ NUM_PGDN: 99,
|
||||
/* 0x64 */ NUM_4: 100,
|
||||
/* 0x64 */ NUM_LEFT: 100,
|
||||
/* 0x65 */ NUM_5: 101,
|
||||
/* 0x65 */ NUM_CENTER: 101,
|
||||
/* 0x66 */ NUM_6: 102,
|
||||
/* 0x66 */ NUM_RIGHT: 102,
|
||||
/* 0x67 */ NUM_7: 103,
|
||||
/* 0x67 */ NUM_HOME: 103,
|
||||
/* 0x68 */ NUM_8: 104,
|
||||
/* 0x68 */ NUM_UP: 104,
|
||||
/* 0x69 */ NUM_9: 105,
|
||||
/* 0x69 */ NUM_PGUP: 105,
|
||||
/* 0x6A */ NUM_MUL: 106,
|
||||
/* 0x6B */ NUM_ADD: 107,
|
||||
/* 0x6D */ NUM_SUB: 109,
|
||||
/* 0x6E */ NUM_DEL: 110, // aka PERIOD
|
||||
/* 0x6F */ NUM_DIV: 111,
|
||||
/* 0x70 */ F1: 112,
|
||||
/* 0x71 */ F2: 113,
|
||||
/* 0x72 */ F3: 114,
|
||||
/* 0x73 */ F4: 115,
|
||||
/* 0x74 */ F5: 116,
|
||||
/* 0x75 */ F6: 117,
|
||||
/* 0x76 */ F7: 118,
|
||||
/* 0x77 */ F8: 119,
|
||||
/* 0x78 */ F9: 120,
|
||||
/* 0x79 */ F10: 121,
|
||||
/* 0x7A */ F11: 122,
|
||||
/* 0x7B */ F12: 123,
|
||||
/* 0x90 */ NUM_LOCK: 144,
|
||||
/* 0x91 */ SCROLL_LOCK: 145,
|
||||
/* 0xAD */ FF_DASH: 173,
|
||||
/* 0xBA */ SEMI: 186, // Firefox: 59
|
||||
/* 0xBB */ EQUALS: 187, // Firefox: 61
|
||||
/* 0xBC */ COMMA: 188, // Firefox: 44
|
||||
/* 0xBD */ DASH: 189, // Firefox: 173
|
||||
/* 0xBE */ PERIOD: 190, // Firefox: 46
|
||||
/* 0xBF */ SLASH: 191, // Firefox: 47
|
||||
/* 0xC0 */ BQUOTE: 192, // Firefox: 96
|
||||
/* 0xDB */ LBRACK: 219, // Firefox: 91
|
||||
/* 0xDC */ BSLASH: 220, // Firefox: 92
|
||||
/* 0xDD */ RBRACK: 221, // Firefox: 93
|
||||
/* 0xDE */ QUOTE: 222, // Firefox: 39
|
||||
/* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD)
|
||||
//
|
||||
// The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD),
|
||||
// where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4.
|
||||
//
|
||||
// Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really
|
||||
// been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I.
|
||||
//
|
||||
// ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press".
|
||||
//
|
||||
ONDOWN: 1000,
|
||||
//
|
||||
// ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left")
|
||||
//
|
||||
ONRIGHT: 2000,
|
||||
//
|
||||
// FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations.
|
||||
// The actual values are for internal use only and merely need to be unique and used consistently.
|
||||
//
|
||||
FAKE: 4000
|
||||
};
|
||||
|
||||
/*
|
||||
* Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys.
|
||||
*/
|
||||
Keyboard8080.KEYCODE.NUM_CR = Keyboard8080.KEYCODE.CR + Keyboard8080.KEYCODE.ONRIGHT;
|
||||
|
||||
/*
|
||||
* Maps "stupid" keyCodes to their "non-stupid" counterparts
|
||||
*/
|
||||
Keyboard8080.STUPID_KEYCODES = {};
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.SEMI] = Keyboard8080.ASCII[';']; // 186 -> 59
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.EQUALS] = Keyboard8080.ASCII['=']; // 187 -> 61
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.COMMA] = Keyboard8080.ASCII[',']; // 188 -> 44
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.DASH] = Keyboard8080.ASCII['-']; // 189 -> 45
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.PERIOD] = Keyboard8080.ASCII['.']; // 190 -> 46
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.SLASH] = Keyboard8080.ASCII['/']; // 191 -> 47
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.BQUOTE] = Keyboard8080.ASCII['`']; // 192 -> 96
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.LBRACK] = Keyboard8080.ASCII['[']; // 219 -> 91
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.BSLASH] = Keyboard8080.ASCII['\\']; // 220 -> 92
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.RBRACK] = Keyboard8080.ASCII[']']; // 221 -> 93
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.QUOTE] = Keyboard8080.ASCII["'"]; // 222 -> 39
|
||||
Keyboard8080.STUPID_KEYCODES[Keyboard8080.KEYCODE.FF_DASH] = Keyboard8080.ASCII['-'];
|
||||
|
||||
Keyboard8080.MINPRESSTIME = 100; // 100ms
|
||||
|
||||
/**
|
||||
|
|
@ -256,9 +80,9 @@ Keyboard8080.MINPRESSTIME = 100; // 100ms
|
|||
* a simple object literal for this and all other object initializations.
|
||||
*/
|
||||
Keyboard8080.WASDCODES = {};
|
||||
Keyboard8080.WASDCODES[Keyboard8080.ASCII.A] = Keyboard8080.KEYCODE.LEFT;
|
||||
Keyboard8080.WASDCODES[Keyboard8080.ASCII.D] = Keyboard8080.KEYCODE.RIGHT;
|
||||
Keyboard8080.WASDCODES[Keyboard8080.ASCII.L] = Keyboard8080.KEYCODE.SPACE;
|
||||
Keyboard8080.WASDCODES[Keys.ASCII.A] = Keys.KEYCODE.LEFT;
|
||||
Keyboard8080.WASDCODES[Keys.ASCII.D] = Keys.KEYCODE.RIGHT;
|
||||
Keyboard8080.WASDCODES[Keys.ASCII.L] = Keys.KEYCODE.SPACE;
|
||||
|
||||
/*
|
||||
* Supported configurations
|
||||
|
|
@ -269,12 +93,12 @@ Keyboard8080.SI1978 = {
|
|||
ALTCODES: Keyboard8080.WASDCODES,
|
||||
LEDCODES: {},
|
||||
SOFTCODES: {
|
||||
'1p': Keyboard8080.KEYCODE.ONE,
|
||||
'2p': Keyboard8080.KEYCODE.TWO,
|
||||
'coin': Keyboard8080.KEYCODE.THREE,
|
||||
'left': Keyboard8080.KEYCODE.LEFT,
|
||||
'right': Keyboard8080.KEYCODE.RIGHT,
|
||||
'fire': Keyboard8080.KEYCODE.SPACE
|
||||
'1p': Keys.KEYCODE.ONE,
|
||||
'2p': Keys.KEYCODE.TWO,
|
||||
'coin': Keys.KEYCODE.THREE,
|
||||
'left': Keys.KEYCODE.LEFT,
|
||||
'right': Keys.KEYCODE.RIGHT,
|
||||
'fire': Keys.KEYCODE.SPACE
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -284,7 +108,7 @@ Keyboard8080.VT100 = {
|
|||
ALTCODES: {},
|
||||
LEDCODES: {},
|
||||
SOFTCODES: {
|
||||
'setup': Keyboard8080.KEYCODE.F9
|
||||
'setup': Keys.KEYCODE.F9
|
||||
},
|
||||
/*
|
||||
* Reading port 0x82 returns a key address from the VT100 keyboard's UART data output.
|
||||
|
|
@ -329,89 +153,89 @@ Keyboard8080.VT100 = {
|
|||
/*
|
||||
* Table to map host key codes to VT100 key addresses (ie, unique 7-bit values representing key positions on the VT100)
|
||||
*/
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.DEL] = 0x03;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.P] = 0x05;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.O] = 0x06;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.Y] = 0x07;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.T] = 0x08;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.W] = 0x09;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.Q] = 0x0A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.RIGHT] = 0x10;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.RBRACK] = 0x14;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.LBRACK] = 0x15;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.I] = 0x16;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.U] = 0x17;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.R] = 0x18;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.E] = 0x19;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.ONE] = 0x1A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.LEFT] = 0x20;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.DOWN] = 0x22;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F6] = 0x23; // aka BREAK
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.PAUSE] = 0x23; // aka BREAK
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.BQUOTE] = 0x24;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.DASH] = 0x25;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NINE] = 0x26;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.SEVEN] = 0x27;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.FOUR] = 0x28;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.THREE] = 0x29;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.ESC] = 0x2A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.UP] = 0x30;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F3] = 0x31; // aka PF3
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F1] = 0x32; // aka PF1
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.BS] = 0x33;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.EQUALS] = 0x34;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.ZERO] = 0x35;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.EIGHT] = 0x36;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.SIX] = 0x37;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.FIVE] = 0x38;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.TWO] = 0x39;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.TAB] = 0x3A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_7] = 0x40;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F4] = 0x41; // aka PF4
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F2] = 0x42; // aka PF2
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_0] = 0x43;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F7] = 0x44; // aka LINE FEED
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.BSLASH] = 0x45;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.L] = 0x46;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.K] = 0x47;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.G] = 0x48;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.F] = 0x49;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.A] = 0x4A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_8] = 0x50;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_CR] = 0x51;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_2] = 0x52;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_1] = 0x53;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.QUOTE] = 0x55;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.SEMI] = 0x56;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.J] = 0x57;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.H] = 0x58;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.D] = 0x59;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.S] = 0x5A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_DEL] = 0x60; // keypad period
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F5] = 0x61; // aka KEYPAD COMMA
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_5] = 0x62;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_4] = 0x63;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.CR] = 0x64; // TODO: Figure out why the Technical Manual lists CR at both 0x04 and 0x64
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.PERIOD] = 0x65;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.COMMA] = 0x66;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.N] = 0x67;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.B] = 0x68;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.X] = 0x69;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F8] = 0x6A; // aka NO SCROLL
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_9] = 0x70;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_3] = 0x71;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_6] = 0x72;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.NUM_SUB] = 0x73; // aka KEYPAD MINUS
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.SLASH] = 0x75;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.M] = 0x76;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII[' ']] = 0x77;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.V] = 0x78;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.C] = 0x79;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.ASCII.Z] = 0x7A;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.F9] = 0x7B; // aka SET-UP
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.CTRL] = 0x7C;
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.SHIFT] = 0x7D; // either shift key (doesn't matter)
|
||||
Keyboard8080.VT100.KEYMAP[Keyboard8080.KEYCODE.CAPSLOCK]= 0x7E;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.DEL] = 0x03;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.P] = 0x05;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.O] = 0x06;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.Y] = 0x07;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.T] = 0x08;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.W] = 0x09;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.Q] = 0x0A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.RIGHT] = 0x10;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.RBRACK] = 0x14;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.LBRACK] = 0x15;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.I] = 0x16;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.U] = 0x17;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.R] = 0x18;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.E] = 0x19;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.ONE] = 0x1A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.LEFT] = 0x20;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.DOWN] = 0x22;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F6] = 0x23; // aka BREAK
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.PAUSE] = 0x23; // aka BREAK
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.BQUOTE] = 0x24;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.DASH] = 0x25;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NINE] = 0x26;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.SEVEN] = 0x27;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.FOUR] = 0x28;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.THREE] = 0x29;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.ESC] = 0x2A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.UP] = 0x30;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F3] = 0x31; // aka PF3
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F1] = 0x32; // aka PF1
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.BS] = 0x33;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.EQUALS] = 0x34;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.ZERO] = 0x35;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.EIGHT] = 0x36;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.SIX] = 0x37;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.FIVE] = 0x38;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.TWO] = 0x39;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.TAB] = 0x3A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_7] = 0x40;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F4] = 0x41; // aka PF4
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F2] = 0x42; // aka PF2
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_0] = 0x43;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F7] = 0x44; // aka LINE FEED
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.BSLASH] = 0x45;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.L] = 0x46;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.K] = 0x47;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.G] = 0x48;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.F] = 0x49;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.A] = 0x4A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_8] = 0x50;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_CR] = 0x51;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_2] = 0x52;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_1] = 0x53;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.QUOTE] = 0x55;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.SEMI] = 0x56;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.J] = 0x57;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.H] = 0x58;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.D] = 0x59;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.S] = 0x5A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_DEL] = 0x60; // keypad period
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F5] = 0x61; // aka KEYPAD COMMA
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_5] = 0x62;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_4] = 0x63;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.CR] = 0x64; // TODO: Figure out why the Technical Manual lists CR at both 0x04 and 0x64
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.PERIOD] = 0x65;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.COMMA] = 0x66;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.N] = 0x67;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.B] = 0x68;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.X] = 0x69;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F8] = 0x6A; // aka NO SCROLL
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_9] = 0x70;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_3] = 0x71;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_6] = 0x72;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.NUM_SUB] = 0x73; // aka KEYPAD MINUS
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.SLASH] = 0x75;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.M] = 0x76;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII[' ']] = 0x77;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.V] = 0x78;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.C] = 0x79;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.ASCII.Z] = 0x7A;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.F9] = 0x7B; // aka SET-UP
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.CTRL] = 0x7C;
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.SHIFT] = 0x7D; // either shift key (doesn't matter)
|
||||
Keyboard8080.VT100.KEYMAP[Keys.KEYCODE.CAPS_LOCK] = 0x7E;
|
||||
|
||||
Keyboard8080.VT100.LEDCODES = {
|
||||
'l4': Keyboard8080.VT100.STATUS.LED4,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ if (DEBUGGER) {
|
|||
var X86 = require("./x86");
|
||||
var X86Seg = require("./x86seg");
|
||||
var Interrupts = require("./interrupts");
|
||||
var Keyboard = require("./keyboard");
|
||||
var Messages = require("./messages");
|
||||
var Memory = require("./memory");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,18 +313,6 @@ Keyboard.SCANCODE = {
|
|||
/* 0xE1 */ EXTEND2: 225
|
||||
};
|
||||
|
||||
/**
|
||||
* The set of values that a browser may store in the 'location' property of a keyboard event object
|
||||
* which we also support.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Keyboard.LOCATION = {
|
||||
LEFT: 1,
|
||||
RIGHT: 2,
|
||||
NUMPAD: 3
|
||||
};
|
||||
|
||||
/**
|
||||
* These internal "shift key" states are used to indicate BOTH the physical shift-key states (in bitsState)
|
||||
* and the simulated shift-key states (in bitsStateSim). The LOCK keys are problematic in both cases: the
|
||||
|
|
@ -2116,7 +2104,7 @@ Keyboard.prototype.onKeyDown = function(event, fDown)
|
|||
if (Keyboard.SIMCODES[keyCode + Keys.KEYCODE.ONDOWN]) {
|
||||
|
||||
simCode += Keys.KEYCODE.ONDOWN;
|
||||
if (event.location == Keyboard.LOCATION.RIGHT) {
|
||||
if (event.location == Keys.LOCATION.RIGHT) {
|
||||
simCode += Keys.KEYCODE.ONRIGHT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ if (DEBUGGER) {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("../../shared/lib/debugger");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var State = require("../../shared/lib/state");
|
||||
var PDP11 = require("./defines");
|
||||
var CPUPDP11 = require("./cpu");
|
||||
var KeyboardPDP11 = require("./keyboard");
|
||||
var MessagesPDP11 = require("./messages");
|
||||
var MemoryPDP11 = require("./memory");
|
||||
}
|
||||
|
|
@ -353,19 +353,19 @@ if (DEBUGGER) {
|
|||
*/
|
||||
control.onkeydown = function onKeyDownDebugInput(event) {
|
||||
var sCmd;
|
||||
if (event.keyCode == KeyboardPDP11.KEYCODE.CR) {
|
||||
if (event.keyCode == Keys.KEYCODE.CR) {
|
||||
sCmd = control.value;
|
||||
control.value = "";
|
||||
dbg.doCommands(sCmd, true);
|
||||
}
|
||||
else if (event.keyCode == KeyboardPDP11.KEYCODE.ESC) {
|
||||
else if (event.keyCode == Keys.KEYCODE.ESC) {
|
||||
control.value = sCmd = "";
|
||||
}
|
||||
else {
|
||||
if (event.keyCode == KeyboardPDP11.KEYCODE.UP) {
|
||||
if (event.keyCode == Keys.KEYCODE.UP) {
|
||||
sCmd = dbg.getPrevCommand();
|
||||
}
|
||||
else if (event.keyCode == KeyboardPDP11.KEYCODE.DOWN) {
|
||||
else if (event.keyCode == Keys.KEYCODE.DOWN) {
|
||||
sCmd = dbg.getNextCommand();
|
||||
}
|
||||
if (sCmd != null) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ if (NODE) {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Keys = require("../../shared/lib/keys");
|
||||
var PDP11 = require("./defines");
|
||||
var MessagesPDP11 = require("./messages");
|
||||
}
|
||||
|
|
@ -57,183 +58,6 @@ function KeyboardPDP11(parmsKbd)
|
|||
|
||||
Component.subclass(KeyboardPDP11);
|
||||
|
||||
/**
|
||||
* Alphanumeric and other common (printable) ASCII codes.
|
||||
*
|
||||
* TODO: Determine what we can do to get ALL constants like these inlined by the Closure Compiler
|
||||
* (enum doesn't seem to get the job done); the problem seems to be limited to property references
|
||||
* that use quotes, which is why I've 'unquoted' as many of them as possible.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
KeyboardPDP11.ASCII = {
|
||||
CTRL_A: 1, CTRL_C: 3, CTRL_Z: 26,
|
||||
' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39,
|
||||
'(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47,
|
||||
'0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55,
|
||||
'8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63,
|
||||
'@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71,
|
||||
H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79,
|
||||
P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87,
|
||||
X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95,
|
||||
'`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103,
|
||||
h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111,
|
||||
p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119,
|
||||
x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126
|
||||
};
|
||||
|
||||
/**
|
||||
* Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric
|
||||
* or function keys, some which may require special treatment (eg, preventDefault() if returning false on
|
||||
* the initial keyDown event is insufficient).
|
||||
*
|
||||
* keyCodes for most common ASCII keys can simply use the appropriate ASCII code above.
|
||||
*
|
||||
* Most of these represent non-ASCII characters (eg, the LEFT arrow key), yet for some reason, browsers
|
||||
* defined them using ASCII codes (eg, the LEFT arrow key uses 37, which is the ASCII code for '%').
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
KeyboardPDP11.KEYCODE = {
|
||||
/* 0x08 */ BS: 8,
|
||||
/* 0x09 */ TAB: 9,
|
||||
/* 0x0A */ LF: 10, // TODO: Determine if any key actually generates this (I suspect there is none)
|
||||
/* 0x0D */ CR: 13,
|
||||
/* 0x10 */ SHIFT: 16,
|
||||
/* 0x11 */ CTRL: 17,
|
||||
/* 0x12 */ ALT: 18,
|
||||
/* 0x13 */ PAUSE: 19, // PAUSE/BREAK
|
||||
/* 0x14 */ CAPSLOCK: 20,
|
||||
/* 0x1B */ ESC: 27,
|
||||
/* 0x20 */ SPACE: 32,
|
||||
/* 0x21 */ PGUP: 33,
|
||||
/* 0x22 */ PGDN: 34,
|
||||
/* 0x23 */ END: 35,
|
||||
/* 0x24 */ HOME: 36,
|
||||
/* 0x25 */ LEFT: 37,
|
||||
/* 0x26 */ UP: 38,
|
||||
/* 0x27 */ RIGHT: 39,
|
||||
/* 0x27 */ FF_QUOTE: 39,
|
||||
/* 0x28 */ DOWN: 40,
|
||||
/* 0x2C */ FF_COMMA: 44,
|
||||
/* 0x2C */ PRTSC: 44,
|
||||
/* 0x2D */ INS: 45,
|
||||
/* 0x2E */ DEL: 46,
|
||||
/* 0x2E */ FF_PERIOD: 46,
|
||||
/* 0x2F */ FF_SLASH: 47,
|
||||
/* 0x30 */ ZERO: 48,
|
||||
/* 0x31 */ ONE: 49,
|
||||
/* 0x32 */ TWO: 50,
|
||||
/* 0x33 */ THREE: 51,
|
||||
/* 0x34 */ FOUR: 52,
|
||||
/* 0x35 */ FIVE: 53,
|
||||
/* 0x36 */ SIX: 54,
|
||||
/* 0x37 */ SEVEN: 55,
|
||||
/* 0x38 */ EIGHT: 56,
|
||||
/* 0x39 */ NINE: 57,
|
||||
/* 0x3B */ FF_SEMI: 59,
|
||||
/* 0x3D */ FF_EQUALS: 61,
|
||||
/* 0x5B */ CMD: 91, // aka WIN
|
||||
/* 0x5B */ FF_LBRACK: 91,
|
||||
/* 0x5C */ FF_BSLASH: 92,
|
||||
/* 0x5D */ RCMD: 93, // aka MENU
|
||||
/* 0x5D */ FF_RBRACK: 93,
|
||||
/* 0x60 */ NUM_0: 96,
|
||||
/* 0x60 */ NUM_INS: 96,
|
||||
/* 0x60 */ FF_BQUOTE: 96,
|
||||
/* 0x61 */ NUM_1: 97,
|
||||
/* 0x61 */ NUM_END: 97,
|
||||
/* 0x62 */ NUM_2: 98,
|
||||
/* 0x62 */ NUM_DOWN: 98,
|
||||
/* 0x63 */ NUM_3: 99,
|
||||
/* 0x63 */ NUM_PGDN: 99,
|
||||
/* 0x64 */ NUM_4: 100,
|
||||
/* 0x64 */ NUM_LEFT: 100,
|
||||
/* 0x65 */ NUM_5: 101,
|
||||
/* 0x65 */ NUM_CENTER: 101,
|
||||
/* 0x66 */ NUM_6: 102,
|
||||
/* 0x66 */ NUM_RIGHT: 102,
|
||||
/* 0x67 */ NUM_7: 103,
|
||||
/* 0x67 */ NUM_HOME: 103,
|
||||
/* 0x68 */ NUM_8: 104,
|
||||
/* 0x68 */ NUM_UP: 104,
|
||||
/* 0x69 */ NUM_9: 105,
|
||||
/* 0x69 */ NUM_PGUP: 105,
|
||||
/* 0x6A */ NUM_MUL: 106,
|
||||
/* 0x6B */ NUM_ADD: 107,
|
||||
/* 0x6D */ NUM_SUB: 109,
|
||||
/* 0x6E */ NUM_DEL: 110, // aka PERIOD
|
||||
/* 0x6F */ NUM_DIV: 111,
|
||||
/* 0x70 */ F1: 112,
|
||||
/* 0x71 */ F2: 113,
|
||||
/* 0x72 */ F3: 114,
|
||||
/* 0x73 */ F4: 115,
|
||||
/* 0x74 */ F5: 116,
|
||||
/* 0x75 */ F6: 117,
|
||||
/* 0x76 */ F7: 118,
|
||||
/* 0x77 */ F8: 119,
|
||||
/* 0x78 */ F9: 120,
|
||||
/* 0x79 */ F10: 121,
|
||||
/* 0x7A */ F11: 122,
|
||||
/* 0x7B */ F12: 123,
|
||||
/* 0x90 */ NUM_LOCK: 144,
|
||||
/* 0x91 */ SCROLL_LOCK: 145,
|
||||
/* 0xAD */ FF_DASH: 173,
|
||||
/* 0xBA */ SEMI: 186, // Firefox: 59
|
||||
/* 0xBB */ EQUALS: 187, // Firefox: 61
|
||||
/* 0xBC */ COMMA: 188, // Firefox: 44
|
||||
/* 0xBD */ DASH: 189, // Firefox: 173
|
||||
/* 0xBE */ PERIOD: 190, // Firefox: 46
|
||||
/* 0xBF */ SLASH: 191, // Firefox: 47
|
||||
/* 0xC0 */ BQUOTE: 192, // Firefox: 96
|
||||
/* 0xDB */ LBRACK: 219, // Firefox: 91
|
||||
/* 0xDC */ BSLASH: 220, // Firefox: 92
|
||||
/* 0xDD */ RBRACK: 221, // Firefox: 93
|
||||
/* 0xDE */ QUOTE: 222, // Firefox: 39
|
||||
/* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD)
|
||||
//
|
||||
// The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD),
|
||||
// where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4.
|
||||
//
|
||||
// Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really
|
||||
// been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I.
|
||||
//
|
||||
// ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press".
|
||||
//
|
||||
ONDOWN: 1000,
|
||||
//
|
||||
// ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left")
|
||||
//
|
||||
ONRIGHT: 2000,
|
||||
//
|
||||
// FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations.
|
||||
// The actual values are for internal use only and merely need to be unique and used consistently.
|
||||
//
|
||||
FAKE: 4000
|
||||
};
|
||||
|
||||
/*
|
||||
* Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys.
|
||||
*/
|
||||
KeyboardPDP11.KEYCODE.NUM_CR = KeyboardPDP11.KEYCODE.CR + KeyboardPDP11.KEYCODE.ONRIGHT;
|
||||
|
||||
/*
|
||||
* Maps "stupid" keyCodes to their "non-stupid" counterparts
|
||||
*/
|
||||
KeyboardPDP11.STUPID_KEYCODES = {};
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.SEMI] = KeyboardPDP11.ASCII[';']; // 186 -> 59
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.EQUALS] = KeyboardPDP11.ASCII['=']; // 187 -> 61
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.COMMA] = KeyboardPDP11.ASCII[',']; // 188 -> 44
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.DASH] = KeyboardPDP11.ASCII['-']; // 189 -> 45
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.PERIOD] = KeyboardPDP11.ASCII['.']; // 190 -> 46
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.SLASH] = KeyboardPDP11.ASCII['/']; // 191 -> 47
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.BQUOTE] = KeyboardPDP11.ASCII['`']; // 192 -> 96
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.LBRACK] = KeyboardPDP11.ASCII['[']; // 219 -> 91
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.BSLASH] = KeyboardPDP11.ASCII['\\']; // 220 -> 92
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.RBRACK] = KeyboardPDP11.ASCII[']']; // 221 -> 93
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.QUOTE] = KeyboardPDP11.ASCII["'"]; // 222 -> 39
|
||||
KeyboardPDP11.STUPID_KEYCODES[KeyboardPDP11.KEYCODE.FF_DASH] = KeyboardPDP11.ASCII['-'];
|
||||
|
||||
KeyboardPDP11.MINPRESSTIME = 100; // 100ms
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,15 +31,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Alphanumeric and other common (printable) ASCII codes.
|
||||
*
|
||||
* TODO: Determine what we can do to get ALL constants like these inlined (enum doesn't seem to
|
||||
* get the job done); the problem seems to be limited to property references that use quotes, which
|
||||
* is why I've 'unquoted' as many of them as possible.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
var Keys = {
|
||||
/*
|
||||
* Alphanumeric and other common (printable) ASCII codes.
|
||||
|
|
@ -77,7 +68,7 @@ var Keys = {
|
|||
KEYCODE: {
|
||||
/* 0x08 */ BS: 8,
|
||||
/* 0x09 */ TAB: 9,
|
||||
/* 0x0A */ LF: 10,
|
||||
/* 0x0A */ LF: 10, // TODO: Determine if any key actually generates this (I suspect there is none)
|
||||
/* 0x0D */ CR: 13,
|
||||
/* 0x10 */ SHIFT: 16,
|
||||
/* 0x11 */ CTRL: 17,
|
||||
|
|
@ -101,6 +92,16 @@ var Keys = {
|
|||
/* 0x2E */ DEL: 46,
|
||||
/* 0x2E */ FF_PERIOD: 46,
|
||||
/* 0x2F */ FF_SLASH: 47,
|
||||
/* 0x30 */ ZERO: 48,
|
||||
/* 0x31 */ ONE: 49,
|
||||
/* 0x32 */ TWO: 50,
|
||||
/* 0x33 */ THREE: 51,
|
||||
/* 0x34 */ FOUR: 52,
|
||||
/* 0x35 */ FIVE: 53,
|
||||
/* 0x36 */ SIX: 54,
|
||||
/* 0x37 */ SEVEN: 55,
|
||||
/* 0x38 */ EIGHT: 56,
|
||||
/* 0x39 */ NINE: 57,
|
||||
/* 0x3B */ FF_SEMI: 59,
|
||||
/* 0x3D */ FF_EQUALS: 61,
|
||||
/* 0x5B */ CMD: 91, // aka WIN
|
||||
|
|
@ -108,21 +109,31 @@ var Keys = {
|
|||
/* 0x5C */ FF_BSLASH: 92,
|
||||
/* 0x5D */ RCMD: 93, // aka MENU
|
||||
/* 0x5D */ FF_RBRACK: 93,
|
||||
/* 0x60 */ NUM_INS: 96, // 0
|
||||
/* 0x60 */ NUM_0: 96,
|
||||
/* 0x60 */ NUM_INS: 96,
|
||||
/* 0x60 */ FF_BQUOTE: 96,
|
||||
/* 0x61 */ NUM_END: 97, // 1
|
||||
/* 0x62 */ NUM_DOWN: 98, // 2
|
||||
/* 0x63 */ NUM_PGDN: 99, // 3
|
||||
/* 0x64 */ NUM_LEFT: 100, // 4
|
||||
/* 0x65 */ NUM_CENTER: 101, // 5
|
||||
/* 0x66 */ NUM_RIGHT: 102, // 6
|
||||
/* 0x67 */ NUM_HOME: 103, // 7
|
||||
/* 0x68 */ NUM_UP: 104, // 8
|
||||
/* 0x69 */ NUM_PGUP: 105, // 9
|
||||
/* 0x61 */ NUM_1: 97,
|
||||
/* 0x61 */ NUM_END: 97,
|
||||
/* 0x62 */ NUM_2: 98,
|
||||
/* 0x62 */ NUM_DOWN: 98,
|
||||
/* 0x63 */ NUM_3: 99,
|
||||
/* 0x63 */ NUM_PGDN: 99,
|
||||
/* 0x64 */ NUM_4: 100,
|
||||
/* 0x64 */ NUM_LEFT: 100,
|
||||
/* 0x65 */ NUM_5: 101,
|
||||
/* 0x65 */ NUM_CENTER: 101,
|
||||
/* 0x66 */ NUM_6: 102,
|
||||
/* 0x66 */ NUM_RIGHT: 102,
|
||||
/* 0x67 */ NUM_7: 103,
|
||||
/* 0x67 */ NUM_HOME: 103,
|
||||
/* 0x68 */ NUM_8: 104,
|
||||
/* 0x68 */ NUM_UP: 104,
|
||||
/* 0x69 */ NUM_9: 105,
|
||||
/* 0x69 */ NUM_PGUP: 105,
|
||||
/* 0x6A */ NUM_MUL: 106,
|
||||
/* 0x6B */ NUM_ADD: 107,
|
||||
/* 0x6D */ NUM_SUB: 109,
|
||||
/* 0x6E */ NUM_DEL: 110, // .
|
||||
/* 0x6E */ NUM_DEL: 110, // aka PERIOD
|
||||
/* 0x6F */ NUM_DIV: 111,
|
||||
/* 0x70 */ F1: 112,
|
||||
/* 0x71 */ F2: 113,
|
||||
|
|
@ -170,9 +181,23 @@ var Keys = {
|
|||
// The actual values are for internal use only and merely need to be unique and used consistently.
|
||||
//
|
||||
FAKE: 4000
|
||||
},
|
||||
/*
|
||||
* The set of values that a browser may store in the 'location' property of a keyboard event object
|
||||
* which we also support.
|
||||
*/
|
||||
LOCATION: {
|
||||
LEFT: 1,
|
||||
RIGHT: 2,
|
||||
NUMPAD: 3
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys.
|
||||
*/
|
||||
Keys.KEYCODE.NUM_CR = Keys.KEYCODE.CR + Keys.KEYCODE.ONRIGHT;
|
||||
|
||||
/*
|
||||
* Maps "stupid" keyCodes to their "non-stupid" counterparts
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -104,10 +104,10 @@
|
|||
"./modules/shared/lib/dumpapi.js",
|
||||
"./modules/shared/lib/reportapi.js",
|
||||
"./modules/shared/lib/userapi.js",
|
||||
"./modules/shared/lib/keys.js",
|
||||
"./modules/shared/lib/strlib.js",
|
||||
"./modules/shared/lib/usrlib.js",
|
||||
"./modules/shared/lib/weblib.js",
|
||||
"./modules/shared/lib/keys.js",
|
||||
"./modules/shared/lib/component.js",
|
||||
"./modules/pcx86/lib/defines.js",
|
||||
"./modules/pcx86/lib/x86.js",
|
||||
|
|
@ -148,6 +148,7 @@
|
|||
"./modules/shared/lib/dumpapi.js",
|
||||
"./modules/shared/lib/reportapi.js",
|
||||
"./modules/shared/lib/userapi.js",
|
||||
"./modules/shared/lib/keys.js",
|
||||
"./modules/shared/lib/strlib.js",
|
||||
"./modules/shared/lib/usrlib.js",
|
||||
"./modules/shared/lib/weblib.js",
|
||||
|
|
@ -178,6 +179,7 @@
|
|||
"./modules/shared/lib/dumpapi.js",
|
||||
"./modules/shared/lib/reportapi.js",
|
||||
"./modules/shared/lib/userapi.js",
|
||||
"./modules/shared/lib/keys.js",
|
||||
"./modules/shared/lib/strlib.js",
|
||||
"./modules/shared/lib/usrlib.js",
|
||||
"./modules/shared/lib/weblib.js",
|
||||
|
|
|
|||
|
|
@ -1,246 +1,248 @@
|
|||
(function(){var l;function aa(a){var b=16,c;if(a){b||(b=10);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}
|
||||
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 da(a){return"0x"+n(a,2)}function t(a){return"0x"+n(a,4)}function ea(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}function fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ga(){var a=ha();return-1!==a.indexOf("pcjs.org",a.length-8)}var ja={"&":"&","<":"<",">":">",'"':""","'":"'"};function ka(a){return a.replace(/[&<>"']/g,function(a){return ja[a]})}function la(a,b){return(a+" ").slice(0,b)}function ma(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
(function(){var l,n={ke:1,le:3,me:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,Sb:65,Gc:66,Ic:67,Vb:68,E:69,Lc:70,Mc:71,Nc:72,Oc:73,Vc:74,Wc:75,Xb:76,cd:77,dd:78,fd:79,gd:80,Q:81,nd:82,qd:83,wd:84,xd:85,yd:86,zd:87,Bd:88,Cd:89,Dd:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Te:97,Ue:98,Ve:99,d:100,e:101,We:102,Ye:103,Ze:104,$e:105,af:106,k:107,bf:108,
|
||||
cf:109,n:110,df:111,p:112,q:113,r:114,ef:115,t:116,gf:117,hf:118,jf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126};
|
||||
function aa(a){var b=16,c;if(a){b||(b=10);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}
|
||||
function t(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 ba(a){return"0x"+t(a,2)}function v(a){return"0x"+t(a,4)}function ea(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}function fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ga(){var a=ha();return-1!==a.indexOf("pcjs.org",a.length-8)}var ia={"&":"&","<":"<",">":">",'"':""","'":"'"};function ka(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function la(a,b){return(a+" ").slice(0,b)}function ma(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
var na={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};function oa(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var h=d+e>>1,g;g=c(b,a[h]);0<g?d=h+1:(e=h,f=!g)}return f?d:~d}var pa=Date.now||function(){return+new Date};
|
||||
function qa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}function ra(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1}
|
||||
function sa(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),d&&d(a,f,e))});if(b&&"object"==
|
||||
typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function ha(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function ta(){return window?window.navigator.userAgent:""}function v(a){window&&window.alert(a)}function va(a){var b=!1;window&&(b=window.confirm(a));return b}var wa=null;function xa(){if(null==wa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}wa=a}return wa}
|
||||
function ta(){return window?window.navigator.userAgent:""}function w(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var wa=null;function xa(){if(null==wa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}wa=a}return wa}
|
||||
function ya(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function za(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Aa(a){if(window){var b=ta();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 Ba(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function Ca(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||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);f=!0}}var Da={init:[],show:[],exit:[]},Ea=!1,Ja=!1,Ka=!0;function La(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ma(a){Da.init.push(a)}
|
||||
function Na(a){if(Ka)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Oa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Pa(a){!Ka&&a?(Ka=!0,Ea&&Qa("init"),Ja&&Qa("show")):Ka=a}function Qa(a){Da[a]&&Na(Da[a])}La("onload",function(){Ea=!0;Na(Da.init)});La("onpageshow",function(){Ja=!0;Na(Da.show)});La(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Na(Da.exit)});
|
||||
function w(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.gc=b.comment;this.Id=b;b=this.id.indexOf(".");0>b?this.Xa=this.id:(this.Ab=this.id.substr(0,b),this.Xa=this.id.substr(b+1));this[a]=c;this.C={ready:!1,cb:!1,Hb:!1,wa:!1,error:!1};this.Cb=null;this.C.error=!1;this.N={};this.I=null;this.sa=d||0;Ra.push(this)}var Ua=void 0,Va={};
|
||||
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Za=/\+/g,$a=/([^&=]+)=?([^&]*)/g;Wa=$a.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Za," "))]=decodeURIComponent(Wa[2].replace(Za," "))}function ab(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 z(a,b){b||(b=w);a.prototype=ab(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var bb=window.PCjs.Machines||(window.PCjs.Machines={}),Ra=window.PCjs.Components||(window.PCjs.Components=[])}else bb={},Ra=[];function cb(a,b,c){bb[a]&&b&&(bb[a][b]=c)}function Oa(a,b,c){b||v((c?c+": ":"")+a)}
|
||||
function db(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Ra.length;b++){var d=Ra[b];a&&d.id.indexOf(a)||c.push(d)}return c}function eb(a){if(void 0!==a){var b;for(b=0;b<Ra.length;b++)if(Ra[b].id===a)return Ra[b]}return null}function fb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<Ra.length;d++)if(c)c==Ra[d]&&(c=null);else if(!(a!=Ra[d].type||b&&Ra[d].id.indexOf(b)))return Ra[d]}return null}
|
||||
function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){v(c.message+" ("+a+")")}return b}function gb(a,b){for(var c=D(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pc8080-binding":(g=C(h))&&g.binding&&a.oa(g.type,g.binding,h,g.value),m=k.length}}}}
|
||||
function Ca(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||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);f=!0}}var Da={init:[],show:[],exit:[]},Ea=!1,Fa=!1,Ka=!0;function La(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ma(a){Da.init.push(a)}
|
||||
function Na(a){if(Ka)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Oa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Pa(a){!Ka&&a?(Ka=!0,Ea&&Qa("init"),Fa&&Qa("show")):Ka=a}function Qa(a){Da[a]&&Na(Da[a])}La("onload",function(){Ea=!0;Na(Da.init)});La("onpageshow",function(){Fa=!0;Na(Da.show)});La(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Na(Da.exit)});
|
||||
function z(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.cc=b.comment;this.Kd=b;b=this.id.indexOf(".");0>b?this.cb=this.id:(this.Ab=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=c;this.C={ready:!1,eb:!1,Kb:!1,xa:!1,error:!1};this.Db=null;this.C.error=!1;this.N={};this.H=null;this.ta=d||0;Ra.push(this)}var Sa=void 0,Va={};
|
||||
if(window){Sa||(Sa=window.location.search.substr(1));for(var Wa,Xa=/\+/g,$a=/([^&=]+)=?([^&]*)/g;Wa=$a.exec(Sa);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function ab(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 bb(a,b){b||(b=z);a.prototype=ab(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var cb=window.PCjs.Machines||(window.PCjs.Machines={}),Ra=window.PCjs.Components||(window.PCjs.Components=[])}else cb={},Ra=[];function db(a,b,c){cb[a]&&b&&(cb[a][b]=c)}function Oa(a,b,c){b||w((c?c+": ":"")+a)}
|
||||
function eb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Ra.length;b++){var d=Ra[b];a&&d.id.indexOf(a)||c.push(d)}return c}function fb(a){if(void 0!==a){var b;for(b=0;b<Ra.length;b++)if(Ra[b].id===a)return Ra[b]}return null}function gb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<Ra.length;d++)if(c)c==Ra[d]&&(c=null);else if(!(a!=Ra[d].type||b&&Ra[d].id.indexOf(b)))return Ra[d]}return null}
|
||||
function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){w(c.message+" ("+a+")")}return b}function hb(a,b){for(var c=D(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pc8080-binding":(g=A(h))&&g.binding&&a.oa(g.type,g.binding,h,g.value),m=k.length}}}}
|
||||
function D(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}
|
||||
w.prototype={constructor:w,parent:null,toString:function(){return this.name?this.name:this.id||this.type},oa:function(a,b,c){switch(b){case "clear":return this.N[b]||(this.N[b]=c,c.onclick=function(a){return function(){a.N.print&&(a.N.print.value="")}}(this)),!0;case "print":return this.N[b]||(this.Fa=this.N[b]=c,c.value="",this.g=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.ja=function(a){this.g(a,this.Xa)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.Xa+": "+a)},ja:function(a,b,c){Oa(a,b,c||this.type)},Da:function(){return this.C.wa=!0},Ha:function(a,b){b&&(this.C.wa=!1);return!0}};function E(a,b,c,d,e,f,h){a.I&&(!0===h?h=0:null==h&&(h=a.sa),hb(a.I,a,b,c,d,e,f,h))}function ib(a,b){a.I&&jb(a,0)&&a.I.message(b,void 0)}function jb(a,b){if(a.I){a===a.I?b|=0:b=b||a.sa;var c=a.I.sa&b;return!!b&&c===b||!!(c&a.I.fd)}return!1}
|
||||
function kb(a,b){if(a.C.Hb)return a.C.cb&&(a.C.cb=!1),a.C.Hb=!1;if(a.C.error)return a.g(a.toString()+" error"),!1;a.C.cb=b;return a.C.cb}function lb(a,b){a.C.cb&&(b?a.C.Hb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.C.cb}function F(a){if(!a.C.error&&(a.C.ready=!0,a.C.ready)){var b=a.Cb;a.Cb=null;b&&b()}}function mb(a,b){b&&(a.C.ready?b():a.Cb=b);return a.C.ready}function pb(a,b){a.C.error=!0;a.ja(b)}
|
||||
var qb="undefined"!==typeof ArrayBuffer,rb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
|
||||
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1],sb={cpu:1,bus:64,mem:128,port:256,nvr:16384,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function tb(a){w.call(this,"Panel",a,tb)}z(tb);l=tb.prototype;
|
||||
l.oa=function(a,b,c,d){return this.B&&this.B.oa(a,b,c,d)||this.b&&this.b.oa(a,b,c,d)||this.K&&this.K.oa(a,b,c,d)||this.I&&this.I.oa(a,b,c,d)?!0:this.parent.oa.call(this,a,b,c,d)};l.Oa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.I=d;this.K=ub(a,"Keyboard")};l.Da=function(a,b){b||vb();return!0};l.Ha=function(){return!0};l.Ia=function(){};function vb(){for(var a=!1,b=D(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=eb(e.id);f||(a=!0,f=new tb(e));gb(f,d);a&&F(f)}}Ma(vb);
|
||||
function wb(a,b,c){w.call(this,"Bus",a,wb);this.b=b;this.I=c;this.G=a.busWidth||16;this.L=Math.pow(2,this.G);this.w=this.L-1|0;this.ra=16>=this.G?10:20>=this.G?12:24>=this.G?14:15;this.Ga=1<<this.ra;this.M=this.Ga>>2;this.u=this.Ga-1;this.J=this.L/this.Ga|0;this.K=this.J-1;this.B=[];this.j=[];this.H=this.D=!1;this.O=[];this.P=[];a=new G;xb(a,this.I);this.Y=Array(this.J);for(b=0;b<this.J;b++)this.Y[b]=a;F(this)}z(wb);l=wb.prototype;l.reset=function(){};l.Da=function(a,b){b||this.reset();return!0};
|
||||
function yb(a,b,c,d){for(var e=b,f=c,h=e>>>a.ra;0<f&&h<a.Y.length;){var g=a.Y[h],k=h*a.Ga,m=a.Ga-(e-k);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.wb+=g.F-e,g.F=e,!0;if(e>=g.F+g.wb){m=g.size-(e-k);m>f&&(m=f);g.wb=e-g.F+m;e=k+a.Ga;f-=m;h++;continue}}return zb(1,e,f)}e=new G(e,m,a.Ga,d);xb(e,a.I,g);a.Y[h++]=e;e=k+a.Ga;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Ab[d]+" at "+t(b)),!0):zb(2,b,c)}l.$=function(a){return this.Y[(a&this.w)>>>this.ra].ib(a&this.u,a)};
|
||||
function Bb(a,b){return a.Y[(b&a.w)>>>a.ra].ub(b&a.u,b)}l.Ra=function(a){var b=a&this.u,c=(a&this.w)>>>this.ra;return b!=this.u?this.Y[c].sc(b,a):this.Y[c++].ib(b,a)|this.Y[c&this.K].ib(0,a+1)<<8};function Cb(a,b){var c=b&a.u,d=(b&a.w)>>>a.ra;return c!=a.u?a.Y[d].Mb(c,b):a.Y[d++].ub(c,b)|a.Y[d&a.K].ub(0,b+1)<<8}l.ua=function(a,b){this.Y[(a&this.w)>>>this.ra].kb(a&this.u,b&255,a)};function Db(a,b,c){a.Y[(b&a.w)>>>a.ra].xb(b&a.u,c&255,b)}
|
||||
l.Gb=function(a,b){var c=a&this.u,d=(a&this.w)>>>this.ra;c!=this.u?this.Y[d].xc(c,b&65535,a):(this.Y[d++].kb(c,b&255,a),this.Y[d&this.K].kb(0,b>>8&255,a+1))};function Eb(a,b){if(void 0===b)return a.H=!a.H,a.H;void 0===a.B[b]&&(a.B[b]=[null,!1]);a.B[b][1]=!a.B[b][1];return a.B[b][1]}function Gb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.B[k]?v("Input port "+t(k)+" already registered"):f.B[k]=[g,!1]}}
|
||||
function Hb(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.B[b],g=a.O[b]||1,k=1==g?255:2==g?65535:-1,m=k;void 0!==h?(h[0]&&(m=h[0](b,c),void 0===m?m=k:m&=k),a.I&&a.H!=h[1]&&Ib(a.I,b,m)):a.I&&(hb(a.I,a,b,null,c),a.H&&Ib(a.I,b,m));e|=m<<f;f+=g<<3;b+=g;d-=g}return e}function Rb(a,b){if(void 0===b)return a.D=!a.D,a.D;void 0===a.j[b]&&(a.j[b]=[null,!1]);a.j[b][1]=!a.j[b][1];return a.j[b][1]}
|
||||
function Sb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.j[k]?v("Output port "+t(k)+" already registered"):f.j[k]=[g,!1]}}function Tb(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.j[b],g=a.P[b]||1,k=1==g?255:2==g?65535:-1,k=(c>>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.I&&a.D!=h[1]&&Ub(a.I,b,k)}else a.I&&(hb(a.I,a,b,k,d),a.D&&Ub(a.I,b,k));f+=g<<3;b+=g;e-=g}}
|
||||
function zb(a,b,c){v("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Vb;if(qb){var Wb=new ArrayBuffer(2);(new DataView(Wb)).setUint16(0,256,!0);Vb=256===(new Uint16Array(Wb))[0]}else Vb=!1;var Xb=Vb;
|
||||
function G(a,b,c,d){this.id=Yb+=2;this.b=null;this.F=a;this.wb=b;this.size=c||0;this.type=d||Zb;this.N=d==$b;xb(this);this.Ma=this.ec=!1;if(c)if(qb)this.H=new ArrayBuffer(c),this.D=new DataView(this.H,0,c),this.u=new Uint8Array(this.H,0,c),this.K=new Uint16Array(this.H,0,c>>1),this.b=new Int32Array(this.H,0,c>>2),ac(this,Xb?bc:cc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;ac(this,dc)}else ac(this)}var Zb=0,$b=2,Ab=["NONE","RAM","ROM","VID","H/W"],Yb=0;
|
||||
G.prototype={constructor:G,parent:null,save:function(){var a,b;if(qb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(qb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ma=!0}return!1},Ya:function(a,b){b?0===this.j++&&ec(this,fc,!1):0===this.B++&&gc(this,fc,!1)},J:function(){this.I&&jb(this.I,129)&&this.I.message("attempt to read invalid block %"+n(this.F),!0);
|
||||
return 255},w:function(a,b){this.I&&jb(this.I,129)&&this.I.message("attempt to write "+t(b)+" to invalid block %"+n(this.F),!0)},L:function(a,b){return this.ib(a++,b++)|this.ib(a,b)<<8},G:function(a,b,c){this.kb(a++,b&255,c++);this.kb(a,b>>8,c)},X:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ea:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},ia:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.Ma=!0},ya:function(a,
|
||||
b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ma=!0},O:function(a,b){if(this.I&&null!=this.F){var c=this.I;hc(c,this.F+a,1,c.O)&&c.pa(!0)}return this.ub(a,b)},ba:function(a,b){if(this.I&&null!=this.F){var c=this.I;hc(c,this.F+a,2,c.O)&&c.pa(!0)}return this.Mb(a,b)},ha:function(a,b,c){if(this.I&&null!=this.F){var d=this.I;hc(d,this.F+a,1,d.D)&&d.pa(!0)}this.N?this.w(a,b,c):this.xb(a,b,c)},la:function(a,
|
||||
b,c){if(this.I&&null!=this.F){var d=this.I;hc(d,this.F+a,2,d.D)&&d.pa(!0)}this.N?this.w(a,b,c):this.Qb(a,b,c)},M:function(a){return this.u[a]},P:function(a){return this.u[a]},aa:function(a){return this.D.getUint16(a,!0)},da:function(a){return a&1?this.u[a]|this.u[a+1]<<8:this.K[a>>1]},ga:function(a,b){this.u[a]=b;this.Ma=!0},Xa:function(a,b){this.u[a]=b;this.Ma=!0},ka:function(a,b){this.D.setUint16(a,b,!0);this.Ma=!0},va:function(a,b){a&1?(this.u[a]=b,this.u[a+1]=b>>8):this.K[a>>1]=b;this.Ma=!0}};
|
||||
function xb(a,b,c){a.I=b;a.B=a.j=0;c&&((a.B=c.B)&&gc(a,fc,!1),(a.j=c.j)&&ec(a,fc,!1))}function ic(a,b){b?0===--a.j&&(a.kb=a.N?a.w:a.xb,a.xc=a.N?a.G:a.Qb):0===--a.B&&(a.ib=a.ub,a.sc=a.Mb)}function ec(a,b,c){c&&a.j||(a.kb=!a.N&&b[2]||a.w,a.xc=!a.N&&b[3]||a.G);if(c||void 0===c)a.xb=b[2]||a.w,a.Qb=b[3]||a.G}function gc(a,b,c){c&&a.B||(a.ib=b[0]||a.J,a.sc=b[1]||a.L);if(c||void 0===c)a.ub=b[0]||a.J,a.Mb=b[1]||a.L}function ac(a,b){b||(b=jc);gc(a,b,void 0);ec(a,b,void 0)}
|
||||
var jc=[],dc=[G.prototype.X,G.prototype.ea,G.prototype.ia,G.prototype.ya],fc=[G.prototype.O,G.prototype.ba,G.prototype.ha,G.prototype.la];if(qb)var cc=[G.prototype.M,G.prototype.aa,G.prototype.ga,G.prototype.ka],bc=[G.prototype.P,G.prototype.da,G.prototype.Xa,G.prototype.va];
|
||||
function kc(a,b){w.call(this,"CPU",a,kc,1);var c=a.multiplier||1;this.X=a.cycles||b;this.Qa=c;this.ga=Math.round(this.X/1E4)/100;this.ab=this.ga*this.Qa;this.C.za=!1;this.C.Pb=!1;this.C.nb=a.autoStart;this.C.cc=!1;this.C.eb=!1;this.rb=this.O=0;this.sb=a.csStart;this.gb=a.csInterval;this.hb=a.csStop;this.w=[];this.Ea=this.bb.bind(this);F(this)}z(kc);var lc=["power","reset"];l=kc.prototype;
|
||||
l.Oa=function(a,b,c,d){this.B=a;this.u=b;this.I=d;for(b=0;b<lc.length;b++)(c=this.N[lc[b]])&&this.B.oa(null,lc[b],c);this.H=ub(a,"ChipSet");a=mc(a,"autoStart");null!=a&&(this.C.nb="true"==a?!0:"false"==a?!1:!!a);F(this)};l.reset=function(){};l.save=function(){return null};l.restore=function(){return!1};
|
||||
l.Da=function(a,b){if(!b){if(a&&this.restore){nc(this);if(!this.restore(a))return!1;oc(this)}else this.reset();if(this.I){var c=this.I;c.g("Type ? for help with PC8080 Debugger commands");c.Ia();if(c.ya){var d=c.ya;c.ya=null;pc(c,d)}}else this.g("No debugger detected")}qc(this);return!0};l.Ha=function(a){return a?this.save():!0};l.nb=function(){return this.C.nb||!this.I&&void 0===this.N.run?(this.bb(!0),!0):!1};l.fc=function(){return 0};
|
||||
function oc(a){void 0===a.sb&&(a.sb=0);void 0===a.gb&&(a.gb=-1);void 0===a.hb&&(a.hb=-1);a.C.eb=0<=a.sb&&0<a.gb;a.C.eb&&(a.rb=0,a.O=a.sb-a.M)}function Dc(a,b){if(a.C.eb){var c=!1;a.rb=a.rb+a.fc()|0;a.O-=b;0>=a.O&&(a.O+=a.gb,c=!0);0<=a.hb&&a.hb<=Ec(a)&&(a.gb=a.hb=-1,oc(a),a.pa(),c=!0);c&&a.g(Ec(a)+" cycles: checksum="+n(a.rb))}}
|
||||
l.oa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.N[b]=c;a=!0;break;case "run":this.N[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.C.wa)a=!0;else{var b=null,c,g=db(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.C.ready);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.C.wa);c++);c==g.length&&(b=a);v("The "+b.type+" component ("+b.id+") is not "+(b.C.ready?"powered yet":"ready yet"+(b.Cb?" (waiting for notification)":""))+".");a=!1}a&&(d.C.za?d.pa():d.bb())};
|
||||
a=!0;break;case "speed":this.N[b]=c;a=!0;break;case "setSpeed":this.N[b]=c,c.onclick=function(){Fc(d,d.Qa<<1,!0)},c.textContent=this.ab.toFixed(2)+"Mhz",a=!0}return a};function Gc(a,b,c){a.M+=b;c&&(a.L=a.b=0)}function Hc(a,b){var c=1;b&&1<a.Qa&&a.K&&(c=a.K/a.ga);a.va=Math.round(1E3/30);a.ea=Math.floor(a.X/30*c);b||(a.P=a.ea);a.ha=0}function Ec(a){return a.M+a.G+a.L-a.b}function nc(a){a.K=0;a.ya=0;a.M=a.G=a.L=a.b=0;oc(a);Fc(a,1)}
|
||||
function Fc(a,b,c){var d=!1;if(void 0!==b){.8>a.K/a.ab?b=1:d=!0;a.Qa=b;b=a.ga*a.Qa;if(a.ab!=b){a.ab=b;b=a.ab.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.vb()}Gc(a,a.G);a.G=0;a.D=pa();a.J=0;Hc(a);return d}function Ic(a,b){var c=a.w.length;a.w.push([-1,b]);return c}function Jc(a,b,c){var d=-1;0<=b&&b<a.w.length&&(d=a.X*a.Qa/1E3*c,a.w[b][0]=d)}function Kc(a){a.L-=a.b;a.b=0}
|
||||
l.bb=function(a){if(kb(this,!0)){if(!this.C.za){Fc(this);this.B&&this.B.start(this.D,Ec(this));this.C.za=!0;this.C.Pb=!0;this.H&&this.H.start();var b=this.N.run;b&&(b.textContent="Halt");this.B&&(this.B.Ia(!0),a&&this.B.vb(!0))}this.ha>=this.X&&Hc(this,!0);this.aa=0;this.da=pa();this.J&&(a=this.da-this.J,a>this.va&&(this.D+=a,this.D>this.da&&(this.D=this.da)));try{do{for(var c=this.C.eb?1:this.ea,d=this.w.length-1;0<=d;d--){var e=this.w[d];0>e[0]||c>e[0]&&(c=e[0])}this.jb(c);var f=this.L-this.b;a=
|
||||
f;for(var h=this.w.length-1;0<=h;h--){var g=this.w[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.aa+=f;this.G+=f;Gc(this,0,!0);Dc(this,f);this.P-=f;if(0>=this.P){this.P+=this.ea;15<=++this.ya&&(this.B&&this.B.Ia(),this.ya=0);break}}while(this.C.za)}catch(k){this.pa();qc(this);this.B&&this.B.stop(pa(),Ec(this));kb(this,!1);pb(this,k.stack||k.message);return}c=setTimeout;d=this.Ea;this.J=pa();e=this.va;this.aa&&(e=Math.round(e*this.aa/this.ea));e=e-(this.J-this.da);if(f=this.J-this.D)this.K=Math.round(this.G/
|
||||
(10*f))/100,864E5<=f&&(this.M=0,Fc(this));if(0>e||this.K<this.ab)-1E3>e&&(this.D-=e),e=0;this.ha+=this.aa;this.J+=e;c(d,e)}else qc(this),this.B&&this.B.stop(pa(),Ec(this))};l.jb=function(){return 0};l.pa=function(a){lb(this,!0);Kc(this);Gc(this,this.G);this.G=0;if(this.C.za){this.C.za=!1;this.H&&this.H.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.complete=a};function qc(a,b){if(a.B){for(var c=a.B,d=0;d<c.G.length;d++)Lc(c.G[d],b);a.B.Ia(b)}}
|
||||
function Mc(a){this.mc=+a.model||8080;kc.call(this,a,1E6);this.ia=Nc;nc(this);this.C.complete=this.C.gd=!1;this.la=0;this.ba=[];this.ka=0;Oc(this)}z(Mc,kc);function Pc(a,b){a.ba.push(b)}l=Mc.prototype;l.reset=function(){this.C.za&&this.pa();Oc(this);nc(this);this.C.error=!1;this.parent.reset.call(this)};function Oc(a){a.i=0;a.S=0;a.T=0;a.U=0;a.V=0;a.W=0;a.Z=0;a.na=0;H(a,a.ka);Qc(a,0);a.j=0}function Rc(a,b){a.ka=b;H(a,b)}
|
||||
l.fc=function(){var a=this.i+this.S+this.T+this.U+this.V+this.W+this.Z|0;return a=a+this.na+this.R+Sc(this)|0};
|
||||
l.save=function(){var a=new Tc(this);I(a,0,[this.i,this.S,this.T,this.U,this.V,this.W,this.Z,this.na,this.R,Sc(this)]);I(a,1,[this.j,this.M,this.Qa]);for(var b=this.u,c=0,d=[],e=0;e<b.J;e++){var f=b.Y[e];if(f.Ma||f.ec){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,m=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;m[k++]=q-g;m[k++]=p;g=q}if(m.length<f.length){f=m;break a}}d[h]=f}}I(a,2,d);return a.data()};
|
||||
l.restore=function(a){var b=a[0];this.i=b[0];this.S=b[1];this.T=b[2];this.U=b[3];this.V=b[4];this.W=b[5];this.Z=b[6];this.na=b[7]&65535;H(this,b[8]);Qc(this,b[9]);b=a[1];this.j=b[0];this.M=b[1];Fc(this,b[3]);a:{b=this.u;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.M){for(var f=0,h=Array(b.M),g=0;g<e.length-1;)for(var k=e[g++],m=e[g++];k--;)h[f++]=m;e=h}f=b.Y[d];if(!f||!f.restore(e)){v("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
l.oa=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.N[b]=c;this.la++;d=!0;break;default:d=this.parent.oa.call(this,a,b,c)}return d};function Uc(a){return a.S<<8|a.T}function Vc(a,b){a.S=b>>8&255;a.T=b&255}function Wc(a){return a.U<<8|a.V}function Xc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Z}
|
||||
function Yc(a,b){a.W=b>>8&255;a.Z=b&255}function H(a,b){a.R=b&65535}function Zc(a){return a.ca&256?1:0}function $c(a,b){a.ca=a.ca&255|b}function ad(a){return rb[a.fa&255]?4:0}function bd(a){return(a.fa^a.xa)&16?16:0}function cd(a){return a.ca&255?0:64}function dd(a){return a.fa&128?128:0}function Sc(a){return a.ta&-214|dd(a)|cd(a)|bd(a)|ad(a)|Zc(a)}function Qc(a,b){a.ca=a.fa=a.xa=0;b&1&&(a.ca|=256);b&4||(a.fa|=1);b&16&&(a.xa|=16);b&64||(a.ca|=255);b&128&&(a.fa^=192);a.ta=a.ta&-726|b&512|2}
|
||||
function ed(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b)&255}function fd(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?1:0))&255}function gd(a,b){a.ca=a.fa=a.xa=a.i&b;(a.i|b)&8&&(a.xa^=16);return a.ca}function hd(a,b){a.xa=b^255;b=a.fa=b+255&255;a.ca=a.ca&-256|b;return b}function id(a,b){a.xa=b;b=a.fa=b+1&255;a.ca=a.ca&-256|b;return b}function jd(a,b){return a.fa=a.ca=a.xa=a.i|b}function K(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+1^256)&255}
|
||||
function kd(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?0:1)^256)&255}function Ed(a,b){return a.fa=a.ca=a.xa=a.i^b}l.$=function(a){return this.u.$(a)};l.ua=function(a,b){this.u.ua(a,b)};function L(a){var b=a.$(a.R);H(a,a.R+1);return b}function M(a){var b=a.u.Ra(a.R);H(a,a.R+2);return b}function O(a){var b=a.u.Ra(a.na);a.na=a.na+2&65535;return b}function P(a,b){a.na=a.na-2&65535;a.u.Gb(a.na,b)}
|
||||
function Fd(a){if(a.b&&a.j&255&&a.ta&512){for(var b=0;8>b&&!(a.j&1<<b);b++);a.j&=~(0>b?255:1<<b);a.ta&=-513;a.j&=-257;a.ia[199|b<<3].call(a)}return a.j&256?(Kc(a),!1):!0}function Gd(a,b){a.j|=1<<b;a.ta&512&&Kc(a)}function R(a,b,c,d){d=d||2;a.N[b]&&(void 0===c&&(pb(a,"Value for "+b+" is invalid"),a.pa()),c=!a.C.za||a.C.cc?n(c,d):"--------".substr(0,d),a.N[b].textContent!=c&&(a.N[b].textContent=c))}
|
||||
l.Ia=function(a){this.la&&(a||!this.C.za||this.C.cc)&&(R(this,"A",this.i),R(this,"B",this.S),R(this,"C",this.T),R(this,"BC",Uc(this),4),R(this,"D",this.U),R(this,"E",this.V),R(this,"DE",Wc(this),4),R(this,"H",this.W),R(this,"L",this.Z),R(this,"HL",J(this),4),R(this,"SP",this.na,4),R(this,"PC",this.R,4),a=Sc(this),R(this,"PS",a,4),R(this,"IF",a&512?1:0,1),R(this,"SF",a&128?1:0,1),R(this,"ZF",a&64?1:0,1),R(this,"AF",a&16?1:0,1),R(this,"PF",a&4?1:0,1),R(this,"CF",a&1?1:0,1));if(a=this.N.speed)a.textContent=
|
||||
this.C.za&&this.K?this.K.toFixed(2)+"Mhz":"Stopped"};l.jb=function(a){this.C.complete=!0;var b=this.C.gd=this.I&&Hd(this.I),c=a?this.C.Pb?0:1:-1;this.C.Pb=!1;this.L=this.b=a;if(Fd(this)){do{if(b){if(Id(this.I,this.R,c)){this.pa();break}c=1}this.ia[L(this)].call(this)}while(0<this.b)}return this.C.complete?this.L-this.b:void 0===this.C.complete?0:-1};Ma(function(){for(var a=D(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Mc(d);gb(d,c)}});function Jd(){this.b-=4}
|
||||
function Kd(){H(this,M(this));this.b-=10}function Ld(){H(this,O(this));this.b-=10}function Md(){var a=M(this);P(this,this.R);H(this,a);this.b-=17}
|
||||
var Nc=[Jd,function(){Vc(this,M(this));this.b-=10},function(){this.ua(Uc(this),this.i);this.b-=7},function(){Vc(this,Uc(this)+1);this.b-=5},function(){this.S=id(this,this.S);this.b-=5},function(){this.S=hd(this,this.S);this.b-=5},function(){this.S=L(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|a>>8;$c(this,a&256);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+Uc(this));$c(this,a>>8&256);this.b-=10},function(){this.i=this.$(Uc(this));this.b-=7},function(){Vc(this,Uc(this)-1);this.b-=
|
||||
5},function(){this.T=id(this,this.T);this.b-=5},function(){this.T=hd(this,this.T);this.b-=5},function(){this.T=L(this);this.b-=7},function(){var a=this.i<<8&256;this.i=(a|this.i)>>1;$c(this,a);this.b-=4},Jd,function(){Xc(this,M(this));this.b-=10},function(){this.ua(Wc(this),this.i);this.b-=7},function(){Xc(this,Wc(this)+1);this.b-=5},function(){this.U=id(this,this.U);this.b-=5},function(){this.U=hd(this,this.U);this.b-=5},function(){this.U=L(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|
|
||||
Zc(this);$c(this,a&256);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+Wc(this));$c(this,a>>8&256);this.b-=10},function(){this.i=this.$(Wc(this));this.b-=7},function(){Xc(this,Wc(this)-1);this.b-=5},function(){this.V=id(this,this.V);this.b-=5},function(){this.V=hd(this,this.V);this.b-=5},function(){this.V=L(this);this.b-=7},function(){var a=this.i<<8;this.i=(Zc(this)<<8|this.i)>>1;$c(this,a&256);this.b-=4},Jd,function(){Yc(this,M(this));this.b-=10},function(){var a=M(this);this.u.Gb(a,J(this));
|
||||
this.b-=16},function(){Yc(this,J(this)+1);this.b-=5},function(){this.W=id(this,this.W);this.b-=5},function(){this.W=hd(this,this.W);this.b-=5},function(){this.W=L(this);this.b-=7},function(){var a=0,b=Zc(this);if(bd(this)||9<(this.i&15))a|=6;if(b||154<=this.i)a|=96,b=1;this.i=ed(this,a);$c(this,b?256:0);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+J(this));$c(this,a>>8&256);this.b-=10},function(){var a;a=M(this);a=this.u.Ra(a);Yc(this,a);this.b-=16},function(){Yc(this,J(this)-1);this.b-=5},function(){this.Z=
|
||||
id(this,this.Z);this.b-=5},function(){this.Z=hd(this,this.Z);this.b-=5},function(){this.Z=L(this);this.b-=7},function(){this.i=~this.i&255;this.b-=4},Jd,function(){this.na=M(this)&65535;this.b-=10},function(){this.ua(M(this),this.i);this.b-=13},function(){this.na=this.na+1&65535;this.b-=5},function(){var a=J(this);this.ua(a,id(this,this.$(a)));this.b-=10},function(){var a=J(this);this.ua(a,hd(this,this.$(a)));this.b-=10},function(){this.ua(J(this),L(this));this.b-=10},function(){this.ca|=256;this.b-=
|
||||
4},Jd,function(){var a;Yc(this,a=J(this)+this.na);$c(this,a>>8&256);this.b-=10},function(){this.i=this.$(M(this));this.b-=13},function(){this.na=this.na-1&65535;this.b-=5},function(){this.i=id(this,this.i);this.b-=5},function(){this.i=hd(this,this.i);this.b-=5},function(){this.i=L(this);this.b-=7},function(){$c(this,Zc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;this.b-=
|
||||
5},function(){this.S=this.Z;this.b-=5},function(){this.S=this.$(J(this));this.b-=7},function(){this.S=this.i;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Z;this.b-=5},function(){this.T=this.$(J(this));this.b-=7},function(){this.T=this.i;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=5},function(){this.U=
|
||||
this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Z;this.b-=5},function(){this.U=this.$(J(this));this.b-=7},function(){this.U=this.i;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Z;this.b-=5},function(){this.V=this.$(J(this));this.b-=7},function(){this.V=this.i;this.b-=5},function(){this.W=this.S;this.b-=5},function(){this.W=
|
||||
this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Z;this.b-=5},function(){this.W=this.$(J(this));this.b-=7},function(){this.W=this.i;this.b-=5},function(){this.Z=this.S;this.b-=5},function(){this.Z=this.T;this.b-=5},function(){this.Z=this.U;this.b-=5},function(){this.Z=this.V;this.b-=5},function(){this.Z=this.W;this.b-=5},function(){this.b-=5},function(){this.Z=this.$(J(this));this.b-=7},function(){this.Z=this.i;
|
||||
this.b-=5},function(){this.ua(J(this),this.S);this.b-=7},function(){this.ua(J(this),this.T);this.b-=7},function(){this.ua(J(this),this.U);this.b-=7},function(){this.ua(J(this),this.V);this.b-=7},function(){this.ua(J(this),this.W);this.b-=7},function(){this.ua(J(this),this.Z);this.b-=7},function(){var a=this.R-1;if(this.ba.length)for(var b=0;b<this.ba.length;b++)if(this.ba[b](a))return;this.b-=7;this.j|=256;Kc(this);this.I&&jb(this,-2147483648)?(H(this,a),this.I.pa()):this.ta&512||(this.I&&H(this,
|
||||
a),this.pa())},function(){this.ua(J(this),this.i);this.b-=7},function(){this.i=this.S;this.b-=5},function(){this.i=this.T;this.b-=5},function(){this.i=this.U;this.b-=5},function(){this.i=this.V;this.b-=5},function(){this.i=this.W;this.b-=5},function(){this.i=this.Z;this.b-=5},function(){this.i=this.$(J(this));this.b-=7},function(){this.b-=5},function(){this.i=ed(this,this.S);this.b-=4},function(){this.i=ed(this,this.T);this.b-=4},function(){this.i=ed(this,this.U);this.b-=4},function(){this.i=ed(this,
|
||||
this.V);this.b-=4},function(){this.i=ed(this,this.W);this.b-=4},function(){this.i=ed(this,this.Z);this.b-=4},function(){this.i=ed(this,this.$(J(this)));this.b-=7},function(){this.i=ed(this,this.i);this.b-=4},function(){this.i=fd(this,this.S);this.b-=4},function(){this.i=fd(this,this.T);this.b-=4},function(){this.i=fd(this,this.U);this.b-=4},function(){this.i=fd(this,this.V);this.b-=4},function(){this.i=fd(this,this.W);this.b-=4},function(){this.i=fd(this,this.Z);this.b-=4},function(){this.i=fd(this,
|
||||
this.$(J(this)));this.b-=7},function(){this.i=fd(this,this.i);this.b-=4},function(){this.i=K(this,this.S);this.b-=4},function(){this.i=K(this,this.T);this.b-=4},function(){this.i=K(this,this.U);this.b-=4},function(){this.i=K(this,this.V);this.b-=4},function(){this.i=K(this,this.W);this.b-=4},function(){this.i=K(this,this.Z);this.b-=4},function(){this.i=K(this,this.$(J(this)));this.b-=7},function(){this.i=K(this,this.i);this.b-=4},function(){this.i=kd(this,this.S);this.b-=4},function(){this.i=kd(this,
|
||||
this.T);this.b-=4},function(){this.i=kd(this,this.U);this.b-=4},function(){this.i=kd(this,this.V);this.b-=4},function(){this.i=kd(this,this.W);this.b-=4},function(){this.i=kd(this,this.Z);this.b-=4},function(){this.i=kd(this,this.$(J(this)));this.b-=7},function(){this.i=kd(this,this.i);this.b-=4},function(){this.i=gd(this,this.S);this.b-=4},function(){this.i=gd(this,this.T);this.b-=4},function(){this.i=gd(this,this.U);this.b-=4},function(){this.i=gd(this,this.V);this.b-=4},function(){this.i=gd(this,
|
||||
this.W);this.b-=4},function(){this.i=gd(this,this.Z);this.b-=4},function(){this.i=gd(this,this.$(J(this)));this.b-=7},function(){this.i=gd(this,this.i);this.b-=4},function(){this.i=Ed(this,this.S);this.b-=4},function(){this.i=Ed(this,this.T);this.b-=4},function(){this.i=Ed(this,this.U);this.b-=4},function(){this.i=Ed(this,this.V);this.b-=4},function(){this.i=Ed(this,this.W);this.b-=4},function(){this.i=Ed(this,this.Z);this.b-=4},function(){this.i=Ed(this,this.$(J(this)));this.b-=7},function(){this.i=
|
||||
Ed(this,this.i);this.b-=4},function(){this.i=jd(this,this.S);this.b-=4},function(){this.i=jd(this,this.T);this.b-=4},function(){this.i=jd(this,this.U);this.b-=4},function(){this.i=jd(this,this.V);this.b-=4},function(){this.i=jd(this,this.W);this.b-=4},function(){this.i=jd(this,this.Z);this.b-=4},function(){this.i=jd(this,this.$(J(this)));this.b-=7},function(){this.i=jd(this,this.i);this.b-=4},function(){K(this,this.S);this.b-=4},function(){K(this,this.T);this.b-=4},function(){K(this,this.U);this.b-=
|
||||
4},function(){K(this,this.V);this.b-=4},function(){K(this,this.W);this.b-=4},function(){K(this,this.Z);this.b-=4},function(){K(this,this.$(J(this)));this.b-=7},function(){K(this,this.i);this.b-=4},function(){cd(this)||(H(this,O(this)),this.b-=6);this.b-=5},function(){Vc(this,O(this));this.b-=10},function(){var a=M(this);cd(this)||H(this,a);this.b-=10},Kd,function(){var a=M(this);cd(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Uc(this));this.b-=11},function(){this.i=ed(this,
|
||||
L(this));this.b-=7},function(){P(this,this.R);H(this,0);this.b-=11},function(){cd(this)&&(H(this,O(this)),this.b-=6);this.b-=5},Ld,function(){var a=M(this);cd(this)&&H(this,a);this.b-=10},Kd,function(){var a=M(this);cd(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Md,function(){this.i=fd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,8);this.b-=11},function(){Zc(this)||(H(this,O(this)),this.b-=6);this.b-=5},function(){Xc(this,O(this));this.b-=10},function(){var a=M(this);Zc(this)||
|
||||
H(this,a);this.b-=10},function(){var a=L(this);Tb(this.u,a,this.i,this.R+-2&65535);this.b-=10},function(){var a=M(this);Zc(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Wc(this));this.b-=11},function(){this.i=K(this,L(this));this.b-=7},function(){P(this,this.R);H(this,16);this.b-=11},function(){Zc(this)&&(H(this,O(this)),this.b-=6);this.b-=5},Ld,function(){var a=M(this);Zc(this)&&H(this,a);this.b-=10},function(){var a=L(this);this.i=Hb(this.u,a,this.R+-2&65535)&255;this.b-=
|
||||
10},function(){var a=M(this);Zc(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Md,function(){this.i=kd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,24);this.b-=11},function(){ad(this)||(H(this,O(this)),this.b-=6);this.b-=5},function(){Yc(this,O(this));this.b-=10},function(){var a=M(this);ad(this)||H(this,a);this.b-=10},function(){var a=O(this);P(this,J(this));Yc(this,a);this.b-=18},function(){var a=M(this);ad(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,
|
||||
J(this));this.b-=11},function(){this.i=gd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,32);this.b-=11},function(){ad(this)&&(H(this,O(this)),this.b-=6);this.b-=5},function(){H(this,J(this));this.b-=5},function(){var a=M(this);ad(this)&&H(this,a);this.b-=10},function(){var a=J(this);Yc(this,Wc(this));Xc(this,a);this.b-=5},function(){var a=M(this);ad(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Md,function(){this.i=Ed(this,L(this));this.b-=7},function(){P(this,this.R);H(this,
|
||||
40);this.b-=11},function(){dd(this)||(H(this,O(this)),this.b-=6);this.b-=5},function(){var a=O(this);Qc(this,a&255|this.ta&-256);this.i=a>>8;this.b-=10},function(){var a=M(this);dd(this)||H(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=M(this);dd(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Sc(this)&255|this.i<<8);this.b-=11},function(){this.i=jd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,48);this.b-=11},function(){dd(this)&&(H(this,
|
||||
O(this)),this.b-=6);this.b-=5},function(){this.na=J(this)&65535;this.b-=5},function(){var a=M(this);dd(this)&&H(this,a);this.b-=10},function(){this.ta|=512;this.b-=4;Fd(this)},function(){var a=M(this);dd(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Md,function(){K(this,L(this));this.b-=7},function(){P(this,this.R);H(this,56);this.b-=11}];
|
||||
function S(a){w.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Nd[b]&&Oa("Unrecognized ChipSet model: "+b);this.w=Nd[b]||{};a.sound&&(this.ea=null,window&&(this.ea=window.AudioContext||window.webkitAudioContext),this.ea&&new this.ea);F(this)}z(S);
|
||||
var T={Aa:1978.1,bd:{Ba:0,Nd:1,Rd:16,Yd:32,ge:64,fe:128,lb:14},Wa:{Ba:1,Dc:1,Wc:2,Sc:4,Tc:16,Uc:32,Vc:64,lb:8},cd:{Ba:2,Md:3,oe:4,Od:8,be:16,ce:32,de:64,Pd:128,lb:0},ke:{Ba:3},ie:{Ba:2,Zd:7},me:{Ba:3,pe:1,le:2,ee:4,Wd:8,Qd:16,Jd:32},je:{Ba:4},ne:{Ba:5,Sd:1,Td:2,Ud:4,Vd:8,qe:16}},U={Aa:100,Ja:{Ba:66,$b:1,Wb:2,Rc:4,ae:8,$d:16,Yb:32,Xb:64,Tb:128},Cc:{Ba:66,INIT:0},Ua:{Ba:194,Ld:0,Sb:16,Xc:32,Zb:48,Hc:0,Ic:32},yb:{Ba:162,he:0,Kc:0,Gc:0,Jc:0,Fc:0},Ka:{Xd:{Ba:98},Ta:{zc:0,yc:1,Zc:2,dd:4,Ec:5,Yc:6,$c:7},
|
||||
zb:16383}},Nd={SI1978:T,VT100:U};S.prototype.oa=function(){return!1};S.prototype.Oa=function(a,b,c,d){this.u=b;this.b=c;this.I=d;this.B=a;this.K=ub(a,"Keyboard");this.Ea=ub(a,"SerialPort");this.video=ub(a,"Video");Gb(b,this,this.w.Eb);Sb(b,this,this.w.Fb);if(d){var e=this;Od(d,16384,function(){for(var a="",b=0;b<e.H.length;b++)a&&(a+=b&&b%10?", ":",\n"),a+=t(e.H[b]);e.I.g(a)})}};S.prototype.Da=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
S.prototype.Ha=function(a){return a?this.save():!0};T.INIT=[[T.bd.lb,T.Wa.lb,T.cd.lb,0,0,0,0]];
|
||||
U.INIT=[[U.Cc.INIT,U.Ja.Wb|U.Ja.Rc],[U.Ua.Hc,U.Ua.Ic],[U.yb.Kc,U.yb.Gc,U.yb.Jc,U.yb.Fc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
z.prototype={constructor:z,parent:null,toString:function(){return this.name?this.name:this.id||this.type},oa:function(a,b,c){switch(b){case "clear":return this.N[b]||(this.N[b]=c,c.onclick=function(a){return function(){a.N.print&&(a.N.print.value="")}}(this)),!0;case "print":return this.N[b]||(this.Ga=this.N[b]=c,c.value="",this.g=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.ja=function(a){this.g(a,this.cb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.cb+": "+a)},ja:function(a,b,c){Oa(a,b,c||this.type)},Ea:function(){return this.C.xa=!0},Ia:function(a,b){b&&(this.C.xa=!1);return!0}};function E(a,b,c,d,e,f,h){a.H&&(!0===h?h=0:null==h&&(h=a.ta),ib(a.H,a,b,c,d,e,f,h))}function jb(a,b){a.H&&kb(a,0)&&a.H.message(b,void 0)}function kb(a,b){if(a.H){a===a.H?b|=0:b=b||a.ta;var c=a.H.ta&b;return!!b&&c===b||!!(c&a.H.Hd)}return!1}
|
||||
function lb(a,b){if(a.C.Kb)return a.C.eb&&(a.C.eb=!1),a.C.Kb=!1;if(a.C.error)return a.g(a.toString()+" error"),!1;a.C.eb=b;return a.C.eb}function mb(a,b){a.C.eb&&(b?a.C.Kb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.C.eb}function F(a){if(!a.C.error&&(a.C.ready=!0,a.C.ready)){var b=a.Db;a.Db=null;b&&b()}}function nb(a,b){b&&(a.C.ready?b():a.Db=b);return a.C.ready}function qb(a,b){a.C.error=!0;a.ja(b)}
|
||||
var rb="undefined"!==typeof ArrayBuffer,sb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
|
||||
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1],tb={cpu:1,bus:64,mem:128,port:256,nvr:16384,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function ub(a){z.call(this,"Panel",a,ub)}bb(ub);l=ub.prototype;
|
||||
l.oa=function(a,b,c,d){return this.B&&this.B.oa(a,b,c,d)||this.b&&this.b.oa(a,b,c,d)||this.K&&this.K.oa(a,b,c,d)||this.H&&this.H.oa(a,b,c,d)?!0:this.parent.oa.call(this,a,b,c,d)};l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;this.K=vb(a,"Keyboard")};l.Ea=function(a,b){b||wb();return!0};l.Ia=function(){return!0};l.Ja=function(){};function wb(){for(var a=!1,b=D(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=fb(e.id);f||(a=!0,f=new ub(e));hb(f,d);a&&F(f)}}Ma(wb);
|
||||
function xb(a,b,c){z.call(this,"Bus",a,xb);this.b=b;this.H=c;this.G=a.busWidth||16;this.L=Math.pow(2,this.G);this.w=this.L-1|0;this.sa=16>=this.G?10:20>=this.G?12:24>=this.G?14:15;this.Ha=1<<this.sa;this.M=this.Ha>>2;this.u=this.Ha-1;this.J=this.L/this.Ha|0;this.K=this.J-1;this.B=[];this.j=[];this.I=this.D=!1;this.O=[];this.P=[];a=new G;yb(a,this.H);this.X=Array(this.J);for(b=0;b<this.J;b++)this.X[b]=a;F(this)}bb(xb);l=xb.prototype;l.reset=function(){};l.Ea=function(a,b){b||this.reset();return!0};
|
||||
function zb(a,b,c,d){for(var e=b,f=c,h=e>>>a.sa;0<f&&h<a.X.length;){var g=a.X[h],k=h*a.Ha,m=a.Ha-(e-k);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.xb+=g.F-e,g.F=e,!0;if(e>=g.F+g.xb){m=g.size-(e-k);m>f&&(m=f);g.xb=e-g.F+m;e=k+a.Ha;f-=m;h++;continue}}return Ab(1,e,f)}e=new G(e,m,a.Ha,d);yb(e,a.H,g);a.X[h++]=e;e=k+a.Ha;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Bb[d]+" at "+v(b)),!0):Ab(2,b,c)}l.aa=function(a){return this.X[(a&this.w)>>>this.sa].jb(a&this.u,a)};
|
||||
function Cb(a,b){return a.X[(b&a.w)>>>a.sa].vb(b&a.u,b)}l.Sa=function(a){var b=a&this.u,c=(a&this.w)>>>this.sa;return b!=this.u?this.X[c].zc(b,a):this.X[c++].jb(b,a)|this.X[c&this.K].jb(0,a+1)<<8};function Db(a,b){var c=b&a.u,d=(b&a.w)>>>a.sa;return c!=a.u?a.X[d].Nb(c,b):a.X[d++].vb(c,b)|a.X[d&a.K].vb(0,b+1)<<8}l.va=function(a,b){this.X[(a&this.w)>>>this.sa].lb(a&this.u,b&255,a)};function Eb(a,b,c){a.X[(b&a.w)>>>a.sa].yb(b&a.u,c&255,b)}
|
||||
l.Hb=function(a,b){var c=a&this.u,d=(a&this.w)>>>this.sa;c!=this.u?this.X[d].Bc(c,b&65535,a):(this.X[d++].lb(c,b&255,a),this.X[d&this.K].lb(0,b>>8&255,a+1))};function Fb(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.B[b]&&(a.B[b]=[null,!1]);a.B[b][1]=!a.B[b][1];return a.B[b][1]}function Hb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.B[k]?w("Input port "+v(k)+" already registered"):f.B[k]=[g,!1]}}
|
||||
function Ib(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.B[b],g=a.O[b]||1,k=1==g?255:2==g?65535:-1,m=k;void 0!==h?(h[0]&&(m=h[0](b,c),void 0===m?m=k:m&=k),a.H&&a.I!=h[1]&&Jb(a.H,b,m)):a.H&&(ib(a.H,a,b,null,c),a.I&&Jb(a.H,b,m));e|=m<<f;f+=g<<3;b+=g;d-=g}return e}function Sb(a,b){if(void 0===b)return a.D=!a.D,a.D;void 0===a.j[b]&&(a.j[b]=[null,!1]);a.j[b][1]=!a.j[b][1];return a.j[b][1]}
|
||||
function Tb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.j[k]?w("Output port "+v(k)+" already registered"):f.j[k]=[g,!1]}}function Ub(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.j[b],g=a.P[b]||1,k=1==g?255:2==g?65535:-1,k=(c>>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.H&&a.D!=h[1]&&Vb(a.H,b,k)}else a.H&&(ib(a.H,a,b,k,d),a.D&&Vb(a.H,b,k));f+=g<<3;b+=g;e-=g}}
|
||||
function Ab(a,b,c){w("Memory block error ("+a+": "+t(b)+","+t(c)+")");return!1}var Wb;if(rb){var Xb=new ArrayBuffer(2);(new DataView(Xb)).setUint16(0,256,!0);Wb=256===(new Uint16Array(Xb))[0]}else Wb=!1;var Yb=Wb;
|
||||
function G(a,b,c,d){this.id=Zb+=2;this.b=null;this.F=a;this.xb=b;this.size=c||0;this.type=d||$b;this.N=d==ac;yb(this);this.Na=this.vc=!1;if(c)if(rb)this.I=new ArrayBuffer(c),this.D=new DataView(this.I,0,c),this.u=new Uint8Array(this.I,0,c),this.K=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),bc(this,Yb?cc:dc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;bc(this,ec)}else bc(this)}var $b=0,ac=2,Bb=["NONE","RAM","ROM","VID","H/W"],Zb=0;
|
||||
G.prototype={constructor:G,parent:null,save:function(){var a,b;if(rb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(rb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Na=!0}return!1},$a:function(a,b){b?0===this.j++&&fc(this,gc,!1):0===this.B++&&hc(this,gc,!1)},J:function(){this.H&&kb(this.H,129)&&this.H.message("attempt to read invalid block %"+t(this.F),!0);
|
||||
return 255},w:function(a,b){this.H&&kb(this.H,129)&&this.H.message("attempt to write "+v(b)+" to invalid block %"+t(this.F),!0)},L:function(a,b){return this.jb(a++,b++)|this.jb(a,b)<<8},G:function(a,b,c){this.lb(a++,b&255,c++);this.lb(a,b>>8,c)},Y:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},fa:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},ka:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.Na=!0},za:function(a,
|
||||
b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Na=!0},O:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,1,c.O)&&c.pa(!0)}return this.vb(a,b)},ca:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,2,c.O)&&c.pa(!0)}return this.Nb(a,b)},ia:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,1,d.D)&&d.pa(!0)}this.N?this.w(a,b,c):this.yb(a,b,c)},la:function(a,
|
||||
b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,2,d.D)&&d.pa(!0)}this.N?this.w(a,b,c):this.Rb(a,b,c)},M:function(a){return this.u[a]},P:function(a){return this.u[a]},ba:function(a){return this.D.getUint16(a,!0)},ea:function(a){return a&1?this.u[a]|this.u[a+1]<<8:this.K[a>>1]},ha:function(a,b){this.u[a]=b;this.Na=!0},cb:function(a,b){this.u[a]=b;this.Na=!0},qa:function(a,b){this.D.setUint16(a,b,!0);this.Na=!0},wa:function(a,b){a&1?(this.u[a]=b,this.u[a+1]=b>>8):this.K[a>>1]=b;this.Na=!0}};
|
||||
function yb(a,b,c){a.H=b;a.B=a.j=0;c&&((a.B=c.B)&&hc(a,gc,!1),(a.j=c.j)&&fc(a,gc,!1))}function jc(a,b){b?0===--a.j&&(a.lb=a.N?a.w:a.yb,a.Bc=a.N?a.G:a.Rb):0===--a.B&&(a.jb=a.vb,a.zc=a.Nb)}function fc(a,b,c){c&&a.j||(a.lb=!a.N&&b[2]||a.w,a.Bc=!a.N&&b[3]||a.G);if(c||void 0===c)a.yb=b[2]||a.w,a.Rb=b[3]||a.G}function hc(a,b,c){c&&a.B||(a.jb=b[0]||a.J,a.zc=b[1]||a.L);if(c||void 0===c)a.vb=b[0]||a.J,a.Nb=b[1]||a.L}function bc(a,b){b||(b=kc);hc(a,b,void 0);fc(a,b,void 0)}
|
||||
var kc=[],ec=[G.prototype.Y,G.prototype.fa,G.prototype.ka,G.prototype.za],gc=[G.prototype.O,G.prototype.ca,G.prototype.ia,G.prototype.la];if(rb)var dc=[G.prototype.M,G.prototype.ba,G.prototype.ha,G.prototype.qa],cc=[G.prototype.P,G.prototype.ea,G.prototype.cb,G.prototype.wa];
|
||||
function lc(a,b){z.call(this,"CPU",a,lc,1);var c=a.multiplier||1;this.Y=a.cycles||b;this.Ra=c;this.ha=Math.round(this.Y/1E4)/100;this.ab=this.ha*this.Ra;this.C.Aa=!1;this.C.Qb=!1;this.C.rb=a.autoStart;this.C.tc=!1;this.C.fb=!1;this.sb=this.O=0;this.tb=a.csStart;this.hb=a.csInterval;this.ib=a.csStop;this.w=[];this.Fa=this.bb.bind(this);F(this)}bb(lc);var mc=["power","reset"];l=lc.prototype;
|
||||
l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.H=d;for(b=0;b<mc.length;b++)(c=this.N[mc[b]])&&this.B.oa(null,mc[b],c);this.I=vb(a,"ChipSet");a=nc(a,"autoStart");null!=a&&(this.C.rb="true"==a?!0:"false"==a?!1:!!a);F(this)};l.reset=function(){};l.save=function(){return null};l.restore=function(){return!1};
|
||||
l.Ea=function(a,b){if(!b){if(a&&this.restore){oc(this);if(!this.restore(a))return!1;pc(this)}else this.reset();if(this.H){var c=this.H;c.g("Type ? for help with PC8080 Debugger commands");c.Ja();if(c.za){var d=c.za;c.za=null;qc(c,d)}}else this.g("No debugger detected")}rc(this);return!0};l.Ia=function(a){return a?this.save():!0};l.rb=function(){return this.C.rb||!this.H&&void 0===this.N.run?(this.bb(!0),!0):!1};l.wc=function(){return 0};
|
||||
function pc(a){void 0===a.tb&&(a.tb=0);void 0===a.hb&&(a.hb=-1);void 0===a.ib&&(a.ib=-1);a.C.fb=0<=a.tb&&0<a.hb;a.C.fb&&(a.sb=0,a.O=a.tb-a.M)}function sc(a,b){if(a.C.fb){var c=!1;a.sb=a.sb+a.wc()|0;a.O-=b;0>=a.O&&(a.O+=a.hb,c=!0);0<=a.ib&&a.ib<=Fc(a)&&(a.hb=a.ib=-1,pc(a),a.pa(),c=!0);c&&a.g(Fc(a)+" cycles: checksum="+t(a.sb))}}
|
||||
l.oa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.N[b]=c;a=!0;break;case "run":this.N[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.C.xa)a=!0;else{var b=null,c,g=eb(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.C.ready);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.C.xa);c++);c==g.length&&(b=a);w("The "+b.type+" component ("+b.id+") is not "+(b.C.ready?"powered yet":"ready yet"+(b.Db?" (waiting for notification)":""))+".");a=!1}a&&(d.C.Aa?d.pa():d.bb())};
|
||||
a=!0;break;case "speed":this.N[b]=c;a=!0;break;case "setSpeed":this.N[b]=c,c.onclick=function(){Gc(d,d.Ra<<1,!0)},c.textContent=this.ab.toFixed(2)+"Mhz",a=!0}return a};function Hc(a,b,c){a.M+=b;c&&(a.L=a.b=0)}function Ic(a,b){var c=1;b&&1<a.Ra&&a.K&&(c=a.K/a.ha);a.wa=Math.round(1E3/30);a.fa=Math.floor(a.Y/30*c);b||(a.P=a.fa);a.ia=0}function Fc(a){return a.M+a.G+a.L-a.b}function oc(a){a.K=0;a.za=0;a.M=a.G=a.L=a.b=0;pc(a);Gc(a,1)}
|
||||
function Gc(a,b,c){var d=!1;if(void 0!==b){.8>a.K/a.ab?b=1:d=!0;a.Ra=b;b=a.ha*a.Ra;if(a.ab!=b){a.ab=b;b=a.ab.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.wb()}Hc(a,a.G);a.G=0;a.D=pa();a.J=0;Ic(a);return d}function Jc(a,b){var c=a.w.length;a.w.push([-1,b]);return c}function Kc(a,b,c){var d=-1;0<=b&&b<a.w.length&&(d=a.Y*a.Ra/1E3*c,a.w[b][0]=d)}function Lc(a){a.L-=a.b;a.b=0}
|
||||
l.bb=function(a){if(lb(this,!0)){if(!this.C.Aa){Gc(this);this.B&&this.B.start(this.D,Fc(this));this.C.Aa=!0;this.C.Qb=!0;this.I&&this.I.start();var b=this.N.run;b&&(b.textContent="Halt");this.B&&(this.B.Ja(!0),a&&this.B.wb(!0))}this.ia>=this.Y&&Ic(this,!0);this.ba=0;this.ea=pa();this.J&&(a=this.ea-this.J,a>this.wa&&(this.D+=a,this.D>this.ea&&(this.D=this.ea)));try{do{for(var c=this.C.fb?1:this.fa,d=this.w.length-1;0<=d;d--){var e=this.w[d];0>e[0]||c>e[0]&&(c=e[0])}this.kb(c);var f=this.L-this.b;a=
|
||||
f;for(var h=this.w.length-1;0<=h;h--){var g=this.w[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ba+=f;this.G+=f;Hc(this,0,!0);sc(this,f);this.P-=f;if(0>=this.P){this.P+=this.fa;15<=++this.za&&(this.B&&this.B.Ja(),this.za=0);break}}while(this.C.Aa)}catch(k){this.pa();rc(this);this.B&&this.B.stop(pa(),Fc(this));lb(this,!1);qb(this,k.stack||k.message);return}c=setTimeout;d=this.Fa;this.J=pa();e=this.wa;this.ba&&(e=Math.round(e*this.ba/this.fa));e=e-(this.J-this.ea);if(f=this.J-this.D)this.K=Math.round(this.G/
|
||||
(10*f))/100,864E5<=f&&(this.M=0,Gc(this));if(0>e||this.K<this.ab)-1E3>e&&(this.D-=e),e=0;this.ia+=this.ba;this.J+=e;c(d,e)}else rc(this),this.B&&this.B.stop(pa(),Fc(this))};l.kb=function(){return 0};l.pa=function(a){mb(this,!0);Lc(this);Hc(this,this.G);this.G=0;if(this.C.Aa){this.C.Aa=!1;this.I&&this.I.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.complete=a};function rc(a,b){if(a.B){for(var c=a.B,d=0;d<c.G.length;d++)Mc(c.G[d],b);a.B.Ja(b)}}
|
||||
function Nc(a){this.yc=+a.model||8080;lc.call(this,a,1E6);this.ka=Oc;oc(this);this.C.complete=this.C.Jd=!1;this.la=0;this.ca=[];this.qa=0;Pc(this)}bb(Nc,lc);function Qc(a,b){a.ca.push(b)}l=Nc.prototype;l.reset=function(){this.C.Aa&&this.pa();Pc(this);oc(this);this.C.error=!1;this.parent.reset.call(this)};function Pc(a){a.i=0;a.S=0;a.T=0;a.U=0;a.V=0;a.W=0;a.Z=0;a.na=0;H(a,a.qa);Rc(a,0);a.j=0}function Sc(a,b){a.qa=b;H(a,b)}
|
||||
l.wc=function(){var a=this.i+this.S+this.T+this.U+this.V+this.W+this.Z|0;return a=a+this.na+this.R+Tc(this)|0};
|
||||
l.save=function(){var a=new Uc(this);I(a,0,[this.i,this.S,this.T,this.U,this.V,this.W,this.Z,this.na,this.R,Tc(this)]);I(a,1,[this.j,this.M,this.Ra]);for(var b=this.u,c=0,d=[],e=0;e<b.J;e++){var f=b.X[e];if(f.Na||f.vc){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,m=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;m[k++]=q-g;m[k++]=p;g=q}if(m.length<f.length){f=m;break a}}d[h]=f}}I(a,2,d);return a.data()};
|
||||
l.restore=function(a){var b=a[0];this.i=b[0];this.S=b[1];this.T=b[2];this.U=b[3];this.V=b[4];this.W=b[5];this.Z=b[6];this.na=b[7]&65535;H(this,b[8]);Rc(this,b[9]);b=a[1];this.j=b[0];this.M=b[1];Gc(this,b[3]);a:{b=this.u;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.M){for(var f=0,h=Array(b.M),g=0;g<e.length-1;)for(var k=e[g++],m=e[g++];k--;)h[f++]=m;e=h}f=b.X[d];if(!f||!f.restore(e)){w("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
l.oa=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.N[b]=c;this.la++;d=!0;break;default:d=this.parent.oa.call(this,a,b,c)}return d};function Vc(a){return a.S<<8|a.T}function Wc(a,b){a.S=b>>8&255;a.T=b&255}function Xc(a){return a.U<<8|a.V}function Yc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Z}
|
||||
function Zc(a,b){a.W=b>>8&255;a.Z=b&255}function H(a,b){a.R=b&65535}function $c(a){return a.da&256?1:0}function ad(a,b){a.da=a.da&255|b}function bd(a){return sb[a.ga&255]?4:0}function cd(a){return(a.ga^a.ya)&16?16:0}function dd(a){return a.da&255?0:64}function ed(a){return a.ga&128?128:0}function Tc(a){return a.ua&-214|ed(a)|dd(a)|cd(a)|bd(a)|$c(a)}function Rc(a,b){a.da=a.ga=a.ya=0;b&1&&(a.da|=256);b&4||(a.ga|=1);b&16&&(a.ya|=16);b&64||(a.da|=255);b&128&&(a.ga^=192);a.ua=a.ua&-726|b&512|2}
|
||||
function fd(a,b){a.ya=a.i^b;return a.ga=(a.da=a.i+b)&255}function gd(a,b){a.ya=a.i^b;return a.ga=(a.da=a.i+b+(a.da&256?1:0))&255}function hd(a,b){a.da=a.ga=a.ya=a.i&b;(a.i|b)&8&&(a.ya^=16);return a.da}function id(a,b){a.ya=b^255;b=a.ga=b+255&255;a.da=a.da&-256|b;return b}function jd(a,b){a.ya=b;b=a.ga=b+1&255;a.da=a.da&-256|b;return b}function kd(a,b){return a.ga=a.da=a.ya=a.i|b}function K(a,b){b^=255;a.ya=a.i^b;return a.ga=(a.da=a.i+b+1^256)&255}
|
||||
function ld(a,b){b^=255;a.ya=a.i^b;return a.ga=(a.da=a.i+b+(a.da&256?0:1)^256)&255}function md(a,b){return a.ga=a.da=a.ya=a.i^b}l.aa=function(a){return this.u.aa(a)};l.va=function(a,b){this.u.va(a,b)};function L(a){var b=a.aa(a.R);H(a,a.R+1);return b}function M(a){var b=a.u.Sa(a.R);H(a,a.R+2);return b}function N(a){var b=a.u.Sa(a.na);a.na=a.na+2&65535;return b}function P(a,b){a.na=a.na-2&65535;a.u.Hb(a.na,b)}
|
||||
function Gd(a){if(a.b&&a.j&255&&a.ua&512){for(var b=0;8>b&&!(a.j&1<<b);b++);a.j&=~(0>b?255:1<<b);a.ua&=-513;a.j&=-257;a.ka[199|b<<3].call(a)}return a.j&256?(Lc(a),!1):!0}function Hd(a,b){a.j|=1<<b;a.ua&512&&Lc(a)}function Q(a,b,c,d){d=d||2;a.N[b]&&(void 0===c&&(qb(a,"Value for "+b+" is invalid"),a.pa()),c=!a.C.Aa||a.C.tc?t(c,d):"--------".substr(0,d),a.N[b].textContent!=c&&(a.N[b].textContent=c))}
|
||||
l.Ja=function(a){this.la&&(a||!this.C.Aa||this.C.tc)&&(Q(this,"A",this.i),Q(this,"B",this.S),Q(this,"C",this.T),Q(this,"BC",Vc(this),4),Q(this,"D",this.U),Q(this,"E",this.V),Q(this,"DE",Xc(this),4),Q(this,"H",this.W),Q(this,"L",this.Z),Q(this,"HL",J(this),4),Q(this,"SP",this.na,4),Q(this,"PC",this.R,4),a=Tc(this),Q(this,"PS",a,4),Q(this,"IF",a&512?1:0,1),Q(this,"SF",a&128?1:0,1),Q(this,"ZF",a&64?1:0,1),Q(this,"AF",a&16?1:0,1),Q(this,"PF",a&4?1:0,1),Q(this,"CF",a&1?1:0,1));if(a=this.N.speed)a.textContent=
|
||||
this.C.Aa&&this.K?this.K.toFixed(2)+"Mhz":"Stopped"};l.kb=function(a){this.C.complete=!0;var b=this.C.Jd=this.H&&Id(this.H),c=a?this.C.Qb?0:1:-1;this.C.Qb=!1;this.L=this.b=a;if(Gd(this)){do{if(b){if(Jd(this.H,this.R,c)){this.pa();break}c=1}this.ka[L(this)].call(this)}while(0<this.b)}return this.C.complete?this.L-this.b:void 0===this.C.complete?0:-1};Ma(function(){for(var a=D(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Nc(d);hb(d,c)}});function Kd(){this.b-=4}
|
||||
function Ld(){H(this,M(this));this.b-=10}function Md(){H(this,N(this));this.b-=10}function Nd(){var a=M(this);P(this,this.R);H(this,a);this.b-=17}
|
||||
var Oc=[Kd,function(){Wc(this,M(this));this.b-=10},function(){this.va(Vc(this),this.i);this.b-=7},function(){Wc(this,Vc(this)+1);this.b-=5},function(){this.S=jd(this,this.S);this.b-=5},function(){this.S=id(this,this.S);this.b-=5},function(){this.S=L(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|a>>8;ad(this,a&256);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+Vc(this));ad(this,a>>8&256);this.b-=10},function(){this.i=this.aa(Vc(this));this.b-=7},function(){Wc(this,Vc(this)-1);this.b-=
|
||||
5},function(){this.T=jd(this,this.T);this.b-=5},function(){this.T=id(this,this.T);this.b-=5},function(){this.T=L(this);this.b-=7},function(){var a=this.i<<8&256;this.i=(a|this.i)>>1;ad(this,a);this.b-=4},Kd,function(){Yc(this,M(this));this.b-=10},function(){this.va(Xc(this),this.i);this.b-=7},function(){Yc(this,Xc(this)+1);this.b-=5},function(){this.U=jd(this,this.U);this.b-=5},function(){this.U=id(this,this.U);this.b-=5},function(){this.U=L(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|
|
||||
$c(this);ad(this,a&256);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+Xc(this));ad(this,a>>8&256);this.b-=10},function(){this.i=this.aa(Xc(this));this.b-=7},function(){Yc(this,Xc(this)-1);this.b-=5},function(){this.V=jd(this,this.V);this.b-=5},function(){this.V=id(this,this.V);this.b-=5},function(){this.V=L(this);this.b-=7},function(){var a=this.i<<8;this.i=($c(this)<<8|this.i)>>1;ad(this,a&256);this.b-=4},Kd,function(){Zc(this,M(this));this.b-=10},function(){var a=M(this);this.u.Hb(a,J(this));
|
||||
this.b-=16},function(){Zc(this,J(this)+1);this.b-=5},function(){this.W=jd(this,this.W);this.b-=5},function(){this.W=id(this,this.W);this.b-=5},function(){this.W=L(this);this.b-=7},function(){var a=0,b=$c(this);if(cd(this)||9<(this.i&15))a|=6;if(b||154<=this.i)a|=96,b=1;this.i=fd(this,a);ad(this,b?256:0);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+J(this));ad(this,a>>8&256);this.b-=10},function(){var a;a=M(this);a=this.u.Sa(a);Zc(this,a);this.b-=16},function(){Zc(this,J(this)-1);this.b-=5},function(){this.Z=
|
||||
jd(this,this.Z);this.b-=5},function(){this.Z=id(this,this.Z);this.b-=5},function(){this.Z=L(this);this.b-=7},function(){this.i=~this.i&255;this.b-=4},Kd,function(){this.na=M(this)&65535;this.b-=10},function(){this.va(M(this),this.i);this.b-=13},function(){this.na=this.na+1&65535;this.b-=5},function(){var a=J(this);this.va(a,jd(this,this.aa(a)));this.b-=10},function(){var a=J(this);this.va(a,id(this,this.aa(a)));this.b-=10},function(){this.va(J(this),L(this));this.b-=10},function(){this.da|=256;this.b-=
|
||||
4},Kd,function(){var a;Zc(this,a=J(this)+this.na);ad(this,a>>8&256);this.b-=10},function(){this.i=this.aa(M(this));this.b-=13},function(){this.na=this.na-1&65535;this.b-=5},function(){this.i=jd(this,this.i);this.b-=5},function(){this.i=id(this,this.i);this.b-=5},function(){this.i=L(this);this.b-=7},function(){ad(this,$c(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;
|
||||
this.b-=5},function(){this.S=this.Z;this.b-=5},function(){this.S=this.aa(J(this));this.b-=7},function(){this.S=this.i;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Z;this.b-=5},function(){this.T=this.aa(J(this));this.b-=7},function(){this.T=this.i;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=
|
||||
5},function(){this.U=this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Z;this.b-=5},function(){this.U=this.aa(J(this));this.b-=7},function(){this.U=this.i;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Z;this.b-=5},function(){this.V=this.aa(J(this));this.b-=7},function(){this.V=this.i;this.b-=5},function(){this.W=this.S;
|
||||
this.b-=5},function(){this.W=this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Z;this.b-=5},function(){this.W=this.aa(J(this));this.b-=7},function(){this.W=this.i;this.b-=5},function(){this.Z=this.S;this.b-=5},function(){this.Z=this.T;this.b-=5},function(){this.Z=this.U;this.b-=5},function(){this.Z=this.V;this.b-=5},function(){this.Z=this.W;this.b-=5},function(){this.b-=5},function(){this.Z=this.aa(J(this));this.b-=
|
||||
7},function(){this.Z=this.i;this.b-=5},function(){this.va(J(this),this.S);this.b-=7},function(){this.va(J(this),this.T);this.b-=7},function(){this.va(J(this),this.U);this.b-=7},function(){this.va(J(this),this.V);this.b-=7},function(){this.va(J(this),this.W);this.b-=7},function(){this.va(J(this),this.Z);this.b-=7},function(){var a=this.R-1;if(this.ca.length)for(var b=0;b<this.ca.length;b++)if(this.ca[b](a))return;this.b-=7;this.j|=256;Lc(this);this.H&&kb(this,-2147483648)?(H(this,a),this.H.pa()):this.ua&
|
||||
512||(this.H&&H(this,a),this.pa())},function(){this.va(J(this),this.i);this.b-=7},function(){this.i=this.S;this.b-=5},function(){this.i=this.T;this.b-=5},function(){this.i=this.U;this.b-=5},function(){this.i=this.V;this.b-=5},function(){this.i=this.W;this.b-=5},function(){this.i=this.Z;this.b-=5},function(){this.i=this.aa(J(this));this.b-=7},function(){this.b-=5},function(){this.i=fd(this,this.S);this.b-=4},function(){this.i=fd(this,this.T);this.b-=4},function(){this.i=fd(this,this.U);this.b-=4},
|
||||
function(){this.i=fd(this,this.V);this.b-=4},function(){this.i=fd(this,this.W);this.b-=4},function(){this.i=fd(this,this.Z);this.b-=4},function(){this.i=fd(this,this.aa(J(this)));this.b-=7},function(){this.i=fd(this,this.i);this.b-=4},function(){this.i=gd(this,this.S);this.b-=4},function(){this.i=gd(this,this.T);this.b-=4},function(){this.i=gd(this,this.U);this.b-=4},function(){this.i=gd(this,this.V);this.b-=4},function(){this.i=gd(this,this.W);this.b-=4},function(){this.i=gd(this,this.Z);this.b-=
|
||||
4},function(){this.i=gd(this,this.aa(J(this)));this.b-=7},function(){this.i=gd(this,this.i);this.b-=4},function(){this.i=K(this,this.S);this.b-=4},function(){this.i=K(this,this.T);this.b-=4},function(){this.i=K(this,this.U);this.b-=4},function(){this.i=K(this,this.V);this.b-=4},function(){this.i=K(this,this.W);this.b-=4},function(){this.i=K(this,this.Z);this.b-=4},function(){this.i=K(this,this.aa(J(this)));this.b-=7},function(){this.i=K(this,this.i);this.b-=4},function(){this.i=ld(this,this.S);this.b-=
|
||||
4},function(){this.i=ld(this,this.T);this.b-=4},function(){this.i=ld(this,this.U);this.b-=4},function(){this.i=ld(this,this.V);this.b-=4},function(){this.i=ld(this,this.W);this.b-=4},function(){this.i=ld(this,this.Z);this.b-=4},function(){this.i=ld(this,this.aa(J(this)));this.b-=7},function(){this.i=ld(this,this.i);this.b-=4},function(){this.i=hd(this,this.S);this.b-=4},function(){this.i=hd(this,this.T);this.b-=4},function(){this.i=hd(this,this.U);this.b-=4},function(){this.i=hd(this,this.V);this.b-=
|
||||
4},function(){this.i=hd(this,this.W);this.b-=4},function(){this.i=hd(this,this.Z);this.b-=4},function(){this.i=hd(this,this.aa(J(this)));this.b-=7},function(){this.i=hd(this,this.i);this.b-=4},function(){this.i=md(this,this.S);this.b-=4},function(){this.i=md(this,this.T);this.b-=4},function(){this.i=md(this,this.U);this.b-=4},function(){this.i=md(this,this.V);this.b-=4},function(){this.i=md(this,this.W);this.b-=4},function(){this.i=md(this,this.Z);this.b-=4},function(){this.i=md(this,this.aa(J(this)));
|
||||
this.b-=7},function(){this.i=md(this,this.i);this.b-=4},function(){this.i=kd(this,this.S);this.b-=4},function(){this.i=kd(this,this.T);this.b-=4},function(){this.i=kd(this,this.U);this.b-=4},function(){this.i=kd(this,this.V);this.b-=4},function(){this.i=kd(this,this.W);this.b-=4},function(){this.i=kd(this,this.Z);this.b-=4},function(){this.i=kd(this,this.aa(J(this)));this.b-=7},function(){this.i=kd(this,this.i);this.b-=4},function(){K(this,this.S);this.b-=4},function(){K(this,this.T);this.b-=4},function(){K(this,
|
||||
this.U);this.b-=4},function(){K(this,this.V);this.b-=4},function(){K(this,this.W);this.b-=4},function(){K(this,this.Z);this.b-=4},function(){K(this,this.aa(J(this)));this.b-=7},function(){K(this,this.i);this.b-=4},function(){dd(this)||(H(this,N(this)),this.b-=6);this.b-=5},function(){Wc(this,N(this));this.b-=10},function(){var a=M(this);dd(this)||H(this,a);this.b-=10},Ld,function(){var a=M(this);dd(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Vc(this));this.b-=11},function(){this.i=
|
||||
fd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,0);this.b-=11},function(){dd(this)&&(H(this,N(this)),this.b-=6);this.b-=5},Md,function(){var a=M(this);dd(this)&&H(this,a);this.b-=10},Ld,function(){var a=M(this);dd(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=gd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,8);this.b-=11},function(){$c(this)||(H(this,N(this)),this.b-=6);this.b-=5},function(){Yc(this,N(this));this.b-=10},function(){var a=M(this);
|
||||
$c(this)||H(this,a);this.b-=10},function(){var a=L(this);Ub(this.u,a,this.i,this.R+-2&65535);this.b-=10},function(){var a=M(this);$c(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Xc(this));this.b-=11},function(){this.i=K(this,L(this));this.b-=7},function(){P(this,this.R);H(this,16);this.b-=11},function(){$c(this)&&(H(this,N(this)),this.b-=6);this.b-=5},Md,function(){var a=M(this);$c(this)&&H(this,a);this.b-=10},function(){var a=L(this);this.i=Ib(this.u,a,this.R+-2&65535)&
|
||||
255;this.b-=10},function(){var a=M(this);$c(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=ld(this,L(this));this.b-=7},function(){P(this,this.R);H(this,24);this.b-=11},function(){bd(this)||(H(this,N(this)),this.b-=6);this.b-=5},function(){Zc(this,N(this));this.b-=10},function(){var a=M(this);bd(this)||H(this,a);this.b-=10},function(){var a=N(this);P(this,J(this));Zc(this,a);this.b-=18},function(){var a=M(this);bd(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},
|
||||
function(){P(this,J(this));this.b-=11},function(){this.i=hd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,32);this.b-=11},function(){bd(this)&&(H(this,N(this)),this.b-=6);this.b-=5},function(){H(this,J(this));this.b-=5},function(){var a=M(this);bd(this)&&H(this,a);this.b-=10},function(){var a=J(this);Zc(this,Xc(this));Yc(this,a);this.b-=5},function(){var a=M(this);bd(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=md(this,L(this));this.b-=7},function(){P(this,
|
||||
this.R);H(this,40);this.b-=11},function(){ed(this)||(H(this,N(this)),this.b-=6);this.b-=5},function(){var a=N(this);Rc(this,a&255|this.ua&-256);this.i=a>>8;this.b-=10},function(){var a=M(this);ed(this)||H(this,a);this.b-=10},function(){this.ua&=-513;this.b-=4},function(){var a=M(this);ed(this)||(P(this,this.R),H(this,a),this.b-=6);this.b-=11},function(){P(this,Tc(this)&255|this.i<<8);this.b-=11},function(){this.i=kd(this,L(this));this.b-=7},function(){P(this,this.R);H(this,48);this.b-=11},function(){ed(this)&&
|
||||
(H(this,N(this)),this.b-=6);this.b-=5},function(){this.na=J(this)&65535;this.b-=5},function(){var a=M(this);ed(this)&&H(this,a);this.b-=10},function(){this.ua|=512;this.b-=4;Gd(this)},function(){var a=M(this);ed(this)&&(P(this,this.R),H(this,a),this.b-=6);this.b-=11},Nd,function(){K(this,L(this));this.b-=7},function(){P(this,this.R);H(this,56);this.b-=11}];
|
||||
function S(a){z.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Od[b]&&Oa("Unrecognized ChipSet model: "+b);this.w=Od[b]||{};a.sound&&(this.fa=null,window&&(this.fa=window.AudioContext||window.webkitAudioContext),this.fa&&new this.fa);F(this)}bb(S);
|
||||
var T={Ba:1978.1,ud:{Ca:0,oe:1,se:16,ze:32,Ie:64,He:128,mb:14},Za:{Ca:1,Jc:1,md:2,hd:4,jd:16,kd:32,ld:64,mb:8},vd:{Ca:2,ne:3,Qe:4,pe:8,De:16,Ee:32,Fe:64,qe:128,mb:0},Me:{Ca:3},Ke:{Ca:2,Ae:7},Oe:{Ca:3,Re:1,Ne:2,Ge:4,xe:8,re:16,he:32},Le:{Ca:4},Pe:{Ca:5,te:1,ue:2,ve:4,we:8,Se:16}},U={Ba:100,Ka:{Ca:66,kc:1,$b:2,ed:4,Ce:8,Be:16,bc:32,ac:64,Wb:128},Hc:{Ca:66,INIT:0},Ua:{Ca:194,je:0,Ub:16,od:32,gc:48,Rc:0,Sc:32},zb:{Ca:162,Je:0,Uc:0,Qc:0,Tc:0,Pc:0},La:{ye:{Ca:98},Ta:{Ec:0,Dc:1,rd:2,Ad:4,Kc:5,pd:6,sd:7},
|
||||
Bb:16383}},Od={SI1978:T,VT100:U};S.prototype.oa=function(){return!1};S.prototype.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;this.B=a;this.K=vb(a,"Keyboard");this.Fa=vb(a,"SerialPort");this.video=vb(a,"Video");Hb(b,this,this.w.Fb);Tb(b,this,this.w.Gb);if(d){var e=this;Pd(d,16384,function(){for(var a="",b=0;b<e.I.length;b++)a&&(a+=b&&b%10?", ":",\n"),a+=v(e.I[b]);e.H.g(a)})}};S.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
S.prototype.Ia=function(a){return a?this.save():!0};T.INIT=[[T.ud.mb,T.Za.mb,T.vd.mb,0,0,0,0]];
|
||||
U.INIT=[[U.Hc.INIT,U.Ka.$b|U.Ka.ed],[U.Ua.Rc,U.Ua.Sc],[U.zb.Uc,U.zb.Qc,U.zb.Tc,U.zb.Pc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];l=S.prototype;l.reset=function(){this.w.INIT&&!this.restore(this.w.INIT)&&this.ja("reset error")};
|
||||
l.save=function(){var a=new Tc(this);switch(this.w.Aa){case T.Aa:I(a,0,[this.va,this.G,this.ya,this.X,this.da,this.ka,this.la]);break;case U.Aa:I(a,0,[this.ga,this.J]),I(a,1,[this.L,this.M]),I(a,2,[this.D,this.aa,this.ia,this.ha]),I(a,3,[this.P,this.j,this.O,this.ba,this.H])}return a.data()};
|
||||
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.w.Aa){case T.Aa:return this.va=b[0],this.G=b[1],this.ya=b[2],this.X=b[3],this.da=b[4],this.ka=b[5],this.la=b[6],!0;case U.Aa:return this.ga=b[0],this.J=b[1],b=a[1],this.L=b[0],this.M=b[1],b=a[2],this.D=b[0],this.aa=b[1],this.ia=b[2],this.ha=b[3],b=a[3],this.P=b[0],this.j=b[1],this.O=b[2],this.ba=b[3],this.H=b[4],!0}return!1};l.start=function(){};l.stop=function(){};l.ld=function(a,b){var c=this.va;E(this,a,null,b,"STATUS0",c,!0);return c};
|
||||
l.md=function(a,b){var c=this.G;E(this,a,null,b,"STATUS1",c,!0);return c};l.nd=function(a,b){var c=this.ya;E(this,a,null,b,"STATUS2",c,!0);return c};l.kd=function(a,b){var c=this.X>>8-this.da&255;E(this,a,null,b,"SHIFT.RESULT",c,!0);return c};l.ud=function(a,b,c){E(this,a,b,c,"SHIFT.COUNT",null,!0);this.da=b};l.wd=function(a,b,c){E(this,a,b,c,"SOUND1",null,!0);this.ka=b};l.vd=function(a,b,c){E(this,a,b,c,"SHIFT.DATA",null,!0);this.X=b<<8|this.X>>8};
|
||||
l.xd=function(a,b,c){E(this,a,b,c,"SOUND2",null,!0);this.la=b};l.yd=function(a,b,c){E(this,a,b,c,"WATCHDOG",null,!0)};function Pd(a){var b=0,c=0,d=~a.P;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
|
||||
l.od=function(a,b){var c=this.J,c=c&~U.Ja.Xb;if((Ec(this.b)&64)<<1&&(c|=U.Ja.Xb,c!=this.J)){var d,e;d=this.O&1;e=this.O>>1&7;switch(e){case U.Ka.Ta.$c:break;case U.Ka.Ta.yc:this.P=this.P<<1|d;break;case U.Ka.Ta.Ec:d=Pd(this);this.H[d]=U.Ka.zb;ib(this,"doNVRCommand(): erase data at addr "+t(d));break;case U.Ka.Ta.zc:this.j=this.j<<1|d;break;case U.Ka.Ta.dd:d=Pd(this);e=this.j&U.Ka.zb;this.H[d]=e;ib(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case U.Ka.Ta.Yc:d=Pd(this);e=this.H[d];
|
||||
null==e&&(e=U.Ka.zb);this.j=e;ib(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case U.Ka.Ta.Zc:this.j<<=1;this.ba=this.j&U.Ka.zb+1;break;default:ib(this,"doNVRCommand(): unrecognized command "+da(e))}}c&=~U.Ja.Yb;this.ba&&(c|=U.Ja.Yb);c&=~U.Ja.Tb;if(d=this.K){d=this.K;if(e=d.D)e=d.b,e=Ec(d.b)>=d.J+e.X*e.Qa/1E3*1.2731488;e&&(d.D=!1);d=!d.D}d&&(c|=U.Ja.Tb);c&=~U.Ja.$b;this.Ea&&this.Ea.Ca&1&&(c|=U.Ja.$b);this.J=c;E(this,a,null,b,"FLAGS",c);return c};
|
||||
l.zd=function(a,b,c){E(this,a,b,c,"BRIGHTNESS");this.ga=b};l.Cd=function(a,b,c){E(this,a,b,c,"NVR.LATCH");this.O=b};l.Bd=function(a,b,c){E(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.D=this.D&-4|a;break;case 1:this.D=this.D&-13|a<<2;this.video&&(b=this.video,a=this.D,ib(b,"updateScrollOffset("+a+")"),b.ob!==a&&((b.ob=a)?Lc(b,!0):b.qb=!0));break;case 2:switch(a){case 0:this.aa=~this.aa;break;case 2:case 3:this.ia=3-a}break;case 3:this.ha=a}};
|
||||
l.Ad=function(a,b,c){E(this,a,b,c,"DC011");b&U.Ua.Xc?(b&=U.Ua.Zb,this.M!=b&&(this.M=b,this.video&&(a=this.video,b=this.M==U.Ua.Zb?50:60,ib(a,"updateRate("+b+")"),a.uc=b))):(b&=U.Ua.Sb,this.L!=b&&(this.L=b,this.video&&(a=this.L==U.Ua.Sb?132:80,b=this.video,ib(b,"updateDimensions("+a+","+(80<a&&this.J&U.Ja.Wb?14:24)+")"),b.ba=a,b.qa=b.ic,80<a&&b.qa--,Qd(b)&&Rd(b))))};T.Eb={0:S.prototype.ld,1:S.prototype.md,2:S.prototype.nd,3:S.prototype.kd};
|
||||
T.Fb={2:S.prototype.ud,3:S.prototype.wd,4:S.prototype.vd,5:S.prototype.xd,6:S.prototype.yd};U.Eb={66:S.prototype.od};U.Fb={66:S.prototype.zd,98:S.prototype.Cd,162:S.prototype.Bd,194:S.prototype.Ad};Ma(function(){for(var a=D(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new S(d);gb(d,c)}});
|
||||
function Sd(a){w.call(this,"ROM",a,Sd);this.B=null;this.D=a.addr;this.j=a.size;this.G=a.writable;this.w=a.alias;this.H=a.file;this.K=ea(this.H);if(this.H){a=this.H;var b=fa(this.K);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.H+"&format=bytes&decimal=true");var c=this;sa(a,null,!0,function(a,b,f){Td(c,a,b,f)})}}z(Sd);var Ud=[0,5];Sd.prototype.Oa=function(a,b,c,d){this.u=b;this.b=c;this.I=d;Vd(this)};
|
||||
Sd.prototype.Da=function(){if(this.Pa){if(this.I){var a=this.I,b=this.id,c=this.D,d=this.j,e=this.Pa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,m=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=oa(p,k,a.bc);0>q&&p.splice(-(q+1),0,k)}m&&(g.a=m.replace(/''/g,'"'))}a.G.push({se:b,F:c,qd:d,Pa:e,ac:f})}delete this.Pa}return!0};Sd.prototype.Ha=function(){return!0};
|
||||
function Td(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{cb(a.Ab,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.B=f;else if(h)for(a.B=Array(4*h.length),d=c=0;c<h.length;c++)a.B[d++]=h[c]&255,a.B[d++]=h[c]>>8&255,a.B[d++]=h[c]>>16&255,a.B[d++]=h[c]>>24&255;else a.B=e;a.Pa=e.symbols;if(!a.B.length){v("Empty ROM: "+b);return}if(1==a.B.length){v(a.B[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e<b.length;e++)a.B[e]=aa(b[e]);Vd(a)}}
|
||||
function Vd(a){if(!mb(a))if(!a.H)F(a);else if(a.B&&a.u){a.j||(a.j=a.B.length);if(a.B.length!=a.j)pb(a,"ROM size (0x"+n(a.B.length)+") does not match specified size ("+("0x"+n(a.j))+")");else if(Wd(a,a.D)){var b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.u,h=d.j,g=[],k=d.D>>>f.ra;0<h&&k<f.Y.length;)g.push(f.Y[k++]),h-=f.Ga;f=d.u;d=d.j;h=0;for(e>>>=f.ra;0<d&&e<f.Y.length;){k=g[h++];if(!k)break;f.Y[e++]=k;d-=f.Ga}}delete a.B}F(a)}}
|
||||
function Wd(a,b){if(yb(a.u,b,a.j,a.G?1:$b)){var c;for(c=0;c<a.B.length;c++)Db(a.u,b+c,a.B[c]);if(a.G&&256==b){for(c=0;c<Ud.length;c++)Db(a.u,Ud[c],118);Pc(a.b,function(a){return function(b){if(0<=Ud.indexOf(b)){var c=!1,h=a.b,g=a.I;if(5==b)switch(c=!0,h.T){case 2:Xd(a,String.fromCharCode(h.V));break;case 9:for(var k=Wc(h),m="",p=255;p--;){var q=a.b.$(k++);if(36==q)break;m+=String.fromCharCode(q)}Xd(a,m);break;default:c=!1}c?Ld.call(h):g&&(a.g("\nCP/M vector "+t(b)),H(h,b),g.pa());b=!0}else b=!1;return b}}(a));
|
||||
Rc(a.b,b)}return!0}return!1}function Xd(a,b){b=b.replace(/\r/g,"");a.Fa&&(a.Fa.value+=b,a.Fa.scrollTop=a.Fa.scrollHeight)}Ma(function(){for(var a=D(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Sd(d);gb(d,c)}});function Yd(a){w.call(this,"RAM",a,Yd);this.w=a.addr;this.j=a.size;this.B=!1}z(Yd);l=Yd.prototype;l.Oa=function(a,b,c,d){this.u=b;this.b=c;this.I=d;F(this)};l.Da=function(a,b){b||this.reset();return!0};l.Ha=function(a){return a?this.save():!0};
|
||||
l.reset=function(){!this.B&&this.j&&yb(this.u,this.w,this.j,1)&&(this.B=!0);this.B||v("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};Ma(function(){for(var a=D(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Yd(d);gb(d,c)}});function Zd(a){w.call(this,"Keyboard",a,Zd,65536);(a=a.model)&&!$d[a]&&Oa("Unrecognized Keyboard8080 model: "+a);this.u=$d[a]||{};this.reset();F(this)}z(Zd);
|
||||
var ae={Aa:1978.1,A:{},Rb:{65:37,68:39,76:32},mb:{},Va:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},V={Aa:100,A:{},Rb:{},mb:{},Va:{setup:120},Ac:{Ba:130,INIT:127},La:{Ba:130,Pc:1,Oc:2,Nc:4,Mc:8,Qc:16,Vb:32,Ub:63,ad:64,Kd:128,INIT:0},Lc:127};V.A[46]=3;V.A[80]=5;V.A[79]=6;V.A[89]=7;V.A[84]=8;V.A[87]=9;V.A[81]=10;V.A[39]=16;V.A[221]=20;V.A[219]=21;V.A[73]=22;V.A[85]=23;V.A[82]=24;V.A[69]=25;V.A[49]=26;V.A[37]=32;V.A[40]=34;V.A[117]=35;V.A[19]=35;V.A[192]=36;V.A[189]=37;V.A[57]=38;V.A[55]=39;
|
||||
V.A[52]=40;V.A[51]=41;V.A[27]=42;V.A[38]=48;V.A[114]=49;V.A[112]=50;V.A[8]=51;V.A[187]=52;V.A[48]=53;V.A[56]=54;V.A[54]=55;V.A[53]=56;V.A[50]=57;V.A[9]=58;V.A[103]=64;V.A[115]=65;V.A[113]=66;V.A[96]=67;V.A[118]=68;V.A[220]=69;V.A[76]=70;V.A[75]=71;V.A[71]=72;V.A[70]=73;V.A[65]=74;V.A[104]=80;V.A[2013]=81;V.A[98]=82;V.A[97]=83;V.A[222]=85;V.A[186]=86;V.A[74]=87;V.A[72]=88;V.A[68]=89;V.A[83]=90;V.A[110]=96;V.A[116]=97;V.A[101]=98;V.A[100]=99;V.A[13]=100;V.A[190]=101;V.A[188]=102;V.A[78]=103;
|
||||
V.A[66]=104;V.A[88]=105;V.A[119]=106;V.A[105]=112;V.A[99]=113;V.A[102]=114;V.A[109]=115;V.A[191]=117;V.A[77]=118;V.A[32]=119;V.A[86]=120;V.A[67]=121;V.A[90]=122;V.A[120]=123;V.A[17]=124;V.A[16]=125;V.A[20]=126;V.mb={l4:V.La.Pc,l3:V.La.Oc,l2:V.La.Nc,l1:V.La.Mc,locked:V.La.Qc,local:V.La.Vb,online:~V.La.Vb};var $d={SI1978:ae,VT100:V};
|
||||
Zd.prototype.oa=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.N[e]){if("led"==a&&this.u.mb[b])return this.N[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return be(d,a,!0)},c.onkeyup=function(a){return be(d,a,!1)},!0;default:if(this.u.Va&&void 0!==this.u.Va[b])return this.N[e]=c,a=function(a,b){return function(c){c.preventDefault();ce(a,b,!0)}}(this,this.u.Va[b]),b=function(a,b){return function(){ce(a,b,!1)}}(this,this.u.Va[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
|
||||
b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};Zd.prototype.Oa=function(a,b,c,d){this.B=a;this.b=c;this.I=d;this.H=ub(a,"ChipSet");Gb(b,this,this.u.Eb);Sb(b,this,this.u.Fb)};Zd.prototype.Da=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Zd.prototype.Ha=function(a){return a?this.save():!0};V.INIT=[[V.La.INIT,V.Ac.INIT,!1,0,-1]];l=Zd.prototype;l.reset=function(){this.j=[];this.u.INIT&&!this.restore(this.u.INIT)&&this.ja("reset error")};
|
||||
l.save=function(){var a=new Tc(this);switch(this.u.Aa){case V.Aa:I(a,0,[this.K,this.G,this.D,this.J,-1])}return a.data()};l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.u.Aa){case ae.Aa:return!0;case V.Aa:return this.K=b[0],de(this,this.K&V.La.Ub),this.G=b[1],this.D=b[2],this.J=b[3],this.w=b[4],!0}return!1};function de(a,b){for(var c in a.u.mb){var d=a.N["led-"+c];if(d){var e=a.u.mb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function be(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.u.Rb[e]||e,!a.u.A[e]){for(var f in a.u.Va)if(a.u.Va[f]===e){e=f;break a}e=null}e&&(d=ce(a,e,c),b.preventDefault());return d}
|
||||
function ce(a,b,c){var d;a:{for(d=0;d<a.j.length;d++)if(a.j[d].Ob==b)break a;d=-1}if(c)0>d?a.j.push({Ob:b,Lb:Date.now(),Bb:!1}):(a.j[d].Lb=Date.now(),a.j[d].Bb=!1);else if(0<=d){if(!a.j[d].Bb){var e=a.j[d].Lb;if(e&&100>Date.now()-e)return a.j[d].Bb=!0,ee(a),!0}a.j.splice(d,1)}if(a.H){d=0;switch(b){case "1p":d=T.Wa.Sc;break;case "2p":d=T.Wa.Wc;break;case "coin":d=T.Wa.Dc;break;case "left":d=T.Wa.Uc;break;case "right":d=T.Wa.Vc;break;case "fire":d=T.Wa.Tc}d&&(a=a.H,b=d,a.G&=~b,c&&(a.G|=b))}return!0}
|
||||
function ee(a){for(var b=0,c=-1;b<a.j.length;){if(a.j[b].Bb){var d=a.j[b].Ob,e=100-(Date.now()-a.j[b].Lb);if(0<e){if(0>c||c>e)c=e}else{ce(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){ee(a)},c)}l.pd=function(a,b){var c=this.G;0<=this.w&&(this.w<this.j.length?(c=this.j[this.w],this.w++,c=V.A[c.Ob],c&128&&(c&=127)):(this.w=-1,c=V.Lc),this.G=c,Gd(this.b,1));E(this,a,null,b,"KBDUART.ADDRESS",c);return c};
|
||||
l.Dd=function(a,b,c){E(this,a,b,c,"KBDUART.STATUS");this.K=b;this.D=!0;this.J=Ec(this.b);de(this,b&V.La.Ub);b&V.La.ad&&(this.w=0,Gd(this.b,1))};V.Eb={130:Zd.prototype.pd};V.Fb={130:Zd.prototype.Dd};Ma(function(){for(var a=D(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Zd(d);gb(d,c)}});
|
||||
function fe(a,b,c,d,e){var f=this;this.nc=Aa("Gecko/");var h=["","moz","ms","webkit"];w.call(this,"Video",a,fe,262144);this.X=a.screenWidth;this.O=a.screenHeight;this.Sa=a.bufferAddr;this.Gd=a.bufferRAM;var g=a.bufferFormat;this.la=g&&ge[g.toUpperCase()]||he;this.ba=a.bufferCols;this.va=a.bufferRows;this.ic=this.qa=a.cellWidth||1;this.ma=a.cellHeight||1;this.ya=null;this.lc=!1;this.Za=a.bufferBits||1;this.Hd=a.bufferLeft||0;if(this.w=a.bufferRotate)this.w=this.w%360,0<this.w&&(this.w-=360),-90!=this.w&&
|
||||
(this.ja("unsupported buffer rotation: "+this.w),this.w=0);this.$a=a.interruptRate;this.vc=a.refreshRate||60;this.M=b;this.H=c;this.ia=(this.Bc=d)||b||null;this.Ed=this.X;this.Fd=this.O;this.jc=this.X/this.ba|0;this.kc=this.O/this.va|0;1<this.ma&&(this.va++,this.ob=0,this.qb=!1);b=a.smoothing;(c=Va.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.H[d]){this.H[d]=b;break}if(this.D=a.screenRotate)this.D=this.D%
|
||||
360,0<this.D&&(this.D-=360),-90!=this.D?(this.ja("unsupported screen rotation: "+this.D),this.D=0):(this.H.translate(0,this.O),this.H.rotate(this.D*Math.PI/180),this.H.scale(this.O/this.X,this.X/this.O));if(this.j=e)if(this.j.fb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.j.fb){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){ie(f,document.fullscreenElement||document.msFullscreenElement||
|
||||
document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){ie(f,null)},!1);break}}if(this.da=a.fontROM)"json"!=fa(this.da)&&(this.da=ha()+"/api/v1/dump?file="+this.da+"&format=bytes"),sa(this.da,null,!0,function(a,b,c){je(f,a,b,c)});this.Kb={}}z(fe);var he=0,ge={SI1978:1,VT100:2};
|
||||
function Qd(a){a.J=a.ba*a.qa;a.aa=a.va*a.ma;var b=a.J,c=a.aa;a.w&&(b=a.aa,c=a.J);a.P=0;if(!a.Gd&&(a.P=(a.J*a.Za>>3)*a.aa,!yb(a.u,a.Sa,a.P,3)))return!1;a.P?(a.oc=a.H.createImageData(b,c),a.qc=16/a.Za|0,ke(a,a.P>>1)):ke(a,(a.ba+1)*a.va);a.L=document.createElement("canvas");a.L.width=b;a.L.height=c;a.pb=a.L.getContext("2d");a.ea={};a.ka=1<<a.Za;a.ga=Array(a.ka+2);a.ga[0]=[0,0,0,255];a.ga[1]=[255,255,255,255];1==a.la&&(a.ga[a.ka+0]=[255,255,0,255],a.ga[a.ka+1]=[0,255,0,255]);2==a.la&&(a.uc=60,a.Jb=!1,
|
||||
a.Ea=Array(a.ba));return!0}fe.prototype.Oa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.I=d;Qd(this);if(this.K=ub(a,"Keyboard")){for(var e in this.Kb)this.K.oa("led",e,this.Kb[e]);this.M&&this.K.oa(this.Bc?"textarea":"canvas","kbd",this.ia)}var f=this;this.wc=Ic(this.b,function(){Lc(f)});Jc(this.b,this.wc,1E3/Math.max(this.vc,this.$a));this.rc=0;this.da||F(this)};
|
||||
function je(a,b,c,d){if(d)a.ja("Unable to load font ROM (error "+d+": "+b+")");else{cb(a.Ab,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){v("Empty font ROM: "+b);return}if(1==f.length){v(f[0]);return}if(2048==f.length)a.ya=f,Rd(a);else{a.ja("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ja("Font ROM data error: "+h.message);return}(a.H||a.I)&&F(a)}}
|
||||
function Rd(a){a.ya&&(a.lc=2==a.la,a.ea[96]=[le(a,a.qa,a.ma),le(a,a.qa,a.ma,a.Jb)],a.ea[64]=[le(a,2*a.qa,a.ma),le(a,2*a.qa,a.ma,a.Jb)],a.ea[32]=a.ea[0]=[le(a,2*a.qa,2*a.ma),le(a,2*a.qa,2*a.ma,a.Jb)])}
|
||||
function le(a,b,c,d){var e=8>=a.ic?8:16,f=8<e?15:0,h=a.ya.length/e,g=!1===d,k={qa:b,ma:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var m=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,x=q;q<a.ma;q++)for(var u=p*e+(f+q&e-1),u=d&&8==q?255:a.ya[u],r=0;r<c/a.ma;r++){for(var B=0,y=0,X=y;y<a.qa;y++){for(var A=u&128>>(7<y?7:y),B=a.lc&&!A&&B?B:A,Q=0;Q<b/a.qa;Q++)g&&(B=!B),me(a,m,X,x,B?1:0),X++;B=A}x++}k.context.putImageData(m,
|
||||
(p&15)*b,(p>>4)*c)}return k}fe.prototype.Da=function(){return!0};fe.prototype.oa=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Kb[b]=c,!0;switch(b){case "fullScreen":return this.N[b]=c,this.j&&this.j.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
fe.prototype.fb=function(){var a=!1;if(this.j){if(this.j.fb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.X/this.O;b>c&&(a=Math.round(c/b*100)+"%")}this.nc?(this.M.style.width=a,this.M.style.width=a,this.M.style.display="block",this.M.style.margin="auto"):(this.j.style.width=a,this.j.style.height="auto");this.j.style.backgroundColor="black";this.j.fb();a=!0}this.ia&&this.ia.focus()}return a};
|
||||
function ie(a,b){!b&&a.j&&(a.nc?a.M.style.width=a.M.style.height="":a.j.style.width=a.j.style.height="");ib(a,"notifyFullScreen("+b+")")}function ke(a,b){a.pc=b;a.ha=!1;if(void 0===a.G||a.G.length!=a.pc)a.G=Array(a.pc)}function me(a,b,c,d,e){d=a.w?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.la&&(208<=c&&236>c?e=a.ka+0:28<=c&&72>c&&(e=a.ka+1));a=a.ga[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
|
||||
function Lc(a,b){var c=!0;if(!b){a.$a&&(120==a.$a?a.rc&1?(Gd(a.b,2),c=!1):Gd(a.b,1):Gd(a.b,4));if(c&&a.ha&&a.P){for(var d=a.u,e=a.P,f=!0,h=a.Sa>>>d.ra;0<e&&h<d.Y.length;)d.Y[h].Ma&&(d.Y[h].Ma=f=!1,d.Y[h].ec=!0),e-=d.Ga,h++;f&&(c=!1)}Jc(a.b,a.wc,1E3/Math.max(a.vc,a.$a));a.rc++}if(c)if(1<a.qa)switch(a.la){case 2:for(var c=a.Sa,d=-1,e=0,f=60==a.uc?2:5,g=h=0,k=-1;e<a.va;){var m=0,p=c,q=d,x=a.ba;for(96!=q&&(x>>=1);;){var u=Bb(a.u,p++);if(127==(u&127)){var r=Bb(a.u,p++),d=r&96,c=(r&15)<<8|Bb(a.u,p),c=c+
|
||||
(r&16?8192:16384);break}if(m<x)a.Ea[m++]=u;else break}if(f)f--;else{for(;m<a.Ea.length;)a.Ea[m++]=0;if(0<=q)for(p=a.ha&&a.G[h]==x,a.G[h++]=x,x=0;x<m;x++){u=a.Ea[x];if(!p||u!==a.G[h]){a.G[k=h]=u;var r=a,B=a.pb,y=u&127;if(u=r.ea[q][u&128?1:0]){var X=(y&15)*u.qa,y=(y>>4)*u.ma,A=void 0,Q=void 0,ba=void 0,Y=void 0,ua=u.qa,Fb=u.ma;B?(A=x*r.qa,Q=e*r.ma,ba=r.qa,Y=r.ma):(A=x*r.jc,Q=e*r.kc,ba=r.jc,Y=r.kc);u.qa>r.qa&&(A*=2,ba*=2);u.ma>r.ma&&(0==q&&(y+=r.ma),Fb=r.ma);B?B.drawImage(u.canvas,X,y,ua,Fb,A,Q,ba,Y):
|
||||
(A+=0,Q+=0,r.H.drawImage(u.canvas,X,y,ua,Fb,A,Q,ba,Y))}g++}h++}e++}}a.ha=!0;!b&&a.qb&&1==g&&(a.G[k]=-1,g=0);a.qb=!1;(g||b)&&a.pb&&a.H.drawImage(a.L,0,a.ob,a.J,a.aa-a.ma,0,0,a.Ed,a.Fd)}else{f=a.Sa;h=f+a.P;m=k=g=0;c=a.J;q=0;d=a.aa;p=e=0;x=a.Za;r=(1<<x)-1;a.Hd&&(x=-x,p=16+x);for(;f<h;){B=Cb(a.u,f);if(a.ha&&B===a.G[g])k+=a.qc;else{a.G[g]=B;(u=p)&&(B=B>>8|(B&255)<<8);k<c&&(c=k);for(X=a.qc;X--;)y=B>>u&r,me(a,a.oc,k++,m,y),u+=x;k>q&&(q=k);m<d&&(d=m);m>=e&&(e=m+1)}f+=2;g++;if(k>=a.J&&(k=0,m++,m>a.aa))break}a.ha=
|
||||
!0;c<a.J&&(f=q-c,e-=d,a.w&&(h=c,g=f,c=d,f=e,d=a.J-(h+g),e=g),a.pb.putImageData(a.oc,0,0,c,d,f,e),a.H.drawImage(a.L,0,0,a.L.width,a.L.height,0,0,a.X,a.O))}}
|
||||
Ma(function(){for(var a=D(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=C(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=ta().indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Va.aspect);f&&.3<=f&&3.33>=f&&(La("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");Aa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new fe(d,e,h,f,c);gb(d,c)}});
|
||||
function ne(a){this.ea=+a.adapter;switch(this.ea){case 0:this.ga=0;this.ia=2;break;default:v("Unrecognized serial adapter #"+this.ea);return}this.j=this.w=null;this.ha=a.tabSize;this.da=a.charBOL;this.D=0;this.aa=!1;w.call(this,"SerialPort",a,ne,8388608);var b=a.binding;if("console"==b)this.w="";else{var c;a=oe;b&&(void 0===c&&(c="Panel"),(c=fb(c,this.id))&&(b=c.N[b])&&this.oa(null,a,b))}this.G="";this.K=this.M=null;this.exports={connect:this.hc,receiveData:this.Nb}}z(ne);
|
||||
var pe=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],qe=[!1,0,0,133,142,39,238],oe="buffer";l=ne.prototype;
|
||||
l.oa=function(a,b,c,d){var e=this;switch(b){case oe:return this.N[b]=this.j=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),re(e,b);return!0},c.onkeypress=function(a){a=a||window.event;re(e,a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.N[b]=c,d=d.replace(/\\e/g,String.fromCharCode(27)),c.onclick=function(){e.Nb(d);return!0},
|
||||
!0}return!1};l.Oa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.I=d;var e=this;this.ka=Ic(this.b,function(){e.Nb()});this.la=Ic(this.b,function(){e.Ca|=5});this.H=ub(a,"ChipSet");Gb(b,this,se,this.ga);Sb(b,this,te,this.ga);F(this)};
|
||||
l.hc=function(){if(!this.K){var a=mc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ma(b[0]);if(c!=this.Xa)return;b=ma(b[1]);if(this.K=eb(b)){var d=this.K.exports;if(d){var e=d.connect;e&&e.call(this.K);if(this.M=d.receiveData){this.status(this.Ab+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};l.Da=function(a,b){if(!b)if(this.hc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
l.Ha=function(a){return a?this.save():!0};l.reset=function(){ue(this)};l.save=function(){var a=new Tc(this),b=0,c=[];c[b++]=this.L;c[b++]=this.X;c[b++]=this.ba;c[b++]=this.Ca;c[b++]=this.J;c[b++]=this.P;c[b]=this.O;I(a,0,c);return a.data()};l.restore=function(a){return ue(this,a[0])};function ue(a,b){var c=0;void 0===b&&(b=qe);a.L=b[c++];a.X=b[c++];a.ba=b[c++];a.Ca=b[c++];a.J=b[c++];a.P=b[c++];a.O=b[c];return!0}
|
||||
function ve(a,b){var c=a.O&b;b&15||(c>>=4);var c=pe[c],d=((a.J&12)>>2)+6;a.J&16&&d++;d+=((a.J&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function re(a,b){ib(a,"receiveByte("+da(b)+"), status="+da(a.Ca));return a.aa||a.Ca&2?!1:(a.X=b,a.Ca|=2,Gd(a.b,a.ia),!0)}l.Nb=function(a){null!=a&&(this.G="number"!=typeof a?a:this.G+String.fromCharCode(a));this.G&&(re(this,this.G.charCodeAt(0))&&(this.G=this.G.substr(1)),this.G&&this.b&&Jc(this.b,this.ka,ve(this,15)));return!0};
|
||||
l.jd=function(a,b){var c=this.X;E(this,a,null,b,"DATA",c);this.Ca&=-3;return c};l.hd=function(a,b){var c=this.Ca;E(this,a,null,b,"STATUS",c);return c};
|
||||
l.td=function(a,b,c){E(this,a,b,c,"DATA");this.ba=b;this.Ca&=-6;ib(this,"transmitByte("+da(b)+")");if(19==b)this.aa=!0;else if(17==b)this.aa=!1;else if(this.M&&this.M.call(this.K,b),this.j)8==b?(this.j.value=this.j.value.slice(0,-1),0<this.D&&this.D--):(a=(a=na[b])?"<"+a+">":String.fromCharCode(b),c=a.length,9==b?(b=this.ha||8,c=b-this.D%b,this.ha&&(a=la("",c))):13==b&&(this.D=c=0,a="\n"),this.da&&!this.D&&c&&(a=String.fromCharCode(this.da)+a),this.j.value+=a,this.j.scrollTop=this.j.scrollHeight,
|
||||
this.D+=c);else if(null!=this.w){if(10==b||1024<=this.w.length)this.g(this.w),this.w="";10!=b&&(this.w+=String.fromCharCode(b))}this.b&&Jc(this.b,this.la,ve(this,240))};l.sd=function(a,b,c){E(this,a,b,c,"CONTROL");this.L?(this.P=b,this.P&64&&(this.L=!1)):(this.J=b,this.L=!0)};l.rd=function(a,b,c){E(this,a,b,c,"BAUDRATES");this.O=b};var se={0:ne.prototype.jd,1:ne.prototype.hd},te={0:ne.prototype.td,1:ne.prototype.sd,2:ne.prototype.rd};
|
||||
Ma(function(){for(var a=D(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new ne(d);gb(d,c)}});function we(a){w.call(this,"Debugger",a,we);this.aa=this.la=this.J=0;this.P=!1;this.j=-1;this.w=[];this.da={}}z(we);var xe={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
|
||||
function ye(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
||||
l.save=function(){var a=new Uc(this);switch(this.w.Ba){case T.Ba:I(a,0,[this.wa,this.G,this.za,this.Y,this.ea,this.qa,this.la]);break;case U.Ba:I(a,0,[this.ha,this.J]),I(a,1,[this.L,this.M]),I(a,2,[this.D,this.ba,this.ka,this.ia]),I(a,3,[this.P,this.j,this.O,this.ca,this.I])}return a.data()};
|
||||
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.w.Ba){case T.Ba:return this.wa=b[0],this.G=b[1],this.za=b[2],this.Y=b[3],this.ea=b[4],this.qa=b[5],this.la=b[6],!0;case U.Ba:return this.ha=b[0],this.J=b[1],b=a[1],this.L=b[0],this.M=b[1],b=a[2],this.D=b[0],this.ba=b[1],this.ka=b[2],this.ia=b[3],b=a[3],this.P=b[0],this.j=b[1],this.O=b[2],this.ca=b[3],this.I=b[4],!0}return!1};l.start=function(){};l.stop=function(){};l.Pd=function(a,b){var c=this.wa;E(this,a,null,b,"STATUS0",c,!0);return c};
|
||||
l.Qd=function(a,b){var c=this.G;E(this,a,null,b,"STATUS1",c,!0);return c};l.Rd=function(a,b){var c=this.za;E(this,a,null,b,"STATUS2",c,!0);return c};l.Od=function(a,b){var c=this.Y>>8-this.ea&255;E(this,a,null,b,"SHIFT.RESULT",c,!0);return c};l.Yd=function(a,b,c){E(this,a,b,c,"SHIFT.COUNT",null,!0);this.ea=b};l.$d=function(a,b,c){E(this,a,b,c,"SOUND1",null,!0);this.qa=b};l.Zd=function(a,b,c){E(this,a,b,c,"SHIFT.DATA",null,!0);this.Y=b<<8|this.Y>>8};
|
||||
l.ae=function(a,b,c){E(this,a,b,c,"SOUND2",null,!0);this.la=b};l.be=function(a,b,c){E(this,a,b,c,"WATCHDOG",null,!0)};function Qd(a){var b=0,c=0,d=~a.P;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
|
||||
l.Sd=function(a,b){var c=this.J,c=c&~U.Ka.ac;if((Fc(this.b)&64)<<1&&(c|=U.Ka.ac,c!=this.J)){var d,e;d=this.O&1;e=this.O>>1&7;switch(e){case U.La.Ta.sd:break;case U.La.Ta.Dc:this.P=this.P<<1|d;break;case U.La.Ta.Kc:d=Qd(this);this.I[d]=U.La.Bb;jb(this,"doNVRCommand(): erase data at addr "+v(d));break;case U.La.Ta.Ec:this.j=this.j<<1|d;break;case U.La.Ta.Ad:d=Qd(this);e=this.j&U.La.Bb;this.I[d]=e;jb(this,"doNVRCommand(): write data "+v(e)+" to addr "+v(d));break;case U.La.Ta.pd:d=Qd(this);e=this.I[d];
|
||||
null==e&&(e=U.La.Bb);this.j=e;jb(this,"doNVRCommand(): read data "+v(e)+" from addr "+v(d));break;case U.La.Ta.rd:this.j<<=1;this.ca=this.j&U.La.Bb+1;break;default:jb(this,"doNVRCommand(): unrecognized command "+ba(e))}}c&=~U.Ka.bc;this.ca&&(c|=U.Ka.bc);c&=~U.Ka.Wb;if(d=this.K){d=this.K;if(e=d.D)e=d.b,e=Fc(d.b)>=d.J+e.Y*e.Ra/1E3*1.2731488;e&&(d.D=!1);d=!d.D}d&&(c|=U.Ka.Wb);c&=~U.Ka.kc;this.Fa&&this.Fa.Da&1&&(c|=U.Ka.kc);this.J=c;E(this,a,null,b,"FLAGS",c);return c};
|
||||
l.ce=function(a,b,c){E(this,a,b,c,"BRIGHTNESS");this.ha=b};l.fe=function(a,b,c){E(this,a,b,c,"NVR.LATCH");this.O=b};l.ee=function(a,b,c){E(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.D=this.D&-4|a;break;case 1:this.D=this.D&-13|a<<2;this.video&&(b=this.video,a=this.D,jb(b,"updateScrollOffset("+a+")"),b.nb!==a&&((b.nb=a)?Mc(b,!0):b.pb=!0));break;case 2:switch(a){case 0:this.ba=~this.ba;break;case 2:case 3:this.ka=3-a}break;case 3:this.ia=a}};
|
||||
l.de=function(a,b,c){E(this,a,b,c,"DC011");b&U.Ua.od?(b&=U.Ua.gc,this.M!=b&&(this.M=b,this.video&&(a=this.video,b=this.M==U.Ua.gc?50:60,jb(a,"updateRate("+b+")"),a.oc=b))):(b&=U.Ua.Ub,this.L!=b&&(this.L=b,this.video&&(a=this.L==U.Ua.Ub?132:80,b=this.video,jb(b,"updateDimensions("+a+","+(80<a&&this.J&U.Ka.$b?14:24)+")"),b.ca=a,b.ra=b.dc,80<a&&b.ra--,Rd(b)&&Sd(b))))};T.Fb={0:S.prototype.Pd,1:S.prototype.Qd,2:S.prototype.Rd,3:S.prototype.Od};
|
||||
T.Gb={2:S.prototype.Yd,3:S.prototype.$d,4:S.prototype.Zd,5:S.prototype.ae,6:S.prototype.be};U.Fb={66:S.prototype.Sd};U.Gb={66:S.prototype.ce,98:S.prototype.fe,162:S.prototype.ee,194:S.prototype.de};Ma(function(){for(var a=D(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new S(d);hb(d,c)}});
|
||||
function Td(a){z.call(this,"ROM",a,Td);this.B=null;this.D=a.addr;this.j=a.size;this.G=a.writable;this.w=a.alias;this.I=a.file;this.K=ea(this.I);if(this.I){a=this.I;var b=fa(this.K);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.I+"&format=bytes&decimal=true");var c=this;sa(a,null,!0,function(a,b,f){Ud(c,a,b,f)})}}bb(Td);var Vd=[0,5];Td.prototype.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;Wd(this)};
|
||||
Td.prototype.Ea=function(){if(this.Qa){if(this.H){var a=this.H,b=this.id,c=this.D,d=this.j,e=this.Qa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,m=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=oa(p,k,a.sc);0>q&&p.splice(-(q+1),0,k)}m&&(g.a=m.replace(/''/g,'"'))}a.G.push({ff:b,F:c,Ud:d,Qa:e,rc:f})}delete this.Qa}return!0};Td.prototype.Ia=function(){return!0};
|
||||
function Ud(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{db(a.Ab,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.B=f;else if(h)for(a.B=Array(4*h.length),d=c=0;c<h.length;c++)a.B[d++]=h[c]&255,a.B[d++]=h[c]>>8&255,a.B[d++]=h[c]>>16&255,a.B[d++]=h[c]>>24&255;else a.B=e;a.Qa=e.symbols;if(!a.B.length){w("Empty ROM: "+b);return}if(1==a.B.length){w(a.B[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e<b.length;e++)a.B[e]=aa(b[e]);Wd(a)}}
|
||||
function Wd(a){if(!nb(a))if(!a.I)F(a);else if(a.B&&a.u){a.j||(a.j=a.B.length);if(a.B.length!=a.j)qb(a,"ROM size (0x"+t(a.B.length)+") does not match specified size ("+("0x"+t(a.j))+")");else if(Xd(a,a.D)){var b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.u,h=d.j,g=[],k=d.D>>>f.sa;0<h&&k<f.X.length;)g.push(f.X[k++]),h-=f.Ha;f=d.u;d=d.j;h=0;for(e>>>=f.sa;0<d&&e<f.X.length;){k=g[h++];if(!k)break;f.X[e++]=k;d-=f.Ha}}delete a.B}F(a)}}
|
||||
function Xd(a,b){if(zb(a.u,b,a.j,a.G?1:ac)){var c;for(c=0;c<a.B.length;c++)Eb(a.u,b+c,a.B[c]);if(a.G&&256==b){for(c=0;c<Vd.length;c++)Eb(a.u,Vd[c],118);Qc(a.b,function(a){return function(b){if(0<=Vd.indexOf(b)){var c=!1,h=a.b,g=a.H;if(5==b)switch(c=!0,h.T){case 2:Yd(a,String.fromCharCode(h.V));break;case 9:for(var k=Xc(h),m="",p=255;p--;){var q=a.b.aa(k++);if(36==q)break;m+=String.fromCharCode(q)}Yd(a,m);break;default:c=!1}c?Md.call(h):g&&(a.g("\nCP/M vector "+v(b)),H(h,b),g.pa());b=!0}else b=!1;
|
||||
return b}}(a));Sc(a.b,b)}return!0}return!1}function Yd(a,b){b=b.replace(/\r/g,"");a.Ga&&(a.Ga.value+=b,a.Ga.scrollTop=a.Ga.scrollHeight)}Ma(function(){for(var a=D(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Td(d);hb(d,c)}});function Zd(a){z.call(this,"RAM",a,Zd);this.w=a.addr;this.j=a.size;this.B=!1}bb(Zd);l=Zd.prototype;l.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;F(this)};l.Ea=function(a,b){b||this.reset();return!0};l.Ia=function(a){return a?this.save():!0};
|
||||
l.reset=function(){!this.B&&this.j&&zb(this.u,this.w,this.j,1)&&(this.B=!0);this.B||w("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};Ma(function(){for(var a=D(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Zd(d);hb(d,c)}});function $d(a){z.call(this,"Keyboard",a,$d,65536);(a=a.model)&&!ae[a]&&Oa("Unrecognized Keyboard8080 model: "+a);this.u=ae[a]||{};this.reset();F(this)}bb($d);var be={};be[n.Sb]=37;be[n.Vb]=39;be[n.Xb]=32;
|
||||
var ce={Ba:1978.1,A:{},Tb:be,qb:{},Ya:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},V={Ba:100,A:{},Tb:{},qb:{},Ya:{setup:120},Fc:{Ca:130,INIT:127},Ma:{Ca:130,ad:1,$c:2,Zc:4,Yc:8,bd:16,Zb:32,Yb:63,td:64,ie:128,INIT:0},Xc:127};V.A[46]=3;V.A[n.gd]=5;V.A[n.fd]=6;V.A[n.Cd]=7;V.A[n.wd]=8;V.A[n.zd]=9;V.A[n.Q]=10;V.A[39]=16;V.A[221]=20;V.A[219]=21;V.A[n.Oc]=22;V.A[n.xd]=23;V.A[n.nd]=24;V.A[n.E]=25;V.A[49]=26;V.A[37]=32;V.A[40]=34;V.A[117]=35;V.A[19]=35;V.A[192]=36;V.A[189]=37;V.A[57]=38;V.A[55]=39;
|
||||
V.A[52]=40;V.A[51]=41;V.A[27]=42;V.A[38]=48;V.A[114]=49;V.A[112]=50;V.A[8]=51;V.A[187]=52;V.A[48]=53;V.A[56]=54;V.A[54]=55;V.A[53]=56;V.A[50]=57;V.A[9]=58;V.A[103]=64;V.A[115]=65;V.A[113]=66;V.A[96]=67;V.A[118]=68;V.A[220]=69;V.A[n.Xb]=70;V.A[n.Wc]=71;V.A[n.Mc]=72;V.A[n.Lc]=73;V.A[n.Sb]=74;V.A[104]=80;V.A[2013]=81;V.A[98]=82;V.A[97]=83;V.A[222]=85;V.A[186]=86;V.A[n.Vc]=87;V.A[n.Nc]=88;V.A[n.Vb]=89;V.A[n.qd]=90;V.A[110]=96;V.A[116]=97;V.A[101]=98;V.A[100]=99;V.A[13]=100;V.A[190]=101;V.A[188]=102;
|
||||
V.A[n.dd]=103;V.A[n.Gc]=104;V.A[n.Bd]=105;V.A[119]=106;V.A[105]=112;V.A[99]=113;V.A[102]=114;V.A[109]=115;V.A[191]=117;V.A[n.cd]=118;V.A[n[" "]]=119;V.A[n.yd]=120;V.A[n.Ic]=121;V.A[n.Dd]=122;V.A[120]=123;V.A[17]=124;V.A[16]=125;V.A[20]=126;V.qb={l4:V.Ma.ad,l3:V.Ma.$c,l2:V.Ma.Zc,l1:V.Ma.Yc,locked:V.Ma.bd,local:V.Ma.Zb,online:~V.Ma.Zb};var ae={SI1978:ce,VT100:V};
|
||||
$d.prototype.oa=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.N[e]){if("led"==a&&this.u.qb[b])return this.N[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return de(d,a,!0)},c.onkeyup=function(a){return de(d,a,!1)},!0;default:if(this.u.Ya&&void 0!==this.u.Ya[b])return this.N[e]=c,a=function(a,b){return function(c){c.preventDefault();ee(a,b,!0)}}(this,this.u.Ya[b]),b=function(a,b){return function(){ee(a,b,!1)}}(this,this.u.Ya[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
|
||||
b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};$d.prototype.Pa=function(a,b,c,d){this.B=a;this.b=c;this.H=d;this.I=vb(a,"ChipSet");Hb(b,this,this.u.Fb);Tb(b,this,this.u.Gb)};$d.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};$d.prototype.Ia=function(a){return a?this.save():!0};V.INIT=[[V.Ma.INIT,V.Fc.INIT,!1,0,-1]];l=$d.prototype;l.reset=function(){this.j=[];this.u.INIT&&!this.restore(this.u.INIT)&&this.ja("reset error")};
|
||||
l.save=function(){var a=new Uc(this);switch(this.u.Ba){case V.Ba:I(a,0,[this.K,this.G,this.D,this.J,-1])}return a.data()};l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.u.Ba){case ce.Ba:return!0;case V.Ba:return this.K=b[0],fe(this,this.K&V.Ma.Yb),this.G=b[1],this.D=b[2],this.J=b[3],this.w=b[4],!0}return!1};function fe(a,b){for(var c in a.u.qb){var d=a.N["led-"+c];if(d){var e=a.u.qb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function de(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.u.Tb[e]||e,!a.u.A[e]){for(var f in a.u.Ya)if(a.u.Ya[f]===e){e=f;break a}e=null}e&&(d=ee(a,e,c),b.preventDefault());return d}
|
||||
function ee(a,b,c){var d;a:{for(d=0;d<a.j.length;d++)if(a.j[d].Pb==b)break a;d=-1}if(c)0>d?a.j.push({Pb:b,Mb:Date.now(),Cb:!1}):(a.j[d].Mb=Date.now(),a.j[d].Cb=!1);else if(0<=d){if(!a.j[d].Cb){var e=a.j[d].Mb;if(e&&100>Date.now()-e)return a.j[d].Cb=!0,ge(a),!0}a.j.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=T.Za.hd;break;case "2p":d=T.Za.md;break;case "coin":d=T.Za.Jc;break;case "left":d=T.Za.kd;break;case "right":d=T.Za.ld;break;case "fire":d=T.Za.jd}d&&(a=a.I,b=d,a.G&=~b,c&&(a.G|=b))}return!0}
|
||||
function ge(a){for(var b=0,c=-1;b<a.j.length;){if(a.j[b].Cb){var d=a.j[b].Pb,e=100-(Date.now()-a.j[b].Mb);if(0<e){if(0>c||c>e)c=e}else{ee(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){ge(a)},c)}l.Td=function(a,b){var c=this.G;0<=this.w&&(this.w<this.j.length?(c=this.j[this.w],this.w++,c=V.A[c.Pb],c&128&&(c&=127)):(this.w=-1,c=V.Xc),this.G=c,Hd(this.b,1));E(this,a,null,b,"KBDUART.ADDRESS",c);return c};
|
||||
l.ge=function(a,b,c){E(this,a,b,c,"KBDUART.STATUS");this.K=b;this.D=!0;this.J=Fc(this.b);fe(this,b&V.Ma.Yb);b&V.Ma.td&&(this.w=0,Hd(this.b,1))};V.Fb={130:$d.prototype.Td};V.Gb={130:$d.prototype.ge};Ma(function(){for(var a=D(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new $d(d);hb(d,c)}});
|
||||
function he(a,b,c,d,e){var f=this;this.ic=Aa("Gecko/");var h=["","moz","ms","webkit"];z.call(this,"Video",a,he,262144);this.Y=a.screenWidth;this.O=a.screenHeight;this.Va=a.bufferAddr;this.Gd=a.bufferRAM;var g=a.bufferFormat;this.la=g&&ie[g.toUpperCase()]||je;this.ca=a.bufferCols;this.wa=a.bufferRows;this.dc=this.ra=a.cellWidth||1;this.ma=a.cellHeight||1;this.za=null;this.hc=!1;this.Wa=a.bufferBits||1;this.Id=a.bufferLeft||0;if(this.w=a.bufferRotate)this.w=this.w%360,0<this.w&&(this.w-=360),-90!=this.w&&
|
||||
(this.ja("unsupported buffer rotation: "+this.w),this.w=0);this.Xa=a.interruptRate;this.pc=a.refreshRate||60;this.M=b;this.I=c;this.ka=(this.Ld=d)||b||null;this.Cc=this.Y;this.Fd=this.O;this.ec=this.Y/this.ca|0;this.fc=this.O/this.wa|0;1<this.ma&&(this.wa++,this.nb=0,this.pb=!1);b=a.smoothing;(c=Va.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.I[d]){this.I[d]=b;break}if(this.D=a.screenRotate)this.D=this.D%
|
||||
360,0<this.D&&(this.D-=360),-90!=this.D?(this.ja("unsupported screen rotation: "+this.D),this.D=0):(this.I.translate(0,this.O),this.I.rotate(this.D*Math.PI/180),this.I.scale(this.O/this.Y,this.Y/this.O));if(this.j=e)if(this.j.gb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.j.gb){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){ke(f,document.fullscreenElement||document.msFullscreenElement||
|
||||
document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){ke(f,null)},!1);break}}if(this.ea=a.fontROM)"json"!=fa(this.ea)&&(this.ea=ha()+"/api/v1/dump?file="+this.ea+"&format=bytes"),sa(this.ea,null,!0,function(a,b,c){le(f,a,b,c)});this.Jb={}}bb(he);var je=0,ie={SI1978:1,VT100:2};
|
||||
function Rd(a){a.J=a.ca*a.ra;a.ba=a.wa*a.ma;var b=a.J,c=a.ba;a.w&&(b=a.ba,c=a.J);a.P=0;if(!a.Gd&&(a.P=(a.J*a.Wa>>3)*a.ba,!zb(a.u,a.Va,a.P,3)))return!1;a.P?(a.jc=a.I.createImageData(b,c),a.mc=16/a.Wa|0,me(a,a.P>>1)):me(a,(a.ca+1)*a.wa);a.L=document.createElement("canvas");a.L.width=b;a.L.height=c;a.ob=a.L.getContext("2d");a.fa={};a.qa=1<<a.Wa;a.ha=Array(a.qa+2);a.ha[0]=[0,0,0,255];a.ha[1]=[255,255,255,255];1==a.la&&(a.ha[a.qa+0]=[255,255,0,255],a.ha[a.qa+1]=[0,255,0,255]);2==a.la&&(a.oc=60,a.Ib=!1,
|
||||
a.Fa=Array(a.ca));return!0}he.prototype.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;Rd(this);if(this.K=vb(a,"Keyboard")){for(var e in this.Jb)this.K.oa("led",e,this.Jb[e]);this.M&&this.K.oa(this.Ld?"textarea":"canvas","kbd",this.ka)}var f=this;this.qc=Jc(this.b,function(){Mc(f)});Kc(this.b,this.qc,1E3/Math.max(this.pc,this.Xa));this.nc=0;this.ea||F(this)};
|
||||
function le(a,b,c,d){if(d)a.ja("Unable to load font ROM (error "+d+": "+b+")");else{db(a.Ab,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){w("Empty font ROM: "+b);return}if(1==f.length){w(f[0]);return}if(2048==f.length)a.za=f,Sd(a);else{a.ja("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ja("Font ROM data error: "+h.message);return}(a.I||a.H)&&F(a)}}
|
||||
function Sd(a){a.za&&(a.hc=2==a.la,a.fa[96]=[ne(a,a.ra,a.ma),ne(a,a.ra,a.ma,a.Ib)],a.fa[64]=[ne(a,2*a.ra,a.ma),ne(a,2*a.ra,a.ma,a.Ib)],a.fa[32]=a.fa[0]=[ne(a,2*a.ra,2*a.ma),ne(a,2*a.ra,2*a.ma,a.Ib)])}
|
||||
function ne(a,b,c,d){var e=8>=a.dc?8:16,f=8<e?15:0,h=a.za.length/e,g=!1===d,k={ra:b,ma:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var m=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,x=q;q<a.ma;q++)for(var u=p*e+(f+q&e-1),u=d&&8==q?255:a.za[u],r=0;r<c/a.ma;r++){for(var C=0,y=0,Y=y;y<a.ra;y++){for(var B=u&128>>(7<y?7:y),C=a.hc&&!B&&C?C:B,R=0;R<b/a.ra;R++)g&&(C=!C),oe(a,m,Y,x,C?1:0),Y++;C=B}x++}k.context.putImageData(m,
|
||||
(p&15)*b,(p>>4)*c)}return k}he.prototype.Ea=function(){return!0};he.prototype.oa=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Jb[b]=c,!0;switch(b){case "fullScreen":return this.N[b]=c,this.j&&this.j.gb?c.onclick=function(){d.gb()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
he.prototype.gb=function(){var a=!1;if(this.j){if(this.j.gb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.Y/this.O;b>c&&(a=Math.round(c/b*100)+"%")}this.ic?(this.M.style.width=a,this.M.style.width=a,this.M.style.display="block",this.M.style.margin="auto"):(this.j.style.width=a,this.j.style.height="auto");this.j.style.backgroundColor="black";this.j.gb();a=!0}this.ka&&this.ka.focus()}return a};
|
||||
function ke(a,b){!b&&a.j&&(a.ic?a.M.style.width=a.M.style.height="":a.j.style.width=a.j.style.height="");jb(a,"notifyFullScreen("+b+")")}function me(a,b){a.lc=b;a.ia=!1;if(void 0===a.G||a.G.length!=a.lc)a.G=Array(a.lc)}function oe(a,b,c,d,e){d=a.w?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.la&&(208<=c&&236>c?e=a.qa+0:28<=c&&72>c&&(e=a.qa+1));a=a.ha[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
|
||||
function Mc(a,b){var c=!0;if(!b){a.Xa&&(120==a.Xa?a.nc&1?(Hd(a.b,2),c=!1):Hd(a.b,1):Hd(a.b,4));if(c&&a.ia&&a.P){for(var d=a.u,e=a.P,f=!0,h=a.Va>>>d.sa;0<e&&h<d.X.length;)d.X[h].Na&&(d.X[h].Na=f=!1,d.X[h].vc=!0),e-=d.Ha,h++;f&&(c=!1)}Kc(a.b,a.qc,1E3/Math.max(a.pc,a.Xa));a.nc++}if(c)if(1<a.ra)switch(a.la){case 2:for(var c=a.Va,d=-1,e=0,f=60==a.oc?2:5,g=h=0,k=-1;e<a.wa;){var m=0,p=c,q=d,x=a.ca;for(96!=q&&(x>>=1);;){var u=Cb(a.u,p++);if(127==(u&127)){var r=Cb(a.u,p++),d=r&96,c=(r&15)<<8|Cb(a.u,p),c=c+
|
||||
(r&16?8192:16384);break}if(m<x)a.Fa[m++]=u;else break}if(f)f--;else{for(;m<a.Fa.length;)a.Fa[m++]=0;if(0<=q)for(p=a.ia&&a.G[h]==x,a.G[h++]=x,x=0;x<m;x++){u=a.Fa[x];if(!p||u!==a.G[h]){a.G[k=h]=u;var r=a,C=a.ob,y=u&127;if(u=r.fa[q][u&128?1:0]){var Y=(y&15)*u.ra,y=(y>>4)*u.ma,B=void 0,R=void 0,ca=void 0,Z=void 0,va=u.ra,Gb=u.ma;C?(B=x*r.ra,R=e*r.ma,ca=r.ra,Z=r.ma):(B=x*r.ec,R=e*r.fc,ca=r.ec,Z=r.fc);u.ra>r.ra&&(B*=2,ca*=2);u.ma>r.ma&&(0==q&&(y+=r.ma),Gb=r.ma);C?C.drawImage(u.canvas,Y,y,va,Gb,B,R,ca,Z):
|
||||
(B+=0,R+=0,r.I.drawImage(u.canvas,Y,y,va,Gb,B,R,ca,Z))}g++}h++}e++}}a.ia=!0;!b&&a.pb&&1==g&&(a.G[k]=-1,g=0);a.pb=!1;(g||b)&&a.ob&&a.I.drawImage(a.L,0,a.nb,a.J,a.ba-a.ma,0,0,a.Cc,a.Fd)}else{f=a.Va;h=f+a.P;m=k=g=0;c=a.J;q=0;d=a.ba;p=e=0;x=a.Wa;r=(1<<x)-1;a.Id&&(x=-x,p=16+x);for(;f<h;){C=Db(a.u,f);if(a.ia&&C===a.G[g])k+=a.mc;else{a.G[g]=C;(u=p)&&(C=C>>8|(C&255)<<8);k<c&&(c=k);for(Y=a.mc;Y--;)y=C>>u&r,oe(a,a.jc,k++,m,y),u+=x;k>q&&(q=k);m<d&&(d=m);m>=e&&(e=m+1)}f+=2;g++;if(k>=a.J&&(k=0,m++,m>a.ba))break}a.ia=
|
||||
!0;c<a.J&&(f=q-c,e-=d,a.w&&(h=c,g=f,c=d,f=e,d=a.J-(h+g),e=g),a.ob.putImageData(a.jc,0,0,c,d,f,e),a.I.drawImage(a.L,0,0,a.L.width,a.L.height,0,0,a.Y,a.O))}}
|
||||
Ma(function(){for(var a=D(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=A(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=ta().indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Va.aspect);f&&.3<=f&&3.33>=f&&(La("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");Aa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new he(d,e,h,f,c);hb(d,c)}});
|
||||
function pe(a){this.fa=+a.adapter;switch(this.fa){case 0:this.ha=0;this.ka=2;break;default:w("Unrecognized serial adapter #"+this.fa);return}this.j=this.w=null;this.ia=a.tabSize;this.ea=a.charBOL;this.D=0;this.ba=!1;z.call(this,"SerialPort",a,pe,8388608);var b=a.binding;if("console"==b)this.w="";else{var c;a=qe;b&&(void 0===c&&(c="Panel"),(c=gb(c,this.id))&&(b=c.N[b])&&this.oa(null,a,b))}this.G="";this.K=this.M=null;this.exports={connect:this.xc,receiveData:this.Ob}}bb(pe);
|
||||
var re=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],se=[!1,0,0,133,142,39,238],qe="buffer";l=pe.prototype;
|
||||
l.oa=function(a,b,c,d){var e=this;switch(b){case qe:return this.N[b]=this.j=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),te(e,b);return!0},c.onkeypress=function(a){a=a||window.event;te(e,a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.N[b]=c,d=d.replace(/\\e/g,String.fromCharCode(27)),c.onclick=function(){e.Ob(d);return!0},
|
||||
!0}return!1};l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;var e=this;this.qa=Jc(this.b,function(){e.Ob()});this.la=Jc(this.b,function(){e.Da|=5});this.I=vb(a,"ChipSet");Hb(b,this,ue,this.ha);Tb(b,this,ve,this.ha);F(this)};
|
||||
l.xc=function(){if(!this.K){var a=nc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ma(b[0]);if(c!=this.cb)return;b=ma(b[1]);if(this.K=fb(b)){var d=this.K.exports;if(d){var e=d.connect;e&&e.call(this.K);if(this.M=d.receiveData){this.status(this.Ab+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};l.Ea=function(a,b){if(!b)if(this.xc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
l.Ia=function(a){return a?this.save():!0};l.reset=function(){we(this)};l.save=function(){var a=new Uc(this),b=0,c=[];c[b++]=this.L;c[b++]=this.Y;c[b++]=this.ca;c[b++]=this.Da;c[b++]=this.J;c[b++]=this.P;c[b]=this.O;I(a,0,c);return a.data()};l.restore=function(a){return we(this,a[0])};function we(a,b){var c=0;void 0===b&&(b=se);a.L=b[c++];a.Y=b[c++];a.ca=b[c++];a.Da=b[c++];a.J=b[c++];a.P=b[c++];a.O=b[c];return!0}
|
||||
function xe(a,b){var c=a.O&b;b&15||(c>>=4);var c=re[c],d=((a.J&12)>>2)+6;a.J&16&&d++;d+=((a.J&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function te(a,b){jb(a,"receiveByte("+ba(b)+"), status="+ba(a.Da));return a.ba||a.Da&2?!1:(a.Y=b,a.Da|=2,Hd(a.b,a.ka),!0)}l.Ob=function(a){null!=a&&(this.G="number"!=typeof a?a:this.G+String.fromCharCode(a));this.G&&(te(this,this.G.charCodeAt(0))&&(this.G=this.G.substr(1)),this.G&&this.b&&Kc(this.b,this.qa,xe(this,15)));return!0};
|
||||
l.Nd=function(a,b){var c=this.Y;E(this,a,null,b,"DATA",c);this.Da&=-3;return c};l.Md=function(a,b){var c=this.Da;E(this,a,null,b,"STATUS",c);return c};
|
||||
l.Xd=function(a,b,c){E(this,a,b,c,"DATA");this.ca=b;this.Da&=-6;jb(this,"transmitByte("+ba(b)+")");if(19==b)this.ba=!0;else if(17==b)this.ba=!1;else if(this.M&&this.M.call(this.K,b),this.j)8==b?(this.j.value=this.j.value.slice(0,-1),0<this.D&&this.D--):(a=(a=na[b])?"<"+a+">":String.fromCharCode(b),c=a.length,9==b?(b=this.ia||8,c=b-this.D%b,this.ia&&(a=la("",c))):13==b&&(this.D=c=0,a="\n"),this.ea&&!this.D&&c&&(a=String.fromCharCode(this.ea)+a),this.j.value+=a,this.j.scrollTop=this.j.scrollHeight,
|
||||
this.D+=c);else if(null!=this.w){if(10==b||1024<=this.w.length)this.g(this.w),this.w="";10!=b&&(this.w+=String.fromCharCode(b))}this.b&&Kc(this.b,this.la,xe(this,240))};l.Wd=function(a,b,c){E(this,a,b,c,"CONTROL");this.L?(this.P=b,this.P&64&&(this.L=!1)):(this.J=b,this.L=!0)};l.Vd=function(a,b,c){E(this,a,b,c,"BAUDRATES");this.O=b};var ue={0:pe.prototype.Nd,1:pe.prototype.Md},ve={0:pe.prototype.Xd,1:pe.prototype.Wd,2:pe.prototype.Vd};
|
||||
Ma(function(){for(var a=D(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new pe(d);hb(d,c)}});function ye(a){z.call(this,"Debugger",a,ye);this.ba=this.la=this.J=0;this.P=!1;this.j=-1;this.w=[];this.ea={}}bb(ye);var ze={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
|
||||
function Ae(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
||||
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
|
||||
we.prototype.Db=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var h=a.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)b.push(ma(a.substring(d,f))),d=f+1}}return b};
|
||||
function ze(a,b,c){var d;if(b){b=Ae(a,b);for(var e=0,f=!1,h=b,g=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var p=m[e++],q=p.length,p=ma(p);if(!p){f=!0;break}p=Be(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==m.length)break;var p=m[e++],x=p.length;k.length&&xe[p]<xe[k[k.length-1]]&&ye(g,k,1);k.push(p);b=b.substr(q+x)}ye(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&Ce(a,null,
|
||||
d))}return d}function Ae(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=ze(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=De(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.Ra(d,0),d.re?8:4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.aa-a.la}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
|
||||
function Be(a,b,c,d){var e;void 0!==b?(e=Ee(b),0<=e?e=Fe(a,e):(e=a.da[b],void 0===e&&(e=aa(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function Ce(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,m=8,p="";void 0===m?m=32:32<m&&(m=32);if(null==k||isNaN(k))for(;0<m--;)p="?"+p;else for(;0<m--;)p=(k&1?"1":"0")+p,k>>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Ge(a,b){if(b)return Ce(a,b,a.da[b]);var c=0;for(b in a.da)Ce(a,b,a.da[b]),c++;return 0<c}
|
||||
function He(a){w.call(this,"Debugger",a,He);this.style=Ie;this.M=W();this.Sa=W();this.ba=W();this.G=[];this.H=this.O=this.D=[];Je(this);this.ha=0;Ke(this);this.va=[];Le(this,a.messages);this.ya=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return pc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return pc(b,a)})}z(He,we);
|
||||
var Me={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},
|
||||
Ie=8080,Ne="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),Oe="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),
|
||||
Pe="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),Qe=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,18963,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,18963,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,18963,
|
||||
ye.prototype.Eb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var h=a.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)b.push(ma(a.substring(d,f))),d=f+1}}return b};
|
||||
function Be(a,b,c){var d;if(b){b=Ce(a,b);for(var e=0,f=!1,h=b,g=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var p=m[e++],q=p.length,p=ma(p);if(!p){f=!0;break}p=De(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==m.length)break;var p=m[e++],x=p.length;k.length&&ze[p]<ze[k[k.length-1]]&&Ae(g,k,1);k.push(p);b=b.substr(q+x)}Ae(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&Ee(a,null,
|
||||
d))}return d}function Ce(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=Be(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?t(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=Fe(a,c[1]),b=b.replace("["+c[1]+"]",d?t(a.Sa(d,0),d.Xe?8:4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.ba-a.la}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
|
||||
function De(a,b,c,d){var e;void 0!==b?(e=Ge(b),0<=e?e=He(a,e):(e=a.ea[b],void 0===e&&(e=aa(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function Ee(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,m=8,p="";void 0===m?m=32:32<m&&(m=32);if(null==k||isNaN(k))for(;0<m--;)p="?"+p;else for(;0<m--;)p=(k&1?"1":"0")+p,k>>=1;h=p+"b"+h;d>>=8}d="0x"+t(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Ie(a,b){if(b)return Ee(a,b,a.ea[b]);var c=0;for(b in a.ea)Ee(a,b,a.ea[b]),c++;return 0<c}
|
||||
function Je(a){z.call(this,"Debugger",a,Je);this.style=Ke;this.M=W();this.Va=W();this.ca=W();this.G=[];this.I=this.O=this.D=[];Le(this);this.ia=0;Me(this);this.wa=[];Ne(this,a.messages);this.za=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return qc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return qc(b,a)})}bb(Je,ye);
|
||||
var Oe={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},
|
||||
Ke=8080,Pe="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),Qe="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),
|
||||
Re="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),Se=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,18963,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,18963,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,18963,
|
||||
2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617],[44,1617,32],[72],[45,32768],[21,18963,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,
|
||||
785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[26],[43,1617,1809],
|
||||
[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193,273],[3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66,
|
||||
18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193,785],[5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193,
|
||||
785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128],[62],[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[13,51],[7,32819],[77,
|
||||
18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19,18193,33],[65,128]];l=He.prototype;
|
||||
l.Oa=function(a,b,c,d){this.u=b;this.b=c;this.B=a;(a=mc(a,"messages"))&&Le(this,a);this.Ea=Qe;Od(this,64,function(a){a:{var b=d.u.Y,c=a[0],g=a=0,k=b.length;if(c){a=Re(De(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.u.ra;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;k--;){var p=b[g];p.type==c?m++||d.g("..."):(c=p.type,m=Ab[c],p&&d.g(n(p.id)+" %"+n(g<<d.u.ra)+" %%"+n(p.F)+" "+t(p.wb)+" "+
|
||||
t(p.size)+" "+m),c!=Zb&&(c=-1),m=0);a+=d.u.Ga;g++}}});F(this)};
|
||||
l.oa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ga=this.N[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",pc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.j<d.w.length-1&&(b=d.w[++d.j]):40==a.keyCode&&(0<d.j?b=d.w[--d.j]:(b="",d.j=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.N[b]=c,Ca(c,function(){if(d.ga){var a=d.ga.value;d.ga.value=
|
||||
"";pc(d,a,!0);return!0}return!1}),!0;case "step":return this.N[b]=c,Ca(c,function(a){var b=!1;lb(d,!0)||(kb(d,!0),b=d.jb(a?1:0),kb(d,!1));return b}),!0}return!1};l.vb=function(){this.ga&&this.ga.focus()};function Re(a){a=a&&a.F;null==a&&(a=-1);return a}l.$=function(a,b){var c=255,d=Re(a);-1!==d&&(c=Bb(this.u,d),b&&Se(a,b));return c};l.Ra=function(a,b){var c=65535,d=Re(a);-1!==d&&(c=Cb(this.u,d),b&&Se(a,b));return c};l.ua=function(a,b,c){var d=Re(a);-1!==d&&(Db(this.u,d,b),c&&Se(a,c),qc(this.b,!0))};
|
||||
l.Gb=function(a,b,c){var d=Re(a);if(-1!==d){var e=this.u,f=d&e.u,h=(d&e.w)>>>e.ra;f!=e.u?e.Y[h].Qb(f,b&65535,d):(e.Y[h++].xb(f,b&255,d),e.Y[h&e.K].xb(0,b>>8&255,d+1));c&&Se(a,c);qc(this.b,!0)}};function W(a){return{F:a,Na:!1}}function Te(a){return[a.F,a.Na]}function Ue(a){return{F:a[0],Na:a[1]}}
|
||||
function De(a,b,c){var d;c=(c?a.M:a.Sa).F;if(void 0!==b){d=b=Ae(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var f=a.G[c].Pa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=W(d));break}}if(d=e)return d;c=ze(a,b,void 0)}null!=c&&(d=W(c));return d}function Ve(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.ed=a.Db(b.tc=c[2]))}function Se(a,b){null!=a.F&&(a.F+=b||1)}function Z(a){return n(a,4)}
|
||||
function uf(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.$(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function Le(a,b){a.I=a;a.sa=a.fd=536870912;a.ia=null;a.ka=[];var c=a.Db(b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in sb)0<=ra(c,d)&&(a.sa|=sb[d],a.g(d+" messages enabled"))}function Od(a,b,c){for(var d in sb)if(b==sb[d]){a.va[d]=c;break}}
|
||||
function Ee(a,b){var c;a=a.toUpperCase();null==b?c=ra(Pe,a):(c=ra(Pe,a.substr(b,2)),0>c&&(c=ra(Pe,a.substr(b,1))));return c}function vf(a,b){var c=0,d=Fe(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?n(d,c):"??"}
|
||||
function Fe(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.i;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Uc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Wc(d);break;case 4:c=d.W;break;case 5:c=d.Z;break;case 10:c=J(d);break;case 6:c=d.$(J(d));break;case 11:c=d.na;break;case 12:c=d.R;break;case 13:c=Sc(d);break;case 14:c=Sc(d)&255|d.i<<8}}return c}
|
||||
function wf(a,b){b=Ae(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Ee(b,c+1),0<=e&&(b=b.substr(0,c)+vf(a,e)+b.substr(c+1+Pe[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=aa(e),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=De(a,e))?(d=e+' "'+uf(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=De(a,e))?(Se(d),d=e+' "'+
|
||||
uf(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}l.message=function(a,b){b&&(a+=" at "+Z(W(this.b.R).F));if(this.sa&1073741824)this.ka.push(a);else if(!this.ia||a!=this.ia)if(this.ia=a,this.sa&-2147483648&&(this.pa(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;Kc(c);c.P=0;qc(c)}};
|
||||
function hb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.sa&g)!=g||a.message(b.Xa+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?","+da(d):"")+")"+(null!=h?": "+da(h):"")+(null!=e?" at "+Z(e):""))}
|
||||
function Ke(a){var b;if(Hd(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=W();a.ea=0;a.g("instruction history buffer allocated")}if(!a.K||!a.K.length)for(a.K=Array(256),b=0;b<a.K.length;b++)a.K[b]=[b,0]}else a.L&&a.L.length&&a.g("instruction history buffer freed"),a.ea=0,a.L=[],a.K=[]}l.bb=function(a){if(!xf(this))return!1;this.b.bb(a);return!0};
|
||||
l.jb=function(a,b,c){if(!xf(this))return!1;this.J=0;a||Hd(this)&&Id(this,this.b.R,0);try{var d=this.b.jb(a);0<d&&(this.J+=d,Gc(this.b,d,!0),Dc(this.b,d),this.aa++)}catch(e){"number"!=typeof e&&(this.J=0,pb(this.b,e.stack||e.message))}!1!==c&&qc(this.b);this.Ia(b||!1);return 0<this.J};l.pa=function(a){this.b&&this.b.pa(a)};l.Ia=function(a){void 0===a&&(a=!0);this.M=W(this.b.R);a&&1!=this.X?yf(this):zf(this)};
|
||||
function xf(a){var b;if(b=a.b&&mb(a.b))b=a.b,b.C.wa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!lb(a.b)?(a=a.b,a.C.error?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}l.Da=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};l.Ha=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};l.reset=function(a){Ke(this);this.aa=this.la=0;this.ia=null;this.J=0;this.M=W(this.b.R);this.C.za=!1;Af(this);a||this.Ia()};
|
||||
l.save=function(){var a=new Tc(this);I(a,0,Te(this.M));I(a,1,Te(this.ba));I(a,2,[this.w,this.P,this.sa]);I(a,3,this.G);return a.data()};l.restore=function(a){var b=0;void 0!==a[2]&&(this.M=Ue(a[b++]),this.ba=Ue(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.P=a[b][1],this.sa|=a[b][2]);a[3]&&(this.G=a[3]);return!0};l.start=function(a,b){this.X||this.g("running");this.C.za=!0;this.ob=a;this.pb=b};
|
||||
l.stop=function(a,b){if(this.C.za){this.C.za=!1;this.J=b-this.pb;if(!this.X){var c="stopped";if(this.J){var d=a-this.ob,e=0<d?Math.round(1E3*this.J/d):0,c=c+" (";Hd(this)&&(c+=this.aa+" opcodes, ",this.la-=this.aa,this.aa=0);c+=this.J+" cycles, "+d+" ms, "+e+" hz)"}else jb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ia(!0);this.vb();Af(this,this.b.R)}};function Hd(a){return 1<a.H.length||!!a.ha}
|
||||
function Id(a,b,c){var d=a.b;if(0<c&&(a.ha&&!--a.ha||hc(a,b,1,a.H)))return!0;0<=c&&a.K.length&&(a.aa++,b=Bb(a.u,b),null!=b&&(a.K[b][1]++,b=a.L[a.ea],b.F=d.R,b.Na=!1,++a.ea==a.L.length&&(a.ea=0)));return!1}function Ib(a,b,c){a.g("break on input from port "+t(b)+": "+n(c));a.pa(!0)}function Ub(a,b,c){a.g("break on output to port "+t(b)+": "+n(c));a.pa(!0)}
|
||||
function Je(a){var b,c;a.H=["bp"];if(void 0!==a.O)for(b=1;b<a.O.length;b++){c=a.O[b];var d=a.u;ic(d.Y[Re(c)>>>d.ra],!1)}a.O=["br"];if(void 0!==a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.u,ic(d.Y[Re(c)>>>d.ra],!0);a.D=["bw"];a.Za=0}l.Ya=function(a,b,c){var d=!0;c||Bf(this,a,b,!1,!0);if(a!=this.H){var e=Re(b);if(-1===e)this.g("invalid address: "+Z(b.F)),d=!1;else{var f=this.u;f.Y[e>>>f.ra].Ya(e&f.u,a==this.D)}}d&&(a.push(b),c?b.Na=!0:(Cf(this,a,a.length-1,"set"),Ke(this)));return d};
|
||||
function Bf(a,b,c,d,e){var f=!1;c=Re(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==Re(g)&&(!d||g.Na)){f=!0;g.Na||e||Cf(a,b,h,"cleared");b.splice(h,1);b!=a.H&&(d=a.u,ic(d.Y[c>>>d.ra],b==a.D));g.Na||Ke(a);break}}return f}function Df(a,b){for(var c=1;c<b.length;c++)Cf(a,b,c);return b.length-1}function Cf(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.F)+(d?" "+d:c.tc?' "'+c.tc+'"':""))}
|
||||
function Af(a,b){if(void 0!==b)hc(a,b,1,a.H,!0),a.X=0;else for(var c=1;c<a.H.length;c++){var d=a.H[c];if(d.Na){if(!Bf(a,a.H,d,!0))break;c=0}}}
|
||||
function hc(a,b,c,d,e){var f=!1;if(!a.Za++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Na)for(var k=Re(g),m=0;m<c;m++)if(b+m==k){var p,f=!0;g.Na&&(Bf(a,d,g,!0),e=!0);if(p=g.ed){for(var f=!1,q=0;q<p.length;q++)if(!Ef(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var x=q+1;x<p.length&&p[x].indexOf("else");x++)q++;if(x==p.length){f=!0;break}}a.b.C.za||(f=!0)}if(f){e||Cf(a,d,h,"hit");break}}}a.Za--;return f}
|
||||
function Ff(a,b,c,d){for(var e=W(b.F),f=a.$(b,1),h=a.Ea[f],g="",k=(8086!=a.style?Ne:Oe)[h[0]],m=h.length-1,p=0,q,x=1;x<=m;x++){var u="";q=h[x];if(void 0!==q&&!(q&16384&&a.style==Ie)){var r=q&240;if(r){var B=q&15;B?p=B:q|=p;q&61440||(q|=1==x?8192:4096);if(r&32)a:{var u=a,r=q,B=b,y=" ";switch(r&15){case 1:y=n(u.$(B,1),2);break;case 2:y=n(u.$(B,1)<<24>>24,4);break;case 3:y=n(u.Ra(B,2),4);break;default:u="imm("+t(r)+")";break a}8086==u.style&&r&64?y="["+y+"]":r&16||(y=(u.style==Ie?"$":"0x")+y);u=y}else r&
|
||||
16?(u=(q&3840)>>8,r=Pe[u],8086==a.style&&q&64&&(6==u&&(r="HL"),r="["+r+"]"),u=r):r&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0<g.length&&(g+=",");g+=u||"???"}}}f="";h=Z(e.F)+" ";if(-1!==e.F&&-1!==b.F){do if(f+=n(a.$(e,1),2),null==e.F)break;while(e.F!=b.F)}h+=la(f,10);h=h+(q&32768?"*":" ")+la(k,7);g&&(h+=" "+g);c&&(h=la(h,40)+";"+c,h=a.b.C.eb?h+("cycles="+Ec(a.b).toString()+" cs="+n(a.b.rb)):h+(null!=d?"="+d.toString():""));return h}
|
||||
function Gf(a,b){var c;switch(b){case "IF":c=a.b.ta&512;break;case "SF":c=dd(a.b);break;case "ZF":c=cd(a.b);break;case "AF":c=bd(a.b);break;case "PF":c=ad(a.b);break;case "CF":c=Zc(a.b);break;default:c=0}return b.charAt(0)+(c?"1":"0")+" "}function Hf(a,b){return Pe[b]+"="+vf(a,b)+" "}function If(a){return Hf(a,7)+Hf(a,8)+Hf(a,9)+Hf(a,10)+Hf(a,11)+Gf(a,"IF")+Gf(a,"SF")+Gf(a,"ZF")+Gf(a,"AF")+Gf(a,"PF")+Gf(a,"CF")}l.bc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Jf(a,b,c){var d=[],e=Re(b)>>>0;for(b=0;b<a.G.length;b++){var f=a.G[b],h=f.F>>>0,g=f.qd;if(e>=h&&e<h+g){e=oa(f.ac,[e-h],a.bc);0<=e?Kf(a,b,e,d):c&&(e=~e,Kf(a,b,e-1,d),Kf(a,b,e,d));break}}return d}function Kf(a,b,c,d){var e={},f=a.G[b].ac,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.G[b].Pa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
|
||||
function Lf(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.K)if("clear"==b){for(c=0;c<a.K.length;c++)a.K[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.K.slice();e.sort(function(a,b){return b[1]-a[1]});var f=8086!=a.style?Ne:Oe;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Ea[h][0]]+" ").substr(0,5)+" ("+da(h)+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
|
||||
function Mf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Ge(a)||a.g("no variables"),!0;if(!c[2])return Ge(a,c[1]);if(!c[3])return delete a.da[c[1]],!0;var d=ze(a,c[3]);return void 0!==d?(a.da[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Nf(a,b,c){var d=null;if(b=De(a,b,!0)){var e=Jf(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.F-e[1])&&(h=" + "+t(f)),f=e[0]+" ("+Z(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.F)&&(h=" - "+t(f)),f=e[4]+" ("+Z(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
|
||||
function Of(a,b){switch(b[1]){case "8080":a.style=Ie;break;case "8086":a.style=8086;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.gb=c;break;case "start":a.b.sb=c;break;case "stop":a.b.hb=c;break;default:a.g("unknown cs option");return}void 0!==c&&oc(a.b);a.g("checksums "+(a.b.C.eb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Fc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.ab.toFixed(2)+"Mhz")+" ("+
|
||||
a.b.Qa+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.style+"-style mnemonics enabled")}
|
||||
function yf(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=ze(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.i=g&255;break;case "B":d.S=g&255;break;case "BC":d.S=g>>8&255;case "C":d.T=g&255;break;case "D":d.U=
|
||||
g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Z=g&255;break;case "SP":d.na=g&65535;break;case "PC":H(d,g);a.M=W(d.R);break;case "PS":Qc(d,g);break;case "PSW":Qc(d,g&255|d.ta&-256);d.i=g>>8;break;case "CF":d.ca=g?d.ca|256:d.ca&255;break;case "PF":g?ad(d)||(d.fa^=1):ad(d)&&(d.fa^=1);break;case "AF":d.xa=g?~d.fa&16|d.xa&-17:d.fa&16|d.xa&-17;break;case "ZF":d.ca=g?d.ca&-256:d.ca|255;break;case "SF":g?dd(d)||(d.fa^=192):dd(d)&&(d.fa^=
|
||||
192);break;case "IF":d.ta=g?d.ta|512:d.ta&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}qc(d);a.g("updated registers:")}a.g(If(a));c&&(a.M=W(d.R),zf(a,Z(a.M.F)))}}function Pf(a,b){b=ma(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(wf(a,c[2])):ze(a,b,!0)}function Qf(a,b,c){var d="t"!=b;c=Be(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ba(c,function(){return kb(a,!0)&&a.jb(e,d,!1)},function(){qc(a.b);kb(a,!1)})}
|
||||
function zf(a,b,c,d){if(b=De(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=De(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=lb(a,!1)||a.X?a.J:null;var h=null!=f?"cycles":null,g=Jf(a,b),k=b.F;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var m=g[0]+":";g[2]&&(m+=" "+g[2]);a.g(m)}g[3]&&(h=g[3],f=null);f=Ff(a,b,h,f);a.g(f);a.M=b;e-=b.F-k;c++}}}
|
||||
l.Db=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var h=a.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)b.push(ma(a.substring(d,f))),d=f+1}}return b};
|
||||
function Ef(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.P&&(a.g("ended assemble at "+Z(a.ba.F)),a.M=a.ba,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(mb(a)&&0<b.length){a.P&&(b="a "+Z(a.ba.F)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var m=h.charAt(k);if("?"==g||"r"==g||"a">m||"z"<m){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=De(a,f[1],!0);if(p)if(a.ba=
|
||||
p,void 0===f[2])a.g("begin assemble at "+Z(p.F)),a.P=!0,qc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var x=0;x<q.length;x++)a.ua(p,q[x],1);a.g(Ff(a,a.ba))}}break;case "b":a:{var u=f[0],r=f[1],B=b;if("?"==r)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),a.g("\tbc [a]\tclear breakpoint at addr [a]"),
|
||||
a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var y=u.charAt(1);if("l"==y){var X=0,X=X+Df(a,a.H),X=X+Df(a,a.O);(X+=Df(a,a.D))||a.g("no breakpoints")}else if("n"==y)a.ha=Be(a,r),a.g("break after "+a.ha+" instruction(s)");else if(void 0===r)a.g("missing breakpoint address");else{var A=W();if("*"!=r&&(A=De(a,r,!0),!A))break a;r=t(A.F);"c"==y?null==A.F?(Je(a),a.g("all breakpoints cleared")):Bf(a,a.H,A)||Bf(a,a.O,A)||Bf(a,a.D,A)||a.g("breakpoint missing: "+Z(A.F)):
|
||||
"i"==y?a.g("breakpoint "+(Eb(a.u,A.F)?"enabled":"cleared")+": port "+r+" (input)"):"o"==y?a.g("breakpoint "+(Rb(a.u,A.F)?"enabled":"cleared")+": port "+r+" (output)"):null!=A.F&&(Ve(a,A,B),"p"==y?a.Ya(a.H,A):"r"==y?a.Ya(a.O,A):"w"==y?a.Ya(a.D,A):a.g("unknown breakpoint command: "+y))}}}break;case "c":a.Fa&&(a.Fa.value="");break;case "d":a:{var Q,ba=f[0],Y=f[1],ua=f[2],Fb=f[3];if("?"==Y){var Fa="";for(Q in sb)a.va[Q]&&(Fa&&(Fa+=","),Fa+=Q);Fa+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");
|
||||
a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Fa.length&&a.g("dump extension commands:\n\t"+Fa)}else if("state"==Y){var We=Rf(a.B,!0);"console"==ua?console.log(We):(a.Fa&&(a.Fa.value=""),a.g(We))}else if("symbols"==Y)for(var ld=0;ld<a.G.length;ld++){var md=a.G[ld],nb;for(nb in md.Pa)if("."!=nb.charAt(0)){var Xe=md.Pa[nb].o;if(void 0!==Xe){var Ye=md.Pa[nb].l;Ye&&(nb=Ye);a.g(Z(Xe)+" "+nb)}}}else{if("d"==
|
||||
ba){for(Q in sb)if(f[1]==Q){var Ze=a.va[Q];Ze?(f.shift(),f.shift(),Ze(f)):a.g("no dump registered for "+Y);break a}Y||(ba=a.qb||"db")}else a.qb=ba;if("dh"==ba){var $e=Y,af=ua,bf="",cf=0,ca=a.ea,Ga=a.L;if(Ga.length){var ia=+$e||a.$a,ob=+af||10;isNaN(ia)?ia=ob:bf="more ";ia>Ga.length&&(a.g("note: only "+Ga.length+" available"),ia=Ga.length);ca-=ia;0>ca&&(null==Ga[Ga.length-1].F?(ia=ca+ia,ca=0):ca+=Ga.length);var nd=[];"call"==af&&(ob=1E5,nd=["CALL"]);for(void 0!==$e&&a.g(ia+" instructions earlier:");0<
|
||||
ob&&ca!=a.ea;){var df=Ga[ca++];if(null==df.F)break;var Jb=W(df.F),jg=ia--,ef=Ff(a,Jb,"history",jg);(!nd.length||0<=ef.indexOf(nd[0]))&&a.g(ef);Jb.Ib&&(ca+=Jb.Ib,ob-=Jb.Ib,ia-=Jb.Ib);ca>=Ga.length&&(ca=0);a.$a=ia;cf++;ob--}}cf||(a.g("no "+bf+"history available"),a.$a=void 0)}else{var rc=De(a,Y);if(rc){var sc=0;ua&&("l"==ua.charAt(0)&&(ua=ua.substr(1)||Fb),sc=Be(a,ua)>>>0,65536<sc&&(sc=65536));for(var Xa="",tc="dd"==ba?4:"dw"==ba?2:1,uc=tc*sc||128,kg=uc+15>>4||1;kg--&&0<uc;){var vc=0,od=0,Kb,Lb="",
|
||||
pd="",Y=Z(rc.F);for(Kb=16;0<Kb&&0<uc;Kb--){var wc=a.$(rc,1),vc=vc|wc<<(od++<<3);od==tc&&(Lb+=n(vc,2*tc),Lb+=1==tc?9==Kb?"-":" ":" ",vc=od=0);pd+=32<=wc&&128>wc?String.fromCharCode(wc):".";uc--}Xa&&(Xa+="\n");Xa+=Y+" "+Lb+(0==Kb?" "+pd:"")}Xa&&a.g(Xa);a.Sa=rc}}}}break;case "e":if("else"==f[0])break;var xc=1,ff=255,gf=a.$,hf=a.ua;"ew"==f[0]&&(xc=2,ff=65535,gf=a.Ra,hf=a.Gb);var jf=xc<<1,kf=f[1];if(null==kf)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");
|
||||
else{var yc=De(a,kf);if(yc)for(var zc=2;zc<f.length;zc++){var Mb=ze(a,f[zc]);if(void 0===Mb){a.g("unrecognized value: "+f[zc]);break}Mb&~ff&&a.g("warning: "+n(Mb)+" exceeds "+xc+"-byte value");var lg=gf.call(a,yc);a.g("changing "+Z(yc.F)+" from 0x"+n(lg,jf)+" to 0x"+n(Mb,jf));hf.call(a,yc,Mb,xc)}}break;case "f":Lf(a,f[1]);break;case "g":a:{var lf=f[1],mg=b;if(void 0!==lf){var qd=De(a,lf,!0);if(!qd)break a;Ve(a,qd,mg);a.Ya(a.H,qd,!0)}a.bb(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;
|
||||
case "h":a:{var rd;if(a.C.za)rd="halting",a.pa();else{if(lb(a,!0))break a;rd="already halted"}c||a.g(rd)}break;case "i":if("if"==f[0]){var sd;var Nb=b.substr(2),Nb=ma(Nb);ze(a,Nb)?(c||a.g("true: "+Nb),sd=!0):(c||a.g("false: "+Nb),sd=!1);sd||(d=!1);break}if("int"==f[0]){var Ac;var ng=f[1];if(a.b.ta&512){var td=ze(a,ng);null==td?Ac=!1:(a.g("requesting interrupt level "+td),Gd(a.b,td),Ac=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),Ac=!1;Ac||(d=!1);break}var ud=f[1];if(ud&&"?"!=ud){var vd=
|
||||
Be(a,ud);if(void 0!==vd){var og=Hb(a.u,vd);a.g(t(vd)+": "+da(og))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");break;case "k":var pg=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var wd=0,mf=W(),Ob=W(a.b.na);for(a.g("stack trace for "+Z(Ob.F));10>wd;){for(var Ya=null,qg=256;65536>Ob.F>>>0;){mf.F=a.Ra(Ob,2);if(null==Ob.F||!qg--)break;for(var rg=a,Bc=mf,nf=
|
||||
null,Pb=Bc.F,of=Pb,xd=1;6>=xd&&Pb;xd++){if(2<xd){Bc.F=Pb;var Cc=Ff(rg,Bc);if(0<=Cc.indexOf("CALL")){var pf=Cc.indexOf(" ");if(Pb+(Cc.indexOf(" ",pf+1)-pf-1)/2==of){nf=Cc;break}}}Pb--}Bc.F=of;if(Ya=nf)break}if(!Ya||null==Ya)break;var qf=null;if("ks"==pg){var rf=Ya.match(/[0-9A-F]+$/);rf&&(qf=Nf(a,rf[0]))}Ya=la(Ya,50)+" ;"+(qf||"stack="+Z(Ob.F));a.g(Ya);wd++}wd||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Nf(a,f[1],!0);break}break;case "m":a:{var Ha,Ia=null,N=f[1];"?"==N&&(N=void 0);
|
||||
if(void 0!==N){var Sa=0;if("all"==N)Sa=1878917119,N=null;else if("on"==N)Ia=!0,N=null;else if("off"==N)Ia=!1,N=null;else{"keys"==N&&(N="key");"kbd"==N&&(N="keyboard");for(Ha in sb)if(N==Ha){Sa=sb[Ha];Ia=!!(a.sa&Sa);break}if(!Sa){a.g("unknown message category: "+N);break a}}if(Sa)if("on"==f[2])a.sa|=Sa,Ia=!0;else if("off"==f[2]&&(a.sa&=~Sa,Ia=!1,1073741824==Sa)){for(var yd=0;yd<a.ka.length;yd++)a.g(a.ka[yd]);a.ka=[]}}var sg=0,Ta="";for(Ha in sb)if(!N||N==Ha){var tg=!!(a.sa&sb[Ha]);if(null===Ia||Ia==
|
||||
tg)Ta&&(Ta+=","),++sg%10||(Ta+="\n\t"),"key"==Ha&&(Ha="keys"),Ta+=Ha}void 0===N&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Ia?Ia?"messages on: ":"messages off: ":"message categories:\n\t")+(Ta||"none"));Ke(a)}break;case "o":var zd=f[1],ug=f[2];if(zd&&"?"!=zd){var Ad=Be(a,zd,"port #"),Bd=Be(a,ug);void 0!==Ad&&void 0!==Bd&&(Tb(a.u,Ad,Bd),a.g(t(Ad)+": "+da(Bd)))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),a.g("warning: port accesses can affect hardware state");
|
||||
break;case "p":if("print"==f[0]){Pf(a,b.substr(5));break}var sf="pr"==f[0]?1:0,vg=1+sf;if(a.X)a.g("step in progress");else{var Cd=W(a.b.R);switch(a.$(Cd)){case 205:a.X=vg,Se(Cd,3)}a.X?(a.Ya(a.H,Cd,!0),a.bb()||(a.B&&a.B.vb(),a.X=0)):Qf(a,sf?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}yf(a,f);break;case "s":Of(a,f);break;case "t":Qf(a,f[0],f[1]);break;case "u":zf(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Mf(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.30.0 ("+a.b.mc+",RELEASE"+
|
||||
(qb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(ta());break;case "?":if(f[1]){Pf(a,b.substr(1));break}var Qb="commands:",Dd;for(Dd in Me)Qb+="\n"+la(Dd,9)+Me[Dd];Hd(a)||(Qb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Qb);break;default:a.g("unknown command: "+b),d=!1}}}catch(tf){a.g("debugger error: "+(tf.stack||tf.message)),d=!1}return d}function pc(a,b,c){b=a.Db(b,c);for(var d in b)if(!Ef(a,b[d]))return!1;return!0}
|
||||
Ma(function(){for(var a=D(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new He(d);gb(d,c)}});
|
||||
function Sf(a,b,c){w.call(this,"Computer",a,Sf,67108864);this.C.wa=!1;Tf(this,b);this.O=mc(this,"autoPower",a);this.w=0;this.da=a.busWidth||a.buswidth;this.B=Uf;this.L=null;this.K=this.aa=!1;this.ea=mc(this,"url")||"";(Math.random()+.1).toString(36);this.j=Vf(this);if(this.b=fb("CPU",this.id)){this.I=fb("Debugger",this.id);this.G=[];for(b=null;b=ub(this,"Video",b);)this.G.push(b);this.u=new wb({id:this.Ab+".bus",busWidth:this.da},this.b,this.I);var d,e=db(this.id);if((this.H=fb("Panel",this.id))&&
|
||||
this.H.Fa)for(b=0;b<e.length;b++)d=e[b],d.ja=this.H.ja,d.g=this.H.g,d.Fa=this.H.Fa;this.g("PC8080 v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Oa&&d.Oa(this,this.u,this.b,this.I);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.J=d:this.B=parseInt(d,10));var f;if(a=mc(this,"state")||(f=!0,a.state))b=this.P=a,f||(this.K=!0,this.B=Uf),this.B&&(this.M=new Tc(this,"1.30.0"),Wf(this.M)?
|
||||
b=null:delete this.M);!b&&this.B&&(b=Xf(this))&&(this.K=!0);if(b){var h=this;sa(b,null,!0,function(a,b,c){c?(h.J=null,h.K=!1,h.ja("Unable to load machine state from server (error "+c+(b?": "+ma(b):"")+")")):(h.L=b,h.aa=!0);F(h)})}else F(this);this.N.power||(this.O=!0);!c&&this.O&&Yf(this,this.tb)}else v("Unable to find CPU component")}z(Sf);var Uf=0;function Tf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){v(d.message+" ("+c+")")}}a.ba=b}
|
||||
function mc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.ba&&(d=a.ba[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Yf(a,b,c){for(var d=db(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!mb(f)){mb(f,function(){Yf(a,b,c)});return}}b.call(a,c)}
|
||||
function Zf(a,b){var c=new Tc(a,"1.30.0","validate");if(Wf(c)&&$f(c)){var d=ag(c,"timestamp"),e=b?ag(b,"timestamp"):"unknown";d!=e&&(a.ja("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Sf.prototype;
|
||||
l.tb=function(a){void 0===a&&(a=this.B||(this.L?1:Uf));if(!this.w){this.w++;var b=!1,c=!1;this.X=!1;var d=this.M||new Tc(this,"1.30.0");if(-1==a)b=!0;else if(a>Uf){if(Wf(d,this.L)){this.D=new Tc(this,"1.30.0","failsafe");Wf(this.D)&&(bg(this,d),a=2,cg(this.D));I(this.D,"timestamp",qa());dg(this.D);var e=this.B&&!this.K;if(1==a||va("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=$f(d)){var f=ag(d,"code"),h=ag(d,"data");f&&("ok"==f?Wf(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(za("user",""),this.j=null)):this.g(f+": "+h),cg(d),Wf(d)?(c=$f(d),e=!0):c=!1))}e&&Zf(this,c?d:null)}else 2==a&&d.clear()}else Zf(this);delete this.L;delete this.M}e=db(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=eg(this,h,d,b,c));b=[d,a,c];-1!=a?Yf(this,this.dc,b):this.dc(b)}};
|
||||
function eg(a,b,c,d,e){if(!b.C.wa){b.C.wa=!0;if(b.Da){var f=null;e&&((f=ag(c,b.id))||(f=ag(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Da(f,d)&&f&&(v("Unable to restore state for "+b.type),a.P&&!a.aa?(c.clear(),a.B=Uf,window&&window.location.reload()):a.X=!0,b.Da(null),e=!1)}if(!d&&b.gc)for(a=b.gc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
l.dc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ga=!0;this.C.wa=!0;var d=this.N.power;d&&(d.textContent="Shutdown");this.b&&(eg(this,this.b,b,c,a),this.b.nb());this.X&&(bg(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.w=0};
|
||||
function bg(a,b){if(va("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.j||"",d=b.toString(),e={app:"PC8080",ver:"1.30.0"};e.url=a.ea;e.user=c;e.type="bug";e.data=d;sa("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function Rf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new Tc(a,"1.30.0"),h=new Tc(a,"1.30.0","validate"),g=qa();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.30.0");I(f,"url",window?window.location.href:null);I(f,"browser",ta());a.b&&a.b.Ha&&(c&&a.b.pa(),d=a.b.Ha(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.C.wa=!1,!1===d&&(e=null)));for(var g=db(a.id),k=0;k<g.length;k++){var m=g[k];m.C.wa&&(m.Ha&&(d=m.Ha(b,c),"object"===typeof d&&I(f,m.id,d)),c&&(m.C.wa=!1,!1===d&&(e=null)))}e&&
|
||||
(c?(g=d=!1,b?(a.j&&fg(a,a.j,f.toString()),dg(h)&&dg(f)||(e=null,d=g=!0)):a.B&&(d=!0,g=3==a.B),d&&f.clear(g)):e=f.toString());c&&(a.C.wa=!1,b=a.N.power)&&(b.textContent="Power");a.w=0;return e}l.reset=function(){this.u&&this.u.reset&&(ib(this,"Resetting "+this.u.type),this.u.reset());for(var a=db(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.u&&c.reset&&(ib(this,"Resetting "+c.type),c.reset())}};
|
||||
l.start=function(a,b){for(var c=db(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};l.stop=function(a,b){for(var c=db(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
l.oa=function(a,b,c){var d=this;switch(b){case "power":return this.N[b]=c,c.onclick=function(){d.w||(d.C.wa?Rf(d,!1,!0):Yf(d,d.tb))},!0;case "reset":return this.N[b]=c,c.onclick=function(){if(d.C.wa&&!d.w)if(d.B&&!d.J){var a=va("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Rf(d,a,!0);!a&&d.P?window&&window.location.reload():d.tb(Uf)}else d.reset(),d.b&&d.b.nb()},!0;case "save":if(ga()){c.parentNode.removeChild(c);break}this.N[b]=
|
||||
c;c.onclick=function(){var a=Vf(d,!0);if(a){var b=!!(d.B&&!d.J||d.P),c=Rf(d,b);b?fg(d,a,c):d.ja("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Vf(a,b){var c=a.j;c||(c=ya("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=gg(a,c))||a.ja("The user ID is invalid."))):b&&a.ja("Browser local storage is not available"));return c}
|
||||
function gg(a,b){a.j=null;var c=sa(ha()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(za("user",c.data),a.j=c.data)}catch(e){v(e.message+" ("+d+")")}return a.j}function Xf(a){var b=null;a.j&&(b=ha()+"/api/v1/user?req=load&user="+a.j+"&state="+hg(a,"1.30.0"));return b}
|
||||
function fg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=hg(a,"1.30.0");d.data=c;b=sa(ha()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ja("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ja(c),za("user",""),a.j=null)}}
|
||||
function ub(a,b,c){a=db(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}l.vb=function(a){if(this.G.length){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.G[0];d.ia&&d.ia.focus();!a&&window&&window.scrollTo(b,c)}};l.Ia=function(a){this.b&&this.b.Ia(a);this.H&&this.H.Ia(a)};
|
||||
Ma(function(){for(var a=D(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=D(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=C(f),h=new Sf(h,d,!0);gb(h,f);h.O&&Yf(h,h.tb)}});Da.show.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=fb("Computer",c.id))&&c.ga&&!c.C.wa&&c.tb(-1)}});
|
||||
Da.exit.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=fb("Computer",c.id))&&c.C.wa&&Rf(c,!(!c.B||c.J),!0)}});function Tc(a,b,c){this.id=a.id;this.key=hg(a,b,c);this.I=a.I;cg(this,a.Id)}function hg(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
Tc.prototype={constructor:Tc,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){cg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
|
||||
function cg(a,b){a[a.id]={};b&&I(a,"parms",b);a.b=!1}function dg(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(v("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function $f(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){v(c.message||c),b=!1}return b}function Wf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=ya(a.key))?(a[a.id]=b,a.b=!0):!1}function ag(a,b){return a[a.id][b]||null}function I(a,b,c){try{a[a.id][b]=c}catch(d){}}var ig=0;
|
||||
function wg(a,b,c,d,e,f){e("Loading "+a+"...");sa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):xg(g,a,b,c,d,e,f)})}
|
||||
function xg(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){cb(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PC8080$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?yg(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),
|
||||
18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19,18193,33],[65,128]];l=Je.prototype;
|
||||
l.Pa=function(a,b,c,d){this.u=b;this.b=c;this.B=a;(a=nc(a,"messages"))&&Ne(this,a);this.Fa=Se;Pd(this,64,function(a){a:{var b=d.u.X,c=a[0],g=a=0,k=b.length;if(c){a=Te(Fe(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.u.sa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;k--;){var p=b[g];p.type==c?m++||d.g("..."):(c=p.type,m=Bb[c],p&&d.g(t(p.id)+" %"+t(g<<d.u.sa)+" %%"+t(p.F)+" "+v(p.xb)+" "+
|
||||
v(p.size)+" "+m),c!=$b&&(c=-1),m=0);a+=d.u.Ha;g++}}});F(this)};
|
||||
l.oa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ha=this.N[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",qc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.j<d.w.length-1&&(b=d.w[++d.j])):40==a.keyCode&&(0<d.j?b=d.w[--d.j]:(b="",d.j=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.N[b]=c,Ca(c,function(){if(d.ha){var a=d.ha.value;
|
||||
d.ha.value="";qc(d,a,!0);return!0}return!1}),!0;case "step":return this.N[b]=c,Ca(c,function(a){var b=!1;mb(d,!0)||(lb(d,!0),b=d.kb(a?1:0),lb(d,!1));return b}),!0}return!1};l.wb=function(){this.ha&&this.ha.focus()};function Te(a){a=a&&a.F;null==a&&(a=-1);return a}l.aa=function(a,b){var c=255,d=Te(a);-1!==d&&(c=Cb(this.u,d),b&&Ue(a,b));return c};l.Sa=function(a,b){var c=65535,d=Te(a);-1!==d&&(c=Db(this.u,d),b&&Ue(a,b));return c};
|
||||
l.va=function(a,b,c){var d=Te(a);-1!==d&&(Eb(this.u,d,b),c&&Ue(a,c),rc(this.b,!0))};l.Hb=function(a,b,c){var d=Te(a);if(-1!==d){var e=this.u,f=d&e.u,h=(d&e.w)>>>e.sa;f!=e.u?e.X[h].Rb(f,b&65535,d):(e.X[h++].yb(f,b&255,d),e.X[h&e.K].yb(0,b>>8&255,d+1));c&&Ue(a,c);rc(this.b,!0)}};function W(a){return{F:a,Oa:!1}}function Ve(a){return[a.F,a.Oa]}function We(a){return{F:a[0],Oa:a[1]}}
|
||||
function Fe(a,b,c){var d;c=(c?a.M:a.Va).F;if(void 0!==b){d=b=Ce(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var f=a.G[c].Qa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=W(d));break}}if(d=e)return d;c=Be(a,b,void 0)}null!=c&&(d=W(c));return d}function Xe(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ed=a.Eb(b.Ac=c[2]))}function Ue(a,b){null!=a.F&&(a.F+=b||1)}function X(a){return t(a,4)}
|
||||
function wf(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.aa(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function Ne(a,b){a.H=a;a.ta=a.Hd=536870912;a.ka=null;a.qa=[];var c=a.Eb(b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in tb)0<=ra(c,d)&&(a.ta|=tb[d],a.g(d+" messages enabled"))}function Pd(a,b,c){for(var d in tb)if(b==tb[d]){a.wa[d]=c;break}}
|
||||
function Ge(a,b){var c;a=a.toUpperCase();null==b?c=ra(Re,a):(c=ra(Re,a.substr(b,2)),0>c&&(c=ra(Re,a.substr(b,1))));return c}function xf(a,b){var c=0,d=He(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?t(d,c):"??"}
|
||||
function He(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.i;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Vc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Xc(d);break;case 4:c=d.W;break;case 5:c=d.Z;break;case 10:c=J(d);break;case 6:c=d.aa(J(d));break;case 11:c=d.na;break;case 12:c=d.R;break;case 13:c=Tc(d);break;case 14:c=Tc(d)&255|d.i<<8}}return c}
|
||||
function yf(a,b){b=Ce(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Ge(b,c+1),0<=e&&(b=b.substr(0,c)+xf(a,e)+b.substr(c+1+Re[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=aa(e),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=Fe(a,e))?(d=e+' "'+wf(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=Fe(a,e))?(Ue(d),d=e+' "'+
|
||||
wf(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}l.message=function(a,b){b&&(a+=" at "+X(W(this.b.R).F));if(this.ta&1073741824)this.qa.push(a);else if(!this.ka||a!=this.ka)if(this.ka=a,this.ta&-2147483648&&(this.pa(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;Lc(c);c.P=0;rc(c)}};
|
||||
function ib(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.ta&g)!=g||a.message(b.cb+"."+(null!=d?"outPort":"inPort")+"("+v(c)+","+(f?f:"unknown")+(null!=d?","+ba(d):"")+")"+(null!=h?": "+ba(h):"")+(null!=e?" at "+X(e):""))}
|
||||
function Me(a){var b;if(Id(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=W();a.fa=0;a.g("instruction history buffer allocated")}if(!a.K||!a.K.length)for(a.K=Array(256),b=0;b<a.K.length;b++)a.K[b]=[b,0]}else a.L&&a.L.length&&a.g("instruction history buffer freed"),a.fa=0,a.L=[],a.K=[]}l.bb=function(a){if(!zf(this))return!1;this.b.bb(a);return!0};
|
||||
l.kb=function(a,b,c){if(!zf(this))return!1;this.J=0;a||Id(this)&&Jd(this,this.b.R,0);try{var d=this.b.kb(a);0<d&&(this.J+=d,Hc(this.b,d,!0),sc(this.b,d),this.ba++)}catch(e){"number"!=typeof e&&(this.J=0,qb(this.b,e.stack||e.message))}!1!==c&&rc(this.b);this.Ja(b||!1);return 0<this.J};l.pa=function(a){this.b&&this.b.pa(a)};l.Ja=function(a){void 0===a&&(a=!0);this.M=W(this.b.R);a&&1!=this.Y?Af(this):Bf(this)};
|
||||
function zf(a){var b;if(b=a.b&&nb(a.b))b=a.b,b.C.xa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!mb(a.b)?(a=a.b,a.C.error?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}l.Ea=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};l.Ia=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};l.reset=function(a){Me(this);this.ba=this.la=0;this.ka=null;this.J=0;this.M=W(this.b.R);this.C.Aa=!1;Cf(this);a||this.Ja()};
|
||||
l.save=function(){var a=new Uc(this);I(a,0,Ve(this.M));I(a,1,Ve(this.ca));I(a,2,[this.w,this.P,this.ta]);I(a,3,this.G);return a.data()};l.restore=function(a){var b=0;void 0!==a[2]&&(this.M=We(a[b++]),this.ca=We(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.P=a[b][1],this.ta|=a[b][2]);a[3]&&(this.G=a[3]);return!0};l.start=function(a,b){this.Y||this.g("running");this.C.Aa=!0;this.nb=a;this.ob=b};
|
||||
l.stop=function(a,b){if(this.C.Aa){this.C.Aa=!1;this.J=b-this.ob;if(!this.Y){var c="stopped";if(this.J){var d=a-this.nb,e=0<d?Math.round(1E3*this.J/d):0,c=c+" (";Id(this)&&(c+=this.ba+" opcodes, ",this.la-=this.ba,this.ba=0);c+=this.J+" cycles, "+d+" ms, "+e+" hz)"}else kb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ja(!0);this.wb();Cf(this,this.b.R)}};function Id(a){return 1<a.I.length||!!a.ia}
|
||||
function Jd(a,b,c){var d=a.b;if(0<c&&(a.ia&&!--a.ia||ic(a,b,1,a.I)))return!0;0<=c&&a.K.length&&(a.ba++,b=Cb(a.u,b),null!=b&&(a.K[b][1]++,b=a.L[a.fa],b.F=d.R,b.Oa=!1,++a.fa==a.L.length&&(a.fa=0)));return!1}function Jb(a,b,c){a.g("break on input from port "+v(b)+": "+t(c));a.pa(!0)}function Vb(a,b,c){a.g("break on output to port "+v(b)+": "+t(c));a.pa(!0)}
|
||||
function Le(a){var b,c;a.I=["bp"];if(void 0!==a.O)for(b=1;b<a.O.length;b++){c=a.O[b];var d=a.u;jc(d.X[Te(c)>>>d.sa],!1)}a.O=["br"];if(void 0!==a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.u,jc(d.X[Te(c)>>>d.sa],!0);a.D=["bw"];a.Wa=0}l.$a=function(a,b,c){var d=!0;c||Df(this,a,b,!1,!0);if(a!=this.I){var e=Te(b);if(-1===e)this.g("invalid address: "+X(b.F)),d=!1;else{var f=this.u;f.X[e>>>f.sa].$a(e&f.u,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(Ef(this,a,a.length-1,"set"),Me(this)));return d};
|
||||
function Df(a,b,c,d,e){var f=!1;c=Te(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==Te(g)&&(!d||g.Oa)){f=!0;g.Oa||e||Ef(a,b,h,"cleared");b.splice(h,1);b!=a.I&&(d=a.u,jc(d.X[c>>>d.sa],b==a.D));g.Oa||Me(a);break}}return f}function Ff(a,b){for(var c=1;c<b.length;c++)Ef(a,b,c);return b.length-1}function Ef(a,b,c,d){c=b[c];a.g(b[0]+" "+X(c.F)+(d?" "+d:c.Ac?' "'+c.Ac+'"':""))}
|
||||
function Cf(a,b){if(void 0!==b)ic(a,b,1,a.I,!0),a.Y=0;else for(var c=1;c<a.I.length;c++){var d=a.I[c];if(d.Oa){if(!Df(a,a.I,d,!0))break;c=0}}}
|
||||
function ic(a,b,c,d,e){var f=!1;if(!a.Wa++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Oa)for(var k=Te(g),m=0;m<c;m++)if(b+m==k){var p,f=!0;g.Oa&&(Df(a,d,g,!0),e=!0);if(p=g.Ed){for(var f=!1,q=0;q<p.length;q++)if(!Gf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var x=q+1;x<p.length&&p[x].indexOf("else");x++)q++;if(x==p.length){f=!0;break}}a.b.C.Aa||(f=!0)}if(f){e||Ef(a,d,h,"hit");break}}}a.Wa--;return f}
|
||||
function Hf(a,b,c,d){for(var e=W(b.F),f=a.aa(b,1),h=a.Fa[f],g="",k=(8086!=a.style?Pe:Qe)[h[0]],m=h.length-1,p=0,q,x=1;x<=m;x++){var u="";q=h[x];if(void 0!==q&&!(q&16384&&a.style==Ke)){var r=q&240;if(r){var C=q&15;C?p=C:q|=p;q&61440||(q|=1==x?8192:4096);if(r&32)a:{var u=a,r=q,C=b,y=" ";switch(r&15){case 1:y=t(u.aa(C,1),2);break;case 2:y=t(u.aa(C,1)<<24>>24,4);break;case 3:y=t(u.Sa(C,2),4);break;default:u="imm("+v(r)+")";break a}8086==u.style&&r&64?y="["+y+"]":r&16||(y=(u.style==Ke?"$":"0x")+y);u=y}else r&
|
||||
16?(u=(q&3840)>>8,r=Re[u],8086==a.style&&q&64&&(6==u&&(r="HL"),r="["+r+"]"),u=r):r&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0<g.length&&(g+=",");g+=u||"???"}}}f="";h=X(e.F)+" ";if(-1!==e.F&&-1!==b.F){do if(f+=t(a.aa(e,1),2),null==e.F)break;while(e.F!=b.F)}h+=la(f,10);h=h+(q&32768?"*":" ")+la(k,7);g&&(h+=" "+g);c&&(h=la(h,40)+";"+c,h=a.b.C.fb?h+("cycles="+Fc(a.b).toString()+" cs="+t(a.b.sb)):h+(null!=d?"="+d.toString():""));return h}
|
||||
function If(a,b){var c;switch(b){case "IF":c=a.b.ua&512;break;case "SF":c=ed(a.b);break;case "ZF":c=dd(a.b);break;case "AF":c=cd(a.b);break;case "PF":c=bd(a.b);break;case "CF":c=$c(a.b);break;default:c=0}return b.charAt(0)+(c?"1":"0")+" "}function Jf(a,b){return Re[b]+"="+xf(a,b)+" "}function Kf(a){return Jf(a,7)+Jf(a,8)+Jf(a,9)+Jf(a,10)+Jf(a,11)+If(a,"IF")+If(a,"SF")+If(a,"ZF")+If(a,"AF")+If(a,"PF")+If(a,"CF")}l.sc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Lf(a,b,c){var d=[],e=Te(b)>>>0;for(b=0;b<a.G.length;b++){var f=a.G[b],h=f.F>>>0,g=f.Ud;if(e>=h&&e<h+g){e=oa(f.rc,[e-h],a.sc);0<=e?Mf(a,b,e,d):c&&(e=~e,Mf(a,b,e-1,d),Mf(a,b,e,d));break}}return d}function Mf(a,b,c,d){var e={},f=a.G[b].rc,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.G[b].Qa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
|
||||
function Nf(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.K)if("clear"==b){for(c=0;c<a.K.length;c++)a.K[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.K.slice();e.sort(function(a,b){return b[1]-a[1]});var f=8086!=a.style?Pe:Qe;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Fa[h][0]]+" ").substr(0,5)+" ("+ba(h)+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
|
||||
function Of(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Ie(a)||a.g("no variables"),!0;if(!c[2])return Ie(a,c[1]);if(!c[3])return delete a.ea[c[1]],!0;var d=Be(a,c[3]);return void 0!==d?(a.ea[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Pf(a,b,c){var d=null;if(b=Fe(a,b,!0)){var e=Lf(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.F-e[1])&&(h=" + "+v(f)),f=e[0]+" ("+X(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.F)&&(h=" - "+v(f)),f=e[4]+" ("+X(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
|
||||
function Qf(a,b){switch(b[1]){case "8080":a.style=Ke;break;case "8086":a.style=8086;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.hb=c;break;case "start":a.b.tb=c;break;case "stop":a.b.ib=c;break;default:a.g("unknown cs option");return}void 0!==c&&pc(a.b);a.g("checksums "+(a.b.C.fb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Gc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.ab.toFixed(2)+"Mhz")+" ("+
|
||||
a.b.Ra+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.style+"-style mnemonics enabled")}
|
||||
function Af(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=Be(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.i=g&255;break;case "B":d.S=g&255;break;case "BC":d.S=g>>8&255;case "C":d.T=g&255;break;case "D":d.U=
|
||||
g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Z=g&255;break;case "SP":d.na=g&65535;break;case "PC":H(d,g);a.M=W(d.R);break;case "PS":Rc(d,g);break;case "PSW":Rc(d,g&255|d.ua&-256);d.i=g>>8;break;case "CF":d.da=g?d.da|256:d.da&255;break;case "PF":g?bd(d)||(d.ga^=1):bd(d)&&(d.ga^=1);break;case "AF":d.ya=g?~d.ga&16|d.ya&-17:d.ga&16|d.ya&-17;break;case "ZF":d.da=g?d.da&-256:d.da|255;break;case "SF":g?ed(d)||(d.ga^=192):ed(d)&&(d.ga^=
|
||||
192);break;case "IF":d.ua=g?d.ua|512:d.ua&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}rc(d);a.g("updated registers:")}a.g(Kf(a));c&&(a.M=W(d.R),Bf(a,X(a.M.F)))}}function Rf(a,b){b=ma(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(yf(a,c[2])):Be(a,b,!0)}function Sf(a,b,c){var d="t"!=b;c=De(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ba(c,function(){return lb(a,!0)&&a.kb(e,d,!1)},function(){rc(a.b);lb(a,!1)})}
|
||||
function Bf(a,b,c,d){if(b=Fe(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Fe(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=mb(a,!1)||a.Y?a.J:null;var h=null!=f?"cycles":null,g=Lf(a,b),k=b.F;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var m=g[0]+":";g[2]&&(m+=" "+g[2]);a.g(m)}g[3]&&(h=g[3],f=null);f=Hf(a,b,h,f);a.g(f);a.M=b;e-=b.F-k;c++}}}
|
||||
l.Eb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var h=a.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)b.push(ma(a.substring(d,f))),d=f+1}}return b};
|
||||
function Gf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.P&&(a.g("ended assemble at "+X(a.ca.F)),a.M=a.ca,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ka=null;if(nb(a)&&0<b.length){a.P&&(b="a "+X(a.ca.F)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var m=h.charAt(k);if("?"==g||"r"==g||"a">m||"z"<m){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=Fe(a,f[1],!0);if(p)if(a.ca=
|
||||
p,void 0===f[2])a.g("begin assemble at "+X(p.F)),a.P=!0,rc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var x=0;x<q.length;x++)a.va(p,q[x],1);a.g(Hf(a,a.ca))}}break;case "b":a:{var u=f[0],r=f[1],C=b;if("?"==r)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),a.g("\tbc [a]\tclear breakpoint at addr [a]"),
|
||||
a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var y=u.charAt(1);if("l"==y){var Y=0,Y=Y+Ff(a,a.I),Y=Y+Ff(a,a.O);(Y+=Ff(a,a.D))||a.g("no breakpoints")}else if("n"==y)a.ia=De(a,r),a.g("break after "+a.ia+" instruction(s)");else if(void 0===r)a.g("missing breakpoint address");else{var B=W();if("*"!=r&&(B=Fe(a,r,!0),!B))break a;r=v(B.F);"c"==y?null==B.F?(Le(a),a.g("all breakpoints cleared")):Df(a,a.I,B)||Df(a,a.O,B)||Df(a,a.D,B)||a.g("breakpoint missing: "+X(B.F)):
|
||||
"i"==y?a.g("breakpoint "+(Fb(a.u,B.F)?"enabled":"cleared")+": port "+r+" (input)"):"o"==y?a.g("breakpoint "+(Sb(a.u,B.F)?"enabled":"cleared")+": port "+r+" (output)"):null!=B.F&&(Xe(a,B,C),"p"==y?a.$a(a.I,B):"r"==y?a.$a(a.O,B):"w"==y?a.$a(a.D,B):a.g("unknown breakpoint command: "+y))}}}break;case "c":a.Ga&&(a.Ga.value="");break;case "d":a:{var R,ca=f[0],Z=f[1],va=f[2],Gb=f[3];if("?"==Z){var Ga="";for(R in tb)a.wa[R]&&(Ga&&(Ga+=","),Ga+=R);Ga+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");
|
||||
a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Ga.length&&a.g("dump extension commands:\n\t"+Ga)}else if("state"==Z){var Ye=Tf(a.B,!0);"console"==va?console.log(Ye):(a.Ga&&(a.Ga.value=""),a.g(Ye))}else if("symbols"==Z)for(var nd=0;nd<a.G.length;nd++){var od=a.G[nd],ob;for(ob in od.Qa)if("."!=ob.charAt(0)){var Ze=od.Qa[ob].o;if(void 0!==Ze){var $e=od.Qa[ob].l;$e&&(ob=$e);a.g(X(Ze)+" "+ob)}}}else{if("d"==
|
||||
ca){for(R in tb)if(f[1]==R){var af=a.wa[R];af?(f.shift(),f.shift(),af(f)):a.g("no dump registered for "+Z);break a}Z||(ca=a.pb||"db")}else a.pb=ca;if("dh"==ca){var bf=Z,cf=va,df="",ef=0,da=a.fa,Ha=a.L;if(Ha.length){var ja=+bf||a.Xa,pb=+cf||10;isNaN(ja)?ja=pb:df="more ";ja>Ha.length&&(a.g("note: only "+Ha.length+" available"),ja=Ha.length);da-=ja;0>da&&(null==Ha[Ha.length-1].F?(ja=da+ja,da=0):da+=Ha.length);var pd=[];"call"==cf&&(pb=1E5,pd=["CALL"]);for(void 0!==bf&&a.g(ja+" instructions earlier:");0<
|
||||
pb&&da!=a.fa;){var ff=Ha[da++];if(null==ff.F)break;var Kb=W(ff.F),lg=ja--,gf=Hf(a,Kb,"history",lg);(!pd.length||0<=gf.indexOf(pd[0]))&&a.g(gf);Kb.Lb&&(da+=Kb.Lb,pb-=Kb.Lb,ja-=Kb.Lb);da>=Ha.length&&(da=0);a.Xa=ja;ef++;pb--}}ef||(a.g("no "+df+"history available"),a.Xa=void 0)}else{var tc=Fe(a,Z);if(tc){var uc=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||Gb),uc=De(a,va)>>>0,65536<uc&&(uc=65536));for(var Ya="",vc="dd"==ca?4:"dw"==ca?2:1,wc=vc*uc||128,mg=wc+15>>4||1;mg--&&0<wc;){var xc=0,qd=0,Lb,Mb="",
|
||||
rd="",Z=X(tc.F);for(Lb=16;0<Lb&&0<wc;Lb--){var yc=a.aa(tc,1),xc=xc|yc<<(qd++<<3);qd==vc&&(Mb+=t(xc,2*vc),Mb+=1==vc?9==Lb?"-":" ":" ",xc=qd=0);rd+=32<=yc&&128>yc?String.fromCharCode(yc):".";wc--}Ya&&(Ya+="\n");Ya+=Z+" "+Mb+(0==Lb?" "+rd:"")}Ya&&a.g(Ya);a.Va=tc}}}}break;case "e":if("else"==f[0])break;var zc=1,hf=255,jf=a.aa,kf=a.va;"ew"==f[0]&&(zc=2,hf=65535,jf=a.Sa,kf=a.Hb);var lf=zc<<1,mf=f[1];if(null==mf)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");
|
||||
else{var Ac=Fe(a,mf);if(Ac)for(var Bc=2;Bc<f.length;Bc++){var Nb=Be(a,f[Bc]);if(void 0===Nb){a.g("unrecognized value: "+f[Bc]);break}Nb&~hf&&a.g("warning: "+t(Nb)+" exceeds "+zc+"-byte value");var ng=jf.call(a,Ac);a.g("changing "+X(Ac.F)+" from 0x"+t(ng,lf)+" to 0x"+t(Nb,lf));kf.call(a,Ac,Nb,zc)}}break;case "f":Nf(a,f[1]);break;case "g":a:{var nf=f[1],og=b;if(void 0!==nf){var sd=Fe(a,nf,!0);if(!sd)break a;Xe(a,sd,og);a.$a(a.I,sd,!0)}a.bb(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;
|
||||
case "h":a:{var td;if(a.C.Aa)td="halting",a.pa();else{if(mb(a,!0))break a;td="already halted"}c||a.g(td)}break;case "i":if("if"==f[0]){var ud;var Ob=b.substr(2),Ob=ma(Ob);Be(a,Ob)?(c||a.g("true: "+Ob),ud=!0):(c||a.g("false: "+Ob),ud=!1);ud||(d=!1);break}if("int"==f[0]){var Cc;var pg=f[1];if(a.b.ua&512){var vd=Be(a,pg);null==vd?Cc=!1:(a.g("requesting interrupt level "+vd),Hd(a.b,vd),Cc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),Cc=!1;Cc||(d=!1);break}var wd=f[1];if(wd&&"?"!=wd){var xd=
|
||||
De(a,wd);if(void 0!==xd){var qg=Ib(a.u,xd);a.g(v(xd)+": "+ba(qg))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");break;case "k":var rg=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var yd=0,of=W(),Pb=W(a.b.na);for(a.g("stack trace for "+X(Pb.F));10>yd;){for(var Za=null,sg=256;65536>Pb.F>>>0;){of.F=a.Sa(Pb,2);if(null==Pb.F||!sg--)break;for(var tg=a,Dc=of,pf=
|
||||
null,Qb=Dc.F,qf=Qb,zd=1;6>=zd&&Qb;zd++){if(2<zd){Dc.F=Qb;var Ec=Hf(tg,Dc);if(0<=Ec.indexOf("CALL")){var rf=Ec.indexOf(" ");if(Qb+(Ec.indexOf(" ",rf+1)-rf-1)/2==qf){pf=Ec;break}}}Qb--}Dc.F=qf;if(Za=pf)break}if(!Za||null==Za)break;var sf=null;if("ks"==rg){var tf=Za.match(/[0-9A-F]+$/);tf&&(sf=Pf(a,tf[0]))}Za=la(Za,50)+" ;"+(sf||"stack="+X(Pb.F));a.g(Za);yd++}yd||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Pf(a,f[1],!0);break}break;case "m":a:{var Ia,Ja=null,O=f[1];"?"==O&&(O=void 0);
|
||||
if(void 0!==O){var Ta=0;if("all"==O)Ta=1878917119,O=null;else if("on"==O)Ja=!0,O=null;else if("off"==O)Ja=!1,O=null;else{"keys"==O&&(O="key");"kbd"==O&&(O="keyboard");for(Ia in tb)if(O==Ia){Ta=tb[Ia];Ja=!!(a.ta&Ta);break}if(!Ta){a.g("unknown message category: "+O);break a}}if(Ta)if("on"==f[2])a.ta|=Ta,Ja=!0;else if("off"==f[2]&&(a.ta&=~Ta,Ja=!1,1073741824==Ta)){for(var Ad=0;Ad<a.qa.length;Ad++)a.g(a.qa[Ad]);a.qa=[]}}var ug=0,Ua="";for(Ia in tb)if(!O||O==Ia){var vg=!!(a.ta&tb[Ia]);if(null===Ja||Ja==
|
||||
vg)Ua&&(Ua+=","),++ug%10||(Ua+="\n\t"),"key"==Ia&&(Ia="keys"),Ua+=Ia}void 0===O&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Ja?Ja?"messages on: ":"messages off: ":"message categories:\n\t")+(Ua||"none"));Me(a)}break;case "o":var Bd=f[1],wg=f[2];if(Bd&&"?"!=Bd){var Cd=De(a,Bd,"port #"),Dd=De(a,wg);void 0!==Cd&&void 0!==Dd&&(Ub(a.u,Cd,Dd),a.g(v(Cd)+": "+ba(Dd)))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),a.g("warning: port accesses can affect hardware state");
|
||||
break;case "p":if("print"==f[0]){Rf(a,b.substr(5));break}var uf="pr"==f[0]?1:0,xg=1+uf;if(a.Y)a.g("step in progress");else{var Ed=W(a.b.R);switch(a.aa(Ed)){case 205:a.Y=xg,Ue(Ed,3)}a.Y?(a.$a(a.I,Ed,!0),a.bb()||(a.B&&a.B.wb(),a.Y=0)):Sf(a,uf?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Af(a,f);break;case "s":Qf(a,f);break;case "t":Sf(a,f[0],f[1]);break;case "u":Bf(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Of(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.30.0 ("+a.b.yc+",RELEASE"+
|
||||
(rb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(ta());break;case "?":if(f[1]){Rf(a,b.substr(1));break}var Rb="commands:",Fd;for(Fd in Oe)Rb+="\n"+la(Fd,9)+Oe[Fd];Id(a)||(Rb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Rb);break;default:a.g("unknown command: "+b),d=!1}}}catch(vf){a.g("debugger error: "+(vf.stack||vf.message)),d=!1}return d}function qc(a,b,c){b=a.Eb(b,c);for(var d in b)if(!Gf(a,b[d]))return!1;return!0}
|
||||
Ma(function(){for(var a=D(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Je(d);hb(d,c)}});
|
||||
function Uf(a,b,c){z.call(this,"Computer",a,Uf,67108864);this.C.xa=!1;Vf(this,b);this.O=nc(this,"autoPower",a);this.w=0;this.ea=a.busWidth||a.buswidth;this.B=Wf;this.L=null;this.K=this.ba=!1;this.fa=nc(this,"url")||"";(Math.random()+.1).toString(36);this.j=Xf(this);if(this.b=gb("CPU",this.id)){this.H=gb("Debugger",this.id);this.G=[];for(b=null;b=vb(this,"Video",b);)this.G.push(b);this.u=new xb({id:this.Ab+".bus",busWidth:this.ea},this.b,this.H);var d,e=eb(this.id);if((this.I=gb("Panel",this.id))&&
|
||||
this.I.Ga)for(b=0;b<e.length;b++)d=e[b],d.ja=this.I.ja,d.g=this.I.g,d.Ga=this.I.Ga;this.g("PC8080 v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Pa&&d.Pa(this,this.u,this.b,this.H);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.J=d:this.B=parseInt(d,10));var f;if(a=nc(this,"state")||(f=!0,a.state))b=this.P=a,f||(this.K=!0,this.B=Wf),this.B&&(this.M=new Uc(this,"1.30.0"),Yf(this.M)?
|
||||
b=null:delete this.M);!b&&this.B&&(b=Zf(this))&&(this.K=!0);if(b){var h=this;sa(b,null,!0,function(a,b,c){c?(h.J=null,h.K=!1,h.ja("Unable to load machine state from server (error "+c+(b?": "+ma(b):"")+")")):(h.L=b,h.ba=!0);F(h)})}else F(this);this.N.power||(this.O=!0);!c&&this.O&&$f(this,this.ub)}else w("Unable to find CPU component")}bb(Uf);var Wf=0;function Vf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){w(d.message+" ("+c+")")}}a.ca=b}
|
||||
function nc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.ca&&(d=a.ca[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function $f(a,b,c){for(var d=eb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!nb(f)){nb(f,function(){$f(a,b,c)});return}}b.call(a,c)}
|
||||
function ag(a,b){var c=new Uc(a,"1.30.0","validate");if(Yf(c)&&bg(c)){var d=cg(c,"timestamp"),e=b?cg(b,"timestamp"):"unknown";d!=e&&(a.ja("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Uf.prototype;
|
||||
l.ub=function(a){void 0===a&&(a=this.B||(this.L?1:Wf));if(!this.w){this.w++;var b=!1,c=!1;this.Y=!1;var d=this.M||new Uc(this,"1.30.0");if(-1==a)b=!0;else if(a>Wf){if(Yf(d,this.L)){this.D=new Uc(this,"1.30.0","failsafe");Yf(this.D)&&(dg(this,d),a=2,eg(this.D));I(this.D,"timestamp",qa());fg(this.D);var e=this.B&&!this.K;if(1==a||ua("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=bg(d)){var f=cg(d,"code"),h=cg(d,"data");f&&("ok"==f?Yf(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(za("user",""),this.j=null)):this.g(f+": "+h),eg(d),Yf(d)?(c=bg(d),e=!0):c=!1))}e&&ag(this,c?d:null)}else 2==a&&d.clear()}else ag(this);delete this.L;delete this.M}e=eb(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=gg(this,h,d,b,c));b=[d,a,c];-1!=a?$f(this,this.uc,b):this.uc(b)}};
|
||||
function gg(a,b,c,d,e){if(!b.C.xa){b.C.xa=!0;if(b.Ea){var f=null;e&&((f=cg(c,b.id))||(f=cg(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ea(f,d)&&f&&(w("Unable to restore state for "+b.type),a.P&&!a.ba?(c.clear(),a.B=Wf,window&&window.location.reload()):a.Y=!0,b.Ea(null),e=!1)}if(!d&&b.cc)for(a=b.cc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
l.uc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ha=!0;this.C.xa=!0;var d=this.N.power;d&&(d.textContent="Shutdown");this.b&&(gg(this,this.b,b,c,a),this.b.rb());this.Y&&(dg(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.w=0};
|
||||
function dg(a,b){if(ua("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.j||"",d=b.toString(),e={app:"PC8080",ver:"1.30.0"};e.url=a.fa;e.user=c;e.type="bug";e.data=d;sa("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function Tf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new Uc(a,"1.30.0"),h=new Uc(a,"1.30.0","validate"),g=qa();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.30.0");I(f,"url",window?window.location.href:null);I(f,"browser",ta());a.b&&a.b.Ia&&(c&&a.b.pa(),d=a.b.Ia(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.C.xa=!1,!1===d&&(e=null)));for(var g=eb(a.id),k=0;k<g.length;k++){var m=g[k];m.C.xa&&(m.Ia&&(d=m.Ia(b,c),"object"===typeof d&&I(f,m.id,d)),c&&(m.C.xa=!1,!1===d&&(e=null)))}e&&
|
||||
(c?(g=d=!1,b?(a.j&&hg(a,a.j,f.toString()),fg(h)&&fg(f)||(e=null,d=g=!0)):a.B&&(d=!0,g=3==a.B),d&&f.clear(g)):e=f.toString());c&&(a.C.xa=!1,b=a.N.power)&&(b.textContent="Power");a.w=0;return e}l.reset=function(){this.u&&this.u.reset&&(jb(this,"Resetting "+this.u.type),this.u.reset());for(var a=eb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.u&&c.reset&&(jb(this,"Resetting "+c.type),c.reset())}};
|
||||
l.start=function(a,b){for(var c=eb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};l.stop=function(a,b){for(var c=eb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
l.oa=function(a,b,c){var d=this;switch(b){case "power":return this.N[b]=c,c.onclick=function(){d.w||(d.C.xa?Tf(d,!1,!0):$f(d,d.ub))},!0;case "reset":return this.N[b]=c,c.onclick=function(){if(d.C.xa&&!d.w)if(d.B&&!d.J){var a=ua("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Tf(d,a,!0);!a&&d.P?window&&window.location.reload():d.ub(Wf)}else d.reset(),d.b&&d.b.rb()},!0;case "save":if(ga()){c.parentNode.removeChild(c);break}this.N[b]=
|
||||
c;c.onclick=function(){var a=Xf(d,!0);if(a){var b=!!(d.B&&!d.J||d.P),c=Tf(d,b);b?hg(d,a,c):d.ja("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Xf(a,b){var c=a.j;c||(c=ya("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=ig(a,c))||a.ja("The user ID is invalid."))):b&&a.ja("Browser local storage is not available"));return c}
|
||||
function ig(a,b){a.j=null;var c=sa(ha()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(za("user",c.data),a.j=c.data)}catch(e){w(e.message+" ("+d+")")}return a.j}function Zf(a){var b=null;a.j&&(b=ha()+"/api/v1/user?req=load&user="+a.j+"&state="+jg(a,"1.30.0"));return b}
|
||||
function hg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=jg(a,"1.30.0");d.data=c;b=sa(ha()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ja("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ja(c),za("user",""),a.j=null)}}
|
||||
function vb(a,b,c){a=eb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}l.wb=function(a){if(this.G.length){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.G[0];d.ka&&d.ka.focus();!a&&window&&window.scrollTo(b,c)}};l.Ja=function(a){this.b&&this.b.Ja(a);this.I&&this.I.Ja(a)};
|
||||
Ma(function(){for(var a=D(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=A(f),h=new Uf(h,d,!0);hb(h,f);h.O&&$f(h,h.ub)}});Da.show.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=gb("Computer",c.id))&&c.ha&&!c.C.xa&&c.ub(-1)}});
|
||||
Da.exit.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=gb("Computer",c.id))&&c.C.xa&&Tf(c,!(!c.B||c.J),!0)}});function Uc(a,b,c){this.id=a.id;this.key=jg(a,b,c);this.H=a.H;eg(this,a.Kd)}function jg(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
Uc.prototype={constructor:Uc,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){eg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
|
||||
function eg(a,b){a[a.id]={};b&&I(a,"parms",b);a.b=!1}function fg(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(w("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function bg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){w(c.message||c),b=!1}return b}function Yf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=ya(a.key))?(a[a.id]=b,a.b=!0):!1}function cg(a,b){return a[a.id][b]||null}function I(a,b,c){try{a[a.id][b]=c}catch(d){}}var kg=0;
|
||||
function yg(a,b,c,d,e,f){e("Loading "+a+"...");sa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):zg(g,a,b,c,d,e,f)})}
|
||||
function zg(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){db(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PC8080$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?Ag(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),
|
||||
null)}
|
||||
function yg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");sa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,"");
|
||||
a=a.replace(d[0],h);yg(a,b,c)}})}else c(a,null)}
|
||||
function zg(a,b,c,d){function e(a){if(void 0===g){var b=h&&D(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ka(a))}function f(a){e("Error: "+a);k&&(--ig||Pa(!0));k=!1}var h,g,k=!0;ig++;bb[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));p.appendChild(q)}c||
|
||||
(c="/versions/pc8080/1.30.0/components.xsl");m=function(d,g){g?wg(c,null,null,!1,e,function(d,k){if(k)if(cb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(k);m?(h.outerHTML=m,--ig||Pa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(m,h),--ig||Pa(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?wg(b,a,d,!0,e,m):xg(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Pa(!1);return zg(a,b,c,d)};window.enableEvents=Pa;window.sendEvent=Qa;})();
|
||||
function Ag(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");sa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,"");
|
||||
a=a.replace(d[0],h);Ag(a,b,c)}})}else c(a,null)}
|
||||
function Bg(a,b,c,d){function e(a){if(void 0===g){var b=h&&D(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ka(a))}function f(a){e("Error: "+a);k&&(--kg||Pa(!0));k=!1}var h,g,k=!0;kg++;cb[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));p.appendChild(q)}c||
|
||||
(c="/versions/pc8080/1.30.0/components.xsl");m=function(d,g){g?yg(c,null,null,!1,e,function(d,k){if(k)if(db(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(k);m?(h.outerHTML=m,--kg||Pa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(m,h),--kg||Pa(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?yg(b,a,d,!0,e,m):zg(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Pa(!1);return Bg(a,b,c,d)};window.enableEvents=Pa;window.sendEvent=Qa;})();
|
||||
|
|
|
|||
|
|
@ -1,164 +1,166 @@
|
|||
(function(){var k;function aa(a){var b=16,c;if(a){b||(b=10);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}
|
||||
function m(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 ba(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}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function da(){var a=ea();return-1!==a.indexOf("pcjs.org",a.length-8)}
|
||||
(function(){var k,m={pd:1,qd:3,rd:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,kb:65,Mb:66,Ob:67,nb:68,E:69,Rb:70,Sb:71,Tb:72,Ub:73,ac:74,bc:75,pb:76,ic:77,jc:78,mc:79,nc:80,Q:81,tc:82,wc:83,Bc:84,Cc:85,Dc:86,Ec:87,Gc:88,Hc:89,Ic:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Zd:97,$d:98,ae:99,d:100,e:101,be:102,ce:103,de:104,ee:105,fe:106,k:107,ge:108,
|
||||
he:109,n:110,ie:111,p:112,q:113,r:114,je:115,t:116,ke:117,le:118,me:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126};
|
||||
function aa(a){var b=16,c;if(a){b||(b=10);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}
|
||||
function p(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 ba(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}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function da(){var a=ea();return-1!==a.indexOf("pcjs.org",a.length-8)}
|
||||
var fa={"&":"&","<":"<",">":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}function ha(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ia={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"},ja=Date.now||function(){return+new Date};
|
||||
function la(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
||||
function ka(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
||||
function ma(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),d&&d(a,f,e))});if(b&&"object"==
|
||||
typeof b){var l="",n;for(n in b)b.hasOwnProperty(n)&&(l&&(l+="&"),l+=n+"="+encodeURIComponent(b[n]));l=l.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(l)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function ea(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function p(a){window&&window.alert(a)}function na(a){var b=!1;window&&(b=window.confirm(a));return b}var oa=null;function pa(){if(null==oa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}oa=a}return oa}function qa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function q(a){window&&window.alert(a)}function na(a){var b=!1;window&&(b=window.confirm(a));return b}var oa=null;function pa(){if(null==oa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}oa=a}return oa}function qa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function ra(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function sa(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 ta={init:[],show:[],exit:[]},ua=!1,va=!1,wa=!0;function xa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ya(a){ta.init.push(a)}
|
||||
function za(a){if(wa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Aa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Ba(a){!wa&&a?(wa=!0,ua&&Da("init"),va&&Da("show")):wa=a}function Da(a){ta[a]&&za(ta[a])}xa("onload",function(){ua=!0;za(ta.init)});xa("onpageshow",function(){va=!0;za(ta.show)});xa(sa("Opera")||sa("iOS")?"onunload":"onbeforeunload",function(){za(ta.exit)});
|
||||
function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.vb=b.comment;this.Jc=b;b=this.id.indexOf(".");0>b?this.Sa=this.id:(this.Ta=this.id.substr(0,b),this.Sa=this.id.substr(b+1));this[a]=c;this.l={ready:!1,Ia:!1,eb:!1,Y:!1,error:!1};this.Xa=null;this.l.error=!1;this.A={};this.O=null;r.push(this)}var Ea=void 0,Fa={};
|
||||
function za(a){if(wa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Aa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Ba(a){!wa&&a?(wa=!0,ua&&Ca("init"),va&&Ca("show")):wa=a}function Ca(a){ta[a]&&za(ta[a])}xa("onload",function(){ua=!0;za(ta.init)});xa("onpageshow",function(){va=!0;za(ta.show)});xa(sa("Opera")||sa("iOS")?"onunload":"onbeforeunload",function(){za(ta.exit)});
|
||||
function r(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.vb=b.comment;this.Mc=b;b=this.id.indexOf(".");0>b?this.Ta=this.id:(this.Ua=this.id.substr(0,b),this.Ta=this.id.substr(b+1));this[a]=c;this.l={ready:!1,Oa:!1,fb:!1,Y:!1,error:!1};this.$a=null;this.l.error=!1;this.A={};this.N=null;u.push(this)}var Ea=void 0,Fa={};
|
||||
if(window){Ea||(Ea=window.location.search.substr(1));for(var Ga,Ha=/\+/g,Ia=/([^&=]+)=?([^&]*)/g;Ga=Ia.exec(Ea);)Fa[decodeURIComponent(Ga[1].replace(Ha," "))]=decodeURIComponent(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 w(a,b){b||(b=q);a.prototype=Ja(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ka=window.PCjs.Machines||(window.PCjs.Machines={}),r=window.PCjs.Components||(window.PCjs.Components=[])}else Ka={},r=[];function La(a,b,c){Ka[a]&&b&&(Ka[a][b]=c)}function Aa(a,b,c){b||p((c?c+": ":"")+a)}
|
||||
function Ma(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<r.length;b++){var d=r[b];a&&d.id.indexOf(a)||c.push(d)}return c}function Na(a){if(void 0!==a){var b;for(b=0;b<r.length;b++)if(r[b].id===a)return r[b]}return null}function Oa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<r.length;d++)if(c)c==r[d]&&(c=null);else if(!(a!=r[d].type||b&&r[d].id.indexOf(b)))return r[d]}return null}
|
||||
function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){p(c.message+" ("+a+")")}return b}function Pa(a,b){for(var c=A(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var l=g.split(" "),n=0;n<l.length;n++)switch(g=l[n],g){case "pc8080-binding":(g=z(h))&&g.binding&&a.V(g.type,g.binding,h,g.value),n=l.length}}}}
|
||||
function A(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}
|
||||
q.prototype={constructor:q,parent:null,toString:function(){return this.name?this.name:this.id||this.type},V: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.ua=this.A[b]=c,c.value="",this.ca=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.M=function(a){this.ca(a,this.Sa)}),!0;default:return!1}},log:function(){},ca:function(){},status:function(a){this.ca(this.Sa+": "+a)},M:function(a,b,c){Aa(a,b,c||this.type)},fa:function(){return this.l.Y=!0},ha:function(a,b){b&&(this.l.Y=!1);return!0}};function Qa(a,b){if(a.l.eb)return a.l.Ia&&(a.l.Ia=!1),a.l.eb=!1;if(a.l.error)return a.ca(a.toString()+" error"),!1;a.l.Ia=b;return a.l.Ia}function C(a){if(!a.l.error&&(a.l.ready=!0,a.l.ready)){var b=a.Xa;a.Xa=null;b&&b()}}
|
||||
function Ra(a,b){b&&(a.l.ready?b():a.Xa=b);return a.l.ready}
|
||||
function x(a,b){b||(b=r);a.prototype=Ja(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ka=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else Ka={},u=[];function La(a,b,c){Ka[a]&&b&&(Ka[a][b]=c)}function Aa(a,b,c){b||q((c?c+": ":"")+a)}
|
||||
function Ma(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}function Na(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function Oa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[d]}return null}
|
||||
function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}function Pa(a,b){for(var c=B(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var l=g.split(" "),n=0;n<l.length;n++)switch(g=l[n],g){case "pc8080-binding":(g=A(h))&&g.binding&&a.V(g.type,g.binding,h,g.value),n=l.length}}}}
|
||||
function B(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}
|
||||
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},V: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.va=this.A[b]=c,c.value="",this.da=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.M=function(a){this.da(a,this.Ta)}),!0;default:return!1}},log:function(){},da:function(){},status:function(a){this.da(this.Ta+": "+a)},M:function(a,b,c){Aa(a,b,c||this.type)},ga:function(){return this.l.Y=!0},ia:function(a,b){b&&(this.l.Y=!1);return!0}};function Qa(a,b){if(a.l.fb)return a.l.Oa&&(a.l.Oa=!1),a.l.fb=!1;if(a.l.error)return a.da(a.toString()+" error"),!1;a.l.Oa=b;return a.l.Oa}function D(a){if(!a.l.error&&(a.l.ready=!0,a.l.ready)){var b=a.$a;a.$a=null;b&&b()}}
|
||||
function Ra(a,b){b&&(a.l.ready?b():a.$a=b);return a.l.ready}
|
||||
var Sa="undefined"!==typeof ArrayBuffer,Ta=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
|
||||
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function Ua(a){q.call(this,"Panel",a,Ua)}w(Ua);k=Ua.prototype;k.V=function(a,b,c,d){return this.v&&this.v.V(a,b,c,d)||this.a&&this.a.V(a,b,c,d)||this.m&&this.m.V(a,b,c,d)?!0:this.parent.V.call(this,a,b,c,d)};k.pa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.O=d;this.m=Va(a,"Keyboard")};k.fa=function(a,b){b||Wa();return!0};k.ha=function(){return!0};k.za=function(){};
|
||||
function Wa(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=Na(e.id);f||(a=!0,f=new Ua(e));Pa(f,d);a&&C(f)}}ya(Wa);
|
||||
function Xa(a,b,c){q.call(this,"Bus",a,Xa);this.a=b;this.O=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.g=this.u-1|0;this.j=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.c=1<<this.j;this.w=this.c>>2;this.f=this.c-1;this.m=this.u/this.c|0;this.s=this.m-1;this.v=[];this.o=[];this.B=[];this.C=[];a=new D;Ya(a,this.O);this.b=Array(this.m);for(b=0;b<this.m;b++)this.b[b]=a;C(this)}w(Xa);Xa.prototype.reset=function(){};Xa.prototype.fa=function(a,b){b||this.reset();return!0};
|
||||
function Za(a,b,c,d){for(var e=b,f=c,h=e>>>a.j;0<f&&h<a.b.length;){var g=a.b[h],l=h*a.c,n=a.c-(e-l);n>f&&(n=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ga)return g.cb+=g.Ga-e,g.Ga=e,!0;if(e>=g.Ga+g.cb){n=g.size-(e-l);n>f&&(n=f);g.cb=e-g.Ga+n;e=l+a.c;f-=n;h++;continue}}return $a(1,e,f)}e=new D(e,n,a.c,d);Ya(e,a.O,g);a.b[h++]=e;e=l+a.c;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+ab[d]+" at "+("0x"+m(b,4))),!0):$a(2,b,c)}
|
||||
Xa.prototype.L=function(a){return this.b[(a&this.g)>>>this.j].Pa(a&this.f,a)};function bb(a,b){return a.b[(b&a.g)>>>a.j].bb(b&a.f,b)}function cb(a,b){var c=b&a.f,d=(b&a.g)>>>a.j;return c!=a.f?a.b[d].Lc(c,b):a.b[d++].Pa(c,b)|a.b[d&a.s].Pa(0,b+1)<<8}Xa.prototype.$=function(a,b){this.b[(a&this.g)>>>this.j].Qa(a&this.f,b&255,a)};function db(a,b,c){a.b[(b&a.g)>>>a.j].Db(b&a.f,c&255,b)}
|
||||
function fb(a,b,c){var d=b&a.f,e=(b&a.g)>>>a.j;d!=a.f?a.b[e].Mc(d,c&65535,b):(a.b[e++].Qa(d,c&255,b),a.b[e&a.s].Qa(0,c>>8&255,b+1))}function gb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var l=+e+d;l<=h;l++)void 0!==f.v[l]?p("Input port 0x"+m(l,4)+" already registered"):f.v[l]=[g,!1]}}
|
||||
function hb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var l=+e+d;l<=h;l++)void 0!==f.o[l]?p("Output port 0x"+m(l,4)+" already registered"):f.o[l]=[g,!1]}}function $a(a,b,c){p("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}var ib;if(Sa){var jb=new ArrayBuffer(2);(new DataView(jb)).setUint16(0,256,!0);ib=256===(new Uint16Array(jb))[0]}else ib=!1;var kb=ib;
|
||||
function D(a,b,c,d){this.id=lb+=2;this.a=null;this.Ga=a;this.cb=b;this.size=c||0;this.type=d||mb;this.c=d==nb;Ya(this);this.ma=this.ub=!1;if(c)if(Sa)this.j=new ArrayBuffer(c),this.A=new DataView(this.j,0,c),this.b=new Uint8Array(this.j,0,c),this.i=new Uint16Array(this.j,0,c>>1),this.a=new Int32Array(this.j,0,c>>2),ob(this,kb?pb:qb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;ob(this,rb)}else ob(this)}var mb=0,nb=2,ab=["NONE","RAM","ROM","VID","H/W"],lb=0;
|
||||
D.prototype={constructor:D,parent:null,save:function(){var a,b;if(Sa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.A.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(Sa)for(b=0;b<a.length;b++)this.A.setInt32(b<<2,a[b],!0);else this.a=a;return this.ma=!0}return!1},m:function(){return 255},o:function(){},v:function(a,b){return this.Pa(a++,b++)|this.Pa(a,b)<<8},s:function(a,b,c){this.Qa(a++,b&255,c++);this.Qa(a,b>>8,c)},C:function(a){return this.a[a>>
|
||||
2]>>>((a&3)<<3)&255},I:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},R:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.ma=!0},da:function(a,b){var c=a>>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<<d)|b<<d:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.ma=!0},w:function(a,b){return this.bb(a,b)},J:function(a,b){return this.Ab(a,b)},N:function(a,b,c){this.c||this.Db(a,b,c)},W:function(a,
|
||||
b,c){this.c||this.X(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.A.getUint16(a,!0)},H:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},K:function(a,b){this.b[a]=b;this.ma=!0},P:function(a,b){this.b[a]=b;this.ma=!0},S:function(a,b){this.A.setUint16(a,b,!0);this.ma=!0},Z:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.ma=!0}};function Ya(a,b,c){a.O=b;a.f=a.g=0;c&&((a.f=c.f)&&sb(a,tb,!1),(a.g=c.g)&&ub(a,tb,!1))}
|
||||
function ub(a,b,c){c&&a.g||(a.Qa=!a.c&&b[2]||a.o,a.Mc=!a.c&&b[3]||a.s);if(c||void 0===c)a.Db=b[2]||a.o,a.X=b[3]||a.s}function sb(a,b,c){c&&a.f||(a.Pa=b[0]||a.m,a.Lc=b[1]||a.v);if(c||void 0===c)a.bb=b[0]||a.m,a.Ab=b[1]||a.v}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}var vb=[],rb=[D.prototype.C,D.prototype.I,D.prototype.R,D.prototype.da],tb=[D.prototype.w,D.prototype.J,D.prototype.N,D.prototype.W];
|
||||
if(Sa)var qb=[D.prototype.u,D.prototype.G,D.prototype.K,D.prototype.S],pb=[D.prototype.B,D.prototype.H,D.prototype.P,D.prototype.Z];function wb(a,b){q.call(this,"CPU",a,wb);var c=a.multiplier||1;this.la=a.cycles||b;this.I=c;this.Ba=Math.round(this.la/1E4)/100;this.W=this.Ba*this.I;this.l.na=!1;this.l.Bb=!1;this.l.Ha=a.autoStart;this.l.sb=!1;this.l.Va=!1;this.sa=this.X=0;this.ta=a.csStart;this.Z=a.csInterval;this.da=a.csStop;this.G=[];this.Za=this.hb.bind(this);C(this)}w(wb);var xb=["power","reset"];
|
||||
k=wb.prototype;k.pa=function(a,b,c,d){this.v=a;this.j=b;this.O=d;for(b=0;b<xb.length;b++)(c=this.A[xb[b]])&&this.v.V(null,xb[b],c);this.J=Va(a,"ChipSet");a=yb(a,"autoStart");null!=a&&(this.l.Ha="true"==a?!0:"false"==a?!1:!!a);C(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};k.fa=function(a,b){if(!b){if(a&&this.restore){zb(this);if(!this.restore(a))return!1;Ab(this)}else this.reset();this.ca("No debugger detected")}Bb(this);return!0};
|
||||
k.ha=function(a){return a?this.save():!0};k.Ha=function(){return this.l.Ha||void 0===this.A.run?(this.hb(!0),!0):!1};k.wb=function(){return 0};function Ab(a){void 0===a.ta&&(a.ta=0);void 0===a.Z&&(a.Z=-1);void 0===a.da&&(a.da=-1);a.l.Va=0<=a.ta&&0<a.Z;a.l.Va&&(a.sa=0,a.X=a.ta-a.S)}
|
||||
k.V=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.A[b]=c;a=!0;break;case "run":this.A[b]=c;c.onclick=function(){var a;if(a=d.v)if(a=d.v,a.l.Y)a=!0;else{var b=null,c,g=Ma(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.l.ready);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.l.Y);c++);c==g.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.l.ready?"powered yet":"ready yet"+(b.Xa?" (waiting for notification)":""))+".");a=!1}a&&(d.l.na?Cb(d):d.hb())};a=!0;
|
||||
break;case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(){Db(d,d.I<<1,!0)},c.textContent=this.W.toFixed(2)+"Mhz",a=!0}return a};function Eb(a,b,c){a.S+=b;c&&(a.R=a.a=0)}function Fb(a,b){var c=1;b&&1<a.I&&a.N&&(c=a.N/a.Ba);a.Ma=Math.round(1E3/30);a.va=Math.floor(a.la/30*c);b||(a.ka=a.va);a.Ca=0}function Gb(a){return a.S+a.K+a.R-a.a}function zb(a){a.N=0;a.Na=0;a.S=a.K=a.R=a.a=0;Ab(a);Db(a,1)}
|
||||
function Db(a,b,c){if(void 0!==b){.8>a.N/a.W&&(b=1);a.I=b;b=a.Ba*a.I;if(a.W!=b){a.W=b;b=a.W.toFixed(2)+"Mhz";var d=a.A.setSpeed;d&&(d.textContent=b);a.ca("target speed: "+b)}c&&a.v&&Hb(a.v)}Eb(a,a.K);a.K=0;a.H=ja();a.P=0;Fb(a)}function Ib(a,b){var c=a.G.length;a.G.push([-1,b]);return c}function Jb(a,b,c){var d=-1;0<=b&&b<a.G.length&&(d=a.la*a.I/1E3*c,a.G[b][0]=d)}function Lb(a){a.R-=a.a;a.a=0}
|
||||
k.hb=function(a){if(Qa(this,!0)){if(!this.l.na){Db(this);this.v&&this.v.start(this.H,Gb(this));this.l.na=!0;this.l.Bb=!0;this.J&&this.J.start();var b=this.A.run;b&&(b.textContent="Halt");this.v&&(this.v.za(!0),a&&Hb(this.v,!0))}this.Ca>=this.la&&Fb(this,!0);this.oa=0;this.ra=ja();this.P&&(a=this.ra-this.P,a>this.Ma&&(this.H+=a,this.H>this.ra&&(this.H=this.ra)));try{do{for(var c=this.l.Va?1:this.va,d=this.G.length-1;0<=d;d--){var e=this.G[d];0>e[0]||c>e[0]&&(c=e[0])}this.Cb(c);var f=this.R-this.a;
|
||||
a=f;for(var h=this.G.length-1;0<=h;h--){var g=this.G[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.oa+=f;this.K+=f;Eb(this,0,!0);a=f;this.l.Va&&(b=!1,this.sa=this.sa+this.wb()|0,this.X-=a,0>=this.X&&(this.X+=this.Z,b=!0),0<=this.da&&this.da<=Gb(this)&&(this.Z=this.da=-1,Ab(this),Cb(this),b=!0),b&&this.ca(Gb(this)+" cycles: checksum="+m(this.sa)));this.ka-=f;if(0>=this.ka){this.ka+=this.va;15<=++this.Na&&(this.v&&this.v.za(),this.Na=0);break}}while(this.l.na)}catch(l){Cb(this);Bb(this);this.v&&
|
||||
this.v.stop(ja(),Gb(this));Qa(this,!1);c=l.stack||l.message;this.l.error=!0;this.M(c);return}c=setTimeout;d=this.Za;this.P=ja();e=this.Ma;this.oa&&(e=Math.round(e*this.oa/this.va));e=e-(this.P-this.ra);if(f=this.P-this.H)this.N=Math.round(this.K/(10*f))/100,864E5<=f&&(this.S=0,Db(this));if(0>e||this.N<this.W)-1E3>e&&(this.H-=e),e=0;this.Ca+=this.oa;this.P+=e;c(d,e)}else Bb(this),this.v&&this.v.stop(ja(),Gb(this))};k.Cb=function(){return 0};
|
||||
function Cb(a){a.l.Ia&&(a.l.eb=!0);Lb(a);Eb(a,a.K);a.K=0;if(a.l.na){a.l.na=!1;a.J&&a.J.stop();var b=a.A.run;b&&(b.textContent="Run")}a.l.complete=void 0}function Bb(a){if(a.v){for(var b=a.v,c=0;c<b.m.length;c++)Mb(b.m[c],void 0);a.v.za(void 0)}}function Nb(a){this.Ya=+a.model||8080;wb.call(this,a,1E6);this.Ja=Ob;zb(this);this.l.complete=this.l.jc=!1;this.La=0;this.qa=[];this.Ka=0;Pb(this)}w(Nb,wb);function Qb(a,b){a.qa.push(b)}k=Nb.prototype;
|
||||
k.reset=function(){this.l.na&&Cb(this);Pb(this);zb(this);this.l.error=!1;this.parent.reset.call(this)};function Pb(a){a.b=0;a.c=0;a.D=0;a.f=0;a.F=0;a.g=0;a.i=0;a.u=0;E(a,a.Ka);Rb(a,0);a.B=0}function Sb(a,b){a.Ka=b;E(a,b)}k.wb=function(){var a=this.b+this.c+this.D+this.f+this.F+this.g+this.i|0;return a=a+this.u+this.o+Tb(this)|0};
|
||||
k.save=function(){var a=new F(this);G(a,0,[this.b,this.c,this.D,this.f,this.F,this.g,this.i,this.u,this.o,Tb(this)]);G(a,1,[this.B,this.S,this.I]);for(var b=this.j,c=0,d=[],e=0;e<b.m;e++){var f=b.b[e];if(f.ma||f.ub){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,l=0,n=[];g<f.length;){for(var x=f[g],t=g+1;t<f.length&&f[t]===x;)t++;n[l++]=t-g;n[l++]=x;g=t}if(n.length<f.length){f=n;break a}}d[h]=f}}G(a,2,d);return a.data()};
|
||||
k.restore=function(a){var b=a[0];this.b=b[0];this.c=b[1];this.D=b[2];this.f=b[3];this.F=b[4];this.g=b[5];this.i=b[6];this.u=b[7]&65535;E(this,b[8]);Rb(this,b[9]);b=a[1];this.B=b[0];this.S=b[1];Db(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.w){for(var f=0,h=Array(b.w),g=0;g<e.length-1;)for(var l=e[g++],n=e[g++];l--;)h[f++]=n;e=h}f=b.b[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
k.V=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.A[b]=c;this.La++;d=!0;break;default:d=this.parent.V.call(this,a,b,c)}return d};function Ub(a){return a.c<<8|a.D}function Vb(a,b){a.c=b>>8&255;a.D=b&255}function Wb(a){return a.f<<8|a.F}function Xb(a,b){a.f=b>>8&255;a.F=b&255}function I(a){return a.g<<8|a.i}
|
||||
function J(a,b){a.g=b>>8&255;a.i=b&255}function E(a,b){a.o=b&65535}function K(a){return a.m&256?1:0}function L(a,b){a.m=a.m&255|b}function Yb(a){return Ta[a.s&255]?4:0}function Tb(a){return a.C&-214|(a.s&128?128:0)|(a.m&255?0:64)|((a.s^a.w)&16?16:0)|Yb(a)|K(a)}function Rb(a,b){a.m=a.s=a.w=0;b&1&&(a.m|=256);b&4||(a.s|=1);b&16&&(a.w|=16);b&64||(a.m|=255);b&128&&(a.s^=192);a.C=a.C&-726|b&512|2}function M(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b)&255}
|
||||
function Zb(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?1:0))&255}function $b(a,b){a.m=a.s=a.w=a.b&b;(a.b|b)&8&&(a.w^=16);return a.m}function ac(a,b){a.w=b^255;b=a.s=b+255&255;a.m=a.m&-256|b;return b}function bc(a,b){a.w=b;b=a.s=b+1&255;a.m=a.m&-256|b;return b}function cc(a,b){return a.s=a.m=a.w=a.b|b}function N(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+1^256)&255}function dc(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?0:1)^256)&255}function ec(a,b){return a.s=a.m=a.w=a.b^b}k.L=function(a){return this.j.L(a)};
|
||||
k.$=function(a,b){this.j.$(a,b)};function O(a){var b=a.L(a.o);E(a,a.o+1);return b}function P(a){var b=cb(a.j,a.o);E(a,a.o+2);return b}function Q(a){var b=cb(a.j,a.u);a.u=a.u+2&65535;return b}function S(a,b){a.u=a.u-2&65535;fb(a.j,a.u,b)}function fc(a){if(a.a&&a.B&255&&a.C&512){for(var b=0;8>b&&!(a.B&1<<b);b++);a.B&=~(0>b?255:1<<b);a.C&=-513;a.B&=-257;a.Ja[199|b<<3].call(a)}return a.B&256?(Lb(a),!1):!0}function gc(a,b){a.B|=1<<b;a.C&512&&Lb(a)}
|
||||
function T(a,b,c,d){d=d||2;a.A[b]&&(void 0===c&&(a.l.error=!0,a.M("Value for "+b+" is invalid"),Cb(a)),c=!a.l.na||a.l.sb?m(c,d):"--------".substr(0,d),a.A[b].textContent!=c&&(a.A[b].textContent=c))}
|
||||
k.za=function(a){this.La&&(a||!this.l.na||this.l.sb)&&(T(this,"A",this.b),T(this,"B",this.c),T(this,"C",this.D),T(this,"BC",Ub(this),4),T(this,"D",this.f),T(this,"E",this.F),T(this,"DE",Wb(this),4),T(this,"H",this.g),T(this,"L",this.i),T(this,"HL",I(this),4),T(this,"SP",this.u,4),T(this,"PC",this.o,4),a=Tb(this),T(this,"PS",a,4),T(this,"IF",a&512?1:0,1),T(this,"SF",a&128?1:0,1),T(this,"ZF",a&64?1:0,1),T(this,"AF",a&16?1:0,1),T(this,"PF",a&4?1:0,1),T(this,"CF",a&1?1:0,1));if(a=this.A.speed)a.textContent=
|
||||
this.l.na&&this.N?this.N.toFixed(2)+"Mhz":"Stopped"};k.Cb=function(a){this.l.complete=!0;this.l.jc=!1;this.l.Bb=!1;this.R=this.a=a;if(fc(this)){do this.Ja[O(this)].call(this);while(0<this.a)}return this.l.complete?this.R-this.a:void 0===this.l.complete?0:-1};ya(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Nb(d);Pa(d,c)}});function hc(){this.a-=4}function ic(){E(this,P(this));this.a-=10}function jc(){E(this,Q(this));this.a-=10}
|
||||
function kc(){var a=P(this);S(this,this.o);E(this,a);this.a-=17}
|
||||
var Ob=[hc,function(){Vb(this,P(this));this.a-=10},function(){this.$(Ub(this),this.b);this.a-=7},function(){Vb(this,Ub(this)+1);this.a-=5},function(){this.c=bc(this,this.c);this.a-=5},function(){this.c=ac(this,this.c);this.a-=5},function(){this.c=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;L(this,a&256);this.a-=4},hc,function(){var a;J(this,a=I(this)+Ub(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.L(Ub(this));this.a-=7},function(){Vb(this,Ub(this)-1);this.a-=5},function(){this.D=
|
||||
bc(this,this.D);this.a-=5},function(){this.D=ac(this,this.D);this.a-=5},function(){this.D=O(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;L(this,a);this.a-=4},hc,function(){Xb(this,P(this));this.a-=10},function(){this.$(Wb(this),this.b);this.a-=7},function(){Xb(this,Wb(this)+1);this.a-=5},function(){this.f=bc(this,this.f);this.a-=5},function(){this.f=ac(this,this.f);this.a-=5},function(){this.f=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|K(this);L(this,a&256);
|
||||
this.a-=4},hc,function(){var a;J(this,a=I(this)+Wb(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.L(Wb(this));this.a-=7},function(){Xb(this,Wb(this)-1);this.a-=5},function(){this.F=bc(this,this.F);this.a-=5},function(){this.F=ac(this,this.F);this.a-=5},function(){this.F=O(this);this.a-=7},function(){var a=this.b<<8;this.b=(K(this)<<8|this.b)>>1;L(this,a&256);this.a-=4},hc,function(){J(this,P(this));this.a-=10},function(){var a=P(this);fb(this.j,a,I(this));this.a-=16},function(){J(this,
|
||||
I(this)+1);this.a-=5},function(){this.g=bc(this,this.g);this.a-=5},function(){this.g=ac(this,this.g);this.a-=5},function(){this.g=O(this);this.a-=7},function(){var a=0,b=K(this);if((this.s^this.w)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=M(this,a);L(this,b?256:0);this.a-=4},hc,function(){var a;J(this,a=I(this)+I(this));L(this,a>>8&256);this.a-=10},function(){var a;a=P(this);a=cb(this.j,a);J(this,a);this.a-=16},function(){J(this,I(this)-1);this.a-=5},function(){this.i=bc(this,this.i);
|
||||
this.a-=5},function(){this.i=ac(this,this.i);this.a-=5},function(){this.i=O(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},hc,function(){this.u=P(this)&65535;this.a-=10},function(){this.$(P(this),this.b);this.a-=13},function(){this.u=this.u+1&65535;this.a-=5},function(){var a=I(this);this.$(a,bc(this,this.L(a)));this.a-=10},function(){var a=I(this);this.$(a,ac(this,this.L(a)));this.a-=10},function(){this.$(I(this),O(this));this.a-=10},function(){this.m|=256;this.a-=4},hc,function(){var a;
|
||||
J(this,a=I(this)+this.u);L(this,a>>8&256);this.a-=10},function(){this.b=this.L(P(this));this.a-=13},function(){this.u=this.u-1&65535;this.a-=5},function(){this.b=bc(this,this.b);this.a-=5},function(){this.b=ac(this,this.b);this.a-=5},function(){this.b=O(this);this.a-=7},function(){L(this,K(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.c=this.D;this.a-=5},function(){this.c=this.f;this.a-=5},function(){this.c=this.F;this.a-=5},function(){this.c=this.g;this.a-=5},function(){this.c=this.i;
|
||||
this.a-=5},function(){this.c=this.L(I(this));this.a-=7},function(){this.c=this.b;this.a-=5},function(){this.D=this.c;this.a-=5},function(){this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.F;this.a-=5},function(){this.D=this.g;this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.L(I(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.f=this.c;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.a-=5},function(){this.f=this.F;this.a-=
|
||||
5},function(){this.f=this.g;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.L(I(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.F=this.c;this.a-=5},function(){this.F=this.D;this.a-=5},function(){this.F=this.f;this.a-=5},function(){this.a-=5},function(){this.F=this.g;this.a-=5},function(){this.F=this.i;this.a-=5},function(){this.F=this.L(I(this));this.a-=7},function(){this.F=this.b;this.a-=5},function(){this.g=this.c;this.a-=5},function(){this.g=this.D;this.a-=
|
||||
5},function(){this.g=this.f;this.a-=5},function(){this.g=this.F;this.a-=5},function(){this.a-=5},function(){this.g=this.i;this.a-=5},function(){this.g=this.L(I(this));this.a-=7},function(){this.g=this.b;this.a-=5},function(){this.i=this.c;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.F;this.a-=5},function(){this.i=this.g;this.a-=5},function(){this.a-=5},function(){this.i=this.L(I(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.$(I(this),
|
||||
this.c);this.a-=7},function(){this.$(I(this),this.D);this.a-=7},function(){this.$(I(this),this.f);this.a-=7},function(){this.$(I(this),this.F);this.a-=7},function(){this.$(I(this),this.g);this.a-=7},function(){this.$(I(this),this.i);this.a-=7},function(){var a=this.o-1;if(this.qa.length)for(var b=0;b<this.qa.length;b++)if(this.qa[b](a))return;this.a-=7;this.B|=256;Lb(this);this.C&512||Cb(this)},function(){this.$(I(this),this.b);this.a-=7},function(){this.b=this.c;this.a-=5},function(){this.b=this.D;
|
||||
this.a-=5},function(){this.b=this.f;this.a-=5},function(){this.b=this.F;this.a-=5},function(){this.b=this.g;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.L(I(this));this.a-=7},function(){this.a-=5},function(){this.b=M(this,this.c);this.a-=4},function(){this.b=M(this,this.D);this.a-=4},function(){this.b=M(this,this.f);this.a-=4},function(){this.b=M(this,this.F);this.a-=4},function(){this.b=M(this,this.g);this.a-=4},function(){this.b=M(this,this.i);this.a-=4},function(){this.b=
|
||||
M(this,this.L(I(this)));this.a-=7},function(){this.b=M(this,this.b);this.a-=4},function(){this.b=Zb(this,this.c);this.a-=4},function(){this.b=Zb(this,this.D);this.a-=4},function(){this.b=Zb(this,this.f);this.a-=4},function(){this.b=Zb(this,this.F);this.a-=4},function(){this.b=Zb(this,this.g);this.a-=4},function(){this.b=Zb(this,this.i);this.a-=4},function(){this.b=Zb(this,this.L(I(this)));this.a-=7},function(){this.b=Zb(this,this.b);this.a-=4},function(){this.b=N(this,this.c);this.a-=4},function(){this.b=
|
||||
N(this,this.D);this.a-=4},function(){this.b=N(this,this.f);this.a-=4},function(){this.b=N(this,this.F);this.a-=4},function(){this.b=N(this,this.g);this.a-=4},function(){this.b=N(this,this.i);this.a-=4},function(){this.b=N(this,this.L(I(this)));this.a-=7},function(){this.b=N(this,this.b);this.a-=4},function(){this.b=dc(this,this.c);this.a-=4},function(){this.b=dc(this,this.D);this.a-=4},function(){this.b=dc(this,this.f);this.a-=4},function(){this.b=dc(this,this.F);this.a-=4},function(){this.b=dc(this,
|
||||
this.g);this.a-=4},function(){this.b=dc(this,this.i);this.a-=4},function(){this.b=dc(this,this.L(I(this)));this.a-=7},function(){this.b=dc(this,this.b);this.a-=4},function(){this.b=$b(this,this.c);this.a-=4},function(){this.b=$b(this,this.D);this.a-=4},function(){this.b=$b(this,this.f);this.a-=4},function(){this.b=$b(this,this.F);this.a-=4},function(){this.b=$b(this,this.g);this.a-=4},function(){this.b=$b(this,this.i);this.a-=4},function(){this.b=$b(this,this.L(I(this)));this.a-=7},function(){this.b=
|
||||
$b(this,this.b);this.a-=4},function(){this.b=ec(this,this.c);this.a-=4},function(){this.b=ec(this,this.D);this.a-=4},function(){this.b=ec(this,this.f);this.a-=4},function(){this.b=ec(this,this.F);this.a-=4},function(){this.b=ec(this,this.g);this.a-=4},function(){this.b=ec(this,this.i);this.a-=4},function(){this.b=ec(this,this.L(I(this)));this.a-=7},function(){this.b=ec(this,this.b);this.a-=4},function(){this.b=cc(this,this.c);this.a-=4},function(){this.b=cc(this,this.D);this.a-=4},function(){this.b=
|
||||
cc(this,this.f);this.a-=4},function(){this.b=cc(this,this.F);this.a-=4},function(){this.b=cc(this,this.g);this.a-=4},function(){this.b=cc(this,this.i);this.a-=4},function(){this.b=cc(this,this.L(I(this)));this.a-=7},function(){this.b=cc(this,this.b);this.a-=4},function(){N(this,this.c);this.a-=4},function(){N(this,this.D);this.a-=4},function(){N(this,this.f);this.a-=4},function(){N(this,this.F);this.a-=4},function(){N(this,this.g);this.a-=4},function(){N(this,this.i);this.a-=4},function(){N(this,
|
||||
this.L(I(this)));this.a-=7},function(){N(this,this.b);this.a-=4},function(){this.m&255&&(E(this,Q(this)),this.a-=6);this.a-=5},function(){Vb(this,Q(this));this.a-=10},function(){var a=P(this);this.m&255&&E(this,a);this.a-=10},ic,function(){var a=P(this);this.m&255&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,Ub(this));this.a-=11},function(){this.b=M(this,O(this));this.a-=7},function(){S(this,this.o);E(this,0);this.a-=11},function(){this.m&255||(E(this,Q(this)),this.a-=6);this.a-=
|
||||
5},jc,function(){var a=P(this);this.m&255||E(this,a);this.a-=10},ic,function(){var a=P(this);this.m&255||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},kc,function(){this.b=Zb(this,O(this));this.a-=7},function(){S(this,this.o);E(this,8);this.a-=11},function(){K(this)||(E(this,Q(this)),this.a-=6);this.a-=5},function(){Xb(this,Q(this));this.a-=10},function(){var a=P(this);K(this)||E(this,a);this.a-=10},function(){for(var a=O(this),b=this.j,c=this.b,d=this.o+-2&65535,e=1,f=0;0<e;){var h=b.o[a],g=b.C[a]||
|
||||
1,l=1==g?255:2==g?65535:-1,l=(c>>>=f)&l;if(void 0!==h&&h[0])h[0](a,l,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=P(this);K(this)||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,Wb(this));this.a-=11},function(){this.b=N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,16);this.a-=11},function(){K(this)&&(E(this,Q(this)),this.a-=6);this.a-=5},jc,function(){var a=P(this);K(this)&&E(this,a);this.a-=10},function(){for(var a=O(this),b=this.j,c=this.o+-2&65535,d=1,e=0,
|
||||
f=0;0<d;){var h=b.v[a],g=b.B[a]||1,l=1==g?255:2==g?65535:-1,n=l;void 0!==h&&h[0]&&(n=h[0](a,c),void 0===n?n=l:n&=l);e|=n<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=P(this);K(this)&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},kc,function(){this.b=dc(this,O(this));this.a-=7},function(){S(this,this.o);E(this,24);this.a-=11},function(){Yb(this)||(E(this,Q(this)),this.a-=6);this.a-=5},function(){J(this,Q(this));this.a-=10},function(){var a=P(this);Yb(this)||E(this,a);this.a-=10},
|
||||
function(){var a=Q(this);S(this,I(this));J(this,a);this.a-=18},function(){var a=P(this);Yb(this)||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,I(this));this.a-=11},function(){this.b=$b(this,O(this));this.a-=7},function(){S(this,this.o);E(this,32);this.a-=11},function(){Yb(this)&&(E(this,Q(this)),this.a-=6);this.a-=5},function(){E(this,I(this));this.a-=5},function(){var a=P(this);Yb(this)&&E(this,a);this.a-=10},function(){var a=I(this);J(this,Wb(this));Xb(this,a);this.a-=5},function(){var a=
|
||||
P(this);Yb(this)&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},kc,function(){this.b=ec(this,O(this));this.a-=7},function(){S(this,this.o);E(this,40);this.a-=11},function(){this.s&128||(E(this,Q(this)),this.a-=6);this.a-=5},function(){var a=Q(this);Rb(this,a&255|this.C&-256);this.b=a>>8;this.a-=10},function(){var a=P(this);this.s&128||E(this,a);this.a-=10},function(){this.C&=-513;this.a-=4},function(){var a=P(this);this.s&128||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,
|
||||
Tb(this)&255|this.b<<8);this.a-=11},function(){this.b=cc(this,O(this));this.a-=7},function(){S(this,this.o);E(this,48);this.a-=11},function(){this.s&128&&(E(this,Q(this)),this.a-=6);this.a-=5},function(){this.u=I(this)&65535;this.a-=5},function(){var a=P(this);this.s&128&&E(this,a);this.a-=10},function(){this.C|=512;this.a-=4;fc(this)},function(){var a=P(this);this.s&128&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},kc,function(){N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,56);
|
||||
this.a-=11}];function U(a){q.call(this,"ChipSet",a,U);var b=a.model;b&&!lc[b]&&Aa("Unrecognized ChipSet model: "+b);this.c=lc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);C(this)}w(U);
|
||||
var W={aa:1978.1,gc:{ba:0,Rc:1,Vc:16,bd:32,ld:64,kd:128,Ea:14},ya:{ba:1,Ib:1,bc:2,Yb:4,Zb:16,$b:32,ac:64,Ea:8},hc:{ba:2,Qc:3,ud:4,Sc:8,fd:16,gd:32,hd:64,Tc:128,Ea:0},pd:{ba:3},nd:{ba:2,cd:7},rd:{ba:3,vd:1,qd:2,jd:4,$c:8,Uc:16,Nc:32},od:{ba:4},sd:{ba:5,Wc:1,Xc:2,Yc:4,Zc:8,wd:16}},X={aa:100,ia:{ba:66,rb:1,Wb:2,Xb:4,ed:8,dd:16,pb:32,ob:64,lb:128},Hb:{ba:66,INIT:0},wa:{ba:194,Pc:0,kb:16,cc:32,qb:48,Mb:0,Nb:32},Ra:{ba:162,md:0,Pb:0,Lb:0,Ob:0,Kb:0},ja:{ad:{ba:98},Aa:{Fb:0,Eb:1,ec:2,ic:4,Jb:5,dc:6,td:7},
|
||||
Ua:16383}},lc={SI1978:W,VT100:X};U.prototype.V=function(){return!1};U.prototype.pa=function(a,b,c,d){this.j=b;this.a=c;this.O=d;this.v=a;this.m=Va(a,"Keyboard");this.Z=Va(a,"SerialPort");this.video=Va(a,"Video");gb(b,this,this.c.$a);hb(b,this,this.c.ab)};U.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};U.prototype.ha=function(a){return a?this.save():!0};W.INIT=[[W.gc.Ea,W.ya.Ea,W.hc.Ea,0,0,0,0]];
|
||||
X.INIT=[[X.Hb.INIT,X.ia.Wb|X.ia.Xb],[X.wa.Mb,X.wa.Nb],[X.Ra.Pb,X.Ra.Lb,X.Ra.Ob,X.Ra.Kb],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];k=U.prototype;k.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.M("reset error")};
|
||||
k.save=function(){var a=new F(this);switch(this.c.aa){case W.aa:G(a,0,[this.W,this.g,this.X,this.C,this.H,this.R,this.S]);break;case X.aa:G(a,0,[this.K,this.u]),G(a,1,[this.o,this.s]),G(a,2,[this.f,this.G,this.P,this.N]),G(a,3,[this.B,this.b,this.w,this.J,this.i])}return a.data()};
|
||||
k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.aa){case W.aa:return this.W=b[0],this.g=b[1],this.X=b[2],this.C=b[3],this.H=b[4],this.R=b[5],this.S=b[6],!0;case X.aa:return this.K=b[0],this.u=b[1],b=a[1],this.o=b[0],this.s=b[1],b=a[2],this.f=b[0],this.G=b[1],this.P=b[2],this.N=b[3],b=a[3],this.B=b[0],this.b=b[1],this.w=b[2],this.J=b[3],this.i=b[4],!0}return!1};k.start=function(){};k.stop=function(){};k.nc=function(){return this.W};k.oc=function(){return this.g};k.pc=function(){return this.X};
|
||||
k.mc=function(){return this.C>>8-this.H&255};k.zc=function(a,b){this.H=b};k.Bc=function(a,b){this.R=b};k.Ac=function(a,b){this.C=b<<8|this.C>>8};k.Cc=function(a,b){this.S=b};k.Dc=function(){};function mc(a){var b=0,c=0,d=~a.B;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
|
||||
k.qc=function(){var a=this.u,a=a&~X.ia.ob;if((Gb(this.a)&64)<<1&&(a|=X.ia.ob,a!=this.u)){var b,c;b=this.w&1;switch(this.w>>1&7){case X.ja.Aa.Eb:this.B=this.B<<1|b;break;case X.ja.Aa.Jb:b=mc(this);this.i[b]=X.ja.Ua;break;case X.ja.Aa.Fb:this.b=this.b<<1|b;break;case X.ja.Aa.ic:b=mc(this);c=this.b&X.ja.Ua;this.i[b]=c;break;case X.ja.Aa.dc:b=mc(this);c=this.i[b];null==c&&(c=X.ja.Ua);this.b=c;break;case X.ja.Aa.ec:this.b<<=1,this.J=this.b&X.ja.Ua+1}}a&=~X.ia.pb;this.J&&(a|=X.ia.pb);a&=~X.ia.lb;if(b=this.m){b=
|
||||
this.m;if(c=b.f)c=b.a,c=Gb(b.a)>=b.m+c.la*c.I/1E3*1.2731488;c&&(b.f=!1);b=!b.f}b&&(a|=X.ia.lb);a&=~X.ia.rb;this.Z&&this.Z.ea&1&&(a|=X.ia.rb);return this.u=a};k.Ec=function(a,b){this.K=b};k.Hc=function(a,b){this.w=b};k.Gc=function(a,b){var c=b&3;switch(b>>2&3){case 0:this.f=this.f&-4|c;break;case 1:this.f=this.f&-13|c<<2;if(this.video){var c=this.video,d=this.f;c.oa!==d&&((c.oa=d)?Mb(c,!0):c.ra=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.P=3-c}break;case 3:this.N=c}};
|
||||
k.Fc=function(a,b){if(b&X.wa.cc)b&=X.wa.qb,this.s!=b&&(this.s=b,this.video&&(this.video.zb=this.s==X.wa.qb?50:60));else if(b&=X.wa.kb,this.o!=b&&(this.o=b,this.video)){var c=this.video,d=this.o==X.wa.kb?132:80;c.J=d;c.U=c.va;80<d&&c.U--;nc(c)&&oc(c)}};W.$a={0:U.prototype.nc,1:U.prototype.oc,2:U.prototype.pc,3:U.prototype.mc};W.ab={2:U.prototype.zc,3:U.prototype.Bc,4:U.prototype.Ac,5:U.prototype.Cc,6:U.prototype.Dc};X.$a={66:U.prototype.qc};
|
||||
X.ab={66:U.prototype.Ec,98:U.prototype.Hc,162:U.prototype.Gc,194:U.prototype.Fc};ya(function(){for(var a=A(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new U(d);Pa(d,c)}});
|
||||
function pc(a){q.call(this,"ROM",a,pc);this.b=null;this.m=a.addr;this.c=a.size;this.v=a.writable;this.f=a.alias;this.g=a.file;this.o=ba(this.g);if(this.g){a=this.g;var b=ca(this.o);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;ma(a,null,!0,function(a,b,f){qc(c,a,b,f)})}}w(pc);var rc=[0,5];pc.prototype.pa=function(a,b,c,d){this.j=b;this.a=c;this.O=d;sc(this)};
|
||||
pc.prototype.fa=function(){this.i&&(this.O&&this.O.a(this.id,this.m,this.c,this.i),delete this.i);return!0};pc.prototype.ha=function(){return!0};
|
||||
function qc(a,b,c,d){if(d)a.M("Unable to load system ROM (error "+d+": "+b+")");else{La(a.Ta,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.b=f;else if(h)for(a.b=Array(4*h.length),d=c=0;c<h.length;c++)a.b[d++]=h[c]&255,a.b[d++]=h[c]>>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=e.symbols;if(!a.b.length){p("Empty ROM: "+b);return}if(1==a.b.length){p(a.b[0]);return}}catch(g){a.M("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function Ua(a){r.call(this,"Panel",a,Ua)}x(Ua);k=Ua.prototype;k.V=function(a,b,c,d){return this.v&&this.v.V(a,b,c,d)||this.a&&this.a.V(a,b,c,d)||this.m&&this.m.V(a,b,c,d)?!0:this.parent.V.call(this,a,b,c,d)};k.qa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.N=d;this.m=Va(a,"Keyboard")};k.ga=function(a,b){b||Wa();return!0};k.ia=function(){return!0};k.Aa=function(){};
|
||||
function Wa(){for(var a=!1,b=B(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=Na(e.id);f||(a=!0,f=new Ua(e));Pa(f,d);a&&D(f)}}ya(Wa);
|
||||
function Xa(a,b,c){r.call(this,"Bus",a,Xa);this.a=b;this.N=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.g=this.u-1|0;this.j=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.c=1<<this.j;this.w=this.c>>2;this.f=this.c-1;this.m=this.u/this.c|0;this.s=this.m-1;this.v=[];this.o=[];this.B=[];this.C=[];a=new E;Ya(a,this.N);this.b=Array(this.m);for(b=0;b<this.m;b++)this.b[b]=a;D(this)}x(Xa);Xa.prototype.reset=function(){};Xa.prototype.ga=function(a,b){b||this.reset();return!0};
|
||||
function Za(a,b,c,d){for(var e=b,f=c,h=e>>>a.j;0<f&&h<a.b.length;){var g=a.b[h],l=h*a.c,n=a.c-(e-l);n>f&&(n=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ma)return g.eb+=g.Ma-e,g.Ma=e,!0;if(e>=g.Ma+g.eb){n=g.size-(e-l);n>f&&(n=f);g.eb=e-g.Ma+n;e=l+a.c;f-=n;h++;continue}}return $a(1,e,f)}e=new E(e,n,a.c,d);Ya(e,a.N,g);a.b[h++]=e;e=l+a.c;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+ab[d]+" at "+("0x"+p(b,4))),!0):$a(2,b,c)}
|
||||
Xa.prototype.J=function(a){return this.b[(a&this.g)>>>this.j].Qa(a&this.f,a)};function bb(a,b){return a.b[(b&a.g)>>>a.j].cb(b&a.f,b)}function cb(a,b){var c=b&a.f,d=(b&a.g)>>>a.j;return c!=a.f?a.b[d].kd(c,b):a.b[d++].Qa(c,b)|a.b[d&a.s].Qa(0,b+1)<<8}Xa.prototype.aa=function(a,b){this.b[(a&this.g)>>>this.j].Ra(a&this.f,b&255,a)};function db(a,b,c){a.b[(b&a.g)>>>a.j].Hb(b&a.f,c&255,b)}
|
||||
function eb(a,b,c){var d=b&a.f,e=(b&a.g)>>>a.j;d!=a.f?a.b[e].ld(d,c&65535,b):(a.b[e++].Ra(d,c&255,b),a.b[e&a.s].Ra(0,c>>8&255,b+1))}function fb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var l=+e+d;l<=h;l++)void 0!==f.v[l]?q("Input port 0x"+p(l,4)+" already registered"):f.v[l]=[g,!1]}}
|
||||
function hb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var l=+e+d;l<=h;l++)void 0!==f.o[l]?q("Output port 0x"+p(l,4)+" already registered"):f.o[l]=[g,!1]}}function $a(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}var ib;if(Sa){var jb=new ArrayBuffer(2);(new DataView(jb)).setUint16(0,256,!0);ib=256===(new Uint16Array(jb))[0]}else ib=!1;var kb=ib;
|
||||
function E(a,b,c,d){this.id=lb+=2;this.a=null;this.Ma=a;this.eb=b;this.size=c||0;this.type=d||mb;this.c=d==nb;Ya(this);this.na=this.Ab=!1;if(c)if(Sa)this.j=new ArrayBuffer(c),this.A=new DataView(this.j,0,c),this.b=new Uint8Array(this.j,0,c),this.i=new Uint16Array(this.j,0,c>>1),this.a=new Int32Array(this.j,0,c>>2),ob(this,kb?pb:qb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;ob(this,rb)}else ob(this)}var mb=0,nb=2,ab=["NONE","RAM","ROM","VID","H/W"],lb=0;
|
||||
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(Sa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.A.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(Sa)for(b=0;b<a.length;b++)this.A.setInt32(b<<2,a[b],!0);else this.a=a;return this.na=!0}return!1},m:function(){return 255},o:function(){},v:function(a,b){return this.Qa(a++,b++)|this.Qa(a,b)<<8},s:function(a,b,c){this.Ra(a++,b&255,c++);this.Ra(a,b>>8,c)},C:function(a){return this.a[a>>
|
||||
2]>>>((a&3)<<3)&255},I:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},S:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.na=!0},ea:function(a,b){var c=a>>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<<d)|b<<d:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.na=!0},w:function(a,b){return this.cb(a,b)},K:function(a,b){return this.Eb(a,b)},O:function(a,b,c){this.c||this.Hb(a,b,c)},W:function(a,
|
||||
b,c){this.c||this.X(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.A.getUint16(a,!0)},H:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},L:function(a,b){this.b[a]=b;this.na=!0},R:function(a,b){this.b[a]=b;this.na=!0},T:function(a,b){this.A.setUint16(a,b,!0);this.na=!0},Z:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.na=!0}};function Ya(a,b,c){a.N=b;a.f=a.g=0;c&&((a.f=c.f)&&sb(a,tb,!1),(a.g=c.g)&&ub(a,tb,!1))}
|
||||
function ub(a,b,c){c&&a.g||(a.Ra=!a.c&&b[2]||a.o,a.ld=!a.c&&b[3]||a.s);if(c||void 0===c)a.Hb=b[2]||a.o,a.X=b[3]||a.s}function sb(a,b,c){c&&a.f||(a.Qa=b[0]||a.m,a.kd=b[1]||a.v);if(c||void 0===c)a.cb=b[0]||a.m,a.Eb=b[1]||a.v}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}var vb=[],rb=[E.prototype.C,E.prototype.I,E.prototype.S,E.prototype.ea],tb=[E.prototype.w,E.prototype.K,E.prototype.O,E.prototype.W];
|
||||
if(Sa)var qb=[E.prototype.u,E.prototype.G,E.prototype.L,E.prototype.T],pb=[E.prototype.B,E.prototype.H,E.prototype.R,E.prototype.Z];function wb(a,b){r.call(this,"CPU",a,wb);var c=a.multiplier||1;this.la=a.cycles||b;this.I=c;this.Ca=Math.round(this.la/1E4)/100;this.W=this.Ca*this.I;this.l.oa=!1;this.l.Fb=!1;this.l.Na=a.autoStart;this.l.yb=!1;this.l.Ya=!1;this.ta=this.X=0;this.ua=a.csStart;this.Z=a.csInterval;this.ea=a.csStop;this.G=[];this.Xa=this.ib.bind(this);D(this)}x(wb);var xb=["power","reset"];
|
||||
k=wb.prototype;k.qa=function(a,b,c,d){this.v=a;this.j=b;this.N=d;for(b=0;b<xb.length;b++)(c=this.A[xb[b]])&&this.v.V(null,xb[b],c);this.K=Va(a,"ChipSet");a=yb(a,"autoStart");null!=a&&(this.l.Na="true"==a?!0:"false"==a?!1:!!a);D(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};k.ga=function(a,b){if(!b){if(a&&this.restore){zb(this);if(!this.restore(a))return!1;Ab(this)}else this.reset();this.da("No debugger detected")}Bb(this);return!0};
|
||||
k.ia=function(a){return a?this.save():!0};k.Na=function(){return this.l.Na||void 0===this.A.run?(this.ib(!0),!0):!1};k.Bb=function(){return 0};function Ab(a){void 0===a.ua&&(a.ua=0);void 0===a.Z&&(a.Z=-1);void 0===a.ea&&(a.ea=-1);a.l.Ya=0<=a.ua&&0<a.Z;a.l.Ya&&(a.ta=0,a.X=a.ua-a.T)}
|
||||
k.V=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.A[b]=c;a=!0;break;case "run":this.A[b]=c;c.onclick=function(){var a;if(a=d.v)if(a=d.v,a.l.Y)a=!0;else{var b=null,c,g=Ma(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.l.ready);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.l.Y);c++);c==g.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.l.ready?"powered yet":"ready yet"+(b.$a?" (waiting for notification)":""))+".");a=!1}a&&(d.l.oa?Cb(d):d.ib())};a=!0;
|
||||
break;case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(){Db(d,d.I<<1,!0)},c.textContent=this.W.toFixed(2)+"Mhz",a=!0}return a};function Eb(a,b,c){a.T+=b;c&&(a.S=a.a=0)}function Fb(a,b){var c=1;b&&1<a.I&&a.O&&(c=a.O/a.Ca);a.Ka=Math.round(1E3/30);a.xa=Math.floor(a.la/30*c);b||(a.ja=a.xa);a.Da=0}function Gb(a){return a.T+a.L+a.S-a.a}function zb(a){a.O=0;a.La=0;a.T=a.L=a.S=a.a=0;Ab(a);Db(a,1)}
|
||||
function Db(a,b,c){if(void 0!==b){.8>a.O/a.W&&(b=1);a.I=b;b=a.Ca*a.I;if(a.W!=b){a.W=b;b=a.W.toFixed(2)+"Mhz";var d=a.A.setSpeed;d&&(d.textContent=b);a.da("target speed: "+b)}c&&a.v&&Hb(a.v)}Eb(a,a.L);a.L=0;a.H=ja();a.R=0;Fb(a)}function Ib(a,b){var c=a.G.length;a.G.push([-1,b]);return c}function Jb(a,b,c){var d=-1;0<=b&&b<a.G.length&&(d=a.la*a.I/1E3*c,a.G[b][0]=d)}function Kb(a){a.S-=a.a;a.a=0}
|
||||
k.ib=function(a){if(Qa(this,!0)){if(!this.l.oa){Db(this);this.v&&this.v.start(this.H,Gb(this));this.l.oa=!0;this.l.Fb=!0;this.K&&this.K.start();var b=this.A.run;b&&(b.textContent="Halt");this.v&&(this.v.Aa(!0),a&&Hb(this.v,!0))}this.Da>=this.la&&Fb(this,!0);this.pa=0;this.sa=ja();this.R&&(a=this.sa-this.R,a>this.Ka&&(this.H+=a,this.H>this.sa&&(this.H=this.sa)));try{do{for(var c=this.l.Ya?1:this.xa,d=this.G.length-1;0<=d;d--){var e=this.G[d];0>e[0]||c>e[0]&&(c=e[0])}this.Gb(c);var f=this.S-this.a;
|
||||
a=f;for(var h=this.G.length-1;0<=h;h--){var g=this.G[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.pa+=f;this.L+=f;Eb(this,0,!0);a=f;this.l.Ya&&(b=!1,this.ta=this.ta+this.Bb()|0,this.X-=a,0>=this.X&&(this.X+=this.Z,b=!0),0<=this.ea&&this.ea<=Gb(this)&&(this.Z=this.ea=-1,Ab(this),Cb(this),b=!0),b&&this.da(Gb(this)+" cycles: checksum="+p(this.ta)));this.ja-=f;if(0>=this.ja){this.ja+=this.xa;15<=++this.La&&(this.v&&this.v.Aa(),this.La=0);break}}while(this.l.oa)}catch(l){Cb(this);Bb(this);this.v&&
|
||||
this.v.stop(ja(),Gb(this));Qa(this,!1);c=l.stack||l.message;this.l.error=!0;this.M(c);return}c=setTimeout;d=this.Xa;this.R=ja();e=this.Ka;this.pa&&(e=Math.round(e*this.pa/this.xa));e=e-(this.R-this.sa);if(f=this.R-this.H)this.O=Math.round(this.L/(10*f))/100,864E5<=f&&(this.T=0,Db(this));if(0>e||this.O<this.W)-1E3>e&&(this.H-=e),e=0;this.Da+=this.pa;this.R+=e;c(d,e)}else Bb(this),this.v&&this.v.stop(ja(),Gb(this))};k.Gb=function(){return 0};
|
||||
function Cb(a){a.l.Oa&&(a.l.fb=!0);Kb(a);Eb(a,a.L);a.L=0;if(a.l.oa){a.l.oa=!1;a.K&&a.K.stop();var b=a.A.run;b&&(b.textContent="Run")}a.l.complete=void 0}function Bb(a){if(a.v){for(var b=a.v,c=0;c<b.m.length;c++)Lb(b.m[c],void 0);a.v.Aa(void 0)}}function Nb(a){this.Wa=+a.model||8080;wb.call(this,a,1E6);this.Ha=Ob;zb(this);this.l.complete=this.l.Nc=!1;this.Ja=0;this.ra=[];this.Ia=0;Pb(this)}x(Nb,wb);function Qb(a,b){a.ra.push(b)}k=Nb.prototype;
|
||||
k.reset=function(){this.l.oa&&Cb(this);Pb(this);zb(this);this.l.error=!1;this.parent.reset.call(this)};function Pb(a){a.b=0;a.c=0;a.D=0;a.f=0;a.F=0;a.g=0;a.i=0;a.u=0;F(a,a.Ia);Rb(a,0);a.B=0}function Sb(a,b){a.Ia=b;F(a,b)}k.Bb=function(){var a=this.b+this.c+this.D+this.f+this.F+this.g+this.i|0;return a=a+this.u+this.o+Tb(this)|0};
|
||||
k.save=function(){var a=new G(this);H(a,0,[this.b,this.c,this.D,this.f,this.F,this.g,this.i,this.u,this.o,Tb(this)]);H(a,1,[this.B,this.T,this.I]);for(var b=this.j,c=0,d=[],e=0;e<b.m;e++){var f=b.b[e];if(f.na||f.Ab){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,l=0,n=[];g<f.length;){for(var y=f[g],t=g+1;t<f.length&&f[t]===y;)t++;n[l++]=t-g;n[l++]=y;g=t}if(n.length<f.length){f=n;break a}}d[h]=f}}H(a,2,d);return a.data()};
|
||||
k.restore=function(a){var b=a[0];this.b=b[0];this.c=b[1];this.D=b[2];this.f=b[3];this.F=b[4];this.g=b[5];this.i=b[6];this.u=b[7]&65535;F(this,b[8]);Rb(this,b[9]);b=a[1];this.B=b[0];this.T=b[1];Db(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.w){for(var f=0,h=Array(b.w),g=0;g<e.length-1;)for(var l=e[g++],n=e[g++];l--;)h[f++]=n;e=h}f=b.b[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
k.V=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.A[b]=c;this.Ja++;d=!0;break;default:d=this.parent.V.call(this,a,b,c)}return d};function Ub(a){return a.c<<8|a.D}function Vb(a,b){a.c=b>>8&255;a.D=b&255}function Wb(a){return a.f<<8|a.F}function Xb(a,b){a.f=b>>8&255;a.F=b&255}function J(a){return a.g<<8|a.i}
|
||||
function K(a,b){a.g=b>>8&255;a.i=b&255}function F(a,b){a.o=b&65535}function L(a){return a.m&256?1:0}function M(a,b){a.m=a.m&255|b}function Yb(a){return Ta[a.s&255]?4:0}function Tb(a){return a.C&-214|(a.s&128?128:0)|(a.m&255?0:64)|((a.s^a.w)&16?16:0)|Yb(a)|L(a)}function Rb(a,b){a.m=a.s=a.w=0;b&1&&(a.m|=256);b&4||(a.s|=1);b&16&&(a.w|=16);b&64||(a.m|=255);b&128&&(a.s^=192);a.C=a.C&-726|b&512|2}function N(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b)&255}
|
||||
function Zb(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?1:0))&255}function $b(a,b){a.m=a.s=a.w=a.b&b;(a.b|b)&8&&(a.w^=16);return a.m}function ac(a,b){a.w=b^255;b=a.s=b+255&255;a.m=a.m&-256|b;return b}function bc(a,b){a.w=b;b=a.s=b+1&255;a.m=a.m&-256|b;return b}function cc(a,b){return a.s=a.m=a.w=a.b|b}function O(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+1^256)&255}function dc(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?0:1)^256)&255}function ec(a,b){return a.s=a.m=a.w=a.b^b}k.J=function(a){return this.j.J(a)};
|
||||
k.aa=function(a,b){this.j.aa(a,b)};function P(a){var b=a.J(a.o);F(a,a.o+1);return b}function Q(a){var b=cb(a.j,a.o);F(a,a.o+2);return b}function R(a){var b=cb(a.j,a.u);a.u=a.u+2&65535;return b}function T(a,b){a.u=a.u-2&65535;eb(a.j,a.u,b)}function fc(a){if(a.a&&a.B&255&&a.C&512){for(var b=0;8>b&&!(a.B&1<<b);b++);a.B&=~(0>b?255:1<<b);a.C&=-513;a.B&=-257;a.Ha[199|b<<3].call(a)}return a.B&256?(Kb(a),!1):!0}function gc(a,b){a.B|=1<<b;a.C&512&&Kb(a)}
|
||||
function U(a,b,c,d){d=d||2;a.A[b]&&(void 0===c&&(a.l.error=!0,a.M("Value for "+b+" is invalid"),Cb(a)),c=!a.l.oa||a.l.yb?p(c,d):"--------".substr(0,d),a.A[b].textContent!=c&&(a.A[b].textContent=c))}
|
||||
k.Aa=function(a){this.Ja&&(a||!this.l.oa||this.l.yb)&&(U(this,"A",this.b),U(this,"B",this.c),U(this,"C",this.D),U(this,"BC",Ub(this),4),U(this,"D",this.f),U(this,"E",this.F),U(this,"DE",Wb(this),4),U(this,"H",this.g),U(this,"L",this.i),U(this,"HL",J(this),4),U(this,"SP",this.u,4),U(this,"PC",this.o,4),a=Tb(this),U(this,"PS",a,4),U(this,"IF",a&512?1:0,1),U(this,"SF",a&128?1:0,1),U(this,"ZF",a&64?1:0,1),U(this,"AF",a&16?1:0,1),U(this,"PF",a&4?1:0,1),U(this,"CF",a&1?1:0,1));if(a=this.A.speed)a.textContent=
|
||||
this.l.oa&&this.O?this.O.toFixed(2)+"Mhz":"Stopped"};k.Gb=function(a){this.l.complete=!0;this.l.Nc=!1;this.l.Fb=!1;this.S=this.a=a;if(fc(this)){do this.Ha[P(this)].call(this);while(0<this.a)}return this.l.complete?this.S-this.a:void 0===this.l.complete?0:-1};ya(function(){for(var a=B(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Nb(d);Pa(d,c)}});function hc(){this.a-=4}function ic(){F(this,Q(this));this.a-=10}function jc(){F(this,R(this));this.a-=10}
|
||||
function kc(){var a=Q(this);T(this,this.o);F(this,a);this.a-=17}
|
||||
var Ob=[hc,function(){Vb(this,Q(this));this.a-=10},function(){this.aa(Ub(this),this.b);this.a-=7},function(){Vb(this,Ub(this)+1);this.a-=5},function(){this.c=bc(this,this.c);this.a-=5},function(){this.c=ac(this,this.c);this.a-=5},function(){this.c=P(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;M(this,a&256);this.a-=4},hc,function(){var a;K(this,a=J(this)+Ub(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.J(Ub(this));this.a-=7},function(){Vb(this,Ub(this)-1);this.a-=5},
|
||||
function(){this.D=bc(this,this.D);this.a-=5},function(){this.D=ac(this,this.D);this.a-=5},function(){this.D=P(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;M(this,a);this.a-=4},hc,function(){Xb(this,Q(this));this.a-=10},function(){this.aa(Wb(this),this.b);this.a-=7},function(){Xb(this,Wb(this)+1);this.a-=5},function(){this.f=bc(this,this.f);this.a-=5},function(){this.f=ac(this,this.f);this.a-=5},function(){this.f=P(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|L(this);
|
||||
M(this,a&256);this.a-=4},hc,function(){var a;K(this,a=J(this)+Wb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.J(Wb(this));this.a-=7},function(){Xb(this,Wb(this)-1);this.a-=5},function(){this.F=bc(this,this.F);this.a-=5},function(){this.F=ac(this,this.F);this.a-=5},function(){this.F=P(this);this.a-=7},function(){var a=this.b<<8;this.b=(L(this)<<8|this.b)>>1;M(this,a&256);this.a-=4},hc,function(){K(this,Q(this));this.a-=10},function(){var a=Q(this);eb(this.j,a,J(this));this.a-=16},function(){K(this,
|
||||
J(this)+1);this.a-=5},function(){this.g=bc(this,this.g);this.a-=5},function(){this.g=ac(this,this.g);this.a-=5},function(){this.g=P(this);this.a-=7},function(){var a=0,b=L(this);if((this.s^this.w)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=N(this,a);M(this,b?256:0);this.a-=4},hc,function(){var a;K(this,a=J(this)+J(this));M(this,a>>8&256);this.a-=10},function(){var a;a=Q(this);a=cb(this.j,a);K(this,a);this.a-=16},function(){K(this,J(this)-1);this.a-=5},function(){this.i=bc(this,this.i);
|
||||
this.a-=5},function(){this.i=ac(this,this.i);this.a-=5},function(){this.i=P(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},hc,function(){this.u=Q(this)&65535;this.a-=10},function(){this.aa(Q(this),this.b);this.a-=13},function(){this.u=this.u+1&65535;this.a-=5},function(){var a=J(this);this.aa(a,bc(this,this.J(a)));this.a-=10},function(){var a=J(this);this.aa(a,ac(this,this.J(a)));this.a-=10},function(){this.aa(J(this),P(this));this.a-=10},function(){this.m|=256;this.a-=4},hc,function(){var a;
|
||||
K(this,a=J(this)+this.u);M(this,a>>8&256);this.a-=10},function(){this.b=this.J(Q(this));this.a-=13},function(){this.u=this.u-1&65535;this.a-=5},function(){this.b=bc(this,this.b);this.a-=5},function(){this.b=ac(this,this.b);this.a-=5},function(){this.b=P(this);this.a-=7},function(){M(this,L(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.c=this.D;this.a-=5},function(){this.c=this.f;this.a-=5},function(){this.c=this.F;this.a-=5},function(){this.c=this.g;this.a-=5},function(){this.c=this.i;
|
||||
this.a-=5},function(){this.c=this.J(J(this));this.a-=7},function(){this.c=this.b;this.a-=5},function(){this.D=this.c;this.a-=5},function(){this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.F;this.a-=5},function(){this.D=this.g;this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.J(J(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.f=this.c;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.a-=5},function(){this.f=this.F;this.a-=
|
||||
5},function(){this.f=this.g;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.J(J(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.F=this.c;this.a-=5},function(){this.F=this.D;this.a-=5},function(){this.F=this.f;this.a-=5},function(){this.a-=5},function(){this.F=this.g;this.a-=5},function(){this.F=this.i;this.a-=5},function(){this.F=this.J(J(this));this.a-=7},function(){this.F=this.b;this.a-=5},function(){this.g=this.c;this.a-=5},function(){this.g=this.D;this.a-=
|
||||
5},function(){this.g=this.f;this.a-=5},function(){this.g=this.F;this.a-=5},function(){this.a-=5},function(){this.g=this.i;this.a-=5},function(){this.g=this.J(J(this));this.a-=7},function(){this.g=this.b;this.a-=5},function(){this.i=this.c;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.F;this.a-=5},function(){this.i=this.g;this.a-=5},function(){this.a-=5},function(){this.i=this.J(J(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.aa(J(this),
|
||||
this.c);this.a-=7},function(){this.aa(J(this),this.D);this.a-=7},function(){this.aa(J(this),this.f);this.a-=7},function(){this.aa(J(this),this.F);this.a-=7},function(){this.aa(J(this),this.g);this.a-=7},function(){this.aa(J(this),this.i);this.a-=7},function(){var a=this.o-1;if(this.ra.length)for(var b=0;b<this.ra.length;b++)if(this.ra[b](a))return;this.a-=7;this.B|=256;Kb(this);this.C&512||Cb(this)},function(){this.aa(J(this),this.b);this.a-=7},function(){this.b=this.c;this.a-=5},function(){this.b=
|
||||
this.D;this.a-=5},function(){this.b=this.f;this.a-=5},function(){this.b=this.F;this.a-=5},function(){this.b=this.g;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.J(J(this));this.a-=7},function(){this.a-=5},function(){this.b=N(this,this.c);this.a-=4},function(){this.b=N(this,this.D);this.a-=4},function(){this.b=N(this,this.f);this.a-=4},function(){this.b=N(this,this.F);this.a-=4},function(){this.b=N(this,this.g);this.a-=4},function(){this.b=N(this,this.i);this.a-=4},function(){this.b=
|
||||
N(this,this.J(J(this)));this.a-=7},function(){this.b=N(this,this.b);this.a-=4},function(){this.b=Zb(this,this.c);this.a-=4},function(){this.b=Zb(this,this.D);this.a-=4},function(){this.b=Zb(this,this.f);this.a-=4},function(){this.b=Zb(this,this.F);this.a-=4},function(){this.b=Zb(this,this.g);this.a-=4},function(){this.b=Zb(this,this.i);this.a-=4},function(){this.b=Zb(this,this.J(J(this)));this.a-=7},function(){this.b=Zb(this,this.b);this.a-=4},function(){this.b=O(this,this.c);this.a-=4},function(){this.b=
|
||||
O(this,this.D);this.a-=4},function(){this.b=O(this,this.f);this.a-=4},function(){this.b=O(this,this.F);this.a-=4},function(){this.b=O(this,this.g);this.a-=4},function(){this.b=O(this,this.i);this.a-=4},function(){this.b=O(this,this.J(J(this)));this.a-=7},function(){this.b=O(this,this.b);this.a-=4},function(){this.b=dc(this,this.c);this.a-=4},function(){this.b=dc(this,this.D);this.a-=4},function(){this.b=dc(this,this.f);this.a-=4},function(){this.b=dc(this,this.F);this.a-=4},function(){this.b=dc(this,
|
||||
this.g);this.a-=4},function(){this.b=dc(this,this.i);this.a-=4},function(){this.b=dc(this,this.J(J(this)));this.a-=7},function(){this.b=dc(this,this.b);this.a-=4},function(){this.b=$b(this,this.c);this.a-=4},function(){this.b=$b(this,this.D);this.a-=4},function(){this.b=$b(this,this.f);this.a-=4},function(){this.b=$b(this,this.F);this.a-=4},function(){this.b=$b(this,this.g);this.a-=4},function(){this.b=$b(this,this.i);this.a-=4},function(){this.b=$b(this,this.J(J(this)));this.a-=7},function(){this.b=
|
||||
$b(this,this.b);this.a-=4},function(){this.b=ec(this,this.c);this.a-=4},function(){this.b=ec(this,this.D);this.a-=4},function(){this.b=ec(this,this.f);this.a-=4},function(){this.b=ec(this,this.F);this.a-=4},function(){this.b=ec(this,this.g);this.a-=4},function(){this.b=ec(this,this.i);this.a-=4},function(){this.b=ec(this,this.J(J(this)));this.a-=7},function(){this.b=ec(this,this.b);this.a-=4},function(){this.b=cc(this,this.c);this.a-=4},function(){this.b=cc(this,this.D);this.a-=4},function(){this.b=
|
||||
cc(this,this.f);this.a-=4},function(){this.b=cc(this,this.F);this.a-=4},function(){this.b=cc(this,this.g);this.a-=4},function(){this.b=cc(this,this.i);this.a-=4},function(){this.b=cc(this,this.J(J(this)));this.a-=7},function(){this.b=cc(this,this.b);this.a-=4},function(){O(this,this.c);this.a-=4},function(){O(this,this.D);this.a-=4},function(){O(this,this.f);this.a-=4},function(){O(this,this.F);this.a-=4},function(){O(this,this.g);this.a-=4},function(){O(this,this.i);this.a-=4},function(){O(this,
|
||||
this.J(J(this)));this.a-=7},function(){O(this,this.b);this.a-=4},function(){this.m&255&&(F(this,R(this)),this.a-=6);this.a-=5},function(){Vb(this,R(this));this.a-=10},function(){var a=Q(this);this.m&255&&F(this,a);this.a-=10},ic,function(){var a=Q(this);this.m&255&&(T(this,this.o),F(this,a),this.a-=6);this.a-=11},function(){T(this,Ub(this));this.a-=11},function(){this.b=N(this,P(this));this.a-=7},function(){T(this,this.o);F(this,0);this.a-=11},function(){this.m&255||(F(this,R(this)),this.a-=6);this.a-=
|
||||
5},jc,function(){var a=Q(this);this.m&255||F(this,a);this.a-=10},ic,function(){var a=Q(this);this.m&255||(T(this,this.o),F(this,a),this.a-=6);this.a-=11},kc,function(){this.b=Zb(this,P(this));this.a-=7},function(){T(this,this.o);F(this,8);this.a-=11},function(){L(this)||(F(this,R(this)),this.a-=6);this.a-=5},function(){Xb(this,R(this));this.a-=10},function(){var a=Q(this);L(this)||F(this,a);this.a-=10},function(){for(var a=P(this),b=this.j,c=this.b,d=this.o+-2&65535,e=1,f=0;0<e;){var h=b.o[a],g=b.C[a]||
|
||||
1,l=1==g?255:2==g?65535:-1,l=(c>>>=f)&l;if(void 0!==h&&h[0])h[0](a,l,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=Q(this);L(this)||(T(this,this.o),F(this,a),this.a-=6);this.a-=11},function(){T(this,Wb(this));this.a-=11},function(){this.b=O(this,P(this));this.a-=7},function(){T(this,this.o);F(this,16);this.a-=11},function(){L(this)&&(F(this,R(this)),this.a-=6);this.a-=5},jc,function(){var a=Q(this);L(this)&&F(this,a);this.a-=10},function(){for(var a=P(this),b=this.j,c=this.o+-2&65535,d=1,e=0,
|
||||
f=0;0<d;){var h=b.v[a],g=b.B[a]||1,l=1==g?255:2==g?65535:-1,n=l;void 0!==h&&h[0]&&(n=h[0](a,c),void 0===n?n=l:n&=l);e|=n<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=Q(this);L(this)&&(T(this,this.o),F(this,a),this.a-=6);this.a-=11},kc,function(){this.b=dc(this,P(this));this.a-=7},function(){T(this,this.o);F(this,24);this.a-=11},function(){Yb(this)||(F(this,R(this)),this.a-=6);this.a-=5},function(){K(this,R(this));this.a-=10},function(){var a=Q(this);Yb(this)||F(this,a);this.a-=10},
|
||||
function(){var a=R(this);T(this,J(this));K(this,a);this.a-=18},function(){var a=Q(this);Yb(this)||(T(this,this.o),F(this,a),this.a-=6);this.a-=11},function(){T(this,J(this));this.a-=11},function(){this.b=$b(this,P(this));this.a-=7},function(){T(this,this.o);F(this,32);this.a-=11},function(){Yb(this)&&(F(this,R(this)),this.a-=6);this.a-=5},function(){F(this,J(this));this.a-=5},function(){var a=Q(this);Yb(this)&&F(this,a);this.a-=10},function(){var a=J(this);K(this,Wb(this));Xb(this,a);this.a-=5},function(){var a=
|
||||
Q(this);Yb(this)&&(T(this,this.o),F(this,a),this.a-=6);this.a-=11},kc,function(){this.b=ec(this,P(this));this.a-=7},function(){T(this,this.o);F(this,40);this.a-=11},function(){this.s&128||(F(this,R(this)),this.a-=6);this.a-=5},function(){var a=R(this);Rb(this,a&255|this.C&-256);this.b=a>>8;this.a-=10},function(){var a=Q(this);this.s&128||F(this,a);this.a-=10},function(){this.C&=-513;this.a-=4},function(){var a=Q(this);this.s&128||(T(this,this.o),F(this,a),this.a-=6);this.a-=11},function(){T(this,
|
||||
Tb(this)&255|this.b<<8);this.a-=11},function(){this.b=cc(this,P(this));this.a-=7},function(){T(this,this.o);F(this,48);this.a-=11},function(){this.s&128&&(F(this,R(this)),this.a-=6);this.a-=5},function(){this.u=J(this)&65535;this.a-=5},function(){var a=Q(this);this.s&128&&F(this,a);this.a-=10},function(){this.C|=512;this.a-=4;fc(this)},function(){var a=Q(this);this.s&128&&(T(this,this.o),F(this,a),this.a-=6);this.a-=11},kc,function(){O(this,P(this));this.a-=7},function(){T(this,this.o);F(this,56);
|
||||
this.a-=11}];function V(a){r.call(this,"ChipSet",a,V);var b=a.model;b&&!lc[b]&&Aa("Unrecognized ChipSet model: "+b);this.c=lc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);D(this)}x(V);
|
||||
var X={ba:1978.1,zc:{ca:0,td:1,xd:16,Ed:32,Nd:64,Md:128,Fa:14},za:{ca:1,Pb:1,sc:2,oc:4,pc:16,qc:32,rc:64,Fa:8},Ac:{ca:2,sd:3,Wd:4,ud:8,Id:16,Jd:32,Kd:64,vd:128,Fa:0},Rd:{ca:3},Pd:{ca:2,Fd:7},Td:{ca:3,Xd:1,Sd:2,Ld:4,Cd:8,wd:16,md:32},Qd:{ca:4},Ud:{ca:5,yd:1,zd:2,Ad:4,Bd:8,Yd:16}},Y={ba:100,ka:{ca:66,wb:1,kc:2,lc:4,Hd:8,Gd:16,tb:32,sb:64,ob:128},Nb:{ca:66,INIT:0},wa:{ca:194,od:0,mb:16,uc:32,ub:48,Xb:0,Yb:32},Sa:{ca:162,Od:0,$b:0,Wb:0,Zb:0,Vb:0},ma:{Dd:{ca:98},Ba:{Kb:0,Jb:1,xc:2,Fc:4,Qb:5,vc:6,Vd:7},
|
||||
Va:16383}},lc={SI1978:X,VT100:Y};V.prototype.V=function(){return!1};V.prototype.qa=function(a,b,c,d){this.j=b;this.a=c;this.N=d;this.v=a;this.m=Va(a,"Keyboard");this.Z=Va(a,"SerialPort");this.video=Va(a,"Video");fb(b,this,this.c.ab);hb(b,this,this.c.bb)};V.prototype.ga=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};V.prototype.ia=function(a){return a?this.save():!0};X.INIT=[[X.zc.Fa,X.za.Fa,X.Ac.Fa,0,0,0,0]];
|
||||
Y.INIT=[[Y.Nb.INIT,Y.ka.kc|Y.ka.lc],[Y.wa.Xb,Y.wa.Yb],[Y.Sa.$b,Y.Sa.Wb,Y.Sa.Zb,Y.Sa.Vb],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];k=V.prototype;k.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.M("reset error")};
|
||||
k.save=function(){var a=new G(this);switch(this.c.ba){case X.ba:H(a,0,[this.W,this.g,this.X,this.C,this.H,this.S,this.T]);break;case Y.ba:H(a,0,[this.L,this.u]),H(a,1,[this.o,this.s]),H(a,2,[this.f,this.G,this.R,this.O]),H(a,3,[this.B,this.b,this.w,this.K,this.i])}return a.data()};
|
||||
k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.ba){case X.ba:return this.W=b[0],this.g=b[1],this.X=b[2],this.C=b[3],this.H=b[4],this.S=b[5],this.T=b[6],!0;case Y.ba:return this.L=b[0],this.u=b[1],b=a[1],this.o=b[0],this.s=b[1],b=a[2],this.f=b[0],this.G=b[1],this.R=b[2],this.O=b[3],b=a[3],this.B=b[0],this.b=b[1],this.w=b[2],this.K=b[3],this.i=b[4],!0}return!1};k.start=function(){};k.stop=function(){};k.Sc=function(){return this.W};k.Tc=function(){return this.g};k.Uc=function(){return this.X};
|
||||
k.Rc=function(){return this.C>>8-this.H&255};k.$c=function(a,b){this.H=b};k.bd=function(a,b){this.S=b};k.ad=function(a,b){this.C=b<<8|this.C>>8};k.cd=function(a,b){this.T=b};k.dd=function(){};function mc(a){var b=0,c=0,d=~a.B;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
|
||||
k.Vc=function(){var a=this.u,a=a&~Y.ka.sb;if((Gb(this.a)&64)<<1&&(a|=Y.ka.sb,a!=this.u)){var b,c;b=this.w&1;switch(this.w>>1&7){case Y.ma.Ba.Jb:this.B=this.B<<1|b;break;case Y.ma.Ba.Qb:b=mc(this);this.i[b]=Y.ma.Va;break;case Y.ma.Ba.Kb:this.b=this.b<<1|b;break;case Y.ma.Ba.Fc:b=mc(this);c=this.b&Y.ma.Va;this.i[b]=c;break;case Y.ma.Ba.vc:b=mc(this);c=this.i[b];null==c&&(c=Y.ma.Va);this.b=c;break;case Y.ma.Ba.xc:this.b<<=1,this.K=this.b&Y.ma.Va+1}}a&=~Y.ka.tb;this.K&&(a|=Y.ka.tb);a&=~Y.ka.ob;if(b=this.m){b=
|
||||
this.m;if(c=b.f)c=b.a,c=Gb(b.a)>=b.m+c.la*c.I/1E3*1.2731488;c&&(b.f=!1);b=!b.f}b&&(a|=Y.ka.ob);a&=~Y.ka.wb;this.Z&&this.Z.fa&1&&(a|=Y.ka.wb);return this.u=a};k.ed=function(a,b){this.L=b};k.hd=function(a,b){this.w=b};k.gd=function(a,b){var c=b&3;switch(b>>2&3){case 0:this.f=this.f&-4|c;break;case 1:this.f=this.f&-13|c<<2;if(this.video){var c=this.video,d=this.f;c.pa!==d&&((c.pa=d)?Lb(c,!0):c.sa=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.R=3-c}break;case 3:this.O=c}};
|
||||
k.fd=function(a,b){if(b&Y.wa.uc)b&=Y.wa.ub,this.s!=b&&(this.s=b,this.video&&(this.video.Db=this.s==Y.wa.ub?50:60));else if(b&=Y.wa.mb,this.o!=b&&(this.o=b,this.video)){var c=this.video,d=this.o==Y.wa.mb?132:80;c.K=d;c.U=c.xa;80<d&&c.U--;nc(c)&&oc(c)}};X.ab={0:V.prototype.Sc,1:V.prototype.Tc,2:V.prototype.Uc,3:V.prototype.Rc};X.bb={2:V.prototype.$c,3:V.prototype.bd,4:V.prototype.ad,5:V.prototype.cd,6:V.prototype.dd};Y.ab={66:V.prototype.Vc};
|
||||
Y.bb={66:V.prototype.ed,98:V.prototype.hd,162:V.prototype.gd,194:V.prototype.fd};ya(function(){for(var a=B(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new V(d);Pa(d,c)}});
|
||||
function pc(a){r.call(this,"ROM",a,pc);this.b=null;this.m=a.addr;this.c=a.size;this.v=a.writable;this.f=a.alias;this.g=a.file;this.o=ba(this.g);if(this.g){a=this.g;var b=ca(this.o);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;ma(a,null,!0,function(a,b,f){qc(c,a,b,f)})}}x(pc);var rc=[0,5];pc.prototype.qa=function(a,b,c,d){this.j=b;this.a=c;this.N=d;sc(this)};
|
||||
pc.prototype.ga=function(){this.i&&(this.N&&this.N.a(this.id,this.m,this.c,this.i),delete this.i);return!0};pc.prototype.ia=function(){return!0};
|
||||
function qc(a,b,c,d){if(d)a.M("Unable to load system ROM (error "+d+": "+b+")");else{La(a.Ua,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.b=f;else if(h)for(a.b=Array(4*h.length),d=c=0;c<h.length;c++)a.b[d++]=h[c]&255,a.b[d++]=h[c]>>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=e.symbols;if(!a.b.length){q("Empty ROM: "+b);return}if(1==a.b.length){q(a.b[0]);return}}catch(g){a.M("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=aa(b[e]);sc(a)}}
|
||||
function sc(a){if(!Ra(a))if(!a.g)C(a);else if(a.b&&a.j){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+m(a.b.length)+") does not match specified size ("+("0x"+m(a.c))+")";a.l.error=!0;a.M(b)}else if(tc(a,a.m)){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.j,h=d.c,g=[],l=d.m>>>f.j;0<h&&l<f.b.length;)g.push(f.b[l++]),h-=f.c;f=d.j;d=d.c;h=0;for(e>>>=f.j;0<d&&e<f.b.length;){l=g[h++];if(!l)break;f.b[e++]=l;d-=f.c}}delete a.b}C(a)}}
|
||||
function tc(a,b){if(Za(a.j,b,a.c,a.v?1:nb)){var c;for(c=0;c<a.b.length;c++)db(a.j,b+c,a.b[c]);if(a.v&&256==b){for(c=0;c<rc.length;c++)db(a.j,rc[c],118);Qb(a.a,function(a){return function(b){if(0<=rc.indexOf(b)){var c=!1,h=a.a,g=a.O;if(5==b)switch(c=!0,h.D){case 2:uc(a,String.fromCharCode(h.F));break;case 9:for(var l=Wb(h),n="",x=255;x--;){var t=a.a.L(l++);if(36==t)break;n+=String.fromCharCode(t)}uc(a,n);break;default:c=!1}c?jc.call(h):g&&(a.ca("\nCP/M vector 0x"+m(b,4)),E(h,b),Cb(g));b=!0}else b=
|
||||
!1;return b}}(a));Sb(a.a,b)}return!0}return!1}function uc(a,b){b=b.replace(/\r/g,"");a.ua&&(a.ua.value+=b,a.ua.scrollTop=a.ua.scrollHeight)}ya(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new pc(d);Pa(d,c)}});function vc(a){q.call(this,"RAM",a,vc);this.f=a.addr;this.c=a.size;this.b=!1}w(vc);k=vc.prototype;k.pa=function(a,b,c,d){this.j=b;this.a=c;this.O=d;C(this)};k.fa=function(a,b){b||this.reset();return!0};k.ha=function(a){return a?this.save():!0};
|
||||
k.reset=function(){!this.b&&this.c&&Za(this.j,this.f,this.c,1)&&(this.b=!0);this.b||p("No RAM allocated")};k.save=function(){return null};k.restore=function(){return!0};ya(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new vc(d);Pa(d,c)}});function Y(a){q.call(this,"Keyboard",a,Y);(a=a.model)&&!wc[a]&&Aa("Unrecognized Keyboard8080 model: "+a);this.b=wc[a]||{};this.reset();C(this)}w(Y);
|
||||
var xc={aa:1978.1,h:{},jb:{65:37,68:39,76:32},Fa:{},xa:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={aa:100,h:{},jb:{},Fa:{},xa:{setup:120},Gb:{ba:130,INIT:127},ga:{ba:130,Ub:1,Tb:2,Sb:4,Rb:8,Vb:16,nb:32,mb:63,fc:64,Oc:128,INIT:0},Qb:127};Z.h[46]=3;Z.h[80]=5;Z.h[79]=6;Z.h[89]=7;Z.h[84]=8;Z.h[87]=9;Z.h[81]=10;Z.h[39]=16;Z.h[221]=20;Z.h[219]=21;Z.h[73]=22;Z.h[85]=23;Z.h[82]=24;Z.h[69]=25;Z.h[49]=26;Z.h[37]=32;Z.h[40]=34;Z.h[117]=35;Z.h[19]=35;Z.h[192]=36;Z.h[189]=37;Z.h[57]=38;Z.h[55]=39;
|
||||
Z.h[52]=40;Z.h[51]=41;Z.h[27]=42;Z.h[38]=48;Z.h[114]=49;Z.h[112]=50;Z.h[8]=51;Z.h[187]=52;Z.h[48]=53;Z.h[56]=54;Z.h[54]=55;Z.h[53]=56;Z.h[50]=57;Z.h[9]=58;Z.h[103]=64;Z.h[115]=65;Z.h[113]=66;Z.h[96]=67;Z.h[118]=68;Z.h[220]=69;Z.h[76]=70;Z.h[75]=71;Z.h[71]=72;Z.h[70]=73;Z.h[65]=74;Z.h[104]=80;Z.h[2013]=81;Z.h[98]=82;Z.h[97]=83;Z.h[222]=85;Z.h[186]=86;Z.h[74]=87;Z.h[72]=88;Z.h[68]=89;Z.h[83]=90;Z.h[110]=96;Z.h[116]=97;Z.h[101]=98;Z.h[100]=99;Z.h[13]=100;Z.h[190]=101;Z.h[188]=102;Z.h[78]=103;
|
||||
Z.h[66]=104;Z.h[88]=105;Z.h[119]=106;Z.h[105]=112;Z.h[99]=113;Z.h[102]=114;Z.h[109]=115;Z.h[191]=117;Z.h[77]=118;Z.h[32]=119;Z.h[86]=120;Z.h[67]=121;Z.h[90]=122;Z.h[120]=123;Z.h[17]=124;Z.h[16]=125;Z.h[20]=126;Z.Fa={l4:Z.ga.Ub,l3:Z.ga.Tb,l2:Z.ga.Sb,l1:Z.ga.Rb,locked:Z.ga.Vb,local:Z.ga.nb,online:~Z.ga.nb};var wc={SI1978:xc,VT100:Z};
|
||||
Y.prototype.V=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.A[e]){if("led"==a&&this.b.Fa[b])return this.A[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return yc(d,a,!0)},c.onkeyup=function(a){return yc(d,a,!1)},!0;default:if(this.b.xa&&void 0!==this.b.xa[b])return this.A[e]=c,a=function(a,b){return function(c){c.preventDefault();Ac(a,b,!0)}}(this,this.b.xa[b]),b=function(a,b){return function(){Ac(a,b,!1)}}(this,this.b.xa[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
|
||||
b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};Y.prototype.pa=function(a,b,c,d){this.v=a;this.a=c;this.O=d;this.J=Va(a,"ChipSet");gb(b,this,this.b.$a);hb(b,this,this.b.ab)};Y.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Y.prototype.ha=function(a){return a?this.save():!0};Z.INIT=[[Z.ga.INIT,Z.Gb.INIT,!1,0,-1]];k=Y.prototype;k.reset=function(){this.j=[];this.b.INIT&&!this.restore(this.b.INIT)&&this.M("reset error")};
|
||||
k.save=function(){var a=new F(this);switch(this.b.aa){case Z.aa:G(a,0,[this.i,this.g,this.f,this.m,-1])}return a.data()};k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.aa){case xc.aa:return!0;case Z.aa:return this.i=b[0],Bc(this,this.i&Z.ga.mb),this.g=b[1],this.f=b[2],this.m=b[3],this.c=b[4],!0}return!1};function Bc(a,b){for(var c in a.b.Fa){var d=a.A["led-"+c];if(d){var e=a.b.Fa[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function yc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.b.jb[e]||e,!a.b.h[e]){for(var f in a.b.xa)if(a.b.xa[f]===e){e=f;break a}e=null}e&&(d=Ac(a,e,c),b.preventDefault());return d}
|
||||
function Ac(a,b,c){var d;a:{for(d=0;d<a.j.length;d++)if(a.j[d].ib==b)break a;d=-1}if(c)0>d?a.j.push({ib:b,fb:Date.now(),Wa:!1}):(a.j[d].fb=Date.now(),a.j[d].Wa=!1);else if(0<=d){if(!a.j[d].Wa){var e=a.j[d].fb;if(e&&100>Date.now()-e)return a.j[d].Wa=!0,Cc(a),!0}a.j.splice(d,1)}if(a.J){d=0;switch(b){case "1p":d=W.ya.Yb;break;case "2p":d=W.ya.bc;break;case "coin":d=W.ya.Ib;break;case "left":d=W.ya.$b;break;case "right":d=W.ya.ac;break;case "fire":d=W.ya.Zb}d&&(a=a.J,b=d,a.g&=~b,c&&(a.g|=b))}return!0}
|
||||
function Cc(a){for(var b=0,c=-1;b<a.j.length;){if(a.j[b].Wa){var d=a.j[b].ib,e=100-(Date.now()-a.j[b].fb);if(0<e){if(0>c||c>e)c=e}else{Ac(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Cc(a)},c)}k.rc=function(){var a=this.g;0<=this.c&&(this.c<this.j.length?(a=this.j[this.c],this.c++,a=Z.h[a.ib],a&128&&(a&=127)):(this.c=-1,a=Z.Qb),this.g=a,gc(this.a,1));return a};k.Ic=function(a,b){this.i=b;this.f=!0;this.m=Gb(this.a);Bc(this,b&Z.ga.mb);b&Z.ga.fc&&(this.c=0,gc(this.a,1))};Z.$a={130:Y.prototype.rc};
|
||||
Z.ab={130:Y.prototype.Ic};ya(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Y(d);Pa(d,c)}});
|
||||
function Dc(a,b,c,d,e){var f=this;this.Ka=sa("Gecko/");var h=["","moz","ms","webkit"];q.call(this,"Video",a,Dc);this.C=a.screenWidth;this.w=a.screenHeight;this.da=a.bufferAddr;this.uc=a.bufferRAM;var g=a.bufferFormat;this.S=g&&Ec[g.toUpperCase()]||Fc;this.J=a.bufferCols;this.W=a.bufferRows;this.va=this.U=a.cellWidth||1;this.T=a.cellHeight||1;this.X=null;this.Ja=!1;this.ka=a.bufferBits||1;this.vc=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.M("unsupported buffer rotation: "+
|
||||
this.c),this.c=0);this.la=a.interruptRate;this.Za=a.refreshRate||60;this.u=b;this.f=c;this.P=(this.Kc=d)||b||null;this.sc=this.C;this.tc=this.w;this.Ba=this.C/this.J|0;this.Ca=this.w/this.W|0;1<this.T&&(this.W++,this.oa=0,this.ra=!1);b=a.smoothing;(c=Fa.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.f[d]){this.f[d]=b;break}if(this.g=a.screenRotate)this.g=this.g%360,0<this.g&&(this.g-=360),-90!=this.g?(this.M("unsupported screen rotation: "+
|
||||
this.g),this.g=0):(this.f.translate(0,this.w),this.f.rotate(this.g*Math.PI/180),this.f.scale(this.w/this.C,this.C/this.w));if(this.b=e)if(this.b.Da=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.Da){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){Gc(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);
|
||||
break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){Gc(f,null)},!1);break}}if(this.H=a.fontROM)"json"!=ca(this.H)&&(this.H=ea()+"/api/v1/dump?file="+this.H+"&format=bytes"),ma(this.H,null,!0,function(a,b,c){Hc(f,a,b,c)});this.ta={}}w(Dc);var Fc=0,Ec={SI1978:1,VT100:2};
|
||||
function nc(a){a.o=a.J*a.U;a.G=a.W*a.T;var b=a.o,c=a.G;a.c&&(b=a.G,c=a.o);a.B=0;if(!a.uc&&(a.B=(a.o*a.ka>>3)*a.G,!Za(a.j,a.da,a.B,3)))return!1;a.B?(a.La=a.f.createImageData(b,c),a.Na=16/a.ka|0,Ic(a,a.B>>1)):Ic(a,(a.J+1)*a.W);a.s=document.createElement("canvas");a.s.width=b;a.s.height=c;a.qa=a.s.getContext("2d");a.I={};a.R=1<<a.ka;a.K=Array(a.R+2);a.K[0]=[0,0,0,255];a.K[1]=[255,255,255,255];1==a.S&&(a.K[a.R+0]=[255,255,0,255],a.K[a.R+1]=[0,255,0,255]);2==a.S&&(a.zb=60,a.sa=!1,a.Z=Array(a.J));return!0}
|
||||
Dc.prototype.pa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.O=d;nc(this);if(this.m=Va(a,"Keyboard")){for(var e in this.ta)this.m.V("led",e,this.ta[e]);this.u&&this.m.V(this.Kc?"textarea":"canvas","kbd",this.P)}var f=this;this.yb=Ib(this.a,function(){Mb(f)});Jb(this.a,this.yb,1E3/Math.max(this.Za,this.la));this.Ya=0;this.H||C(this)};
|
||||
function Hc(a,b,c,d){if(d)a.M("Unable to load font ROM (error "+d+": "+b+")");else{La(a.Ta,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){p("Empty font ROM: "+b);return}if(1==f.length){p(f[0]);return}if(2048==f.length)a.X=f,oc(a);else{a.M("Unrecognized font data length ("+f.length+")");return}}catch(h){a.M("Font ROM data error: "+h.message);return}(a.f||a.O)&&C(a)}}
|
||||
function oc(a){a.X&&(a.Ja=2==a.S,a.I[96]=[Jc(a,a.U,a.T),Jc(a,a.U,a.T,a.sa)],a.I[64]=[Jc(a,2*a.U,a.T),Jc(a,2*a.U,a.T,a.sa)],a.I[32]=a.I[0]=[Jc(a,2*a.U,2*a.T),Jc(a,2*a.U,2*a.T,a.sa)])}
|
||||
function Jc(a,b,c,d){var e=8>=a.va?8:16,f=8<e?15:0,h=a.X.length/e,g=!1===d,l={U:b,T:c};l.canvas=document.createElement("canvas");l.canvas.width=16*b;l.canvas.height=h/16*c;l.context=l.canvas.getContext("2d");for(var n=l.context.createImageData(b,c),x=0;x<h;x++){for(var t=0,B=t;t<a.T;t++)for(var u=x*e+(f+t&e-1),u=d&&8==t?255:a.X[u],y=0;y<c/a.T;y++){for(var v=0,H=0,V=H;H<a.U;H++){for(var R=u&128>>(7<H?7:H),v=a.Ja&&!R&&v?v:R,ka=0;ka<b/a.U;ka++)g&&(v=!v),Kc(a,n,V,B,v?1:0),V++;v=R}B++}l.context.putImageData(n,
|
||||
(x&15)*b,(x>>4)*c)}return l}Dc.prototype.fa=function(){return!0};Dc.prototype.V=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ta[b]=c,!0;switch(b){case "fullScreen":return this.A[b]=c,this.b&&this.b.Da?c.onclick=function(){d.Da()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
Dc.prototype.Da=function(){var a=!1;if(this.b){if(this.b.Da){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.C/this.w;b>c&&(a=Math.round(c/b*100)+"%")}this.Ka?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Da();a=!0}this.P&&this.P.focus()}return a};
|
||||
function Gc(a,b){!b&&a.b&&(a.Ka?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function Ic(a,b){a.Ma=b;a.N=!1;if(void 0===a.i||a.i.length!=a.Ma)a.i=Array(a.Ma)}function Kc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.S&&(208<=c&&236>c?e=a.R+0:28<=c&&72>c&&(e=a.R+1));a=a.K[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
|
||||
function Mb(a,b){var c=!0;if(!b){a.la&&(120==a.la?a.Ya&1?(gc(a.a,2),c=!1):gc(a.a,1):gc(a.a,4));if(c&&a.N&&a.B){for(var d=a.j,e=a.B,f=!0,h=a.da>>>d.j;0<e&&h<d.b.length;)d.b[h].ma&&(d.b[h].ma=f=!1,d.b[h].ub=!0),e-=d.c,h++;f&&(c=!1)}Jb(a.a,a.yb,1E3/Math.max(a.Za,a.la));a.Ya++}if(c)if(1<a.U)switch(a.S){case 2:for(var c=a.da,d=-1,e=0,f=60==a.zb?2:5,g=h=0,l=-1;e<a.W;){var n=0,x=c,t=d,B=a.J;for(96!=t&&(B>>=1);;){var u=bb(a.j,x++);if(127==(u&127)){var y=bb(a.j,x++),d=y&96,c=(y&15)<<8|bb(a.j,x),c=c+(y&16?
|
||||
8192:16384);break}if(n<B)a.Z[n++]=u;else break}if(f)f--;else{for(;n<a.Z.length;)a.Z[n++]=0;if(0<=t)for(x=a.N&&a.i[h]==B,a.i[h++]=B,B=0;B<n;B++){u=a.Z[B];if(!x||u!==a.i[h]){a.i[l=h]=u;var y=a,v=a.qa,H=u&127;if(u=y.I[t][u&128?1:0]){var V=(H&15)*u.U,H=(H>>4)*u.T,R=void 0,ka=void 0,Ca=void 0,eb=void 0,zc=u.U,Kb=u.T;v?(R=B*y.U,ka=e*y.T,Ca=y.U,eb=y.T):(R=B*y.Ba,ka=e*y.Ca,Ca=y.Ba,eb=y.Ca);u.U>y.U&&(R*=2,Ca*=2);u.T>y.T&&(0==t&&(H+=y.T),Kb=y.T);v?v.drawImage(u.canvas,V,H,zc,Kb,R,ka,Ca,eb):(R+=0,ka+=0,y.f.drawImage(u.canvas,
|
||||
V,H,zc,Kb,R,ka,Ca,eb))}g++}h++}e++}}a.N=!0;!b&&a.ra&&1==g&&(a.i[l]=-1,g=0);a.ra=!1;(g||b)&&a.qa&&a.f.drawImage(a.s,0,a.oa,a.o,a.G-a.T,0,0,a.sc,a.tc)}else{f=a.da;h=f+a.B;n=l=g=0;c=a.o;t=0;d=a.G;x=e=0;B=a.ka;y=(1<<B)-1;a.vc&&(B=-B,x=16+B);for(;f<h;){v=a.j;u=f;V=u&v.f;H=(u&v.g)>>>v.j;v=V!=v.f?v.b[H].Ab(V,u):v.b[H++].bb(V,u)|v.b[H&v.s].bb(0,u+1)<<8;if(a.N&&v===a.i[g])l+=a.Na;else{a.i[g]=v;(u=x)&&(v=v>>8|(v&255)<<8);l<c&&(c=l);for(V=a.Na;V--;)H=v>>u&y,Kc(a,a.La,l++,n,H),u+=B;l>t&&(t=l);n<d&&(d=n);n>=e&&
|
||||
(e=n+1)}f+=2;g++;if(l>=a.o&&(l=0,n++,n>a.G))break}a.N=!0;c<a.o&&(f=t-c,e-=d,a.c&&(h=c,g=f,c=d,f=e,d=a.o-(h+g),e=g),a.qa.putImageData(a.La,0,0,c,d,f,e),a.f.drawImage(a.s,0,0,a.s.width,a.s.height,0,0,a.C,a.w))}}
|
||||
ya(function(){for(var a=A(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=z(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Fa.aspect);f&&.3<=f&&3.33>=f&&(xa("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");sa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Dc(d,e,h,f,c);Pa(d,c)}});
|
||||
function Lc(a){this.I=+a.adapter;switch(this.I){case 0:this.K=0;this.P=2;break;default:p("Unrecognized serial adapter #"+this.I);return}this.b=this.c=null;this.N=a.tabSize;this.H=a.charBOL;this.f=0;this.C=!1;q.call(this,"SerialPort",a,Lc);var b=a.binding;if("console"==b)this.c="";else{var c;a=Mc;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.A[b])&&this.V(null,a,b))}this.g="";this.i=this.s=null;this.exports={connect:this.xb,receiveData:this.gb}}w(Lc);
|
||||
var Nc=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Oc=[!1,0,0,133,142,39,238],Mc="buffer";k=Lc.prototype;
|
||||
k.V=function(a,b,c,d){var e=this;switch(b){case Mc:return this.A[b]=this.b=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),Pc(e,b);return!0},c.onkeypress=function(a){a=a||window.event;Pc(e,a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.A[b]=c,d=d.replace(/\\e/g,String.fromCharCode(27)),c.onclick=function(){e.gb(d);return!0},
|
||||
!0}return!1};k.pa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.O=d;var e=this;this.R=Ib(this.a,function(){e.gb()});this.S=Ib(this.a,function(){e.ea|=5});this.J=Va(a,"ChipSet");gb(b,this,Qc,this.K);hb(b,this,Rc,this.K);C(this)};
|
||||
k.xb=function(){if(!this.i){var a=yb(this.v,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.Sa)return;b=ha(b[1]);if(this.i=Na(b)){var d=this.i.exports;if(d){var e=d.connect;e&&e.call(this.i);if(this.s=d.receiveData){this.status(this.Ta+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.fa=function(a,b){if(!b)if(this.xb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
k.ha=function(a){return a?this.save():!0};k.reset=function(){Sc(this)};k.save=function(){var a=new F(this),b=0,c=[];c[b++]=this.o;c[b++]=this.B;c[b++]=this.G;c[b++]=this.ea;c[b++]=this.m;c[b++]=this.w;c[b]=this.u;G(a,0,c);return a.data()};k.restore=function(a){return Sc(this,a[0])};function Sc(a,b){var c=0;void 0===b&&(b=Oc);a.o=b[c++];a.B=b[c++];a.G=b[c++];a.ea=b[c++];a.m=b[c++];a.w=b[c++];a.u=b[c];return!0}
|
||||
function Tc(a,b){var c=a.u&b;b&15||(c>>=4);var c=Nc[c],d=((a.m&12)>>2)+6;a.m&16&&d++;d+=((a.m&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function Pc(a,b){return a.C||a.ea&2?!1:(a.B=b,a.ea|=2,gc(a.a,a.P),!0)}k.gb=function(a){null!=a&&(this.g="number"!=typeof a?a:this.g+String.fromCharCode(a));this.g&&(Pc(this,this.g.charCodeAt(0))&&(this.g=this.g.substr(1)),this.g&&this.a&&Jb(this.a,this.R,Tc(this,15)));return!0};k.lc=function(){var a=this.B;this.ea&=-3;return a};k.kc=function(){return this.ea};
|
||||
k.yc=function(a,b){this.G=b;this.ea&=-6;if(19==b)this.C=!0;else if(17==b)this.C=!1;else if(this.s&&this.s.call(this.i,b),this.b)if(8==b)this.b.value=this.b.value.slice(0,-1),0<this.f&&this.f--;else{var c;c=(c=ia[b])?"<"+c+">":String.fromCharCode(b);var d=c.length;9==b?(d=this.N||8,d=d-this.f%d,this.N&&(c=" ".slice(0,d))):13==b&&(this.f=d=0,c="\n");this.H&&!this.f&&d&&(c=String.fromCharCode(this.H)+c);this.b.value+=c;this.b.scrollTop=this.b.scrollHeight;this.f+=
|
||||
d}else if(null!=this.c){if(10==b||1024<=this.c.length)this.ca(this.c),this.c="";10!=b&&(this.c+=String.fromCharCode(b))}this.a&&Jb(this.a,this.S,Tc(this,240))};k.xc=function(a,b){this.o?(this.w=b,this.w&64&&(this.o=!1)):(this.m=b,this.o=!0)};k.wc=function(a,b){this.u=b};var Qc={0:Lc.prototype.lc,1:Lc.prototype.kc},Rc={0:Lc.prototype.yc,1:Lc.prototype.xc,2:Lc.prototype.wc};ya(function(){for(var a=A(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Lc(d);Pa(d,c)}});
|
||||
function Uc(a,b,c){q.call(this,"Computer",a,Uc);this.l.Y=!1;Vc(this,b);this.w=yb(this,"autoPower",a);this.f=0;this.H=a.busWidth||a.buswidth;this.b=Wc;this.s=null;this.v=this.G=!1;this.I=yb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Xc(this);if(this.a=Oa("CPU",this.id)){this.O=Oa("Debugger",this.id);this.m=[];for(b=null;b=Va(this,"Video",b);)this.m.push(b);this.j=new Xa({id:this.Ta+".bus",busWidth:this.H},this.a,this.O);var d,e=Ma(this.id);if((this.g=Oa("Panel",this.id))&&this.g.ua)for(b=
|
||||
0;b<e.length;b++)d=e[b],d.M=this.g.M,d.ca=this.g.ca,d.ua=this.g.ua;this.ca("PC8080 v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.pa&&d.pa(this,this.j,this.a,this.O);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.o=d:this.b=parseInt(d,10));var f;if(a=yb(this,"state")||(f=!0,a.state))b=this.B=a,f||(this.v=!0,this.b=Wc),this.b&&(this.u=new F(this,"1.30.0"),Yc(this.u)?b=null:delete this.u);
|
||||
!b&&this.b&&(b=Zc(this))&&(this.v=!0);if(b){var h=this;ma(b,null,!0,function(a,b,c){c?(h.o=null,h.v=!1,h.M("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(h.s=b,h.G=!0);C(h)})}else C(this);this.A.power||(this.w=!0);!c&&this.w&&$c(this,this.Oa)}else p("Unable to find CPU component")}w(Uc);var Wc=0;function Vc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.J=b}
|
||||
function yb(a,b,c){var d=b.toLowerCase(),d=Fa[b]||Fa[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function $c(a,b,c){for(var d=Ma(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ra(f)){Ra(f,function(){$c(a,b,c)});return}}b.call(a,c)}
|
||||
function ad(a,b){var c=new F(a,"1.30.0","validate");if(Yc(c)&&bd(c)){var d=cd(c,"timestamp"),e=b?cd(b,"timestamp"):"unknown";d!=e&&(a.M("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Uc.prototype;
|
||||
k.Oa=function(a){void 0===a&&(a=this.b||(this.s?1:Wc));if(!this.f){this.f++;var b=!1,c=!1;this.C=!1;var d=this.u||new F(this,"1.30.0");if(-1==a)b=!0;else if(a>Wc){if(Yc(d,this.s)){this.i=new F(this,"1.30.0","failsafe");Yc(this.i)&&(dd(this,d),a=2,ed(this.i));G(this.i,"timestamp",la());fd(this.i);var e=this.b&&!this.v;if(1==a||na("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=bd(d)){var f=cd(d,"code"),h=cd(d,"data");f&&("ok"==f?Yc(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.M("Error: "+h),"unable to verify user"==h&&(ra("user",""),this.c=null)):this.ca(f+": "+h),ed(d),Yc(d)?(c=bd(d),e=!0):c=!1))}e&&ad(this,c?d:null)}else 2==a&&d.clear()}else ad(this);delete this.s;delete this.u}e=Ma(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=gd(this,h,d,b,c));b=[d,a,c];-1!=a?$c(this,this.tb,b):this.tb(b)}};
|
||||
function gd(a,b,c,d,e){if(!b.l.Y){b.l.Y=!0;if(b.fa){var f=null;e&&((f=cd(c,b.id))||(f=cd(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.fa(f,d)&&f&&(p("Unable to restore state for "+b.type),a.B&&!a.G?(c.clear(),a.b=Wc,window&&window.location.reload()):a.C=!0,b.fa(null),e=!1)}if(!d&&b.vb)for(a=b.vb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
k.tb=function(a){var b=a[0],c=0>a[1];a=a[2];this.K=!0;this.l.Y=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(gd(this,this.a,b,c,a),this.a.Ha());this.C&&(dd(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0};
|
||||
function dd(a,b){if(na("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.30.0"};e.url=a.I;e.user=c;e.type="bug";e.data=d;ma("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function hd(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new F(a,"1.30.0"),h=new F(a,"1.30.0","validate"),g=la();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.30.0");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ha&&(c&&Cb(a.a),d=a.a.ha(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.l.Y=!1,!1===d&&(e=null)));for(var g=Ma(a.id),l=0;l<g.length;l++){var n=g[l];n.l.Y&&(n.ha&&(d=n.ha(b,c),"object"===typeof d&&G(f,n.id,d)),c&&
|
||||
(n.l.Y=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&id(a,a.c,f.toString()),fd(h)&&fd(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.l.Y=!1,b=a.A.power)&&(b.textContent="Power");a.f=0;return e}k.reset=function(){this.j&&this.j.reset&&this.j.reset();for(var a=Ma(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.j&&c.reset&&c.reset()}};k.start=function(a,b){for(var c=Ma(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
|
||||
function sc(a){if(!Ra(a))if(!a.g)D(a);else if(a.b&&a.j){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+p(a.b.length)+") does not match specified size ("+("0x"+p(a.c))+")";a.l.error=!0;a.M(b)}else if(tc(a,a.m)){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.j,h=d.c,g=[],l=d.m>>>f.j;0<h&&l<f.b.length;)g.push(f.b[l++]),h-=f.c;f=d.j;d=d.c;h=0;for(e>>>=f.j;0<d&&e<f.b.length;){l=g[h++];if(!l)break;f.b[e++]=l;d-=f.c}}delete a.b}D(a)}}
|
||||
function tc(a,b){if(Za(a.j,b,a.c,a.v?1:nb)){var c;for(c=0;c<a.b.length;c++)db(a.j,b+c,a.b[c]);if(a.v&&256==b){for(c=0;c<rc.length;c++)db(a.j,rc[c],118);Qb(a.a,function(a){return function(b){if(0<=rc.indexOf(b)){var c=!1,h=a.a,g=a.N;if(5==b)switch(c=!0,h.D){case 2:uc(a,String.fromCharCode(h.F));break;case 9:for(var l=Wb(h),n="",y=255;y--;){var t=a.a.J(l++);if(36==t)break;n+=String.fromCharCode(t)}uc(a,n);break;default:c=!1}c?jc.call(h):g&&(a.da("\nCP/M vector 0x"+p(b,4)),F(h,b),Cb(g));b=!0}else b=
|
||||
!1;return b}}(a));Sb(a.a,b)}return!0}return!1}function uc(a,b){b=b.replace(/\r/g,"");a.va&&(a.va.value+=b,a.va.scrollTop=a.va.scrollHeight)}ya(function(){for(var a=B(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new pc(d);Pa(d,c)}});function vc(a){r.call(this,"RAM",a,vc);this.f=a.addr;this.c=a.size;this.b=!1}x(vc);k=vc.prototype;k.qa=function(a,b,c,d){this.j=b;this.a=c;this.N=d;D(this)};k.ga=function(a,b){b||this.reset();return!0};k.ia=function(a){return a?this.save():!0};
|
||||
k.reset=function(){!this.b&&this.c&&Za(this.j,this.f,this.c,1)&&(this.b=!0);this.b||q("No RAM allocated")};k.save=function(){return null};k.restore=function(){return!0};ya(function(){for(var a=B(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new vc(d);Pa(d,c)}});function wc(a){r.call(this,"Keyboard",a,wc);(a=a.model)&&!xc[a]&&Aa("Unrecognized Keyboard8080 model: "+a);this.b=xc[a]||{};this.reset();D(this)}x(wc);var yc={};yc[m.kb]=37;yc[m.nb]=39;yc[m.pb]=32;
|
||||
var zc={ba:1978.1,h:{},lb:yc,Ga:{},ya:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={ba:100,h:{},lb:{},Ga:{},ya:{setup:120},Lb:{ca:130,INIT:127},ha:{ca:130,gc:1,fc:2,ec:4,dc:8,hc:16,rb:32,qb:63,yc:64,nd:128,INIT:0},cc:127};Z.h[46]=3;Z.h[m.nc]=5;Z.h[m.mc]=6;Z.h[m.Hc]=7;Z.h[m.Bc]=8;Z.h[m.Ec]=9;Z.h[m.Q]=10;Z.h[39]=16;Z.h[221]=20;Z.h[219]=21;Z.h[m.Ub]=22;Z.h[m.Cc]=23;Z.h[m.tc]=24;Z.h[m.E]=25;Z.h[49]=26;Z.h[37]=32;Z.h[40]=34;Z.h[117]=35;Z.h[19]=35;Z.h[192]=36;Z.h[189]=37;Z.h[57]=38;Z.h[55]=39;
|
||||
Z.h[52]=40;Z.h[51]=41;Z.h[27]=42;Z.h[38]=48;Z.h[114]=49;Z.h[112]=50;Z.h[8]=51;Z.h[187]=52;Z.h[48]=53;Z.h[56]=54;Z.h[54]=55;Z.h[53]=56;Z.h[50]=57;Z.h[9]=58;Z.h[103]=64;Z.h[115]=65;Z.h[113]=66;Z.h[96]=67;Z.h[118]=68;Z.h[220]=69;Z.h[m.pb]=70;Z.h[m.bc]=71;Z.h[m.Sb]=72;Z.h[m.Rb]=73;Z.h[m.kb]=74;Z.h[104]=80;Z.h[2013]=81;Z.h[98]=82;Z.h[97]=83;Z.h[222]=85;Z.h[186]=86;Z.h[m.ac]=87;Z.h[m.Tb]=88;Z.h[m.nb]=89;Z.h[m.wc]=90;Z.h[110]=96;Z.h[116]=97;Z.h[101]=98;Z.h[100]=99;Z.h[13]=100;Z.h[190]=101;Z.h[188]=102;
|
||||
Z.h[m.jc]=103;Z.h[m.Mb]=104;Z.h[m.Gc]=105;Z.h[119]=106;Z.h[105]=112;Z.h[99]=113;Z.h[102]=114;Z.h[109]=115;Z.h[191]=117;Z.h[m.ic]=118;Z.h[m[" "]]=119;Z.h[m.Dc]=120;Z.h[m.Ob]=121;Z.h[m.Ic]=122;Z.h[120]=123;Z.h[17]=124;Z.h[16]=125;Z.h[20]=126;Z.Ga={l4:Z.ha.gc,l3:Z.ha.fc,l2:Z.ha.ec,l1:Z.ha.dc,locked:Z.ha.hc,local:Z.ha.rb,online:~Z.ha.rb};var xc={SI1978:zc,VT100:Z};
|
||||
wc.prototype.V=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.A[e]){if("led"==a&&this.b.Ga[b])return this.A[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Ac(d,a,!0)},c.onkeyup=function(a){return Ac(d,a,!1)},!0;default:if(this.b.ya&&void 0!==this.b.ya[b])return this.A[e]=c,a=function(a,b){return function(c){c.preventDefault();Cc(a,b,!0)}}(this,this.b.ya[b]),b=function(a,b){return function(){Cc(a,b,!1)}}(this,this.b.ya[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
|
||||
b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};wc.prototype.qa=function(a,b,c,d){this.v=a;this.a=c;this.N=d;this.K=Va(a,"ChipSet");fb(b,this,this.b.ab);hb(b,this,this.b.bb)};wc.prototype.ga=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};wc.prototype.ia=function(a){return a?this.save():!0};Z.INIT=[[Z.ha.INIT,Z.Lb.INIT,!1,0,-1]];k=wc.prototype;k.reset=function(){this.j=[];this.b.INIT&&!this.restore(this.b.INIT)&&this.M("reset error")};
|
||||
k.save=function(){var a=new G(this);switch(this.b.ba){case Z.ba:H(a,0,[this.i,this.g,this.f,this.m,-1])}return a.data()};k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.ba){case zc.ba:return!0;case Z.ba:return this.i=b[0],Dc(this,this.i&Z.ha.qb),this.g=b[1],this.f=b[2],this.m=b[3],this.c=b[4],!0}return!1};function Dc(a,b){for(var c in a.b.Ga){var d=a.A["led-"+c];if(d){var e=a.b.Ga[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function Ac(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.b.lb[e]||e,!a.b.h[e]){for(var f in a.b.ya)if(a.b.ya[f]===e){e=f;break a}e=null}e&&(d=Cc(a,e,c),b.preventDefault());return d}
|
||||
function Cc(a,b,c){var d;a:{for(d=0;d<a.j.length;d++)if(a.j[d].jb==b)break a;d=-1}if(c)0>d?a.j.push({jb:b,gb:Date.now(),Za:!1}):(a.j[d].gb=Date.now(),a.j[d].Za=!1);else if(0<=d){if(!a.j[d].Za){var e=a.j[d].gb;if(e&&100>Date.now()-e)return a.j[d].Za=!0,Ec(a),!0}a.j.splice(d,1)}if(a.K){d=0;switch(b){case "1p":d=X.za.oc;break;case "2p":d=X.za.sc;break;case "coin":d=X.za.Pb;break;case "left":d=X.za.qc;break;case "right":d=X.za.rc;break;case "fire":d=X.za.pc}d&&(a=a.K,b=d,a.g&=~b,c&&(a.g|=b))}return!0}
|
||||
function Ec(a){for(var b=0,c=-1;b<a.j.length;){if(a.j[b].Za){var d=a.j[b].jb,e=100-(Date.now()-a.j[b].gb);if(0<e){if(0>c||c>e)c=e}else{Cc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Ec(a)},c)}k.Wc=function(){var a=this.g;0<=this.c&&(this.c<this.j.length?(a=this.j[this.c],this.c++,a=Z.h[a.jb],a&128&&(a&=127)):(this.c=-1,a=Z.cc),this.g=a,gc(this.a,1));return a};k.jd=function(a,b){this.i=b;this.f=!0;this.m=Gb(this.a);Dc(this,b&Z.ha.qb);b&Z.ha.yc&&(this.c=0,gc(this.a,1))};Z.ab={130:wc.prototype.Wc};
|
||||
Z.bb={130:wc.prototype.jd};ya(function(){for(var a=B(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new wc(d);Pa(d,c)}});
|
||||
function Fc(a,b,c,d,e){var f=this;this.Ia=sa("Gecko/");var h=["","moz","ms","webkit"];r.call(this,"Video",a,Fc);this.C=a.screenWidth;this.w=a.screenHeight;this.ea=a.bufferAddr;this.Kc=a.bufferRAM;var g=a.bufferFormat;this.T=g&&Gc[g.toUpperCase()]||Hc;this.K=a.bufferCols;this.W=a.bufferRows;this.xa=this.U=a.cellWidth||1;this.P=a.cellHeight||1;this.X=null;this.Ha=!1;this.ja=a.bufferBits||1;this.Lc=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.M("unsupported buffer rotation: "+
|
||||
this.c),this.c=0);this.la=a.interruptRate;this.Xa=a.refreshRate||60;this.u=b;this.f=c;this.R=(this.Oc=d)||b||null;this.Jc=this.C;this.Ib=this.w;this.Ca=this.C/this.K|0;this.Da=this.w/this.W|0;1<this.P&&(this.W++,this.pa=0,this.sa=!1);b=a.smoothing;(c=Fa.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.f[d]){this.f[d]=b;break}if(this.g=a.screenRotate)this.g=this.g%360,0<this.g&&(this.g-=360),-90!=this.g?(this.M("unsupported screen rotation: "+
|
||||
this.g),this.g=0):(this.f.translate(0,this.w),this.f.rotate(this.g*Math.PI/180),this.f.scale(this.w/this.C,this.C/this.w));if(this.b=e)if(this.b.Ea=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.Ea){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){Ic(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);
|
||||
break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){Ic(f,null)},!1);break}}if(this.H=a.fontROM)"json"!=ca(this.H)&&(this.H=ea()+"/api/v1/dump?file="+this.H+"&format=bytes"),ma(this.H,null,!0,function(a,b,c){Jc(f,a,b,c)});this.ua={}}x(Fc);var Hc=0,Gc={SI1978:1,VT100:2};
|
||||
function nc(a){a.o=a.K*a.U;a.G=a.W*a.P;var b=a.o,c=a.G;a.c&&(b=a.G,c=a.o);a.B=0;if(!a.Kc&&(a.B=(a.o*a.ja>>3)*a.G,!Za(a.j,a.ea,a.B,3)))return!1;a.B?(a.Ja=a.f.createImageData(b,c),a.La=16/a.ja|0,Kc(a,a.B>>1)):Kc(a,(a.K+1)*a.W);a.s=document.createElement("canvas");a.s.width=b;a.s.height=c;a.ra=a.s.getContext("2d");a.I={};a.S=1<<a.ja;a.L=Array(a.S+2);a.L[0]=[0,0,0,255];a.L[1]=[255,255,255,255];1==a.T&&(a.L[a.S+0]=[255,255,0,255],a.L[a.S+1]=[0,255,0,255]);2==a.T&&(a.Db=60,a.ta=!1,a.Z=Array(a.K));return!0}
|
||||
Fc.prototype.qa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.N=d;nc(this);if(this.m=Va(a,"Keyboard")){for(var e in this.ua)this.m.V("led",e,this.ua[e]);this.u&&this.m.V(this.Oc?"textarea":"canvas","kbd",this.R)}var f=this;this.xb=Ib(this.a,function(){Lb(f)});Jb(this.a,this.xb,1E3/Math.max(this.Xa,this.la));this.Wa=0;this.H||D(this)};
|
||||
function Jc(a,b,c,d){if(d)a.M("Unable to load font ROM (error "+d+": "+b+")");else{La(a.Ua,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){q("Empty font ROM: "+b);return}if(1==f.length){q(f[0]);return}if(2048==f.length)a.X=f,oc(a);else{a.M("Unrecognized font data length ("+f.length+")");return}}catch(h){a.M("Font ROM data error: "+h.message);return}(a.f||a.N)&&D(a)}}
|
||||
function oc(a){a.X&&(a.Ha=2==a.T,a.I[96]=[Lc(a,a.U,a.P),Lc(a,a.U,a.P,a.ta)],a.I[64]=[Lc(a,2*a.U,a.P),Lc(a,2*a.U,a.P,a.ta)],a.I[32]=a.I[0]=[Lc(a,2*a.U,2*a.P),Lc(a,2*a.U,2*a.P,a.ta)])}
|
||||
function Lc(a,b,c,d){var e=8>=a.xa?8:16,f=8<e?15:0,h=a.X.length/e,g=!1===d,l={U:b,P:c};l.canvas=document.createElement("canvas");l.canvas.width=16*b;l.canvas.height=h/16*c;l.context=l.canvas.getContext("2d");for(var n=l.context.createImageData(b,c),y=0;y<h;y++){for(var t=0,C=t;t<a.P;t++)for(var v=y*e+(f+t&e-1),v=d&&8==t?255:a.X[v],z=0;z<c/a.P;z++){for(var w=0,I=0,W=I;I<a.U;I++){for(var S=v&128>>(7<I?7:I),w=a.Ha&&!S&&w?w:S,la=0;la<b/a.U;la++)g&&(w=!w),Mc(a,n,W,C,w?1:0),W++;w=S}C++}l.context.putImageData(n,
|
||||
(y&15)*b,(y>>4)*c)}return l}Fc.prototype.ga=function(){return!0};Fc.prototype.V=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ua[b]=c,!0;switch(b){case "fullScreen":return this.A[b]=c,this.b&&this.b.Ea?c.onclick=function(){d.Ea()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
Fc.prototype.Ea=function(){var a=!1;if(this.b){if(this.b.Ea){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.C/this.w;b>c&&(a=Math.round(c/b*100)+"%")}this.Ia?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Ea();a=!0}this.R&&this.R.focus()}return a};
|
||||
function Ic(a,b){!b&&a.b&&(a.Ia?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function Kc(a,b){a.Ka=b;a.O=!1;if(void 0===a.i||a.i.length!=a.Ka)a.i=Array(a.Ka)}function Mc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.T&&(208<=c&&236>c?e=a.S+0:28<=c&&72>c&&(e=a.S+1));a=a.L[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
|
||||
function Lb(a,b){var c=!0;if(!b){a.la&&(120==a.la?a.Wa&1?(gc(a.a,2),c=!1):gc(a.a,1):gc(a.a,4));if(c&&a.O&&a.B){for(var d=a.j,e=a.B,f=!0,h=a.ea>>>d.j;0<e&&h<d.b.length;)d.b[h].na&&(d.b[h].na=f=!1,d.b[h].Ab=!0),e-=d.c,h++;f&&(c=!1)}Jb(a.a,a.xb,1E3/Math.max(a.Xa,a.la));a.Wa++}if(c)if(1<a.U)switch(a.T){case 2:for(var c=a.ea,d=-1,e=0,f=60==a.Db?2:5,g=h=0,l=-1;e<a.W;){var n=0,y=c,t=d,C=a.K;for(96!=t&&(C>>=1);;){var v=bb(a.j,y++);if(127==(v&127)){var z=bb(a.j,y++),d=z&96,c=(z&15)<<8|bb(a.j,y),c=c+(z&16?
|
||||
8192:16384);break}if(n<C)a.Z[n++]=v;else break}if(f)f--;else{for(;n<a.Z.length;)a.Z[n++]=0;if(0<=t)for(y=a.O&&a.i[h]==C,a.i[h++]=C,C=0;C<n;C++){v=a.Z[C];if(!y||v!==a.i[h]){a.i[l=h]=v;var z=a,w=a.ra,I=v&127;if(v=z.I[t][v&128?1:0]){var W=(I&15)*v.U,I=(I>>4)*v.P,S=void 0,la=void 0,Da=void 0,gb=void 0,Bc=v.U,Mb=v.P;w?(S=C*z.U,la=e*z.P,Da=z.U,gb=z.P):(S=C*z.Ca,la=e*z.Da,Da=z.Ca,gb=z.Da);v.U>z.U&&(S*=2,Da*=2);v.P>z.P&&(0==t&&(I+=z.P),Mb=z.P);w?w.drawImage(v.canvas,W,I,Bc,Mb,S,la,Da,gb):(S+=0,la+=0,z.f.drawImage(v.canvas,
|
||||
W,I,Bc,Mb,S,la,Da,gb))}g++}h++}e++}}a.O=!0;!b&&a.sa&&1==g&&(a.i[l]=-1,g=0);a.sa=!1;(g||b)&&a.ra&&a.f.drawImage(a.s,0,a.pa,a.o,a.G-a.P,0,0,a.Jc,a.Ib)}else{f=a.ea;h=f+a.B;n=l=g=0;c=a.o;t=0;d=a.G;y=e=0;C=a.ja;z=(1<<C)-1;a.Lc&&(C=-C,y=16+C);for(;f<h;){w=a.j;v=f;W=v&w.f;I=(v&w.g)>>>w.j;w=W!=w.f?w.b[I].Eb(W,v):w.b[I++].cb(W,v)|w.b[I&w.s].cb(0,v+1)<<8;if(a.O&&w===a.i[g])l+=a.La;else{a.i[g]=w;(v=y)&&(w=w>>8|(w&255)<<8);l<c&&(c=l);for(W=a.La;W--;)I=w>>v&z,Mc(a,a.Ja,l++,n,I),v+=C;l>t&&(t=l);n<d&&(d=n);n>=e&&
|
||||
(e=n+1)}f+=2;g++;if(l>=a.o&&(l=0,n++,n>a.G))break}a.O=!0;c<a.o&&(f=t-c,e-=d,a.c&&(h=c,g=f,c=d,f=e,d=a.o-(h+g),e=g),a.ra.putImageData(a.Ja,0,0,c,d,f,e),a.f.drawImage(a.s,0,0,a.s.width,a.s.height,0,0,a.C,a.w))}}
|
||||
ya(function(){for(var a=B(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=A(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Fa.aspect);f&&.3<=f&&3.33>=f&&(xa("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");sa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Fc(d,e,h,f,c);Pa(d,c)}});
|
||||
function Nc(a){this.I=+a.adapter;switch(this.I){case 0:this.L=0;this.R=2;break;default:q("Unrecognized serial adapter #"+this.I);return}this.b=this.c=null;this.O=a.tabSize;this.H=a.charBOL;this.f=0;this.C=!1;r.call(this,"SerialPort",a,Nc);var b=a.binding;if("console"==b)this.c="";else{var c;a=Oc;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.A[b])&&this.V(null,a,b))}this.g="";this.i=this.s=null;this.exports={connect:this.Cb,receiveData:this.hb}}x(Nc);
|
||||
var Pc=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Qc=[!1,0,0,133,142,39,238],Oc="buffer";k=Nc.prototype;
|
||||
k.V=function(a,b,c,d){var e=this;switch(b){case Oc:return this.A[b]=this.b=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),Rc(e,b);return!0},c.onkeypress=function(a){a=a||window.event;Rc(e,a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.A[b]=c,d=d.replace(/\\e/g,String.fromCharCode(27)),c.onclick=function(){e.hb(d);return!0},
|
||||
!0}return!1};k.qa=function(a,b,c,d){this.v=a;this.j=b;this.a=c;this.N=d;var e=this;this.S=Ib(this.a,function(){e.hb()});this.T=Ib(this.a,function(){e.fa|=5});this.K=Va(a,"ChipSet");fb(b,this,Sc,this.L);hb(b,this,Tc,this.L);D(this)};
|
||||
k.Cb=function(){if(!this.i){var a=yb(this.v,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.Ta)return;b=ha(b[1]);if(this.i=Na(b)){var d=this.i.exports;if(d){var e=d.connect;e&&e.call(this.i);if(this.s=d.receiveData){this.status(this.Ua+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.ga=function(a,b){if(!b)if(this.Cb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
k.ia=function(a){return a?this.save():!0};k.reset=function(){Uc(this)};k.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.o;c[b++]=this.B;c[b++]=this.G;c[b++]=this.fa;c[b++]=this.m;c[b++]=this.w;c[b]=this.u;H(a,0,c);return a.data()};k.restore=function(a){return Uc(this,a[0])};function Uc(a,b){var c=0;void 0===b&&(b=Qc);a.o=b[c++];a.B=b[c++];a.G=b[c++];a.fa=b[c++];a.m=b[c++];a.w=b[c++];a.u=b[c];return!0}
|
||||
function Vc(a,b){var c=a.u&b;b&15||(c>>=4);var c=Pc[c],d=((a.m&12)>>2)+6;a.m&16&&d++;d+=((a.m&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function Rc(a,b){return a.C||a.fa&2?!1:(a.B=b,a.fa|=2,gc(a.a,a.R),!0)}k.hb=function(a){null!=a&&(this.g="number"!=typeof a?a:this.g+String.fromCharCode(a));this.g&&(Rc(this,this.g.charCodeAt(0))&&(this.g=this.g.substr(1)),this.g&&this.a&&Jb(this.a,this.S,Vc(this,15)));return!0};k.Qc=function(){var a=this.B;this.fa&=-3;return a};k.Pc=function(){return this.fa};
|
||||
k.Zc=function(a,b){this.G=b;this.fa&=-6;if(19==b)this.C=!0;else if(17==b)this.C=!1;else if(this.s&&this.s.call(this.i,b),this.b)if(8==b)this.b.value=this.b.value.slice(0,-1),0<this.f&&this.f--;else{var c;c=(c=ia[b])?"<"+c+">":String.fromCharCode(b);var d=c.length;9==b?(d=this.O||8,d=d-this.f%d,this.O&&(c=" ".slice(0,d))):13==b&&(this.f=d=0,c="\n");this.H&&!this.f&&d&&(c=String.fromCharCode(this.H)+c);this.b.value+=c;this.b.scrollTop=this.b.scrollHeight;this.f+=
|
||||
d}else if(null!=this.c){if(10==b||1024<=this.c.length)this.da(this.c),this.c="";10!=b&&(this.c+=String.fromCharCode(b))}this.a&&Jb(this.a,this.T,Vc(this,240))};k.Yc=function(a,b){this.o?(this.w=b,this.w&64&&(this.o=!1)):(this.m=b,this.o=!0)};k.Xc=function(a,b){this.u=b};var Sc={0:Nc.prototype.Qc,1:Nc.prototype.Pc},Tc={0:Nc.prototype.Zc,1:Nc.prototype.Yc,2:Nc.prototype.Xc};ya(function(){for(var a=B(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Nc(d);Pa(d,c)}});
|
||||
function Wc(a,b,c){r.call(this,"Computer",a,Wc);this.l.Y=!1;Xc(this,b);this.w=yb(this,"autoPower",a);this.f=0;this.H=a.busWidth||a.buswidth;this.b=Yc;this.s=null;this.v=this.G=!1;this.I=yb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Zc(this);if(this.a=Oa("CPU",this.id)){this.N=Oa("Debugger",this.id);this.m=[];for(b=null;b=Va(this,"Video",b);)this.m.push(b);this.j=new Xa({id:this.Ua+".bus",busWidth:this.H},this.a,this.N);var d,e=Ma(this.id);if((this.g=Oa("Panel",this.id))&&this.g.va)for(b=
|
||||
0;b<e.length;b++)d=e[b],d.M=this.g.M,d.da=this.g.da,d.va=this.g.va;this.da("PC8080 v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.qa&&d.qa(this,this.j,this.a,this.N);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.o=d:this.b=parseInt(d,10));var f;if(a=yb(this,"state")||(f=!0,a.state))b=this.B=a,f||(this.v=!0,this.b=Yc),this.b&&(this.u=new G(this,"1.30.0"),$c(this.u)?b=null:delete this.u);
|
||||
!b&&this.b&&(b=ad(this))&&(this.v=!0);if(b){var h=this;ma(b,null,!0,function(a,b,c){c?(h.o=null,h.v=!1,h.M("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(h.s=b,h.G=!0);D(h)})}else D(this);this.A.power||(this.w=!0);!c&&this.w&&bd(this,this.Pa)}else q("Unable to find CPU component")}x(Wc);var Yc=0;function Xc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.K=b}
|
||||
function yb(a,b,c){var d=b.toLowerCase(),d=Fa[b]||Fa[d];void 0===d&&a.K&&(d=a.K[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function bd(a,b,c){for(var d=Ma(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ra(f)){Ra(f,function(){bd(a,b,c)});return}}b.call(a,c)}
|
||||
function cd(a,b){var c=new G(a,"1.30.0","validate");if($c(c)&&dd(c)){var d=ed(c,"timestamp"),e=b?ed(b,"timestamp"):"unknown";d!=e&&(a.M("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Wc.prototype;
|
||||
k.Pa=function(a){void 0===a&&(a=this.b||(this.s?1:Yc));if(!this.f){this.f++;var b=!1,c=!1;this.C=!1;var d=this.u||new G(this,"1.30.0");if(-1==a)b=!0;else if(a>Yc){if($c(d,this.s)){this.i=new G(this,"1.30.0","failsafe");$c(this.i)&&(fd(this,d),a=2,gd(this.i));H(this.i,"timestamp",ka());hd(this.i);var e=this.b&&!this.v;if(1==a||na("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=dd(d)){var f=ed(d,"code"),h=ed(d,"data");f&&("ok"==f?$c(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.M("Error: "+h),"unable to verify user"==h&&(ra("user",""),this.c=null)):this.da(f+": "+h),gd(d),$c(d)?(c=dd(d),e=!0):c=!1))}e&&cd(this,c?d:null)}else 2==a&&d.clear()}else cd(this);delete this.s;delete this.u}e=Ma(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=id(this,h,d,b,c));b=[d,a,c];-1!=a?bd(this,this.zb,b):this.zb(b)}};
|
||||
function id(a,b,c,d,e){if(!b.l.Y){b.l.Y=!0;if(b.ga){var f=null;e&&((f=ed(c,b.id))||(f=ed(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ga(f,d)&&f&&(q("Unable to restore state for "+b.type),a.B&&!a.G?(c.clear(),a.b=Yc,window&&window.location.reload()):a.C=!0,b.ga(null),e=!1)}if(!d&&b.vb)for(a=b.vb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
k.zb=function(a){var b=a[0],c=0>a[1];a=a[2];this.L=!0;this.l.Y=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(id(this,this.a,b,c,a),this.a.Na());this.C&&(fd(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0};
|
||||
function fd(a,b){if(na("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.30.0"};e.url=a.I;e.user=c;e.type="bug";e.data=d;ma("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function jd(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new G(a,"1.30.0"),h=new G(a,"1.30.0","validate"),g=ka();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.30.0");H(f,"url",window?window.location.href:null);H(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ia&&(c&&Cb(a.a),d=a.a.ia(b,c),"object"===typeof d&&H(f,a.a.id,d),c&&(a.a.l.Y=!1,!1===d&&(e=null)));for(var g=Ma(a.id),l=0;l<g.length;l++){var n=g[l];n.l.Y&&(n.ia&&(d=n.ia(b,c),"object"===typeof d&&H(f,n.id,d)),c&&
|
||||
(n.l.Y=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&kd(a,a.c,f.toString()),hd(h)&&hd(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.l.Y=!1,b=a.A.power)&&(b.textContent="Power");a.f=0;return e}k.reset=function(){this.j&&this.j.reset&&this.j.reset();for(var a=Ma(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.j&&c.reset&&c.reset()}};k.start=function(a,b){for(var c=Ma(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
|
||||
k.stop=function(a,b){for(var c=Ma(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
k.V=function(a,b,c){var d=this;switch(b){case "power":return this.A[b]=c,c.onclick=function(){d.f||(d.l.Y?hd(d,!1,!0):$c(d,d.Oa))},!0;case "reset":return this.A[b]=c,c.onclick=function(){if(d.l.Y&&!d.f)if(d.b&&!d.o){var a=na("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");hd(d,a,!0);!a&&d.B?window&&window.location.reload():d.Oa(Wc)}else d.reset(),d.a&&d.a.Ha()},!0;case "save":if(da()){c.parentNode.removeChild(c);break}this.A[b]=c;
|
||||
c.onclick=function(){var a=Xc(d,!0);if(a){var b=!!(d.b&&!d.o||d.B),c=hd(d,b);b?id(d,a,c):d.M("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Xc(a,b){var c=a.c;c||(c=qa("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=jd(a,c))||a.M("The user ID is invalid."))):b&&a.M("Browser local storage is not available"));return c}
|
||||
function jd(a,b){a.c=null;var c=ma(ea()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(ra("user",c.data),a.c=c.data)}catch(e){p(e.message+" ("+d+")")}return a.c}function Zc(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+kd(a,"1.30.0"));return b}
|
||||
function id(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=kd(a,"1.30.0");d.data=c;b=ma(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.M("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.M(c),ra("user",""),a.c=null)}}
|
||||
function Va(a,b,c){a=Ma(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}function Hb(a,b){if(a.m.length){var c=0,d=0;!b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.m[0];e.P&&e.P.focus();!b&&window&&window.scrollTo(c,d)}}k.za=function(a){this.a&&this.a.za(a);this.g&&this.g.za(a)};
|
||||
ya(function(){for(var a=A(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=z(f),h=new Uc(h,d,!0);Pa(h,f);h.w&&$c(h,h.Oa)}});ta.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Oa("Computer",c.id))&&c.K&&!c.l.Y&&c.Oa(-1)}});
|
||||
ta.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Oa("Computer",c.id))&&c.l.Y&&hd(c,!(!c.b||c.o),!0)}});function F(a,b,c){this.id=a.id;this.key=kd(a,b,c);this.O=a.O;ed(this,a.Jc)}function kd(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
F.prototype={constructor:F,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){ed(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
|
||||
function ed(a,b){a[a.id]={};b&&G(a,"parms",b);a.a=!1}function fd(a){var b=!0;if(pa()){var c=JSON.stringify(a[a.id]);ra(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function bd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function Yc(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:pa()&&(b=qa(a.key))?(a[a.id]=b,a.a=!0):!1}function cd(a,b){return a[a.id][b]||null}function G(a,b,c){try{a[a.id][b]=c}catch(d){}}var ld=0;
|
||||
function md(a,b,c,d,e,f){e("Loading "+a+"...");ma(a,null,!0,function(h,g,l){l?(g||(g="unable to load "+a+" ("+l+")"),f(g,null)):nd(g,a,b,c,d,e,f)})}
|
||||
function nd(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){La(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PC8080$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){g=null,a=t.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?od(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),
|
||||
k.V=function(a,b,c){var d=this;switch(b){case "power":return this.A[b]=c,c.onclick=function(){d.f||(d.l.Y?jd(d,!1,!0):bd(d,d.Pa))},!0;case "reset":return this.A[b]=c,c.onclick=function(){if(d.l.Y&&!d.f)if(d.b&&!d.o){var a=na("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");jd(d,a,!0);!a&&d.B?window&&window.location.reload():d.Pa(Yc)}else d.reset(),d.a&&d.a.Na()},!0;case "save":if(da()){c.parentNode.removeChild(c);break}this.A[b]=c;
|
||||
c.onclick=function(){var a=Zc(d,!0);if(a){var b=!!(d.b&&!d.o||d.B),c=jd(d,b);b?kd(d,a,c):d.M("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Zc(a,b){var c=a.c;c||(c=qa("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=ld(a,c))||a.M("The user ID is invalid."))):b&&a.M("Browser local storage is not available"));return c}
|
||||
function ld(a,b){a.c=null;var c=ma(ea()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(ra("user",c.data),a.c=c.data)}catch(e){q(e.message+" ("+d+")")}return a.c}function ad(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+md(a,"1.30.0"));return b}
|
||||
function kd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=md(a,"1.30.0");d.data=c;b=ma(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.M("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.M(c),ra("user",""),a.c=null)}}
|
||||
function Va(a,b,c){a=Ma(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}function Hb(a,b){if(a.m.length){var c=0,d=0;!b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.m[0];e.R&&e.R.focus();!b&&window&&window.scrollTo(c,d)}}k.Aa=function(a){this.a&&this.a.Aa(a);this.g&&this.g.Aa(a)};
|
||||
ya(function(){for(var a=B(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=B(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=A(f),h=new Wc(h,d,!0);Pa(h,f);h.w&&bd(h,h.Pa)}});ta.show.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Oa("Computer",c.id))&&c.L&&!c.l.Y&&c.Pa(-1)}});
|
||||
ta.exit.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Oa("Computer",c.id))&&c.l.Y&&jd(c,!(!c.b||c.o),!0)}});function G(a,b,c){this.id=a.id;this.key=md(a,b,c);this.N=a.N;gd(this,a.Mc)}function md(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
G.prototype={constructor:G,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){gd(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
|
||||
function gd(a,b){a[a.id]={};b&&H(a,"parms",b);a.a=!1}function hd(a){var b=!0;if(pa()){var c=JSON.stringify(a[a.id]);ra(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function dd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function $c(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:pa()&&(b=qa(a.key))?(a[a.id]=b,a.a=!0):!1}function ed(a,b){return a[a.id][b]||null}function H(a,b,c){try{a[a.id][b]=c}catch(d){}}var nd=0;
|
||||
function od(a,b,c,d,e,f){e("Loading "+a+"...");ma(a,null,!0,function(h,g,l){l?(g||(g="unable to load "+a+" ("+l+")"),f(g,null)):pd(g,a,b,c,d,e,f)})}
|
||||
function pd(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){La(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PC8080$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){g=null,a=t.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?qd(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),
|
||||
null)}
|
||||
function od(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=g[0],n,x=/( [a-z]+=)(['"])(.*?)\2/g;n=x.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);g[0]!=l&&(h=h.replace(g[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,"");
|
||||
a=a.replace(d[0],h);od(a,b,c)}})}else c(a,null)}
|
||||
function pd(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);l&&(--ld||Ba(!0));l=!1}var h,g,l=!0;ld++;Ka[a]={};try{if(h=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var x=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));x.appendChild(t)}c||
|
||||
(c="/versions/pc8080/1.30.0/components.xsl");n=function(d,g){g?md(c,null,null,!1,e,function(d,l){if(l)if(La(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var n=g.transformNode(l);n?(h.outerHTML=n,--ld||Ba(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(n=new XSLTProcessor,n.importStylesheet(l),(n=n.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(n,h),--ld||Ba(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?md(b,a,d,!0,e,n):nd(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(B){f(B.message)}return l}window.embedPC8080=function(a,b,c,d){Ba(!1);return pd(a,b,c,d)};window.enableEvents=Ba;window.sendEvent=Da;})();
|
||||
function qd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=g[0],n,y=/( [a-z]+=)(['"])(.*?)\2/g;n=y.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);g[0]!=l&&(h=h.replace(g[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,"");
|
||||
a=a.replace(d[0],h);qd(a,b,c)}})}else c(a,null)}
|
||||
function rd(a,b,c,d){function e(a){if(void 0===g){var b=h&&B(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);l&&(--nd||Ba(!0));l=!1}var h,g,l=!0;nd++;Ka[a]={};try{if(h=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var y=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));y.appendChild(t)}c||
|
||||
(c="/versions/pc8080/1.30.0/components.xsl");n=function(d,g){g?od(c,null,null,!1,e,function(d,l){if(l)if(La(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var n=g.transformNode(l);n?(h.outerHTML=n,--nd||Ba(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(n=new XSLTProcessor,n.importStylesheet(l),(n=n.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(n,h),--nd||Ba(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?od(b,a,d,!0,e,n):pd(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(C){f(C.message)}return l}window.embedPC8080=function(a,b,c,d){Ba(!1);return rd(a,b,c,d)};window.enableEvents=Ba;window.sendEvent=Ca;})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -95,7 +95,7 @@ function $c(a){Pc.call(this,a);this.N=W();this.pa=W();this.S=W();this.G=[];this.
|
|||
var dd={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},ed=["NONE"],fd=["PC","PSW"],gd=[];m=$c.prototype;
|
||||
m.za=function(a,b,c,d){this.H=b;this.b=c;this.D=a;(a=dc(a,"messages"))&&cd(this,a);this.oa=gd;hd(this,function(a){a:{var b=d.H.P,c=a[0],g=a=0,k=b.length;if(c){a=X(V(d,c));if(-1===a){d.u("invalid address: "+c);break a}g=a>>>d.H.aa;k=1}d.u("blockid physical blockaddr used size type");d.u("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var n=b[g];n.type==c?l++||d.u("..."):(c=n.type,l=zb[c],n&&d.u(q(n.id)+" %"+q(g<<d.H.aa)+" %%"+q(n.B)+" "+ea(n.Sa)+" "+
|
||||
ea(n.size)+" "+l),c!=Qb&&(c=-1),l=0);a+=d.H.la;g++}}});A(this)};
|
||||
m.ha=function(a,b,c){var d=this;switch(b){case "debugInput":return this.$=this.K[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",gc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.w<d.j.length-1&&(b=d.j[++d.w]):40==a.keyCode&&(0<d.w?b=d.j[--d.w]:(b="",d.w=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.K[b]=c,Ka(c,function(){if(d.$){var a=d.$.value;d.$.value=
|
||||
m.ha=function(a,b,c){var d=this;switch(b){case "debugInput":return this.$=this.K[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",gc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.w<d.j.length-1&&(b=d.j[++d.w])):40==a.keyCode&&(0<d.w?b=d.j[--d.w]:(b="",d.w=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.K[b]=c,Ka(c,function(){if(d.$){var a=d.$.value;d.$.value=
|
||||
"";gc(d,a,!0);return!0}return!1}),!0;case "step":return this.K[b]=c,Ka(c,function(a){var b=!1;pb(d,!0)||(ob(d,!0),b=d.Ha(a?1:0),ob(d,!1));return b}),!0}return!1};m.Ra=function(){this.$&&this.$.focus()};function X(a){a=a&&a.B;null==a&&(a=-1);return a}m.ua=function(a,b){var c=255,d=X(a);-1!==d&&(c=Ab(this.H,d),b&&id(a,b));return c};m.Ta=function(a,b){var c=65535,d=X(a);if(-1!==d){var c=this.H,e=d&c.i,f=(d&c.j)>>>c.aa,c=e!=c.i?c.P[f].vb(e,d):c.P[f++].Qa(e,d)|c.P[f&c.G].Qa(0,d+1)<<8;b&&id(a,b)}return c};
|
||||
m.eb=function(a,b,c){var d=X(a);if(-1!==d){var e=this.H;e.P[(d&e.j)>>>e.aa].Ia(d&e.i,b&255,d);c&&id(a,c);F(this.b,!0)}};m.zb=function(a,b,c){var d=X(a);if(-1!==d){var e=this.H,f=d&e.i,h=(d&e.j)>>>e.aa;f!=e.i?e.P[h].yb(f,b&65535,d):(e.P[h++].Ia(f,b&255,d),e.P[h&e.G].Ia(0,b>>8&255,d+1));c&&id(a,c);F(this.b,!0)}};function W(a){return{B:a,ma:!1}}function jd(a){return[a.B,a.ma]}function kd(a){return{B:a[0],ma:a[1]}}
|
||||
function V(a,b,c){var d;c=(c?a.N:a.pa).B;if(void 0!==b){d=b=Uc(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var f=a.G[c].qa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=W(d));break}}if(d=e)return d;c=Tc(a,b,void 0)}null!=c&&(d=W(c));return d}function ld(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ab=Sc(a,b.wb=c[2]))}function id(a,b){null!=a.B&&(a.B+=b||1)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue