Merged with master
This commit is contained in:
commit
c00a96c830
11 changed files with 6067 additions and 5866 deletions
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: page
|
||||
title: DEC VT100 Terminal
|
||||
title: DEC VT100 Terminal with Debugger
|
||||
permalink: /devices/pc8080/machine/vt100/debugger/
|
||||
machines:
|
||||
- type: pc8080
|
||||
|
|
@ -13,10 +13,22 @@ DEC VT100 Terminal with Debugger
|
|||
|
||||
The [PC8080](/modules/pc8080/) machine below is configured to simulate a [VT100 Terminal](/devices/pc8080/machine/vt100/)
|
||||
with a Control Panel and Debugger. It is running the original [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the
|
||||
[PC8080](/modules/pc8080/) CPU emulator.
|
||||
[PC8080](/modules/pc8080/) CPU emulator. You'll also find assorted [Hardware Notes](#vt100-memory-usage) below.
|
||||
|
||||
Click the "Run" button to start the simulation. You'll also find assorted
|
||||
[Hardware Notes](#vt100-memory-usage) below.
|
||||
Click the "Run" button to start the simulation. The VT100 KEYMAP table in [keyboard.js](/modules/pc8080/lib/keyboard.js)
|
||||
maps modern keys to VT100 key addresses, and most of the mappings are 1-1. Function keys are mapped as follows:
|
||||
|
||||
- F1: PF1
|
||||
- F2: PF2
|
||||
- F3: PF3
|
||||
- F4: PF4
|
||||
- F5: KEYPAD COMMA
|
||||
- F6: BREAK
|
||||
- F7: LINE FEED
|
||||
- F8: NO SCROLL
|
||||
- F9: SET-UP
|
||||
|
||||
The simulation is not fully operational yet, but it is now possible to access the SET-UP screen.
|
||||
|
||||
{% include machine.html id="vt100" %}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<machine id="vt100" class="pc8080" border="1" pos="center" background="#FAEBD7">
|
||||
<name pos="center">VT100 Terminal</name>
|
||||
<computer id="computer" busWidth="16"/>
|
||||
<cpu id="cpu8080" model="8080" cycles="2764800"/>
|
||||
<cpu id="cpu8080" model="8080" cycles="1000000"/>
|
||||
<rom id="rom" addr="0x0000" size="0x2000" file="/devices/pc8080/rom/vt100/VT100.json"/>
|
||||
<ram id="ram" addr="0x2000" size="0x0C00"/>
|
||||
<video id="video" screenWidth="1600" screenHeight="960" smoothing="false" interruptRate="60"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<machine id="vt100" class="pc8080" border="1" pos="center" background="#FAEBD7">
|
||||
<name pos="center">VT100 Terminal</name>
|
||||
<computer id="computer" busWidth="16"/>
|
||||
<cpu id="cpu8080" model="8080" cycles="2764800"/>
|
||||
<cpu id="cpu8080" model="8080" cycles="1000000"/>
|
||||
<rom id="rom" addr="0x0000" size="0x2000" file="/devices/pc8080/rom/vt100/VT100.json"/>
|
||||
<ram id="ram" addr="0x2000" size="0x0C00"/>
|
||||
<video id="video" screenWidth="1600" screenHeight="960" smoothing="false" interruptRate="60"
|
||||
|
|
|
|||
|
|
@ -6,60 +6,75 @@
|
|||
; work at https://github.com/phooky/VT100-Hax/blob/master/ROMs/haxrom.d80 and http://vt100romhax.tumblr.com
|
||||
;
|
||||
; All other comments/annotations by Jeff Parsons (@jeffpar) <Jeff@pcjs.org>
|
||||
;
|
||||
|
||||
;
|
||||
; Data area definitions
|
||||
;
|
||||
stack_top equ 204eh
|
||||
scratch_start equ 204eh
|
||||
cursor_countdn equ 212dh
|
||||
cursor_visible equ 21bah
|
||||
|
||||
;
|
||||
; Reset vector
|
||||
;
|
||||
org 0
|
||||
|
||||
X0000: di
|
||||
lxi sp,X204e
|
||||
jmp X003b
|
||||
|
||||
di
|
||||
lxi sp,stack_top ; SP = 0x204e
|
||||
jmp reset
|
||||
;
|
||||
; Interrupt vector 0x1 for Keyboard
|
||||
;
|
||||
org 8
|
||||
;
|
||||
; Interrupt vector 0x1 for keyboard
|
||||
;
|
||||
X0008: call X00fd
|
||||
call X00fd
|
||||
ei
|
||||
ret
|
||||
|
||||
X000d: nop
|
||||
|
||||
;
|
||||
; Interrupt vector 0x2 for PUSART
|
||||
;
|
||||
org 10h
|
||||
|
||||
call X03cc
|
||||
ei
|
||||
X0014: ret
|
||||
|
||||
nop
|
||||
|
||||
ret
|
||||
;
|
||||
; Interrupt vector 0x3 for Keyboard and PUSART
|
||||
;
|
||||
org 18h
|
||||
|
||||
call X03cc
|
||||
call X00fd
|
||||
ei
|
||||
ret
|
||||
|
||||
;
|
||||
; Interrupt vector 0x4 for Video (vertical retrace)
|
||||
;
|
||||
org 20h
|
||||
call X04cf
|
||||
ret
|
||||
|
||||
nop
|
||||
|
||||
;
|
||||
; Interrupt vector 0x5 for Keyboard and Video
|
||||
;
|
||||
org 28h
|
||||
|
||||
call X04cf
|
||||
ret
|
||||
|
||||
nop
|
||||
|
||||
;
|
||||
; Interrupt vector 0x6 for PUSART and Video
|
||||
;
|
||||
org 30h
|
||||
|
||||
X0030: call X03cc
|
||||
call X04cf
|
||||
ei
|
||||
ret
|
||||
|
||||
;
|
||||
; Interrupt vector 0x7 for Keyboard and PUSART and Video
|
||||
;
|
||||
org 38h
|
||||
jmp X0030
|
||||
|
||||
X003b: mvi e,1
|
||||
;
|
||||
; Beginning of power-up (reset) code at 0x003b
|
||||
;
|
||||
reset: mvi e,1
|
||||
X003d: di
|
||||
mvi a,0fh
|
||||
out 62h ;; 0x0f to NVR latch
|
||||
|
|
@ -233,7 +248,7 @@ X00fd: push psw
|
|||
sui 7ch ;; subtract 0x7c from a
|
||||
jm X011a ;; jump to 011a if a is a normal key
|
||||
mov h,a ;; otherwise h <- a
|
||||
X0109: inr h ;; h++
|
||||
inr h ;; h++
|
||||
mvi a,10h ;; a <- 0x10
|
||||
rrc
|
||||
X010d: rlc
|
||||
|
|
@ -370,7 +385,7 @@ X01ff: lxi h,X0812
|
|||
X020e: sui 41h
|
||||
mov b,a
|
||||
X0211: mov a,m
|
||||
X0212: jz X0222
|
||||
jz X0222
|
||||
dcr b
|
||||
jz X0226
|
||||
dcr b
|
||||
|
|
@ -408,7 +423,7 @@ X0245: mov a,c
|
|||
jmp X0812
|
||||
|
||||
X0251: di
|
||||
lxi sp,X204e
|
||||
lxi sp,stack_top ; SP = 0x204e
|
||||
lxi h,2000h
|
||||
push h
|
||||
mov a,m
|
||||
|
|
@ -447,10 +462,10 @@ X0298: call X0bf2
|
|||
;;
|
||||
;; Zero all scratch and screen RAM above stack
|
||||
;;
|
||||
X02a4: lxi h,X204e ;; HL <- 0x204e (top of stack)
|
||||
lxi d,X0fb2 ;; DE <- 0x0fb2
|
||||
mvi b,0 ;; B <- 0
|
||||
call X1083 ;; memset(0x204e,0,0xfb2)
|
||||
X02a4: lxi h,scratch_start ;; HL = 0x204e (just above stack)
|
||||
lxi d,0fb2h ;; DE = 0x0fb2 (every byte from 0x204e up to 0x3000)
|
||||
mvi b,0 ;; B = 0
|
||||
call memset ;; memset(0x1083): set 0x0fb2 bytes to 0 starting at 0x204e
|
||||
cma ;; invert A
|
||||
sta X2104 ;; store A in 0x2104
|
||||
lxi h,X2004 ;; HL <- 0x2004
|
||||
|
|
@ -469,7 +484,7 @@ X02c0: call X0a15 ;; 0x2140 = 0xe605
|
|||
lxi h,X3000 ;; HL = 0x3000
|
||||
lxi d,X1000 ;; DE = 0x1000
|
||||
mvi b,0ffh ;; B = 0xFF
|
||||
jmp X1083 ;; Set all of attribute RAM to 0xFF and return
|
||||
jmp memset ;; invoke memset(0x1083) to set all of attribute RAM to 0xFF and return
|
||||
;;
|
||||
;; 0x02d9 through 0x02eb are the initial values for the screen RAM;
|
||||
;; it's copied into low RAM at 0x2000 during init.
|
||||
|
|
@ -484,8 +499,8 @@ X02d9:
|
|||
;;
|
||||
;; Initialize several scratch values. We don't know what all of these are for yet.
|
||||
;;
|
||||
X02eb: lxi h,X0212 ;; HL = 0x0212
|
||||
shld X212d ;; Store 0x1202 at 0x212d
|
||||
X02eb: lxi h,212h ;; HL = 0x0212 (530.)
|
||||
shld cursor_countdn ;; Store 0x0212 at cursor_countdn [0x212d]
|
||||
mvi a,35h ;; A = 0x35
|
||||
sta X212c ;; 0x212c = 0x35
|
||||
mvi a,1 ;; A = 1
|
||||
|
|
@ -504,7 +519,7 @@ X02eb: lxi h,X0212 ;; HL = 0x0212
|
|||
sta X2079 ;; else store 1 in 0x2079
|
||||
X031a: mvi a,0ffh ;; A = 0xff
|
||||
sta X210e ;; 0x210e = 0xff
|
||||
sta X21ba ;; 0x21ba = 0xff
|
||||
sta cursor_visible ;; set cursor_visible [0x21ba] to 0xff (initially visible)
|
||||
mvi h,80h ;; H = 0x80
|
||||
mov l,h ;; L = 0x80
|
||||
shld X20c0 ;; Store 0x8080 at 0x20c0
|
||||
|
|
@ -1592,7 +1607,7 @@ X0a7b: inx sp
|
|||
|
||||
mvi a,48h
|
||||
sta X207e
|
||||
lxi h,X0000
|
||||
lxi h,0
|
||||
shld X2130
|
||||
pop h
|
||||
X0aa2: lxi h,X0a15
|
||||
|
|
@ -2405,7 +2420,7 @@ X0fae: cmp m
|
|||
rz
|
||||
push h
|
||||
push psw
|
||||
X0fb2: lda X207b
|
||||
lda X207b
|
||||
ora a
|
||||
cz X1488
|
||||
pop psw
|
||||
|
|
@ -2415,11 +2430,11 @@ X0fb2: lda X207b
|
|||
; End of main loop?
|
||||
;
|
||||
|
||||
X0fbe: lhld X204e
|
||||
X0fbe: lhld scratch_start ; HL = [0x204e]
|
||||
mov a,h
|
||||
ori 0f0h
|
||||
mov h,a
|
||||
shld X204e
|
||||
shld scratch_start ; update [0x204e]
|
||||
X0fc8: lda X2050
|
||||
X0fcb: mov b,a
|
||||
mov a,h
|
||||
|
|
@ -2525,15 +2540,14 @@ X1074: call X13e3
|
|||
shld X214e
|
||||
ret
|
||||
;;
|
||||
;; memset: Set memory from HL to HL+DE-1 to value B
|
||||
;; memset(0x1083): Set DE bytes at address HL to B
|
||||
;;
|
||||
memset:
|
||||
X1083: mov m,b ;; M <- B
|
||||
memset: mov m,b ;; M <- B
|
||||
inx h ;; HL++
|
||||
dcx d ;; DE--
|
||||
mov a,d ;;
|
||||
ora e ;; A = D | E
|
||||
jnz X1083 ;; repeat if A != 0
|
||||
jnz memset ;; repeat if A != 0
|
||||
ret
|
||||
|
||||
mvi c,0
|
||||
|
|
@ -2672,7 +2686,7 @@ X1159: mov m,e
|
|||
X117e: mov a,h
|
||||
ori 0f0h
|
||||
mov h,a
|
||||
shld X204e
|
||||
shld scratch_start ; update [0x204e]
|
||||
lxi h,X2113
|
||||
xra a
|
||||
X1189: mov m,a
|
||||
|
|
@ -2727,7 +2741,7 @@ X11ce: ora a
|
|||
mov l,m
|
||||
ori 0f0h
|
||||
mov h,a
|
||||
shld X204e
|
||||
shld scratch_start ; update [0x204e]
|
||||
call X1290
|
||||
pop h
|
||||
mov b,d
|
||||
|
|
@ -2747,7 +2761,7 @@ X11e8: call X127f
|
|||
ori 0f0h
|
||||
mov h,a
|
||||
mov l,e
|
||||
shld X204e
|
||||
shld scratch_start ; update [0x204e]
|
||||
pop h
|
||||
mov a,h
|
||||
ori 9fh
|
||||
|
|
@ -2810,12 +2824,12 @@ X1252: call X129d
|
|||
mov c,m
|
||||
call X13de
|
||||
xchg
|
||||
lhld X204e
|
||||
lhld scratch_start ; load [0x204e]
|
||||
xchg
|
||||
mov m,e
|
||||
dcx h
|
||||
mov m,d
|
||||
X1271: lhld X204e
|
||||
X1271: lhld scratch_start ; load [0x204e]
|
||||
shld X2056
|
||||
call X1299
|
||||
mov m,b
|
||||
|
|
@ -3175,25 +3189,29 @@ X14a2: lxi h,X21a5 ;;
|
|||
lda X2077 ;; load what's at 0x2077
|
||||
ora a ;; return if it's not zero
|
||||
rnz ;;
|
||||
lda X2065 ;; A = 0x2065
|
||||
lda X2065 ;; A = [0x2065]
|
||||
lxi h,X2051 ;;
|
||||
ora m ;; return if [0x2065] | [0x2051] != 0
|
||||
rnz
|
||||
lhld X212d
|
||||
|
||||
lhld cursor_countdn ; HL = cursor countdown from [0x212d]
|
||||
dcx h
|
||||
mov a,h
|
||||
ora l
|
||||
jz X14d4
|
||||
shld X212d
|
||||
shld cursor_countdn ; update cursor countdown with decremented value
|
||||
ret
|
||||
|
||||
X14d4: lda X21ba
|
||||
xri 0ffh
|
||||
sta X21ba
|
||||
lxi h,X0212
|
||||
jnz X14e5
|
||||
lxi h,X0109
|
||||
X14e5: shld X212d
|
||||
;
|
||||
; Cursor countdown reached zero, time to invert the cursor;
|
||||
; note that the cursor is on (visible) twice as long as it's off
|
||||
;
|
||||
X14d4: lda cursor_visible ; A = 0xff (visible) or 0x00 (invisible)
|
||||
xri 0ffh ; invert
|
||||
sta cursor_visible ;
|
||||
lxi h,212h ; new initial count; start with 0x0212
|
||||
jnz X14e5 ; and stick with that if cursor still visible
|
||||
lxi h,109h ; otherwise, use half that value (0x0109) if invisible
|
||||
X14e5: shld cursor_countdn ; store new cursor countdown
|
||||
lhld X20f6
|
||||
mov b,m
|
||||
lda X2159
|
||||
|
|
@ -3394,10 +3412,10 @@ X162b: inx h
|
|||
inx h
|
||||
jmp X13db
|
||||
|
||||
X1636: lxi h,X000d
|
||||
shld X212d
|
||||
X1636: lxi h,13
|
||||
shld cursor_countdn ; reset cursor countdown to 13 (0x000d)
|
||||
xra a
|
||||
sta X21ba
|
||||
sta cursor_visible ; reset cursor visibility
|
||||
lhld X20f6
|
||||
lda X20f4
|
||||
mov b,a
|
||||
|
|
@ -3679,7 +3697,7 @@ X1837: cmp d
|
|||
X1844: mov m,a
|
||||
jmp X1636
|
||||
|
||||
X1848: lxi h,X0000
|
||||
X1848: lxi h,0
|
||||
shld X2130
|
||||
mvi a,0ffh
|
||||
sta X210e
|
||||
|
|
@ -3786,7 +3804,7 @@ X1900: in 42h
|
|||
out 62h
|
||||
lxi d,X21d3 ;; DE = 0x21d3
|
||||
mvi b,0eh ;; B = 14
|
||||
lxi h,X0000 ;; HL = 0
|
||||
lxi h,0 ;; HL = 0
|
||||
X1916: dad h ;;
|
||||
ldax d ;; load next char
|
||||
ani 20h ;; and with NVR data bit
|
||||
|
|
@ -3967,7 +3985,7 @@ X1a2b: mvi c,80h
|
|||
shld X2111
|
||||
lxi h,X19ee
|
||||
shld X2140
|
||||
lxi h,X0000
|
||||
lxi h,0
|
||||
shld X2143
|
||||
shld X2172
|
||||
X1a45: lhld X2004
|
||||
|
|
@ -4170,7 +4188,7 @@ X1bb0: call X0394
|
|||
shld X2140
|
||||
ret
|
||||
|
||||
X1bba: lhld X204e
|
||||
X1bba: lhld scratch_start ; load [0x204e]
|
||||
jmp X1bc3
|
||||
|
||||
X1bc0: lxi h,X21cc
|
||||
|
|
@ -4374,7 +4392,7 @@ X1d17: mvi m,0
|
|||
lda X21ac
|
||||
call X1d61
|
||||
call X1c9f
|
||||
lxi d,X0008
|
||||
lxi d,8
|
||||
mvi c,4
|
||||
pop psw
|
||||
jz X1d3d
|
||||
|
|
@ -4600,8 +4618,8 @@ X1e9f: call X1edd
|
|||
inx h
|
||||
shld X21b4
|
||||
mov b,a
|
||||
lxi d,X0014
|
||||
call X1083
|
||||
lxi d,20 ; DE = 20(0x0014)
|
||||
call memset ; call memset(0x1083)
|
||||
lxi h,X1eb8
|
||||
shld X2140
|
||||
ret
|
||||
|
|
@ -4635,7 +4653,7 @@ X1ee5: call X05e3
|
|||
ret
|
||||
|
||||
X1eea: push h
|
||||
lxi h,X204e
|
||||
lxi h,scratch_start ; HL -> 0x204e
|
||||
mov c,a
|
||||
lda X21a2
|
||||
ora a
|
||||
|
|
@ -4804,7 +4822,6 @@ X1ccd equ 1ccdh
|
|||
X2001 equ 2001h
|
||||
X2002 equ 2002h
|
||||
X2004 equ 2004h
|
||||
X204e equ 204eh
|
||||
X2050 equ 2050h
|
||||
X2051 equ 2051h
|
||||
X2052 equ 2052h
|
||||
|
|
@ -4818,7 +4835,7 @@ X2065 equ 2065h
|
|||
X2067 equ 2067h
|
||||
X2068 equ 2068h ; Keys flag buffer
|
||||
X2069 equ 2069h
|
||||
X206a equ 206ah
|
||||
X206a equ 206ah ; Start of the "three place New Key Address Buffer"
|
||||
X206e equ 206eh
|
||||
X2072 equ 2072h
|
||||
X2073 equ 2073h
|
||||
|
|
@ -4857,7 +4874,6 @@ X2111 equ 2111h
|
|||
X2113 equ 2113h
|
||||
X212b equ 212bh
|
||||
X212c equ 212ch
|
||||
X212d equ 212dh
|
||||
X212f equ 212fh
|
||||
X2130 equ 2130h
|
||||
X2131 equ 2131h
|
||||
|
|
@ -4912,7 +4928,6 @@ X21af equ 21afh
|
|||
X21b4 equ 21b4h
|
||||
X21b8 equ 21b8h
|
||||
X21b9 equ 21b9h
|
||||
X21ba equ 21bah
|
||||
X21bb equ 21bbh
|
||||
X21bc equ 21bch
|
||||
X21bd equ 21bdh
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -169,13 +169,29 @@ ChipSet.SI1978 = {
|
|||
|
||||
/*
|
||||
* One of the many chips in the VT100 is an 8224, which operates at 24.8832MHz. That frequency is divided by 9
|
||||
* to yield a 361.69ns clock period for the 8080 CPU, which means the CPU is running at 2.76Mhz (cycles per second).
|
||||
* Hence the CPU component in the VT100's machine.xml is defined as:
|
||||
* to yield a 361.69ns clock period for the 8080 CPU, which means (in theory) that the CPU is running at 2.76Mhz.
|
||||
*
|
||||
* Hence the CPU component in the VT100's machine.xml SHOULD be defined as:
|
||||
*
|
||||
* <cpu id="cpu8080" model="8080" cycles="2764800"/>
|
||||
*
|
||||
* where 2764800 = 24883200 / 9. You need to know this because we rely on the CPU frequency for simulating some
|
||||
* of the other VT100 circuits.
|
||||
* where 2764800 = 24883200 / 9. Unfortunately, the VT100 ROM decrements a countdown value in memory to determine
|
||||
* cursor blink rate, and if we use 2764800 cycles per second, the cursor blinks MUCH too fast. It's surprising that
|
||||
* the VT100 doesn't rely on vertical retrace interrupts for blink rate. Perhaps the designers were concerned about
|
||||
* consistency across 60Hz and 50Hz display modes, although that seems like a minor concern, considering that the
|
||||
* alternative means the ROM is now tied to a specific CPU operating frequency. However, short of rewriting portions
|
||||
* of the ROM, we have to deal with it.
|
||||
*
|
||||
* And we deal with it by lowering cycles per second to 1000000 (1Mhz). I'm guessing that in a real VT100, the 8080
|
||||
* gets bogged down by other factors (eg, the Video Processor's DMA requests), but we don't simulate the hardware to
|
||||
* that level of detail, so the easiest solution is to lower the effective clock speed.
|
||||
*
|
||||
* NOTE: If you've noticed that the VT100 cursor blinks unevenly, you're right, and it's by design: the ROM uses a
|
||||
* countdown value for the cursor's "on" state that is twice as large as that for the cursor's "off" state, so it's
|
||||
* "on" twice as long as it's "off".
|
||||
*
|
||||
* WARNING: The choice of clock speed has an effect on other simulated VT100 circuits; see the DC011 Timing Chip
|
||||
* discussion below, along with the getVT100LBA() function.
|
||||
*
|
||||
* For reference, here is a list of all the VT100 I/O ports, from /devices/pc8080/machine/vt100/debugger/README.md,
|
||||
* which in turn comes from p. 4-17 of the VT100 Technical Manual (July 1982):
|
||||
|
|
@ -386,6 +402,7 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
this.cpu = cpu;
|
||||
this.dbg = dbg;
|
||||
this.cmp = cmp;
|
||||
this.kbd = cmp.getMachineComponent("Keyboard");
|
||||
bus.addPortInputTable(this, this.config.portsInput);
|
||||
bus.addPortOutputTable(this, this.config.portsOutput);
|
||||
};
|
||||
|
|
@ -728,7 +745,7 @@ ChipSet.prototype.outSIWatchdog = function(port, b, addrFrom)
|
|||
};
|
||||
|
||||
/**
|
||||
* getVT100LBA(nBit)
|
||||
* getVT100LBA(iBit)
|
||||
*
|
||||
* Returns the state of the requested (simulated) LBA bit.
|
||||
*
|
||||
|
|
@ -737,12 +754,12 @@ ChipSet.prototype.outSIWatchdog = function(port, b, addrFrom)
|
|||
* period than if we divided the cycle count by 88, but a shorter LBA7 period is probably helpful in terms of
|
||||
* overall performance.
|
||||
*
|
||||
* @param {number} nBit
|
||||
* @param {number} iBit
|
||||
* @return {number}
|
||||
*/
|
||||
ChipSet.prototype.getVT100LBA = function(nBit)
|
||||
ChipSet.prototype.getVT100LBA = function(iBit)
|
||||
{
|
||||
return (this.cpu.getCycles() & (1 << (nBit - 1))) << 1;
|
||||
return (this.cpu.getCycles() & (1 << (iBit - 1))) << 1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -852,6 +869,10 @@ ChipSet.prototype.inVT100FlagsBuffer = function(port, addrFrom)
|
|||
if (this.bNVROut) {
|
||||
b |= ChipSet.VT100.FLAGS_BUFFER.NVR_DATA;
|
||||
}
|
||||
b &= ~ChipSet.VT100.FLAGS_BUFFER.KBD_XMIT;
|
||||
if (this.kbd && !this.kbd.checkBusy()) {
|
||||
b |= ChipSet.VT100.FLAGS_BUFFER.KBD_XMIT;
|
||||
}
|
||||
this.bFlagsBuffer = b;
|
||||
this.printMessageIO(port, null, addrFrom, "FLAGS.BUFFER", b);
|
||||
return b;
|
||||
|
|
@ -888,6 +909,10 @@ ChipSet.prototype.outVT100NVRLatch = function(port, b, addrFrom)
|
|||
/**
|
||||
* outVT100DC012(port, b, addrFrom)
|
||||
*
|
||||
* TODO: Consider whether we should disable any interrupts (eg, vertical retrace) until the
|
||||
* this port is initialized at runtime. We initialize it ourselves at start-up, but our initial
|
||||
* value is just a guess.
|
||||
*
|
||||
* @this {ChipSet}
|
||||
* @param {number} port (0xA2)
|
||||
* @param {number} b
|
||||
|
|
|
|||
|
|
@ -939,6 +939,7 @@ CPUState.prototype.checkINTR = function()
|
|||
{
|
||||
if ((this.intFlags & CPUDef.INTFLAG.INTR) && this.getIF()) {
|
||||
var bRST = CPUDef.OPCODE.RST0 | ((this.intFlags & CPUDef.INTFLAG.INTL) << 3);
|
||||
this.intFlags &= ~CPUDef.INTFLAG.HALT;
|
||||
this.clearINTR();
|
||||
this.clearIF();
|
||||
this.aOps[bRST].call(this);
|
||||
|
|
@ -1096,16 +1097,30 @@ CPUState.prototype.stepCPU = function(nMinCycles)
|
|||
|
||||
do {
|
||||
if (this.intFlags) {
|
||||
if (this.checkINTR()) {
|
||||
if (!nMinCycles) {
|
||||
this.assert(DEBUGGER); // nMinCycles of zero should be generated ONLY by the Debugger
|
||||
if (DEBUGGER) {
|
||||
this.println("interrupt dispatched");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* We no longer call checkINTR() if the Debugger is single-stepping; you'll have to let the
|
||||
* CPU run with a "g" (or a "p" on a call instruction) if you want interrupts to be processed.
|
||||
*/
|
||||
if (nMinCycles) {
|
||||
/*
|
||||
* NOTE: If checkINTR() returns true, it also clears INTFLAG.HALT, so we don't have to worry
|
||||
* about the INTFLAG.HALT code below triggering.
|
||||
*/
|
||||
this.checkINTR();
|
||||
/*
|
||||
* If the Debugger is running, consider some new notification mechanism(s) regarding interrupt
|
||||
* dispatches; the following code no longer applies, due to changes above.
|
||||
*
|
||||
* if (!nMinCycles && this.checkINTR()) {
|
||||
* this.assert(DEBUGGER); // nMinCycles of zero should be generated ONLY by the Debugger
|
||||
* if (DEBUGGER) {
|
||||
* this.println("interrupt dispatched");
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
}
|
||||
else if (this.intFlags & CPUDef.INTFLAG.HALT) {
|
||||
if (this.intFlags & CPUDef.INTFLAG.HALT) {
|
||||
/*
|
||||
* As discussed in opHLT(), the CPU is never REALLY halted by a HLT instruction; instead,
|
||||
* opHLT() sets CPUDef.INTFLAG.HALT, signalling to us that we're free to end the current burst
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ Keyboard.ASCII = {
|
|||
Keyboard.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,
|
||||
|
|
@ -249,7 +249,7 @@ Keyboard.STUPID_KEYCODES[Keyboard.KEYCODE.FF_DASH] = Keyboard.ASCII['-'];
|
|||
Keyboard.MINPRESSTIME = 100; // 100ms
|
||||
|
||||
/**
|
||||
* Alternate keyCode mappings (to support the popular WASD directional mappings)
|
||||
* Alternate keyCode mappings (to support popular "WASD"-style directional-key mappings)
|
||||
*
|
||||
* TODO: ES6 computed property name support may now be in all mainstream browsers, allowing us to use
|
||||
* a simple object literal for this and all other object initializations.
|
||||
|
|
@ -286,10 +286,11 @@ Keyboard.VT100 = {
|
|||
*
|
||||
* Every time a keyboard scan is initiated (by setting the START bit of the status byte),
|
||||
* an internal address index is reset to zero, and an interrupt is generated for each entry
|
||||
* in the aKeysPressed array, along with a final interrupt for KEYLAST.
|
||||
* in the aKeysActive array, along with a final interrupt for KEYLAST.
|
||||
*/
|
||||
ADDRESS: {
|
||||
PORT: 0x82
|
||||
PORT: 0x82,
|
||||
INIT: 0x7F
|
||||
},
|
||||
/*
|
||||
* Writing port 0x82 updates the VT100's keyboard status byte via the keyboard's UART data input.
|
||||
|
|
@ -329,39 +330,56 @@ Keyboard.VT100.KEYMAP[Keyboard.ASCII.W] = 0x09;
|
|||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.Q] = 0x0A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.RIGHT] = 0x10;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[']']] = 0x14;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['}']] = 0x94;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['[']] = 0x15;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['{']] = 0x95;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.I] = 0x16;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.U] = 0x17;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.R] = 0x18;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.E] = 0x19;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['1']] = 0x1A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['!']] = 0x9A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.LEFT] = 0x20;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.DOWN] = 0x22;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F6] = 0x23; // aka BREAK
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.PAUSE] = 0x23; // aka BREAK
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['`']] = 0x24;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['~']] = 0xA4;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['-']] = 0x25;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['_']] = 0xA5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['9']] = 0x26;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['(']] = 0xA6;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['7']] = 0x27;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['&']] = 0xA7;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['4']] = 0x28;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['$']] = 0xA8;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['3']] = 0x29;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['#']] = 0xA9;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.ESC] = 0x2A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.UP] = 0x30;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F3] = 0x31; // aka PF3
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F1] = 0x32; // aka PF1
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.BS] = 0x33;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['=']] = 0x34;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['+']] = 0xB4;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['0']] = 0x35;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[')']] = 0xB5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['8']] = 0x36;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['*']] = 0xB6;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['6']] = 0x37;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['^']] = 0xB7;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['5']] = 0x38;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['%']] = 0xB8;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['2']] = 0x39;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['@']] = 0xB9;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.TAB] = 0x3A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_7] = 0x40;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F4] = 0x41; // aka PF4
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F2] = 0x42; // aka PF2
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_0] = 0x43;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.LF] = 0x44;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F7] = 0x44; // aka LINE FEED
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['\\']] = 0x45;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['|']] = 0xC5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.L] = 0x46;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.K] = 0x47;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.G] = 0x48;
|
||||
|
|
@ -372,33 +390,38 @@ Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_CR] = 0x51;
|
|||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_2] = 0x52;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_1] = 0x53;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII["'"]] = 0x55;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['"']] = 0xD5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[';']] = 0x56;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[':']] = 0xD6;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.J] = 0x57;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.H] = 0x58;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.D] = 0x59;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.S] = 0x5A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_DEL] = 0x60; // keypad period
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F8] = 0x61; // aka keypad comma
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F5] = 0x61; // aka KEYPAD COMMA
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_5] = 0x62;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_4] = 0x63;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.CR] = 0x64; // TODO: Figure out why the Technical Manual lists CR at both 0x04 and 0x64
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['.']] = 0x65;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['>']] = 0xE5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[',']] = 0x66;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['<']] = 0xE6;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.N] = 0x67;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.B] = 0x68;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.X] = 0x69;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F9] = 0x6A; // aka NO SCROLL
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F8] = 0x6A; // aka NO SCROLL
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_9] = 0x70;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_3] = 0x71;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_6] = 0x72;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_SUB] = 0x73;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.NUM_SUB] = 0x73; // aka KEYPAD MINUS
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['/']] = 0x75;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII['?']] = 0xF5;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.M] = 0x76;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII[' ']] = 0x77;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.V] = 0x78;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.C] = 0x79;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.ASCII.Z] = 0x7A;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F10] = 0x7B; // aka SET-UP
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.F9] = 0x7B; // aka SET-UP
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.CTRL] = 0x7C;
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.SHIFT] = 0x7D; // either shift key (doesn't matter)
|
||||
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.CAPSLOCK]= 0x7E;
|
||||
|
|
@ -560,8 +583,9 @@ Keyboard.prototype.powerDown = function(fSave, fShutdown)
|
|||
|
||||
Keyboard.VT100.INIT = [
|
||||
[
|
||||
Keyboard.VT100.STATUS.INIT,
|
||||
0 // iKeyNext
|
||||
Keyboard.VT100.STATUS.INIT, // bVT100Status
|
||||
Keyboard.VT100.ADDRESS.INIT, // bVT100Address
|
||||
-1 // iKeyNext
|
||||
]
|
||||
];
|
||||
|
||||
|
|
@ -574,7 +598,7 @@ Keyboard.prototype.reset = function()
|
|||
{
|
||||
/*
|
||||
* As keyDown events are encountered, a corresponding "softCode" is looked up. If one is found,
|
||||
* then an entry for the key is added to the aKeysPressed array. Each entry contains:
|
||||
* then an entry for the key is added to the aKeysActive array. Each "key" entry in aKeysActive contains:
|
||||
*
|
||||
* softCode: number or string representing the key pressed
|
||||
* msDown: timestamp of the most recent "down" event
|
||||
|
|
@ -582,7 +606,7 @@ Keyboard.prototype.reset = function()
|
|||
*
|
||||
* When the key is finally released (or auto-released), its entry is removed from the array.
|
||||
*/
|
||||
this.aKeysPressed = [];
|
||||
this.aKeysActive = [];
|
||||
|
||||
if (this.config.INIT && !this.restore(this.config.INIT)) {
|
||||
this.notice("reset error");
|
||||
|
|
@ -604,7 +628,7 @@ Keyboard.prototype.save = function()
|
|||
case Keyboard.SI1978.MODEL:
|
||||
break;
|
||||
case Keyboard.VT100.MODEL:
|
||||
state.set(0, [this.bVT100Status]);
|
||||
state.set(0, [this.bVT100Status, this.bVT100Address, -1]);
|
||||
break;
|
||||
}
|
||||
return state.data();
|
||||
|
|
@ -630,7 +654,8 @@ Keyboard.prototype.restore = function(data)
|
|||
case Keyboard.VT100.MODEL:
|
||||
this.bVT100Status = a[0];
|
||||
this.updateLEDs(this.bVT100Status & Keyboard.VT100.STATUS.LEDS);
|
||||
this.iKeyNext = a[1];
|
||||
this.bVT100Address = a[1];
|
||||
this.iKeyNext = a[2];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -717,7 +742,7 @@ Keyboard.prototype.onKeyDown = function(event, fDown)
|
|||
}
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.printMessage("onKey" + (fDown? "Down" : "Up") + "(" + keyCode + "): " + (fPass? "true" : "false"), true);
|
||||
this.printMessage("onKey" + (fDown? "Down" : "Up") + "(" + keyCode + "): softCode=" + softCode + ", pass=" + (fPass? "true" : "false"), true);
|
||||
}
|
||||
|
||||
return fPass;
|
||||
|
|
@ -728,13 +753,13 @@ Keyboard.prototype.onKeyDown = function(event, fDown)
|
|||
*
|
||||
* @this {Keyboard}
|
||||
* @param {number|string} softCode
|
||||
* @return {number} index of softCode in aKeysPressed, or -1 if not found
|
||||
* @return {number} index of softCode in aKeysActive, or -1 if not found
|
||||
*/
|
||||
Keyboard.prototype.indexOfSoftKey = function(softCode)
|
||||
{
|
||||
var i;
|
||||
for (i = 0; i < this.aKeysPressed.length; i++) {
|
||||
if (this.aKeysPressed[i].softCode == softCode) return i;
|
||||
for (i = 0; i < this.aKeysActive.length; i++) {
|
||||
if (this.aKeysActive[i].softCode == softCode) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
|
@ -753,30 +778,30 @@ Keyboard.prototype.onSoftKeyDown = function(softCode, fDown)
|
|||
if (fDown) {
|
||||
// this.println(softCode + " down");
|
||||
if (i < 0) {
|
||||
this.aKeysPressed.push({
|
||||
this.aKeysActive.push({
|
||||
softCode: softCode,
|
||||
msDown: Date.now(),
|
||||
fAutoRelease: false
|
||||
});
|
||||
} else {
|
||||
this.aKeysPressed[i].msDown = Date.now();
|
||||
this.aKeysPressed[i].fAutoRelease = false;
|
||||
this.aKeysActive[i].msDown = Date.now();
|
||||
this.aKeysActive[i].fAutoRelease = false;
|
||||
}
|
||||
} else if (i >= 0) {
|
||||
// this.println(softCode + " up");
|
||||
if (!this.aKeysPressed[i].fAutoRelease) {
|
||||
var msDown = this.aKeysPressed[i].msDown;
|
||||
if (!this.aKeysActive[i].fAutoRelease) {
|
||||
var msDown = this.aKeysActive[i].msDown;
|
||||
if (msDown) {
|
||||
var msElapsed = Date.now() - msDown;
|
||||
if (msElapsed < Keyboard.MINPRESSTIME) {
|
||||
// this.println(softCode + " released after only " + msElapsed + "ms");
|
||||
this.aKeysPressed[i].fAutoRelease = true;
|
||||
this.aKeysActive[i].fAutoRelease = true;
|
||||
this.checkSoftKeysToRelease();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.aKeysPressed.splice(i, 1);
|
||||
this.aKeysActive.splice(i, 1);
|
||||
} else {
|
||||
// this.println(softCode + " up with no down?");
|
||||
}
|
||||
|
|
@ -820,10 +845,10 @@ Keyboard.prototype.checkSoftKeysToRelease = function()
|
|||
{
|
||||
var i = 0;
|
||||
var msDelayMin = -1;
|
||||
while (i < this.aKeysPressed.length) {
|
||||
if (this.aKeysPressed[i].fAutoRelease) {
|
||||
var softCode = this.aKeysPressed[i].softCode;
|
||||
var msDown = this.aKeysPressed[i].msDown;
|
||||
while (i < this.aKeysActive.length) {
|
||||
if (this.aKeysActive[i].fAutoRelease) {
|
||||
var softCode = this.aKeysActive[i].softCode;
|
||||
var msDown = this.aKeysActive[i].msDown;
|
||||
var msElapsed = Date.now() - msDown;
|
||||
var msDelay = Keyboard.MINPRESSTIME - msElapsed;
|
||||
if (msDelay > 0) {
|
||||
|
|
@ -849,9 +874,28 @@ Keyboard.prototype.checkSoftKeysToRelease = function()
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* checkBusy()
|
||||
*
|
||||
* Called whenever a ChipSet circuit needs the keyboard's UART status.
|
||||
* Currently, we have no busy conditions (our virtual keyboard is infinitely fast).
|
||||
*
|
||||
* @this {Keyboard}
|
||||
* @return {boolean}
|
||||
*/
|
||||
Keyboard.prototype.checkBusy = function()
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* inVT100UARTAddress(port, addrFrom)
|
||||
*
|
||||
* We take our cue from iKeyNext. If it's -1 (default), we simply return the last value latched
|
||||
* in bVT100Address. Otherwise, if iKeyNext is a valid index into aKeysActive, we look up the key
|
||||
* in the VT100.KEYMAP, latch it, and increment iKeyNext, else we latch Keyboard.VT100.KEYLAST
|
||||
* and set iKeyNext to -1 again.
|
||||
*
|
||||
* @this {Keyboard}
|
||||
* @param {number} port (0x82)
|
||||
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
|
||||
|
|
@ -859,12 +903,24 @@ Keyboard.prototype.checkSoftKeysToRelease = function()
|
|||
*/
|
||||
Keyboard.prototype.inVT100UARTAddress = function(port, addrFrom)
|
||||
{
|
||||
var b = 0;
|
||||
if (this.iKeyNext >= 0 && this.iKeyNext < this.aKeysPressed.length - 1) {
|
||||
var softCode = this.aKeysPressed[this.iKeyNext++];
|
||||
b = Keyboard.VT100.KEYMAP[softCode];
|
||||
var b = this.bVT100Address;
|
||||
if (this.iKeyNext >= 0) {
|
||||
if (this.iKeyNext < this.aKeysActive.length) {
|
||||
var key = this.aKeysActive[this.iKeyNext++];
|
||||
b = Keyboard.VT100.KEYMAP[key.softCode];
|
||||
if (b & 0x80) {
|
||||
/*
|
||||
* TODO: This code is supposed to be accompanied by a SHIFT key; make sure that it is.
|
||||
*/
|
||||
b &= 0x7F;
|
||||
}
|
||||
} else {
|
||||
this.iKeyNext = -1;
|
||||
b = Keyboard.VT100.KEYLAST;
|
||||
}
|
||||
this.bVT100Address = b;
|
||||
this.cpu.requestINTR(1);
|
||||
}
|
||||
if (!b) b = Keyboard.VT100.KEYLAST;
|
||||
this.printMessageIO(port, null, addrFrom, "KBDUART.ADDRESS", b);
|
||||
return b;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -320,7 +320,10 @@ Video.prototype.initBuffers = function()
|
|||
* for each font and draw characters by drawing from the font canvas to the target canvas.
|
||||
*/
|
||||
if (this.cxCell > 1) {
|
||||
this.initCellCache(this.nColsBuffer * this.nRowsBuffer);
|
||||
/*
|
||||
* We add an extra column per row to store the visible line length at the start of every row.
|
||||
*/
|
||||
this.initCellCache((this.nColsBuffer + 1) * this.nRowsBuffer);
|
||||
} else {
|
||||
this.imageBuffer = this.contextScreen.createImageData(cxBuffer, cyBuffer);
|
||||
this.nPixelsPerCell = (16 / this.nBitsPerPixel)|0;
|
||||
|
|
@ -959,11 +962,12 @@ Video.prototype.updateChar = function(idFont, col, row, data, context)
|
|||
};
|
||||
|
||||
/**
|
||||
* updateVT100()
|
||||
* updateVT100(fForced)
|
||||
*
|
||||
* @this {Video}
|
||||
* @param {boolean} [fForced]
|
||||
*/
|
||||
Video.prototype.updateVT100 = function()
|
||||
Video.prototype.updateVT100 = function(fForced)
|
||||
{
|
||||
var addrNext = this.addrBuffer, fontNext = -1;
|
||||
|
||||
|
|
@ -979,6 +983,8 @@ Video.prototype.updateVT100 = function()
|
|||
var nCols = 0;
|
||||
var addr = addrNext;
|
||||
var font = fontNext;
|
||||
var nColsVisible = this.nColsBuffer;
|
||||
if (font != Video.VT100.FONT.NORML) nColsVisible >>= 1;
|
||||
while (true) {
|
||||
var data = this.bus.getByteDirect(addr++);
|
||||
if ((data & Video.VT100.LINETERM) == Video.VT100.LINETERM) {
|
||||
|
|
@ -988,7 +994,7 @@ Video.prototype.updateVT100 = function()
|
|||
addrNext += (b & Video.VT100.LINEATTR.ADDRBIAS)? Video.VT100.ADDRBIAS_LO : Video.VT100.ADDRBIAS_HI;
|
||||
break;
|
||||
}
|
||||
if (nCols < this.abLineBuffer.length) {
|
||||
if (nCols < nColsVisible) {
|
||||
this.abLineBuffer[nCols++] = data;
|
||||
} else {
|
||||
break; // ideally, we would wait for a LINETERM byte, but it's not safe to loop without limit
|
||||
|
|
@ -1011,13 +1017,21 @@ Video.prototype.updateVT100 = function()
|
|||
}
|
||||
|
||||
/*
|
||||
* Display the line buffer; ordinarily, the font number would always be valid after processing the "fill lines",
|
||||
* but if the buffer isn't initialized yet, the usual LINETERM might be missing, so the font number might not be set.
|
||||
* Display the line buffer; ordinarily, the font number would be valid after processing the "fill lines",
|
||||
* but if the buffer isn't initialized yet, those lines might be missing, so the font number might not be set.
|
||||
*/
|
||||
if (font >= 0) {
|
||||
/*
|
||||
* Cell cache logic is complicated by the fact that a line may be single-width one frame and double-width
|
||||
* the next. So we store the visible line length at the start of each row in the cache, which must match if
|
||||
* the cache is considered valid for the current line.
|
||||
*/
|
||||
var fLineCacheValid = this.fCellCacheValid && (this.aCellCache[iCell] == nColsVisible);
|
||||
this.aCellCache[iCell++] = nColsVisible;
|
||||
for (var iCol = 0; iCol < nCols; iCol++) {
|
||||
data = this.abLineBuffer[iCol];
|
||||
if (!this.fCellCacheValid || data !== this.aCellCache[iCell]) {
|
||||
if (!fLineCacheValid || data !== this.aCellCache[iCell]) {
|
||||
this.aCellCache[iCell] = data;
|
||||
this.updateChar(font, iCol, nRows, data, this.contextBuffer);
|
||||
cUpdated++;
|
||||
}
|
||||
|
|
@ -1027,6 +1041,18 @@ Video.prototype.updateVT100 = function()
|
|||
nRows++;
|
||||
}
|
||||
|
||||
this.assert(font < 0 || iCell === this.nCellCache);
|
||||
|
||||
if (MAXDEBUG && !fForced) {
|
||||
var nSeconds = Date.now() / 1000;
|
||||
if ((nSeconds|0) != (this.nUpdateSeconds|0)) {
|
||||
this.nUpdateNumber = 0;
|
||||
}
|
||||
this.nUpdateNumber++;
|
||||
this.nUpdateSeconds = nSeconds;
|
||||
this.printMessage("updateVT100(): update #" + this.nUpdateNumber + " at " +this.nUpdateSeconds + " corner=" + str.toHexByte(this.aCellCache[1]) + " cycles=" + this.nCyclesPrev + " delta=" + this.nCyclesDelta);
|
||||
}
|
||||
|
||||
this.fCellCacheValid = true;
|
||||
|
||||
if (cUpdated && this.contextBuffer) {
|
||||
|
|
@ -1056,9 +1082,10 @@ Video.prototype.updateScreen = function(n)
|
|||
{
|
||||
var fClean;
|
||||
var fUpdate = true;
|
||||
var fForced = true;
|
||||
|
||||
if (n >= 0) {
|
||||
|
||||
fForced = false;
|
||||
if (this.rateInterrupt) {
|
||||
/*
|
||||
* TODO: Incorporate these hard-coded interrupt vector numbers into configuration blocks.
|
||||
|
|
@ -1093,11 +1120,11 @@ Video.prototype.updateScreen = function(n)
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
if (DEBUG && !fForced) {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
var nCyclesDelta = nCycles - this.nCyclesPrev;
|
||||
this.nCyclesDelta = nCycles - this.nCyclesPrev;
|
||||
this.nCyclesPrev = nCycles;
|
||||
this.printMessage("updateScreen(" + n + "): clean=" + fClean + ", update=" + fUpdate + ", cycles=" + nCycles + ", delta=" + nCyclesDelta);
|
||||
if (MAXDEBUG) this.printMessage("updateScreen(" + n + "): clean=" + fClean + ", update=" + fUpdate + ", cycles=" + this.nCyclesPrev + ", delta=" + this.nCyclesDelta);
|
||||
}
|
||||
|
||||
if (!fUpdate) {
|
||||
|
|
@ -1105,32 +1132,34 @@ Video.prototype.updateScreen = function(n)
|
|||
}
|
||||
|
||||
if (this.cxCell > 1) {
|
||||
this.updateScreenText();
|
||||
this.updateScreenText(fForced);
|
||||
} else {
|
||||
this.updateScreenGraphics();
|
||||
this.updateScreenGraphics(fForced);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* updateScreenText()
|
||||
* updateScreenText(fForced)
|
||||
*
|
||||
* @this {Video}
|
||||
* @param {boolean} [fForced]
|
||||
*/
|
||||
Video.prototype.updateScreenText = function()
|
||||
Video.prototype.updateScreenText = function(fForced)
|
||||
{
|
||||
switch(this.nFormat) {
|
||||
case Video.FORMAT.VT100:
|
||||
this.updateVT100();
|
||||
this.updateVT100(fForced);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* updateScreenGraphics()
|
||||
* updateScreenGraphics(fForced)
|
||||
*
|
||||
* @this {Video}
|
||||
* @param {boolean} [fForced]
|
||||
*/
|
||||
Video.prototype.updateScreenGraphics = function()
|
||||
Video.prototype.updateScreenGraphics = function(fForced)
|
||||
{
|
||||
var addr = this.addrBuffer;
|
||||
var addrLimit = addr + this.sizeBuffer;
|
||||
|
|
|
|||
|
|
@ -1,139 +1,140 @@
|
|||
(function(){var m;function ba(a,b){var c;if(a){b||(b=16);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 r(a){return"0x"+n(a,4)}function ca(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function da(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ea(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ga={"&":"&","<":"<",">":">",'"':""","'":"'"};function ha(a){return a.replace(/[&<>"']/g,function(a){return ga[a]})}function ia(a,b){return(a+" ").slice(0,b)}function ja(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
function ka(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 la=Date.now||function(){return+new Date};function ma(){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 na(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 oa(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="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));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 pa(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function qa(){return window?window.navigator.userAgent:""}function t(a){window&&window.alert(a)}function ra(a){var b=!1;window&&(b=window.confirm(a));return b}var ta=null;function ua(){if(null==ta){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}ta=a}return ta}
|
||||
function va(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function wa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function xa(a){if(window){var b=qa();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 ya(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function za(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 Aa={init:[],show:[],exit:[]},Ga=!1,Ha=!0;function Ia(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ja(a){Aa.init.push(a)}
|
||||
function Ka(a){if(Ha)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){La("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Ma(a){!Ha&&a?(Ha=!0,Ga&&Na("init")):Ha=a}function Na(a){Aa[a]&&Ka(Aa[a])}Ia("onload",function(){Ga=!0;Ka(Aa.init)});Ia("onpageshow",function(){Ka(Aa.show)});Ia(xa("Opera")||xa("iOS")?"onunload":"onbeforeunload",function(){Ka(Aa.exit)});
|
||||
function w(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.dc=b.comment;this.xc=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Sb=this.id.substr(0,b),this.$a=this.id.substr(b+1)):this.$a=this.id;this[a]=c;this.D={jb:!1,gb:!1,Vb:!1,sa:!1,ib:!1};this.Mb=null;this.D.ib=!1;this.L={};this.H=null;this.oa=d||0;Qa.push(this)}var Ra=void 0,Sa={};
|
||||
(function(){var m;function ca(a,b){var c;if(a){b||(b=16);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 t(a){return"0x"+n(a,4)}function da(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ea(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function fa(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ha={"&":"&","<":"<",">":">",'"':""","'":"'"};function ia(a){return a.replace(/[&<>"']/g,function(a){return ha[a]})}function ja(a,b){return(a+" ").slice(0,b)}function ka(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
function la(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 ma=Date.now||function(){return+new Date};function na(){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 oa(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 pa(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="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));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 qa(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function ra(){return window?window.navigator.userAgent:""}function u(a){window&&window.alert(a)}function sa(a){var b=!1;window&&(b=window.confirm(a));return b}var ta=null;function ua(){if(null==ta){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}ta=a}return ta}
|
||||
function va(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function wa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function xa(a){if(window){var b=ra();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 ya(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function za(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 Ba={init:[],show:[],exit:[]},Ga=!1,Ha=!0;function Ia(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ja(a){Ba.init.push(a)}
|
||||
function Ka(a){if(Ha)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){La("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Ma(a){!Ha&&a?(Ha=!0,Ga&&Na("init")):Ha=a}function Na(a){Ba[a]&&Ka(Ba[a])}Ia("onload",function(){Ga=!0;Ka(Ba.init)});Ia("onpageshow",function(){Ka(Ba.show)});Ia(xa("Opera")||xa("iOS")?"onunload":"onbeforeunload",function(){Ka(Ba.exit)});
|
||||
function v(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.fc=b.comment;this.zc=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Sb=this.id.substr(0,b),this.ab=this.id.substr(b+1)):this.ab=this.id;this[a]=c;this.C={jb:!1,gb:!1,Vb:!1,sa:!1,ib:!1};this.Mb=null;this.C.ib=!1;this.L={};this.I=null;this.oa=d||0;Oa.push(this)}var Ra=void 0,Sa={};
|
||||
if(window){Ra||(Ra=window.location.search.substr(1));for(var Ta,Ua=/\+/g,Va=/([^&=]+)=?([^&]*)/g;Ta=Va.exec(Ra);)Sa[decodeURIComponent(Ta[1].replace(Ua," "))]=decodeURIComponent(Ta[2].replace(Ua," "))}function Za(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 $a(a,b){b||(b=w);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var Qa=[],ab={};function bb(a,b,c){ab[a]&&b&&(ab[a][b]=c)}function La(a,b,c){b||t((c?c+": ":"")+a)}function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Qa.length;b++){var d=Qa[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function db(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<Qa.length;d++)if(c)c==Qa[d]&&(c=null);else if(!(a!=Qa[d].type||b&&Qa[d].id.indexOf(b)))return Qa[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
|
||||
function eb(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 k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=A(h))&&g.binding&&a.ja(g.type,g.binding,h,g.value),l=k.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}
|
||||
w.prototype={constructor:w,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ja:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.Ba=this.L[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.ga=function(a){this.g(a,this.$a)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.$a+": "+a)},ga:function(a,b,c){La(a,b,c||this.type)},za:function(){return this.D.sa=!0},Da:function(a,b){b&&(this.D.sa=!1);return!0}};function D(a,b,c,d,e,f,h){a.H&&(!0===h?h=0:null==h&&(h=a.oa),fb(a.H,a,b,c,d,e,f,h))}function gb(a,b,c){a.H&&(!0===c||hb(a,c|0))&&a.H.message(b,void 0)}
|
||||
function hb(a,b){if(a.H){a===a.H?b|=0:b=b||a.oa;var c=a.H.oa&b;return!!b&&c===b||!!(c&a.H.ld)}return!1}function ib(a,b){if(a.D.Vb)return a.D.gb&&(a.D.gb=!1),a.D.Vb=!1;if(a.D.ib)return a.g(a.toString()+" error"),!1;a.D.gb=b;return a.D.gb}function jb(a,b){a.D.gb&&(b?a.D.Vb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.D.gb}function E(a){if(!a.D.ib&&(a.D.jb=!0,a.D.jb)){var b=a.Mb;a.Mb=null;b&&b()}}function kb(a,b){b&&(a.D.jb?b():a.Mb=b);return a.D.jb}function lb(a,b){a.D.ib=!0;a.ga(b)}
|
||||
var ob="undefined"!==typeof ArrayBuffer,pb=[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 qb(a){w.call(this,"Panel",a,qb)}$a(qb);m=qb.prototype;m.ja=function(a,b,c,d){return this.u&&this.u.ja(a,b,c,d)||this.b&&this.b.ja(a,b,c,d)||this.ba&&this.ba.ja(a,b,c,d)||this.H&&this.H.ja(a,b,c,d)?!0:this.parent.ja.call(this,a,b,c,d)};m.Na=function(a,b,c,d){this.u=a;this.w=b;this.b=c;this.H=d;this.ba=rb(a,"Keyboard")};m.za=function(a,b){b||sb();return!0};m.Da=function(){return!0};m.Ea=function(){};
|
||||
function sb(){for(var a=!1,b=B(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<Qa.length;h++)if(Qa[h].id===f){f=Qa[h];break a}f=null}f||(a=!0,f=new qb(e));eb(f,d);a&&E(f)}}Ja(sb);
|
||||
function tb(a,b,c){w.call(this,"Bus",a,tb);this.b=b;this.H=c;this.J=a.busWidth||16;this.O=Math.pow(2,this.J);this.B=this.O-1|0;this.la=16>=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ca=1<<this.la;this.Y=this.Ca>>2;this.w=this.Ca-1;this.M=this.O/this.Ca|0;this.K=this.M-1;this.u=[];this.A=[];this.F=this.I=!1;this.Z=[];this.ba=[];a=new F;ub(a,this.H);this.V=Array(this.M);for(b=0;b<this.M;b++)this.V[b]=a;E(this)}$a(tb);m=tb.prototype;m.reset=function(){};m.za=function(a,b){b||this.reset();return!0};
|
||||
function vb(a,b,c,d){for(var e=b,f=c,h=e>>>a.la;0<f&&h<a.V.length;){var g=a.V[h],k=h*a.Ca,l=a.Ca-(e-k);l>f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Fb+=g.G-e,g.G=e,!0;if(e>=g.G+g.Fb){l=g.size-(e-k);l>f&&(l=f);g.Fb=e-g.G+l;e=k+a.Ca;f-=l;h++;continue}}return wb(1,e,f)}e=new F(e,l,a.Ca,d);ub(e,a.H,g);a.V[h++]=e;e=k+a.Ca;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+xb[d]+" at "+r(b)),!0):wb(2,b,c)}m.X=function(a){return this.V[(a&this.B)>>>this.la].qb(a&this.w,a)};
|
||||
function yb(a,b){return a.V[(b&a.B)>>>a.la].Db(b&a.w,b)}m.Pa=function(a){var b=a&this.w,c=(a&this.B)>>>this.la;return b!=this.w?this.V[c].yc(b,a):this.V[c++].qb(b,a)|this.V[c&this.K].qb(0,a+1)<<8};function zb(a,b){var c=b&a.w,d=(b&a.B)>>>a.la;return c!=a.w?a.V[d].ac(c,b):a.V[d++].Db(c,b)|a.V[d&a.K].Db(0,b+1)<<8}m.qa=function(a,b){this.V[(a&this.B)>>>this.la].sb(a&this.w,b&255,a)};function Ab(a,b,c){a.V[(b&a.B)>>>a.la].Gb(b&a.w,c&255,b)}
|
||||
m.Rb=function(a,b){var c=a&this.w,d=(a&this.B)>>>this.la;c!=this.w?this.V[d].Bc(c,b&65535,a):(this.V[d++].sb(c,b&255,a),this.V[d&this.K].sb(0,b>>8&255,a+1))};function Bb(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.u[b]&&(a.u[b]=[null,!1]);a.u[b][1]=!a.u[b][1];return a.u[b][1]}function Cb(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.u[k]?t("Input port "+r(k)+" already registered"):f.u[k]=[g,!1]}}
|
||||
function Db(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.u[b],g=a.Z[b]||1,k=1==g?255:2==g?65535:-1,l=k;void 0!==h?(h[0]&&(l=h[0](b,c),void 0===l?l=k:l&=k),a.H&&a.F!=h[1]&&Eb(a.H,b,l)):a.H&&(fb(a.H,a,b,null,c),a.F&&Eb(a.H,b,l));e|=l<<f;f+=g<<3;b+=g;d-=g}return e}function Fb(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[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.A[k]?t("Output port "+r(k)+" already registered"):f.A[k]=[g,!1]}}function Hb(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.A[b],g=a.ba[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.I!=h[1]&&Ib(a.H,b,k)}else a.H&&(fb(a.H,a,b,k,d),a.I&&Ib(a.H,b,k));f+=g<<3;b+=g;e-=g}}
|
||||
function wb(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Jb;if(ob){var Kb=new ArrayBuffer(2);(new DataView(Kb)).setUint16(0,256,!0);Jb=256===(new Uint16Array(Kb))[0]}else Jb=!1;var Lb=Jb;
|
||||
function F(a,b,c,d){this.id=Ub+=2;this.b=null;this.G=a;this.Fb=b;this.size=c||0;this.type=d||Vb;this.L=d==Wb;ub(this);this.La=this.qc=!1;if(c)if(ob)this.F=new ArrayBuffer(c),this.I=new DataView(this.F,0,c),this.w=new Uint8Array(this.F,0,c),this.K=new Uint16Array(this.F,0,c>>1),this.b=new Int32Array(this.F,0,c>>2),Xb(this,Lb?Yb:Zb);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Xb(this,$b)}else Xb(this)}var Vb=0,Wb=2,xb=["NONE","RAM","ROM","VID","H/W"],Ub=0;
|
||||
F.prototype={constructor:F,parent:null,save:function(){var a,b;if(ob)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.I.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(ob)for(b=0;b<a.length;b++)this.I.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},Ua:function(a,b){b?0===this.A++&&ac(this,bc,!1):0===this.u++&&cc(this,bc,!1)},M:function(){this.H&&hb(this.H,129)&&this.H.message("attempt to read invalid block %"+n(this.G),!0);
|
||||
return 255},B:function(a,b){this.H&&hb(this.H,129)&&this.H.message("attempt to write "+r(b)+" to invalid block %"+n(this.G),!0)},O:function(a,b){return this.qb(a++,b++)|this.qb(a,b)<<8},J:function(a,b,c){this.sb(a++,b&255,c++);this.sb(a,b>>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},na: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},Fa:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.La=!0},Ka: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.La=!0},Z:function(a,b){if(this.H&&null!=this.G){var c=this.H;dc(c,this.G+a,1,c.Z)&&c.ka(!0)}return this.Db(a,b)},fa:function(a,b){if(this.H&&null!=this.G){var c=this.H;dc(c,this.G+a,2,c.Z)&&c.ka(!0)}return this.ac(a,b)},wa:function(a,b,c){if(this.H&&null!=this.G){var d=this.H;dc(d,this.G+a,1,d.I)&&d.ka(!0)}this.L?this.B(a,b,c):this.Gb(a,b,c)},Ha:function(a,
|
||||
b,c){if(this.H&&null!=this.G){var d=this.H;dc(d,this.G+a,2,d.I)&&d.ka(!0)}this.L?this.B(a,b,c):this.bc(a,b,c)},Y:function(a){return this.w[a]},ba:function(a){return this.w[a]},ea:function(a){return this.I.getUint16(a,!0)},ma:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},ra:function(a,b){this.w[a]=b;this.La=!0},Aa:function(a,b){this.w[a]=b;this.La=!0},Ga:function(a,b){this.I.setUint16(a,b,!0);this.La=!0},$a:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.La=!0}};
|
||||
function ub(a,b,c){a.H=b;a.u=a.A=0;c&&((a.u=c.u)&&cc(a,bc,!1),(a.A=c.A)&&ac(a,bc,!1))}function ec(a,b){b?0===--a.A&&(a.sb=a.L?a.B:a.Gb,a.Bc=a.L?a.J:a.bc):0===--a.u&&(a.qb=a.Db,a.yc=a.ac)}function ac(a,b,c){c&&a.A||(a.sb=!a.L&&b[2]||a.B,a.Bc=!a.L&&b[3]||a.J);if(c||void 0===c)a.Gb=b[2]||a.B,a.bc=b[3]||a.J}function cc(a,b,c){c&&a.u||(a.qb=b[0]||a.M,a.yc=b[1]||a.O);if(c||void 0===c)a.Db=b[0]||a.M,a.ac=b[1]||a.O}function Xb(a,b){b||(b=fc);cc(a,b,void 0);ac(a,b,void 0)}
|
||||
var fc=[],$b=[F.prototype.da,F.prototype.na,F.prototype.Fa,F.prototype.Ka],bc=[F.prototype.Z,F.prototype.fa,F.prototype.wa,F.prototype.Ha];if(ob)var Zb=[F.prototype.Y,F.prototype.ea,F.prototype.ra,F.prototype.Ga],Yb=[F.prototype.ba,F.prototype.ma,F.prototype.Aa,F.prototype.$a];
|
||||
function gc(a,b){w.call(this,"CPU",a,gc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.pb=c;this.i.Ob=0;this.i.Ya=d;this.i.Xb=Math.round(this.i.pb/1E4)/100;this.i.Wa=this.i.Xb*this.i.Ya;this.D.va=!1;this.D.Wb=!1;this.D.pc=a.autoStart;this.D.rc=!1;this.D.hb=!1;this.i.xb=this.i.mb=0;this.i.yb=a.csStart;this.i.lb=a.csInterval;this.i.nb=a.csStop;this.ba=this.Za.bind(this);E(this)}$a(gc);var hc=["power","reset"];m=gc.prototype;
|
||||
m.Na=function(a,b,c,d){this.u=a;this.w=b;this.H=d;for(b=0;b<hc.length;b++)(c=this.L[hc[b]])&&this.u.ja(null,hc[b],c);this.M=(b=rb(a,"Video"))&&Math.max(b.jd,b.Tb)||60;this.A=rb(a,"ChipSet");a=ic(a,"autoStart");null!=a&&(this.D.pc="true"==a?!0:"false"==a?!1:!!a);E(this)};m.reset=function(){this.i.Ob=0};m.save=function(){return null};m.restore=function(){return!1};
|
||||
m.za=function(a,b){if(!b){if(a&&this.restore){jc(this);if(!this.restore(a))return!1;kc(this)}else this.reset();if(this.H){var c=this.H;c.g("Type ? for help with PC8080 Debugger commands");c.Ea();if(c.Ka){var d=c.Ka;c.Ka=null;lc(c,d)}}else this.g("No debugger detected")}mc(this);return!0};m.Da=function(a){return a?this.save():!0};function nc(a){(a.D.pc||!a.H&&void 0===a.L.run)&&a.Za(!0)}m.sc=function(){return 0};
|
||||
function kc(a){void 0===a.i.yb&&(a.i.yb=0);void 0===a.i.lb&&(a.i.lb=-1);void 0===a.i.nb&&(a.i.nb=-1);a.D.hb=0<=a.i.yb&&0<a.i.lb;a.D.hb&&(a.i.xb=0,a.i.mb=a.i.yb-a.J)}function oc(a,b){if(a.D.hb){var c=!1;a.i.xb=a.i.xb+a.sc()|0;a.i.mb-=b;0>=a.i.mb&&(a.i.mb+=a.i.lb,c=!0);0<=a.i.nb&&a.i.nb<=pc(a)&&(a.i.lb=a.i.nb=-1,kc(a),a.ka(),c=!0);c&&a.g(pc(a)+" cycles: checksum="+n(a.i.xb))}}
|
||||
m.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.u)if(a=d.u,a.D.sa)a=!0;else{var b=null,c,g=cb(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.D.jb);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.D.sa);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.D.jb?"powered yet":"ready yet"+(b.Mb?" (waiting for notification)":""))+".");a=!1}a&&(d.D.va?d.ka(!0):d.Za(!0))};a=
|
||||
!0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Cc(d,d.i.Ya<<1,!0)},c.textContent=this.i.Wa.toFixed(2)+"Mhz",a=!0}return a};function Dc(a,b,c){a.J+=b;c&&(a.F=a.b=0)}
|
||||
function Ec(a,b){var c=30;c<a.M&&(c=a.M);2>c&&(c=2);var d=1;b&&1<a.i.Ya&&a.i.Va&&(d=a.i.Va/a.i.Xb);a.i.uc=Math.round(1E3/30);a.i.wd=Math.floor(a.i.pb/c*d);a.i.Zb=Math.floor(a.i.pb/30*d);a.i.wc=Math.floor(a.i.pb/a.M*d);a.i.vc=Math.floor(a.i.pb/2*d);b||(a.i.ob=a.i.Zb,a.i.Ab=a.i.wc,a.i.zb=a.i.vc);a.i.$b=0}function pc(a){return a.J+a.I+a.F-a.b}function jc(a){a.i.Va=0;a.J=a.I=a.F=a.b=0;kc(a);Cc(a,1)}
|
||||
function Cc(a,b,c){var d=!1;if(void 0!==b){.8>a.i.Va/a.i.Wa?b=1:d=!0;a.i.Ya=b;b=a.i.Xb*a.i.Ya;if(a.i.Wa!=b){a.i.Wa=b;b=a.i.Wa.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.u&&a.u.Eb()}Dc(a,a.I);a.I=0;a.i.kb=la();a.i.Xa=0;Ec(a);return d}
|
||||
m.Za=function(a){if(ib(this,!0)){if(!this.D.va){Cc(this);this.u&&this.u.start(this.i.kb,pc(this));this.D.va=!0;this.D.Wb=!0;this.A&&this.A.start();var b=this.L.run;b&&(b.textContent="Halt");this.u&&(this.u.Ea(!0),a&&this.u.Eb(!0))}this.i.$b>=this.i.pb&&Ec(this,!0);this.i.Bb=0;this.i.Nb=la();this.i.Xa&&(a=this.i.Nb-this.i.Xa,a>this.i.uc&&(this.i.kb+=a,this.i.kb>this.i.Nb&&(this.i.kb=this.i.Nb)));try{do{this.rb(this.D.hb?1:this.i.wd);var c=this.F-this.b;this.I+=c;this.i.Bb+=c;Dc(this,0,!0);oc(this,
|
||||
c);this.i.Ab-=c;0>=this.i.Ab&&(this.i.Ab+=this.i.wc,this.u&&Fc(this.u,this.i.Ob++),this.i.Ob>this.M&&(this.i.Ob=0));this.i.zb-=c;0>=this.i.zb&&(this.i.zb+=this.i.vc,this.u&&this.u.Ea());this.i.ob-=c;if(0>=this.i.ob){this.i.ob+=this.i.Zb;break}}while(this.D.va)}catch(e){this.ka();mc(this);this.u&&this.u.stop(la(),pc(this));ib(this,!1);lb(this,e.stack||e.message);return}c=setTimeout;a=this.ba;this.i.Xa=la();b=this.i.uc;this.i.Bb&&(b=Math.round(b*this.i.Bb/this.i.Zb));var b=b-(this.i.Xa-this.i.Nb),d=
|
||||
this.i.Xa-this.i.kb;d&&(this.i.Va=Math.round(this.I/(10*d))/100,864E5<=d&&(this.J=0,Cc(this)));if(0>b||this.i.Va<this.i.Wa)b=0;this.i.$b+=this.i.Bb;this.i.Xa+=b;c(a,b)}else mc(this),this.u&&this.u.stop(la(),pc(this))};m.rb=function(){return 0};m.ka=function(a){jb(this,!0);this.F-=this.b;this.b=0;Dc(this,this.I);this.I=0;if(this.D.va){this.D.va=!1;this.A&&this.A.stop();var b=this.L.run;b&&(b.textContent="Run")}this.D.Lb=a};function mc(a,b){a.u&&(Fc(a.u,-1),a.u.Ea(b))}
|
||||
function Gc(a){this.tc=+a.model||8080;gc.call(this,a,1E6);this.O=Hc;jc(this);this.D.Lb=this.D.md=!1;this.Z=0;this.K=[];this.Y=0;Ic(this)}$a(Gc,gc);function Jc(a,b){a.K.push(b)}m=Gc.prototype;m.reset=function(){this.D.va&&this.ka();Ic(this);jc(this);this.D.ib=!1;this.parent.reset.call(this)};function Ic(a){a.j=0;a.P=0;a.R=0;a.S=0;a.T=0;a.U=0;a.W=0;a.ia=0;G(a,a.Y);Kc(a,0);a.B=0}function Lc(a,b){a.Y=b;G(a,b)}
|
||||
m.sc=function(){var a=this.j+this.P+this.R+this.S+this.T+this.U+this.W|0;return a=a+this.ia+this.N+Mc(this)|0};
|
||||
m.save=function(){var a=new H(this);I(a,0,[this.j,this.P,this.R,this.S,this.T,this.U,this.W,this.ia,this.N,Mc(this)]);I(a,1,[this.B,this.J,this.i.Ya]);for(var b=this.w,c=0,d=[],e=0;e<b.M;e++){var f=b.V[e];if(f.La||f.qc){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;l[k++]=q-g;l[k++]=p;g=q}if(l.length<f.length){f=l;break a}}d[h]=f}}I(a,2,d);return a.data()};
|
||||
m.restore=function(a){var b=a[0];this.j=b[0];this.P=b[1];this.R=b[2];this.S=b[3];this.T=b[4];this.U=b[5];this.W=b[6];this.ia=b[7]&65535;G(this,b[8]);Kc(this,b[9]);b=a[1];this.B=b[0];this.J=b[1];Cc(this,b[3]);a:{b=this.w;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.Y){for(var f=0,h=Array(b.Y),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.V[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
m.ja=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.L[b]=c;this.Z++;d=!0;break;default:d=this.parent.ja.call(this,a,b,c)}return d};function Nc(a){return a.P<<8|a.R}function Oc(a,b){a.P=b>>8&255;a.R=b&255}function Pc(a){return a.S<<8|a.T}function Qc(a,b){a.S=b>>8&255;a.T=b&255}function J(a){return a.U<<8|a.W}
|
||||
function Rc(a,b){a.U=b>>8&255;a.W=b&255}function G(a,b){a.N=b&65535}function Sc(a){return a.aa&256?1:0}function Tc(a,b){a.aa=a.aa&255|b}function Uc(a){return pb[a.ca&255]?4:0}function Vc(a){return(a.ca^a.ua)&16?16:0}function Wc(a){return a.aa&255?0:64}function Xc(a){return a.ca&128?128:0}function Mc(a){return a.ta&-214|Xc(a)|Wc(a)|Vc(a)|Uc(a)|Sc(a)}function Kc(a,b){a.aa=a.ca=a.ua=0;b&1&&(a.aa|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.aa|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2}
|
||||
function $a(a,b){b||(b=v);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var Oa=[],ab={};function bb(a,b,c){ab[a]&&b&&(ab[a][b]=c)}function La(a,b,c){b||u((c?c+": ":"")+a)}function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Oa.length;b++){var d=Oa[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function db(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<Oa.length;d++)if(c)c==Oa[d]&&(c=null);else if(!(a!=Oa[d].type||b&&Oa[d].id.indexOf(b)))return Oa[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){u(c.message+" ("+a+")")}return b}
|
||||
function eb(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 k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=y(h))&&g.binding&&a.ja(g.type,g.binding,h,g.value),l=k.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}
|
||||
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ja:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.Ba=this.L[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.ga=function(a){this.g(a,this.ab)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.ab+": "+a)},ga:function(a,b,c){La(a,b,c||this.type)},Aa:function(){return this.C.sa=!0},Da:function(a,b){b&&(this.C.sa=!1);return!0}};function C(a,b,c,d,e,f,h){a.I&&(!0===h?h=0:null==h&&(h=a.oa),fb(a.I,a,b,c,d,e,f,h))}function gb(a,b,c){a.I&&(!0===c||hb(a,c|0))&&a.I.message(b,void 0)}
|
||||
function hb(a,b){if(a.I){a===a.I?b|=0:b=b||a.oa;var c=a.I.oa&b;return!!b&&c===b||!!(c&a.I.nd)}return!1}function ib(a,b){if(a.C.Vb)return a.C.gb&&(a.C.gb=!1),a.C.Vb=!1;if(a.C.ib)return a.g(a.toString()+" error"),!1;a.C.gb=b;return a.C.gb}function jb(a,b){a.C.gb&&(b?a.C.Vb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.C.gb}function D(a){if(!a.C.ib&&(a.C.jb=!0,a.C.jb)){var b=a.Mb;a.Mb=null;b&&b()}}function kb(a,b){b&&(a.C.jb?b():a.Mb=b);return a.C.jb}function lb(a,b){a.C.ib=!0;a.ga(b)}
|
||||
var mb="undefined"!==typeof ArrayBuffer,pb=[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 qb(a){v.call(this,"Panel",a,qb)}$a(qb);m=qb.prototype;m.ja=function(a,b,c,d){return this.w&&this.w.ja(a,b,c,d)||this.b&&this.b.ja(a,b,c,d)||this.M&&this.M.ja(a,b,c,d)||this.I&&this.I.ja(a,b,c,d)?!0:this.parent.ja.call(this,a,b,c,d)};m.Na=function(a,b,c,d){this.w=a;this.B=b;this.b=c;this.I=d;this.M=rb(a,"Keyboard")};m.Aa=function(a,b){b||sb();return!0};m.Da=function(){return!0};m.Ea=function(){};
|
||||
function sb(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<Oa.length;h++)if(Oa[h].id===f){f=Oa[h];break a}f=null}f||(a=!0,f=new qb(e));eb(f,d);a&&D(f)}}Ja(sb);
|
||||
function tb(a,b,c){v.call(this,"Bus",a,tb);this.b=b;this.I=c;this.J=a.busWidth||16;this.O=Math.pow(2,this.J);this.D=this.O-1|0;this.ma=16>=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ca=1<<this.ma;this.P=this.Ca>>2;this.B=this.Ca-1;this.M=this.O/this.Ca|0;this.K=this.M-1;this.w=[];this.A=[];this.F=this.H=!1;this.Z=[];this.ba=[];a=new E;ub(a,this.I);this.W=Array(this.M);for(b=0;b<this.M;b++)this.W[b]=a;D(this)}$a(tb);m=tb.prototype;m.reset=function(){};m.Aa=function(a,b){b||this.reset();return!0};
|
||||
function vb(a,b,c,d){for(var e=b,f=c,h=e>>>a.ma;0<f&&h<a.W.length;){var g=a.W[h],k=h*a.Ca,l=a.Ca-(e-k);l>f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Fb+=g.G-e,g.G=e,!0;if(e>=g.G+g.Fb){l=g.size-(e-k);l>f&&(l=f);g.Fb=e-g.G+l;e=k+a.Ca;f-=l;h++;continue}}return wb(1,e,f)}e=new E(e,l,a.Ca,d);ub(e,a.I,g);a.W[h++]=e;e=k+a.Ca;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+xb[d]+" at "+t(b)),!0):wb(2,b,c)}m.Y=function(a){return this.W[(a&this.D)>>>this.ma].qb(a&this.B,a)};
|
||||
function yb(a,b){return a.W[(b&a.D)>>>a.ma].Db(b&a.B,b)}m.Qa=function(a){var b=a&this.B,c=(a&this.D)>>>this.ma;return b!=this.B?this.W[c].Ac(b,a):this.W[c++].qb(b,a)|this.W[c&this.K].qb(0,a+1)<<8};function zb(a,b){var c=b&a.B,d=(b&a.D)>>>a.ma;return c!=a.B?a.W[d].ac(c,b):a.W[d++].Db(c,b)|a.W[d&a.K].Db(0,b+1)<<8}m.qa=function(a,b){this.W[(a&this.D)>>>this.ma].sb(a&this.B,b&255,a)};function Ab(a,b,c){a.W[(b&a.D)>>>a.ma].Gb(b&a.B,c&255,b)}
|
||||
m.Rb=function(a,b){var c=a&this.B,d=(a&this.D)>>>this.ma;c!=this.B?this.W[d].Cc(c,b&65535,a):(this.W[d++].sb(c,b&255,a),this.W[d&this.K].sb(0,b>>8&255,a+1))};function Bb(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.w[b]&&(a.w[b]=[null,!1]);a.w[b][1]=!a.w[b][1];return a.w[b][1]}function Cb(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.w[k]?u("Input port "+t(k)+" already registered"):f.w[k]=[g,!1]}}
|
||||
function Db(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.w[b],g=a.Z[b]||1,k=1==g?255:2==g?65535:-1,l=k;void 0!==h?(h[0]&&(l=h[0](b,c),void 0===l?l=k:l&=k),a.I&&a.F!=h[1]&&Eb(a.I,b,l)):a.I&&(fb(a.I,a,b,null,c),a.F&&Eb(a.I,b,l));e|=l<<f;f+=g<<3;b+=g;d-=g}return e}function Fb(a,b){if(void 0===b)return a.H=!a.H,a.H;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[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.A[k]?u("Output port "+t(k)+" already registered"):f.A[k]=[g,!1]}}function Hb(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.A[b],g=a.ba[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.H!=h[1]&&Ib(a.I,b,k)}else a.I&&(fb(a.I,a,b,k,d),a.H&&Ib(a.I,b,k));f+=g<<3;b+=g;e-=g}}
|
||||
function wb(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Jb;if(mb){var Kb=new ArrayBuffer(2);(new DataView(Kb)).setUint16(0,256,!0);Jb=256===(new Uint16Array(Kb))[0]}else Jb=!1;var Lb=Jb;
|
||||
function E(a,b,c,d){this.id=Ub+=2;this.b=null;this.G=a;this.Fb=b;this.size=c||0;this.type=d||Vb;this.L=d==Wb;ub(this);this.La=this.sc=!1;if(c)if(mb)this.F=new ArrayBuffer(c),this.H=new DataView(this.F,0,c),this.B=new Uint8Array(this.F,0,c),this.K=new Uint16Array(this.F,0,c>>1),this.b=new Int32Array(this.F,0,c>>2),Xb(this,Lb?Yb:Zb);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Xb(this,$b)}else Xb(this)}var Vb=0,Wb=2,xb=["NONE","RAM","ROM","VID","H/W"],Ub=0;
|
||||
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(mb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.H.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(mb)for(b=0;b<a.length;b++)this.H.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},Va:function(a,b){b?0===this.A++&&ac(this,bc,!1):0===this.w++&&cc(this,bc,!1)},M:function(){this.I&&hb(this.I,129)&&this.I.message("attempt to read invalid block %"+n(this.G),!0);
|
||||
return 255},D:function(a,b){this.I&&hb(this.I,129)&&this.I.message("attempt to write "+t(b)+" to invalid block %"+n(this.G),!0)},O:function(a,b){return this.qb(a++,b++)|this.qb(a,b)<<8},J:function(a,b,c){this.sb(a++,b&255,c++);this.sb(a,b>>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},na: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},Fa:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.La=!0},ab: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.La=!0},Z:function(a,b){if(this.I&&null!=this.G){var c=this.I;dc(c,this.G+a,1,c.Z)&&c.ka(!0)}return this.Db(a,b)},fa:function(a,b){if(this.I&&null!=this.G){var c=this.I;dc(c,this.G+a,2,c.Z)&&c.ka(!0)}return this.ac(a,b)},wa:function(a,b,c){if(this.I&&null!=this.G){var d=this.I;dc(d,this.G+a,1,d.H)&&d.ka(!0)}this.L?this.D(a,b,c):this.Gb(a,b,c)},Ha:function(a,
|
||||
b,c){if(this.I&&null!=this.G){var d=this.I;dc(d,this.G+a,2,d.H)&&d.ka(!0)}this.L?this.D(a,b,c):this.cc(a,b,c)},P:function(a){return this.B[a]},ba:function(a){return this.B[a]},ea:function(a){return this.H.getUint16(a,!0)},la:function(a){return a&1?this.B[a]|this.B[a+1]<<8:this.K[a>>1]},ra:function(a,b){this.B[a]=b;this.La=!0},xa:function(a,b){this.B[a]=b;this.La=!0},Ga:function(a,b){this.H.setUint16(a,b,!0);this.La=!0},Ka:function(a,b){a&1?(this.B[a]=b,this.B[a+1]=b>>8):this.K[a>>1]=b;this.La=!0}};
|
||||
function ub(a,b,c){a.I=b;a.w=a.A=0;c&&((a.w=c.w)&&cc(a,bc,!1),(a.A=c.A)&&ac(a,bc,!1))}function ec(a,b){b?0===--a.A&&(a.sb=a.L?a.D:a.Gb,a.Cc=a.L?a.J:a.cc):0===--a.w&&(a.qb=a.Db,a.Ac=a.ac)}function ac(a,b,c){c&&a.A||(a.sb=!a.L&&b[2]||a.D,a.Cc=!a.L&&b[3]||a.J);if(c||void 0===c)a.Gb=b[2]||a.D,a.cc=b[3]||a.J}function cc(a,b,c){c&&a.w||(a.qb=b[0]||a.M,a.Ac=b[1]||a.O);if(c||void 0===c)a.Db=b[0]||a.M,a.ac=b[1]||a.O}function Xb(a,b){b||(b=fc);cc(a,b,void 0);ac(a,b,void 0)}
|
||||
var fc=[],$b=[E.prototype.da,E.prototype.na,E.prototype.Fa,E.prototype.ab],bc=[E.prototype.Z,E.prototype.fa,E.prototype.wa,E.prototype.Ha];if(mb)var Zb=[E.prototype.P,E.prototype.ea,E.prototype.ra,E.prototype.Ga],Yb=[E.prototype.ba,E.prototype.la,E.prototype.xa,E.prototype.Ka];
|
||||
function gc(a,b){v.call(this,"CPU",a,gc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.pb=c;this.i.Ob=0;this.i.Za=d;this.i.Xb=Math.round(this.i.pb/1E4)/100;this.i.Xa=this.i.Xb*this.i.Za;this.C.va=!1;this.C.Wb=!1;this.C.rc=a.autoStart;this.C.tc=!1;this.C.hb=!1;this.i.xb=this.i.mb=0;this.i.yb=a.csStart;this.i.lb=a.csInterval;this.i.nb=a.csStop;this.ba=this.$a.bind(this);D(this)}$a(gc);var hc=["power","reset"];m=gc.prototype;
|
||||
m.Na=function(a,b,c,d){this.w=a;this.B=b;this.I=d;for(b=0;b<hc.length;b++)(c=this.L[hc[b]])&&this.w.ja(null,hc[b],c);this.M=(b=rb(a,"Video"))&&Math.max(b.ld,b.Tb)||60;this.D=rb(a,"ChipSet");a=ic(a,"autoStart");null!=a&&(this.C.rc="true"==a?!0:"false"==a?!1:!!a);D(this)};m.reset=function(){this.i.Ob=0};m.save=function(){return null};m.restore=function(){return!1};
|
||||
m.Aa=function(a,b){if(!b){if(a&&this.restore){jc(this);if(!this.restore(a))return!1;kc(this)}else this.reset();if(this.I){var c=this.I;c.g("Type ? for help with PC8080 Debugger commands");c.Ea();if(c.Ka){var d=c.Ka;c.Ka=null;lc(c,d)}}else this.g("No debugger detected")}mc(this);return!0};m.Da=function(a){return a?this.save():!0};function nc(a){(a.C.rc||!a.I&&void 0===a.L.run)&&a.$a(!0)}m.uc=function(){return 0};
|
||||
function kc(a){void 0===a.i.yb&&(a.i.yb=0);void 0===a.i.lb&&(a.i.lb=-1);void 0===a.i.nb&&(a.i.nb=-1);a.C.hb=0<=a.i.yb&&0<a.i.lb;a.C.hb&&(a.i.xb=0,a.i.mb=a.i.yb-a.J)}function oc(a,b){if(a.C.hb){var c=!1;a.i.xb=a.i.xb+a.uc()|0;a.i.mb-=b;0>=a.i.mb&&(a.i.mb+=a.i.lb,c=!0);0<=a.i.nb&&a.i.nb<=pc(a)&&(a.i.lb=a.i.nb=-1,kc(a),a.ka(),c=!0);c&&a.g(pc(a)+" cycles: checksum="+n(a.i.xb))}}
|
||||
m.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.w)if(a=d.w,a.C.sa)a=!0;else{var b=null,c,g=cb(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.C.jb);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.C.sa);c++);c==g.length&&(b=a);u("The "+b.type+" component ("+b.id+") is not "+(b.C.jb?"powered yet":"ready yet"+(b.Mb?" (waiting for notification)":""))+".");a=!1}a&&(d.C.va?d.ka(!0):d.$a(!0))};a=
|
||||
!0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Cc(d,d.i.Za<<1,!0)},c.textContent=this.i.Xa.toFixed(2)+"Mhz",a=!0}return a};function Dc(a,b,c){a.J+=b;c&&(a.F=a.b=0)}
|
||||
function Ec(a,b){var c=30;c<a.M&&(c=a.M);2>c&&(c=2);var d=1;b&&1<a.i.Za&&a.i.Wa&&(d=a.i.Wa/a.i.Xb);a.i.wc=Math.round(1E3/30);a.i.yd=Math.floor(a.i.pb/c*d);a.i.Zb=Math.floor(a.i.pb/30*d);a.i.yc=Math.floor(a.i.pb/a.M*d);a.i.xc=Math.floor(a.i.pb/2*d);b||(a.i.ob=a.i.Zb,a.i.Ab=a.i.yc,a.i.zb=a.i.xc);a.i.$b=0}function pc(a){return a.J+a.H+a.F-a.b}function jc(a){a.i.Wa=0;a.J=a.H=a.F=a.b=0;kc(a);Cc(a,1)}
|
||||
function Cc(a,b,c){var d=!1;if(void 0!==b){.8>a.i.Wa/a.i.Xa?b=1:d=!0;a.i.Za=b;b=a.i.Xb*a.i.Za;if(a.i.Xa!=b){a.i.Xa=b;b=a.i.Xa.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.w&&a.w.Eb()}Dc(a,a.H);a.H=0;a.i.kb=ma();a.i.Ya=0;Ec(a);return d}
|
||||
m.$a=function(a){if(ib(this,!0)){if(!this.C.va){Cc(this);this.w&&this.w.start(this.i.kb,pc(this));this.C.va=!0;this.C.Wb=!0;this.D&&this.D.start();var b=this.L.run;b&&(b.textContent="Halt");this.w&&(this.w.Ea(!0),a&&this.w.Eb(!0))}this.i.$b>=this.i.pb&&Ec(this,!0);this.i.Bb=0;this.i.Nb=ma();this.i.Ya&&(a=this.i.Nb-this.i.Ya,a>this.i.wc&&(this.i.kb+=a,this.i.kb>this.i.Nb&&(this.i.kb=this.i.Nb)));try{do{this.rb(this.C.hb?1:this.i.yd);var c=this.F-this.b;this.H+=c;this.i.Bb+=c;Dc(this,0,!0);oc(this,
|
||||
c);this.i.Ab-=c;0>=this.i.Ab&&(this.i.Ab+=this.i.yc,this.w&&Fc(this.w,this.i.Ob++),this.i.Ob>this.M&&(this.i.Ob=0));this.i.zb-=c;0>=this.i.zb&&(this.i.zb+=this.i.xc,this.w&&this.w.Ea());this.i.ob-=c;if(0>=this.i.ob){this.i.ob+=this.i.Zb;break}}while(this.C.va)}catch(e){this.ka();mc(this);this.w&&this.w.stop(ma(),pc(this));ib(this,!1);lb(this,e.stack||e.message);return}c=setTimeout;a=this.ba;this.i.Ya=ma();b=this.i.wc;this.i.Bb&&(b=Math.round(b*this.i.Bb/this.i.Zb));var b=b-(this.i.Ya-this.i.Nb),d=
|
||||
this.i.Ya-this.i.kb;d&&(this.i.Wa=Math.round(this.H/(10*d))/100,864E5<=d&&(this.J=0,Cc(this)));if(0>b||this.i.Wa<this.i.Xa)b=0;this.i.$b+=this.i.Bb;this.i.Ya+=b;c(a,b)}else mc(this),this.w&&this.w.stop(ma(),pc(this))};m.rb=function(){return 0};m.ka=function(a){jb(this,!0);this.F-=this.b;this.b=0;Dc(this,this.H);this.H=0;if(this.C.va){this.C.va=!1;this.D&&this.D.stop();var b=this.L.run;b&&(b.textContent="Run")}this.C.Lb=a};function mc(a,b){a.w&&(Fc(a.w,-1),a.w.Ea(b))}
|
||||
function Gc(a){this.vc=+a.model||8080;gc.call(this,a,1E6);this.O=Hc;jc(this);this.C.Lb=this.C.od=!1;this.Z=0;this.K=[];this.P=0;Ic(this)}$a(Gc,gc);function Jc(a,b){a.K.push(b)}m=Gc.prototype;m.reset=function(){this.C.va&&this.ka();Ic(this);jc(this);this.C.ib=!1;this.parent.reset.call(this)};function Ic(a){a.j=0;a.R=0;a.S=0;a.T=0;a.U=0;a.V=0;a.X=0;a.ia=0;F(a,a.P);Kc(a,0);a.A=0}function Lc(a,b){a.P=b;F(a,b)}
|
||||
m.uc=function(){var a=this.j+this.R+this.S+this.T+this.U+this.V+this.X|0;return a=a+this.ia+this.N+Mc(this)|0};
|
||||
m.save=function(){var a=new G(this);H(a,0,[this.j,this.R,this.S,this.T,this.U,this.V,this.X,this.ia,this.N,Mc(this)]);H(a,1,[this.A,this.J,this.i.Za]);for(var b=this.B,c=0,d=[],e=0;e<b.M;e++){var f=b.W[e];if(f.La||f.sc){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;l[k++]=q-g;l[k++]=p;g=q}if(l.length<f.length){f=l;break a}}d[h]=f}}H(a,2,d);return a.data()};
|
||||
m.restore=function(a){var b=a[0];this.j=b[0];this.R=b[1];this.S=b[2];this.T=b[3];this.U=b[4];this.V=b[5];this.X=b[6];this.ia=b[7]&65535;F(this,b[8]);Kc(this,b[9]);b=a[1];this.A=b[0];this.J=b[1];Cc(this,b[3]);a:{b=this.B;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.P){for(var f=0,h=Array(b.P),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.W[d];if(!f||!f.restore(e)){u("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
m.ja=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.L[b]=c;this.Z++;d=!0;break;default:d=this.parent.ja.call(this,a,b,c)}return d};function Nc(a){return a.R<<8|a.S}function Oc(a,b){a.R=b>>8&255;a.S=b&255}function Pc(a){return a.T<<8|a.U}function Qc(a,b){a.T=b>>8&255;a.U=b&255}function I(a){return a.V<<8|a.X}
|
||||
function Rc(a,b){a.V=b>>8&255;a.X=b&255}function F(a,b){a.N=b&65535}function Sc(a){return a.aa&256?1:0}function Tc(a,b){a.aa=a.aa&255|b}function Uc(a){return pb[a.ca&255]?4:0}function Vc(a){return(a.ca^a.ua)&16?16:0}function Wc(a){return a.aa&255?0:64}function Xc(a){return a.ca&128?128:0}function Mc(a){return a.ta&-214|Xc(a)|Wc(a)|Vc(a)|Uc(a)|Sc(a)}function Kc(a,b){a.aa=a.ca=a.ua=0;b&1&&(a.aa|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.aa|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2}
|
||||
function Yc(a,b){a.ua=a.j^b;return a.ca=(a.aa=a.j+b)&255}function Zc(a,b){a.ua=a.j^b;return a.ca=(a.aa=a.j+b+(a.aa&256?1:0))&255}function $c(a,b){a.aa=a.ca=a.ua=a.j&b;(a.j|b)&8&&(a.ua^=16);return a.aa}function ad(a,b){a.ua=b^255;b=a.ca=b+255&255;a.aa=a.aa&-256|b;return b}function bd(a,b){a.ua=b;b=a.ca=b+1&255;a.aa=a.aa&-256|b;return b}function cd(a,b){return a.ca=a.aa=a.ua=a.j|b}function L(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.aa=a.j+b+1^256)&255}
|
||||
function dd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.aa=a.j+b+(a.aa&256?0:1)^256)&255}function ed(a,b){return a.ca=a.aa=a.ua=a.j^b}m.X=function(a){return this.w.X(a)};m.qa=function(a,b){this.w.qa(a,b)};function M(a){var b=a.X(a.N);G(a,a.N+1);return b}function N(a){var b=a.w.Pa(a.N);G(a,a.N+2);return b}function O(a){var b=a.w.Pa(a.ia);a.ia=a.ia+2&65535;return b}function Q(a,b){a.ia=a.ia-2&65535;a.w.Rb(a.ia,b)}function fd(a,b){a.B=a.B&-8|b|8}
|
||||
function R(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(lb(a,"Value for "+b+" is invalid"),a.ka()),c=!a.D.va||a.D.rc?n(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))}
|
||||
m.Ea=function(a){this.Z&&(a||!this.D.va||this.D.rc)&&(R(this,"A",this.j),R(this,"B",this.P),R(this,"C",this.R),R(this,"BC",Nc(this),4),R(this,"D",this.S),R(this,"E",this.T),R(this,"DE",Pc(this),4),R(this,"H",this.U),R(this,"L",this.W),R(this,"HL",J(this),4),R(this,"SP",this.ia,4),R(this,"PC",this.N,4),a=Mc(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.L.speed)a.textContent=
|
||||
this.D.va&&this.i.Va?this.i.Va.toFixed(2)+"Mhz":"Stopped"};
|
||||
m.rb=function(a){this.D.Lb=!0;var b=this.D.md=this.H&&gd(this.H),c=a?this.D.Wb?0:1:-1;this.D.Wb=!1;this.F=this.b=a;do{if(this.B){var d;this.B&8&&this.ta&512?(d=199|(this.B&7)<<3,this.B&=-16,this.ta&=-513,this.O[d].call(this),d=!0):d=!1;if(d){if(!a){this.g("interrupt dispatched");break}}else if(this.B&16){this.b=0;break}}if(b){if(Ad(this.H,this.N,c)){this.ka();break}c=1}this.O[M(this)].call(this)}while(0<this.b);return this.D.Lb?this.F-this.b:void 0===this.D.Lb?0:-1};
|
||||
Ja(function(){for(var a=B(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Gc(d);eb(d,c)}});function Bd(){this.b-=4}function Cd(){G(this,N(this));this.b-=10}function Dd(){G(this,O(this));this.b-=10}function Ed(){var a=N(this);Q(this,this.N);G(this,a);this.b-=17}
|
||||
var Hc=[Bd,function(){Oc(this,N(this));this.b-=10},function(){this.qa(Nc(this),this.j);this.b-=7},function(){Oc(this,Nc(this)+1);this.b-=5},function(){this.P=bd(this,this.P);this.b-=5},function(){this.P=ad(this,this.P);this.b-=5},function(){this.P=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>8;Tc(this,a&256);this.b-=4},Bd,function(){var a;Rc(this,a=J(this)+Nc(this));Tc(this,a>>8&256);this.b-=10},function(){this.j=this.X(Nc(this));this.b-=7},function(){Oc(this,Nc(this)-1);this.b-=
|
||||
5},function(){this.R=bd(this,this.R);this.b-=5},function(){this.R=ad(this,this.R);this.b-=5},function(){this.R=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Tc(this,a);this.b-=4},Bd,function(){Qc(this,N(this));this.b-=10},function(){this.qa(Pc(this),this.j);this.b-=7},function(){Qc(this,Pc(this)+1);this.b-=5},function(){this.S=bd(this,this.S);this.b-=5},function(){this.S=ad(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|
|
||||
Sc(this);Tc(this,a&256);this.b-=4},Bd,function(){var a;Rc(this,a=J(this)+Pc(this));Tc(this,a>>8&256);this.b-=10},function(){this.j=this.X(Pc(this));this.b-=7},function(){Qc(this,Pc(this)-1);this.b-=5},function(){this.T=bd(this,this.T);this.b-=5},function(){this.T=ad(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Sc(this)<<8|this.j)>>1;Tc(this,a&256);this.b-=4},Bd,function(){Rc(this,N(this));this.b-=10},function(){var a=N(this);this.w.Rb(a,J(this));
|
||||
this.b-=16},function(){Rc(this,J(this)+1);this.b-=5},function(){this.U=bd(this,this.U);this.b-=5},function(){this.U=ad(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=0,b=Sc(this);if(Vc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Yc(this,a);Tc(this,b?256:0);this.b-=4},Bd,function(){var a;Rc(this,a=J(this)+J(this));Tc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Pa(a);Rc(this,a);this.b-=16},function(){Rc(this,J(this)-1);this.b-=5},function(){this.W=
|
||||
bd(this,this.W);this.b-=5},function(){this.W=ad(this,this.W);this.b-=5},function(){this.W=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Bd,function(){this.ia=N(this)&65535;this.b-=10},function(){this.qa(N(this),this.j);this.b-=13},function(){this.ia=this.ia+1&65535;this.b-=5},function(){var a=J(this);this.qa(a,bd(this,this.X(a)));this.b-=10},function(){var a=J(this);this.qa(a,ad(this,this.X(a)));this.b-=10},function(){this.qa(J(this),M(this));this.b-=10},function(){this.aa|=256;this.b-=
|
||||
4},Bd,function(){var a;Rc(this,a=J(this)+this.ia);Tc(this,a>>8&256);this.b-=10},function(){this.j=this.X(N(this));this.b-=13},function(){this.ia=this.ia-1&65535;this.b-=5},function(){this.j=bd(this,this.j);this.b-=5},function(){this.j=ad(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Tc(this,Sc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.P=this.R;this.b-=5},function(){this.P=this.S;this.b-=5},function(){this.P=this.T;this.b-=5},function(){this.P=this.U;this.b-=
|
||||
5},function(){this.P=this.W;this.b-=5},function(){this.P=this.X(J(this));this.b-=7},function(){this.P=this.j;this.b-=5},function(){this.R=this.P;this.b-=5},function(){this.b-=5},function(){this.R=this.S;this.b-=5},function(){this.R=this.T;this.b-=5},function(){this.R=this.U;this.b-=5},function(){this.R=this.W;this.b-=5},function(){this.R=this.X(J(this));this.b-=7},function(){this.R=this.j;this.b-=5},function(){this.S=this.P;this.b-=5},function(){this.S=this.R;this.b-=5},function(){this.b-=5},function(){this.S=
|
||||
this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.W;this.b-=5},function(){this.S=this.X(J(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.P;this.b-=5},function(){this.T=this.R;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.W;this.b-=5},function(){this.T=this.X(J(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.P;this.b-=5},function(){this.U=
|
||||
this.R;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.W;this.b-=5},function(){this.U=this.X(J(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.W=this.P;this.b-=5},function(){this.W=this.R;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.b-=5},function(){this.W=this.X(J(this));this.b-=7},function(){this.W=this.j;
|
||||
this.b-=5},function(){this.qa(J(this),this.P);this.b-=7},function(){this.qa(J(this),this.R);this.b-=7},function(){this.qa(J(this),this.S);this.b-=7},function(){this.qa(J(this),this.T);this.b-=7},function(){this.qa(J(this),this.U);this.b-=7},function(){this.qa(J(this),this.W);this.b-=7},function(){var a=this.N-1;if(this.K.length)for(var b=0;b<this.K.length;b++)if(this.K[b](a))return;this.B|=16;this.b-=7;this.H&&hb(this,-2147483648)?(G(this,a),this.H.ka()):this.ta&512||(this.H&&G(this,a),this.ka())},
|
||||
function(){this.qa(J(this),this.j);this.b-=7},function(){this.j=this.P;this.b-=5},function(){this.j=this.R;this.b-=5},function(){this.j=this.S;this.b-=5},function(){this.j=this.T;this.b-=5},function(){this.j=this.U;this.b-=5},function(){this.j=this.W;this.b-=5},function(){this.j=this.X(J(this));this.b-=7},function(){this.b-=5},function(){this.j=Yc(this,this.P);this.b-=4},function(){this.j=Yc(this,this.R);this.b-=4},function(){this.j=Yc(this,this.S);this.b-=4},function(){this.j=Yc(this,this.T);this.b-=
|
||||
4},function(){this.j=Yc(this,this.U);this.b-=4},function(){this.j=Yc(this,this.W);this.b-=4},function(){this.j=Yc(this,this.X(J(this)));this.b-=7},function(){this.j=Yc(this,this.j);this.b-=4},function(){this.j=Zc(this,this.P);this.b-=4},function(){this.j=Zc(this,this.R);this.b-=4},function(){this.j=Zc(this,this.S);this.b-=4},function(){this.j=Zc(this,this.T);this.b-=4},function(){this.j=Zc(this,this.U);this.b-=4},function(){this.j=Zc(this,this.W);this.b-=4},function(){this.j=Zc(this,this.X(J(this)));
|
||||
this.b-=7},function(){this.j=Zc(this,this.j);this.b-=4},function(){this.j=L(this,this.P);this.b-=4},function(){this.j=L(this,this.R);this.b-=4},function(){this.j=L(this,this.S);this.b-=4},function(){this.j=L(this,this.T);this.b-=4},function(){this.j=L(this,this.U);this.b-=4},function(){this.j=L(this,this.W);this.b-=4},function(){this.j=L(this,this.X(J(this)));this.b-=7},function(){this.j=L(this,this.j);this.b-=4},function(){this.j=dd(this,this.P);this.b-=4},function(){this.j=dd(this,this.R);this.b-=
|
||||
4},function(){this.j=dd(this,this.S);this.b-=4},function(){this.j=dd(this,this.T);this.b-=4},function(){this.j=dd(this,this.U);this.b-=4},function(){this.j=dd(this,this.W);this.b-=4},function(){this.j=dd(this,this.X(J(this)));this.b-=7},function(){this.j=dd(this,this.j);this.b-=4},function(){this.j=$c(this,this.P);this.b-=4},function(){this.j=$c(this,this.R);this.b-=4},function(){this.j=$c(this,this.S);this.b-=4},function(){this.j=$c(this,this.T);this.b-=4},function(){this.j=$c(this,this.U);this.b-=
|
||||
4},function(){this.j=$c(this,this.W);this.b-=4},function(){this.j=$c(this,this.X(J(this)));this.b-=7},function(){this.j=$c(this,this.j);this.b-=4},function(){this.j=ed(this,this.P);this.b-=4},function(){this.j=ed(this,this.R);this.b-=4},function(){this.j=ed(this,this.S);this.b-=4},function(){this.j=ed(this,this.T);this.b-=4},function(){this.j=ed(this,this.U);this.b-=4},function(){this.j=ed(this,this.W);this.b-=4},function(){this.j=ed(this,this.X(J(this)));this.b-=7},function(){this.j=ed(this,this.j);
|
||||
this.b-=4},function(){this.j=cd(this,this.P);this.b-=4},function(){this.j=cd(this,this.R);this.b-=4},function(){this.j=cd(this,this.S);this.b-=4},function(){this.j=cd(this,this.T);this.b-=4},function(){this.j=cd(this,this.U);this.b-=4},function(){this.j=cd(this,this.W);this.b-=4},function(){this.j=cd(this,this.X(J(this)));this.b-=7},function(){this.j=cd(this,this.j);this.b-=4},function(){L(this,this.P);this.b-=4},function(){L(this,this.R);this.b-=4},function(){L(this,this.S);this.b-=4},function(){L(this,
|
||||
this.T);this.b-=4},function(){L(this,this.U);this.b-=4},function(){L(this,this.W);this.b-=4},function(){L(this,this.X(J(this)));this.b-=7},function(){L(this,this.j);this.b-=4},function(){Wc(this)||(G(this,O(this)),this.b-=6);this.b-=5},function(){Oc(this,O(this));this.b-=10},function(){var a=N(this);Wc(this)||G(this,a);this.b-=10},Cd,function(){var a=N(this);Wc(this)||(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},function(){Q(this,Nc(this));this.b-=11},function(){this.j=Yc(this,M(this));this.b-=
|
||||
7},function(){Q(this,this.N);G(this,0);this.b-=11},function(){Wc(this)&&(G(this,O(this)),this.b-=6);this.b-=5},Dd,function(){var a=N(this);Wc(this)&&G(this,a);this.b-=10},Cd,function(){var a=N(this);Wc(this)&&(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=Zc(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,8);this.b-=11},function(){Sc(this)||(G(this,O(this)),this.b-=6);this.b-=5},function(){Qc(this,O(this));this.b-=10},function(){var a=N(this);Sc(this)||G(this,a);this.b-=
|
||||
10},function(){var a=M(this);Hb(this.w,a,this.j,this.N+-2&65535);this.b-=10},function(){var a=N(this);Sc(this)||(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},function(){Q(this,Pc(this));this.b-=11},function(){this.j=L(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,16);this.b-=11},function(){Sc(this)&&(G(this,O(this)),this.b-=6);this.b-=5},Dd,function(){var a=N(this);Sc(this)&&G(this,a);this.b-=10},function(){var a=M(this);this.j=Db(this.w,a,this.N+-2&65535)&255;this.b-=10},function(){var a=
|
||||
N(this);Sc(this)&&(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=dd(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,24);this.b-=11},function(){Uc(this)||(G(this,O(this)),this.b-=6);this.b-=5},function(){Rc(this,O(this));this.b-=10},function(){var a=N(this);Uc(this)||G(this,a);this.b-=10},function(){var a=O(this);Q(this,J(this));Rc(this,a);this.b-=18},function(){var a=N(this);Uc(this)||(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},function(){Q(this,J(this));this.b-=
|
||||
11},function(){this.j=$c(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,32);this.b-=11},function(){Uc(this)&&(G(this,O(this)),this.b-=6);this.b-=5},function(){G(this,J(this));this.b-=5},function(){var a=N(this);Uc(this)&&G(this,a);this.b-=10},function(){var a=J(this);Rc(this,Pc(this));Qc(this,a);this.b-=5},function(){var a=N(this);Uc(this)&&(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=ed(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,40);this.b-=11},
|
||||
function(){Xc(this)||(G(this,O(this)),this.b-=6);this.b-=5},function(){var a=O(this);Kc(this,a&255|this.ta&-256);this.j=a>>8;this.b-=10},function(){var a=N(this);Xc(this)||G(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Xc(this)||(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},function(){Q(this,Mc(this)&255|this.j<<8);this.b-=11},function(){this.j=cd(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,48);this.b-=11},function(){Xc(this)&&(G(this,O(this)),
|
||||
this.b-=6);this.b-=5},function(){this.ia=J(this)&65535;this.b-=5},function(){var a=N(this);Xc(this)&&G(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Xc(this)&&(Q(this,this.N),G(this,a),this.b-=6);this.b-=11},Ed,function(){L(this,M(this));this.b-=7},function(){Q(this,this.N);G(this,56);this.b-=11}];
|
||||
function S(a){w.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Fd[b]&&La("Unrecognized ChipSet model: "+b);this.B=Fd[b]||{};a.sound&&(this.ba=null,window&&(this.ba=window.AudioContext||window.webkitAudioContext),this.ba&&new this.ba);E(this)}$a(S);
|
||||
var T={xa:1978.1,ad:{ya:0,Vd:1,$d:16,ne:32,Be:64,ze:128,tb:14},Ta:{ya:1,Gc:1,Wc:2,Sc:4,Tc:16,Uc:32,Vc:64,tb:8},bd:{ya:2,Ud:3,Ke:4,Wd:8,ve:16,we:32,xe:64,Xd:128,tb:0},Fe:{ya:3},De:{ya:2,pe:7},He:{ya:3,Me:1,Ge:2,ye:4,he:8,Yd:16,Md:32},Ee:{ya:4},Ie:{ya:5,ae:1,be:2,ce:4,de:8,Ne:16}},U={xa:100,ab:{ya:66,Re:1,Qc:2,Rc:4,te:8,re:16,fc:32,ec:64,ke:128},Fc:{ya:66,INIT:0},Ia:{me:{ya:98},Qa:{Ec:0,Dc:1,Yc:2,ed:4,Jc:5,Xc:6,Zc:7},Jb:16383},Ic:{ya:162,INIT:0},Hc:{ya:194,INIT:0}},Fd={SI1978:T,VT100:U};
|
||||
S.prototype.ja=function(){return!1};S.prototype.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.u=a;Cb(b,this,this.B.Pb);Gb(b,this,this.B.Qb)};S.prototype.za=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};S.prototype.Da=function(a){return a?this.save():!0};T.INIT=[[T.ad.tb,T.Ta.tb,T.bd.tb,0,0,0,0]];
|
||||
U.INIT=[[U.Fc.INIT,U.ab.Qc|U.ab.Rc,U.Ic.INIT,U.Hc.INIT],[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,11856,11824,11840,11808,11776,12E3,12E3,11857,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]]];m=S.prototype;
|
||||
m.reset=function(){this.B.INIT&&!this.restore(this.B.INIT)&&this.ga("reset error")};m.save=function(){var a=new H(this);switch(this.B.xa){case T.xa:I(a,0,[this.ra,this.F,this.wa,this.O,this.Z,this.ma,this.na]);break;case U.xa:I(a,0,[this.da,this.J,this.fa,this.ea]),I(a,1,[this.M,this.A,this.K,this.Y,this.I])}return a.data()};
|
||||
m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.B.xa){case T.xa:return this.ra=b[0],this.F=b[1],this.wa=b[2],this.O=b[3],this.Z=b[4],this.ma=b[5],this.na=b[6],!0;case U.xa:return this.da=b[0],this.J=b[1],this.fa=b[2],this.ea=b[3],b=a[1],this.M=b[0],this.A=b[1],this.K=b[2],this.Y=b[3],this.I=b[4],!0}return!1};m.start=function(){};m.stop=function(){};function Gd(a,b,c){a.F&=~b;c&&(a.F|=b)}m.qd=function(a,b){var c=this.ra;D(this,a,null,b,"STATUS0",c,!0);return c};
|
||||
m.rd=function(a,b){var c=this.F;D(this,a,null,b,"STATUS1",c,!0);return c};m.sd=function(a,b){var c=this.wa;D(this,a,null,b,"STATUS2",c,!0);return c};m.pd=function(a,b){var c=this.O>>8-this.Z&255;D(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Ad=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null,!0);this.Z=b};m.Cd=function(a,b,c){D(this,a,b,c,"SOUND1",null,!0);this.ma=b};m.Bd=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null,!0);this.O=b<<8|this.O>>8};
|
||||
m.Dd=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.na=b};m.Ed=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Hd(a){var b=0,c=0,d=~a.M;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}
|
||||
m.td=function(a,b){var c=this.J,c=c&~U.ab.ec;if((pc(this.b)&64)<<1&&(c|=U.ab.ec,c!=this.J)){var d,e;d=this.K&1;e=this.K>>1&7;switch(e){case U.Ia.Qa.Zc:break;case U.Ia.Qa.Dc:this.M=this.M<<1|d;break;case U.Ia.Qa.Jc:d=Hd(this);this.I[d]=U.Ia.Jb;gb(this,"doNVRCommand(): erase data at addr "+r(d));break;case U.Ia.Qa.Ec:this.A=this.A<<1|d;break;case U.Ia.Qa.ed:d=Hd(this);e=this.A&U.Ia.Jb;this.I[d]=e;gb(this,"doNVRCommand(): write data "+r(e)+" to addr "+r(d));break;case U.Ia.Qa.Xc:d=Hd(this);e=this.I[d];
|
||||
null==e&&(e=U.Ia.Jb);this.A=e;gb(this,"doNVRCommand(): read data "+r(e)+" from addr "+r(d));break;case U.Ia.Qa.Yc:this.A<<=1;this.Y=this.A&U.Ia.Jb+1;break;default:gb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~U.ab.fc;this.Y&&(c|=U.ab.fc);this.J=c;D(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Fd=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.da=b};m.Id=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.K=b};m.Hd=function(a,b,c){D(this,a,b,c,"DC012");this.fa=b};
|
||||
m.Gd=function(a,b,c){D(this,a,b,c,"DC011");this.ea=b};T.Pb={0:S.prototype.qd,1:S.prototype.rd,2:S.prototype.sd,3:S.prototype.pd};T.Qb={2:S.prototype.Ad,3:S.prototype.Cd,4:S.prototype.Bd,5:S.prototype.Dd,6:S.prototype.Ed};U.Pb={66:S.prototype.td};U.Qb={66:S.prototype.Fd,98:S.prototype.Id,162:S.prototype.Hd,194:S.prototype.Gd};Ja(function(){for(var a=B(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new S(d);eb(d,c)}});
|
||||
function Id(a){w.call(this,"ROM",a,Id);this.u=null;this.I=a.addr;this.A=a.size;this.J=a.writable;this.B=a.alias;this.F=a.file;this.K=ca(this.F);if(this.F){a=this.F;var b=da(this.K);"json"!=b&&"hex"!=b&&(a=pa()+"/api/v1/dump?file="+this.F+"&format=bytes&decimal=true");var c=this;oa(a,null,!0,function(a,b,f){Jd(c,a,b,f)})}}$a(Id);var Kd=[0,5];Id.prototype.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;Ld(this)};
|
||||
Id.prototype.za=function(){if(this.Oa){if(this.H){var a=this.H,b=this.id,c=this.I,d=this.A,e=this.Oa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=ka(p,k,a.Sa);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({ff:b,G:c,vd:d,Oa:e,nc:f})}delete this.Oa}return!0};Id.prototype.Da=function(){return!0};
|
||||
function Jd(a,b,c,d){if(d)a.ga("Unable to load system ROM (error "+d+": "+b+")");else{bb(a.Sb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.u=f;else if(h)for(a.u=Array(4*h.length),d=c=0;c<h.length;c++)a.u[d++]=h[c]&255,a.u[d++]=h[c]>>8&255,a.u[d++]=h[c]>>16&255,a.u[d++]=h[c]>>24&255;else a.u=e;a.Oa=e.symbols;if(!a.u.length){t("Empty ROM: "+b);return}if(1==a.u.length){t(a.u[0]);return}}catch(g){a.ga("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e<b.length;e++)a.u[e]=ba(b[e],16);Ld(a)}}
|
||||
function Ld(a){if(!kb(a))if(!a.F)E(a);else if(a.u&&a.w){a.A||(a.A=a.u.length);if(a.u.length!=a.A)lb(a,"ROM size (0x"+n(a.u.length)+") does not match specified size ("+("0x"+n(a.A))+")");else if(Md(a,a.I)){var b=[];"number"==typeof a.B?b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.w,h=d.A,g=[],k=d.I>>>f.la;0<h&&k<f.V.length;)g.push(f.V[k++]),h-=f.Ca;f=d.w;d=d.A;h=0;for(e>>>=f.la;0<d&&e<f.V.length;){k=g[h++];if(!k)break;f.V[e++]=k;d-=f.Ca}}delete a.u}E(a)}}
|
||||
function Md(a,b){if(vb(a.w,b,a.A,a.J?1:Wb)){var c;for(c=0;c<a.u.length;c++)Ab(a.w,b+c,a.u[c]);if(a.J&&256==b){for(c=0;c<Kd.length;c++)Ab(a.w,Kd[c],118);Jc(a.b,function(a){return function(b){if(0<=Kd.indexOf(b)){var c=!1,h=a.b,g=a.H;if(5==b)switch(c=!0,h.R){case 2:Nd(a,String.fromCharCode(h.T));break;case 9:for(var k=Pc(h),l="",p=255;p--;){var q=a.b.X(k++);if(36==q)break;l+=String.fromCharCode(q)}Nd(a,l);break;default:c=!1}c?Dd.call(h):g&&(a.g("\nCP/M vector "+r(b)),G(h,b),g.ka());b=!0}else b=!1;return b}}(a));
|
||||
Lc(a.b,b)}return!0}return!1}function Nd(a,b){b=b.replace(/\r/g,"");a.Ba&&(a.Ba.value+=b,a.Ba.scrollTop=a.Ba.scrollHeight)}Ja(function(){for(var a=B(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Id(d);eb(d,c)}});function Od(a){w.call(this,"RAM",a,Od);this.B=a.addr;this.A=a.size;this.u=!1}$a(Od);m=Od.prototype;m.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;E(this)};m.za=function(a,b){b||this.reset();return!0};m.Da=function(a){return a?this.save():!0};
|
||||
m.reset=function(){!this.u&&this.A&&vb(this.w,this.B,this.A,1)&&(this.u=!0);this.u||t("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ja(function(){for(var a=B(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Od(d);eb(d,c)}});function Pd(a){w.call(this,"Keyboard",a,Pd,65536);(a=a.model)&&!Qd[a]&&La("Unrecognized Keyboard model: "+a);this.u=Qd[a]||{};this.reset();E(this)}$a(Pd);
|
||||
var V={Qd:1,Rd:3,Sd: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,Kd:65,Nd:66,Od:67,Td:68,E:69,Zd:70,ee:71,fe:72,ge:73,ie:74,je:75,le:76,oe:77,qe:78,se:79,ue:80,Q:81,Ae:82,Ce:83,Je:84,Le:85,Oe:86,Pe:87,Qe:88,Se:89,Te:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ue:97,Ve:98,We:99,d:100,e:101,Xe: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},Rd={65:37,68:39,76:32},Sd={xa:1978.1,C:{},vb:{},wb:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},W={xa:100,C:{},vb:{},wb:{},Ld:{ya:130},Ja:{ya:130,Oc:1,Nc:2,Mc:4,Lc:8,Pc:16,gc:32,cc:63,$c:64,Pd:128,INIT:0},Kc:127};W.C[46]=3;W.C[80]=5;W.C[79]=6;W.C[89]=7;W.C[84]=8;W.C[87]=9;W.C[81]=10;W.C[39]=16;W.C[V["]"]]=20;W.C[V["["]]=21;W.C[73]=22;W.C[85]=23;W.C[82]=24;W.C[69]=25;
|
||||
W.C[V["1"]]=26;W.C[37]=32;W.C[40]=34;W.C[19]=35;W.C[V["`"]]=36;W.C[V["-"]]=37;W.C[V["9"]]=38;W.C[V["7"]]=39;W.C[V["4"]]=40;W.C[V["3"]]=41;W.C[27]=42;W.C[38]=48;W.C[114]=49;W.C[112]=50;W.C[8]=51;W.C[V["="]]=52;W.C[V["0"]]=53;W.C[V["8"]]=54;W.C[V["6"]]=55;W.C[V["5"]]=56;W.C[V["2"]]=57;W.C[9]=58;W.C[103]=64;W.C[115]=65;W.C[113]=66;W.C[96]=67;W.C[10]=68;W.C[V["\\"]]=69;W.C[76]=70;W.C[75]=71;W.C[71]=72;W.C[70]=73;W.C[65]=74;W.C[104]=80;W.C[2013]=81;W.C[98]=82;W.C[97]=83;W.C[V["'"]]=85;W.C[V[";"]]=86;
|
||||
W.C[74]=87;W.C[72]=88;W.C[68]=89;W.C[83]=90;W.C[110]=96;W.C[119]=97;W.C[101]=98;W.C[100]=99;W.C[13]=100;W.C[V["."]]=101;W.C[V[","]]=102;W.C[78]=103;W.C[66]=104;W.C[88]=105;W.C[120]=106;W.C[105]=112;W.C[99]=113;W.C[102]=114;W.C[109]=115;W.C[V["/"]]=117;W.C[77]=118;W.C[V[" "]]=119;W.C[86]=120;W.C[67]=121;W.C[90]=122;W.C[121]=123;W.C[17]=124;W.C[16]=125;W.C[20]=126;W.vb={l4:W.Ja.Oc,l3:W.Ja.Nc,l2:W.Ja.Mc,l1:W.Ja.Lc,locked:W.Ja.Pc,online:W.Ja.gc,local:~W.Ja.gc};var Qd={SI1978:Sd,VT100:W};
|
||||
Pd.prototype.ja=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.L[e]){if("led"==a&&this.u.vb[b])return this.L[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Td(d,a,!0)},c.onkeyup=function(a){return Td(d,a,!1)},!0;default:if(this.u.wb&&void 0!==this.u.wb[b])return this.L[e]=c,a=function(a,b){return function(){Ud(a,b,!0)}}(this,b),b=function(a,b){return function(){Ud(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=
|
||||
b),!0}}return!1};Pd.prototype.Na=function(a,b,c,d){this.b=c;this.H=d;this.A=rb(a,"ChipSet");Cb(b,this,this.u.Pb);Gb(b,this,this.u.Qb)};Pd.prototype.za=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Pd.prototype.Da=function(a){return a?this.save():!0};W.INIT=[[W.Ja.INIT,0]];m=Pd.prototype;m.reset=function(){this.w=[];this.u.INIT&&!this.restore(this.u.INIT)&&this.ga("reset error")};m.save=function(){var a=new H(this);switch(this.u.xa){case W.xa:I(a,0,[this.F])}return a.data()};
|
||||
m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.u.xa){case Sd.xa:return!0;case W.xa:return this.F=b[0],Vd(this,this.F&W.Ja.cc),this.B=b[1],!0}return!1};function Vd(a,b){for(var c in a.u.vb){var d=a.L["led-"+c];if(d){var e=a.u.vb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}function Td(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=Rd[e]||e,!a.u.C[e]){for(var f in a.u.wb)if(a.u.wb[f]===e){e=f;break a}e=null}e&&(d=Ud(a,e,c),b.preventDefault());return d}
|
||||
function Ud(a,b,c){var d;a:{for(d=0;d<a.w.length;d++)if(a.w[d].Ac==b)break a;d=-1}if(c)0>d?a.w.push({Ac:b,Yb:Date.now(),Kb:!1}):(a.w[d].Yb=Date.now(),a.w[d].Kb=!1);else if(0<=d){if(!a.w[d].Kb){var e=a.w[d].Yb;if(e&&100>Date.now()-e)return a.w[d].Kb=!0,Wd(a),!0}a.w.splice(d,1)}if(a.A)switch(b){case "1p":Gd(a.A,T.Ta.Sc,c);break;case "2p":Gd(a.A,T.Ta.Wc,c);break;case "coin":Gd(a.A,T.Ta.Gc,c);break;case "left":Gd(a.A,T.Ta.Uc,c);break;case "right":Gd(a.A,T.Ta.Vc,c);break;case "fire":Gd(a.A,T.Ta.Tc,c)}return!0}
|
||||
function Wd(a){for(var b=0,c=-1;b<a.w.length;){if(a.w[b].Kb){var d=a.w[b].Ac,e=100-(Date.now()-a.w[b].Yb);if(0<e){if(0>c||c>e)c=e}else{Ud(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Wd(a)},c)}m.ud=function(a,b){var c=0;0<=this.B&&this.B<this.w.length-1&&(c=this.w[this.B++],c=W.C[c]);c||(c=W.Kc);D(this,a,null,b,"KBDUART.ADDRESS",c);return c};m.Jd=function(a,b,c){D(this,a,b,c,"KBDUART.STATUS");this.F=b;Vd(this,b&W.Ja.cc);b&W.Ja.$c&&(this.B=0,fd(this.b,1))};W.Pb={130:Pd.prototype.ud};
|
||||
W.Qb={130:Pd.prototype.Jd};Ja(function(){for(var a=B(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Pd(d);eb(d,c)}});
|
||||
function Xd(a,b,c,d,e){var f=this;this.ic=xa("Gecko/");var h=["","moz","ms","webkit"];w.call(this,"Video",a,Xd,262144);this.Y=a.screenWidth;this.O=a.screenHeight;this.Aa=a.bufferAddr;this.gd=a.bufferRAM;var g=a.bufferFormat;this.da=g&&Yd[g.toUpperCase()]||Zd;this.Ra=a.bufferCols;this.ea=a.bufferRows;this.cd=this.pa=a.cellWidth||1;this.ha=a.cellHeight||1;this.bb=null;this.hc=!1;this.Ka=a.bufferBits||1;this.hd=a.bufferLeft||0;if(this.B=a.bufferRotate)this.B=this.B%360,0<this.B&&(this.B-=360),-90!=this.B&&
|
||||
(this.ga("unsupported buffer rotation: "+this.B),this.B=0);this.Tb=a.interruptRate;this.jd=a.refreshRate||60;this.M=b;this.F=c;this.Ga=(this.Cc=d)||b||null;this.dd=this.Y;this.fd=this.O;this.Hb=this.Y/this.Ra|0;this.Ib=this.O/this.ea|0;1<this.ha&&this.ea++;b=a.smoothing;(c=Sa.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.I=a.screenRotate)this.I=this.I%360,0<this.I&&(this.I-=
|
||||
360),-90!=this.I?(this.ga("unsupported screen rotation: "+this.I),this.I=0):(this.F.translate(0,this.O),this.F.rotate(this.I*Math.PI/180),this.F.scale(this.O/this.Y,this.Y/this.O));if(this.A=e)if(this.A.fb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.A.fb){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){$d(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(){$d(f,null)},!1);break}}if(this.fa=a.fontROM)"json"!=da(this.fa)&&(this.fa=pa()+"/api/v1/dump?file="+this.fa+"&format=bytes"),oa(this.fa,null,!0,function(a,b,c){ae(f,a,b,c)});this.ub={}}$a(Xd);var Zd=0,Yd={SI1978:1,VT100:2};
|
||||
Xd.prototype.Na=function(a,b,c,d){this.u=a;this.w=b;this.b=c;this.H=d;this.J=this.Ra*this.pa;this.Z=this.ea*this.ha;b=this.J;c=this.Z;this.B&&(b=this.Z,c=this.J);this.Sa=(this.J*this.Ka>>3)*this.Z;if(this.gd||vb(this.w,this.Aa,this.Sa,3))1<this.pa?be(this,this.Ra*this.ea):(this.jc=this.F.createImageData(b,c),this.lc=16/this.Ka|0,be(this,this.Sa>>1)),this.K=document.createElement("canvas"),this.K.width=b,this.K.height=c,this.cb=this.K.getContext("2d"),this.na={},this.Ha=1<<this.Ka,this.ra=Array(this.Ha+
|
||||
2),this.ra[0]=[0,0,0,255],this.ra[1]=[255,255,255,255],1==this.da&&(this.ra[this.Ha+0]=[255,255,0,255],this.ra[this.Ha+1]=[0,255,0,255]),2==this.da&&(this.mc=60,this.eb=!1,this.wa=Array(this.Ra));if(this.ba=rb(a,"Keyboard")){for(var e in this.ub)this.ba.ja("led",e,this.ub[e]);this.M&&this.ba.ja(this.Cc?"textarea":"canvas","kbd",this.Ga)}this.fa||E(this)};
|
||||
function ae(a,b,c,d){if(d)a.ga("Unable to load font ROM (error "+d+": "+b+")");else{bb(a.Sb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){t("Empty font ROM: "+b);return}if(1==f.length){t(f[0]);return}if(2048==f.length)ce(a,f);else{a.ga("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ga("Font ROM data error: "+h.message);return}(a.F||a.H)&&E(a)}}
|
||||
function ce(a,b){a.bb=b;a.hc=2==a.da;a.na[96]=[de(a,a.pa,a.ha),de(a,a.pa,a.ha,a.eb)];a.na[64]=[de(a,2*a.pa,a.ha),de(a,2*a.pa,a.ha,a.eb)];a.na[32]=a.na[0]=[de(a,2*a.pa,2*a.ha),de(a,2*a.pa,2*a.ha,a.eb)]}
|
||||
function de(a,b,c,d){var e=8>=a.cd?8:16,f=8<e?15:0,h=a.bb.length/e,g=!1===d,k={pa:b,ha: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 l=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,y=q;q<a.ha;q++)for(var x=p*e+(f+q&e-1),x=d&&8==q?255:a.bb[x],v=0;v<c/a.ha;v++){for(var z=0,u=0,K=u;u<a.pa;u++){for(var C=x&128>>(7<u?7:u),z=a.hc&&!C&&z?z:C,Y=0;Y<b/a.pa;Y++)g&&(z=!z),ee(a,l,K,y,z?1:0),K++;z=C}y++}k.context.putImageData(l,
|
||||
function dd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.aa=a.j+b+(a.aa&256?0:1)^256)&255}function ed(a,b){return a.ca=a.aa=a.ua=a.j^b}m.Y=function(a){return this.B.Y(a)};m.qa=function(a,b){this.B.qa(a,b)};function M(a){var b=a.Y(a.N);F(a,a.N+1);return b}function N(a){var b=a.B.Qa(a.N);F(a,a.N+2);return b}function O(a){var b=a.B.Qa(a.ia);a.ia=a.ia+2&65535;return b}function Q(a,b){a.ia=a.ia-2&65535;a.B.Rb(a.ia,b)}function fd(a,b){a.A=a.A&-8|b|8}
|
||||
function R(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(lb(a,"Value for "+b+" is invalid"),a.ka()),c=!a.C.va||a.C.tc?n(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))}
|
||||
m.Ea=function(a){this.Z&&(a||!this.C.va||this.C.tc)&&(R(this,"A",this.j),R(this,"B",this.R),R(this,"C",this.S),R(this,"BC",Nc(this),4),R(this,"D",this.T),R(this,"E",this.U),R(this,"DE",Pc(this),4),R(this,"H",this.V),R(this,"L",this.X),R(this,"HL",I(this),4),R(this,"SP",this.ia,4),R(this,"PC",this.N,4),a=Mc(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.L.speed)a.textContent=
|
||||
this.C.va&&this.i.Wa?this.i.Wa.toFixed(2)+"Mhz":"Stopped"};m.rb=function(a){this.C.Lb=!0;var b=this.C.od=this.I&&gd(this.I),c=a?this.C.Wb?0:1:-1;this.C.Wb=!1;this.F=this.b=a;do{if(this.A){if(a&&this.A&8&&this.ta&512){var d=199|(this.A&7)<<3;this.A&=-17;this.A&=-16;this.ta&=-513;this.O[d].call(this)}if(this.A&16){this.b=0;break}}if(b){if(Ad(this.I,this.N,c)){this.ka();break}c=1}this.O[M(this)].call(this)}while(0<this.b);return this.C.Lb?this.F-this.b:void 0===this.C.Lb?0:-1};
|
||||
Ja(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Gc(d);eb(d,c)}});function Bd(){this.b-=4}function Cd(){F(this,N(this));this.b-=10}function Dd(){F(this,O(this));this.b-=10}function Ed(){var a=N(this);Q(this,this.N);F(this,a);this.b-=17}
|
||||
var Hc=[Bd,function(){Oc(this,N(this));this.b-=10},function(){this.qa(Nc(this),this.j);this.b-=7},function(){Oc(this,Nc(this)+1);this.b-=5},function(){this.R=bd(this,this.R);this.b-=5},function(){this.R=ad(this,this.R);this.b-=5},function(){this.R=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>8;Tc(this,a&256);this.b-=4},Bd,function(){var a;Rc(this,a=I(this)+Nc(this));Tc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(Nc(this));this.b-=7},function(){Oc(this,Nc(this)-1);this.b-=
|
||||
5},function(){this.S=bd(this,this.S);this.b-=5},function(){this.S=ad(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Tc(this,a);this.b-=4},Bd,function(){Qc(this,N(this));this.b-=10},function(){this.qa(Pc(this),this.j);this.b-=7},function(){Qc(this,Pc(this)+1);this.b-=5},function(){this.T=bd(this,this.T);this.b-=5},function(){this.T=ad(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|
|
||||
Sc(this);Tc(this,a&256);this.b-=4},Bd,function(){var a;Rc(this,a=I(this)+Pc(this));Tc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(Pc(this));this.b-=7},function(){Qc(this,Pc(this)-1);this.b-=5},function(){this.U=bd(this,this.U);this.b-=5},function(){this.U=ad(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Sc(this)<<8|this.j)>>1;Tc(this,a&256);this.b-=4},Bd,function(){Rc(this,N(this));this.b-=10},function(){var a=N(this);this.B.Rb(a,I(this));
|
||||
this.b-=16},function(){Rc(this,I(this)+1);this.b-=5},function(){this.V=bd(this,this.V);this.b-=5},function(){this.V=ad(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=0,b=Sc(this);if(Vc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Yc(this,a);Tc(this,b?256:0);this.b-=4},Bd,function(){var a;Rc(this,a=I(this)+I(this));Tc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.B.Qa(a);Rc(this,a);this.b-=16},function(){Rc(this,I(this)-1);this.b-=5},function(){this.X=
|
||||
bd(this,this.X);this.b-=5},function(){this.X=ad(this,this.X);this.b-=5},function(){this.X=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Bd,function(){this.ia=N(this)&65535;this.b-=10},function(){this.qa(N(this),this.j);this.b-=13},function(){this.ia=this.ia+1&65535;this.b-=5},function(){var a=I(this);this.qa(a,bd(this,this.Y(a)));this.b-=10},function(){var a=I(this);this.qa(a,ad(this,this.Y(a)));this.b-=10},function(){this.qa(I(this),M(this));this.b-=10},function(){this.aa|=256;this.b-=
|
||||
4},Bd,function(){var a;Rc(this,a=I(this)+this.ia);Tc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(N(this));this.b-=13},function(){this.ia=this.ia-1&65535;this.b-=5},function(){this.j=bd(this,this.j);this.b-=5},function(){this.j=ad(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Tc(this,Sc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.R=this.S;this.b-=5},function(){this.R=this.T;this.b-=5},function(){this.R=this.U;this.b-=5},function(){this.R=this.V;this.b-=
|
||||
5},function(){this.R=this.X;this.b-=5},function(){this.R=this.Y(I(this));this.b-=7},function(){this.R=this.j;this.b-=5},function(){this.S=this.R;this.b-=5},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.X;this.b-=5},function(){this.S=this.Y(I(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.R;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.X;this.b-=5},function(){this.T=this.Y(I(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.R;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.X;this.b-=5},function(){this.U=this.Y(I(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.R;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.X;this.b-=5},function(){this.V=this.Y(I(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.X=this.R;this.b-=5},function(){this.X=this.S;this.b-=5},function(){this.X=this.T;this.b-=5},function(){this.X=this.U;this.b-=5},function(){this.X=this.V;this.b-=5},function(){this.b-=5},function(){this.X=this.Y(I(this));this.b-=7},function(){this.X=this.j;
|
||||
this.b-=5},function(){this.qa(I(this),this.R);this.b-=7},function(){this.qa(I(this),this.S);this.b-=7},function(){this.qa(I(this),this.T);this.b-=7},function(){this.qa(I(this),this.U);this.b-=7},function(){this.qa(I(this),this.V);this.b-=7},function(){this.qa(I(this),this.X);this.b-=7},function(){var a=this.N-1;if(this.K.length)for(var b=0;b<this.K.length;b++)if(this.K[b](a))return;this.A|=16;this.b-=7;this.I&&hb(this,-2147483648)?(F(this,a),this.I.ka()):this.ta&512||(this.I&&F(this,a),this.ka())},
|
||||
function(){this.qa(I(this),this.j);this.b-=7},function(){this.j=this.R;this.b-=5},function(){this.j=this.S;this.b-=5},function(){this.j=this.T;this.b-=5},function(){this.j=this.U;this.b-=5},function(){this.j=this.V;this.b-=5},function(){this.j=this.X;this.b-=5},function(){this.j=this.Y(I(this));this.b-=7},function(){this.b-=5},function(){this.j=Yc(this,this.R);this.b-=4},function(){this.j=Yc(this,this.S);this.b-=4},function(){this.j=Yc(this,this.T);this.b-=4},function(){this.j=Yc(this,this.U);this.b-=
|
||||
4},function(){this.j=Yc(this,this.V);this.b-=4},function(){this.j=Yc(this,this.X);this.b-=4},function(){this.j=Yc(this,this.Y(I(this)));this.b-=7},function(){this.j=Yc(this,this.j);this.b-=4},function(){this.j=Zc(this,this.R);this.b-=4},function(){this.j=Zc(this,this.S);this.b-=4},function(){this.j=Zc(this,this.T);this.b-=4},function(){this.j=Zc(this,this.U);this.b-=4},function(){this.j=Zc(this,this.V);this.b-=4},function(){this.j=Zc(this,this.X);this.b-=4},function(){this.j=Zc(this,this.Y(I(this)));
|
||||
this.b-=7},function(){this.j=Zc(this,this.j);this.b-=4},function(){this.j=L(this,this.R);this.b-=4},function(){this.j=L(this,this.S);this.b-=4},function(){this.j=L(this,this.T);this.b-=4},function(){this.j=L(this,this.U);this.b-=4},function(){this.j=L(this,this.V);this.b-=4},function(){this.j=L(this,this.X);this.b-=4},function(){this.j=L(this,this.Y(I(this)));this.b-=7},function(){this.j=L(this,this.j);this.b-=4},function(){this.j=dd(this,this.R);this.b-=4},function(){this.j=dd(this,this.S);this.b-=
|
||||
4},function(){this.j=dd(this,this.T);this.b-=4},function(){this.j=dd(this,this.U);this.b-=4},function(){this.j=dd(this,this.V);this.b-=4},function(){this.j=dd(this,this.X);this.b-=4},function(){this.j=dd(this,this.Y(I(this)));this.b-=7},function(){this.j=dd(this,this.j);this.b-=4},function(){this.j=$c(this,this.R);this.b-=4},function(){this.j=$c(this,this.S);this.b-=4},function(){this.j=$c(this,this.T);this.b-=4},function(){this.j=$c(this,this.U);this.b-=4},function(){this.j=$c(this,this.V);this.b-=
|
||||
4},function(){this.j=$c(this,this.X);this.b-=4},function(){this.j=$c(this,this.Y(I(this)));this.b-=7},function(){this.j=$c(this,this.j);this.b-=4},function(){this.j=ed(this,this.R);this.b-=4},function(){this.j=ed(this,this.S);this.b-=4},function(){this.j=ed(this,this.T);this.b-=4},function(){this.j=ed(this,this.U);this.b-=4},function(){this.j=ed(this,this.V);this.b-=4},function(){this.j=ed(this,this.X);this.b-=4},function(){this.j=ed(this,this.Y(I(this)));this.b-=7},function(){this.j=ed(this,this.j);
|
||||
this.b-=4},function(){this.j=cd(this,this.R);this.b-=4},function(){this.j=cd(this,this.S);this.b-=4},function(){this.j=cd(this,this.T);this.b-=4},function(){this.j=cd(this,this.U);this.b-=4},function(){this.j=cd(this,this.V);this.b-=4},function(){this.j=cd(this,this.X);this.b-=4},function(){this.j=cd(this,this.Y(I(this)));this.b-=7},function(){this.j=cd(this,this.j);this.b-=4},function(){L(this,this.R);this.b-=4},function(){L(this,this.S);this.b-=4},function(){L(this,this.T);this.b-=4},function(){L(this,
|
||||
this.U);this.b-=4},function(){L(this,this.V);this.b-=4},function(){L(this,this.X);this.b-=4},function(){L(this,this.Y(I(this)));this.b-=7},function(){L(this,this.j);this.b-=4},function(){Wc(this)||(F(this,O(this)),this.b-=6);this.b-=5},function(){Oc(this,O(this));this.b-=10},function(){var a=N(this);Wc(this)||F(this,a);this.b-=10},Cd,function(){var a=N(this);Wc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Nc(this));this.b-=11},function(){this.j=Yc(this,M(this));this.b-=
|
||||
7},function(){Q(this,this.N);F(this,0);this.b-=11},function(){Wc(this)&&(F(this,O(this)),this.b-=6);this.b-=5},Dd,function(){var a=N(this);Wc(this)&&F(this,a);this.b-=10},Cd,function(){var a=N(this);Wc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=Zc(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,8);this.b-=11},function(){Sc(this)||(F(this,O(this)),this.b-=6);this.b-=5},function(){Qc(this,O(this));this.b-=10},function(){var a=N(this);Sc(this)||F(this,a);this.b-=
|
||||
10},function(){var a=M(this);Hb(this.B,a,this.j,this.N+-2&65535);this.b-=10},function(){var a=N(this);Sc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Pc(this));this.b-=11},function(){this.j=L(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,16);this.b-=11},function(){Sc(this)&&(F(this,O(this)),this.b-=6);this.b-=5},Dd,function(){var a=N(this);Sc(this)&&F(this,a);this.b-=10},function(){var a=M(this);this.j=Db(this.B,a,this.N+-2&65535)&255;this.b-=10},function(){var a=
|
||||
N(this);Sc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=dd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,24);this.b-=11},function(){Uc(this)||(F(this,O(this)),this.b-=6);this.b-=5},function(){Rc(this,O(this));this.b-=10},function(){var a=N(this);Uc(this)||F(this,a);this.b-=10},function(){var a=O(this);Q(this,I(this));Rc(this,a);this.b-=18},function(){var a=N(this);Uc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,I(this));this.b-=
|
||||
11},function(){this.j=$c(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,32);this.b-=11},function(){Uc(this)&&(F(this,O(this)),this.b-=6);this.b-=5},function(){F(this,I(this));this.b-=5},function(){var a=N(this);Uc(this)&&F(this,a);this.b-=10},function(){var a=I(this);Rc(this,Pc(this));Qc(this,a);this.b-=5},function(){var a=N(this);Uc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Ed,function(){this.j=ed(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,40);this.b-=11},
|
||||
function(){Xc(this)||(F(this,O(this)),this.b-=6);this.b-=5},function(){var a=O(this);Kc(this,a&255|this.ta&-256);this.j=a>>8;this.b-=10},function(){var a=N(this);Xc(this)||F(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Xc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Mc(this)&255|this.j<<8);this.b-=11},function(){this.j=cd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,48);this.b-=11},function(){Xc(this)&&(F(this,O(this)),
|
||||
this.b-=6);this.b-=5},function(){this.ia=I(this)&65535;this.b-=5},function(){var a=N(this);Xc(this)&&F(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Xc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Ed,function(){L(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,56);this.b-=11}];
|
||||
function T(a){v.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Fd[b]&&La("Unrecognized ChipSet model: "+b);this.D=Fd[b]||{};a.sound&&(this.da=null,window&&(this.da=window.AudioContext||window.webkitAudioContext),this.da&&new this.da);D(this)}$a(T);
|
||||
var U={ya:1978.1,cd:{za:0,Wd:1,ae:16,ne:32,Be:64,ze:128,tb:14},Ua:{za:1,Ic:1,Yc:2,Uc:4,Vc:16,Wc:32,Xc:64,tb:8},dd:{za:2,Vd:3,Ke:4,Xd:8,ve:16,we:32,xe:64,Yd:128,tb:0},Fe:{za:3},De:{za:2,pe:7},He:{za:3,Me:1,Ge:2,ye:4,ie:8,Zd:16,Nd:32},Ee:{za:4},Ie:{za:5,be:1,ce:2,de:4,ee:8,Ne:16}},V={ya:100,Pa:{za:66,Re:1,Sc:2,Tc:4,te:8,re:16,hc:32,gc:64,dc:128},Hc:{za:66,INIT:0},Ia:{me:{za:98},Ra:{Fc:0,Ec:1,$c:2,gd:4,Lc:5,Zc:6,ad:7},Jb:16383},Kc:{za:162,INIT:0},Jc:{za:194,INIT:0}},Fd={SI1978:U,VT100:V};
|
||||
T.prototype.ja=function(){return!1};T.prototype.Na=function(a,b,c,d){this.B=b;this.b=c;this.I=d;this.w=a;this.M=rb(a,"Keyboard");Cb(b,this,this.D.Pb);Gb(b,this,this.D.Qb)};T.prototype.Aa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Da=function(a){return a?this.save():!0};U.INIT=[[U.cd.tb,U.Ua.tb,U.dd.tb,0,0,0,0]];
|
||||
V.INIT=[[V.Hc.INIT,V.Pa.Sc|V.Pa.Tc,V.Kc.INIT,V.Jc.INIT],[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,11856,11824,11840,11808,11776,12E3,12E3,11857,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]]];m=T.prototype;
|
||||
m.reset=function(){this.D.INIT&&!this.restore(this.D.INIT)&&this.ga("reset error")};m.save=function(){var a=new G(this);switch(this.D.ya){case U.ya:H(a,0,[this.wa,this.F,this.xa,this.P,this.ba,this.na,this.ra]);break;case V.ya:H(a,0,[this.ea,this.J,this.la,this.fa]),H(a,1,[this.O,this.A,this.K,this.Z,this.H])}return a.data()};
|
||||
m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.D.ya){case U.ya:return this.wa=b[0],this.F=b[1],this.xa=b[2],this.P=b[3],this.ba=b[4],this.na=b[5],this.ra=b[6],!0;case V.ya:return this.ea=b[0],this.J=b[1],this.la=b[2],this.fa=b[3],b=a[1],this.O=b[0],this.A=b[1],this.K=b[2],this.Z=b[3],this.H=b[4],!0}return!1};m.start=function(){};m.stop=function(){};function Gd(a,b,c){a.F&=~b;c&&(a.F|=b)}m.sd=function(a,b){var c=this.wa;C(this,a,null,b,"STATUS0",c,!0);return c};
|
||||
m.td=function(a,b){var c=this.F;C(this,a,null,b,"STATUS1",c,!0);return c};m.ud=function(a,b){var c=this.xa;C(this,a,null,b,"STATUS2",c,!0);return c};m.rd=function(a,b){var c=this.P>>8-this.ba&255;C(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Cd=function(a,b,c){C(this,a,b,c,"SHIFT.COUNT",null,!0);this.ba=b};m.Ed=function(a,b,c){C(this,a,b,c,"SOUND1",null,!0);this.na=b};m.Dd=function(a,b,c){C(this,a,b,c,"SHIFT.DATA",null,!0);this.P=b<<8|this.P>>8};
|
||||
m.Fd=function(a,b,c){C(this,a,b,c,"SOUND2",null,!0);this.ra=b};m.Gd=function(a,b,c){C(this,a,b,c,"WATCHDOG",null,!0)};function Hd(a){var b=0,c=0,d=~a.O;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}
|
||||
m.vd=function(a,b){var c=this.J,c=c&~V.Pa.gc;if((pc(this.b)&64)<<1&&(c|=V.Pa.gc,c!=this.J)){var d,e;d=this.K&1;e=this.K>>1&7;switch(e){case V.Ia.Ra.ad:break;case V.Ia.Ra.Ec:this.O=this.O<<1|d;break;case V.Ia.Ra.Lc:d=Hd(this);this.H[d]=V.Ia.Jb;gb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ia.Ra.Fc:this.A=this.A<<1|d;break;case V.Ia.Ra.gd:d=Hd(this);e=this.A&V.Ia.Jb;this.H[d]=e;gb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ia.Ra.Zc:d=Hd(this);e=this.H[d];
|
||||
null==e&&(e=V.Ia.Jb);this.A=e;gb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ia.Ra.$c:this.A<<=1;this.Z=this.A&V.Ia.Jb+1;break;default:gb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Pa.hc;this.Z&&(c|=V.Pa.hc);c&=~V.Pa.dc;this.M&&(c|=V.Pa.dc);this.J=c;C(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Hd=function(a,b,c){C(this,a,b,c,"BRIGHTNESS");this.ea=b};m.Kd=function(a,b,c){C(this,a,b,c,"NVR.LATCH");this.K=b};
|
||||
m.Jd=function(a,b,c){C(this,a,b,c,"DC012");this.la=b};m.Id=function(a,b,c){C(this,a,b,c,"DC011");this.fa=b};U.Pb={0:T.prototype.sd,1:T.prototype.td,2:T.prototype.ud,3:T.prototype.rd};U.Qb={2:T.prototype.Cd,3:T.prototype.Ed,4:T.prototype.Dd,5:T.prototype.Fd,6:T.prototype.Gd};V.Pb={66:T.prototype.vd};V.Qb={66:T.prototype.Hd,98:T.prototype.Kd,162:T.prototype.Jd,194:T.prototype.Id};Ja(function(){for(var a=A(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new T(d);eb(d,c)}});
|
||||
function Id(a){v.call(this,"ROM",a,Id);this.w=null;this.H=a.addr;this.A=a.size;this.J=a.writable;this.D=a.alias;this.F=a.file;this.K=da(this.F);if(this.F){a=this.F;var b=ea(this.K);"json"!=b&&"hex"!=b&&(a=qa()+"/api/v1/dump?file="+this.F+"&format=bytes&decimal=true");var c=this;pa(a,null,!0,function(a,b,f){Jd(c,a,b,f)})}}$a(Id);var Kd=[0,5];Id.prototype.Na=function(a,b,c,d){this.B=b;this.b=c;this.I=d;Ld(this)};
|
||||
Id.prototype.Aa=function(){if(this.Oa){if(this.I){var a=this.I,b=this.id,c=this.H,d=this.A,e=this.Oa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=la(p,k,a.Ta);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({ff:b,G:c,xd:d,Oa:e,pc:f})}delete this.Oa}return!0};Id.prototype.Da=function(){return!0};
|
||||
function Jd(a,b,c,d){if(d)a.ga("Unable to load system ROM (error "+d+": "+b+")");else{bb(a.Sb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.w=f;else if(h)for(a.w=Array(4*h.length),d=c=0;c<h.length;c++)a.w[d++]=h[c]&255,a.w[d++]=h[c]>>8&255,a.w[d++]=h[c]>>16&255,a.w[d++]=h[c]>>24&255;else a.w=e;a.Oa=e.symbols;if(!a.w.length){u("Empty ROM: "+b);return}if(1==a.w.length){u(a.w[0]);return}}catch(g){a.ga("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.w=Array(b.length),e=0;e<b.length;e++)a.w[e]=ca(b[e],16);Ld(a)}}
|
||||
function Ld(a){if(!kb(a))if(!a.F)D(a);else if(a.w&&a.B){a.A||(a.A=a.w.length);if(a.w.length!=a.A)lb(a,"ROM size (0x"+n(a.w.length)+") does not match specified size ("+("0x"+n(a.A))+")");else if(Md(a,a.H)){var b=[];"number"==typeof a.D?b.push(a.D):null!=a.D&&a.D.length&&(b=a.D);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.B,h=d.A,g=[],k=d.H>>>f.ma;0<h&&k<f.W.length;)g.push(f.W[k++]),h-=f.Ca;f=d.B;d=d.A;h=0;for(e>>>=f.ma;0<d&&e<f.W.length;){k=g[h++];if(!k)break;f.W[e++]=k;d-=f.Ca}}delete a.w}D(a)}}
|
||||
function Md(a,b){if(vb(a.B,b,a.A,a.J?1:Wb)){var c;for(c=0;c<a.w.length;c++)Ab(a.B,b+c,a.w[c]);if(a.J&&256==b){for(c=0;c<Kd.length;c++)Ab(a.B,Kd[c],118);Jc(a.b,function(a){return function(b){if(0<=Kd.indexOf(b)){var c=!1,h=a.b,g=a.I;if(5==b)switch(c=!0,h.S){case 2:Nd(a,String.fromCharCode(h.U));break;case 9:for(var k=Pc(h),l="",p=255;p--;){var q=a.b.Y(k++);if(36==q)break;l+=String.fromCharCode(q)}Nd(a,l);break;default:c=!1}c?Dd.call(h):g&&(a.g("\nCP/M vector "+t(b)),F(h,b),g.ka());b=!0}else b=!1;return b}}(a));
|
||||
Lc(a.b,b)}return!0}return!1}function Nd(a,b){b=b.replace(/\r/g,"");a.Ba&&(a.Ba.value+=b,a.Ba.scrollTop=a.Ba.scrollHeight)}Ja(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Id(d);eb(d,c)}});function Od(a){v.call(this,"RAM",a,Od);this.D=a.addr;this.A=a.size;this.w=!1}$a(Od);m=Od.prototype;m.Na=function(a,b,c,d){this.B=b;this.b=c;this.I=d;D(this)};m.Aa=function(a,b){b||this.reset();return!0};m.Da=function(a){return a?this.save():!0};
|
||||
m.reset=function(){!this.w&&this.A&&vb(this.B,this.D,this.A,1)&&(this.w=!0);this.w||u("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ja(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Od(d);eb(d,c)}});function Pd(a){v.call(this,"Keyboard",a,Pd,65536);(a=a.model)&&!Qd[a]&&La("Unrecognized Keyboard model: "+a);this.w=Qd[a]||{};this.reset();D(this)}$a(Pd);
|
||||
var W={Rd:1,Sd:3,Td: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,Md:65,Od:66,Pd:67,Ud:68,E:69,$d:70,fe:71,ge:72,he:73,je:74,ke:75,le:76,oe:77,qe:78,se:79,ue:80,Q:81,Ae:82,Ce:83,Je:84,Le:85,Oe:86,Pe:87,Qe:88,Se:89,Te:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ue:97,Ve:98,We:99,d:100,e:101,Xe: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},Rd={65:37,68:39,76:32},Sd={ya:1978.1,u:{},vb:{},wb:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},X={ya:100,u:{},vb:{},wb:{},Gc:{za:130,INIT:127},Ja:{za:130,Qc:1,Pc:2,Oc:4,Nc:8,Rc:16,ic:32,ec:63,bd:64,Qd:128,INIT:0},Mc:127};X.u[46]=3;X.u[80]=5;X.u[79]=6;X.u[89]=7;X.u[84]=8;X.u[87]=9;X.u[81]=10;X.u[39]=16;X.u[W["]"]]=20;X.u[W["}"]]=148;X.u[W["["]]=21;X.u[W["{"]]=149;
|
||||
X.u[73]=22;X.u[85]=23;X.u[82]=24;X.u[69]=25;X.u[W["1"]]=26;X.u[W["!"]]=154;X.u[37]=32;X.u[40]=34;X.u[117]=35;X.u[19]=35;X.u[W["`"]]=36;X.u[W["~"]]=164;X.u[W["-"]]=37;X.u[W._]=165;X.u[W["9"]]=38;X.u[W["("]]=166;X.u[W["7"]]=39;X.u[W["&"]]=167;X.u[W["4"]]=40;X.u[W.$]=168;X.u[W["3"]]=41;X.u[W["#"]]=169;X.u[27]=42;X.u[38]=48;X.u[114]=49;X.u[112]=50;X.u[8]=51;X.u[W["="]]=52;X.u[W["+"]]=180;X.u[W["0"]]=53;X.u[W[")"]]=181;X.u[W["8"]]=54;X.u[W["*"]]=182;X.u[W["6"]]=55;X.u[W["^"]]=183;X.u[W["5"]]=56;
|
||||
X.u[W["%"]]=184;X.u[W["2"]]=57;X.u[W["@"]]=185;X.u[9]=58;X.u[103]=64;X.u[115]=65;X.u[113]=66;X.u[96]=67;X.u[118]=68;X.u[W["\\"]]=69;X.u[W["|"]]=197;X.u[76]=70;X.u[75]=71;X.u[71]=72;X.u[70]=73;X.u[65]=74;X.u[104]=80;X.u[2013]=81;X.u[98]=82;X.u[97]=83;X.u[W["'"]]=85;X.u[W['"']]=213;X.u[W[";"]]=86;X.u[W[":"]]=214;X.u[74]=87;X.u[72]=88;X.u[68]=89;X.u[83]=90;X.u[110]=96;X.u[116]=97;X.u[101]=98;X.u[100]=99;X.u[13]=100;X.u[W["."]]=101;X.u[W[">"]]=229;X.u[W[","]]=102;X.u[W["<"]]=230;X.u[78]=103;X.u[66]=104;
|
||||
X.u[88]=105;X.u[119]=106;X.u[105]=112;X.u[99]=113;X.u[102]=114;X.u[109]=115;X.u[W["/"]]=117;X.u[W["?"]]=245;X.u[77]=118;X.u[W[" "]]=119;X.u[86]=120;X.u[67]=121;X.u[90]=122;X.u[120]=123;X.u[17]=124;X.u[16]=125;X.u[20]=126;X.vb={l4:X.Ja.Qc,l3:X.Ja.Pc,l2:X.Ja.Oc,l1:X.Ja.Nc,locked:X.Ja.Rc,online:X.Ja.ic,local:~X.Ja.ic};var Qd={SI1978:Sd,VT100:X};
|
||||
Pd.prototype.ja=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.L[e]){if("led"==a&&this.w.vb[b])return this.L[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Td(d,a,!0)},c.onkeyup=function(a){return Td(d,a,!1)},!0;default:if(this.w.wb&&void 0!==this.w.wb[b])return this.L[e]=c,a=function(a,b){return function(){Ud(a,b,!0)}}(this,b),b=function(a,b){return function(){Ud(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=
|
||||
b),!0}}return!1};Pd.prototype.Na=function(a,b,c,d){this.b=c;this.I=d;this.D=rb(a,"ChipSet");Cb(b,this,this.w.Pb);Gb(b,this,this.w.Qb)};Pd.prototype.Aa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Pd.prototype.Da=function(a){return a?this.save():!0};X.INIT=[[X.Ja.INIT,X.Gc.INIT,-1]];m=Pd.prototype;m.reset=function(){this.B=[];this.w.INIT&&!this.restore(this.w.INIT)&&this.ga("reset error")};
|
||||
m.save=function(){var a=new G(this);switch(this.w.ya){case X.ya:H(a,0,[this.H,this.F,-1])}return a.data()};m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.w.ya){case Sd.ya:return!0;case X.ya:return this.H=b[0],Vd(this,this.H&X.Ja.ec),this.F=b[1],this.A=b[2],!0}return!1};function Vd(a,b){for(var c in a.w.vb){var d=a.L["led-"+c];if(d){var e=a.w.vb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function Td(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=Rd[e]||e,!a.w.u[e]){for(var f in a.w.wb)if(a.w.wb[f]===e){e=f;break a}e=null}e&&(d=Ud(a,e,c),b.preventDefault());return d}
|
||||
function Ud(a,b,c){var d;a:{for(d=0;d<a.B.length;d++)if(a.B[d].bc==b)break a;d=-1}if(c)0>d?a.B.push({bc:b,Yb:Date.now(),Kb:!1}):(a.B[d].Yb=Date.now(),a.B[d].Kb=!1);else if(0<=d){if(!a.B[d].Kb){var e=a.B[d].Yb;if(e&&100>Date.now()-e)return a.B[d].Kb=!0,Wd(a),!0}a.B.splice(d,1)}if(a.D)switch(b){case "1p":Gd(a.D,U.Ua.Uc,c);break;case "2p":Gd(a.D,U.Ua.Yc,c);break;case "coin":Gd(a.D,U.Ua.Ic,c);break;case "left":Gd(a.D,U.Ua.Wc,c);break;case "right":Gd(a.D,U.Ua.Xc,c);break;case "fire":Gd(a.D,U.Ua.Vc,c)}return!0}
|
||||
function Wd(a){for(var b=0,c=-1;b<a.B.length;){if(a.B[b].Kb){var d=a.B[b].bc,e=100-(Date.now()-a.B[b].Yb);if(0<e){if(0>c||c>e)c=e}else{Ud(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Wd(a)},c)}m.wd=function(a,b){var c=this.F;0<=this.A&&(this.A<this.B.length?(c=this.B[this.A++],c=X.u[c.bc],c&128&&(c&=127)):(this.A=-1,c=X.Mc),this.F=c,fd(this.b,1));C(this,a,null,b,"KBDUART.ADDRESS",c);return c};
|
||||
m.Ld=function(a,b,c){C(this,a,b,c,"KBDUART.STATUS");this.H=b;Vd(this,b&X.Ja.ec);b&X.Ja.bd&&(this.A=0,fd(this.b,1))};X.Pb={130:Pd.prototype.wd};X.Qb={130:Pd.prototype.Ld};Ja(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Pd(d);eb(d,c)}});
|
||||
function Xd(a,b,c,d,e){var f=this;this.kc=xa("Gecko/");var h=["","moz","ms","webkit"];v.call(this,"Video",a,Xd,262144);this.ba=a.screenWidth;this.Z=a.screenHeight;this.wa=a.bufferAddr;this.jd=a.bufferRAM;var g=a.bufferFormat;this.ea=g&&Yd[g.toUpperCase()]||Zd;this.Ha=a.bufferCols;this.fa=a.bufferRows;this.ed=this.pa=a.cellWidth||1;this.ha=a.cellHeight||1;this.bb=null;this.jc=!1;this.Sa=a.bufferBits||1;this.kd=a.bufferLeft||0;if(this.D=a.bufferRotate)this.D=this.D%360,0<this.D&&(this.D-=360),-90!=
|
||||
this.D&&(this.ga("unsupported buffer rotation: "+this.D),this.D=0);this.Tb=a.interruptRate;this.ld=a.refreshRate||60;this.P=b;this.F=c;this.Fa=(this.Dc=d)||b||null;this.fd=this.ba;this.hd=this.Z;this.Hb=this.ba/this.Ha|0;this.Ib=this.Z/this.fa|0;1<this.ha&&this.fa++;b=a.smoothing;(c=Sa.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.H=a.screenRotate)this.H=this.H%360,0<this.H&&
|
||||
(this.H-=360),-90!=this.H?(this.ga("unsupported screen rotation: "+this.H),this.H=0):(this.F.translate(0,this.Z),this.F.rotate(this.H*Math.PI/180),this.F.scale(this.Z/this.ba,this.ba/this.Z));if(this.A=e)if(this.A.fb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.A.fb){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){$d(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(){$d(f,null)},!1);break}}if(this.la=a.fontROM)"json"!=ea(this.la)&&(this.la=qa()+"/api/v1/dump?file="+this.la+"&format=bytes"),pa(this.la,null,!0,function(a,b,c){ae(f,a,b,c)});this.ub={}}$a(Xd);var Zd=0,Yd={SI1978:1,VT100:2};
|
||||
Xd.prototype.Na=function(a,b,c,d){this.w=a;this.B=b;this.b=c;this.I=d;this.K=this.Ha*this.pa;this.da=this.fa*this.ha;b=this.K;c=this.da;this.D&&(b=this.da,c=this.K);this.Ta=(this.K*this.Sa>>3)*this.da;if(this.jd||vb(this.B,this.wa,this.Ta,3))1<this.pa?be(this,(this.Ha+1)*this.fa):(this.lc=this.F.createImageData(b,c),this.nc=16/this.Sa|0,be(this,this.Ta>>1)),this.O=document.createElement("canvas"),this.O.width=b,this.O.height=c,this.cb=this.O.getContext("2d"),this.na={},this.Ga=1<<this.Sa,this.ra=
|
||||
Array(this.Ga+2),this.ra[0]=[0,0,0,255],this.ra[1]=[255,255,255,255],1==this.ea&&(this.ra[this.Ga+0]=[255,255,0,255],this.ra[this.Ga+1]=[0,255,0,255]),2==this.ea&&(this.oc=60,this.eb=!1,this.Ka=Array(this.Ha));if(this.M=rb(a,"Keyboard")){for(var e in this.ub)this.M.ja("led",e,this.ub[e]);this.P&&this.M.ja(this.Dc?"textarea":"canvas","kbd",this.Fa)}this.la||D(this)};
|
||||
function ae(a,b,c,d){if(d)a.ga("Unable to load font ROM (error "+d+": "+b+")");else{bb(a.Sb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){u("Empty font ROM: "+b);return}if(1==f.length){u(f[0]);return}if(2048==f.length)ce(a,f);else{a.ga("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ga("Font ROM data error: "+h.message);return}(a.F||a.I)&&D(a)}}
|
||||
function ce(a,b){a.bb=b;a.jc=2==a.ea;a.na[96]=[de(a,a.pa,a.ha),de(a,a.pa,a.ha,a.eb)];a.na[64]=[de(a,2*a.pa,a.ha),de(a,2*a.pa,a.ha,a.eb)];a.na[32]=a.na[0]=[de(a,2*a.pa,2*a.ha),de(a,2*a.pa,2*a.ha,a.eb)]}
|
||||
function de(a,b,c,d){var e=8>=a.ed?8:16,f=8<e?15:0,h=a.bb.length/e,g=!1===d,k={pa:b,ha: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 l=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,r=q;q<a.ha;q++)for(var z=p*e+(f+q&e-1),z=d&&8==q?255:a.bb[z],w=0;w<c/a.ha;w++){for(var J=0,x=0,K=x;x<a.pa;x++){for(var B=z&128>>(7<x?7:x),J=a.jc&&!B&&J?J:B,S=0;S<b/a.pa;S++)g&&(J=!J),ee(a,l,K,r,J?1:0),K++;J=B}r++}k.context.putImageData(l,
|
||||
(p&15)*b,(p>>4)*c)}return k}
|
||||
Xd.prototype.za=function(){if(2==this.da){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.Aa,c=-1,d=-1,e,f=-(60==this.mc?2:5);f<this.ea;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Ab(this.w,b++,e);Ab(this.w,b++,
|
||||
c&255);if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)Ab(this.w,b++,g.charCodeAt(k)|c);c^=128}Ab(this.w,b++,127);c=b}fe(this)}return!0};Xd.prototype.ja=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ub[b]=c,!0;switch(b){case "fullScreen":return this.L[b]=c,this.A&&this.A.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
Xd.prototype.fb=function(){var a=!1;if(this.A){if(this.A.fb){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.A.style.width=a,this.A.style.height="auto");this.A.style.backgroundColor="black";this.A.fb();a=!0}this.Ga&&this.Ga.focus()}return a};
|
||||
function $d(a,b){!b&&a.A&&(a.ic?a.M.style.width=a.M.style.height="":a.A.style.width=a.A.style.height="");gb(a,"notifyFullScreen("+b+")",!0)}function be(a,b){a.kc=b;a.Fa=!1;if(void 0===a.ma||a.ma.length!=a.kc)a.ma=Array(a.kc)}function ee(a,b,c,d,e){d=a.B?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.da&&(208<=c&&236>c?e=a.Ha+0:28<=c&&72>c&&(e=a.Ha+1));a=a.ra[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 fe(a){for(var b=a.Aa,c=-1,d=0,e=60==a.mc?2:5,f=0,h=0;d<a.ea;){for(var g=0,k=b,l=c;;){var p=yb(a.w,k++);if(127==(p&127)){var q=yb(a.w,k++),c=q&96,b=(q&15)<<8|yb(a.w,k),b=b+(q&16?8192:16384);break}if(g<a.wa.length)a.wa[g++]=p;else break}if(e)e--;else{for(;g<a.wa.length;)a.wa[g++]=0;if(0<=l)for(k=0;k<g;k++){p=a.wa[k];if(!a.Fa||p!==a.ma[f]){var q=a,y=a.cb,x=p&127;if(p=q.na[l][p&128?1:0]){var v=(x&15)*p.pa,x=(x>>4)*p.ha,z=void 0,u=void 0,K=void 0,C=void 0,Y=p.pa,sa=p.ha;y?(z=k*q.pa,u=d*q.ha,K=
|
||||
q.pa,C=q.ha):(z=k*q.Hb,u=d*q.Ib,K=q.Hb,C=q.Ib);p.pa>q.pa&&(z*=2,K*=2);p.ha>q.ha&&(0==l&&(x+=q.ha),sa=q.ha);y?y.drawImage(p.canvas,v,x,Y,sa,z,u,K,C):(z+=0,u+=0,q.F.drawImage(p.canvas,v,x,Y,sa,z,u,K,C))}h++}f++}d++}}a.Fa=!0;h&&a.cb&&a.F.drawImage(a.K,0,0,a.J,a.Z-a.ha,0,0,a.dd,a.fd)}
|
||||
Ja(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<=qa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height=
|
||||
Xd.prototype.Aa=function(){if(2==this.ea){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.wa,c=-1,d=-1,e,f=-(60==this.oc?2:5);f<this.fa;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Ab(this.B,b++,e);Ab(this.B,b++,
|
||||
c&255);if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)Ab(this.B,b++,g.charCodeAt(k)|c);c^=128}Ab(this.B,b++,127);c=b}fe(this)}return!0};Xd.prototype.ja=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ub[b]=c,!0;switch(b){case "fullScreen":return this.L[b]=c,this.A&&this.A.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
Xd.prototype.fb=function(){var a=!1;if(this.A){if(this.A.fb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.ba/this.Z;b>c&&(a=Math.round(c/b*100)+"%")}this.kc?(this.P.style.width=a,this.P.style.width=a,this.P.style.display="block",this.P.style.margin="auto"):(this.A.style.width=a,this.A.style.height="auto");this.A.style.backgroundColor="black";this.A.fb();a=!0}this.Fa&&this.Fa.focus()}return a};
|
||||
function $d(a,b){!b&&a.A&&(a.kc?a.P.style.width=a.P.style.height="":a.A.style.width=a.A.style.height="");gb(a,"notifyFullScreen("+b+")",!0)}function be(a,b){a.mc=b;a.xa=!1;if(void 0===a.J||a.J.length!=a.mc)a.J=Array(a.mc)}function ee(a,b,c,d,e){d=a.D?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ea&&(208<=c&&236>c?e=a.Ga+0:28<=c&&72>c&&(e=a.Ga+1));a=a.ra[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 fe(a){for(var b=a.wa,c=-1,d=0,e=60==a.oc?2:5,f=0,h=0;d<a.fa;){var g=0,k=b,l=c,p=a.Ha;for(96!=l&&(p>>=1);;){var q=yb(a.B,k++);if(127==(q&127)){var r=yb(a.B,k++),c=r&96,b=(r&15)<<8|yb(a.B,k),b=b+(r&16?8192:16384);break}if(g<p)a.Ka[g++]=q;else break}if(e)e--;else{for(;g<a.Ka.length;)a.Ka[g++]=0;if(0<=l)for(k=a.xa&&a.J[f]==p,a.J[f++]=p,p=0;p<g;p++){q=a.Ka[p];if(!k||q!==a.J[f]){a.J[f]=q;var r=a,z=a.cb,w=q&127;if(q=r.na[l][q&128?1:0]){var J=(w&15)*q.pa,w=(w>>4)*q.ha,x=void 0,K=void 0,B=void 0,
|
||||
S=void 0,Aa=q.pa,aa=q.ha;z?(x=p*r.pa,K=d*r.ha,B=r.pa,S=r.ha):(x=p*r.Hb,K=d*r.Ib,B=r.Hb,S=r.Ib);q.pa>r.pa&&(x*=2,B*=2);q.ha>r.ha&&(0==l&&(w+=r.ha),aa=r.ha);z?z.drawImage(q.canvas,J,w,Aa,aa,x,K,B,S):(x+=0,K+=0,r.F.drawImage(q.canvas,J,w,Aa,aa,x,K,B,S))}h++}f++}d++}}a.xa=!0;h&&a.cb&&a.F.drawImage(a.O,0,0,a.K,a.da-a.ha,0,0,a.fd,a.hd)}
|
||||
Ja(function(){for(var a=A(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=y(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<=ra().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||Sa.aspect);f&&.3<=f&&3.33>=f&&(Ia("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");xa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Xd(d,e,h,f,c);eb(d,c)}});
|
||||
function ge(a){this.I=+a.adapter;switch(this.I){case 0:this.J=0;break;default:t("Unrecognized serial adapter #"+this.I);return}w.call(this,"SerialPort",a,ge,8388608);var b=a.binding;if("console"!=b){var c;a=he;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.L[b])&&this.ja(null,a,b))}}$a(ge);var he="buffer";m=ge.prototype;
|
||||
m.ja=function(a,b,c){switch(b){case he:return this.L[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};m.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=rb(a,"ChipSet");Cb(b,this,ie,this.J);Gb(b,this,je,this.J);E(this)};
|
||||
m.za=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.Da=function(a){return a?this.save():!0};m.reset=function(){ke(this)};m.save=function(){var a=new H(this),b=0,c=[];c[b++]=this.B;c[b++]=this.u;c[b++]=this.F;I(a,0,c);return a.data()};m.restore=function(a){return ke(this,a[0])};function ke(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.B=b[c++];a.u=b[c++];a.F=b[c++];return!0}m.od=function(a,b){var c=this.B;D(this,a,null,b,"DATA",c);return c};
|
||||
m.nd=function(a,b){var c=this.u;D(this,a,null,b,"COMMAND",c);return c};m.zd=function(a,b,c){D(this,a,b,c,"DATA");this.B=b};m.yd=function(a,b,c){D(this,a,b,c,"COMMAND");this.u=b};m.xd=function(a,b,c){D(this,a,b,c,"BAUDRATE");this.F=b};var ie={0:ge.prototype.od,1:ge.prototype.nd},je={0:ge.prototype.zd,1:ge.prototype.yd,2:ge.prototype.xd};Ja(function(){for(var a=B(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new ge(d);eb(d,c)}});
|
||||
function le(a){w.call(this,"Debugger",a,le);this.style=me;this.da=this.Ga=this.M=0;this.Y=X();this.bb=X();this.F=-1;this.B=[];this.fa=!1;this.ea=X();this.J=[];this.ma={};this.A=this.Z=this.I=[];ne(this);this.wa=0;oe(this);this.Ha=[];pe(this,a.messages);this.Ka=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return lc(b,a)}):void 0===global.$&&(global.$=function(a){return lc(b,a)})}$a(le);
|
||||
function ge(a){this.H=+a.adapter;switch(this.H){case 0:this.J=0;break;default:u("Unrecognized serial adapter #"+this.H);return}v.call(this,"SerialPort",a,ge,8388608);var b=a.binding;if("console"!=b){var c;a=he;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.L[b])&&this.ja(null,a,b))}}$a(ge);var he="buffer";m=ge.prototype;
|
||||
m.ja=function(a,b,c){switch(b){case he:return this.L[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};m.Na=function(a,b,c,d){this.B=b;this.b=c;this.I=d;this.D=rb(a,"ChipSet");Cb(b,this,ie,this.J);Gb(b,this,je,this.J);D(this)};
|
||||
m.Aa=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.Da=function(a){return a?this.save():!0};m.reset=function(){ke(this)};m.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.A;c[b++]=this.w;c[b++]=this.F;H(a,0,c);return a.data()};m.restore=function(a){return ke(this,a[0])};function ke(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.A=b[c++];a.w=b[c++];a.F=b[c++];return!0}m.qd=function(a,b){var c=this.A;C(this,a,null,b,"DATA",c);return c};
|
||||
m.pd=function(a,b){var c=this.w;C(this,a,null,b,"COMMAND",c);return c};m.Bd=function(a,b,c){C(this,a,b,c,"DATA");this.A=b};m.Ad=function(a,b,c){C(this,a,b,c,"COMMAND");this.w=b};m.zd=function(a,b,c){C(this,a,b,c,"BAUDRATE");this.F=b};var ie={0:ge.prototype.qd,1:ge.prototype.pd},je={0:ge.prototype.Bd,1:ge.prototype.Ad,2:ge.prototype.zd};Ja(function(){for(var a=A(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new ge(d);eb(d,c)}});
|
||||
function le(a){v.call(this,"Debugger",a,le);this.style=me;this.da=this.Ga=this.M=0;this.P=Y();this.bb=Y();this.F=-1;this.D=[];this.fa=!1;this.ea=Y();this.J=[];this.la={};this.A=this.Z=this.H=[];ne(this);this.wa=0;oe(this);this.Ha=[];pe(this,a.messages);this.Ka=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return lc(b,a)}):void 0===global.$&&(global.$=function(a){return lc(b,a)})}$a(le);
|
||||
var qe={"?":"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"},
|
||||
me=8080,re="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(" "),se="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(" "),
|
||||
te="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),ue=[[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,
|
||||
|
|
@ -143,100 +144,100 @@ te="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),ue=[[45],[42,2067,32],[71,
|
|||
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]],ve={cpu:1,bus:64,mem:128,port:256,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};m=le.prototype;
|
||||
m.Na=function(a,b,c,d){this.w=b;this.b=c;this.u=a;(a=ic(a,"messages"))&&pe(this,a);this.Ra=ue;we(this,function(a){a:{var b=d.w.V,c=a[0],g=a=0,k=b.length;if(c){a=xe(ye(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.w.la;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=xb[c],p&&d.g(n(p.id)+" %"+n(g<<d.w.la)+" %%"+n(p.G)+" "+r(p.Fb)+" "+
|
||||
r(p.size)+" "+l),c!=Vb&&(c=-1),l=0);a+=d.w.Ca;g++}}});E(this)};
|
||||
m.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ra=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",lc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.F<d.B.length-1&&(b=d.B[++d.F]):40==a.keyCode&&(0<d.F?b=d.B[--d.F]:(b="",d.F=-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.L[b]=c,za(c,function(){if(d.ra){var a=d.ra.value;d.ra.value=
|
||||
"";lc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,za(c,function(a){var b=!1;jb(d,!0)||(ib(d,!0),b=d.rb(a?1:0),ib(d,!1));return b}),!0}return!1};m.Eb=function(){this.ra&&this.ra.focus()};function xe(a){a=a&&a.G;null==a&&(a=-1);return a}m.X=function(a,b){var c=255,d=xe(a);-1!==d&&(c=yb(this.w,d),b&&ze(a,b));return c};m.Pa=function(a,b){var c=65535,d=xe(a);-1!==d&&(c=zb(this.w,d),b&&ze(a,b));return c};m.qa=function(a,b,c){var d=xe(a);-1!==d&&(Ab(this.w,d,b),c&&ze(a,c),mc(this.b,!0))};
|
||||
m.Rb=function(a,b,c){var d=xe(a);if(-1!==d){var e=this.w,f=d&e.w,h=(d&e.B)>>>e.la;f!=e.w?e.V[h].bc(f,b&65535,d):(e.V[h++].Gb(f,b&255,d),e.V[h&e.K].Gb(0,b>>8&255,d+1));c&&ze(a,c);mc(this.b,!0)}};function X(a){return{G:a,Ma:!1}}function Ae(a){return[a.G,a.Ma]}function Be(a){return{G:a[0],Ma:a[1]}}
|
||||
function ye(a,b,c){var d;c=(c?a.Y:a.bb).G;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.J.length;c++){var f=a.J[c].Oa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=De(a,b,void 0)}null!=c&&(d=X(c));return d}function Ee(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.kd=Fe(a,b.zc=c[2]))}function ze(a,b){null!=a.G&&(a.G+=b||1)}function Z(a){return n(a,4)}
|
||||
function Ge(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.X(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function pe(a,b){a.H=a;a.oa=a.ld=536870912;a.Aa=null;a.Fa=[];var c=Fe(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in ve)0<=na(c,d)&&(a.oa|=ve[d],a.g(d+" messages enabled"))}function we(a,b){for(var c in ve)if(64==ve[c]){a.Ha[c]=b;break}}
|
||||
function He(a,b){var c;a=a.toUpperCase();null==b?c=na(te,a):(c=na(te,a.substr(b,2)),0>c&&(c=na(te,a.substr(b,1))));return c}function Ie(a,b){var c=0,d=Je(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 Je(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.P;break;case 1:c=d.R;break;case 8:c=Nc(d);break;case 2:c=d.S;break;case 3:c=d.T;break;case 9:c=Pc(d);break;case 4:c=d.U;break;case 5:c=d.W;break;case 10:c=J(d);break;case 6:c=d.X(J(d));break;case 11:c=d.ia;break;case 12:c=d.N;break;case 13:c=Mc(d);break;case 14:c=Mc(d)&255|d.j<<8}}return c}
|
||||
function Ke(a,b){b=Ce(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=He(b,c+1),0<=e&&(b=b.substr(0,c)+Ie(a,e)+b.substr(c+1+te[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(e,16),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=ye(a,e))?(d=e+' "'+Ge(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=ye(a,e))?(ze(d),d=e+' "'+
|
||||
Ge(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(X(this.b.N).G));if(this.oa&1073741824)this.Fa.push(a);else if(!this.Aa||a!=this.Aa)if(this.Aa=a,this.oa&-2147483648&&(this.ka(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.ob=0;c.F-=c.b;c.b=0;mc(c)}};
|
||||
function fb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.oa&g)!=g||a.message(b.$a+"."+(null!=d?"outPort":"inPort")+"("+r(c)+","+(f?f:"unknown")+(null!=d?",0x"+n(d,2):"")+")"+(null!=h?": 0x"+n(h,2):"")+(null!=e?" at "+Z(e):""))}
|
||||
function oe(a){var b;if(gd(a)){if(!a.O||!a.O.length){a.O=Array(1E3);for(b=0;b<a.O.length;b++)a.O[b]=X();a.na=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.O&&a.O.length&&a.g("instruction history buffer freed"),a.na=0,a.O=[],a.K=[]}m.Za=function(a){if(!Le(this))return!1;this.b.Za(a);return!0};
|
||||
m.rb=function(a,b,c){if(!Le(this))return!1;this.M=0;a||gd(this)&&Ad(this,this.b.N,0);try{var d=this.b.rb(a);0<d&&(this.M+=d,Dc(this.b,d,!0),oc(this.b,d),this.da++)}catch(e){"number"!=typeof e&&(this.M=0,lb(this.b,e.stack||e.message))}!1!==c&&mc(this.b);this.Ea(b||!1);return 0<this.M};m.ka=function(a){this.b&&this.b.ka(a)};m.Ea=function(a){void 0===a&&(a=!0);this.Y=X(this.b.N);a&&1!=this.ba?Me(this):Ne(this)};
|
||||
function Le(a){var b;if(b=a.b&&kb(a.b))b=a.b,b.D.sa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!jb(a.b)?(a=a.b,a.D.ib?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.za=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.Da=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){oe(this);this.da=this.Ga=0;this.Aa=null;this.M=0;this.Y=X(this.b.N);this.D.va=!1;Oe(this);a||this.Ea()};
|
||||
m.save=function(){var a=new H(this);I(a,0,Ae(this.Y));I(a,1,Ae(this.ea));I(a,2,[this.B,this.fa,this.oa]);I(a,3,this.J);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.Y=Be(a[b++]),this.ea=Be(a[b++]),this.B=a[b][0],"string"==typeof this.B&&(this.B=[this.B]),this.fa=a[b][1],this.oa|=a[b][2]);a[3]&&(this.J=a[3]);return!0};m.start=function(a,b){this.ba||this.g("running");this.D.va=!0;this.ub=a;this.Hb=b};
|
||||
m.stop=function(a,b){if(this.D.va){this.D.va=!1;this.M=b-this.Hb;if(!this.ba){var c="stopped";if(this.M){var d=a-this.ub,e=0<d?Math.round(1E3*this.M/d):0,c=c+" (";gd(this)&&(c+=this.da+" opcodes, ",this.Ga-=this.da,this.da=0);c+=this.M+" cycles, "+d+" ms, "+e+" hz)"}else hb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ea(!0);this.Eb();Oe(this,this.b.N)}};function gd(a){return 1<a.A.length||!!a.wa}
|
||||
function Ad(a,b,c){var d=a.b;if(0<c&&(a.wa&&!--a.wa||dc(a,b,1,a.A)))return!0;0<=c&&a.K.length&&(a.da++,b=yb(a.w,b),null!=b&&(a.K[b][1]++,b=a.O[a.na],b.G=d.N,b.Ma=!1,++a.na==a.O.length&&(a.na=0)));return!1}function Eb(a,b,c){a.g("break on input from port "+r(b)+": "+n(c));a.ka(!0)}function Ib(a,b,c){a.g("break on output to port "+r(b)+": "+n(c));a.ka(!0)}
|
||||
function ne(a){var b,c;a.A=["bp"];if(void 0!==a.Z)for(b=1;b<a.Z.length;b++){c=a.Z[b];var d=a.w;ec(d.V[xe(c)>>>d.la],!1)}a.Z=["br"];if(void 0!==a.I)for(b=1;b<a.I.length;b++)c=a.I[b],d=a.w,ec(d.V[xe(c)>>>d.la],!0);a.I=["bw"];a.cb=0}m.Ua=function(a,b,c){var d=!0;c||nf(this,a,b,!1,!0);if(a!=this.A){var e=xe(b);if(-1===e)this.g("invalid address: "+Z(b.G)),d=!1;else{var f=this.w;f.V[e>>>f.la].Ua(e&f.w,a==this.I)}}d&&(a.push(b),c?b.Ma=!0:(of(this,a,a.length-1,"set"),oe(this)));return d};
|
||||
function nf(a,b,c,d,e){var f=!1;c=xe(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==xe(g)&&(!d||g.Ma)){f=!0;g.Ma||e||of(a,b,h,"cleared");b.splice(h,1);b!=a.A&&(d=a.w,ec(d.V[c>>>d.la],b==a.I));g.Ma||oe(a);break}}return f}function pf(a,b){for(var c=1;c<b.length;c++)of(a,b,c);return b.length-1}function of(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.G)+(d?" "+d:c.zc?' "'+c.zc+'"':""))}
|
||||
m.Na=function(a,b,c,d){this.B=b;this.b=c;this.w=a;(a=ic(a,"messages"))&&pe(this,a);this.Sa=ue;we(this,function(a){a:{var b=d.B.W,c=a[0],g=a=0,k=b.length;if(c){a=xe(ye(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.B.ma;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=xb[c],p&&d.g(n(p.id)+" %"+n(g<<d.B.ma)+" %%"+n(p.G)+" "+t(p.Fb)+" "+
|
||||
t(p.size)+" "+l),c!=Vb&&(c=-1),l=0);a+=d.B.Ca;g++}}});D(this)};
|
||||
m.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ra=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",lc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.F<d.D.length-1&&(b=d.D[++d.F]):40==a.keyCode&&(0<d.F?b=d.D[--d.F]:(b="",d.F=-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.L[b]=c,za(c,function(){if(d.ra){var a=d.ra.value;d.ra.value=
|
||||
"";lc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,za(c,function(a){var b=!1;jb(d,!0)||(ib(d,!0),b=d.rb(a?1:0),ib(d,!1));return b}),!0}return!1};m.Eb=function(){this.ra&&this.ra.focus()};function xe(a){a=a&&a.G;null==a&&(a=-1);return a}m.Y=function(a,b){var c=255,d=xe(a);-1!==d&&(c=yb(this.B,d),b&&ze(a,b));return c};m.Qa=function(a,b){var c=65535,d=xe(a);-1!==d&&(c=zb(this.B,d),b&&ze(a,b));return c};m.qa=function(a,b,c){var d=xe(a);-1!==d&&(Ab(this.B,d,b),c&&ze(a,c),mc(this.b,!0))};
|
||||
m.Rb=function(a,b,c){var d=xe(a);if(-1!==d){var e=this.B,f=d&e.B,h=(d&e.D)>>>e.ma;f!=e.B?e.W[h].cc(f,b&65535,d):(e.W[h++].Gb(f,b&255,d),e.W[h&e.K].Gb(0,b>>8&255,d+1));c&&ze(a,c);mc(this.b,!0)}};function Y(a){return{G:a,Ma:!1}}function Ae(a){return[a.G,a.Ma]}function Be(a){return{G:a[0],Ma:a[1]}}
|
||||
function ye(a,b,c){var d;c=(c?a.P:a.bb).G;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.J.length;c++){var f=a.J[c].Oa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=Y(d));break}}if(d=e)return d;c=De(a,b,void 0)}null!=c&&(d=Y(c));return d}function Ee(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.md=Fe(a,b.Bc=c[2]))}function ze(a,b){null!=a.G&&(a.G+=b||1)}function Z(a){return n(a,4)}
|
||||
function Ge(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.Y(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function pe(a,b){a.I=a;a.oa=a.nd=536870912;a.xa=null;a.Fa=[];var c=Fe(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in ve)0<=oa(c,d)&&(a.oa|=ve[d],a.g(d+" messages enabled"))}function we(a,b){for(var c in ve)if(64==ve[c]){a.Ha[c]=b;break}}
|
||||
function He(a,b){var c;a=a.toUpperCase();null==b?c=oa(te,a):(c=oa(te,a.substr(b,2)),0>c&&(c=oa(te,a.substr(b,1))));return c}function Ie(a,b){var c=0,d=Je(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 Je(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.R;break;case 1:c=d.S;break;case 8:c=Nc(d);break;case 2:c=d.T;break;case 3:c=d.U;break;case 9:c=Pc(d);break;case 4:c=d.V;break;case 5:c=d.X;break;case 10:c=I(d);break;case 6:c=d.Y(I(d));break;case 11:c=d.ia;break;case 12:c=d.N;break;case 13:c=Mc(d);break;case 14:c=Mc(d)&255|d.j<<8}}return c}
|
||||
function Ke(a,b){b=Ce(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=He(b,c+1),0<=e&&(b=b.substr(0,c)+Ie(a,e)+b.substr(c+1+te[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ca(e,16),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=ye(a,e))?(d=e+' "'+Ge(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=ye(a,e))?(ze(d),d=e+' "'+
|
||||
Ge(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(Y(this.b.N).G));if(this.oa&1073741824)this.Fa.push(a);else if(!this.xa||a!=this.xa)if(this.xa=a,this.oa&-2147483648&&(this.ka(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.ob=0;c.F-=c.b;c.b=0;mc(c)}};
|
||||
function fb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.oa&g)!=g||a.message(b.ab+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?",0x"+n(d,2):"")+")"+(null!=h?": 0x"+n(h,2):"")+(null!=e?" at "+Z(e):""))}
|
||||
function oe(a){var b;if(gd(a)){if(!a.O||!a.O.length){a.O=Array(1E3);for(b=0;b<a.O.length;b++)a.O[b]=Y();a.na=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.O&&a.O.length&&a.g("instruction history buffer freed"),a.na=0,a.O=[],a.K=[]}m.$a=function(a){if(!Le(this))return!1;this.b.$a(a);return!0};
|
||||
m.rb=function(a,b,c){if(!Le(this))return!1;this.M=0;a||gd(this)&&Ad(this,this.b.N,0);try{var d=this.b.rb(a);0<d&&(this.M+=d,Dc(this.b,d,!0),oc(this.b,d),this.da++)}catch(e){"number"!=typeof e&&(this.M=0,lb(this.b,e.stack||e.message))}!1!==c&&mc(this.b);this.Ea(b||!1);return 0<this.M};m.ka=function(a){this.b&&this.b.ka(a)};m.Ea=function(a){void 0===a&&(a=!0);this.P=Y(this.b.N);a&&1!=this.ba?Me(this):Ne(this)};
|
||||
function Le(a){var b;if(b=a.b&&kb(a.b))b=a.b,b.C.sa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!jb(a.b)?(a=a.b,a.C.ib?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.Da=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){oe(this);this.da=this.Ga=0;this.xa=null;this.M=0;this.P=Y(this.b.N);this.C.va=!1;Oe(this);a||this.Ea()};
|
||||
m.save=function(){var a=new G(this);H(a,0,Ae(this.P));H(a,1,Ae(this.ea));H(a,2,[this.D,this.fa,this.oa]);H(a,3,this.J);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.P=Be(a[b++]),this.ea=Be(a[b++]),this.D=a[b][0],"string"==typeof this.D&&(this.D=[this.D]),this.fa=a[b][1],this.oa|=a[b][2]);a[3]&&(this.J=a[3]);return!0};m.start=function(a,b){this.ba||this.g("running");this.C.va=!0;this.ub=a;this.Hb=b};
|
||||
m.stop=function(a,b){if(this.C.va){this.C.va=!1;this.M=b-this.Hb;if(!this.ba){var c="stopped";if(this.M){var d=a-this.ub,e=0<d?Math.round(1E3*this.M/d):0,c=c+" (";gd(this)&&(c+=this.da+" opcodes, ",this.Ga-=this.da,this.da=0);c+=this.M+" cycles, "+d+" ms, "+e+" hz)"}else hb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ea(!0);this.Eb();Oe(this,this.b.N)}};function gd(a){return 1<a.A.length||!!a.wa}
|
||||
function Ad(a,b,c){var d=a.b;if(0<c&&(a.wa&&!--a.wa||dc(a,b,1,a.A)))return!0;0<=c&&a.K.length&&(a.da++,b=yb(a.B,b),null!=b&&(a.K[b][1]++,b=a.O[a.na],b.G=d.N,b.Ma=!1,++a.na==a.O.length&&(a.na=0)));return!1}function Eb(a,b,c){a.g("break on input from port "+t(b)+": "+n(c));a.ka(!0)}function Ib(a,b,c){a.g("break on output to port "+t(b)+": "+n(c));a.ka(!0)}
|
||||
function ne(a){var b,c;a.A=["bp"];if(void 0!==a.Z)for(b=1;b<a.Z.length;b++){c=a.Z[b];var d=a.B;ec(d.W[xe(c)>>>d.ma],!1)}a.Z=["br"];if(void 0!==a.H)for(b=1;b<a.H.length;b++)c=a.H[b],d=a.B,ec(d.W[xe(c)>>>d.ma],!0);a.H=["bw"];a.cb=0}m.Va=function(a,b,c){var d=!0;c||nf(this,a,b,!1,!0);if(a!=this.A){var e=xe(b);if(-1===e)this.g("invalid address: "+Z(b.G)),d=!1;else{var f=this.B;f.W[e>>>f.ma].Va(e&f.B,a==this.H)}}d&&(a.push(b),c?b.Ma=!0:(of(this,a,a.length-1,"set"),oe(this)));return d};
|
||||
function nf(a,b,c,d,e){var f=!1;c=xe(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==xe(g)&&(!d||g.Ma)){f=!0;g.Ma||e||of(a,b,h,"cleared");b.splice(h,1);b!=a.A&&(d=a.B,ec(d.W[c>>>d.ma],b==a.H));g.Ma||oe(a);break}}return f}function pf(a,b){for(var c=1;c<b.length;c++)of(a,b,c);return b.length-1}function of(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.G)+(d?" "+d:c.Bc?' "'+c.Bc+'"':""))}
|
||||
function Oe(a,b){if(void 0!==b)dc(a,b,1,a.A,!0),a.ba=0;else for(var c=1;c<a.A.length;c++){var d=a.A[c];if(d.Ma){if(!nf(a,a.A,d,!0))break;c=0}}}
|
||||
function dc(a,b,c,d,e){var f=!1;if(!a.cb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Ma)for(var k=xe(g),l=0;l<c;l++)if(b+l==k){var p,f=!0;g.Ma&&(nf(a,d,g,!0),e=!0);if(p=g.kd){for(var f=!1,q=0;q<p.length;q++)if(!qf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var y=q+1;y<p.length&&p[y].indexOf("else");y++)q++;if(y==p.length){f=!0;break}}a.b.D.va||(f=!0)}if(f){e||of(a,d,h,"hit");break}}}a.cb--;return f}
|
||||
function rf(a,b,c,d){for(var e=X(b.G),f=a.X(b,1),h=a.Ra[f],g="",k=(8086!=a.style?re:se)[h[0]],l=h.length-1,p=0,q,y=1;y<=l;y++){var x="";q=h[y];if(void 0!==q&&!(q&16384&&a.style==me)){var v=q&240;if(v){var z=q&15;z?p=z:q|=p;q&61440||(q|=1==y?8192:4096);if(v&32)a:{var x=a,v=q,z=b,u=" ";switch(v&15){case 1:u=n(x.X(z,1),2);break;case 2:u=n(x.X(z,1)<<24>>24,4);break;case 3:u=n(x.Pa(z,2),4);break;default:x="imm("+r(v)+")";break a}8086==x.style&&v&64?u="["+u+"]":v&16||(u=(x.style==me?"$":"0x")+u);x=u}else v&
|
||||
16?(x=(q&3840)>>8,v=te[x],8086==a.style&&q&64&&(6==x&&(v="HL"),v="["+v+"]"),x=v):v&128&&(x=(f>>3&7).toString());if(!x||!x.length){g="INVALID";break}0<g.length&&(g+=",");g+=x||"???"}}}f="";h=Z(e.G)+" ";if(-1!==e.G&&-1!==b.G){do if(f+=n(a.X(e,1),2),null==e.G)break;while(e.G!=b.G)}h+=ia(f,10);h=h+(q&32768?"*":" ")+ia(k,7);g&&(h+=" "+g);c&&(h=ia(h,40)+";"+c,h=a.b.D.hb?h+("cycles="+pc(a.b).toString()+" cs="+n(a.b.i.xb)):h+(null!=d?"="+d.toString():""));return h}
|
||||
function dc(a,b,c,d,e){var f=!1;if(!a.cb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Ma)for(var k=xe(g),l=0;l<c;l++)if(b+l==k){var p,f=!0;g.Ma&&(nf(a,d,g,!0),e=!0);if(p=g.md){for(var f=!1,q=0;q<p.length;q++)if(!qf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var r=q+1;r<p.length&&p[r].indexOf("else");r++)q++;if(r==p.length){f=!0;break}}a.b.C.va||(f=!0)}if(f){e||of(a,d,h,"hit");break}}}a.cb--;return f}
|
||||
function rf(a,b,c,d){for(var e=Y(b.G),f=a.Y(b,1),h=a.Sa[f],g="",k=(8086!=a.style?re:se)[h[0]],l=h.length-1,p=0,q,r=1;r<=l;r++){var z="";q=h[r];if(void 0!==q&&!(q&16384&&a.style==me)){var w=q&240;if(w){var J=q&15;J?p=J:q|=p;q&61440||(q|=1==r?8192:4096);if(w&32)a:{var z=a,w=q,J=b,x=" ";switch(w&15){case 1:x=n(z.Y(J,1),2);break;case 2:x=n(z.Y(J,1)<<24>>24,4);break;case 3:x=n(z.Qa(J,2),4);break;default:z="imm("+t(w)+")";break a}8086==z.style&&w&64?x="["+x+"]":w&16||(x=(z.style==me?"$":"0x")+x);z=x}else w&
|
||||
16?(z=(q&3840)>>8,w=te[z],8086==a.style&&q&64&&(6==z&&(w="HL"),w="["+w+"]"),z=w):w&128&&(z=(f>>3&7).toString());if(!z||!z.length){g="INVALID";break}0<g.length&&(g+=",");g+=z||"???"}}}f="";h=Z(e.G)+" ";if(-1!==e.G&&-1!==b.G){do if(f+=n(a.Y(e,1),2),null==e.G)break;while(e.G!=b.G)}h+=ja(f,10);h=h+(q&32768?"*":" ")+ja(k,7);g&&(h+=" "+g);c&&(h=ja(h,40)+";"+c,h=a.b.C.hb?h+("cycles="+pc(a.b).toString()+" cs="+n(a.b.i.xb)):h+(null!=d?"="+d.toString():""));return h}
|
||||
function sf(a,b){var c;switch(b){case "IF":c=a.b.ta&512;break;case "SF":c=Xc(a.b);break;case "ZF":c=Wc(a.b);break;case "AF":c=Vc(a.b);break;case "PF":c=Uc(a.b);break;case "CF":c=Sc(a.b);break;default:c=0}return b.charAt(0)+(c?"1":"0")+" "}function tf(a,b){return te[b]+"="+Ie(a,b)+" "}function uf(a){return tf(a,7)+tf(a,8)+tf(a,9)+tf(a,10)+tf(a,11)+sf(a,"IF")+sf(a,"SF")+sf(a,"ZF")+sf(a,"AF")+sf(a,"PF")+sf(a,"CF")}
|
||||
var vf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
|
||||
function wf(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}
|
||||
function De(a,b,c){var d;if(b){b=Ce(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<l.length;){var p=l[e++],q=p.length,p=ja(p);if(!p){f=!0;break}p=xf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==l.length)break;var p=l[e++],y=p.length;k.length&&vf[p]<vf[k[k.length-1]]&&wf(g,k,1);k.push(p);b=b.substr(q+y)}wf(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&yf(a,null,
|
||||
d))}return d}function Ce(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=De(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=ye(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.Pa(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.da-a.Ga}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
|
||||
function xf(a,b,c,d){var e;void 0!==b?(e=He(b),0<=e?e=Je(a,e):(e=a.ma[b],void 0===e&&(e=ba(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function yf(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,l=8,p="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)p="?"+p;else for(;0<l--;)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 zf(a,b){if(b)return yf(a,b,a.ma[b]);var c=0;for(b in a.ma)yf(a,b,a.ma[b]),c++;return 0<c}le.prototype.Sa=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Af(a,b,c){var d=[],e=xe(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],h=f.G>>>0,g=f.vd;if(e>=h&&e<h+g){e=ka(f.nc,[e-h],a.Sa);0<=e?Bf(a,b,e,d):c&&(e=~e,Bf(a,b,e-1,d),Bf(a,b,e,d));break}}return d}function Bf(a,b,c,d){var e={},f=a.J[b].nc,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.J[b].Oa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
|
||||
function Cf(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?re:se;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Ra[h][0]]+" ").substr(0,5)+" ("+("0x"+n(h,2))+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
|
||||
function Df(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return zf(a)||a.g("no variables"),!0;if(!c[2])return zf(a,c[1]);if(!c[3])return delete a.ma[c[1]],!0;var d=De(a,c[3]);return void 0!==d?(a.ma[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Ef(a,b,c){var d=null;if(b=ye(a,b,!0)){var e=Af(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.G-e[1])&&(h=" + "+r(f)),f=e[0]+" ("+Z(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.G)&&(h=" - "+r(f)),f=e[4]+" ("+Z(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
|
||||
function Ff(a,b){switch(b[1]){case "8080":a.style=me;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.i.lb=c;break;case "start":a.b.i.yb=c;break;case "stop":a.b.i.nb=c;break;default:a.g("unknown cs option");return}void 0!==c&&kc(a.b);a.g("checksums "+(a.b.D.hb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Cc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.Wa.toFixed(2)+"Mhz")+
|
||||
" ("+a.b.i.Ya+"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 Me(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=De(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.j=g&255;break;case "B":d.P=g&255;break;case "BC":d.P=g>>8&255;case "C":d.R=g&255;break;case "D":d.S=
|
||||
g&255;break;case "DE":d.S=g>>8&255;case "E":d.T=g&255;break;case "H":d.U=g&255;break;case "HL":d.U=g>>8&255;case "L":d.W=g&255;break;case "SP":d.ia=g&65535;break;case "PC":G(d,g);a.Y=X(d.N);break;case "PS":Kc(d,g);break;case "PSW":Kc(d,g&255|d.ta&-256);d.j=g>>8;break;case "CF":d.aa=g?d.aa|256:d.aa&255;break;case "PF":g?Uc(d)||(d.ca^=1):Uc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.aa=g?d.aa&-256:d.aa|255;break;case "SF":g?Xc(d)||(d.ca^=192):Xc(d)&&(d.ca^=
|
||||
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}mc(d);a.g("updated registers:")}a.g(uf(a));c&&(a.Y=X(d.N),Ne(a,Z(a.Y.G)))}}function Gf(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ke(a,c[2])):De(a,b,!0)}function Hf(a,b,c){var d="t"!=b;c=xf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);ya(c,function(){return ib(a,!0)&&a.rb(e,d,!1)},function(){mc(a.b);ib(a,!1)})}
|
||||
function Ne(a,b,c,d){if(b=ye(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ye(a,c,!0);if(!d||d.G<b.G)return;e=d.G-b.G;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=jb(a,!1)||a.ba?a.M:null;var h=null!=f?"cycles":null,g=Af(a,b),k=b.G;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=rf(a,b,h,f);a.g(f);a.Y=b;e-=b.G-k;c++}}}
|
||||
function Fe(a,b,c,d){if(c)if(b){0>a.F&&a.B.length&&(a.F=0);if(0>a.F||b!=a.B[a.F])a.B.splice(0,0,b),a.F=0;a.F--}else a.fa?b="end":b=a.B[a.F+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ja(b.substring(c,f))),c=f+1}}return a}
|
||||
function qf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Z(a.ea.G)),a.Y=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.Aa=null;if(kb(a)&&0<b.length){a.fa&&(b="a "+Z(a.ea.G)+" "+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 l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=ye(a,f[1],!0);if(p)if(a.ea=
|
||||
p,void 0===f[2])a.g("begin assemble at "+Z(p.G)),a.fa=!0,mc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var y=0;y<q.length;y++)a.qa(p,q[y],1);a.g(rf(a,a.ea))}}break;case "b":a:{var x=f[0],v=f[1],z=b;if("?"==v)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 u=x.charAt(1);if("l"==u){var K=0,K=K+pf(a,a.A),K=K+pf(a,a.Z);(K+=pf(a,a.I))||a.g("no breakpoints")}else if("n"==u)a.wa=xf(a,v),a.g("break after "+a.wa+" instruction(s)");else if(void 0===v)a.g("missing breakpoint address");else{var C=X();if("*"!=v&&(C=ye(a,v,!0),!C))break a;v=r(C.G);"c"==u?null==C.G?(ne(a),a.g("all breakpoints cleared")):nf(a,a.A,C)||nf(a,a.Z,C)||
|
||||
nf(a,a.I,C)||a.g("breakpoint missing: "+Z(C.G)):"i"==u?a.g("breakpoint "+(Bb(a.w,C.G)?"enabled":"cleared")+": port "+v+" (input)"):"o"==u?a.g("breakpoint "+(Fb(a.w,C.G)?"enabled":"cleared")+": port "+v+" (output)"):null!=C.G&&(Ee(a,C,z),"p"==u?a.Ua(a.A,C):"r"==u?a.Ua(a.Z,C):"w"==u?a.Ua(a.I,C):a.g("unknown breakpoint command: "+u))}}}break;case "c":a.Ba&&(a.Ba.value="");break;case "d":a:{var Y,sa=f[0],Ba=f[1],Wa=f[2],bg=f[3];if("?"==Ba){var Ca="";for(Y in ve)a.Ha[Y]&&(Ca&&(Ca+=","),Ca+=Y);Ca+=",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");Ca.length&&a.g("dump extension commands:\n\t"+Ca)}else if("state"==Ba){var Pe=If(a.u,!0);"console"==Wa?console.log(Pe):(a.Ba&&(a.Ba.value=""),a.g(Pe))}else if("symbols"==Ba)for(var hd=0;hd<a.J.length;hd++){var id=a.J[hd],mb;for(mb in id.Oa)if("."!=mb.charAt(0)){var Qe=
|
||||
id.Oa[mb].o;if(void 0!==Qe){var Re=id.Oa[mb].l;Re&&(mb=Re);a.g(Z(Qe)+" "+mb)}}}else{if("d"==sa){for(Y in ve)if(f[1]==Y){var Se=a.Ha[Y];Se?(f.shift(),f.shift(),Se(f)):a.g("no dump registered for "+Ba);break a}Ba||(sa=a.Ib||"db")}else a.Ib=sa;if("dh"==sa){var Te=Ba,Ue=Wa,Ve="",We=0,aa=a.na,Da=a.O;if(Da.length){var fa=+Te||a.eb,nb=+Ue||10;isNaN(fa)?fa=nb:Ve="more ";fa>Da.length&&(a.g("note: only "+Da.length+" available"),fa=Da.length);aa-=fa;0>aa&&(null==Da[Da.length-1].G?(fa=aa+fa,aa=0):aa+=Da.length);
|
||||
var jd=[];"call"==Ue&&(nb=1E5,jd=["CALL"]);for(void 0!==Te&&a.g(fa+" instructions earlier:");0<nb&&aa!=a.na;){var Xe=Da[aa++];if(null==Xe.G)break;var Mb=X(Xe.G),cg=fa--,Ye=rf(a,Mb,"history",cg);(!jd.length||0<=Ye.indexOf(jd[0]))&&a.g(Ye);Mb.Ub&&(aa+=Mb.Ub,nb-=Mb.Ub,fa-=Mb.Ub);aa>=Da.length&&(aa=0);a.eb=fa;We++;nb--}}We||(a.g("no "+Ve+"history available"),a.eb=void 0)}else{var qc=ye(a,Ba);if(qc){var rc=0;Wa&&("l"==Wa.charAt(0)&&(Wa=Wa.substr(1)||bg),rc=xf(a,Wa)>>>0,65536<rc&&(rc=65536));for(var Xa=
|
||||
"",sc="dd"==sa?4:"dw"==sa?2:1,tc=sc*rc||128,dg=tc+15>>4||1;dg--&&0<tc;){var uc=0,kd=0,Nb,Ob="",ld="",Ba=Z(qc.G);for(Nb=16;0<Nb&&0<tc;Nb--){var vc=a.X(qc,1),uc=uc|vc<<(kd++<<3);kd==sc&&(Ob+=n(uc,2*sc),Ob+=1==sc?9==Nb?"-":" ":" ",uc=kd=0);ld+=32<=vc&&128>vc?String.fromCharCode(vc):".";tc--}Xa&&(Xa+="\n");Xa+=Ba+" "+Ob+(0==Nb?" "+ld:"")}Xa&&a.g(Xa);a.bb=qc}}}}break;case "e":if("else"==f[0])break;var wc=1,Ze=255,$e=a.X,af=a.qa;"ew"==f[0]&&(wc=2,Ze=65535,$e=a.Pa,af=a.Rb);var bf=wc<<1,cf=f[1];if(null==
|
||||
function De(a,b,c){var d;if(b){b=Ce(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<l.length;){var p=l[e++],q=p.length,p=ka(p);if(!p){f=!0;break}p=xf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==l.length)break;var p=l[e++],r=p.length;k.length&&vf[p]<vf[k[k.length-1]]&&wf(g,k,1);k.push(p);b=b.substr(q+r)}wf(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&yf(a,null,
|
||||
d))}return d}function Ce(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=De(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=ye(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.Qa(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.da-a.Ga}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
|
||||
function xf(a,b,c,d){var e;void 0!==b?(e=He(b),0<=e?e=Je(a,e):(e=a.la[b],void 0===e&&(e=ca(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function yf(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,l=8,p="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)p="?"+p;else for(;0<l--;)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 zf(a,b){if(b)return yf(a,b,a.la[b]);var c=0;for(b in a.la)yf(a,b,a.la[b]),c++;return 0<c}le.prototype.Ta=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Af(a,b,c){var d=[],e=xe(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],h=f.G>>>0,g=f.xd;if(e>=h&&e<h+g){e=la(f.pc,[e-h],a.Ta);0<=e?Bf(a,b,e,d):c&&(e=~e,Bf(a,b,e-1,d),Bf(a,b,e,d));break}}return d}function Bf(a,b,c,d){var e={},f=a.J[b].pc,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.J[b].Oa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
|
||||
function Cf(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?re:se;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Sa[h][0]]+" ").substr(0,5)+" ("+("0x"+n(h,2))+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
|
||||
function Df(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return zf(a)||a.g("no variables"),!0;if(!c[2])return zf(a,c[1]);if(!c[3])return delete a.la[c[1]],!0;var d=De(a,c[3]);return void 0!==d?(a.la[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Ef(a,b,c){var d=null;if(b=ye(a,b,!0)){var e=Af(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.G-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.G)&&(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 Ff(a,b){switch(b[1]){case "8080":a.style=me;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.i.lb=c;break;case "start":a.b.i.yb=c;break;case "stop":a.b.i.nb=c;break;default:a.g("unknown cs option");return}void 0!==c&&kc(a.b);a.g("checksums "+(a.b.C.hb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Cc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.Xa.toFixed(2)+"Mhz")+
|
||||
" ("+a.b.i.Za+"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 Me(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=De(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.j=g&255;break;case "B":d.R=g&255;break;case "BC":d.R=g>>8&255;case "C":d.S=g&255;break;case "D":d.T=
|
||||
g&255;break;case "DE":d.T=g>>8&255;case "E":d.U=g&255;break;case "H":d.V=g&255;break;case "HL":d.V=g>>8&255;case "L":d.X=g&255;break;case "SP":d.ia=g&65535;break;case "PC":F(d,g);a.P=Y(d.N);break;case "PS":Kc(d,g);break;case "PSW":Kc(d,g&255|d.ta&-256);d.j=g>>8;break;case "CF":d.aa=g?d.aa|256:d.aa&255;break;case "PF":g?Uc(d)||(d.ca^=1):Uc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.aa=g?d.aa&-256:d.aa|255;break;case "SF":g?Xc(d)||(d.ca^=192):Xc(d)&&(d.ca^=
|
||||
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}mc(d);a.g("updated registers:")}a.g(uf(a));c&&(a.P=Y(d.N),Ne(a,Z(a.P.G)))}}function Gf(a,b){b=ka(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ke(a,c[2])):De(a,b,!0)}function Hf(a,b,c){var d="t"!=b;c=xf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);ya(c,function(){return ib(a,!0)&&a.rb(e,d,!1)},function(){mc(a.b);ib(a,!1)})}
|
||||
function Ne(a,b,c,d){if(b=ye(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ye(a,c,!0);if(!d||d.G<b.G)return;e=d.G-b.G;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=jb(a,!1)||a.ba?a.M:null;var h=null!=f?"cycles":null,g=Af(a,b),k=b.G;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=rf(a,b,h,f);a.g(f);a.P=b;e-=b.G-k;c++}}}
|
||||
function Fe(a,b,c,d){if(c)if(b){0>a.F&&a.D.length&&(a.F=0);if(0>a.F||b!=a.D[a.F])a.D.splice(0,0,b),a.F=0;a.F--}else a.fa?b="end":b=a.D[a.F+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ka(b.substring(c,f))),c=f+1}}return a}
|
||||
function qf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Z(a.ea.G)),a.P=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.xa=null;if(kb(a)&&0<b.length){a.fa&&(b="a "+Z(a.ea.G)+" "+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 l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=ye(a,f[1],!0);if(p)if(a.ea=
|
||||
p,void 0===f[2])a.g("begin assemble at "+Z(p.G)),a.fa=!0,mc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var r=0;r<q.length;r++)a.qa(p,q[r],1);a.g(rf(a,a.ea))}}break;case "b":a:{var z=f[0],w=f[1],J=b;if("?"==w)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 x=z.charAt(1);if("l"==x){var K=0,K=K+pf(a,a.A),K=K+pf(a,a.Z);(K+=pf(a,a.H))||a.g("no breakpoints")}else if("n"==x)a.wa=xf(a,w),a.g("break after "+a.wa+" instruction(s)");else if(void 0===w)a.g("missing breakpoint address");else{var B=Y();if("*"!=w&&(B=ye(a,w,!0),!B))break a;w=t(B.G);"c"==x?null==B.G?(ne(a),a.g("all breakpoints cleared")):nf(a,a.A,B)||nf(a,a.Z,B)||
|
||||
nf(a,a.H,B)||a.g("breakpoint missing: "+Z(B.G)):"i"==x?a.g("breakpoint "+(Bb(a.B,B.G)?"enabled":"cleared")+": port "+w+" (input)"):"o"==x?a.g("breakpoint "+(Fb(a.B,B.G)?"enabled":"cleared")+": port "+w+" (output)"):null!=B.G&&(Ee(a,B,J),"p"==x?a.Va(a.A,B):"r"==x?a.Va(a.Z,B):"w"==x?a.Va(a.H,B):a.g("unknown breakpoint command: "+x))}}}break;case "c":a.Ba&&(a.Ba.value="");break;case "d":a:{var S,Aa=f[0],aa=f[1],Wa=f[2],bg=f[3];if("?"==aa){var Ca="";for(S in ve)a.Ha[S]&&(Ca&&(Ca+=","),Ca+=S);Ca+=",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");Ca.length&&a.g("dump extension commands:\n\t"+Ca)}else if("state"==aa){var Pe=If(a.w,!0);"console"==Wa?console.log(Pe):(a.Ba&&(a.Ba.value=""),a.g(Pe))}else if("symbols"==aa)for(var hd=0;hd<a.J.length;hd++){var id=a.J[hd],nb;for(nb in id.Oa)if("."!=nb.charAt(0)){var Qe=
|
||||
id.Oa[nb].o;if(void 0!==Qe){var Re=id.Oa[nb].l;Re&&(nb=Re);a.g(Z(Qe)+" "+nb)}}}else{if("d"==Aa){for(S in ve)if(f[1]==S){var Se=a.Ha[S];Se?(f.shift(),f.shift(),Se(f)):a.g("no dump registered for "+aa);break a}aa||(Aa=a.Ib||"db")}else a.Ib=Aa;if("dh"==Aa){var Te=aa,Ue=Wa,Ve="",We=0,ba=a.na,Da=a.O;if(Da.length){var ga=+Te||a.eb,ob=+Ue||10;isNaN(ga)?ga=ob:Ve="more ";ga>Da.length&&(a.g("note: only "+Da.length+" available"),ga=Da.length);ba-=ga;0>ba&&(null==Da[Da.length-1].G?(ga=ba+ga,ba=0):ba+=Da.length);
|
||||
var jd=[];"call"==Ue&&(ob=1E5,jd=["CALL"]);for(void 0!==Te&&a.g(ga+" instructions earlier:");0<ob&&ba!=a.na;){var Xe=Da[ba++];if(null==Xe.G)break;var Mb=Y(Xe.G),cg=ga--,Ye=rf(a,Mb,"history",cg);(!jd.length||0<=Ye.indexOf(jd[0]))&&a.g(Ye);Mb.Ub&&(ba+=Mb.Ub,ob-=Mb.Ub,ga-=Mb.Ub);ba>=Da.length&&(ba=0);a.eb=ga;We++;ob--}}We||(a.g("no "+Ve+"history available"),a.eb=void 0)}else{var qc=ye(a,aa);if(qc){var rc=0;Wa&&("l"==Wa.charAt(0)&&(Wa=Wa.substr(1)||bg),rc=xf(a,Wa)>>>0,65536<rc&&(rc=65536));for(var Xa=
|
||||
"",sc="dd"==Aa?4:"dw"==Aa?2:1,tc=sc*rc||128,dg=tc+15>>4||1;dg--&&0<tc;){var uc=0,kd=0,Nb,Ob="",ld="",aa=Z(qc.G);for(Nb=16;0<Nb&&0<tc;Nb--){var vc=a.Y(qc,1),uc=uc|vc<<(kd++<<3);kd==sc&&(Ob+=n(uc,2*sc),Ob+=1==sc?9==Nb?"-":" ":" ",uc=kd=0);ld+=32<=vc&&128>vc?String.fromCharCode(vc):".";tc--}Xa&&(Xa+="\n");Xa+=aa+" "+Ob+(0==Nb?" "+ld:"")}Xa&&a.g(Xa);a.bb=qc}}}}break;case "e":if("else"==f[0])break;var wc=1,Ze=255,$e=a.Y,af=a.qa;"ew"==f[0]&&(wc=2,Ze=65535,$e=a.Qa,af=a.Rb);var bf=wc<<1,cf=f[1];if(null==
|
||||
cf)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 xc=ye(a,cf);if(xc)for(var yc=2;yc<f.length;yc++){var Pb=De(a,f[yc]);if(void 0===Pb){a.g("unrecognized value: "+f[yc]);break}Pb&~Ze&&a.g("warning: "+n(Pb)+" exceeds "+wc+"-byte value");var eg=$e.call(a,xc);a.g("changing "+Z(xc.G)+" from 0x"+n(eg,bf)+" to 0x"+n(Pb,bf));af.call(a,xc,Pb,wc)}}break;case "f":Cf(a,f[1]);break;case "g":a:{var df=f[1],fg=b;if(void 0!==df){var md=
|
||||
ye(a,df,!0);if(!md)break a;Ee(a,md,fg);a.Ua(a.A,md,!0)}a.Za(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a:{var nd;if(a.D.va)nd="halting",a.ka();else{if(jb(a,!0))break a;nd="already halted"}c||a.g(nd)}break;case "i":if("if"==f[0]){var od;var Qb=b.substr(2),Qb=ja(Qb);De(a,Qb)?(c||a.g("true: "+Qb),od=!0):(c||a.g("false: "+Qb),od=!1);od||(d=!1);break}if("int"==f[0]){var zc;var gg=f[1];if(a.b.ta&512){var pd=De(a,gg);null==pd?zc=!1:(a.g("requesting interrupt level "+pd),fd(a.b,
|
||||
pd),zc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),zc=!1;zc||(d=!1);break}var qd=f[1];if(qd&&"?"!=qd){var rd=xf(a,qd);if(void 0!==rd){var hg=Db(a.w,rd);a.g(r(rd)+": "+("0x"+n(hg,2)))}}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 ig=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var sd=0,ef=X(),Rb=X(a.b.ia);for(a.g("stack trace for "+
|
||||
Z(Rb.G));10>sd;){for(var Ya=null,jg=256;65536>Rb.G>>>0;){ef.G=a.Pa(Rb,2);if(null==Rb.G||!jg--)break;for(var kg=a,Ac=ef,ff=null,Sb=Ac.G,gf=Sb,td=1;6>=td&&Sb;td++){if(2<td){Ac.G=Sb;var Bc=rf(kg,Ac);if(0<=Bc.indexOf("CALL")){var hf=Bc.indexOf(" ");if(Sb+(Bc.indexOf(" ",hf+1)-hf-1)/2==gf){ff=Bc;break}}}Sb--}Ac.G=gf;if(Ya=ff)break}if(!Ya||null==Ya)break;var jf=null;if("ks"==ig){var kf=Ya.match(/[0-9A-F]+$/);kf&&(jf=Ef(a,kf[0]))}Ya=ia(Ya,50)+" ;"+(jf||"stack="+Z(Rb.G));a.g(Ya);sd++}sd||a.g("no return addresses found")}break;
|
||||
case "l":if("ln"==f[0]){Ef(a,f[1],!0);break}break;case "m":a:{var Ea,Fa=null,P=f[1];"?"==P&&(P=void 0);if(void 0!==P){var Oa=0;if("all"==P)Oa=1878917119,P=null;else if("on"==P)Fa=!0,P=null;else if("off"==P)Fa=!1,P=null;else{"keys"==P&&(P="key");"kbd"==P&&(P="keyboard");for(Ea in ve)if(P==Ea){Oa=ve[Ea];Fa=!!(a.oa&Oa);break}if(!Oa){a.g("unknown message category: "+P);break a}}if(Oa)if("on"==f[2])a.oa|=Oa,Fa=!0;else if("off"==f[2]&&(a.oa&=~Oa,Fa=!1,1073741824==Oa)){for(var ud=0;ud<a.Fa.length;ud++)a.g(a.Fa[ud]);
|
||||
a.Fa=[]}}var lg=0,Pa="";for(Ea in ve)if(!P||P==Ea){var mg=!!(a.oa&ve[Ea]);if(null===Fa||Fa==mg)Pa&&(Pa+=","),++lg%10||(Pa+="\n\t"),"key"==Ea&&(Ea="keys"),Pa+=Ea}void 0===P&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Fa?Fa?"messages on: ":"messages off: ":"message categories:\n\t")+(Pa||"none"));oe(a)}break;case "o":var vd=f[1],ng=f[2];if(vd&&"?"!=vd){var wd=xf(a,vd,"port #"),xd=xf(a,ng);void 0!==wd&&void 0!==xd&&(Hb(a.w,wd,xd),a.g(r(wd)+": "+("0x"+n(xd,
|
||||
2))))}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]){Gf(a,b.substr(5));break}var lf="pr"==f[0]?1:0,og=1+lf;if(a.ba)a.g("step in progress");else{var yd=X(a.b.N);switch(a.X(yd)){case 205:a.ba=og,ze(yd,3)}a.ba?(a.Ua(a.A,yd,!0),a.Za()||(a.u&&a.u.Eb(),a.ba=0)):Hf(a,lf?"tr":"t")}break;case "r":if("reset"==b){a.u&&a.u.reset();break}Me(a,f);break;case "s":Ff(a,f);break;case "t":Hf(a,f[0],
|
||||
f[1]);break;case "u":Ne(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Df(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.23.3 ("+a.b.tc+",RELEASE"+(ob?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(qa());break;case "?":if(f[1]){Gf(a,b.substr(1));break}var Tb="commands:",zd;for(zd in qe)Tb+="\n"+ia(zd,9)+qe[zd];gd(a)||(Tb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Tb);break;default:a.g("unknown command: "+b),d=!1}}}catch(mf){a.g("debugger error: "+(mf.stack||mf.message)),d=!1}return d}
|
||||
function lc(a,b,c){b=Fe(a,b,c);for(var d in b)if(!qf(a,b[d]))return!1;return!0}Ja(function(){for(var a=B(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new le(d);eb(d,c)}});function H(a,b,c){this.id=a.id;this.key=Jf(a,b,c);this.H=a.H;Kf(this,a.xc)}function Jf(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}
|
||||
H.prototype={constructor:H,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){Kf(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 Kf(a,b){a[a.id]={};b&&I(a,"parms",b);a.b=!1}function Lf(a){var b=!0;if(ua()){var c=JSON.stringify(a[a.id]);wa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Mf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Nf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ua()&&(b=va(a.key))?(a[a.id]=b,a.b=!0):!1}function Of(a,b){return a[a.id][b]||null}function I(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function Pf(a,b,c){w.call(this,"Computer",a,Pf,67108864);this.D.sa=!1;Qf(this,b);this.ba=ic(this,"autoPower",a);this.B=0;this.ma=a.busWidth||a.buswidth;this.u=Rf;this.Y=null;this.K=this.fa=!1;this.na=ic(this,"url")||"";(Math.random()+.1).toString(36);this.A=Sf(this);if(this.b=db("CPU",this.id)){this.H=db("Debugger",this.id);this.J=[];for(b=null;b=rb(this,"Video",b);)this.J.push(b);this.w=new tb({id:this.Sb+".bus",busWidth:this.ma},this.b,this.H);var d,e=cb(this.id);if((this.F=db("Panel",this.id))&&
|
||||
this.F.Ba)for(b=0;b<e.length;b++)d=e[b],d.ga=this.F.ga,d.g=this.F.g,d.Ba=this.F.Ba;this.g("PC8080 v1.23.3\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.Na&&d.Na(this,this.w,this.b,this.H);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.O=d:this.u=parseInt(d,10));var f;if(a=ic(this,"state")||(f=!0,a.state))b=this.da=a,f||(this.K=!0,this.u=Rf),this.u&&(this.Z=new H(this,"1.23.3"),Nf(this.Z)?
|
||||
b=null:delete this.Z);!b&&this.u&&(b=Tf(this))&&(this.K=!0);if(b){var h=this;oa(b,null,!0,function(a,b,c){c?(h.O=null,h.K=!1,h.ga("Unable to load machine state from server (error "+c+(b?": "+ja(b):"")+")")):(h.Y=b,h.fa=!0);E(h)})}else E(this);this.L.power||(this.ba=!0);!c&&this.ba&&Uf(this,this.Cb)}else t("Unable to find CPU component")}$a(Pf);var Rf=0;function Qf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.M=b}
|
||||
ye(a,df,!0);if(!md)break a;Ee(a,md,fg);a.Va(a.A,md,!0)}a.$a(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a:{var nd;if(a.C.va)nd="halting",a.ka();else{if(jb(a,!0))break a;nd="already halted"}c||a.g(nd)}break;case "i":if("if"==f[0]){var od;var Qb=b.substr(2),Qb=ka(Qb);De(a,Qb)?(c||a.g("true: "+Qb),od=!0):(c||a.g("false: "+Qb),od=!1);od||(d=!1);break}if("int"==f[0]){var zc;var gg=f[1];if(a.b.ta&512){var pd=De(a,gg);null==pd?zc=!1:(a.g("requesting interrupt level "+pd),fd(a.b,
|
||||
pd),zc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),zc=!1;zc||(d=!1);break}var qd=f[1];if(qd&&"?"!=qd){var rd=xf(a,qd);if(void 0!==rd){var hg=Db(a.B,rd);a.g(t(rd)+": "+("0x"+n(hg,2)))}}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 ig=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var sd=0,ef=Y(),Rb=Y(a.b.ia);for(a.g("stack trace for "+
|
||||
Z(Rb.G));10>sd;){for(var Ya=null,jg=256;65536>Rb.G>>>0;){ef.G=a.Qa(Rb,2);if(null==Rb.G||!jg--)break;for(var kg=a,Ac=ef,ff=null,Sb=Ac.G,gf=Sb,td=1;6>=td&&Sb;td++){if(2<td){Ac.G=Sb;var Bc=rf(kg,Ac);if(0<=Bc.indexOf("CALL")){var hf=Bc.indexOf(" ");if(Sb+(Bc.indexOf(" ",hf+1)-hf-1)/2==gf){ff=Bc;break}}}Sb--}Ac.G=gf;if(Ya=ff)break}if(!Ya||null==Ya)break;var jf=null;if("ks"==ig){var kf=Ya.match(/[0-9A-F]+$/);kf&&(jf=Ef(a,kf[0]))}Ya=ja(Ya,50)+" ;"+(jf||"stack="+Z(Rb.G));a.g(Ya);sd++}sd||a.g("no return addresses found")}break;
|
||||
case "l":if("ln"==f[0]){Ef(a,f[1],!0);break}break;case "m":a:{var Ea,Fa=null,P=f[1];"?"==P&&(P=void 0);if(void 0!==P){var Pa=0;if("all"==P)Pa=1878917119,P=null;else if("on"==P)Fa=!0,P=null;else if("off"==P)Fa=!1,P=null;else{"keys"==P&&(P="key");"kbd"==P&&(P="keyboard");for(Ea in ve)if(P==Ea){Pa=ve[Ea];Fa=!!(a.oa&Pa);break}if(!Pa){a.g("unknown message category: "+P);break a}}if(Pa)if("on"==f[2])a.oa|=Pa,Fa=!0;else if("off"==f[2]&&(a.oa&=~Pa,Fa=!1,1073741824==Pa)){for(var ud=0;ud<a.Fa.length;ud++)a.g(a.Fa[ud]);
|
||||
a.Fa=[]}}var lg=0,Qa="";for(Ea in ve)if(!P||P==Ea){var mg=!!(a.oa&ve[Ea]);if(null===Fa||Fa==mg)Qa&&(Qa+=","),++lg%10||(Qa+="\n\t"),"key"==Ea&&(Ea="keys"),Qa+=Ea}void 0===P&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Fa?Fa?"messages on: ":"messages off: ":"message categories:\n\t")+(Qa||"none"));oe(a)}break;case "o":var vd=f[1],ng=f[2];if(vd&&"?"!=vd){var wd=xf(a,vd,"port #"),xd=xf(a,ng);void 0!==wd&&void 0!==xd&&(Hb(a.B,wd,xd),a.g(t(wd)+": "+("0x"+n(xd,
|
||||
2))))}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]){Gf(a,b.substr(5));break}var lf="pr"==f[0]?1:0,og=1+lf;if(a.ba)a.g("step in progress");else{var yd=Y(a.b.N);switch(a.Y(yd)){case 205:a.ba=og,ze(yd,3)}a.ba?(a.Va(a.A,yd,!0),a.$a()||(a.w&&a.w.Eb(),a.ba=0)):Hf(a,lf?"tr":"t")}break;case "r":if("reset"==b){a.w&&a.w.reset();break}Me(a,f);break;case "s":Ff(a,f);break;case "t":Hf(a,f[0],
|
||||
f[1]);break;case "u":Ne(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Df(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.23.3 ("+a.b.vc+",RELEASE"+(mb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(ra());break;case "?":if(f[1]){Gf(a,b.substr(1));break}var Tb="commands:",zd;for(zd in qe)Tb+="\n"+ja(zd,9)+qe[zd];gd(a)||(Tb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Tb);break;default:a.g("unknown command: "+b),d=!1}}}catch(mf){a.g("debugger error: "+(mf.stack||mf.message)),d=!1}return d}
|
||||
function lc(a,b,c){b=Fe(a,b,c);for(var d in b)if(!qf(a,b[d]))return!1;return!0}Ja(function(){for(var a=A(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new le(d);eb(d,c)}});function G(a,b,c){this.id=a.id;this.key=Jf(a,b,c);this.I=a.I;Kf(this,a.zc)}function Jf(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){Kf(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 Kf(a,b){a[a.id]={};b&&H(a,"parms",b);a.b=!1}function Lf(a){var b=!0;if(ua()){var c=JSON.stringify(a[a.id]);wa(a.key,c)||(u("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Mf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){u(c.message||c),b=!1}return b}function Nf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ua()&&(b=va(a.key))?(a[a.id]=b,a.b=!0):!1}function Of(a,b){return a[a.id][b]||null}function H(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function Pf(a,b,c){v.call(this,"Computer",a,Pf,67108864);this.C.sa=!1;Qf(this,b);this.ba=ic(this,"autoPower",a);this.D=0;this.la=a.busWidth||a.buswidth;this.w=Rf;this.P=null;this.K=this.fa=!1;this.na=ic(this,"url")||"";(Math.random()+.1).toString(36);this.A=Sf(this);if(this.b=db("CPU",this.id)){this.I=db("Debugger",this.id);this.J=[];for(b=null;b=rb(this,"Video",b);)this.J.push(b);this.B=new tb({id:this.Sb+".bus",busWidth:this.la},this.b,this.I);var d,e=cb(this.id);if((this.F=db("Panel",this.id))&&
|
||||
this.F.Ba)for(b=0;b<e.length;b++)d=e[b],d.ga=this.F.ga,d.g=this.F.g,d.Ba=this.F.Ba;this.g("PC8080 v1.23.3\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.Na&&d.Na(this,this.B,this.b,this.I);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.O=d:this.w=parseInt(d,10));var f;if(a=ic(this,"state")||(f=!0,a.state))b=this.da=a,f||(this.K=!0,this.w=Rf),this.w&&(this.Z=new G(this,"1.23.3"),Nf(this.Z)?
|
||||
b=null:delete this.Z);!b&&this.w&&(b=Tf(this))&&(this.K=!0);if(b){var h=this;pa(b,null,!0,function(a,b,c){c?(h.O=null,h.K=!1,h.ga("Unable to load machine state from server (error "+c+(b?": "+ka(b):"")+")")):(h.P=b,h.fa=!0);D(h)})}else D(this);this.L.power||(this.ba=!0);!c&&this.ba&&Uf(this,this.Cb)}else u("Unable to find CPU component")}$a(Pf);var Rf=0;function Qf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){u(d.message+" ("+c+")")}}a.M=b}
|
||||
function ic(a,b,c){var d=b.toLowerCase(),d=Sa[b]||Sa[d];void 0===d&&a.M&&(d=a.M[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Uf(a,b,c){for(var d=cb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!kb(f)){kb(f,function(){Uf(a,b,c)});return}}b.call(a,c)}
|
||||
function Vf(a,b){var c=new H(a,"1.23.3","validate");if(Nf(c)&&Mf(c)){var d=Of(c,"timestamp"),e=b?Of(b,"timestamp"):"unknown";d!=e&&(a.ga("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=Pf.prototype;
|
||||
m.Cb=function(a){void 0===a&&(a=this.u||(this.Y?1:Rf));if(!this.B){this.B++;var b=!1,c=!1;this.ea=!1;var d=this.Z||new H(this,"1.23.3");if(-1==a)b=!0;else if(a>Rf){if(Nf(d,this.Y)){this.I=new H(this,"1.23.3","failsafe");Nf(this.I)&&(Wf(this,d),a=2,Kf(this.I));I(this.I,"timestamp",ma());Lf(this.I);var e=this.u&&!this.K;if(1==a||ra("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Mf(d)){var f=Of(d,"code"),h=Of(d,"data");f&&("ok"==f?Nf(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.ga("Error: "+h),"unable to verify user"==h&&(wa("user",""),this.A=null)):this.g(f+": "+h),Kf(d),Nf(d)?(c=Mf(d),e=!0):c=!1))}e&&Vf(this,c?d:null)}else 2==a&&d.clear()}else Vf(this);delete this.Y;delete this.Z}e=cb(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=Xf(this,h,d,b,c));b=[d,a,c];-1!=a?Uf(this,this.oc,b):this.oc(b)}};
|
||||
function Xf(a,b,c,d,e){if(!b.D.sa){b.D.sa=!0;if(b.za){var f=null;e&&((f=Of(c,b.id))||(f=Of(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.za(f,d)&&f&&(t("Unable to restore state for "+b.type),a.da&&!a.fa?(c.clear(),a.u=Rf,window&&window.location.reload()):a.ea=!0,b.za(null),e=!1)}if(!d&&b.dc)for(a=b.dc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
m.oc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ra=!0;this.D.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Xf(this,this.b,b,c,a),nc(this.b));this.ea&&(Wf(this,b),b.clear());!c&&this.I&&(this.I.clear(),delete this.I);this.B=0};
|
||||
function Wf(a,b){if(ra("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.A||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.na;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function If(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new H(a,"1.23.3"),h=new H(a,"1.23.3","validate"),g=ma();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.23.3");I(f,"url",window?window.location.href:null);I(f,"browser",qa());a.b&&a.b.Da&&(c&&a.b.ka(),d=a.b.Da(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=cb(a.id),k=0;k<g.length;k++){var l=g[k];l.D.sa&&(l.Da&&(d=l.Da(b,c),"object"===typeof d&&I(f,l.id,d)),c&&(l.D.sa=!1,!1===d&&(e=null)))}e&&
|
||||
(c?(g=d=!1,b?(a.A&&Yf(a,a.A,f.toString()),Lf(h)&&Lf(f)||(e=null,d=g=!0)):a.u&&(d=!0,g=3==a.u),d&&f.clear(g)):e=f.toString());c&&(a.D.sa=!1,b=a.L.power)&&(b.textContent="Power");a.B=0;return e}m.reset=function(){this.w&&this.w.reset&&(gb(this,"Resetting "+this.w.type),this.w.reset());for(var a=cb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(gb(this,"Resetting "+c.type),c.reset())}};
|
||||
function Vf(a,b){var c=new G(a,"1.23.3","validate");if(Nf(c)&&Mf(c)){var d=Of(c,"timestamp"),e=b?Of(b,"timestamp"):"unknown";d!=e&&(a.ga("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=Pf.prototype;
|
||||
m.Cb=function(a){void 0===a&&(a=this.w||(this.P?1:Rf));if(!this.D){this.D++;var b=!1,c=!1;this.ea=!1;var d=this.Z||new G(this,"1.23.3");if(-1==a)b=!0;else if(a>Rf){if(Nf(d,this.P)){this.H=new G(this,"1.23.3","failsafe");Nf(this.H)&&(Wf(this,d),a=2,Kf(this.H));H(this.H,"timestamp",na());Lf(this.H);var e=this.w&&!this.K;if(1==a||sa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Mf(d)){var f=Of(d,"code"),h=Of(d,"data");f&&("ok"==f?Nf(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.ga("Error: "+h),"unable to verify user"==h&&(wa("user",""),this.A=null)):this.g(f+": "+h),Kf(d),Nf(d)?(c=Mf(d),e=!0):c=!1))}e&&Vf(this,c?d:null)}else 2==a&&d.clear()}else Vf(this);delete this.P;delete this.Z}e=cb(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=Xf(this,h,d,b,c));b=[d,a,c];-1!=a?Uf(this,this.qc,b):this.qc(b)}};
|
||||
function Xf(a,b,c,d,e){if(!b.C.sa){b.C.sa=!0;if(b.Aa){var f=null;e&&((f=Of(c,b.id))||(f=Of(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Aa(f,d)&&f&&(u("Unable to restore state for "+b.type),a.da&&!a.fa?(c.clear(),a.w=Rf,window&&window.location.reload()):a.ea=!0,b.Aa(null),e=!1)}if(!d&&b.fc)for(a=b.fc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
m.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ra=!0;this.C.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Xf(this,this.b,b,c,a),nc(this.b));this.ea&&(Wf(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.D=0};
|
||||
function Wf(a,b){if(sa("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.A||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.na;e.user=c;e.type="bug";e.data=d;pa("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function If(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new G(a,"1.23.3"),h=new G(a,"1.23.3","validate"),g=na();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.23.3");H(f,"url",window?window.location.href:null);H(f,"browser",ra());a.b&&a.b.Da&&(c&&a.b.ka(),d=a.b.Da(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.C.sa=!1,!1===d&&(e=null)));for(var g=cb(a.id),k=0;k<g.length;k++){var l=g[k];l.C.sa&&(l.Da&&(d=l.Da(b,c),"object"===typeof d&&H(f,l.id,d)),c&&(l.C.sa=!1,!1===d&&(e=null)))}e&&
|
||||
(c?(g=d=!1,b?(a.A&&Yf(a,a.A,f.toString()),Lf(h)&&Lf(f)||(e=null,d=g=!0)):a.w&&(d=!0,g=3==a.w),d&&f.clear(g)):e=f.toString());c&&(a.C.sa=!1,b=a.L.power)&&(b.textContent="Power");a.D=0;return e}m.reset=function(){this.B&&this.B.reset&&(gb(this,"Resetting "+this.B.type),this.B.reset());for(var a=cb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(gb(this,"Resetting "+c.type),c.reset())}};
|
||||
m.start=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
m.ja=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.B||(d.D.sa?If(d,!1,!0):Uf(d,d.Cb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.D.sa&&!d.B)if(d.u&&!d.O){var a=ra("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");If(d,a,!0);!a&&d.da?window&&window.location.reload():d.Cb(Rf)}else d.reset(),d.b&&nc(d.b)},!0;case "save":if(ea(pa(),"pcjs.org")){c.parentNode.removeChild(c);
|
||||
break}this.L[b]=c;c.onclick=function(){var a=Sf(d,!0);if(a){var b=!!(d.u&&!d.O||d.da),c=If(d,b);b?Yf(d,a,c):d.ga("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
m.ja=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.D||(d.C.sa?If(d,!1,!0):Uf(d,d.Cb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.C.sa&&!d.D)if(d.w&&!d.O){var a=sa("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");If(d,a,!0);!a&&d.da?window&&window.location.reload():d.Cb(Rf)}else d.reset(),d.b&&nc(d.b)},!0;case "save":if(fa(qa(),"pcjs.org")){c.parentNode.removeChild(c);
|
||||
break}this.L[b]=c;c.onclick=function(){var a=Sf(d,!0);if(a){var b=!!(d.w&&!d.O||d.da),c=If(d,b);b?Yf(d,a,c):d.ga("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Sf(a,b){var c=a.A;c||(c=va("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=Zf(a,c))||a.ga("The user ID is invalid."))):b&&a.ga("Browser local storage is not available"));return c}
|
||||
function Zf(a,b){a.A=null;var c=oa(pa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(wa("user",c.data),a.A=c.data)}catch(e){t(e.message+" ("+d+")")}return a.A}function Tf(a){var b=null;a.A&&(b=pa()+"/api/v1/user?req=load&user="+a.A+"&state="+Jf(a,"1.23.3"));return b}
|
||||
function Yf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Jf(a,"1.23.3");d.data=c;b=oa(pa()+"/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.ga("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.ga(c),wa("user",""),a.A=null)}}
|
||||
function rb(a,b,c){a=cb(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}m.Eb=function(a){if(this.J.length){var b=0,c=0;a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.J[0];d.Ga&&d.Ga.focus();a&&window&&window.scrollTo(b,c)}};m.Ea=function(a){this.b&&this.b.Ea(a);this.F&&this.F.Ea(a)};
|
||||
function Fc(a,b){for(var c=0;c<a.J.length;c++){var d=a.J[c],e=!0;if(0<=b){d.Tb&&(120==d.Tb?b&1?(fd(d.b,2),e=!1):fd(d.b,1):fd(d.b,4));var f;if(f=e&&d.Fa){f=d.w;for(var h=d.Sa,g=!0,k=d.Aa>>>f.la;0<h&&k<f.V.length;)f.V[k].La&&(f.V[k].La=g=!1,f.V[k].qc=!0),h-=f.Ca,k++;f=g}f&&(e=!1)}if(e)if(1<d.pa)switch(d.da){case 2:fe(d)}else{var g=d.Aa,k=g+d.Sa,l=0,p=0,q=0,e=d.J,y=0;f=d.Z;var x=h=0,v=d.Ka,z=(1<<v)-1;d.hd&&(v=-v,x=16+v);for(;g<k;){var u=zb(d.w,g);if(d.Fa&&u===d.ma[l])p+=d.lc;else{d.ma[l]=u;var K=x;K&&
|
||||
(u=u>>8|(u&255)<<8);p<e&&(e=p);for(var C=d.lc;C--;){var Y=u>>K&z;ee(d,d.jc,p++,q,Y);K+=v}p>y&&(y=p);q<f&&(f=q);q>=h&&(h=q+1)}g+=2;l++;if(p>=d.J&&(p=0,q++,q>d.Z))break}d.Fa=!0;e<d.J&&(g=y-e,h-=f,d.B&&(k=e,l=g,e=f,g=h,f=d.J-(k+l),h=l),d.cb.putImageData(d.jc,0,0,e,f,g,h),d.F.drawImage(d.K,0,0,d.K.width,d.K.height,0,0,d.Y,d.O))}}}
|
||||
Ja(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 Pf(h,d,!0);eb(h,f);h.ba&&Uf(h,h.Cb)}});Aa.show.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=db("Computer",c.id))&&c.ra&&!c.D.sa&&c.Cb(-1)}});
|
||||
Aa.exit.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=db("Computer",c.id))&&c.D.sa&&If(c,!(!c.u||c.O),!0)}});var $f=0;function ag(a,b,c,d,e,f){e("Loading "+a+"...");oa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):pg(g,a,b,c,d,e,f)})}
|
||||
function Zf(a,b){a.A=null;var c=pa(qa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(wa("user",c.data),a.A=c.data)}catch(e){u(e.message+" ("+d+")")}return a.A}function Tf(a){var b=null;a.A&&(b=qa()+"/api/v1/user?req=load&user="+a.A+"&state="+Jf(a,"1.23.3"));return b}
|
||||
function Yf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Jf(a,"1.23.3");d.data=c;b=pa(qa()+"/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.ga("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.ga(c),wa("user",""),a.A=null)}}
|
||||
function rb(a,b,c){a=cb(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}m.Eb=function(a){if(this.J.length){var b=0,c=0;a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.J[0];d.Fa&&d.Fa.focus();a&&window&&window.scrollTo(b,c)}};m.Ea=function(a){this.b&&this.b.Ea(a);this.F&&this.F.Ea(a)};
|
||||
function Fc(a,b){for(var c=0;c<a.J.length;c++){var d=a.J[c],e=!0;if(0<=b){d.Tb&&(120==d.Tb?b&1?(fd(d.b,2),e=!1):fd(d.b,1):fd(d.b,4));var f;if(f=e&&d.xa){f=d.B;for(var h=d.Ta,g=!0,k=d.wa>>>f.ma;0<h&&k<f.W.length;)f.W[k].La&&(f.W[k].La=g=!1,f.W[k].sc=!0),h-=f.Ca,k++;f=g}f&&(e=!1)}if(e)if(1<d.pa)switch(d.ea){case 2:fe(d)}else{var g=d.wa,k=g+d.Ta,l=0,p=0,q=0,e=d.K,r=0;f=d.da;var z=h=0,w=d.Sa,J=(1<<w)-1;d.kd&&(w=-w,z=16+w);for(;g<k;){var x=zb(d.B,g);if(d.xa&&x===d.J[l])p+=d.nc;else{d.J[l]=x;var K=z;K&&
|
||||
(x=x>>8|(x&255)<<8);p<e&&(e=p);for(var B=d.nc;B--;){var S=x>>K&J;ee(d,d.lc,p++,q,S);K+=w}p>r&&(r=p);q<f&&(f=q);q>=h&&(h=q+1)}g+=2;l++;if(p>=d.K&&(p=0,q++,q>d.da))break}d.xa=!0;e<d.K&&(g=r-e,h-=f,d.D&&(k=e,l=g,e=f,g=h,f=d.K-(k+l),h=l),d.cb.putImageData(d.lc,0,0,e,f,g,h),d.F.drawImage(d.O,0,0,d.O.width,d.O.height,0,0,d.ba,d.Z))}}}
|
||||
Ja(function(){for(var a=A(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=A(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new Pf(h,d,!0);eb(h,f);h.ba&&Uf(h,h.Cb)}});Ba.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=db("Computer",c.id))&&c.ra&&!c.C.sa&&c.Cb(-1)}});
|
||||
Ba.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=db("Computer",c.id))&&c.C.sa&&If(c,!(!c.w||c.O),!0)}});var $f=0;function ag(a,b,c,d,e,f){e("Loading "+a+"...");pa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):pg(g,a,b,c,d,e,f)})}
|
||||
function pg(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){bb(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="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?qg(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
|
||||
function qg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(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],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[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]*/,
|
||||
function qg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");pa(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],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[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);qg(a,b,c)}})}else c(a,null)}
|
||||
function rg(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=ha(a))}function f(a){e("Error: "+a);k&&(--$f||Ma(!0));k=!1}var h,g,k=!0;$f++;ab[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c||
|
||||
function rg(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=ia(a))}function f(a){e("Error: "+a);k&&(--$f||Ma(!0));k=!1}var h,g,k=!0;$f++;ab[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c||
|
||||
(c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?ag(c,null,null,!1,e,function(d,k){if(k)if(bb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--$f||Ma(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--$f||Ma(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?ag(b,a,d,!0,e,l):pg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(y){f(y.message)}return k}window.embedPC8080=function(a,b,c,d){Ma(!1);return rg(a,b,c,d)};window.enableEvents=Ma;window.sendEvent=Na;
|
||||
function sg(a,b,c,d){if(!c&&b){d.push(b);a=ab[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){tg(b,d)}):tg(null,d)}else t("Error ("+c+") requesting "+a)}
|
||||
function tg(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=ab[f],k={},l;for(l in g){var p=g[l],q=da(l);if("xml"==q){for(q=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var y=d[2];y&&(g[y]||(p=p.replace(d[0],"")))}d=l=ca(l)}else"xsl"==q&&(e=l=ca(l));k[l]=p}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?ag(b,a,d,!0,e,l):pg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC8080=function(a,b,c,d){Ma(!1);return rg(a,b,c,d)};window.enableEvents=Ma;window.sendEvent=Na;
|
||||
function sg(a,b,c,d){if(!c&&b){d.push(b);a=ab[d[0]];b=null;for(var e in a)if(fa(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?pa(b,null,!0,function(a,b){tg(b,d)}):tg(null,d)}else u("Error ("+c+") requesting "+a)}
|
||||
function tg(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=ab[f],k={},l;for(l in g){var p=g[l],q=ea(l);if("xml"==q){for(q=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var r=d[2];r&&(g[r]||(p=p.replace(d[0],"")))}d=l=da(l)}else"xsl"==q&&(e=l=da(l));k[l]=p}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
"©"),l=h,g=null,k="data:application/javascript,",k=xa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n',
|
||||
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")}
|
||||
window.savePC=function(a,b,c){var d=db("Computer",a),e=db("Debugger",a);if(d){var f=If(d,!0),h=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcx86/1.23.3/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,xc:h}))return!0;oa(b,null,!0,function(c,d,e){sg(c,d,e,[a,ca(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})();
|
||||
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",u(c)):u("Missing XML/XSL resources")}
|
||||
window.savePC=function(a,b,c){var d=db("Computer",a),e=db("Debugger",a);if(d){var f=If(d,!0),h=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcx86/1.23.3/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,zc:h}))return!0;pa(b,null,!0,function(c,d,e){sg(c,d,e,[a,da(b,!0),h,f])});return!0}u("Unable to identify machine '"+a+"'");return!1};})();
|
||||
|
|
|
|||
|
|
@ -1,161 +1,163 @@
|
|||
(function(){var l;function aa(a){var b=16,c;if(a){b||(b=16);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 ba(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function da(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ea={"&":"&","<":"<",">":">",'"':""","'":"'"};function fa(a){return a.replace(/[&<>"']/g,function(a){return ea[a]})}var ga=Date.now||function(){return+new Date};function ha(){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 r(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 ia(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function t(a){window&&window.alert(a)}function ja(a){var b=!1;window&&(b=window.confirm(a));return b}var ka=null;function la(){if(null==ka){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}ka=a}return ka}function ma(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function oa(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 pa={init:[],show:[],exit:[]},qa=!1,ra=!0;function sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ta(a){pa.init.push(a)}
|
||||
function ua(a){if(ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){va("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function wa(a){!ra&&a?(ra=!0,qa&&xa("init")):ra=a}function xa(a){pa[a]&&ua(pa[a])}sa("onload",function(){qa=!0;ua(pa.init)});sa("onpageshow",function(){ua(pa.show)});sa(oa("Opera")||oa("iOS")?"onunload":"onbeforeunload",function(){ua(pa.exit)});
|
||||
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.qb=b.comment;this.Lb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.gb=this.id.substr(0,b),this.fb=this.id.substr(b+1)):this.fb=this.id;this[a]=c;this.j={va:!1,Fa:!1,jb:!1,S:!1,na:!1};this.Ta=null;this.j.na=!1;this.w={};this.K=null;w.push(this)}var ya=void 0,za={};
|
||||
if(window){ya||(ya=window.location.search.substr(1));for(var Aa,Ba=/\+/g,Ca=/([^&=]+)=?([^&]*)/g;Aa=Ca.exec(ya);)za[decodeURIComponent(Aa[1].replace(Ba," "))]=decodeURIComponent(Aa[2].replace(Ba," "))}function Da(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 x(a,b){b||(b=v);a.prototype=Da(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var w=[],Ea={};function Fa(a,b,c){Ea[a]&&b&&(Ea[a][b]=c)}function va(a,b,c){b||t((c?c+": ":"")+a)}function Ga(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Ha(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<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
|
||||
function Ia(a,b){for(var c=z(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=y(h))&&g.binding&&a.R(g.type,g.binding,h,g.value),m=k.length}}}}
|
||||
function z(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}
|
||||
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.la=this.w[b]=c,c.value="",this.Y=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.J=function(a){this.Y(a,this.fb)}),!0;default:return!1}},log:function(){},Y:function(){},status:function(a){this.Y(this.fb+": "+a)},J:function(a,b,c){va(a,b,c||this.type)},X:function(){return this.j.S=!0},ba:function(a,b){b&&(this.j.S=!1);return!0}};function Ja(a,b){if(a.j.jb)return a.j.Fa&&(a.j.Fa=!1),a.j.jb=!1;if(a.j.na)return a.Y(a.toString()+" error"),!1;a.j.Fa=b;return a.j.Fa}function A(a){if(!a.j.na&&(a.j.va=!0,a.j.va)){var b=a.Ta;a.Ta=null;b&&b()}}
|
||||
function Ka(a,b){b&&(a.j.va?b():a.Ta=b);return a.j.va}
|
||||
var La="undefined"!==typeof ArrayBuffer,Ma=[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 Na(a){v.call(this,"Panel",a,Na)}x(Na);l=Na.prototype;l.R=function(a,b,c,d){return this.A&&this.A.R(a,b,c,d)||this.a&&this.a.R(a,b,c,d)||this.B&&this.B.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};l.ia=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.K=d;this.B=Oa(a,"Keyboard")};l.X=function(a,b){b||Pa();return!0};l.ba=function(){return!0};l.qa=function(){};
|
||||
function Pa(){for(var a=!1,b=z(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<w.length;h++)if(w[h].id===f){f=w[h];break a}f=null}f||(a=!0,f=new Na(e));Ia(f,d);a&&A(f)}}ta(Pa);
|
||||
function Qa(a,b,c){v.call(this,"Bus",a,Qa);this.a=b;this.K=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.h=this.u-1|0;this.c=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.m=1<<this.c;this.v=this.m>>2;this.f=this.m-1;this.l=this.u/this.m|0;this.A=this.l-1;this.o=[];this.s=[];this.B=[];this.F=[];a=new B;Ra(a,this.K);this.b=Array(this.l);for(b=0;b<this.l;b++)this.b[b]=a;A(this)}x(Qa);Qa.prototype.reset=function(){};Qa.prototype.X=function(a,b){b||this.reset();return!0};
|
||||
function Sa(a,b,c,d){for(var e=b,f=c,h=e>>>a.c;0<f&&h<a.b.length;){var g=a.b[h],k=h*a.m,m=a.m-(e-k);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ea)return g.ab+=g.Ea-e,g.Ea=e,!0;if(e>=g.Ea+g.ab){m=g.size-(e-k);m>f&&(m=f);g.ab=e-g.Ea+m;e=k+a.m;f-=m;h++;continue}}return Ta(1,e,f)}e=new B(e,m,a.m,d);Ra(e,a.K,g);a.b[h++]=e;e=k+a.m;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Ua[d]+" at "+("0x"+n(b,4))),!0):Ta(2,b,c)}
|
||||
Qa.prototype.I=function(a){return this.b[(a&this.h)>>>this.c].Na(a&this.f,a)};function Va(a,b){return a.b[(b&a.h)>>>a.c].$a(b&a.f,b)}function Wa(a,b){var c=b&a.f,d=(b&a.h)>>>a.c;return c!=a.f?a.b[d].Tc(c,b):a.b[d++].Na(c,b)|a.b[d&a.A].Na(0,b+1)<<8}Qa.prototype.T=function(a,b){this.b[(a&this.h)>>>this.c].Oa(a&this.f,b&255,a)};function Xa(a,b,c){a.b[(b&a.h)>>>a.c].Pb(b&a.f,c&255,b)}
|
||||
function Ya(a,b,c){var d=b&a.f,e=(b&a.h)>>>a.c;d!=a.f?a.b[e].Uc(d,c&65535,b):(a.b[e++].Oa(d,c&255,b),a.b[e&a.A].Oa(0,c>>8&255,b+1))}function Za(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.o[k]?t("Input port 0x"+n(k,4)+" already registered"):f.o[k]=[g,!1]}}
|
||||
function $a(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.s[k]?t("Output port 0x"+n(k,4)+" already registered"):f.s[k]=[g,!1]}}function Ta(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var ab;if(La){var bb=new ArrayBuffer(2);(new DataView(bb)).setUint16(0,256,!0);ab=256===(new Uint16Array(bb))[0]}else ab=!1;var cb=ab;
|
||||
function B(a,b,c,d){this.id=db+=2;this.a=null;this.Ea=a;this.ab=b;this.size=c||0;this.type=d||eb;this.w=d==fb;Ra(this);this.ea=this.Eb=!1;if(c)if(La)this.c=new ArrayBuffer(c),this.m=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.i=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),gb(this,cb?hb:ib);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;gb(this,jb)}else gb(this)}var eb=0,fb=2,Ua=["NONE","RAM","ROM","VID","H/W"],db=0;
|
||||
B.prototype={constructor:B,parent:null,save:function(){var a,b;if(La)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.m.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(La)for(b=0;b<a.length;b++)this.m.setInt32(b<<2,a[b],!0);else this.a=a;return this.ea=!0}return!1},l:function(){return 255},s:function(){},o:function(a,b){return this.Na(a++,b++)|this.Na(a,b)<<8},A:function(a,b,c){this.Oa(a++,b&255,c++);this.Oa(a,b>>8,c)},F:function(a){return this.a[a>>
|
||||
2]>>>((a&3)<<3)&255},N: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},ga:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.ea=!0},sa: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.ea=!0},v:function(a,b){return this.$a(a,b)},H:function(a,b){return this.Mb(a,b)},U:function(a,b,c){this.w||this.Pb(a,b,c)},ca:function(a,
|
||||
b,c){this.w||this.ja(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.m.getUint16(a,!0)},L:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},O:function(a,b){this.b[a]=b;this.ea=!0},Z:function(a,b){this.b[a]=b;this.ea=!0},ha:function(a,b){this.m.setUint16(a,b,!0);this.ea=!0},ka:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.ea=!0}};
|
||||
function Ra(a,b,c){a.K=b;a.f=a.h=0;c&&((a.f=c.f)&&kb(a,lb,!1),(a.h=c.h)&&mb(a,lb,!1))}function mb(a,b,c){c&&a.h||(a.Oa=!a.w&&b[2]||a.s,a.Uc=!a.w&&b[3]||a.A);if(c||void 0===c)a.Pb=b[2]||a.s,a.ja=b[3]||a.A}function kb(a,b,c){c&&a.f||(a.Na=b[0]||a.l,a.Tc=b[1]||a.o);if(c||void 0===c)a.$a=b[0]||a.l,a.Mb=b[1]||a.o}function gb(a,b){b||(b=nb);kb(a,b,void 0);mb(a,b,void 0)}var nb=[],jb=[B.prototype.F,B.prototype.N,B.prototype.ga,B.prototype.sa],lb=[B.prototype.v,B.prototype.H,B.prototype.U,B.prototype.ca];
|
||||
if(La)var ib=[B.prototype.u,B.prototype.G,B.prototype.O,B.prototype.ha],hb=[B.prototype.B,B.prototype.L,B.prototype.Z,B.prototype.ka];
|
||||
function ob(a,b){v.call(this,"CPU",a,ob);var c=a.cycles||b,d=a.multiplier||1;this.c={};this.c.Aa=c;this.c.Xa=0;this.c.za=d;this.c.kb=Math.round(this.c.Aa/1E4)/100;this.c.wa=this.c.kb*this.c.za;this.j.fa=!1;this.j.Gb=!1;this.j.Db=a.autoStart;this.j.Fb=!1;this.j.Ra=!1;this.c.Va=this.c.ya=0;this.c.Wa=a.csStart;this.c.Ga=a.csInterval;this.c.Ha=a.csStop;this.ka=this.ob.bind(this);A(this)}x(ob);var pb=["power","reset"];l=ob.prototype;
|
||||
l.ia=function(a,b,c,d){this.A=a;this.m=b;this.K=d;for(b=0;b<pb.length;b++)(c=this.w[pb[b]])&&this.A.R(null,pb[b],c);this.Z=(b=Oa(a,"Video"))&&Math.max(b.vc,b.ib)||60;this.G=Oa(a,"ChipSet");a=qb(a,"autoStart");null!=a&&(this.j.Db="true"==a?!0:"false"==a?!1:!!a);A(this)};l.reset=function(){this.c.Xa=0};l.save=function(){return null};l.restore=function(){return!1};
|
||||
l.X=function(a,b){if(!b){if(a&&this.restore){rb(this);if(!this.restore(a))return!1;sb(this)}else this.reset();this.Y("No debugger detected")}tb(this);return!0};l.ba=function(a){return a?this.save():!0};function ub(a){(a.j.Db||void 0===a.w.run)&&a.ob(!0)}l.Hb=function(){return 0};function sb(a){void 0===a.c.Wa&&(a.c.Wa=0);void 0===a.c.Ga&&(a.c.Ga=-1);void 0===a.c.Ha&&(a.c.Ha=-1);a.j.Ra=0<=a.c.Wa&&0<a.c.Ga;a.j.Ra&&(a.c.Va=0,a.c.ya=a.c.Wa-a.O)}
|
||||
l.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.S)a=!0;else{var b=null,c,g=Ga(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.j.va);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.j.S);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.va?"powered yet":"ready yet"+(b.Ta?" (waiting for notification)":""))+".");a=!1}a&&(d.j.fa?vb(d,!0):d.ob(!0))};a=!0;
|
||||
break;case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){wb(d,d.c.za<<1,!0)},c.textContent=this.c.wa.toFixed(2)+"Mhz",a=!0}return a};function xb(a,b,c){a.O+=b;c&&(a.N=a.a=0)}
|
||||
function yb(a,b){var c=30;c<a.Z&&(c=a.Z);2>c&&(c=2);var d=1;b&&1<a.c.za&&a.c.oa&&(d=a.c.oa/a.c.kb);a.c.Ib=Math.round(1E3/30);a.c.Fc=Math.floor(a.c.Aa/c*d);a.c.mb=Math.floor(a.c.Aa/30*d);a.c.Kb=Math.floor(a.c.Aa/a.Z*d);a.c.Jb=Math.floor(a.c.Aa/2*d);b||(a.c.Ka=a.c.mb,a.c.Ja=a.c.Kb,a.c.Ia=a.c.Jb);a.c.nb=0}function zb(a){return a.O+a.L+a.N-a.a}function rb(a){a.c.oa=0;a.O=a.L=a.N=a.a=0;sb(a);wb(a,1)}
|
||||
function wb(a,b,c){if(void 0!==b){.8>a.c.oa/a.c.wa&&(b=1);a.c.za=b;b=a.c.kb*a.c.za;if(a.c.wa!=b){a.c.wa=b;b=a.c.wa.toFixed(2)+"Mhz";var d=a.w.setSpeed;d&&(d.textContent=b);a.Y("target speed: "+b)}c&&a.A&&Ab(a.A)}xb(a,a.L);a.L=0;a.c.xa=ga();a.c.pa=0;yb(a)}
|
||||
l.ob=function(a){if(Ja(this,!0)){if(!this.j.fa){wb(this);this.A&&this.A.start(this.c.xa,zb(this));this.j.fa=!0;this.j.Gb=!0;this.G&&this.G.start();var b=this.w.run;b&&(b.textContent="Halt");this.A&&(this.A.qa(!0),a&&Ab(this.A,!0))}this.c.nb>=this.c.Aa&&yb(this,!0);this.c.La=0;this.c.Ua=ga();this.c.pa&&(a=this.c.Ua-this.c.pa,a>this.c.Ib&&(this.c.xa+=a,this.c.xa>this.c.Ua&&(this.c.xa=this.c.Ua)));try{do{this.Ob(this.j.Ra?1:this.c.Fc);var c=this.N-this.a;this.L+=c;this.c.La+=c;xb(this,0,!0);a=c;this.j.Ra&&
|
||||
(b=!1,this.c.Va=this.c.Va+this.Hb()|0,this.c.ya-=a,0>=this.c.ya&&(this.c.ya+=this.c.Ga,b=!0),0<=this.c.Ha&&this.c.Ha<=zb(this)&&(this.c.Ga=this.c.Ha=-1,sb(this),vb(this),b=!0),b&&this.Y(zb(this)+" cycles: checksum="+n(this.c.Va)));this.c.Ja-=c;0>=this.c.Ja&&(this.c.Ja+=this.c.Kb,this.A&&Bb(this.A,this.c.Xa++),this.c.Xa>this.Z&&(this.c.Xa=0));this.c.Ia-=c;0>=this.c.Ia&&(this.c.Ia+=this.c.Jb,this.A&&this.A.qa());this.c.Ka-=c;if(0>=this.c.Ka){this.c.Ka+=this.c.mb;break}}while(this.j.fa)}catch(e){vb(this);
|
||||
tb(this);this.A&&this.A.stop(ga(),zb(this));Ja(this,!1);c=e.stack||e.message;this.j.na=!0;this.J(c);return}c=setTimeout;a=this.ka;this.c.pa=ga();b=this.c.Ib;this.c.La&&(b=Math.round(b*this.c.La/this.c.mb));var b=b-(this.c.pa-this.c.Ua),d=this.c.pa-this.c.xa;d&&(this.c.oa=Math.round(this.L/(10*d))/100,864E5<=d&&(this.O=0,wb(this)));if(0>b||this.c.oa<this.c.wa)b=0;this.c.nb+=this.c.La;this.c.pa+=b;c(a,b)}else tb(this),this.A&&this.A.stop(ga(),zb(this))};l.Ob=function(){return 0};
|
||||
function vb(a,b){a.j.Fa&&(a.j.jb=!0);a.N-=a.a;a.a=0;xb(a,a.L);a.L=0;if(a.j.fa){a.j.fa=!1;a.G&&a.G.stop();var c=a.w.run;c&&(c.textContent="Run")}a.j.Sa=b}function tb(a){a.A&&(Bb(a.A,-1),a.A.qa(void 0))}function Cb(a){this.ja=+a.model||8080;ob.call(this,a,1E6);this.ga=Db;rb(this);this.j.Sa=this.j.wc=!1;this.ca=0;this.U=[];this.ha=0;Eb(this)}x(Cb,ob);function Fb(a,b){a.U.push(b)}l=Cb.prototype;l.reset=function(){this.j.fa&&vb(this);Eb(this);rb(this);this.j.na=!1;this.parent.reset.call(this)};
|
||||
function Eb(a){a.b=0;a.f=0;a.C=0;a.h=0;a.D=0;a.i=0;a.l=0;a.B=0;C(a,a.ha);Hb(a,0);a.v=0}function Ib(a,b){a.ha=b;C(a,b)}l.Hb=function(){var a=this.b+this.f+this.C+this.h+this.D+this.i+this.l|0;return a=a+this.B+this.s+Jb(this)|0};
|
||||
l.save=function(){var a=new D(this);F(a,0,[this.b,this.f,this.C,this.h,this.D,this.i,this.l,this.B,this.s,Jb(this)]);F(a,1,[this.v,this.O,this.c.za]);for(var b=this.m,c=0,d=[],e=0;e<b.l;e++){var f=b.b[e];if(f.ea||f.Eb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,m=[];g<f.length;){for(var q=f[g],p=g+1;p<f.length&&f[p]===q;)p++;m[k++]=p-g;m[k++]=q;g=p}if(m.length<f.length){f=m;break a}}d[h]=f}}F(a,2,d);return a.data()};
|
||||
l.restore=function(a){var b=a[0];this.b=b[0];this.f=b[1];this.C=b[2];this.h=b[3];this.D=b[4];this.i=b[5];this.l=b[6];this.B=b[7]&65535;C(this,b[8]);Hb(this,b[9]);b=a[1];this.v=b[0];this.O=b[1];wb(this,b[3]);a:{b=this.m;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.v){for(var f=0,h=Array(b.v),g=0;g<e.length-1;)for(var k=e[g++],m=e[g++];k--;)h[f++]=m;e=h}f=b.b[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
l.R=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.w[b]=c;this.ca++;d=!0;break;default:d=this.parent.R.call(this,a,b,c)}return d};function Kb(a){return a.f<<8|a.C}function Lb(a,b){a.f=b>>8&255;a.C=b&255}function Mb(a){return a.h<<8|a.D}function Nb(a,b){a.h=b>>8&255;a.D=b&255}function H(a){return a.i<<8|a.l}
|
||||
function I(a,b){a.i=b>>8&255;a.l=b&255}function C(a,b){a.s=b&65535}function K(a){return a.o&256?1:0}function Ob(a,b){a.o=a.o&255|b}function Pb(a){return Ma[a.u&255]?4:0}function Jb(a){return a.H&-214|(a.u&128?128:0)|(a.o&255?0:64)|((a.u^a.F)&16?16:0)|Pb(a)|K(a)}function Hb(a,b){a.o=a.u=a.F=0;b&1&&(a.o|=256);b&4||(a.u|=1);b&16&&(a.F|=16);b&64||(a.o|=255);b&128&&(a.u^=192);a.H=a.H&-726|b&512|2}function Qb(a,b){a.F=a.b^b;return a.u=(a.o=a.b+b)&255}
|
||||
function Rb(a,b){a.F=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?1:0))&255}function Sb(a,b){a.o=a.u=a.F=a.b&b;(a.b|b)&8&&(a.F^=16);return a.o}function Tb(a,b){a.F=b^255;b=a.u=b+255&255;a.o=a.o&-256|b;return b}function Ub(a,b){a.F=b;b=a.u=b+1&255;a.o=a.o&-256|b;return b}function Vb(a,b){return a.u=a.o=a.F=a.b|b}function L(a,b){b^=255;a.F=a.b^b;return a.u=(a.o=a.b+b+1^256)&255}function Wb(a,b){b^=255;a.F=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function Xb(a,b){return a.u=a.o=a.F=a.b^b}l.I=function(a){return this.m.I(a)};
|
||||
l.T=function(a,b){this.m.T(a,b)};function M(a){var b=a.I(a.s);C(a,a.s+1);return b}function P(a){var b=Wa(a.m,a.s);C(a,a.s+2);return b}function Q(a){var b=Wa(a.m,a.B);a.B=a.B+2&65535;return b}function R(a,b){a.B=a.B-2&65535;Ya(a.m,a.B,b)}function S(a,b,c,d){d=d||2;a.w[b]&&(void 0===c&&(a.j.na=!0,a.J("Value for "+b+" is invalid"),vb(a)),c=!a.j.fa||a.j.Fb?n(c,d):"--------".substr(0,d),a.w[b].textContent!=c&&(a.w[b].textContent=c))}
|
||||
l.qa=function(a){this.ca&&(a||!this.j.fa||this.j.Fb)&&(S(this,"A",this.b),S(this,"B",this.f),S(this,"C",this.C),S(this,"BC",Kb(this),4),S(this,"D",this.h),S(this,"E",this.D),S(this,"DE",Mb(this),4),S(this,"H",this.i),S(this,"L",this.l),S(this,"HL",H(this),4),S(this,"SP",this.B,4),S(this,"PC",this.s,4),a=Jb(this),S(this,"PS",a,4),S(this,"IF",a&512?1:0,1),S(this,"SF",a&128?1:0,1),S(this,"ZF",a&64?1:0,1),S(this,"AF",a&16?1:0,1),S(this,"PF",a&4?1:0,1),S(this,"CF",a&1?1:0,1));if(a=this.w.speed)a.textContent=
|
||||
this.j.fa&&this.c.oa?this.c.oa.toFixed(2)+"Mhz":"Stopped"};l.Ob=function(a){this.j.Sa=!0;this.j.wc=!1;this.j.Gb=!1;this.N=this.a=a;do{if(a=this.v)this.v&8&&this.H&512?(a=199|(this.v&7)<<3,this.v&=-16,this.H&=-513,this.ga[a].call(this),a=!0):a=!1,a=!a;if(a&&this.v&16){this.a=0;break}this.ga[M(this)].call(this)}while(0<this.a);return this.j.Sa?this.N-this.a:void 0===this.j.Sa?0:-1};ta(function(){for(var a=z(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Cb(d);Ia(d,c)}});
|
||||
function Yb(){this.a-=4}function Zb(){C(this,P(this));this.a-=10}function $b(){C(this,Q(this));this.a-=10}function ac(){var a=P(this);R(this,this.s);C(this,a);this.a-=17}
|
||||
var Db=[Yb,function(){Lb(this,P(this));this.a-=10},function(){this.T(Kb(this),this.b);this.a-=7},function(){Lb(this,Kb(this)+1);this.a-=5},function(){this.f=Ub(this,this.f);this.a-=5},function(){this.f=Tb(this,this.f);this.a-=5},function(){this.f=M(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;Ob(this,a&256);this.a-=4},Yb,function(){var a;I(this,a=H(this)+Kb(this));Ob(this,a>>8&256);this.a-=10},function(){this.b=this.I(Kb(this));this.a-=7},function(){Lb(this,Kb(this)-1);this.a-=5},
|
||||
function(){this.C=Ub(this,this.C);this.a-=5},function(){this.C=Tb(this,this.C);this.a-=5},function(){this.C=M(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;Ob(this,a);this.a-=4},Yb,function(){Nb(this,P(this));this.a-=10},function(){this.T(Mb(this),this.b);this.a-=7},function(){Nb(this,Mb(this)+1);this.a-=5},function(){this.h=Ub(this,this.h);this.a-=5},function(){this.h=Tb(this,this.h);this.a-=5},function(){this.h=M(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|K(this);
|
||||
Ob(this,a&256);this.a-=4},Yb,function(){var a;I(this,a=H(this)+Mb(this));Ob(this,a>>8&256);this.a-=10},function(){this.b=this.I(Mb(this));this.a-=7},function(){Nb(this,Mb(this)-1);this.a-=5},function(){this.D=Ub(this,this.D);this.a-=5},function(){this.D=Tb(this,this.D);this.a-=5},function(){this.D=M(this);this.a-=7},function(){var a=this.b<<8;this.b=(K(this)<<8|this.b)>>1;Ob(this,a&256);this.a-=4},Yb,function(){I(this,P(this));this.a-=10},function(){var a=P(this);Ya(this.m,a,H(this));this.a-=16},
|
||||
function(){I(this,H(this)+1);this.a-=5},function(){this.i=Ub(this,this.i);this.a-=5},function(){this.i=Tb(this,this.i);this.a-=5},function(){this.i=M(this);this.a-=7},function(){var a=0,b=K(this);if((this.u^this.F)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=Qb(this,a);Ob(this,b?256:0);this.a-=4},Yb,function(){var a;I(this,a=H(this)+H(this));Ob(this,a>>8&256);this.a-=10},function(){var a;a=P(this);a=Wa(this.m,a);I(this,a);this.a-=16},function(){I(this,H(this)-1);this.a-=5},function(){this.l=
|
||||
Ub(this,this.l);this.a-=5},function(){this.l=Tb(this,this.l);this.a-=5},function(){this.l=M(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},Yb,function(){this.B=P(this)&65535;this.a-=10},function(){this.T(P(this),this.b);this.a-=13},function(){this.B=this.B+1&65535;this.a-=5},function(){var a=H(this);this.T(a,Ub(this,this.I(a)));this.a-=10},function(){var a=H(this);this.T(a,Tb(this,this.I(a)));this.a-=10},function(){this.T(H(this),M(this));this.a-=10},function(){this.o|=256;this.a-=4},Yb,
|
||||
function(){var a;I(this,a=H(this)+this.B);Ob(this,a>>8&256);this.a-=10},function(){this.b=this.I(P(this));this.a-=13},function(){this.B=this.B-1&65535;this.a-=5},function(){this.b=Ub(this,this.b);this.a-=5},function(){this.b=Tb(this,this.b);this.a-=5},function(){this.b=M(this);this.a-=7},function(){Ob(this,K(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.f=this.C;this.a-=5},function(){this.f=this.h;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=
|
||||
this.l;this.a-=5},function(){this.f=this.I(H(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.C=this.f;this.a-=5},function(){this.a-=5},function(){this.C=this.h;this.a-=5},function(){this.C=this.D;this.a-=5},function(){this.C=this.i;this.a-=5},function(){this.C=this.l;this.a-=5},function(){this.C=this.I(H(this));this.a-=7},function(){this.C=this.b;this.a-=5},function(){this.h=this.f;this.a-=5},function(){this.h=this.C;this.a-=5},function(){this.a-=5},function(){this.h=this.D;
|
||||
this.a-=5},function(){this.h=this.i;this.a-=5},function(){this.h=this.l;this.a-=5},function(){this.h=this.I(H(this));this.a-=7},function(){this.h=this.b;this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.C;this.a-=5},function(){this.D=this.h;this.a-=5},function(){this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.l;this.a-=5},function(){this.D=this.I(H(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=
|
||||
this.C;this.a-=5},function(){this.i=this.h;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.a-=5},function(){this.i=this.l;this.a-=5},function(){this.i=this.I(H(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.l=this.f;this.a-=5},function(){this.l=this.C;this.a-=5},function(){this.l=this.h;this.a-=5},function(){this.l=this.D;this.a-=5},function(){this.l=this.i;this.a-=5},function(){this.a-=5},function(){this.l=this.I(H(this));this.a-=7},function(){this.l=this.b;
|
||||
this.a-=5},function(){this.T(H(this),this.f);this.a-=7},function(){this.T(H(this),this.C);this.a-=7},function(){this.T(H(this),this.h);this.a-=7},function(){this.T(H(this),this.D);this.a-=7},function(){this.T(H(this),this.i);this.a-=7},function(){this.T(H(this),this.l);this.a-=7},function(){var a=this.s-1;if(this.U.length)for(var b=0;b<this.U.length;b++)if(this.U[b](a))return;this.v|=16;this.a-=7;this.H&512||vb(this)},function(){this.T(H(this),this.b);this.a-=7},function(){this.b=this.f;this.a-=5},
|
||||
function(){this.b=this.C;this.a-=5},function(){this.b=this.h;this.a-=5},function(){this.b=this.D;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.l;this.a-=5},function(){this.b=this.I(H(this));this.a-=7},function(){this.a-=5},function(){this.b=Qb(this,this.f);this.a-=4},function(){this.b=Qb(this,this.C);this.a-=4},function(){this.b=Qb(this,this.h);this.a-=4},function(){this.b=Qb(this,this.D);this.a-=4},function(){this.b=Qb(this,this.i);this.a-=4},function(){this.b=Qb(this,this.l);
|
||||
this.a-=4},function(){this.b=Qb(this,this.I(H(this)));this.a-=7},function(){this.b=Qb(this,this.b);this.a-=4},function(){this.b=Rb(this,this.f);this.a-=4},function(){this.b=Rb(this,this.C);this.a-=4},function(){this.b=Rb(this,this.h);this.a-=4},function(){this.b=Rb(this,this.D);this.a-=4},function(){this.b=Rb(this,this.i);this.a-=4},function(){this.b=Rb(this,this.l);this.a-=4},function(){this.b=Rb(this,this.I(H(this)));this.a-=7},function(){this.b=Rb(this,this.b);this.a-=4},function(){this.b=L(this,
|
||||
this.f);this.a-=4},function(){this.b=L(this,this.C);this.a-=4},function(){this.b=L(this,this.h);this.a-=4},function(){this.b=L(this,this.D);this.a-=4},function(){this.b=L(this,this.i);this.a-=4},function(){this.b=L(this,this.l);this.a-=4},function(){this.b=L(this,this.I(H(this)));this.a-=7},function(){this.b=L(this,this.b);this.a-=4},function(){this.b=Wb(this,this.f);this.a-=4},function(){this.b=Wb(this,this.C);this.a-=4},function(){this.b=Wb(this,this.h);this.a-=4},function(){this.b=Wb(this,this.D);
|
||||
this.a-=4},function(){this.b=Wb(this,this.i);this.a-=4},function(){this.b=Wb(this,this.l);this.a-=4},function(){this.b=Wb(this,this.I(H(this)));this.a-=7},function(){this.b=Wb(this,this.b);this.a-=4},function(){this.b=Sb(this,this.f);this.a-=4},function(){this.b=Sb(this,this.C);this.a-=4},function(){this.b=Sb(this,this.h);this.a-=4},function(){this.b=Sb(this,this.D);this.a-=4},function(){this.b=Sb(this,this.i);this.a-=4},function(){this.b=Sb(this,this.l);this.a-=4},function(){this.b=Sb(this,this.I(H(this)));
|
||||
this.a-=7},function(){this.b=Sb(this,this.b);this.a-=4},function(){this.b=Xb(this,this.f);this.a-=4},function(){this.b=Xb(this,this.C);this.a-=4},function(){this.b=Xb(this,this.h);this.a-=4},function(){this.b=Xb(this,this.D);this.a-=4},function(){this.b=Xb(this,this.i);this.a-=4},function(){this.b=Xb(this,this.l);this.a-=4},function(){this.b=Xb(this,this.I(H(this)));this.a-=7},function(){this.b=Xb(this,this.b);this.a-=4},function(){this.b=Vb(this,this.f);this.a-=4},function(){this.b=Vb(this,this.C);
|
||||
this.a-=4},function(){this.b=Vb(this,this.h);this.a-=4},function(){this.b=Vb(this,this.D);this.a-=4},function(){this.b=Vb(this,this.i);this.a-=4},function(){this.b=Vb(this,this.l);this.a-=4},function(){this.b=Vb(this,this.I(H(this)));this.a-=7},function(){this.b=Vb(this,this.b);this.a-=4},function(){L(this,this.f);this.a-=4},function(){L(this,this.C);this.a-=4},function(){L(this,this.h);this.a-=4},function(){L(this,this.D);this.a-=4},function(){L(this,this.i);this.a-=4},function(){L(this,this.l);
|
||||
this.a-=4},function(){L(this,this.I(H(this)));this.a-=7},function(){L(this,this.b);this.a-=4},function(){this.o&255&&(C(this,Q(this)),this.a-=6);this.a-=5},function(){Lb(this,Q(this));this.a-=10},function(){var a=P(this);this.o&255&&C(this,a);this.a-=10},Zb,function(){var a=P(this);this.o&255&&(R(this,this.s),C(this,a),this.a-=6);this.a-=11},function(){R(this,Kb(this));this.a-=11},function(){this.b=Qb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,0);this.a-=11},function(){this.o&255||
|
||||
(C(this,Q(this)),this.a-=6);this.a-=5},$b,function(){var a=P(this);this.o&255||C(this,a);this.a-=10},Zb,function(){var a=P(this);this.o&255||(R(this,this.s),C(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Rb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,8);this.a-=11},function(){K(this)||(C(this,Q(this)),this.a-=6);this.a-=5},function(){Nb(this,Q(this));this.a-=10},function(){var a=P(this);K(this)||C(this,a);this.a-=10},function(){for(var a=M(this),b=this.m,c=this.b,d=this.s+-2&
|
||||
65535,e=1,f=0;0<e;){var h=b.s[a],g=b.F[a]||1,k=1==g?255:2==g?65535:-1,k=(c>>>=f)&k;if(void 0!==h&&h[0])h[0](a,k,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=P(this);K(this)||(R(this,this.s),C(this,a),this.a-=6);this.a-=11},function(){R(this,Mb(this));this.a-=11},function(){this.b=L(this,M(this));this.a-=7},function(){R(this,this.s);C(this,16);this.a-=11},function(){K(this)&&(C(this,Q(this)),this.a-=6);this.a-=5},$b,function(){var a=P(this);K(this)&&C(this,a);this.a-=10},function(){for(var a=
|
||||
M(this),b=this.m,c=this.s+-2&65535,d=1,e=0,f=0;0<d;){var h=b.o[a],g=b.B[a]||1,k=1==g?255:2==g?65535:-1,m=k;void 0!==h&&h[0]&&(m=h[0](a,c),void 0===m?m=k:m&=k);e|=m<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=P(this);K(this)&&(R(this,this.s),C(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Wb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,24);this.a-=11},function(){Pb(this)||(C(this,Q(this)),this.a-=6);this.a-=5},function(){I(this,Q(this));this.a-=10},function(){var a=
|
||||
P(this);Pb(this)||C(this,a);this.a-=10},function(){var a=Q(this);R(this,H(this));I(this,a);this.a-=18},function(){var a=P(this);Pb(this)||(R(this,this.s),C(this,a),this.a-=6);this.a-=11},function(){R(this,H(this));this.a-=11},function(){this.b=Sb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,32);this.a-=11},function(){Pb(this)&&(C(this,Q(this)),this.a-=6);this.a-=5},function(){C(this,H(this));this.a-=5},function(){var a=P(this);Pb(this)&&C(this,a);this.a-=10},function(){var a=H(this);
|
||||
I(this,Mb(this));Nb(this,a);this.a-=5},function(){var a=P(this);Pb(this)&&(R(this,this.s),C(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Xb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,40);this.a-=11},function(){this.u&128||(C(this,Q(this)),this.a-=6);this.a-=5},function(){var a=Q(this);Hb(this,a&255|this.H&-256);this.b=a>>8;this.a-=10},function(){var a=P(this);this.u&128||C(this,a);this.a-=10},function(){this.H&=-513;this.a-=4},function(){var a=P(this);this.u&128||(R(this,this.s),
|
||||
C(this,a),this.a-=6);this.a-=11},function(){R(this,Jb(this)&255|this.b<<8);this.a-=11},function(){this.b=Vb(this,M(this));this.a-=7},function(){R(this,this.s);C(this,48);this.a-=11},function(){this.u&128&&(C(this,Q(this)),this.a-=6);this.a-=5},function(){this.B=H(this)&65535;this.a-=5},function(){var a=P(this);this.u&128&&C(this,a);this.a-=10},function(){this.H|=512;this.a-=4},function(){var a=P(this);this.u&128&&(R(this,this.s),C(this,a),this.a-=6);this.a-=11},ac,function(){L(this,M(this));this.a-=
|
||||
7},function(){R(this,this.s);C(this,56);this.a-=11}];function T(a){v.call(this,"ChipSet",a,T);var b=a.model;b&&!bc[b]&&va("Unrecognized ChipSet model: "+b);this.c=bc[b]||{};a.sound&&(this.B=null,window&&(this.B=window.AudioContext||window.webkitAudioContext),this.B&&new this.B);A(this)}x(T);
|
||||
var U={V:1978.1,nc:{W:0,fd:1,ld:16,zd:32,Nd:64,Ld:128,Ba:14},ma:{W:1,Ub:1,jc:2,fc:4,gc:16,hc:32,ic:64,Ba:8},oc:{W:2,ed:3,Xd:4,gd:8,Hd:16,Id:32,Jd:64,hd:128,Ba:0},Rd:{W:3},Pd:{W:2,Bd:7},Td:{W:3,Zd:1,Sd:2,Kd:4,td:8,jd:16,Xc:32},Qd:{W:4},Ud:{W:5,md:1,nd:2,od:4,pd:8,$d:16}},V={V:100,ta:{W:66,de:1,dc:2,ec:4,Fd:8,Dd:16,tb:32,sb:64,wd:128},Tb:{W:66,INIT:0},da:{yd:{W:98},ra:{Sb:0,Rb:1,lc:2,rc:4,Xb:5,kc:6,Vd:7},Pa:16383},Wb:{W:162,INIT:0},Vb:{W:194,INIT:0}},bc={SI1978:U,VT100:V};T.prototype.R=function(){return!1};
|
||||
T.prototype.ia=function(a,b,c,d){this.m=b;this.a=c;this.K=d;this.A=a;Za(b,this,this.c.Ya);$a(b,this,this.c.Za)};T.prototype.X=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.ba=function(a){return a?this.save():!0};U.INIT=[[U.nc.Ba,U.ma.Ba,U.oc.Ba,0,0,0,0]];
|
||||
V.INIT=[[V.Tb.INIT,V.ta.dc|V.ta.ec,V.Wb.INIT,V.Vb.INIT],[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,11856,11824,11840,11808,11776,12E3,12E3,11857,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=T.prototype;
|
||||
l.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.J("reset error")};l.save=function(){var a=new D(this);switch(this.c.V){case U.V:F(a,0,[this.O,this.f,this.U,this.s,this.v,this.L,this.N]);break;case V.V:F(a,0,[this.F,this.i,this.H,this.G]),F(a,1,[this.o,this.b,this.l,this.u,this.h])}return a.data()};
|
||||
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.V){case U.V:return this.O=b[0],this.f=b[1],this.U=b[2],this.s=b[3],this.v=b[4],this.L=b[5],this.N=b[6],!0;case V.V:return this.F=b[0],this.i=b[1],this.H=b[2],this.G=b[3],b=a[1],this.o=b[0],this.b=b[1],this.l=b[2],this.u=b[3],this.h=b[4],!0}return!1};l.start=function(){};l.stop=function(){};function cc(a,b,c){a.f&=~b;c&&(a.f|=b)}l.Ac=function(){return this.O};l.Bc=function(){return this.f};l.Cc=function(){return this.U};
|
||||
l.zc=function(){return this.s>>8-this.v&255};l.Jc=function(a,b){this.v=b};l.Lc=function(a,b){this.L=b};l.Kc=function(a,b){this.s=b<<8|this.s>>8};l.Mc=function(a,b){this.N=b};l.Nc=function(){};function dc(a){var b=0,c=0,d=~a.o;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.Dc=function(){var a=this.i,a=a&~V.ta.sb;if((zb(this.a)&64)<<1&&(a|=V.ta.sb,a!=this.i)){var b,c;b=this.l&1;switch(this.l>>1&7){case V.da.ra.Rb:this.o=this.o<<1|b;break;case V.da.ra.Xb:b=dc(this);this.h[b]=V.da.Pa;break;case V.da.ra.Sb:this.b=this.b<<1|b;break;case V.da.ra.rc:b=dc(this);c=this.b&V.da.Pa;this.h[b]=c;break;case V.da.ra.kc:b=dc(this);c=this.h[b];null==c&&(c=V.da.Pa);this.b=c;break;case V.da.ra.lc:this.b<<=1,this.u=this.b&V.da.Pa+1}}a&=~V.ta.tb;this.u&&(a|=V.ta.tb);return this.i=a};
|
||||
l.Oc=function(a,b){this.F=b};l.Rc=function(a,b){this.l=b};l.Qc=function(a,b){this.H=b};l.Pc=function(a,b){this.G=b};U.Ya={0:T.prototype.Ac,1:T.prototype.Bc,2:T.prototype.Cc,3:T.prototype.zc};U.Za={2:T.prototype.Jc,3:T.prototype.Lc,4:T.prototype.Kc,5:T.prototype.Mc,6:T.prototype.Nc};V.Ya={66:T.prototype.Dc};V.Za={66:T.prototype.Oc,98:T.prototype.Rc,162:T.prototype.Qc,194:T.prototype.Pc};ta(function(){for(var a=z(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new T(d);Ia(d,c)}});
|
||||
function ec(a){v.call(this,"ROM",a,ec);this.b=null;this.l=a.addr;this.c=a.size;this.o=a.writable;this.f=a.alias;this.h=a.file;this.s=ba(this.h);if(this.h){a=this.h;var b=ca(this.s);"json"!=b&&"hex"!=b&&(a=ia()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){fc(c,a,b,f)})}}x(ec);var gc=[0,5];ec.prototype.ia=function(a,b,c,d){this.m=b;this.a=c;this.K=d;hc(this)};
|
||||
ec.prototype.X=function(){this.i&&(this.K&&this.K.a(this.id,this.l,this.c,this.i),delete this.i);return!0};ec.prototype.ba=function(){return!0};
|
||||
function fc(a,b,c,d){if(d)a.J("Unable to load system ROM (error "+d+": "+b+")");else{Fa(a.gb,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){t("Empty ROM: "+b);return}if(1==a.b.length){t(a.b[0]);return}}catch(g){a.J("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]);hc(a)}}
|
||||
function hc(a){if(!Ka(a))if(!a.h)A(a);else if(a.b&&a.m){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+n(a.b.length)+") does not match specified size ("+("0x"+n(a.c))+")";a.j.na=!0;a.J(b)}else if(ic(a,a.l)){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.m,h=d.c,g=[],k=d.l>>>f.c;0<h&&k<f.b.length;)g.push(f.b[k++]),h-=f.m;f=d.m;d=d.c;h=0;for(e>>>=f.c;0<d&&e<f.b.length;){k=g[h++];if(!k)break;f.b[e++]=k;d-=f.m}}delete a.b}A(a)}}
|
||||
function ic(a,b){if(Sa(a.m,b,a.c,a.o?1:fb)){var c;for(c=0;c<a.b.length;c++)Xa(a.m,b+c,a.b[c]);if(a.o&&256==b){for(c=0;c<gc.length;c++)Xa(a.m,gc[c],118);Fb(a.a,function(a){return function(b){if(0<=gc.indexOf(b)){var c=!1,h=a.a,g=a.K;if(5==b)switch(c=!0,h.C){case 2:jc(a,String.fromCharCode(h.D));break;case 9:for(var k=Mb(h),m="",q=255;q--;){var p=a.a.I(k++);if(36==p)break;m+=String.fromCharCode(p)}jc(a,m);break;default:c=!1}c?$b.call(h):g&&(a.Y("\nCP/M vector 0x"+n(b,4)),C(h,b),vb(g));b=!0}else b=!1;
|
||||
return b}}(a));Ib(a.a,b)}return!0}return!1}function jc(a,b){b=b.replace(/\r/g,"");a.la&&(a.la.value+=b,a.la.scrollTop=a.la.scrollHeight)}ta(function(){for(var a=z(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new ec(d);Ia(d,c)}});function kc(a){v.call(this,"RAM",a,kc);this.f=a.addr;this.c=a.size;this.b=!1}x(kc);l=kc.prototype;l.ia=function(a,b,c,d){this.m=b;this.a=c;this.K=d;A(this)};l.X=function(a,b){b||this.reset();return!0};l.ba=function(a){return a?this.save():!0};
|
||||
l.reset=function(){!this.b&&this.c&&Sa(this.m,this.f,this.c,1)&&(this.b=!0);this.b||t("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};ta(function(){for(var a=z(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new kc(d);Ia(d,c)}});function lc(a){v.call(this,"Keyboard",a,lc);(a=a.model)&&!mc[a]&&va("Unrecognized Keyboard model: "+a);this.c=mc[a]||{};this.reset();A(this)}x(lc);
|
||||
var Y={ad:1,bd:3,cd: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,Vc:65,Yc:66,Zc:67,dd:68,E:69,kd:70,qd:71,rd:72,sd:73,ud:74,vd:75,xd:76,Ad:77,Cd:78,Ed:79,Gd:80,Q:81,Md:82,Od:83,Wd:84,Yd:85,ae:86,be:87,ce:88,ee:89,fe:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ge:97,he:98,ie:99,d:100,e:101,je:102,ke:103,le:104,me:105,ne:106,k:107,oe:108,
|
||||
pe:109,n:110,qe:111,p:112,q:113,r:114,re:115,t:116,se:117,te:118,ue:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},nc={65:37,68:39,76:32},oc={V:1978.1,g:{},Ca:{},Da:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={V:100,g:{},Ca:{},Da:{},Wc:{W:130},aa:{W:130,bc:1,ac:2,$b:4,Zb:8,cc:16,vb:32,pb:63,mc:64,$c:128,INIT:0},Yb:127};Z.g[46]=3;Z.g[80]=5;Z.g[79]=6;Z.g[89]=7;Z.g[84]=8;Z.g[87]=9;Z.g[81]=10;Z.g[39]=16;Z.g[Y["]"]]=20;Z.g[Y["["]]=21;Z.g[73]=22;Z.g[85]=23;Z.g[82]=24;Z.g[69]=25;
|
||||
Z.g[Y["1"]]=26;Z.g[37]=32;Z.g[40]=34;Z.g[19]=35;Z.g[Y["`"]]=36;Z.g[Y["-"]]=37;Z.g[Y["9"]]=38;Z.g[Y["7"]]=39;Z.g[Y["4"]]=40;Z.g[Y["3"]]=41;Z.g[27]=42;Z.g[38]=48;Z.g[114]=49;Z.g[112]=50;Z.g[8]=51;Z.g[Y["="]]=52;Z.g[Y["0"]]=53;Z.g[Y["8"]]=54;Z.g[Y["6"]]=55;Z.g[Y["5"]]=56;Z.g[Y["2"]]=57;Z.g[9]=58;Z.g[103]=64;Z.g[115]=65;Z.g[113]=66;Z.g[96]=67;Z.g[10]=68;Z.g[Y["\\"]]=69;Z.g[76]=70;Z.g[75]=71;Z.g[71]=72;Z.g[70]=73;Z.g[65]=74;Z.g[104]=80;Z.g[2013]=81;Z.g[98]=82;Z.g[97]=83;Z.g[Y["'"]]=85;Z.g[Y[";"]]=86;
|
||||
Z.g[74]=87;Z.g[72]=88;Z.g[68]=89;Z.g[83]=90;Z.g[110]=96;Z.g[119]=97;Z.g[101]=98;Z.g[100]=99;Z.g[13]=100;Z.g[Y["."]]=101;Z.g[Y[","]]=102;Z.g[78]=103;Z.g[66]=104;Z.g[88]=105;Z.g[120]=106;Z.g[105]=112;Z.g[99]=113;Z.g[102]=114;Z.g[109]=115;Z.g[Y["/"]]=117;Z.g[77]=118;Z.g[Y[" "]]=119;Z.g[86]=120;Z.g[67]=121;Z.g[90]=122;Z.g[121]=123;Z.g[17]=124;Z.g[16]=125;Z.g[20]=126;Z.Ca={l4:Z.aa.bc,l3:Z.aa.ac,l2:Z.aa.$b,l1:Z.aa.Zb,locked:Z.aa.cc,online:Z.aa.vb,local:~Z.aa.vb};var mc={SI1978:oc,VT100:Z};
|
||||
lc.prototype.R=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.w[e]){if("led"==a&&this.c.Ca[b])return this.w[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return pc(d,a,!0)},c.onkeyup=function(a){return pc(d,a,!1)},!0;default:if(this.c.Da&&void 0!==this.c.Da[b])return this.w[e]=c,a=function(a,b){return function(){qc(a,b,!0)}}(this,b),b=function(a,b){return function(){qc(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=
|
||||
b),!0}}return!1};lc.prototype.ia=function(a,b,c,d){this.a=c;this.K=d;this.G=Oa(a,"ChipSet");Za(b,this,this.c.Ya);$a(b,this,this.c.Za)};lc.prototype.X=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};lc.prototype.ba=function(a){return a?this.save():!0};Z.INIT=[[Z.aa.INIT,0]];l=lc.prototype;l.reset=function(){this.b=[];this.c.INIT&&!this.restore(this.c.INIT)&&this.J("reset error")};l.save=function(){var a=new D(this);switch(this.c.V){case Z.V:F(a,0,[this.f])}return a.data()};
|
||||
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.V){case oc.V:return!0;case Z.V:return this.f=b[0],rc(this,this.f&Z.aa.pb),this.m=b[1],!0}return!1};function rc(a,b){for(var c in a.c.Ca){var d=a.w["led-"+c];if(d){var e=a.c.Ca[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}function pc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=nc[e]||e,!a.c.g[e]){for(var f in a.c.Da)if(a.c.Da[f]===e){e=f;break a}e=null}e&&(d=qc(a,e,c),b.preventDefault());return d}
|
||||
function qc(a,b,c){var d;a:{for(d=0;d<a.b.length;d++)if(a.b[d].Nb==b)break a;d=-1}if(c)0>d?a.b.push({Nb:b,lb:Date.now(),Qa:!1}):(a.b[d].lb=Date.now(),a.b[d].Qa=!1);else if(0<=d){if(!a.b[d].Qa){var e=a.b[d].lb;if(e&&100>Date.now()-e)return a.b[d].Qa=!0,sc(a),!0}a.b.splice(d,1)}if(a.G)switch(b){case "1p":cc(a.G,U.ma.fc,c);break;case "2p":cc(a.G,U.ma.jc,c);break;case "coin":cc(a.G,U.ma.Ub,c);break;case "left":cc(a.G,U.ma.hc,c);break;case "right":cc(a.G,U.ma.ic,c);break;case "fire":cc(a.G,U.ma.gc,c)}return!0}
|
||||
function sc(a){for(var b=0,c=-1;b<a.b.length;){if(a.b[b].Qa){var d=a.b[b].Nb,e=100-(Date.now()-a.b[b].lb);if(0<e){if(0>c||c>e)c=e}else{qc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){sc(a)},c)}l.Ec=function(){var a=0;0<=this.m&&this.m<this.b.length-1&&(a=this.b[this.m++],a=Z.g[a]);a||(a=Z.Yb);return a};l.Sc=function(a,b){this.f=b;rc(this,b&Z.aa.pb);if(b&Z.aa.mc){this.m=0;var c=this.a;c.v=c.v&-8|9}};Z.Ya={130:lc.prototype.Ec};Z.Za={130:lc.prototype.Sc};
|
||||
ta(function(){for(var a=z(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new lc(d);Ia(d,c)}});
|
||||
function tc(a,b,c,d,e){var f=this;this.xb=oa("Gecko/");var h=["","moz","ms","webkit"];v.call(this,"Video",a,tc);this.u=a.screenWidth;this.s=a.screenHeight;this.Z=a.bufferAddr;this.tc=a.bufferRAM;var g=a.bufferFormat;this.F=g&&uc[g.toUpperCase()]||vc;this.ka=a.bufferCols;this.G=a.bufferRows;this.pc=this.P=a.cellWidth||1;this.M=a.cellHeight||1;this.bb=null;this.wb=!1;this.ja=a.bufferBits||1;this.uc=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.J("unsupported buffer rotation: "+
|
||||
this.c),this.c=0);this.ib=a.interruptRate;this.vc=a.refreshRate||60;this.o=b;this.f=c;this.ha=(this.Qb=d)||b||null;this.qc=this.u;this.sc=this.s;this.rb=this.u/this.ka|0;this.ub=this.s/this.G|0;1<this.M&&this.G++;b=a.smoothing;(c=za.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.h=a.screenRotate)this.h=this.h%360,0<this.h&&(this.h-=360),-90!=this.h?(this.J("unsupported screen rotation: "+
|
||||
this.h),this.h=0):(this.f.translate(0,this.s),this.f.rotate(this.h*Math.PI/180),this.f.scale(this.s/this.u,this.u/this.s));if(this.b=e)if(this.b.ua=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.ua){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){wc(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(){wc(f,null)},!1);break}}if(this.H=a.fontROM)"json"!=ca(this.H)&&(this.H=ia()+"/api/v1/dump?file="+this.H+"&format=bytes"),r(this.H,null,!0,function(a,b,c){xc(f,a,b,c)});this.hb={}}x(tc);var vc=0,uc={SI1978:1,VT100:2};
|
||||
tc.prototype.ia=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.K=d;this.i=this.ka*this.P;this.v=this.G*this.M;b=this.i;c=this.v;this.c&&(b=this.v,c=this.i);this.sa=(this.i*this.ja>>3)*this.v;if(this.tc||Sa(this.m,this.Z,this.sa,3))1<this.P?yc(this,this.ka*this.G):(this.yb=this.f.createImageData(b,c),this.Ab=16/this.ja|0,yc(this,this.sa>>1)),this.l=document.createElement("canvas"),this.l.width=b,this.l.height=c,this.cb=this.l.getContext("2d"),this.N={},this.ca=1<<this.ja,this.O=Array(this.ca+2),
|
||||
this.O[0]=[0,0,0,255],this.O[1]=[255,255,255,255],1==this.F&&(this.O[this.ca+0]=[255,255,0,255],this.O[this.ca+1]=[0,255,0,255]),2==this.F&&(this.Bb=60,this.eb=!1,this.U=Array(this.ka));if(this.B=Oa(a,"Keyboard")){for(var e in this.hb)this.B.R("led",e,this.hb[e]);this.o&&this.B.R(this.Qb?"textarea":"canvas","kbd",this.ha)}this.H||A(this)};
|
||||
function xc(a,b,c,d){if(d)a.J("Unable to load font ROM (error "+d+": "+b+")");else{Fa(a.gb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){t("Empty font ROM: "+b);return}if(1==f.length){t(f[0]);return}if(2048==f.length)zc(a,f);else{a.J("Unrecognized font data length ("+f.length+")");return}}catch(h){a.J("Font ROM data error: "+h.message);return}(a.f||a.K)&&A(a)}}
|
||||
function zc(a,b){a.bb=b;a.wb=2==a.F;a.N[96]=[Ac(a,a.P,a.M),Ac(a,a.P,a.M,a.eb)];a.N[64]=[Ac(a,2*a.P,a.M),Ac(a,2*a.P,a.M,a.eb)];a.N[32]=a.N[0]=[Ac(a,2*a.P,2*a.M),Ac(a,2*a.P,2*a.M,a.eb)]}
|
||||
function Ac(a,b,c,d){var e=8>=a.pc?8:16,f=8<e?15:0,h=a.bb.length/e,g=!1===d,k={P:b,M: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),q=0;q<h;q++){for(var p=0,J=p;p<a.M;p++)for(var N=q*e+(f+p&e-1),N=d&&8==p?255:a.bb[N],W=0;W<c/a.M;W++){for(var G=0,u=0,E=u;u<a.P;u++){for(var O=N&128>>(7<u?7:u),G=a.wb&&!O&&G?G:O,X=0;X<b/a.P;X++)g&&(G=!G),Bc(a,m,E,J,G?1:0),E++;G=O}J++}k.context.putImageData(m,
|
||||
(q&15)*b,(q>>4)*c)}return k}
|
||||
tc.prototype.X=function(){if(2==this.F){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.Z,c=-1,d=-1,e,f=-(60==this.Bb?2:5);f<this.G;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Xa(this.m,b++,e);Xa(this.m,b++,c&255);
|
||||
if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)Xa(this.m,b++,g.charCodeAt(k)|c);c^=128}Xa(this.m,b++,127);c=b}Cc(this)}return!0};tc.prototype.R=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.hb[b]=c,!0;switch(b){case "fullScreen":return this.w[b]=c,this.b&&this.b.ua?c.onclick=function(){d.ua()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
tc.prototype.ua=function(){var a=!1;if(this.b){if(this.b.ua){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.u/this.s;b>c&&(a=Math.round(c/b*100)+"%")}this.xb?(this.o.style.width=a,this.o.style.width=a,this.o.style.display="block",this.o.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.ua();a=!0}this.ha&&this.ha.focus()}return a};
|
||||
function wc(a,b){!b&&a.b&&(a.xb?a.o.style.width=a.o.style.height="":a.b.style.width=a.b.style.height="")}function yc(a,b){a.zb=b;a.ga=!1;if(void 0===a.L||a.L.length!=a.zb)a.L=Array(a.zb)}function Bc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.F&&(208<=c&&236>c?e=a.ca+0:28<=c&&72>c&&(e=a.ca+1));a=a.O[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 Cc(a){for(var b=a.Z,c=-1,d=0,e=60==a.Bb?2:5,f=0,h=0;d<a.G;){for(var g=0,k=b,m=c;;){var q=Va(a.m,k++);if(127==(q&127)){var p=Va(a.m,k++),c=p&96,b=(p&15)<<8|Va(a.m,k),b=b+(p&16?8192:16384);break}if(g<a.U.length)a.U[g++]=q;else break}if(e)e--;else{for(;g<a.U.length;)a.U[g++]=0;if(0<=m)for(k=0;k<g;k++){q=a.U[k];if(!a.ga||q!==a.L[f]){var p=a,J=a.cb,N=q&127;if(q=p.N[m][q&128?1:0]){var W=(N&15)*q.P,N=(N>>4)*q.M,G=void 0,u=void 0,E=void 0,O=void 0,X=q.P,Gb=q.M;J?(G=k*p.P,u=d*p.M,E=p.P,O=p.M):(G=
|
||||
k*p.rb,u=d*p.ub,E=p.rb,O=p.ub);q.P>p.P&&(G*=2,E*=2);q.M>p.M&&(0==m&&(N+=p.M),Gb=p.M);J?J.drawImage(q.canvas,W,N,X,Gb,G,u,E,O):(G+=0,u+=0,p.f.drawImage(q.canvas,W,N,X,Gb,G,u,E,O))}h++}f++}d++}}a.ga=!0;h&&a.cb&&a.f.drawImage(a.l,0,0,a.i,a.v-a.M,0,0,a.qc,a.sc)}
|
||||
ta(function(){for(var a=z(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=y(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||za.aspect);f&&.3<=f&&3.33>=f&&(sa("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");oa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new tc(d,e,h,f,c);Ia(d,c)}});
|
||||
function Dc(a){this.h=+a.adapter;switch(this.h){case 0:this.i=0;break;default:t("Unrecognized serial adapter #"+this.h);return}v.call(this,"SerialPort",a,Dc);var b=a.binding;if("console"!=b){var c;a=Ec;b&&(void 0===c&&(c="Panel"),(c=Ha(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}}x(Dc);var Ec="buffer";l=Dc.prototype;
|
||||
l.R=function(a,b,c){switch(b){case Ec:return this.w[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};l.ia=function(a,b,c,d){this.m=b;this.a=c;this.K=d;this.G=Oa(a,"ChipSet");Za(b,this,Fc,this.i);$a(b,this,Gc,this.i);A(this)};
|
||||
l.X=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.ba=function(a){return a?this.save():!0};l.reset=function(){Hc(this)};l.save=function(){var a=new D(this),b=0,c=[];c[b++]=this.c;c[b++]=this.b;c[b++]=this.f;F(a,0,c);return a.data()};l.restore=function(a){return Hc(this,a[0])};function Hc(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.c=b[c++];a.b=b[c++];a.f=b[c++];return!0}l.yc=function(){return this.c};l.xc=function(){return this.b};
|
||||
l.Ic=function(a,b){this.c=b};l.Hc=function(a,b){this.b=b};l.Gc=function(a,b){this.f=b};var Fc={0:Dc.prototype.yc,1:Dc.prototype.xc},Gc={0:Dc.prototype.Ic,1:Dc.prototype.Hc,2:Dc.prototype.Gc};ta(function(){for(var a=z(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Dc(d);Ia(d,c)}});function D(a,b,c){this.id=a.id;this.key=Ic(a,b,c);this.K=a.K;Jc(this,a.Lb)}function Ic(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}
|
||||
D.prototype={constructor:D,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){Jc(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 Jc(a,b){a[a.id]={};b&&F(a,"parms",b);a.a=!1}function Kc(a){var b=!0;if(la()){var c=JSON.stringify(a[a.id]);na(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Lc(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Mc(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:la()&&(b=ma(a.key))?(a[a.id]=b,a.a=!0):!1}function Nc(a,b){return a[a.id][b]||null}function F(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function Oc(a,b,c){v.call(this,"Computer",a,Oc);this.j.S=!1;Pc(this,b);this.B=qb(this,"autoPower",a);this.f=0;this.L=a.busWidth||a.buswidth;this.b=Qc;this.u=null;this.o=this.H=!1;this.N=qb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Rc(this);if(this.a=Ha("CPU",this.id)){this.K=Ha("Debugger",this.id);this.l=[];for(b=null;b=Oa(this,"Video",b);)this.l.push(b);this.m=new Qa({id:this.gb+".bus",busWidth:this.L},this.a,this.K);var d,e=Ga(this.id);if((this.h=Ha("Panel",this.id))&&this.h.la)for(b=
|
||||
0;b<e.length;b++)d=e[b],d.J=this.h.J,d.Y=this.h.Y,d.la=this.h.la;this.Y("PC8080 v1.23.3\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.ia&&d.ia(this,this.m,this.a,this.K);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.A=d:this.b=parseInt(d,10));var f;if(a=qb(this,"state")||(f=!0,a.state))b=this.F=a,f||(this.o=!0,this.b=Qc),this.b&&(this.v=new D(this,"1.23.3"),Mc(this.v)?b=null:delete this.v);
|
||||
!b&&this.b&&(b=Sc(this))&&(this.o=!0);if(b){var h=this;r(b,null,!0,function(a,b,c){c?(h.A=null,h.o=!1,h.J("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(h.u=b,h.H=!0);A(h)})}else A(this);this.w.power||(this.B=!0);!c&&this.B&&Tc(this,this.Ma)}else t("Unable to find CPU component")}x(Oc);var Qc=0;
|
||||
function Pc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.s=b}function qb(a,b,c){var d=b.toLowerCase(),d=za[b]||za[d];void 0===d&&a.s&&(d=a.s[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Tc(a,b,c){for(var d=Ga(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ka(f)){Ka(f,function(){Tc(a,b,c)});return}}b.call(a,c)}
|
||||
function Uc(a,b){var c=new D(a,"1.23.3","validate");if(Mc(c)&&Lc(c)){var d=Nc(c,"timestamp"),e=b?Nc(b,"timestamp"):"unknown";d!=e&&(a.J("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Oc.prototype;
|
||||
l.Ma=function(a){void 0===a&&(a=this.b||(this.u?1:Qc));if(!this.f){this.f++;var b=!1,c=!1;this.G=!1;var d=this.v||new D(this,"1.23.3");if(-1==a)b=!0;else if(a>Qc){if(Mc(d,this.u)){this.i=new D(this,"1.23.3","failsafe");Mc(this.i)&&(Vc(this,d),a=2,Jc(this.i));F(this.i,"timestamp",ha());Kc(this.i);var e=this.b&&!this.o;if(1==a||ja("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Lc(d)){var f=Nc(d,"code"),h=Nc(d,"data");f&&("ok"==f?Mc(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.J("Error: "+h),"unable to verify user"==h&&(na("user",""),this.c=null)):this.Y(f+": "+h),Jc(d),Mc(d)?(c=Lc(d),e=!0):c=!1))}e&&Uc(this,c?d:null)}else 2==a&&d.clear()}else Uc(this);delete this.u;delete this.v}e=Ga(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=Wc(this,h,d,b,c));b=[d,a,c];-1!=a?Tc(this,this.Cb,b):this.Cb(b)}};
|
||||
function Wc(a,b,c,d,e){if(!b.j.S){b.j.S=!0;if(b.X){var f=null;e&&((f=Nc(c,b.id))||(f=Nc(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.X(f,d)&&f&&(t("Unable to restore state for "+b.type),a.F&&!a.H?(c.clear(),a.b=Qc,window&&window.location.reload()):a.G=!0,b.X(null),e=!1)}if(!d&&b.qb)for(a=b.qb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
l.Cb=function(a){var b=a[0],c=0>a[1];a=a[2];this.O=!0;this.j.S=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.a&&(Wc(this,this.a,b,c,a),ub(this.a));this.G&&(Vc(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0};
|
||||
function Vc(a,b){if(ja("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.23.3"};e.url=a.N;e.user=c;e.type="bug";e.data=d;r("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function Xc(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new D(a,"1.23.3"),h=new D(a,"1.23.3","validate"),g=ha();F(h,"timestamp",g);F(f,"timestamp",g);F(f,"version","1.23.3");F(f,"url",window?window.location.href:null);F(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ba&&(c&&vb(a.a),d=a.a.ba(b,c),"object"===typeof d&&F(f,a.a.id,d),c&&(a.a.j.S=!1,!1===d&&(e=null)));for(var g=Ga(a.id),k=0;k<g.length;k++){var m=g[k];m.j.S&&(m.ba&&(d=m.ba(b,c),"object"===typeof d&&F(f,m.id,d)),c&&
|
||||
(m.j.S=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&Yc(a,a.c,f.toString()),Kc(h)&&Kc(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.j.S=!1,b=a.w.power)&&(b.textContent="Power");a.f=0;return e}l.reset=function(){this.m&&this.m.reset&&this.m.reset();for(var a=Ga(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.m&&c.reset&&c.reset()}};l.start=function(a,b){for(var c=Ga(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=Ga(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
l.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.f||(d.j.S?Xc(d,!1,!0):Tc(d,d.Ma))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.j.S&&!d.f)if(d.b&&!d.A){var a=ja("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Xc(d,a,!0);!a&&d.F?window&&window.location.reload():d.Ma(Qc)}else d.reset(),d.a&&ub(d.a)},!0;case "save":if(da(ia(),"pcjs.org")){c.parentNode.removeChild(c);break}this.w[b]=
|
||||
c;c.onclick=function(){var a=Rc(d,!0);if(a){var b=!!(d.b&&!d.A||d.F),c=Xc(d,b);b?Yc(d,a,c):d.J("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Rc(a,b){var c=a.c;c||(c=ma("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=Zc(a,c))||a.J("The user ID is invalid."))):b&&a.J("Browser local storage is not available"));return c}
|
||||
function Zc(a,b){a.c=null;var c=r(ia()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(na("user",c.data),a.c=c.data)}catch(e){t(e.message+" ("+d+")")}return a.c}function Sc(a){var b=null;a.c&&(b=ia()+"/api/v1/user?req=load&user="+a.c+"&state="+Ic(a,"1.23.3"));return b}
|
||||
function Yc(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ic(a,"1.23.3");d.data=c;b=r(ia()+"/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.J("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.J(c),na("user",""),a.c=null)}}
|
||||
function Oa(a,b,c){a=Ga(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 Ab(a,b){if(a.l.length){var c=0,d=0;b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.l[0];e.ha&&e.ha.focus();b&&window&&window.scrollTo(c,d)}}l.qa=function(a){this.a&&this.a.qa(a);this.h&&this.h.qa(a)};
|
||||
function Bb(a,b){for(var c=0;c<a.l.length;c++){var d=a.l[c],e=!0;if(0<=b){if(d.ib)if(120==d.ib)if(b&1)e=d.a,e.v=e.v&-8|10,e=!1;else{var f=d.a;f.v=f.v&-8|9}else f=d.a,f.v=f.v&-8|12;if(f=e&&d.ga){for(var f=d.m,h=d.sa,g=!0,k=d.Z>>>f.c;0<h&&k<f.b.length;)f.b[k].ea&&(f.b[k].ea=g=!1,f.b[k].Eb=!0),h-=f.m,k++;f=g}f&&(e=!1)}if(e)if(1<d.P)switch(d.F){case 2:Cc(d)}else{var g=d.Z,k=g+d.sa,m=0,q=0,p=0,e=d.i,J=0,f=d.v,N=h=0,W=d.ja,G=(1<<W)-1;d.uc&&(W=-W,N=16+W);for(;g<k;){var u;u=d.m;var E=g,O=E&u.f,X=(E&u.h)>>>
|
||||
u.c;u=O!=u.f?u.b[X].Mb(O,E):u.b[X++].$a(O,E)|u.b[X&u.A].$a(0,E+1)<<8;if(d.ga&&u===d.L[m])q+=d.Ab;else{d.L[m]=u;(E=N)&&(u=u>>8|(u&255)<<8);q<e&&(e=q);for(O=d.Ab;O--;)X=u>>E&G,Bc(d,d.yb,q++,p,X),E+=W;q>J&&(J=q);p<f&&(f=p);p>=h&&(h=p+1)}g+=2;m++;if(q>=d.i&&(q=0,p++,p>d.v))break}d.ga=!0;e<d.i&&(g=J-e,h-=f,d.c&&(k=e,m=g,e=f,g=h,f=d.i-(k+m),h=m),d.cb.putImageData(d.yb,0,0,e,f,g,h),d.f.drawImage(d.l,0,0,d.l.width,d.l.height,0,0,d.u,d.s))}}}
|
||||
ta(function(){for(var a=z(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=z(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new Oc(h,d,!0);Ia(h,f);h.B&&Tc(h,h.Ma)}});pa.show.push(function(){for(var a=z(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Ha("Computer",c.id))&&c.O&&!c.j.S&&c.Ma(-1)}});
|
||||
pa.exit.push(function(){for(var a=z(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Ha("Computer",c.id))&&c.j.S&&Xc(c,!(!c.b||c.A),!0)}});var $c=0;function ad(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):bd(g,a,b,c,d,e,f)})}
|
||||
function bd(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Fa(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="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(p){g=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?cd(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
|
||||
function cd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");r(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,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.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);cd(a,b,c)}})}else c(a,null)}
|
||||
function dd(a,b,c,d){function e(a){if(void 0===g){var b=h&&z(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=fa(a))}function f(a){e("Error: "+a);k&&(--$c||wa(!0));k=!1}var h,g,k=!0;$c++;Ea[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=m:p.appendChild(document.createTextNode(m));q.appendChild(p)}c||
|
||||
(c="/versions/pc8080/1.23.3/components.xsl");m=function(d,g){g?ad(c,null,null,!1,e,function(d,k){if(k)if(Fa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(k);m?(h.outerHTML=m,--$c||wa(!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),--$c||wa(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?ad(b,a,d,!0,e,m):bd(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(J){f(J.message)}return k}window.embedPC8080=function(a,b,c,d){wa(!1);return dd(a,b,c,d)};window.enableEvents=wa;window.sendEvent=xa;
|
||||
function ed(a,b,c,d){if(!c&&b){d.push(b);a=Ea[d[0]];b=null;for(var e in a)if(da(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?r(b,null,!0,function(a,b){fd(b,d)}):fd(null,d)}else t("Error ("+c+") requesting "+a)}
|
||||
function fd(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Ea[f],k={},m;for(m in g){var q=g[m],p=ca(m);if("xml"==p){for(p=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[m]);){var J=d[2];J&&(g[J]||(q=q.replace(d[0],"")))}d=m=ba(m)}else"xsl"==p&&(e=m=ba(m));k[m]=q}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(m=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
"©"),m=h,g=null,k="data:application/javascript,",k=oa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),m&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=m,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+m+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(m?" ("+m+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n',
|
||||
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")}
|
||||
window.savePC=function(a,b,c){var d=Ha("Computer",a),e=Ha("Debugger",a);if(d){var f=Xc(d,!0),h=d.s?JSON.stringify(d.s):null;b||(b="/versions/pcx86/1.23.3/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Lb:h}))return!0;r(b,null,!0,function(c,d,e){ed(c,d,e,[a,ba(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})();
|
||||
(function(){var k;function aa(a){var b=16,c;if(a){b||(b=16);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 ba(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function da(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ea(a,b){return-1!==a.indexOf(b,a.length-b.length)}var fa={"&":"&","<":"<",">":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}var ha=Date.now||function(){return+new Date};function ia(){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 q(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="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));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 ja(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function r(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){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}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function pa(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 qa={init:[],show:[],exit:[]},ra=!1,sa=!0;function ta(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ua(a){qa.init.push(a)}
|
||||
function va(a){if(sa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){wa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function xa(a){!sa&&a?(sa=!0,ra&&ya("init")):sa=a}function ya(a){qa[a]&&va(qa[a])}ta("onload",function(){ra=!0;va(qa.init)});ta("onpageshow",function(){va(qa.show)});ta(pa("Opera")||pa("iOS")?"onunload":"onbeforeunload",function(){va(qa.exit)});
|
||||
function u(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.sb=b.comment;this.Nb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.gb=this.id.substr(0,b),this.fb=this.id.substr(b+1)):this.fb=this.id;this[a]=c;this.j={va:!1,Fa:!1,jb:!1,S:!1,oa:!1};this.Ta=null;this.j.oa=!1;this.w={};this.L=null;x.push(this)}var za=void 0,Aa={};
|
||||
if(window){za||(za=window.location.search.substr(1));for(var Ba,Ca=/\+/g,Da=/([^&=]+)=?([^&]*)/g;Ba=Da.exec(za);)Aa[decodeURIComponent(Ba[1].replace(Ca," "))]=decodeURIComponent(Ba[2].replace(Ca," "))}function Ea(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 y(a,b){b||(b=u);a.prototype=Ea(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var x=[],Fa={};function Ga(a,b,c){Fa[a]&&b&&(Fa[a][b]=c)}function wa(a,b,c){b||r((c?c+": ":"")+a)}function Ha(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Ia(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<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}
|
||||
function Ja(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(" "),m=0;m<l.length;m++)switch(g=l[m],g){case "pc8080-binding":(g=z(h))&&g.binding&&a.R(g.type,g.binding,h,g.value),m=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}
|
||||
u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.ma=this.w[b]=c,c.value="",this.Z=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.J=function(a){this.Z(a,this.fb)}),!0;default:return!1}},log:function(){},Z:function(){},status:function(a){this.Z(this.fb+": "+a)},J:function(a,b,c){wa(a,b,c||this.type)},Y:function(){return this.j.S=!0},ba:function(a,b){b&&(this.j.S=!1);return!0}};function Ka(a,b){if(a.j.jb)return a.j.Fa&&(a.j.Fa=!1),a.j.jb=!1;if(a.j.oa)return a.Z(a.toString()+" error"),!1;a.j.Fa=b;return a.j.Fa}function B(a){if(!a.j.oa&&(a.j.va=!0,a.j.va)){var b=a.Ta;a.Ta=null;b&&b()}}
|
||||
function La(a,b){b&&(a.j.va?b():a.Ta=b);return a.j.va}
|
||||
var Ma="undefined"!==typeof ArrayBuffer,Na=[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 Oa(a){u.call(this,"Panel",a,Oa)}y(Oa);k=Oa.prototype;k.R=function(a,b,c,d){return this.A&&this.A.R(a,b,c,d)||this.a&&this.a.R(a,b,c,d)||this.o&&this.o.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};k.ia=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.L=d;this.o=Pa(a,"Keyboard")};k.Y=function(a,b){b||Qa();return!0};k.ba=function(){return!0};k.ra=function(){};
|
||||
function Qa(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<x.length;h++)if(x[h].id===f){f=x[h];break a}f=null}f||(a=!0,f=new Oa(e));Ja(f,d);a&&B(f)}}ua(Qa);
|
||||
function Ra(a,b,c){u.call(this,"Bus",a,Ra);this.a=b;this.L=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.h=this.u-1|0;this.c=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.m=1<<this.c;this.v=this.m>>2;this.g=this.m-1;this.l=this.u/this.m|0;this.A=this.l-1;this.o=[];this.s=[];this.B=[];this.F=[];a=new C;Sa(a,this.L);this.b=Array(this.l);for(b=0;b<this.l;b++)this.b[b]=a;B(this)}y(Ra);Ra.prototype.reset=function(){};Ra.prototype.Y=function(a,b){b||this.reset();return!0};
|
||||
function Ta(a,b,c,d){for(var e=b,f=c,h=e>>>a.c;0<f&&h<a.b.length;){var g=a.b[h],l=h*a.m,m=a.m-(e-l);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ea)return g.ab+=g.Ea-e,g.Ea=e,!0;if(e>=g.Ea+g.ab){m=g.size-(e-l);m>f&&(m=f);g.ab=e-g.Ea+m;e=l+a.m;f-=m;h++;continue}}return Ua(1,e,f)}e=new C(e,m,a.m,d);Sa(e,a.L,g);a.b[h++]=e;e=l+a.m;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+("0x"+n(b,4))),!0):Ua(2,b,c)}
|
||||
Ra.prototype.I=function(a){return this.b[(a&this.h)>>>this.c].Na(a&this.g,a)};function Wa(a,b){return a.b[(b&a.h)>>>a.c].$a(b&a.g,b)}function Xa(a,b){var c=b&a.g,d=(b&a.h)>>>a.c;return c!=a.g?a.b[d].Vc(c,b):a.b[d++].Na(c,b)|a.b[d&a.A].Na(0,b+1)<<8}Ra.prototype.T=function(a,b){this.b[(a&this.h)>>>this.c].Oa(a&this.g,b&255,a)};function Ya(a,b,c){a.b[(b&a.h)>>>a.c].Qb(b&a.g,c&255,b)}
|
||||
function Za(a,b,c){var d=b&a.g,e=(b&a.h)>>>a.c;d!=a.g?a.b[e].Wc(d,c&65535,b):(a.b[e++].Oa(d,c&255,b),a.b[e&a.A].Oa(0,c>>8&255,b+1))}function $a(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]?r("Input port 0x"+n(l,4)+" already registered"):f.o[l]=[g,!1]}}
|
||||
function ab(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.s[l]?r("Output port 0x"+n(l,4)+" already registered"):f.s[l]=[g,!1]}}function Ua(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var bb;if(Ma){var cb=new ArrayBuffer(2);(new DataView(cb)).setUint16(0,256,!0);bb=256===(new Uint16Array(cb))[0]}else bb=!1;var db=bb;
|
||||
function C(a,b,c,d){this.id=eb+=2;this.a=null;this.Ea=a;this.ab=b;this.size=c||0;this.type=d||fb;this.w=d==gb;Sa(this);this.ea=this.Gb=!1;if(c)if(Ma)this.c=new ArrayBuffer(c),this.m=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.i=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),hb(this,db?ib:jb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;hb(this,kb)}else hb(this)}var fb=0,gb=2,Va=["NONE","RAM","ROM","VID","H/W"],eb=0;
|
||||
C.prototype={constructor:C,parent:null,save:function(){var a,b;if(Ma)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.m.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(Ma)for(b=0;b<a.length;b++)this.m.setInt32(b<<2,a[b],!0);else this.a=a;return this.ea=!0}return!1},l:function(){return 255},s:function(){},o:function(a,b){return this.Na(a++,b++)|this.Na(a,b)<<8},A:function(a,b,c){this.Oa(a++,b&255,c++);this.Oa(a,b>>8,c)},F:function(a){return this.a[a>>
|
||||
2]>>>((a&3)<<3)&255},N: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},ga:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.ea=!0},ta: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.ea=!0},v:function(a,b){return this.$a(a,b)},H:function(a,b){return this.Ob(a,b)},U:function(a,b,c){this.w||this.Qb(a,b,c)},ca:function(a,
|
||||
b,c){this.w||this.ja(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.m.getUint16(a,!0)},K:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},O:function(a,b){this.b[a]=b;this.ea=!0},V:function(a,b){this.b[a]=b;this.ea=!0},ha:function(a,b){this.m.setUint16(a,b,!0);this.ea=!0},ka:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.ea=!0}};
|
||||
function Sa(a,b,c){a.L=b;a.g=a.h=0;c&&((a.g=c.g)&&lb(a,mb,!1),(a.h=c.h)&&nb(a,mb,!1))}function nb(a,b,c){c&&a.h||(a.Oa=!a.w&&b[2]||a.s,a.Wc=!a.w&&b[3]||a.A);if(c||void 0===c)a.Qb=b[2]||a.s,a.ja=b[3]||a.A}function lb(a,b,c){c&&a.g||(a.Na=b[0]||a.l,a.Vc=b[1]||a.o);if(c||void 0===c)a.$a=b[0]||a.l,a.Ob=b[1]||a.o}function hb(a,b){b||(b=ob);lb(a,b,void 0);nb(a,b,void 0)}var ob=[],kb=[C.prototype.F,C.prototype.N,C.prototype.ga,C.prototype.ta],mb=[C.prototype.v,C.prototype.H,C.prototype.U,C.prototype.ca];
|
||||
if(Ma)var jb=[C.prototype.u,C.prototype.G,C.prototype.O,C.prototype.ha],ib=[C.prototype.B,C.prototype.K,C.prototype.V,C.prototype.ka];
|
||||
function pb(a,b){u.call(this,"CPU",a,pb);var c=a.cycles||b,d=a.multiplier||1;this.c={};this.c.Aa=c;this.c.Xa=0;this.c.za=d;this.c.kb=Math.round(this.c.Aa/1E4)/100;this.c.wa=this.c.kb*this.c.za;this.j.fa=!1;this.j.Ib=!1;this.j.Fb=a.autoStart;this.j.Hb=!1;this.j.Ra=!1;this.c.Va=this.c.ya=0;this.c.Wa=a.csStart;this.c.Ga=a.csInterval;this.c.Ha=a.csStop;this.ka=this.ob.bind(this);B(this)}y(pb);var qb=["power","reset"];k=pb.prototype;
|
||||
k.ia=function(a,b,c,d){this.A=a;this.m=b;this.L=d;for(b=0;b<qb.length;b++)(c=this.w[qb[b]])&&this.A.R(null,qb[b],c);this.V=(b=Pa(a,"Video"))&&Math.max(b.xc,b.ib)||60;this.G=Pa(a,"ChipSet");a=rb(a,"autoStart");null!=a&&(this.j.Fb="true"==a?!0:"false"==a?!1:!!a);B(this)};k.reset=function(){this.c.Xa=0};k.save=function(){return null};k.restore=function(){return!1};
|
||||
k.Y=function(a,b){if(!b){if(a&&this.restore){sb(this);if(!this.restore(a))return!1;tb(this)}else this.reset();this.Z("No debugger detected")}ub(this);return!0};k.ba=function(a){return a?this.save():!0};function vb(a){(a.j.Fb||void 0===a.w.run)&&a.ob(!0)}k.Jb=function(){return 0};function tb(a){void 0===a.c.Wa&&(a.c.Wa=0);void 0===a.c.Ga&&(a.c.Ga=-1);void 0===a.c.Ha&&(a.c.Ha=-1);a.j.Ra=0<=a.c.Wa&&0<a.c.Ga;a.j.Ra&&(a.c.Va=0,a.c.ya=a.c.Wa-a.O)}
|
||||
k.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.S)a=!0;else{var b=null,c,g=Ha(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.j.va);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.j.S);c++);c==g.length&&(b=a);r("The "+b.type+" component ("+b.id+") is not "+(b.j.va?"powered yet":"ready yet"+(b.Ta?" (waiting for notification)":""))+".");a=!1}a&&(d.j.fa?wb(d,!0):d.ob(!0))};a=!0;
|
||||
break;case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){xb(d,d.c.za<<1,!0)},c.textContent=this.c.wa.toFixed(2)+"Mhz",a=!0}return a};function yb(a,b,c){a.O+=b;c&&(a.N=a.a=0)}
|
||||
function zb(a,b){var c=30;c<a.V&&(c=a.V);2>c&&(c=2);var d=1;b&&1<a.c.za&&a.c.pa&&(d=a.c.pa/a.c.kb);a.c.Kb=Math.round(1E3/30);a.c.Hc=Math.floor(a.c.Aa/c*d);a.c.mb=Math.floor(a.c.Aa/30*d);a.c.Mb=Math.floor(a.c.Aa/a.V*d);a.c.Lb=Math.floor(a.c.Aa/2*d);b||(a.c.Ka=a.c.mb,a.c.Ja=a.c.Mb,a.c.Ia=a.c.Lb);a.c.nb=0}function Ab(a){return a.O+a.K+a.N-a.a}function sb(a){a.c.pa=0;a.O=a.K=a.N=a.a=0;tb(a);xb(a,1)}
|
||||
function xb(a,b,c){if(void 0!==b){.8>a.c.pa/a.c.wa&&(b=1);a.c.za=b;b=a.c.kb*a.c.za;if(a.c.wa!=b){a.c.wa=b;b=a.c.wa.toFixed(2)+"Mhz";var d=a.w.setSpeed;d&&(d.textContent=b);a.Z("target speed: "+b)}c&&a.A&&Bb(a.A)}yb(a,a.K);a.K=0;a.c.xa=ha();a.c.qa=0;zb(a)}
|
||||
k.ob=function(a){if(Ka(this,!0)){if(!this.j.fa){xb(this);this.A&&this.A.start(this.c.xa,Ab(this));this.j.fa=!0;this.j.Ib=!0;this.G&&this.G.start();var b=this.w.run;b&&(b.textContent="Halt");this.A&&(this.A.ra(!0),a&&Bb(this.A,!0))}this.c.nb>=this.c.Aa&&zb(this,!0);this.c.La=0;this.c.Ua=ha();this.c.qa&&(a=this.c.Ua-this.c.qa,a>this.c.Kb&&(this.c.xa+=a,this.c.xa>this.c.Ua&&(this.c.xa=this.c.Ua)));try{do{this.Pb(this.j.Ra?1:this.c.Hc);var c=this.N-this.a;this.K+=c;this.c.La+=c;yb(this,0,!0);a=c;this.j.Ra&&
|
||||
(b=!1,this.c.Va=this.c.Va+this.Jb()|0,this.c.ya-=a,0>=this.c.ya&&(this.c.ya+=this.c.Ga,b=!0),0<=this.c.Ha&&this.c.Ha<=Ab(this)&&(this.c.Ga=this.c.Ha=-1,tb(this),wb(this),b=!0),b&&this.Z(Ab(this)+" cycles: checksum="+n(this.c.Va)));this.c.Ja-=c;0>=this.c.Ja&&(this.c.Ja+=this.c.Mb,this.A&&Cb(this.A,this.c.Xa++),this.c.Xa>this.V&&(this.c.Xa=0));this.c.Ia-=c;0>=this.c.Ia&&(this.c.Ia+=this.c.Lb,this.A&&this.A.ra());this.c.Ka-=c;if(0>=this.c.Ka){this.c.Ka+=this.c.mb;break}}while(this.j.fa)}catch(e){wb(this);
|
||||
ub(this);this.A&&this.A.stop(ha(),Ab(this));Ka(this,!1);c=e.stack||e.message;this.j.oa=!0;this.J(c);return}c=setTimeout;a=this.ka;this.c.qa=ha();b=this.c.Kb;this.c.La&&(b=Math.round(b*this.c.La/this.c.mb));var b=b-(this.c.qa-this.c.Ua),d=this.c.qa-this.c.xa;d&&(this.c.pa=Math.round(this.K/(10*d))/100,864E5<=d&&(this.O=0,xb(this)));if(0>b||this.c.pa<this.c.wa)b=0;this.c.nb+=this.c.La;this.c.qa+=b;c(a,b)}else ub(this),this.A&&this.A.stop(ha(),Ab(this))};k.Pb=function(){return 0};
|
||||
function wb(a,b){a.j.Fa&&(a.j.jb=!0);a.N-=a.a;a.a=0;yb(a,a.K);a.K=0;if(a.j.fa){a.j.fa=!1;a.G&&a.G.stop();var c=a.w.run;c&&(c.textContent="Run")}a.j.Sa=b}function ub(a){a.A&&(Cb(a.A,-1),a.A.ra(void 0))}function Db(a){this.ja=+a.model||8080;pb.call(this,a,1E6);this.ga=Eb;sb(this);this.j.Sa=this.j.yc=!1;this.ca=0;this.U=[];this.ha=0;Fb(this)}y(Db,pb);function Gb(a,b){a.U.push(b)}k=Db.prototype;k.reset=function(){this.j.fa&&wb(this);Fb(this);sb(this);this.j.oa=!1;this.parent.reset.call(this)};
|
||||
function Fb(a){a.b=0;a.g=0;a.C=0;a.h=0;a.D=0;a.i=0;a.l=0;a.v=0;D(a,a.ha);Ib(a,0);a.F=0}function Jb(a,b){a.ha=b;D(a,b)}k.Jb=function(){var a=this.b+this.g+this.C+this.h+this.D+this.i+this.l|0;return a=a+this.v+this.s+Kb(this)|0};
|
||||
k.save=function(){var a=new E(this);G(a,0,[this.b,this.g,this.C,this.h,this.D,this.i,this.l,this.v,this.s,Kb(this)]);G(a,1,[this.F,this.O,this.c.za]);for(var b=this.m,c=0,d=[],e=0;e<b.l;e++){var f=b.b[e];if(f.ea||f.Gb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,l=0,m=[];g<f.length;){for(var t=f[g],p=g+1;p<f.length&&f[p]===t;)p++;m[l++]=p-g;m[l++]=t;g=p}if(m.length<f.length){f=m;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.g=b[1];this.C=b[2];this.h=b[3];this.D=b[4];this.i=b[5];this.l=b[6];this.v=b[7]&65535;D(this,b[8]);Ib(this,b[9]);b=a[1];this.F=b[0];this.O=b[1];xb(this,b[3]);a:{b=this.m;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.v){for(var f=0,h=Array(b.v),g=0;g<e.length-1;)for(var l=e[g++],m=e[g++];l--;)h[f++]=m;e=h}f=b.b[d];if(!f||!f.restore(e)){r("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
k.R=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.w[b]=c;this.ca++;d=!0;break;default:d=this.parent.R.call(this,a,b,c)}return d};function Lb(a){return a.g<<8|a.C}function Mb(a,b){a.g=b>>8&255;a.C=b&255}function Nb(a){return a.h<<8|a.D}function Ob(a,b){a.h=b>>8&255;a.D=b&255}function H(a){return a.i<<8|a.l}
|
||||
function K(a,b){a.i=b>>8&255;a.l=b&255}function D(a,b){a.s=b&65535}function L(a){return a.o&256?1:0}function M(a,b){a.o=a.o&255|b}function Pb(a){return Na[a.u&255]?4:0}function Kb(a){return a.H&-214|(a.u&128?128:0)|(a.o&255?0:64)|((a.u^a.B)&16?16:0)|Pb(a)|L(a)}function Ib(a,b){a.o=a.u=a.B=0;b&1&&(a.o|=256);b&4||(a.u|=1);b&16&&(a.B|=16);b&64||(a.o|=255);b&128&&(a.u^=192);a.H=a.H&-726|b&512|2}function Qb(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b)&255}
|
||||
function Rb(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?1:0))&255}function Sb(a,b){a.o=a.u=a.B=a.b&b;(a.b|b)&8&&(a.B^=16);return a.o}function Tb(a,b){a.B=b^255;b=a.u=b+255&255;a.o=a.o&-256|b;return b}function Ub(a,b){a.B=b;b=a.u=b+1&255;a.o=a.o&-256|b;return b}function Vb(a,b){return a.u=a.o=a.B=a.b|b}function N(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+1^256)&255}function Wb(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function Xb(a,b){return a.u=a.o=a.B=a.b^b}k.I=function(a){return this.m.I(a)};
|
||||
k.T=function(a,b){this.m.T(a,b)};function O(a){var b=a.I(a.s);D(a,a.s+1);return b}function P(a){var b=Xa(a.m,a.s);D(a,a.s+2);return b}function R(a){var b=Xa(a.m,a.v);a.v=a.v+2&65535;return b}function T(a,b){a.v=a.v-2&65535;Za(a.m,a.v,b)}function Yb(a,b){a.F=a.F&-8|b|8}function U(a,b,c,d){d=d||2;a.w[b]&&(void 0===c&&(a.j.oa=!0,a.J("Value for "+b+" is invalid"),wb(a)),c=!a.j.fa||a.j.Hb?n(c,d):"--------".substr(0,d),a.w[b].textContent!=c&&(a.w[b].textContent=c))}
|
||||
k.ra=function(a){this.ca&&(a||!this.j.fa||this.j.Hb)&&(U(this,"A",this.b),U(this,"B",this.g),U(this,"C",this.C),U(this,"BC",Lb(this),4),U(this,"D",this.h),U(this,"E",this.D),U(this,"DE",Nb(this),4),U(this,"H",this.i),U(this,"L",this.l),U(this,"HL",H(this),4),U(this,"SP",this.v,4),U(this,"PC",this.s,4),a=Kb(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.w.speed)a.textContent=
|
||||
this.j.fa&&this.c.pa?this.c.pa.toFixed(2)+"Mhz":"Stopped"};k.Pb=function(a){this.j.Sa=!0;this.j.yc=!1;this.j.Ib=!1;this.N=this.a=a;do{if(this.F){if(a&&this.F&8&&this.H&512){var b=199|(this.F&7)<<3;this.F&=-17;this.F&=-16;this.H&=-513;this.ga[b].call(this)}if(this.F&16){this.a=0;break}}this.ga[O(this)].call(this)}while(0<this.a);return this.j.Sa?this.N-this.a:void 0===this.j.Sa?0:-1};ua(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Db(d);Ja(d,c)}});
|
||||
function Zb(){this.a-=4}function $b(){D(this,P(this));this.a-=10}function ac(){D(this,R(this));this.a-=10}function bc(){var a=P(this);T(this,this.s);D(this,a);this.a-=17}
|
||||
var Eb=[Zb,function(){Mb(this,P(this));this.a-=10},function(){this.T(Lb(this),this.b);this.a-=7},function(){Mb(this,Lb(this)+1);this.a-=5},function(){this.g=Ub(this,this.g);this.a-=5},function(){this.g=Tb(this,this.g);this.a-=5},function(){this.g=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;M(this,a&256);this.a-=4},Zb,function(){var a;K(this,a=H(this)+Lb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.I(Lb(this));this.a-=7},function(){Mb(this,Lb(this)-1);this.a-=5},function(){this.C=
|
||||
Ub(this,this.C);this.a-=5},function(){this.C=Tb(this,this.C);this.a-=5},function(){this.C=O(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;M(this,a);this.a-=4},Zb,function(){Ob(this,P(this));this.a-=10},function(){this.T(Nb(this),this.b);this.a-=7},function(){Ob(this,Nb(this)+1);this.a-=5},function(){this.h=Ub(this,this.h);this.a-=5},function(){this.h=Tb(this,this.h);this.a-=5},function(){this.h=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|L(this);M(this,a&256);
|
||||
this.a-=4},Zb,function(){var a;K(this,a=H(this)+Nb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.I(Nb(this));this.a-=7},function(){Ob(this,Nb(this)-1);this.a-=5},function(){this.D=Ub(this,this.D);this.a-=5},function(){this.D=Tb(this,this.D);this.a-=5},function(){this.D=O(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},Zb,function(){K(this,P(this));this.a-=10},function(){var a=P(this);Za(this.m,a,H(this));this.a-=16},function(){K(this,
|
||||
H(this)+1);this.a-=5},function(){this.i=Ub(this,this.i);this.a-=5},function(){this.i=Tb(this,this.i);this.a-=5},function(){this.i=O(this);this.a-=7},function(){var a=0,b=L(this);if((this.u^this.B)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=Qb(this,a);M(this,b?256:0);this.a-=4},Zb,function(){var a;K(this,a=H(this)+H(this));M(this,a>>8&256);this.a-=10},function(){var a;a=P(this);a=Xa(this.m,a);K(this,a);this.a-=16},function(){K(this,H(this)-1);this.a-=5},function(){this.l=Ub(this,this.l);
|
||||
this.a-=5},function(){this.l=Tb(this,this.l);this.a-=5},function(){this.l=O(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},Zb,function(){this.v=P(this)&65535;this.a-=10},function(){this.T(P(this),this.b);this.a-=13},function(){this.v=this.v+1&65535;this.a-=5},function(){var a=H(this);this.T(a,Ub(this,this.I(a)));this.a-=10},function(){var a=H(this);this.T(a,Tb(this,this.I(a)));this.a-=10},function(){this.T(H(this),O(this));this.a-=10},function(){this.o|=256;this.a-=4},Zb,function(){var a;
|
||||
K(this,a=H(this)+this.v);M(this,a>>8&256);this.a-=10},function(){this.b=this.I(P(this));this.a-=13},function(){this.v=this.v-1&65535;this.a-=5},function(){this.b=Ub(this,this.b);this.a-=5},function(){this.b=Tb(this,this.b);this.a-=5},function(){this.b=O(this);this.a-=7},function(){M(this,L(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.g=this.C;this.a-=5},function(){this.g=this.h;this.a-=5},function(){this.g=this.D;this.a-=5},function(){this.g=this.i;this.a-=5},function(){this.g=this.l;
|
||||
this.a-=5},function(){this.g=this.I(H(this));this.a-=7},function(){this.g=this.b;this.a-=5},function(){this.C=this.g;this.a-=5},function(){this.a-=5},function(){this.C=this.h;this.a-=5},function(){this.C=this.D;this.a-=5},function(){this.C=this.i;this.a-=5},function(){this.C=this.l;this.a-=5},function(){this.C=this.I(H(this));this.a-=7},function(){this.C=this.b;this.a-=5},function(){this.h=this.g;this.a-=5},function(){this.h=this.C;this.a-=5},function(){this.a-=5},function(){this.h=this.D;this.a-=
|
||||
5},function(){this.h=this.i;this.a-=5},function(){this.h=this.l;this.a-=5},function(){this.h=this.I(H(this));this.a-=7},function(){this.h=this.b;this.a-=5},function(){this.D=this.g;this.a-=5},function(){this.D=this.C;this.a-=5},function(){this.D=this.h;this.a-=5},function(){this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.l;this.a-=5},function(){this.D=this.I(H(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.i=this.g;this.a-=5},function(){this.i=this.C;this.a-=
|
||||
5},function(){this.i=this.h;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.a-=5},function(){this.i=this.l;this.a-=5},function(){this.i=this.I(H(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.l=this.g;this.a-=5},function(){this.l=this.C;this.a-=5},function(){this.l=this.h;this.a-=5},function(){this.l=this.D;this.a-=5},function(){this.l=this.i;this.a-=5},function(){this.a-=5},function(){this.l=this.I(H(this));this.a-=7},function(){this.l=this.b;this.a-=5},function(){this.T(H(this),
|
||||
this.g);this.a-=7},function(){this.T(H(this),this.C);this.a-=7},function(){this.T(H(this),this.h);this.a-=7},function(){this.T(H(this),this.D);this.a-=7},function(){this.T(H(this),this.i);this.a-=7},function(){this.T(H(this),this.l);this.a-=7},function(){var a=this.s-1;if(this.U.length)for(var b=0;b<this.U.length;b++)if(this.U[b](a))return;this.F|=16;this.a-=7;this.H&512||wb(this)},function(){this.T(H(this),this.b);this.a-=7},function(){this.b=this.g;this.a-=5},function(){this.b=this.C;this.a-=5},
|
||||
function(){this.b=this.h;this.a-=5},function(){this.b=this.D;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.l;this.a-=5},function(){this.b=this.I(H(this));this.a-=7},function(){this.a-=5},function(){this.b=Qb(this,this.g);this.a-=4},function(){this.b=Qb(this,this.C);this.a-=4},function(){this.b=Qb(this,this.h);this.a-=4},function(){this.b=Qb(this,this.D);this.a-=4},function(){this.b=Qb(this,this.i);this.a-=4},function(){this.b=Qb(this,this.l);this.a-=4},function(){this.b=Qb(this,
|
||||
this.I(H(this)));this.a-=7},function(){this.b=Qb(this,this.b);this.a-=4},function(){this.b=Rb(this,this.g);this.a-=4},function(){this.b=Rb(this,this.C);this.a-=4},function(){this.b=Rb(this,this.h);this.a-=4},function(){this.b=Rb(this,this.D);this.a-=4},function(){this.b=Rb(this,this.i);this.a-=4},function(){this.b=Rb(this,this.l);this.a-=4},function(){this.b=Rb(this,this.I(H(this)));this.a-=7},function(){this.b=Rb(this,this.b);this.a-=4},function(){this.b=N(this,this.g);this.a-=4},function(){this.b=
|
||||
N(this,this.C);this.a-=4},function(){this.b=N(this,this.h);this.a-=4},function(){this.b=N(this,this.D);this.a-=4},function(){this.b=N(this,this.i);this.a-=4},function(){this.b=N(this,this.l);this.a-=4},function(){this.b=N(this,this.I(H(this)));this.a-=7},function(){this.b=N(this,this.b);this.a-=4},function(){this.b=Wb(this,this.g);this.a-=4},function(){this.b=Wb(this,this.C);this.a-=4},function(){this.b=Wb(this,this.h);this.a-=4},function(){this.b=Wb(this,this.D);this.a-=4},function(){this.b=Wb(this,
|
||||
this.i);this.a-=4},function(){this.b=Wb(this,this.l);this.a-=4},function(){this.b=Wb(this,this.I(H(this)));this.a-=7},function(){this.b=Wb(this,this.b);this.a-=4},function(){this.b=Sb(this,this.g);this.a-=4},function(){this.b=Sb(this,this.C);this.a-=4},function(){this.b=Sb(this,this.h);this.a-=4},function(){this.b=Sb(this,this.D);this.a-=4},function(){this.b=Sb(this,this.i);this.a-=4},function(){this.b=Sb(this,this.l);this.a-=4},function(){this.b=Sb(this,this.I(H(this)));this.a-=7},function(){this.b=
|
||||
Sb(this,this.b);this.a-=4},function(){this.b=Xb(this,this.g);this.a-=4},function(){this.b=Xb(this,this.C);this.a-=4},function(){this.b=Xb(this,this.h);this.a-=4},function(){this.b=Xb(this,this.D);this.a-=4},function(){this.b=Xb(this,this.i);this.a-=4},function(){this.b=Xb(this,this.l);this.a-=4},function(){this.b=Xb(this,this.I(H(this)));this.a-=7},function(){this.b=Xb(this,this.b);this.a-=4},function(){this.b=Vb(this,this.g);this.a-=4},function(){this.b=Vb(this,this.C);this.a-=4},function(){this.b=
|
||||
Vb(this,this.h);this.a-=4},function(){this.b=Vb(this,this.D);this.a-=4},function(){this.b=Vb(this,this.i);this.a-=4},function(){this.b=Vb(this,this.l);this.a-=4},function(){this.b=Vb(this,this.I(H(this)));this.a-=7},function(){this.b=Vb(this,this.b);this.a-=4},function(){N(this,this.g);this.a-=4},function(){N(this,this.C);this.a-=4},function(){N(this,this.h);this.a-=4},function(){N(this,this.D);this.a-=4},function(){N(this,this.i);this.a-=4},function(){N(this,this.l);this.a-=4},function(){N(this,
|
||||
this.I(H(this)));this.a-=7},function(){N(this,this.b);this.a-=4},function(){this.o&255&&(D(this,R(this)),this.a-=6);this.a-=5},function(){Mb(this,R(this));this.a-=10},function(){var a=P(this);this.o&255&&D(this,a);this.a-=10},$b,function(){var a=P(this);this.o&255&&(T(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){T(this,Lb(this));this.a-=11},function(){this.b=Qb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,0);this.a-=11},function(){this.o&255||(D(this,R(this)),this.a-=6);this.a-=
|
||||
5},ac,function(){var a=P(this);this.o&255||D(this,a);this.a-=10},$b,function(){var a=P(this);this.o&255||(T(this,this.s),D(this,a),this.a-=6);this.a-=11},bc,function(){this.b=Rb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,8);this.a-=11},function(){L(this)||(D(this,R(this)),this.a-=6);this.a-=5},function(){Ob(this,R(this));this.a-=10},function(){var a=P(this);L(this)||D(this,a);this.a-=10},function(){for(var a=O(this),b=this.m,c=this.b,d=this.s+-2&65535,e=1,f=0;0<e;){var h=b.s[a],g=b.F[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);L(this)||(T(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){T(this,Nb(this));this.a-=11},function(){this.b=N(this,O(this));this.a-=7},function(){T(this,this.s);D(this,16);this.a-=11},function(){L(this)&&(D(this,R(this)),this.a-=6);this.a-=5},ac,function(){var a=P(this);L(this)&&D(this,a);this.a-=10},function(){for(var a=O(this),b=this.m,c=this.s+-2&65535,d=1,e=0,
|
||||
f=0;0<d;){var h=b.o[a],g=b.B[a]||1,l=1==g?255:2==g?65535:-1,m=l;void 0!==h&&h[0]&&(m=h[0](a,c),void 0===m?m=l:m&=l);e|=m<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=P(this);L(this)&&(T(this,this.s),D(this,a),this.a-=6);this.a-=11},bc,function(){this.b=Wb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,24);this.a-=11},function(){Pb(this)||(D(this,R(this)),this.a-=6);this.a-=5},function(){K(this,R(this));this.a-=10},function(){var a=P(this);Pb(this)||D(this,a);this.a-=10},
|
||||
function(){var a=R(this);T(this,H(this));K(this,a);this.a-=18},function(){var a=P(this);Pb(this)||(T(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){T(this,H(this));this.a-=11},function(){this.b=Sb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,32);this.a-=11},function(){Pb(this)&&(D(this,R(this)),this.a-=6);this.a-=5},function(){D(this,H(this));this.a-=5},function(){var a=P(this);Pb(this)&&D(this,a);this.a-=10},function(){var a=H(this);K(this,Nb(this));Ob(this,a);this.a-=5},function(){var a=
|
||||
P(this);Pb(this)&&(T(this,this.s),D(this,a),this.a-=6);this.a-=11},bc,function(){this.b=Xb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,40);this.a-=11},function(){this.u&128||(D(this,R(this)),this.a-=6);this.a-=5},function(){var a=R(this);Ib(this,a&255|this.H&-256);this.b=a>>8;this.a-=10},function(){var a=P(this);this.u&128||D(this,a);this.a-=10},function(){this.H&=-513;this.a-=4},function(){var a=P(this);this.u&128||(T(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){T(this,
|
||||
Kb(this)&255|this.b<<8);this.a-=11},function(){this.b=Vb(this,O(this));this.a-=7},function(){T(this,this.s);D(this,48);this.a-=11},function(){this.u&128&&(D(this,R(this)),this.a-=6);this.a-=5},function(){this.v=H(this)&65535;this.a-=5},function(){var a=P(this);this.u&128&&D(this,a);this.a-=10},function(){this.H|=512;this.a-=4},function(){var a=P(this);this.u&128&&(T(this,this.s),D(this,a),this.a-=6);this.a-=11},bc,function(){N(this,O(this));this.a-=7},function(){T(this,this.s);D(this,56);this.a-=
|
||||
11}];function V(a){u.call(this,"ChipSet",a,V);var b=a.model;b&&!cc[b]&&wa("Unrecognized ChipSet model: "+b);this.c=cc[b]||{};a.sound&&(this.F=null,window&&(this.F=window.AudioContext||window.webkitAudioContext),this.F&&new this.F);B(this)}y(V);
|
||||
var W={W:1978.1,pc:{X:0,gd:1,md:16,zd:32,Nd:64,Ld:128,Ba:14},na:{X:1,Wb:1,lc:2,hc:4,ic:16,jc:32,kc:64,Ba:8},qc:{X:2,fd:3,Xd:4,hd:8,Hd:16,Id:32,Jd:64,jd:128,Ba:0},Rd:{X:3},Pd:{X:2,Bd:7},Td:{X:3,Zd:1,Sd:2,Kd:4,ud:8,kd:16,Yc:32},Qd:{X:4},Ud:{X:5,nd:1,od:2,pd:4,qd:8,$d:16}},X={W:100,la:{X:66,de:1,fc:2,gc:4,Fd:8,Dd:16,vb:32,ub:64,qb:128},Vb:{X:66,INIT:0},da:{yd:{X:98},sa:{Tb:0,Sb:1,nc:2,tc:4,Zb:5,mc:6,Vd:7},Pa:16383},Yb:{X:162,INIT:0},Xb:{X:194,INIT:0}},cc={SI1978:W,VT100:X};V.prototype.R=function(){return!1};
|
||||
V.prototype.ia=function(a,b,c,d){this.m=b;this.a=c;this.L=d;this.A=a;this.o=Pa(a,"Keyboard");$a(b,this,this.c.Ya);ab(b,this,this.c.Za)};V.prototype.Y=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};V.prototype.ba=function(a){return a?this.save():!0};W.INIT=[[W.pc.Ba,W.na.Ba,W.qc.Ba,0,0,0,0]];
|
||||
X.INIT=[[X.Vb.INIT,X.la.fc|X.la.gc,X.Yb.INIT,X.Xb.INIT],[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,11856,11824,11840,11808,11776,12E3,12E3,11857,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.J("reset error")};k.save=function(){var a=new E(this);switch(this.c.W){case W.W:G(a,0,[this.U,this.g,this.V,this.u,this.B,this.N,this.O]);break;case X.W:G(a,0,[this.G,this.i,this.K,this.H]),G(a,1,[this.s,this.b,this.l,this.v,this.h])}return a.data()};
|
||||
k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.W){case W.W:return this.U=b[0],this.g=b[1],this.V=b[2],this.u=b[3],this.B=b[4],this.N=b[5],this.O=b[6],!0;case X.W:return this.G=b[0],this.i=b[1],this.K=b[2],this.H=b[3],b=a[1],this.s=b[0],this.b=b[1],this.l=b[2],this.v=b[3],this.h=b[4],!0}return!1};k.start=function(){};k.stop=function(){};function dc(a,b,c){a.g&=~b;c&&(a.g|=b)}k.Cc=function(){return this.U};k.Dc=function(){return this.g};k.Ec=function(){return this.V};
|
||||
k.Bc=function(){return this.u>>8-this.B&255};k.Lc=function(a,b){this.B=b};k.Nc=function(a,b){this.N=b};k.Mc=function(a,b){this.u=b<<8|this.u>>8};k.Oc=function(a,b){this.O=b};k.Pc=function(){};function ec(a){var b=0,c=0,d=~a.s;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.Fc=function(){var a=this.i,a=a&~X.la.ub;if((Ab(this.a)&64)<<1&&(a|=X.la.ub,a!=this.i)){var b,c;b=this.l&1;switch(this.l>>1&7){case X.da.sa.Sb:this.s=this.s<<1|b;break;case X.da.sa.Zb:b=ec(this);this.h[b]=X.da.Pa;break;case X.da.sa.Tb:this.b=this.b<<1|b;break;case X.da.sa.tc:b=ec(this);c=this.b&X.da.Pa;this.h[b]=c;break;case X.da.sa.mc:b=ec(this);c=this.h[b];null==c&&(c=X.da.Pa);this.b=c;break;case X.da.sa.nc:this.b<<=1,this.v=this.b&X.da.Pa+1}}a&=~X.la.vb;this.v&&(a|=X.la.vb);a&=~X.la.qb;this.o&&
|
||||
(a|=X.la.qb);return this.i=a};k.Qc=function(a,b){this.G=b};k.Tc=function(a,b){this.l=b};k.Sc=function(a,b){this.K=b};k.Rc=function(a,b){this.H=b};W.Ya={0:V.prototype.Cc,1:V.prototype.Dc,2:V.prototype.Ec,3:V.prototype.Bc};W.Za={2:V.prototype.Lc,3:V.prototype.Nc,4:V.prototype.Mc,5:V.prototype.Oc,6:V.prototype.Pc};X.Ya={66:V.prototype.Fc};X.Za={66:V.prototype.Qc,98:V.prototype.Tc,162:V.prototype.Sc,194:V.prototype.Rc};
|
||||
ua(function(){for(var a=A(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new V(d);Ja(d,c)}});function fc(a){u.call(this,"ROM",a,fc);this.b=null;this.l=a.addr;this.c=a.size;this.o=a.writable;this.g=a.alias;this.h=a.file;this.s=ba(this.h);if(this.h){a=this.h;var b=da(this.s);"json"!=b&&"hex"!=b&&(a=ja()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){gc(c,a,b,f)})}}y(fc);var hc=[0,5];
|
||||
fc.prototype.ia=function(a,b,c,d){this.m=b;this.a=c;this.L=d;ic(this)};fc.prototype.Y=function(){this.i&&(this.L&&this.L.a(this.id,this.l,this.c,this.i),delete this.i);return!0};fc.prototype.ba=function(){return!0};
|
||||
function gc(a,b,c,d){if(d)a.J("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.gb,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){r("Empty ROM: "+b);return}if(1==a.b.length){r(a.b[0]);return}}catch(g){a.J("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]);ic(a)}}
|
||||
function ic(a){if(!La(a))if(!a.h)B(a);else if(a.b&&a.m){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+n(a.b.length)+") does not match specified size ("+("0x"+n(a.c))+")";a.j.oa=!0;a.J(b)}else if(jc(a,a.l)){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.m,h=d.c,g=[],l=d.l>>>f.c;0<h&&l<f.b.length;)g.push(f.b[l++]),h-=f.m;f=d.m;d=d.c;h=0;for(e>>>=f.c;0<d&&e<f.b.length;){l=g[h++];if(!l)break;f.b[e++]=l;d-=f.m}}delete a.b}B(a)}}
|
||||
function jc(a,b){if(Ta(a.m,b,a.c,a.o?1:gb)){var c;for(c=0;c<a.b.length;c++)Ya(a.m,b+c,a.b[c]);if(a.o&&256==b){for(c=0;c<hc.length;c++)Ya(a.m,hc[c],118);Gb(a.a,function(a){return function(b){if(0<=hc.indexOf(b)){var c=!1,h=a.a,g=a.L;if(5==b)switch(c=!0,h.C){case 2:kc(a,String.fromCharCode(h.D));break;case 9:for(var l=Nb(h),m="",t=255;t--;){var p=a.a.I(l++);if(36==p)break;m+=String.fromCharCode(p)}kc(a,m);break;default:c=!1}c?ac.call(h):g&&(a.Z("\nCP/M vector 0x"+n(b,4)),D(h,b),wb(g));b=!0}else b=!1;
|
||||
return b}}(a));Jb(a.a,b)}return!0}return!1}function kc(a,b){b=b.replace(/\r/g,"");a.ma&&(a.ma.value+=b,a.ma.scrollTop=a.ma.scrollHeight)}ua(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new fc(d);Ja(d,c)}});function lc(a){u.call(this,"RAM",a,lc);this.g=a.addr;this.c=a.size;this.b=!1}y(lc);k=lc.prototype;k.ia=function(a,b,c,d){this.m=b;this.a=c;this.L=d;B(this)};k.Y=function(a,b){b||this.reset();return!0};k.ba=function(a){return a?this.save():!0};
|
||||
k.reset=function(){!this.b&&this.c&&Ta(this.m,this.g,this.c,1)&&(this.b=!0);this.b||r("No RAM allocated")};k.save=function(){return null};k.restore=function(){return!0};ua(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new lc(d);Ja(d,c)}});function mc(a){u.call(this,"Keyboard",a,mc);(a=a.model)&&!nc[a]&&wa("Unrecognized Keyboard model: "+a);this.c=nc[a]||{};this.reset();B(this)}y(mc);
|
||||
var Y={bd:1,cd:3,dd: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,Xc:65,Zc:66,$c:67,ed:68,E:69,ld:70,rd:71,sd:72,td:73,vd:74,wd:75,xd:76,Ad:77,Cd:78,Ed:79,Gd:80,Q:81,Md:82,Od:83,Wd:84,Yd:85,ae:86,be:87,ce:88,ee:89,fe:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ge:97,he:98,ie:99,d:100,e:101,je:102,ke:103,le:104,me:105,ne:106,k:107,oe:108,
|
||||
pe:109,n:110,qe:111,p:112,q:113,r:114,re:115,t:116,se:117,te:118,ue:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},oc={65:37,68:39,76:32},pc={W:1978.1,f:{},Ca:{},Da:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={W:100,f:{},Ca:{},Da:{},Ub:{X:130,INIT:127},aa:{X:130,dc:1,cc:2,bc:4,ac:8,ec:16,xb:32,rb:63,oc:64,ad:128,INIT:0},$b:127};Z.f[46]=3;Z.f[80]=5;Z.f[79]=6;Z.f[89]=7;Z.f[84]=8;Z.f[87]=9;Z.f[81]=10;Z.f[39]=16;Z.f[Y["]"]]=20;Z.f[Y["}"]]=148;Z.f[Y["["]]=21;Z.f[Y["{"]]=149;Z.f[73]=22;
|
||||
Z.f[85]=23;Z.f[82]=24;Z.f[69]=25;Z.f[Y["1"]]=26;Z.f[Y["!"]]=154;Z.f[37]=32;Z.f[40]=34;Z.f[117]=35;Z.f[19]=35;Z.f[Y["`"]]=36;Z.f[Y["~"]]=164;Z.f[Y["-"]]=37;Z.f[Y._]=165;Z.f[Y["9"]]=38;Z.f[Y["("]]=166;Z.f[Y["7"]]=39;Z.f[Y["&"]]=167;Z.f[Y["4"]]=40;Z.f[Y.$]=168;Z.f[Y["3"]]=41;Z.f[Y["#"]]=169;Z.f[27]=42;Z.f[38]=48;Z.f[114]=49;Z.f[112]=50;Z.f[8]=51;Z.f[Y["="]]=52;Z.f[Y["+"]]=180;Z.f[Y["0"]]=53;Z.f[Y[")"]]=181;Z.f[Y["8"]]=54;Z.f[Y["*"]]=182;Z.f[Y["6"]]=55;Z.f[Y["^"]]=183;Z.f[Y["5"]]=56;Z.f[Y["%"]]=184;
|
||||
Z.f[Y["2"]]=57;Z.f[Y["@"]]=185;Z.f[9]=58;Z.f[103]=64;Z.f[115]=65;Z.f[113]=66;Z.f[96]=67;Z.f[118]=68;Z.f[Y["\\"]]=69;Z.f[Y["|"]]=197;Z.f[76]=70;Z.f[75]=71;Z.f[71]=72;Z.f[70]=73;Z.f[65]=74;Z.f[104]=80;Z.f[2013]=81;Z.f[98]=82;Z.f[97]=83;Z.f[Y["'"]]=85;Z.f[Y['"']]=213;Z.f[Y[";"]]=86;Z.f[Y[":"]]=214;Z.f[74]=87;Z.f[72]=88;Z.f[68]=89;Z.f[83]=90;Z.f[110]=96;Z.f[116]=97;Z.f[101]=98;Z.f[100]=99;Z.f[13]=100;Z.f[Y["."]]=101;Z.f[Y[">"]]=229;Z.f[Y[","]]=102;Z.f[Y["<"]]=230;Z.f[78]=103;Z.f[66]=104;Z.f[88]=105;
|
||||
Z.f[119]=106;Z.f[105]=112;Z.f[99]=113;Z.f[102]=114;Z.f[109]=115;Z.f[Y["/"]]=117;Z.f[Y["?"]]=245;Z.f[77]=118;Z.f[Y[" "]]=119;Z.f[86]=120;Z.f[67]=121;Z.f[90]=122;Z.f[120]=123;Z.f[17]=124;Z.f[16]=125;Z.f[20]=126;Z.Ca={l4:Z.aa.dc,l3:Z.aa.cc,l2:Z.aa.bc,l1:Z.aa.ac,locked:Z.aa.ec,online:Z.aa.xb,local:~Z.aa.xb};var nc={SI1978:pc,VT100:Z};
|
||||
mc.prototype.R=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.w[e]){if("led"==a&&this.c.Ca[b])return this.w[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return qc(d,a,!0)},c.onkeyup=function(a){return qc(d,a,!1)},!0;default:if(this.c.Da&&void 0!==this.c.Da[b])return this.w[e]=c,a=function(a,b){return function(){rc(a,b,!0)}}(this,b),b=function(a,b){return function(){rc(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=
|
||||
b),!0}}return!1};mc.prototype.ia=function(a,b,c,d){this.a=c;this.L=d;this.G=Pa(a,"ChipSet");$a(b,this,this.c.Ya);ab(b,this,this.c.Za)};mc.prototype.Y=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};mc.prototype.ba=function(a){return a?this.save():!0};Z.INIT=[[Z.aa.INIT,Z.Ub.INIT,-1]];k=mc.prototype;k.reset=function(){this.b=[];this.c.INIT&&!this.restore(this.c.INIT)&&this.J("reset error")};
|
||||
k.save=function(){var a=new E(this);switch(this.c.W){case Z.W:G(a,0,[this.h,this.g,-1])}return a.data()};k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.W){case pc.W:return!0;case Z.W:return this.h=b[0],sc(this,this.h&Z.aa.rb),this.g=b[1],this.m=b[2],!0}return!1};function sc(a,b){for(var c in a.c.Ca){var d=a.w["led-"+c];if(d){var e=a.c.Ca[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
||||
function qc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=oc[e]||e,!a.c.f[e]){for(var f in a.c.Da)if(a.c.Da[f]===e){e=f;break a}e=null}e&&(d=rc(a,e,c),b.preventDefault());return d}
|
||||
function rc(a,b,c){var d;a:{for(d=0;d<a.b.length;d++)if(a.b[d].pb==b)break a;d=-1}if(c)0>d?a.b.push({pb:b,lb:Date.now(),Qa:!1}):(a.b[d].lb=Date.now(),a.b[d].Qa=!1);else if(0<=d){if(!a.b[d].Qa){var e=a.b[d].lb;if(e&&100>Date.now()-e)return a.b[d].Qa=!0,uc(a),!0}a.b.splice(d,1)}if(a.G)switch(b){case "1p":dc(a.G,W.na.hc,c);break;case "2p":dc(a.G,W.na.lc,c);break;case "coin":dc(a.G,W.na.Wb,c);break;case "left":dc(a.G,W.na.jc,c);break;case "right":dc(a.G,W.na.kc,c);break;case "fire":dc(a.G,W.na.ic,c)}return!0}
|
||||
function uc(a){for(var b=0,c=-1;b<a.b.length;){if(a.b[b].Qa){var d=a.b[b].pb,e=100-(Date.now()-a.b[b].lb);if(0<e){if(0>c||c>e)c=e}else{rc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){uc(a)},c)}k.Gc=function(){var a=this.g;0<=this.m&&(this.m<this.b.length?(a=this.b[this.m++],a=Z.f[a.pb],a&128&&(a&=127)):(this.m=-1,a=Z.$b),this.g=a,Yb(this.a,1));return a};k.Uc=function(a,b){this.h=b;sc(this,b&Z.aa.rb);b&Z.aa.oc&&(this.m=0,Yb(this.a,1))};Z.Ya={130:mc.prototype.Gc};Z.Za={130:mc.prototype.Uc};
|
||||
ua(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new mc(d);Ja(d,c)}});
|
||||
function vc(a,b,c,d,e){var f=this;this.zb=pa("Gecko/");var h=["","moz","ms","webkit"];u.call(this,"Video",a,vc);this.B=a.screenWidth;this.v=a.screenHeight;this.U=a.bufferAddr;this.vc=a.bufferRAM;var g=a.bufferFormat;this.G=g&&wc[g.toUpperCase()]||xc;this.ca=a.bufferCols;this.H=a.bufferRows;this.rc=this.P=a.cellWidth||1;this.M=a.cellHeight||1;this.bb=null;this.yb=!1;this.ka=a.bufferBits||1;this.wc=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.J("unsupported buffer rotation: "+
|
||||
this.c),this.c=0);this.ib=a.interruptRate;this.xc=a.refreshRate||60;this.u=b;this.g=c;this.ga=(this.Rb=d)||b||null;this.sc=this.B;this.uc=this.v;this.tb=this.B/this.ca|0;this.wb=this.v/this.H|0;1<this.M&&this.H++;b=a.smoothing;(c=Aa.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.g[d]){this.g[d]=b;break}if(this.h=a.screenRotate)this.h=this.h%360,0<this.h&&(this.h-=360),-90!=this.h?(this.J("unsupported screen rotation: "+
|
||||
this.h),this.h=0):(this.g.translate(0,this.v),this.g.rotate(this.h*Math.PI/180),this.g.scale(this.v/this.B,this.B/this.v));if(this.b=e)if(this.b.ua=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.ua){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){yc(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(){yc(f,null)},!1);break}}if(this.K=a.fontROM)"json"!=da(this.K)&&(this.K=ja()+"/api/v1/dump?file="+this.K+"&format=bytes"),q(this.K,null,!0,function(a,b,c){zc(f,a,b,c)});this.hb={}}y(vc);var xc=0,wc={SI1978:1,VT100:2};
|
||||
vc.prototype.ia=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.L=d;this.l=this.ca*this.P;this.F=this.H*this.M;b=this.l;c=this.F;this.c&&(b=this.F,c=this.l);this.ta=(this.l*this.ka>>3)*this.F;if(this.vc||Ta(this.m,this.U,this.ta,3))1<this.P?Ac(this,(this.ca+1)*this.H):(this.Ab=this.g.createImageData(b,c),this.Cb=16/this.ka|0,Ac(this,this.ta>>1)),this.s=document.createElement("canvas"),this.s.width=b,this.s.height=c,this.cb=this.s.getContext("2d"),this.N={},this.ha=1<<this.ka,this.O=Array(this.ha+
|
||||
2),this.O[0]=[0,0,0,255],this.O[1]=[255,255,255,255],1==this.G&&(this.O[this.ha+0]=[255,255,0,255],this.O[this.ha+1]=[0,255,0,255]),2==this.G&&(this.Db=60,this.eb=!1,this.ja=Array(this.ca));if(this.o=Pa(a,"Keyboard")){for(var e in this.hb)this.o.R("led",e,this.hb[e]);this.u&&this.o.R(this.Rb?"textarea":"canvas","kbd",this.ga)}this.K||B(this)};
|
||||
function zc(a,b,c,d){if(d)a.J("Unable to load font ROM (error "+d+": "+b+")");else{Ga(a.gb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){r("Empty font ROM: "+b);return}if(1==f.length){r(f[0]);return}if(2048==f.length)Bc(a,f);else{a.J("Unrecognized font data length ("+f.length+")");return}}catch(h){a.J("Font ROM data error: "+h.message);return}(a.g||a.L)&&B(a)}}
|
||||
function Bc(a,b){a.bb=b;a.yb=2==a.G;a.N[96]=[Cc(a,a.P,a.M),Cc(a,a.P,a.M,a.eb)];a.N[64]=[Cc(a,2*a.P,a.M),Cc(a,2*a.P,a.M,a.eb)];a.N[32]=a.N[0]=[Cc(a,2*a.P,2*a.M),Cc(a,2*a.P,2*a.M,a.eb)]}
|
||||
function Cc(a,b,c,d){var e=8>=a.rc?8:16,f=8<e?15:0,h=a.bb.length/e,g=!1===d,l={P:b,M: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 m=l.context.createImageData(b,c),t=0;t<h;t++){for(var p=0,w=p;p<a.M;p++)for(var ca=t*e+(f+p&e-1),ca=d&&8==p?255:a.bb[ca],I=0;I<c/a.M;I++){for(var S=0,v=0,F=v;v<a.P;v++){for(var J=ca&128>>(7<v?7:v),S=a.yb&&!J&&S?S:J,Q=0;Q<b/a.P;Q++)g&&(S=!S),Dc(a,m,F,w,S?1:0),F++;S=J}w++}l.context.putImageData(m,
|
||||
(t&15)*b,(t>>4)*c)}return l}
|
||||
vc.prototype.Y=function(){if(2==this.G){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.U,c=-1,d=-1,e,f=-(60==this.Db?2:5);f<this.H;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Ya(this.m,b++,e);Ya(this.m,b++,c&255);
|
||||
if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],l=0;l<g.length;l++)Ya(this.m,b++,g.charCodeAt(l)|c);c^=128}Ya(this.m,b++,127);c=b}Ec(this)}return!0};vc.prototype.R=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.hb[b]=c,!0;switch(b){case "fullScreen":return this.w[b]=c,this.b&&this.b.ua?c.onclick=function(){d.ua()}:c.parentNode.removeChild(c),!0}return!1};
|
||||
vc.prototype.ua=function(){var a=!1;if(this.b){if(this.b.ua){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.B/this.v;b>c&&(a=Math.round(c/b*100)+"%")}this.zb?(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.ua();a=!0}this.ga&&this.ga.focus()}return a};
|
||||
function yc(a,b){!b&&a.b&&(a.zb?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function Ac(a,b){a.Bb=b;a.V=!1;if(void 0===a.i||a.i.length!=a.Bb)a.i=Array(a.Bb)}function Dc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.G&&(208<=c&&236>c?e=a.ha+0:28<=c&&72>c&&(e=a.ha+1));a=a.O[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 Ec(a){for(var b=a.U,c=-1,d=0,e=60==a.Db?2:5,f=0,h=0;d<a.H;){var g=0,l=b,m=c,t=a.ca;for(96!=m&&(t>>=1);;){var p=Wa(a.m,l++);if(127==(p&127)){var w=Wa(a.m,l++),c=w&96,b=(w&15)<<8|Wa(a.m,l),b=b+(w&16?8192:16384);break}if(g<t)a.ja[g++]=p;else break}if(e)e--;else{for(;g<a.ja.length;)a.ja[g++]=0;if(0<=m)for(l=a.V&&a.i[f]==t,a.i[f++]=t,t=0;t<g;t++){p=a.ja[t];if(!l||p!==a.i[f]){a.i[f]=p;var w=a,ca=a.cb,I=p&127;if(p=w.N[m][p&128?1:0]){var S=(I&15)*p.P,I=(I>>4)*p.M,v=void 0,F=void 0,J=void 0,Q=void 0,
|
||||
tc=p.P,Hb=p.M;ca?(v=t*w.P,F=d*w.M,J=w.P,Q=w.M):(v=t*w.tb,F=d*w.wb,J=w.tb,Q=w.wb);p.P>w.P&&(v*=2,J*=2);p.M>w.M&&(0==m&&(I+=w.M),Hb=w.M);ca?ca.drawImage(p.canvas,S,I,tc,Hb,v,F,J,Q):(v+=0,F+=0,w.g.drawImage(p.canvas,S,I,tc,Hb,v,F,J,Q))}h++}f++}d++}}a.V=!0;h&&a.cb&&a.g.drawImage(a.s,0,0,a.l,a.F-a.M,0,0,a.sc,a.uc)}
|
||||
ua(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||Aa.aspect);f&&.3<=f&&3.33>=f&&(ta("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");pa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new vc(d,e,h,f,c);Ja(d,c)}});
|
||||
function Fc(a){this.h=+a.adapter;switch(this.h){case 0:this.i=0;break;default:r("Unrecognized serial adapter #"+this.h);return}u.call(this,"SerialPort",a,Fc);var b=a.binding;if("console"!=b){var c;a=Gc;b&&(void 0===c&&(c="Panel"),(c=Ia(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}}y(Fc);var Gc="buffer";k=Fc.prototype;
|
||||
k.R=function(a,b,c){switch(b){case Gc:return this.w[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};k.ia=function(a,b,c,d){this.m=b;this.a=c;this.L=d;this.G=Pa(a,"ChipSet");$a(b,this,Hc,this.i);ab(b,this,Ic,this.i);B(this)};
|
||||
k.Y=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.ba=function(a){return a?this.save():!0};k.reset=function(){Jc(this)};k.save=function(){var a=new E(this),b=0,c=[];c[b++]=this.c;c[b++]=this.b;c[b++]=this.g;G(a,0,c);return a.data()};k.restore=function(a){return Jc(this,a[0])};function Jc(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.c=b[c++];a.b=b[c++];a.g=b[c++];return!0}k.Ac=function(){return this.c};k.zc=function(){return this.b};
|
||||
k.Kc=function(a,b){this.c=b};k.Jc=function(a,b){this.b=b};k.Ic=function(a,b){this.g=b};var Hc={0:Fc.prototype.Ac,1:Fc.prototype.zc},Ic={0:Fc.prototype.Kc,1:Fc.prototype.Jc,2:Fc.prototype.Ic};ua(function(){for(var a=A(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Fc(d);Ja(d,c)}});function E(a,b,c){this.id=a.id;this.key=Kc(a,b,c);this.L=a.L;Lc(this,a.Nb)}function Kc(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}
|
||||
E.prototype={constructor:E,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){Lc(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 Lc(a,b){a[a.id]={};b&&G(a,"parms",b);a.a=!1}function Mc(a){var b=!0;if(ma()){var c=JSON.stringify(a[a.id]);oa(a.key,c)||(r("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Nc(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){r(c.message||c),b=!1}return b}function Oc(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ma()&&(b=na(a.key))?(a[a.id]=b,a.a=!0):!1}function Pc(a,b){return a[a.id][b]||null}function G(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function Qc(a,b,c){u.call(this,"Computer",a,Qc);this.j.S=!1;Rc(this,b);this.B=rb(this,"autoPower",a);this.g=0;this.K=a.busWidth||a.buswidth;this.b=Sc;this.u=null;this.o=this.H=!1;this.N=rb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Tc(this);if(this.a=Ia("CPU",this.id)){this.L=Ia("Debugger",this.id);this.l=[];for(b=null;b=Pa(this,"Video",b);)this.l.push(b);this.m=new Ra({id:this.gb+".bus",busWidth:this.K},this.a,this.L);var d,e=Ha(this.id);if((this.h=Ia("Panel",this.id))&&this.h.ma)for(b=
|
||||
0;b<e.length;b++)d=e[b],d.J=this.h.J,d.Z=this.h.Z,d.ma=this.h.ma;this.Z("PC8080 v1.23.3\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.ia&&d.ia(this,this.m,this.a,this.L);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.A=d:this.b=parseInt(d,10));var f;if(a=rb(this,"state")||(f=!0,a.state))b=this.F=a,f||(this.o=!0,this.b=Sc),this.b&&(this.v=new E(this,"1.23.3"),Oc(this.v)?b=null:delete this.v);
|
||||
!b&&this.b&&(b=Uc(this))&&(this.o=!0);if(b){var h=this;q(b,null,!0,function(a,b,c){c?(h.A=null,h.o=!1,h.J("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(h.u=b,h.H=!0);B(h)})}else B(this);this.w.power||(this.B=!0);!c&&this.B&&Vc(this,this.Ma)}else r("Unable to find CPU component")}y(Qc);var Sc=0;
|
||||
function Rc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.s=b}function rb(a,b,c){var d=b.toLowerCase(),d=Aa[b]||Aa[d];void 0===d&&a.s&&(d=a.s[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Vc(a,b,c){for(var d=Ha(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!La(f)){La(f,function(){Vc(a,b,c)});return}}b.call(a,c)}
|
||||
function Wc(a,b){var c=new E(a,"1.23.3","validate");if(Oc(c)&&Nc(c)){var d=Pc(c,"timestamp"),e=b?Pc(b,"timestamp"):"unknown";d!=e&&(a.J("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Qc.prototype;
|
||||
k.Ma=function(a){void 0===a&&(a=this.b||(this.u?1:Sc));if(!this.g){this.g++;var b=!1,c=!1;this.G=!1;var d=this.v||new E(this,"1.23.3");if(-1==a)b=!0;else if(a>Sc){if(Oc(d,this.u)){this.i=new E(this,"1.23.3","failsafe");Oc(this.i)&&(Xc(this,d),a=2,Lc(this.i));G(this.i,"timestamp",ia());Mc(this.i);var e=this.b&&!this.o;if(1==a||ka("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Nc(d)){var f=Pc(d,"code"),h=Pc(d,"data");f&&("ok"==f?Oc(d,h):("error"==f&&
|
||||
"no machine state"!=h?(this.J("Error: "+h),"unable to verify user"==h&&(oa("user",""),this.c=null)):this.Z(f+": "+h),Lc(d),Oc(d)?(c=Nc(d),e=!0):c=!1))}e&&Wc(this,c?d:null)}else 2==a&&d.clear()}else Wc(this);delete this.u;delete this.v}e=Ha(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=Yc(this,h,d,b,c));b=[d,a,c];-1!=a?Vc(this,this.Eb,b):this.Eb(b)}};
|
||||
function Yc(a,b,c,d,e){if(!b.j.S){b.j.S=!0;if(b.Y){var f=null;e&&((f=Pc(c,b.id))||(f=Pc(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Y(f,d)&&f&&(r("Unable to restore state for "+b.type),a.F&&!a.H?(c.clear(),a.b=Sc,window&&window.location.reload()):a.G=!0,b.Y(null),e=!1)}if(!d&&b.sb)for(a=b.sb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
k.Eb=function(a){var b=a[0],c=0>a[1];a=a[2];this.O=!0;this.j.S=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.a&&(Yc(this,this.a,b,c,a),vb(this.a));this.G&&(Xc(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.g=0};
|
||||
function Xc(a,b){if(ka("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.23.3"};e.url=a.N;e.user=c;e.type="bug";e.data=d;q("http://www.pcjs.org/api/v1/report",e,!0)}}
|
||||
function Zc(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new E(a,"1.23.3"),h=new E(a,"1.23.3","validate"),g=ia();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.23.3");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ba&&(c&&wb(a.a),d=a.a.ba(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.j.S=!1,!1===d&&(e=null)));for(var g=Ha(a.id),l=0;l<g.length;l++){var m=g[l];m.j.S&&(m.ba&&(d=m.ba(b,c),"object"===typeof d&&G(f,m.id,d)),c&&
|
||||
(m.j.S=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&$c(a,a.c,f.toString()),Mc(h)&&Mc(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.j.S=!1,b=a.w.power)&&(b.textContent="Power");a.g=0;return e}k.reset=function(){this.m&&this.m.reset&&this.m.reset();for(var a=Ha(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.m&&c.reset&&c.reset()}};k.start=function(a,b){for(var c=Ha(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=Ha(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
k.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.g||(d.j.S?Zc(d,!1,!0):Vc(d,d.Ma))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.j.S&&!d.g)if(d.b&&!d.A){var a=ka("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Zc(d,a,!0);!a&&d.F?window&&window.location.reload():d.Ma(Sc)}else d.reset(),d.a&&vb(d.a)},!0;case "save":if(ea(ja(),"pcjs.org")){c.parentNode.removeChild(c);break}this.w[b]=
|
||||
c;c.onclick=function(){var a=Tc(d,!0);if(a){var b=!!(d.b&&!d.A||d.F),c=Zc(d,b);b?$c(d,a,c):d.J("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Tc(a,b){var c=a.c;c||(c=na("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=ad(a,c))||a.J("The user ID is invalid."))):b&&a.J("Browser local storage is not available"));return c}
|
||||
function ad(a,b){a.c=null;var c=q(ja()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(oa("user",c.data),a.c=c.data)}catch(e){r(e.message+" ("+d+")")}return a.c}function Uc(a){var b=null;a.c&&(b=ja()+"/api/v1/user?req=load&user="+a.c+"&state="+Kc(a,"1.23.3"));return b}
|
||||
function $c(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Kc(a,"1.23.3");d.data=c;b=q(ja()+"/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.J("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.J(c),oa("user",""),a.c=null)}}
|
||||
function Pa(a,b,c){a=Ha(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 Bb(a,b){if(a.l.length){var c=0,d=0;b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.l[0];e.ga&&e.ga.focus();b&&window&&window.scrollTo(c,d)}}k.ra=function(a){this.a&&this.a.ra(a);this.h&&this.h.ra(a)};
|
||||
function Cb(a,b){for(var c=0;c<a.l.length;c++){var d=a.l[c],e=!0;if(0<=b){d.ib&&(120==d.ib?b&1?(Yb(d.a,2),e=!1):Yb(d.a,1):Yb(d.a,4));var f;if(f=e&&d.V){f=d.m;for(var h=d.ta,g=!0,l=d.U>>>f.c;0<h&&l<f.b.length;)f.b[l].ea&&(f.b[l].ea=g=!1,f.b[l].Gb=!0),h-=f.m,l++;f=g}f&&(e=!1)}if(e)if(1<d.P)switch(d.G){case 2:Ec(d)}else{var g=d.U,l=g+d.ta,m=0,t=0,p=0,e=d.l,w=0;f=d.F;var ca=h=0,I=d.ka,S=(1<<I)-1;d.wc&&(I=-I,ca=16+I);for(;g<l;){var v;v=d.m;var F=g,J=F&v.g,Q=(F&v.h)>>>v.c;v=J!=v.g?v.b[Q].Ob(J,F):v.b[Q++].$a(J,
|
||||
F)|v.b[Q&v.A].$a(0,F+1)<<8;if(d.V&&v===d.i[m])t+=d.Cb;else{d.i[m]=v;(F=ca)&&(v=v>>8|(v&255)<<8);t<e&&(e=t);for(J=d.Cb;J--;)Q=v>>F&S,Dc(d,d.Ab,t++,p,Q),F+=I;t>w&&(w=t);p<f&&(f=p);p>=h&&(h=p+1)}g+=2;m++;if(t>=d.l&&(t=0,p++,p>d.F))break}d.V=!0;e<d.l&&(g=w-e,h-=f,d.c&&(l=e,m=g,e=f,g=h,f=d.l-(l+m),h=m),d.cb.putImageData(d.Ab,0,0,e,f,g,h),d.g.drawImage(d.s,0,0,d.s.width,d.s.height,0,0,d.B,d.v))}}}
|
||||
ua(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 Qc(h,d,!0);Ja(h,f);h.B&&Vc(h,h.Ma)}});qa.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.O&&!c.j.S&&c.Ma(-1)}});
|
||||
qa.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.j.S&&Zc(c,!(!c.b||c.A),!0)}});var bd=0;function cd(a,b,c,d,e,f){e("Loading "+a+"...");q(a,null,!0,function(h,g,l){l?(g||(g="unable to load "+a+" ("+l+")"),f(g,null)):dd(g,a,b,c,d,e,f)})}
|
||||
function dd(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Ga(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="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(p){g=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?ed(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
|
||||
function ed(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");q(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],m,t=/( [a-z]+=)(['"])(.*?)\2/g;m=t.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[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);ed(a,b,c)}})}else c(a,null)}
|
||||
function fd(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&&(--bd||xa(!0));l=!1}var h,g,l=!0;bd++;Fa[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=m:p.appendChild(document.createTextNode(m));t.appendChild(p)}c||
|
||||
(c="/versions/pc8080/1.23.3/components.xsl");m=function(d,g){g?cd(c,null,null,!1,e,function(d,l){if(l)if(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(l);m?(h.outerHTML=m,--bd||xa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(m,h),--bd||xa(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?cd(b,a,d,!0,e,m):dd(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(w){f(w.message)}return l}window.embedPC8080=function(a,b,c,d){xa(!1);return fd(a,b,c,d)};window.enableEvents=xa;window.sendEvent=ya;
|
||||
function gd(a,b,c,d){if(!c&&b){d.push(b);a=Fa[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?q(b,null,!0,function(a,b){hd(b,d)}):hd(null,d)}else r("Error ("+c+") requesting "+a)}
|
||||
function hd(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Fa[f],l={},m;for(m in g){var t=g[m],p=da(m);if("xml"==p){for(p=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[m]);){var w=d[2];w&&(g[w]||(t=t.replace(d[0],"")))}d=m=ba(m)}else"xsl"==p&&(e=m=ba(m));l[m]=t}a&&(l[m="css"]=a);b[2]&&(l[m="parms"]=b[2]);b[3]&&(l[m="state"]=b[3]);d&&e?(m=JSON.stringify(l),h+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
"©"),m=h,g=null,l="data:application/javascript,",l=pa("Firefox")?l+encodeURIComponent(c):l+encodeURI(c),m&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=l,g.download=m,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+m+"."):(window.open(l),c="Check your browser for a new window/tab containing the requested data"+(m?" ("+m+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n',
|
||||
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",r(c)):r("Missing XML/XSL resources")}
|
||||
window.savePC=function(a,b,c){var d=Ia("Computer",a),e=Ia("Debugger",a);if(d){var f=Zc(d,!0),h=d.s?JSON.stringify(d.s):null;b||(b="/versions/pcx86/1.23.3/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Nb:h}))return!0;q(b,null,!0,function(c,d,e){gd(c,d,e,[a,ba(b,!0),h,f])});return!0}r("Unable to identify machine '"+a+"'");return!1};})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue