Fixed PC8080 build
This commit is contained in:
parent
4019a4c8a9
commit
98d114a432
12 changed files with 2841 additions and 1 deletions
21
Gruntfile.js
21
Gruntfile.js
|
|
@ -414,7 +414,8 @@ module.exports = function(grunt) {
|
|||
],
|
||||
options: {
|
||||
process: function(content, srcPath) {
|
||||
var s = content.replace(/(<xsl:variable name="APPVERSION">)[^<]*(<\/xsl:variable>)/g, "$1" + pkg.version + "$2");
|
||||
var s = content.replace(/(<xsl:variable name="APPCLASS">)[^<]*(<\/xsl:variable>)/g, "$1pc8080$2");
|
||||
s = s.replace(/(<xsl:variable name="APPVERSION">)[^<]*(<\/xsl:variable>)/g, "$1" + pkg.version + "$2");
|
||||
s = s.replace(/"[^"]*\/?(common.css|common.xsl|components.css|components.xsl|document.css|document.xsl)"/g, '"/versions/pc8080/' + pkg.version + '/$1"');
|
||||
s = s.replace(/[ \t]*\/\*[^\*][\s\S]*?\*\//g, "").replace(/[ \t]*<!--[^@]*?-->[ \t]*\n?/g, "");
|
||||
return s;
|
||||
|
|
@ -455,6 +456,24 @@ module.exports = function(grunt) {
|
|||
}
|
||||
}
|
||||
},
|
||||
"pc8080": {
|
||||
files: [
|
||||
{
|
||||
cwd: "modules/shared/templates/",
|
||||
src: ["components.*"],
|
||||
dest: "versions/pc8080/<%= pkg.version %>/",
|
||||
expand: true
|
||||
}
|
||||
],
|
||||
options: {
|
||||
process: function(content, srcPath) {
|
||||
var s = content.replace(/(<xsl:variable name="APPCLASS">)[^<]*(<\/xsl:variable>)/g, "$1pc8080$2");
|
||||
s = s.replace(/(<xsl:variable name="APPVERSION">)[^<]*(<\/xsl:variable>)/g, "$1" + pkg.version + "$2");
|
||||
s = s.replace(/[ \t]*\/\*[^\*][\s\S]*?\*\//g, "").replace(/[ \t]*<!--[^@]*?-->[ \t]*\n?/g, "");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
files: [
|
||||
{
|
||||
|
|
|
|||
262
versions/pc8080/1.21.7/common.css
Normal file
262
versions/pc8080/1.21.7/common.css
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
@CHARSET "UTF-8";
|
||||
/**
|
||||
@author Jeff Parsons (@jeffpar)
|
||||
@website http://www.pcjs.org/
|
||||
@created 2013-05-05
|
||||
@modified 2014-02-23
|
||||
@license http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
body {
|
||||
margin: 0;
|
||||
background: #202020;
|
||||
}
|
||||
h1, h2 {
|
||||
margin-top: 0;
|
||||
color: #cccccc;
|
||||
}
|
||||
h1, h2, h3, h4 {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h4 a {
|
||||
color: #cccccc !important;
|
||||
}
|
||||
p {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
a img {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
pre, code {
|
||||
color: #000000;
|
||||
background-color: #cccccc;
|
||||
font-family: Monaco, Consolas, "Lucida Console", monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
pre {
|
||||
margin: 1em 2em;
|
||||
padding: 1em;
|
||||
border-radius: 5px;
|
||||
overflow: auto;
|
||||
}
|
||||
code {
|
||||
padding: 1px;
|
||||
}
|
||||
pre a, code a {
|
||||
color: #006400 !important;
|
||||
}
|
||||
.common {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
color: #cccccc;
|
||||
}
|
||||
.common a {
|
||||
|
||||
color: #7fc07f;
|
||||
text-decoration: none;
|
||||
}
|
||||
.common hr {
|
||||
border-color: #808080;
|
||||
}
|
||||
.common a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.common, .machine {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
|
||||
font-size: 15px;
|
||||
}
|
||||
.machine {
|
||||
margin: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.c1pjs {
|
||||
overflow: visible;
|
||||
}
|
||||
.machine-placeholder {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.common-top {
|
||||
background: #202020;
|
||||
font-size: small;
|
||||
}
|
||||
.common-top-left {
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
.common-top-left ul {
|
||||
line-height: 1.5em;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 1em 1em 1em 9px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.common-top-left ul li {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
.common-top-left ul li a {
|
||||
border-right: 1px solid #6f6f6f;
|
||||
padding: 2px 6px 2px 6px;
|
||||
}
|
||||
.common-top-left ul li:last-child a {
|
||||
border-right: none;
|
||||
}
|
||||
.common-top-right {
|
||||
float: right;
|
||||
width: 40%;
|
||||
}
|
||||
.common-top-right p {
|
||||
float: right;
|
||||
margin: 0;
|
||||
padding: 1em;
|
||||
}
|
||||
.common-middle {
|
||||
clear: both;
|
||||
padding: 1px 1em 1px 1em;
|
||||
background: #404040;
|
||||
}
|
||||
.common-sidebar {
|
||||
float: left;
|
||||
font-size: small;
|
||||
width: 140px;
|
||||
padding-bottom: 20px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.common-list {
|
||||
list-style-type: none;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.common-list li {
|
||||
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
.common-list-data {
|
||||
list-style-type: none;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.common-list-data li {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.common-list-data-items, .common-list-data-subitems {
|
||||
font-size: x-small;
|
||||
list-style-type: none;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-left: 2em;
|
||||
}
|
||||
.common-list-data-items li, .common-list-data-subitems li {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.common-main {
|
||||
margin-left: 150px;
|
||||
|
||||
}
|
||||
.common-image-gallery {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.common-image-gallery:after {
|
||||
content: '';
|
||||
display: block;
|
||||
}
|
||||
.common-image-frame {
|
||||
display: inline-block;
|
||||
margin: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.common-image-link {
|
||||
padding: 5px;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
background-color: #FAEBD7;
|
||||
}
|
||||
.common-image-label {
|
||||
font-size: x-small;
|
||||
}
|
||||
.common-bottom {
|
||||
clear: both;
|
||||
padding-top: 1em;
|
||||
}
|
||||
.common-bottom:after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.common-reference {
|
||||
float: left;
|
||||
font-size: x-small;
|
||||
}
|
||||
.common-reference a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.common-copyright {
|
||||
float: right;
|
||||
font-size: x-small;
|
||||
}
|
||||
.common-copyright a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.md-list {
|
||||
}
|
||||
.md-list li {
|
||||
line-height: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.md-list li p {
|
||||
padding-left: 2em;
|
||||
}
|
||||
.md-list-compact {
|
||||
}
|
||||
.md-list-compact li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.md-list-none {
|
||||
list-style-type: none;
|
||||
padding-left: 2em;
|
||||
}
|
||||
.md-list-none li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
@media screen and (max-width: 900px) {
|
||||
|
||||
.common-sidebar {
|
||||
width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
.common-list {
|
||||
padding-left: 0;
|
||||
}
|
||||
.common-list-data {
|
||||
padding-left: 0;
|
||||
}
|
||||
.common-sidebar h4, .common-list li, .common-list-data li, .common-list-data-items li {
|
||||
width: 130px;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
vertical-align: top;
|
||||
padding-right: 1em;
|
||||
margin-top: 0;
|
||||
}
|
||||
.common-list-data-subitems {
|
||||
display: none;
|
||||
}
|
||||
.common-main {
|
||||
clear: both;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.md-list-none {
|
||||
padding-left: 1em;
|
||||
}
|
||||
}
|
||||
59
versions/pc8080/1.21.7/common.xsl
Normal file
59
versions/pc8080/1.21.7/common.xsl
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY nbsp " "> <!ENTITY ne "≠"> <!ENTITY le "≤"> <!ENTITY ge "≥">
|
||||
<!ENTITY times "×"> <!ENTITY sdot "⋅"> <!ENTITY divide "÷">
|
||||
<!ENTITY copy "©"> <!ENTITY Sigma "Σ"> <!ENTITY sigma "σ"> <!ENTITY sum "∑"> <!ENTITY lbrace "{">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="html"/>
|
||||
|
||||
<xsl:template name="commonStyles">
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/versions/icons/current/pc-icon-57.png"/>
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/versions/icons/current/pc-icon-72.png"/>
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/versions/icons/current/pc-icon-76.png"/>
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/versions/icons/current/pc-icon-114.png"/>
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/versions/icons/current/pc-icon-120.png"/>
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/versions/icons/current/pc-icon-144.png"/>
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/versions/icons/current/pc-icon-152.png"/>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/versions/icons/current/pc-icon-180.png"/>
|
||||
<link rel="apple-touch-icon" sizes="192x192" href="/versions/icons/current/pc-icon-192.png"/>
|
||||
<link rel="apple-touch-icon" href="/versions/icons/current/apple-touch-icon.png"/>
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/versions/icons/current/pc-icon-192.png"/>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/versions/icons/current/favicon.ico"/>
|
||||
<link rel="stylesheet" type="text/css" href="/versions/pc8080/1.21.7/common.css"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="commonTop">
|
||||
<div class="common-top">
|
||||
<div class="common-top-left">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/apps/pc/">Apps</a></li>
|
||||
<li><a href="/disks/pc/">Disks</a></li>
|
||||
<li><a href="/devices/pc/machine/">Machines</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
<li><a href="/pubs/">Pubs</a></li>
|
||||
<li><a href="/blog/">Blog</a></li>
|
||||
<li><a href="/docs/about/">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="common-top-right">
|
||||
<p>Powered by JavaScript and <a href="http://github.com/jeffpar/pcjs" target="_blank">GitHub</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="commonBottom">
|
||||
<div class="common-bottom">
|
||||
<p class="common-reference"></p>
|
||||
<p class="common-copyright">
|
||||
<span class="common-copyright"><a href="http://www.pcjs.org/">pcjs.org</a> website © 2012-2016 by <a href="http://twitter.com/jeffpar">@jeffpar</a></span><br/>
|
||||
<span class="common-copyright">PCjs and C1Pjs released under <a href="http://gnu.org/licenses/gpl.html">GPL version 3 or later</a></span>
|
||||
</p>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
148
versions/pc8080/1.21.7/components.css
Normal file
148
versions/pc8080/1.21.7/components.css
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
@CHARSET "UTF-8";
|
||||
|
||||
|
||||
*:not(input,textarea) {
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.pcjs-embed {
|
||||
}
|
||||
.pcjs-embed:after {
|
||||
clear:both;
|
||||
}
|
||||
.pcjs-machine {
|
||||
}
|
||||
.pcjs-name, .pcjs-menu {
|
||||
clear: both;
|
||||
font-weight: bold;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.pcjs-menu {
|
||||
float: left;
|
||||
}
|
||||
.pcjs-canvas {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.pcjs-container {
|
||||
color: #000000;
|
||||
position: relative;
|
||||
}
|
||||
.pcjs-label {
|
||||
font-size: small;
|
||||
line-height: 19px;
|
||||
vertical-align: middle;
|
||||
float: left;
|
||||
font-family: "Lucida Console", monospace;
|
||||
}
|
||||
.pcjs-controls textarea {
|
||||
font-family: Monaco, monospace;
|
||||
font-size: x-small;
|
||||
}
|
||||
.pcjs-fieldset {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.pcjs-flag {
|
||||
font-family: "Lucida Console", monospace;
|
||||
font-size: small;
|
||||
text-align: center;
|
||||
line-height: 19px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.pcjs-register {
|
||||
font-family: "Lucida Console", monospace;
|
||||
font-size: small;
|
||||
text-align: center;
|
||||
line-height: 19px;
|
||||
vertical-align: middle;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.pcjs-switches {
|
||||
float: left;
|
||||
}
|
||||
.pcjs-bitBucket {
|
||||
float: left;
|
||||
width: 19px;
|
||||
height: 38px;
|
||||
}
|
||||
.pcjs-bitCell {
|
||||
float: left;
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
margin-right: -1px;
|
||||
margin-bottom: -1px;
|
||||
border: 1px solid black;
|
||||
text-align: center;
|
||||
line-height: 19px;
|
||||
}
|
||||
.pcjs-bitCellLeft {
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
.pcjs-bitLabel {
|
||||
font-size: xx-small;
|
||||
text-align: center;
|
||||
}
|
||||
.pcjs-description, .pcjs-status {
|
||||
font-size: x-small;
|
||||
line-height: 2em;
|
||||
}
|
||||
.pcjs-key {
|
||||
border: 1px solid black;
|
||||
font-size: x-small;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.pcjs-led {
|
||||
float: left;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin: 4px;
|
||||
border: 1px solid black;
|
||||
text-align: center;
|
||||
line-height: 19px;
|
||||
background-color: #000000;
|
||||
}
|
||||
.pcjs-screen {
|
||||
clear: both;
|
||||
height: auto;
|
||||
position: relative;
|
||||
line-height: 0;
|
||||
}
|
||||
.pcjs-screen textarea {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
.pcjs-reference {
|
||||
float: left;
|
||||
font-size: x-small;
|
||||
}
|
||||
.pcjs-reference a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.pcjs-copyright {
|
||||
float: right;
|
||||
font-size: x-small;
|
||||
}
|
||||
.pcjs-copyright a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 900px) {
|
||||
.pcjs-textarea {
|
||||
width: 100% !important;
|
||||
}
|
||||
.pcjs-registers {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
1138
versions/pc8080/1.21.7/components.xsl
Normal file
1138
versions/pc8080/1.21.7/components.xsl
Normal file
File diff suppressed because it is too large
Load diff
162
versions/pc8080/1.21.7/document.css
Normal file
162
versions/pc8080/1.21.7/document.css
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
@CHARSET "UTF-8";
|
||||
|
||||
.page {
|
||||
margin: 2% 2%;
|
||||
padding: 2% 2%;
|
||||
min-width: 30em;
|
||||
overflow: auto;
|
||||
font-size: large;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
background: #303030;
|
||||
color: #ccc;
|
||||
|
||||
}
|
||||
.page-header {
|
||||
}
|
||||
.page-header-title {
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
.page a {
|
||||
color: #7fc07f;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.footlink, a.paralink {
|
||||
text-decoration: none;
|
||||
}
|
||||
a.footlink:link, a.paralink:link {
|
||||
color: blue;
|
||||
}
|
||||
a.footlink:visited, a.paralink:visited {
|
||||
color: blue;
|
||||
}
|
||||
.galleryitem {
|
||||
float: left;
|
||||
width: 200px;
|
||||
}
|
||||
.item {
|
||||
float: left;
|
||||
width: 2em;
|
||||
text-indent: 1em;
|
||||
}
|
||||
.list {
|
||||
margin-left: 3em;
|
||||
text-indent: 0;
|
||||
text-align: justify;
|
||||
}
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
div.pnumber {
|
||||
float: left;
|
||||
width: 2em;
|
||||
text-indent: 1em;
|
||||
}
|
||||
div.pitem {
|
||||
margin-left: 10em;
|
||||
}
|
||||
p.indent, .justified p {
|
||||
text-indent: 2em;
|
||||
text-align: justify;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
p.noindent {
|
||||
text-indent: 0;
|
||||
text-align: justify;
|
||||
}
|
||||
p.center, .center {
|
||||
text-align: center;
|
||||
}
|
||||
li.para {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
blockquote.tag {
|
||||
font-size: small;
|
||||
font-family: Monaco, Fixed, monospace;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.blockquote {
|
||||
padding-left: 1em;
|
||||
text-indent: 0;
|
||||
text-align: justify;
|
||||
}
|
||||
.italics {
|
||||
font-style: italic;
|
||||
}
|
||||
.medium {
|
||||
font-size: medium;
|
||||
}
|
||||
.small {
|
||||
font-size: x-small;
|
||||
}
|
||||
.smallcaps {
|
||||
font-variant: small-caps;
|
||||
}
|
||||
.strike {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.summation, .bracelist {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
margin-bottom: 0.5ex;
|
||||
text-indent: 0;
|
||||
}
|
||||
.bracelist-symbol {
|
||||
font-size: 3em;
|
||||
vertical-align: -40%;
|
||||
}
|
||||
.summation .summation-lower, .summation .summation-upper, .bracelist-item {
|
||||
display: block;
|
||||
font-size: 75%;
|
||||
text-align: center;
|
||||
}
|
||||
.summation .summation-upper {
|
||||
margin-bottom: 0;
|
||||
margin-left: 0.8ex;
|
||||
font-style: italic;
|
||||
}
|
||||
.summation .summation-lower{
|
||||
margin-bottom: -0.6ex;
|
||||
font-style: italic;
|
||||
}
|
||||
.summation .summation-symbol {
|
||||
font-size: 2em;
|
||||
}
|
||||
p sup {
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
bottom: .5em;
|
||||
font-size: small;
|
||||
}
|
||||
p sub {
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
bottom: -.5em;
|
||||
font-size: small;
|
||||
}
|
||||
.footnote {
|
||||
font-size: medium;
|
||||
text-indent: 1em;
|
||||
text-align: justify;
|
||||
margin-top: .5em;
|
||||
}
|
||||
.image-right {
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.image-caption {
|
||||
font-size: small;
|
||||
text-align: center;
|
||||
}
|
||||
452
versions/pc8080/1.21.7/document.xsl
Normal file
452
versions/pc8080/1.21.7/document.xsl
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY nbsp " "> <!ENTITY ne "≠"> <!ENTITY le "≤"> <!ENTITY ge "≥">
|
||||
<!ENTITY times "×"> <!ENTITY sdot "⋅"> <!ENTITY divide "÷">
|
||||
<!ENTITY copy "©"> <!ENTITY Sigma "Σ"> <!ENTITY sigma "σ"> <!ENTITY sum "∑"> <!ENTITY lbrace "{">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="html"/>
|
||||
|
||||
<xsl:template name="documentStyles">
|
||||
<link rel="stylesheet" type="text/css" href="/versions/pc8080/1.21.7/document.css"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="title">
|
||||
<h1><xsl:apply-templates/></h1>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="p">
|
||||
<xsl:if test="@id">
|
||||
<a name="{@id}"></a>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(@class)">
|
||||
<p><xsl:apply-templates/></p>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<p class="{@class}"><xsl:apply-templates/></p>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p">
|
||||
<xsl:call-template name="p"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="br">
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p[@number]">
|
||||
<div class="pnumber">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(@number) or @number = ''"> </xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="@number"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
<div class="pitem">
|
||||
<xsl:call-template name="p"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="span">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(@class)">
|
||||
<span><xsl:apply-templates/></span>
|
||||
</xsl:when>
|
||||
<xsl:when test="@class = 'italics'">
|
||||
<em><xsl:apply-templates/></em>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<span class="{@class}"><xsl:apply-templates/></span>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="h2">
|
||||
<h2><xsl:apply-templates/></h2>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="h3">
|
||||
<h3><xsl:apply-templates/></h3>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="h4">
|
||||
<h4><xsl:apply-templates/></h4>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="h5">
|
||||
<h5><xsl:apply-templates/></h5>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="h6">
|
||||
<h6><xsl:apply-templates/></h6>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="em">
|
||||
<em><xsl:apply-templates/></em>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="strong">
|
||||
<strong><xsl:apply-templates/></strong>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="a">
|
||||
<a href="{@href}" target="{@target}"><xsl:apply-templates/></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ol">
|
||||
<blockquote><ol><xsl:apply-templates/></ol></blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ul">
|
||||
<blockquote><ul><xsl:apply-templates/></ul></blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="li">
|
||||
<li><xsl:apply-templates/></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="img">
|
||||
<div><img src="{@src}" alt="image"/></div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="pre">
|
||||
<pre><xsl:apply-templates/></pre>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="figure">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@pos">
|
||||
<div class="{@pos}"><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<div><img src="{@ref}" alt="{.}"/><br/><xsl:value-of select="."/></div>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sub">
|
||||
<sub><xsl:apply-templates/></sub>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sup">
|
||||
<sup><xsl:apply-templates/></sup>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lt"><</xsl:template>
|
||||
<xsl:template match="gt">></xsl:template>
|
||||
<xsl:template match="ne">≠</xsl:template>
|
||||
<xsl:template match="le">≤</xsl:template>
|
||||
<xsl:template match="ge">≥</xsl:template>
|
||||
<xsl:template match="times">×</xsl:template>
|
||||
<xsl:template match="dot">⋅</xsl:template>
|
||||
<xsl:template match="divide">÷</xsl:template>
|
||||
<xsl:template match="sigma">σ</xsl:template>
|
||||
|
||||
<xsl:template match="summation">
|
||||
<span class="summation">
|
||||
<span class="summation-upper"><xsl:value-of select="@upper"/></span>
|
||||
<span class="summation-symbol">∑</span>
|
||||
<span class="summation-lower"><xsl:value-of select="@lower"/></span>
|
||||
</span>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bracelist">
|
||||
<span class="bracelist-symbol">{</span>
|
||||
<span class="bracelist">
|
||||
<xsl:for-each select="item">
|
||||
<span class="bracelist-item"><xsl:apply-templates/></span>
|
||||
</xsl:for-each>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="footlink">
|
||||
<xsl:variable name="docID" select="/document/@id"/>
|
||||
<a class="footlink" id="fn{$docID}_ref{@n}" href="#fn{$docID}_{@n}"><sup><xsl:if test="@quoted"><xsl:text>[</xsl:text></xsl:if><xsl:value-of select="@n"/><xsl:if test="@quoted"><xsl:text>]</xsl:text></xsl:if></sup></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="footnote">
|
||||
<xsl:variable name="docID" select="/document/@id"/>
|
||||
<div class="footnote"><a id="fn{$docID}_{@n}" href="#fn{$docID}_ref{@n}"><sup><xsl:value-of select="@n"/></sup></a><xsl:text> </xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="authors">
|
||||
<xsl:for-each select="author"><xsl:if test="position() != 1"><xsl:text>, </xsl:text></xsl:if><xsl:if test="position() != 1 and position() = last()"><xsl:text>and </xsl:text></xsl:if><xsl:value-of select="."/></xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="formatDate">
|
||||
<xsl:param name="date"/>
|
||||
<xsl:param name="format">MDY</xsl:param>
|
||||
<xsl:variable name="year">
|
||||
<xsl:value-of select="substring-before($date,'-')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mon-day">
|
||||
<xsl:value-of select="substring-after($date,'-')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mon">
|
||||
<xsl:value-of select="substring-before($mon-day,'-')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="full-day">
|
||||
<xsl:value-of select="substring-after($mon-day,'-')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="day">
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring($full-day,1,1) = '0'"><xsl:value-of select="substring($full-day,2)"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$full-day"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$mon = '01'">January </xsl:when>
|
||||
<xsl:when test="$mon = '02'">February </xsl:when>
|
||||
<xsl:when test="$mon = '03'">March </xsl:when>
|
||||
<xsl:when test="$mon = '04'">April </xsl:when>
|
||||
<xsl:when test="$mon = '05'">May </xsl:when>
|
||||
<xsl:when test="$mon = '06'">June </xsl:when>
|
||||
<xsl:when test="$mon = '07'">July </xsl:when>
|
||||
<xsl:when test="$mon = '08'">August </xsl:when>
|
||||
<xsl:when test="$mon = '09'">September </xsl:when>
|
||||
<xsl:when test="$mon = '10'">October </xsl:when>
|
||||
<xsl:when test="$mon = '11'">November </xsl:when>
|
||||
<xsl:when test="$mon = '12'">December </xsl:when>
|
||||
<xsl:when test="$mon = '00'"/> </xsl:choose>
|
||||
<xsl:if test="$day != '0' and $format = 'MDY'">
|
||||
<xsl:value-of select="$day"/><xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="$year"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="gallery">
|
||||
<h2><xsl:value-of select="description"/></h2>
|
||||
<div class="gallery">
|
||||
<xsl:apply-templates select="item" mode="gallery"/>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="gallery">
|
||||
<div class="galleryitem">
|
||||
<a href="{@ref}"><img src="/versions/images/current/pdf-192.jpg" alt="{.}"/></a><br/>
|
||||
<div style="font-size:small; text-align:center;"><xsl:value-of select="."/></div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[@type = 'timeline']">
|
||||
<xsl:if test="not(description)">
|
||||
<h2>Timeline</h2>
|
||||
</xsl:if>
|
||||
<xsl:if test="description">
|
||||
<h2><xsl:value-of select="description"/></h2>
|
||||
</xsl:if>
|
||||
<blockquote>
|
||||
<xsl:apply-templates select="item" mode="timeline"/>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="timeline">
|
||||
<xsl:if test="@ref">
|
||||
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
|
||||
<xsl:apply-templates select="document($documentFile)/document" mode="withDate">
|
||||
<xsl:with-param name="itemRef" select="@ref"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(@ref)">
|
||||
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="@date"/></xsl:call-template></h3>
|
||||
<blockquote>
|
||||
<xsl:value-of select="."/>
|
||||
</blockquote>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[@type = 'people']">
|
||||
<xsl:if test="not(description)">
|
||||
<h2>People</h2>
|
||||
</xsl:if>
|
||||
<xsl:if test="description">
|
||||
<h2><xsl:value-of select="description"/></h2>
|
||||
</xsl:if>
|
||||
<blockquote>
|
||||
<xsl:apply-templates select="item" mode="people"/>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="people">
|
||||
<h3><xsl:value-of select="name"/></h3>
|
||||
<xsl:apply-templates select="list"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[@type = 'documents']">
|
||||
<xsl:if test="description"><h2><xsl:value-of select="description"/></h2></xsl:if>
|
||||
<ul>
|
||||
<xsl:apply-templates select="item" mode="document"/>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="document">
|
||||
<xsl:variable name="documentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="@ref"/></xsl:variable>
|
||||
<xsl:apply-templates select="document($documentFile)/document">
|
||||
<xsl:with-param name="itemRef" select="@ref"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="document">
|
||||
<xsl:param name="itemRef"/>
|
||||
<li>
|
||||
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/></xsl:call-template>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="document" mode="withDate">
|
||||
<xsl:param name="itemRef"/>
|
||||
<h3><xsl:call-template name="formatDate"><xsl:with-param name="date" select="date"/><xsl:with-param name="format" select="MY"/></xsl:call-template></h3>
|
||||
<blockquote>
|
||||
<p>
|
||||
<xsl:call-template name="documentSummary"><xsl:with-param name="itemRef" select="$itemRef"/><xsl:with-param name="multiLine" select="'true'"/></xsl:call-template>
|
||||
</p>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="documentSummary">
|
||||
<xsl:param name="itemRef"/>
|
||||
<xsl:param name="multiLine">false</xsl:param>
|
||||
<xsl:choose>
|
||||
<xsl:when test="content|include">
|
||||
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
|
||||
<xsl:if test="@ref">
|
||||
<span class="small">
|
||||
<xsl:text> [</xsl:text><a href="{@ref}">Original</a><xsl:text>]</xsl:text>
|
||||
</span>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<a href="{$itemRef}"><xsl:value-of select="title"/></a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="copy">
|
||||
<span class="small">
|
||||
<xsl:text> [</xsl:text><a href="{copy/@ref}"><xsl:value-of select="copy"/></a><xsl:text>]</xsl:text>
|
||||
</span>
|
||||
</xsl:if>
|
||||
<xsl:if test="author"><xsl:if test="$multiLine = 'true'"><br/></xsl:if><span class="medium"><xsl:text> by </xsl:text><xsl:call-template name="authors"/></span></xsl:if>
|
||||
<xsl:if test="source">
|
||||
<span class="small">
|
||||
<br/>
|
||||
<xsl:text>[Source: </xsl:text>
|
||||
<xsl:if test="site">
|
||||
<a href="{site/@url}"><xsl:value-of select="site"/></a>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(site)">
|
||||
<a href="{source/@url}"><xsl:value-of select="source"/></a>
|
||||
</xsl:if>
|
||||
<xsl:text>]</xsl:text>
|
||||
</span>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[@type = 'resources']">
|
||||
<xsl:if test="not(description)">
|
||||
<h2>Resources</h2>
|
||||
</xsl:if>
|
||||
<xsl:if test="description">
|
||||
<h2><xsl:value-of select="description"/></h2>
|
||||
</xsl:if>
|
||||
<blockquote>
|
||||
<xsl:apply-templates select="item" mode="resources"/>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="resources">
|
||||
<h3><xsl:value-of select="description"/></h3>
|
||||
<xsl:apply-templates select="list"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[@type = 'links']">
|
||||
<xsl:if test="description">
|
||||
<h4><xsl:value-of select="description"/></h4>
|
||||
</xsl:if>
|
||||
<ul>
|
||||
<xsl:apply-templates select="item" mode="links"/>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="links">
|
||||
<li><a href="{@ref}"><xsl:value-of select="."/></a></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list[not(@type)]">
|
||||
<xsl:if test="description">
|
||||
<h2><xsl:value-of select="description"/></h2>
|
||||
</xsl:if>
|
||||
<blockquote>
|
||||
<xsl:apply-templates select="item|tag" mode="outer"/>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="outer">
|
||||
<xsl:if test="description">
|
||||
<h3><xsl:value-of select="description"/></h3>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="list|item|tag" mode="inner"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list" mode="inner">
|
||||
<xsl:if test="description">
|
||||
<h4><xsl:value-of select="description"/></h4>
|
||||
</xsl:if>
|
||||
<ul>
|
||||
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="innerlist">
|
||||
<xsl:if test="description">
|
||||
<xsl:value-of select="description"/>
|
||||
</xsl:if>
|
||||
<ul>
|
||||
<xsl:apply-templates select="list|item|para|tag" mode="inner"/>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item" mode="inner">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@ref">
|
||||
<li><a href="{@ref}"><xsl:apply-templates/></a></li>
|
||||
</xsl:when>
|
||||
<xsl:when test="description">
|
||||
<li><xsl:call-template name="innerlist"/></li>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<li><xsl:apply-templates/></li>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="para" mode="inner">
|
||||
<li class="para"><xsl:apply-templates/></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tag" mode="outer">
|
||||
<xsl:call-template name="tag"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tag" mode="inner">
|
||||
<xsl:call-template name="tag"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="tag">
|
||||
<blockquote class="tag">
|
||||
<xsl:text><</xsl:text><xsl:if test="@href"><a href="{@href}"><xsl:value-of select="@name"/></a></xsl:if><xsl:if test="not(@href)"><xsl:value-of select="@name"/></xsl:if><xsl:for-each select="attr"><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>="</xsl:text><xsl:value-of select="@value"/><xsl:text>"</xsl:text></xsl:for-each>
|
||||
<xsl:choose>
|
||||
<xsl:when test="tag"><xsl:text>></xsl:text><xsl:apply-templates mode="inner"/><xsl:text></</xsl:text><xsl:value-of select="@name"/><xsl:text>></xsl:text></xsl:when>
|
||||
<xsl:when test="normalize-space(.) != ''"><xsl:text>></xsl:text><xsl:value-of select="."/><xsl:text></</xsl:text><xsl:value-of select="@name"/><xsl:text>></xsl:text></xsl:when>
|
||||
<xsl:otherwise><xsl:text>/></xsl:text></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
49
versions/pc8080/1.21.7/machine.xsl
Normal file
49
versions/pc8080/1.21.7/machine.xsl
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY nbsp " "> <!ENTITY sect "§"> <!ENTITY copy "©"> <!ENTITY para "¶"> <!ENTITY ndash "–"> <!ENTITY mdash "—">
|
||||
<!ENTITY lsquo "‘"> <!ENTITY rsquo "’"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY dagger "†"> <!ENTITY Dagger "‡">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output doctype-system="about:legacy-compat" method="html"/>
|
||||
|
||||
<xsl:include href="/versions/pc8080/1.21.7/common.xsl"/>
|
||||
<xsl:include href="/versions/pc8080/1.21.7/components.xsl"/>
|
||||
|
||||
<xsl:template match="/machine">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><xsl:value-of select="$SITEHOST"/></title>
|
||||
<xsl:call-template name="commonStyles"/>
|
||||
<xsl:call-template name="componentStyles"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="common">
|
||||
<xsl:call-template name="commonTop"/>
|
||||
<div class="common-middle">
|
||||
<p></p>
|
||||
<div id="{@id}" class="machine {@class}js">
|
||||
<xsl:call-template name="component">
|
||||
<xsl:with-param name="machine" select="@id"/>
|
||||
<xsl:with-param name="component" select="'machine'"/>
|
||||
<xsl:with-param name="class"><xsl:value-of select="@class"/>js</xsl:with-param>
|
||||
<xsl:with-param name="parms"><xsl:if test="@parms">,<xsl:value-of select="@parms"/></xsl:if></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div>
|
||||
</div>
|
||||
<xsl:call-template name="commonBottom"/>
|
||||
</div>
|
||||
<xsl:call-template name="componentScripts">
|
||||
<xsl:with-param name="component">
|
||||
<xsl:choose>
|
||||
<xsl:when test="debugger"><xsl:value-of select="@class"/>-dbg</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
247
versions/pc8080/1.21.7/manifest.xsl
Normal file
247
versions/pc8080/1.21.7/manifest.xsl
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2014-04-10" modified="2014-04-10" license="http://www.gnu.org/licenses/gpl.html" -->
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY nbsp " "> <!ENTITY sect "§"> <!ENTITY copy "©"> <!ENTITY para "¶"> <!ENTITY ndash "–"> <!ENTITY mdash "—">
|
||||
<!ENTITY lsquo "‘"> <!ENTITY rsquo "’"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY dagger "†"> <!ENTITY Dagger "‡">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output doctype-system="about:legacy-compat" method="html"/>
|
||||
|
||||
<xsl:include href="/versions/pc8080/1.21.7/common.xsl"/>
|
||||
<xsl:include href="/versions/pc8080/1.21.7/components.xsl"/>
|
||||
|
||||
<xsl:template match="/manifest[@type = 'document']">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><xsl:value-of select="$SITEHOST"/></title>
|
||||
<xsl:call-template name="commonStyles"/>
|
||||
<xsl:call-template name="componentStyles"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="common">
|
||||
<xsl:call-template name="commonTop"/>
|
||||
<div class="common-middle">
|
||||
<h4>Document Manifest</h4>
|
||||
<div class="common-sidebar">
|
||||
<ul class="common-list-data">
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Title'"/>
|
||||
<xsl:with-param name="node" select="title"/>
|
||||
<xsl:with-param name="default">None</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Version'"/>
|
||||
<xsl:with-param name="node" select="version"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Source'"/>
|
||||
<xsl:with-param name="node" select="source"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Documents'"/>
|
||||
<xsl:with-param name="node" select="document"/>
|
||||
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="common-main">
|
||||
<p><xsl:value-of select="desc"/></p>
|
||||
<xsl:call-template name="commonBottom"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/manifest[@type = 'software' or not(@type)]">
|
||||
<xsl:variable name="machineClass">
|
||||
<xsl:choose>
|
||||
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><xsl:value-of select="$SITEHOST"/></title>
|
||||
<xsl:call-template name="commonStyles"/>
|
||||
<xsl:call-template name="componentStyles"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="common">
|
||||
<xsl:call-template name="commonTop"/>
|
||||
<div class="common-middle">
|
||||
<h4>Software Manifest</h4>
|
||||
<div class="common-sidebar">
|
||||
<ul class="common-list-data">
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Title'"/>
|
||||
<xsl:with-param name="node" select="title"/>
|
||||
<xsl:with-param name="default">None</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Version'"/>
|
||||
<xsl:with-param name="node" select="version"/>
|
||||
<xsl:with-param name="default">Unknown</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Type'"/>
|
||||
<xsl:with-param name="node" select="type"/>
|
||||
<xsl:with-param name="default">None</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Category'"/>
|
||||
<xsl:with-param name="node" select="category"/>
|
||||
<xsl:with-param name="default">None</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Created'"/>
|
||||
<xsl:with-param name="node" select="creationDate"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Creators'"/>
|
||||
<xsl:with-param name="node" select="creator"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label"><xsl:if test="creationDate">Updated</xsl:if><xsl:if test="not(creationDate)">Released</xsl:if></xsl:with-param>
|
||||
<xsl:with-param name="node" select="releaseDate"/>
|
||||
<xsl:with-param name="default">Unknown</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Company'"/>
|
||||
<xsl:with-param name="node" select="company"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Authors'"/>
|
||||
<xsl:with-param name="node" select="author"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Contributors'"/>
|
||||
<xsl:with-param name="node" select="contributor"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Publisher'"/>
|
||||
<xsl:with-param name="node" select="publisher"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'License'"/>
|
||||
<xsl:with-param name="node" select="license"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Source'"/>
|
||||
<xsl:with-param name="node" select="source"/>
|
||||
<xsl:with-param name="default" select="''"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="listItem">
|
||||
<xsl:with-param name="label" select="'Disks'"/>
|
||||
<xsl:with-param name="node" select="disk"/>
|
||||
<xsl:with-param name="default"><xsl:value-of select="title"/> <xsl:if test="version != ''"><xsl:text> </xsl:text><xsl:value-of select="version"/></xsl:if></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="common-main">
|
||||
<xsl:for-each select="machine[not(@type) or @type = 'default']">
|
||||
<xsl:call-template name="machine">
|
||||
<xsl:with-param name="href" select="@href"/>
|
||||
<xsl:with-param name="state" select="@state"/>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="not(machine[not(@type) or @type = 'default'])">
|
||||
<p>No default machine specified for '<xsl:value-of select="title"/>' in manifest.xml</p>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="commonBottom"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<xsl:call-template name="componentScripts">
|
||||
<xsl:with-param name="component">
|
||||
<xsl:choose>
|
||||
<xsl:when test="machine/@debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="listItem">
|
||||
<xsl:param name="label"/>
|
||||
<xsl:param name="node"/>
|
||||
<xsl:param name="default">Unknown</xsl:param>
|
||||
<xsl:if test="$node != '' or $default != ''">
|
||||
<li><xsl:value-of select="$label"/>
|
||||
<ul class="common-list-data-items">
|
||||
<xsl:for-each select="$node">
|
||||
<xsl:variable name="desc">
|
||||
<xsl:choose>
|
||||
<xsl:when test="desc"><xsl:value-of select="desc"/></xsl:when>
|
||||
<xsl:when test="org"><xsl:value-of select="org"/></xsl:when>
|
||||
<xsl:otherwise/>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<li title="{$desc}">
|
||||
<xsl:variable name="value">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name">
|
||||
<xsl:value-of select="name"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="normalize-space(./text()) != ''">
|
||||
<xsl:value-of select="normalize-space(./text())"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$default"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="href">
|
||||
<xsl:if test="@href"><xsl:value-of select="@href"/></xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$href != ''">
|
||||
<a href="{$href}"><xsl:value-of select="$value"/></a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="page">
|
||||
<ul class="common-list-data-subitems">
|
||||
<xsl:for-each select="page">
|
||||
<li>
|
||||
<xsl:if test="@href">
|
||||
<a href="{$href}{@href}"><xsl:value-of select="."/></a>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(@href)">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="not($node)">
|
||||
<xsl:if test="@href">
|
||||
<a href="{@href}"><xsl:value-of select="$default"/></a>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(@href)">
|
||||
<xsl:value-of select="$default"/>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</ul>
|
||||
</li>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
47
versions/pc8080/1.21.7/outline.xsl
Normal file
47
versions/pc8080/1.21.7/outline.xsl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- author="Jeff Parsons (@jeffpar)" website="http://www.pcjs.org/" created="2012-05-05" modified="2014-02-23" license="http://www.gnu.org/licenses/gpl.html" -->
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY nbsp " "> <!ENTITY sect "§"> <!ENTITY copy "©"> <!ENTITY para "¶"> <!ENTITY ndash "–"> <!ENTITY mdash "—">
|
||||
<!ENTITY lsquo "‘"> <!ENTITY rsquo "’"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY dagger "†"> <!ENTITY Dagger "‡">
|
||||
]>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output doctype-system="about:legacy-compat" method="html"/>
|
||||
|
||||
<xsl:include href="/versions/pc8080/1.21.7/common.xsl"/>
|
||||
<xsl:include href="/versions/pc8080/1.21.7/document.xsl"/>
|
||||
<xsl:include href="/versions/pc8080/1.21.7/components.xsl"/>
|
||||
|
||||
<xsl:template match="/outline">
|
||||
<xsl:variable name="machineClass">
|
||||
<xsl:choose>
|
||||
<xsl:when test="machine/@class"><xsl:value-of select="machine/@class"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$MACHINECLASS"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/></title>
|
||||
<xsl:call-template name="commonStyles"/>
|
||||
<xsl:call-template name="documentStyles"/>
|
||||
<xsl:call-template name="componentStyles"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="common">
|
||||
<div class="page justified">
|
||||
<xsl:apply-templates/>
|
||||
</div>
|
||||
</div>
|
||||
<xsl:call-template name="componentScripts">
|
||||
<xsl:with-param name="component">
|
||||
<xsl:choose>
|
||||
<xsl:when test="debugger"><xsl:value-of select="$machineClass"/>-dbg</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$machineClass"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
165
versions/pc8080/1.21.7/pc8080-dbg.js
Normal file
165
versions/pc8080/1.21.7/pc8080-dbg.js
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
(function(){var g;function da(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 q(a){return"0x"+n(a,4)}function ea(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 fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ka(a,b){return-1!==a.indexOf(b,a.length-b.length)}var la={"&":"&","<":"<",">":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function ra(a,b){return(a+" ").slice(0,b)}function sa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
function ta(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 k=d+e>>1,h;h=c(b,a[k]);0<h?d=k+1:(e=k,f=!h)}return f?d:~d}var ua=Date.now||function(){return+new Date};function va(){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 wa(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 u(a,b,c,d){var e=0,f=null,k=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)}),k;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.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,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),k=[f,e]);return k}function xa(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function ya(){return window?window.navigator.userAgent:""}function v(a){window&&window.alert(a)}function za(a){var b=!1;window&&(b=window.confirm(a));return b}var Aa=null;function Ea(){if(null==Aa){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}Aa=a}return Aa}
|
||||
function Ha(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ia(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ja(a){if(window){var b=ya();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 Ka(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function La(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 Ma={init:[],show:[],exit:[]},Na=!1,Oa=!0;function Pa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Qa(a){Ma.init.push(a)}
|
||||
function Ra(a){if(Oa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){v("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function Sa(a){!Oa&&a?(Oa=!0,Na&&Ta("init")):Oa=a}function Ta(a){Ma[a]&&Ra(Ma[a])}Pa("onload",function(){Na=!0;Ra(Ma.init)});Pa("onpageshow",function(){Ra(Ma.show)});Pa(Ja("Opera")||Ja("iOS")?"onunload":"onbeforeunload",function(){Ra(Ma.exit)});
|
||||
function x(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.hb=b.comment;this.Hb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.wb=this.id.substr(0,b),this.Ua=this.id.substr(b+1)):this.Ua=this.id;this[a]=c;this.j={Ja:!1,Ga:!1,nb:!1,U:!1,Ia:!1};this.jb=null;this.j.Ia=!1;this.H={};this.C=null;this.W=d||0;y.push(this)}var Ua=void 0,Va={};
|
||||
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function ib(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
||||
function z(a,b){b||(b=x);a.prototype=ib(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var y=[],jb={};function kb(a,b,c){jb[a]&&b&&(jb[a][b]=c)}function C(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<y.length;b++){var d=y[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function lb(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<y.length;d++)if(c)c==y[d]&&(c=null);else if(!(a!=y[d].type||b&&y[d].id.indexOf(b)))return y[d]}return null}function E(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){v(c.message+" ("+a+")")}return b}
|
||||
function mb(a,b){for(var c=F(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var k=e[f];if(1===k.nodeType){var h=k.getAttribute("class");if(h)for(var l=h.split(" "),m=0;m<l.length;m++)switch(h=l[m],h){case "pc8080-binding":(h=E(k))&&h.binding&&a.ba(h.type,h.binding,k,h.value),m=l.length}}}}
|
||||
function F(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
||||
x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ba:function(a,b,c){switch(b){case "clear":return this.H[b]||(this.H[b]=c,c.onclick=function(a){return function(){a.H.print&&(a.H.print.value="")}}(this)),!0;case "print":return this.H[b]||(this.ua=this.H[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.Z=function(a,b,c){this.g(a,"notice",c)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.Ua+": "+a)},Z:function(a,b){b||v(a)},ja:function(){return this.j.U=!0},ia:function(a,b){b&&(this.j.U=!1);return!0}};function nb(a,b,c){a.C&&(!0===c||ob(a,c|0))&&a.C.message(b,void 0)}function ob(a,b){if(a.C){a===a.C?b|=0:b=b||a.W;var c=a.C.W&b;return!!b&&c===b||!!(c&a.C.Ob)}return!1}
|
||||
function pb(a,b){if(a.j.nb)return a.j.Ga&&(a.j.Ga=!1),a.j.nb=!1;if(a.j.Ia)return a.g(a.toString()+" error"),!1;a.j.Ga=b;return a.j.Ga}function qb(a,b){a.j.Ga&&(b?a.j.nb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.j.Ga}function G(a){if(!a.j.Ia&&(a.j.Ja=!0,a.j.Ja)){var b=a.jb;a.jb=null;b&&b()}}function rb(a,b){b&&(a.j.Ja?b():a.jb=b);return a.j.Ja}function sb(a,b){a.j.Ia=!0;a.Z(b)}
|
||||
var tb="undefined"!==typeof ArrayBuffer,ub=[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 vb(a){x.call(this,"Panel",a,vb)}z(vb);g=vb.prototype;g.ba=function(a,b,c,d){return this.s&&this.s.ba(a,b,c,d)||this.b&&this.b.ba(a,b,c,d)||this.u&&this.u.ba(a,b,c,d)||this.C&&this.C.ba(a,b,c,d)?!0:this.parent.ba.call(this,a,b,c,d)};g.Ka=function(a,b,c,d){this.s=a;this.B=b;this.b=c;this.C=d;this.u=wb(a,"Keyboard")};g.ja=function(a,b){b||xb();return!0};g.ia=function(){return!0};g.ca=function(){};
|
||||
function xb(){for(var a=!1,b=F(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=E(d),f;a:{f=e.id;if(void 0!==f)for(var k=void 0,k=0;k<y.length;k++)if(y[k].id===f){f=y[k];break a}f=null}f||(a=!0,f=new vb(e));mb(f,d);a&&G(f)}}Qa(xb);
|
||||
function yb(a,b,c){x.call(this,"Bus",a,yb);this.b=b;this.C=c;this.J=a.buswidth||16;this.L=Math.pow(2,this.J);this.u=this.L-1|0;this.O=20>=this.J?12:24>=this.J?14:15;this.X=1<<this.O;this.M=this.X>>2;this.s=this.X-1;this.I=this.L/this.X|0;this.K=this.I-1;this.A=[];this.D=[];this.F=this.G=!1;this.P=[];this.T=[];a=new H;zb(a,this.C);this.B=Array(this.I);for(b=0;b<this.I;b++)this.B[b]=a;a=this.b;b=this.O;c=this.u;a.sa=this.B;a.O=b;a.X=1<<a.O;a.M=a.X-1;a.P=c;G(this)}z(yb);yb.prototype.reset=function(){};
|
||||
yb.prototype.ja=function(a,b){b||this.reset();return!0};function Ab(a,b,c,d){for(var e=b>>>a.O;0<c&&e<a.B.length;){var f=a.B[e],k=e*a.X,h=c>a.X?a.X:c;if(f&&f.size){if(f.type==d){if(b+c<=f.w)return f.eb+=f.w-b,f.w=b,!0;if(b>=f.w+f.eb){h=f.size-(b-k);h>c&&(h=c);f.eb=b-f.w+h;c-=h;b=k+a.X;continue}}return Bb(1,b,c)}f=a.B[e];b=new H(b,h,a.X,d);zb(b,a.C,f);a.B[e++]=b;b=k+a.X;c-=h}return 0>=c?!0:Bb(2,b,c)}function Cb(a,b){return a.B[(b&a.u)>>>a.O].bb(b&a.s,b)}
|
||||
function Db(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]}function Eb(a,b){if(void 0===b)return a.G=!a.G,a.G;void 0===a.D[b]&&(a.D[b]=[null,!1]);a.D[b][1]=!a.D[b][1];return a.D[b][1]}function Bb(a,b,c){v("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Rb;if(tb){var Sb=new ArrayBuffer(2);(new DataView(Sb)).setUint16(0,256,!0);Rb=256===(new Uint16Array(Sb))[0]}else Rb=!1;var Tb=Rb;
|
||||
function H(a,b,c,d){this.id=Ub+=2;this.b=null;this.w=a;this.eb=b;this.size=c||0;this.type=d||Vb;this.F=d==Wb;zb(this);this.ma=this.Rb=!1;if(c)if(tb)this.A=new ArrayBuffer(c),this.D=new DataView(this.A,0,c),this.H=new Uint8Array(this.A,0,c),this.I=new Uint16Array(this.A,0,c>>1),this.b=new Int32Array(this.A,0,c>>2),Xb(this,Tb?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,ac=["NONE","RAM","ROM","VIDEO","H/W"],Ub=0;
|
||||
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(tb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(tb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.ma=!0}return!1},ta:function(a,b){b?0===this.s++&&bc(this,cc,!1):0===this.B++&&dc(this,cc,!1)},J:function(){this.C&&ob(this.C,129)&&this.C.message("attempt to read invalid block %"+n(this.w),!0);
|
||||
return 255},u:function(a,b){this.C&&ob(this.C,129)&&this.C.message("attempt to write "+q(b)+" to invalid block %"+n(this.w),!0)},aa:function(a,b){return this.lb(a++,b++)|this.lb(a,b)<<8},Va:function(a,b,c){this.G(a++,b&255,c++);this.G(a,b>>8,c)},P:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ea:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},Fa:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.ma=!0},hb:function(a,
|
||||
b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.ma=!0},L:function(a,b){if(this.C&&null!=this.w){var c=this.C;ec(c,this.w+a,1,c.M)&&c.S(!0)}return this.bb(a,b)},Y:function(a,b){if(this.C&&null!=this.w){var c=this.C;ec(c,this.w+a,2,c.M)&&c.S(!0)}return this.Ib(a,b)},qa:function(a,b,c){if(this.C&&null!=this.w){var d=this.C;ec(d,this.w+a,1,d.F)&&d.S(!0)}this.F?this.u(a,b,c):this.Sa(a,b,c)},Ua:function(a,b,c){if(this.C&&
|
||||
null!=this.w){var d=this.C;ec(d,this.w+a,2,d.F)&&d.S(!0)}this.F?this.u(a,b,c):this.Lb(a,b,c)},K:function(a){return this.H[a]},M:function(a){return this.H[a]},T:function(a){return this.D.getUint16(a,!0)},da:function(a){return a&1?this.H[a]|this.H[a+1]<<8:this.I[a>>1]},ga:function(a,b){this.H[a]=b;this.ma=!0},ra:function(a,b){this.H[a]=b;this.ma=!0},Ta:function(a,b){this.D.setUint16(a,b,!0);this.ma=!0},gb:function(a,b){a&1?(this.H[a]=b,this.H[a+1]=b>>8):this.I[a>>1]=b;this.ma=!0}};
|
||||
function zb(a,b,c){a.C=b;a.B=a.s=0;c&&((a.B=c.B)&&dc(a,cc,!1),(a.s=c.s)&&bc(a,cc,!1))}function fc(a,b){b?0===--a.s&&(a.G=a.F?a.u:a.Sa):0===--a.B&&(a.lb=a.bb)}function bc(a,b,c){c&&a.s||(a.G=!a.F&&b[2]||a.u);if(c||void 0===c)a.Sa=b[2]||a.u,a.Lb=b[3]||a.Va}function dc(a,b,c){c&&a.B||(a.lb=b[0]||a.J);if(c||void 0===c)a.bb=b[0]||a.J,a.Ib=b[1]||a.aa}function Xb(a,b){b||(b=gc);dc(a,b,void 0);bc(a,b,void 0)}
|
||||
var gc=[],$b=[H.prototype.P,H.prototype.ea,H.prototype.Fa,H.prototype.hb],cc=[H.prototype.L,H.prototype.Y,H.prototype.qa,H.prototype.Ua];if(tb)var Zb=[H.prototype.K,H.prototype.T,H.prototype.ga,H.prototype.Ta],Yb=[H.prototype.M,H.prototype.da,H.prototype.ra,H.prototype.gb];
|
||||
function hc(a,b){x.call(this,"CPU",a,hc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.Qa=c;this.i.ya=d;this.i.pb=Math.round(this.i.Qa/1E4)/100;this.i.wa=this.i.pb*this.i.ya;this.j.V=!1;this.j.ob=!1;this.j.Ab=a.autoStart;this.j.Bb=!1;this.j.Ha=!1;this.i.Wa=this.i.Na=0;this.i.Xa=a.csStart;this.i.Ma=a.csInterval;this.i.Oa=a.csStop;this.aa=this.Ea.bind(this);G(this)}z(hc);var ic=["power","reset"];g=hc.prototype;
|
||||
g.Ka=function(a,b,c,d){this.s=a;this.B=b;this.C=d;for(b=0;b<ic.length;b++)(c=this.H[ic[b]])&&this.s.ba(null,ic[b],c);wb(a,"FPU");this.D=wb(a,"ChipSet");a=jc(a,"autoStart");null!=a&&(this.j.Ab="true"==a?!0:"false"==a?!1:!!a);G(this)};g.reset=function(){};g.save=function(){return null};g.restore=function(){return!1};
|
||||
g.ja=function(a,b){if(!b){if(a&&this.restore){kc(this);if(!this.restore(a))return!1;lc(this)}else this.reset();if(this.C){var c=this.C;c.g("Type ? for help with PC8080 Debugger commands");c.ca();if(c.Va){var d=c.Va;c.Va=null;mc(c,d)}}else this.g("No debugger detected")}I(this);return!0};g.ia=function(a){return a?this.save():!0};function nc(a){(a.j.Ab||!a.C&&void 0===a.H.run)&&a.Ea(!0)}g.Cb=function(){return 0};
|
||||
function lc(a){void 0===a.i.Xa&&(a.i.Xa=0);void 0===a.i.Ma&&(a.i.Ma=-1);void 0===a.i.Oa&&(a.i.Oa=-1);a.j.Ha=0<=a.i.Xa&&0<a.i.Ma;a.j.Ha&&(a.i.Wa=0,a.i.Na=a.i.Xa-a.J)}function oc(a,b){if(a.j.Ha){var c=!1;a.i.Wa=a.i.Wa+a.Cb()|0;a.i.Na-=b;0>=a.i.Na&&(a.i.Na+=a.i.Ma,c=!0);0<=a.i.Oa&&a.i.Oa<=pc(a)&&(a.i.Ma=a.i.Oa=-1,lc(a),a.S(),c=!0);c&&a.g(pc(a)+" cycles: checksum="+n(a.i.Wa))}}
|
||||
g.ba=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.H[b]=c;a=!0;break;case "run":this.H[b]=c;c.onclick=function(){var a;if(a=d.s)if(a=d.s,a.j.U)a=!0;else{var b=null,c,h=C(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.j.Ja);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.j.U);c++);c==h.length&&(b=a);v("The "+b.type+" component ("+b.id+") is not "+(b.j.Ja?"powered yet":"ready yet"+(b.jb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.V?d.S(!0):d.Ea(!0))};a=!0;break;
|
||||
case "speed":this.H[b]=c;a=!0;break;case "setSpeed":this.H[b]=c,c.onclick=function(){qc(d,d.i.ya<<1,!0)},c.textContent=this.i.wa.toFixed(2)+"Mhz",a=!0}return a};function rc(a,b,c){a.J+=b;c&&(a.G=a.u=0)}
|
||||
function sc(a,b){var c=30;60>c&&(c=60);2>c&&(c=2);var d=1;b&&1<a.i.ya&&a.i.va&&(d=a.i.va/a.i.pb);a.i.Eb=Math.round(1E3/30);a.i.Vb=Math.floor(a.i.Qa/c*d);a.i.qb=Math.floor(a.i.Qa/30*d);a.i.Gb=Math.floor(a.i.Qa/60*d);a.i.Fb=Math.floor(a.i.Qa/2*d);b||(a.i.Pa=a.i.qb,a.i.Za=a.i.Gb,a.i.Ya=a.i.Fb);a.i.rb=0}function pc(a){return a.J+a.I+a.G-a.u}function kc(a){a.i.va=0;a.J=a.I=a.G=a.u=0;lc(a);qc(a,1)}
|
||||
function qc(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.pb*a.i.ya;if(a.i.wa!=b){a.i.wa=b;b=a.i.wa.toFixed(2)+"Mhz";var e=a.H.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.s&&a.s.cb()}rc(a,a.I);a.I=0;a.i.La=ua();a.i.xa=0;sc(a);return d}
|
||||
g.Ea=function(a){if(pb(this,!0)){if(!this.j.V){qc(this);this.s&&this.s.start(this.i.La,pc(this));this.j.V=!0;this.j.ob=!0;this.D&&this.D.Wb();var b=this.H.run;b&&(b.textContent="Halt");this.s&&(this.s.ca(!0),a&&this.s.cb(!0))}this.i.rb>=this.i.Qa&&sc(this,!0);this.i.$a=0;this.i.kb=ua();this.i.xa&&(a=this.i.kb-this.i.xa,a>this.i.Eb&&(this.i.La+=a,this.i.La>this.i.kb&&(this.i.La=this.i.kb)));try{do{var c=this.j.Ha?1:this.i.Vb;this.D&&(this.D.Kb(),c=this.D.Yb(0,c),c=this.D.Xb(c));try{this.Ra(c)}catch(e){if("number"!=
|
||||
typeof e)throw e;}var d=this.G-this.u;this.I+=d;this.i.$a+=d;rc(this,0,!0);oc(this,d);this.i.Za-=d;0>=this.i.Za&&(this.i.Za+=this.i.Gb);this.i.Ya-=d;0>=this.i.Ya&&(this.i.Ya+=this.i.Fb,this.s&&this.s.ca());this.i.Pa-=d;if(0>=this.i.Pa){this.i.Pa+=this.i.qb;break}}while(this.j.V)}catch(e){this.S();I(this);this.s&&this.s.stop(ua(),pc(this));pb(this,!1);sb(this,e.stack||e.message);return}c=setTimeout;d=this.aa;this.i.xa=ua();a=this.i.Eb;this.i.$a&&(a=Math.round(a*this.i.$a/this.i.qb));a-=this.i.xa-this.i.kb;
|
||||
if(b=this.i.xa-this.i.La)this.i.va=Math.round(this.I/(10*b))/100,864E5<=b&&(this.J=0,this.D&&this.D.Kb(!0),qc(this));if(0>a||this.i.va<this.i.wa)a=0;this.i.rb+=this.i.$a;this.i.xa+=a;c(d,a)}else I(this),this.s&&this.s.stop(ua(),pc(this))};g.Ra=function(){return 0};g.S=function(a){qb(this,!0);this.G-=this.u;this.u=0;rc(this,this.I);this.I=0;if(this.j.V){this.j.V=!1;this.D&&this.D.Wb();var b=this.H.run;b&&(b.textContent="Run")}this.j.ib=a};function I(a,b){a.s&&a.s.ca(b)}
|
||||
function Sc(a){this.Db=a.model||8080;hc.call(this,a,1E6);this.Y=Tc;kc(this);this.j.ib=this.j.Qb=!1;this.T=0;this.sa=[];this.O=this.X=this.M=this.P=0;Uc(this)}z(Sc,hc);g=Sc.prototype;g.reset=function(){this.j.V&&this.S();Uc(this);kc(this);this.j.Ia=!1};function Uc(a){a.za=0;a.ka=0;a.na=0;a.oa=0;a.Aa=0;a.pa=0;a.Ba=0;a.Da=0;a.N=0;Vc(a,0);a.L=0}g.Cb=function(){var a=this.za+this.ka+this.na+this.oa+this.Aa+this.pa+this.Ba|0;return a=a+this.Da+this.N+Wc(this)|0};
|
||||
g.save=function(){var a=new J(this);M(a,0,[this.za,this.ka,this.na,this.oa,this.Aa,this.pa,this.Ba,this.Da,this.N,Wc(this)]);M(a,1,[this.K,this.L,this.J,this.i.ya]);for(var b=this.B,c=0,d=[],e=0;e<b.I;e++){var f=b.B[e];if(f.ma||f.Rb){d[c++]=e;var k=c++;a:if(f=f.save()){for(var h=0,l=0,m=[];h<f.length;){for(var p=f[h],r=h+1;r<f.length&&f[r]===p;)r++;m[l++]=r-h;m[l++]=p;h=r}if(m.length<f.length){f=m;break a}}d[k]=f}}M(a,2,d);return a.data()};
|
||||
g.restore=function(a){var b=a[0];this.za=b[0];this.ka=b[1];this.na=b[2];this.oa=b[3];this.Aa=b[4];this.pa=b[5];this.Ba=b[6];this.Da=b[7]&65535;this.N=b[8]&65535;Vc(this,b[9]);b=a[1];this.K=b[0];this.L=b[1];this.J=b[2];qc(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.M){for(var f=0,k=Array(b.M),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)k[f++]=m;e=k}f=b.B[d];if(!f||!f.restore(e)){v("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
function Xc(a){return a.R&a.A>>1?128:0}function Yc(a){Xc(a)||(a.R^=a.A>>1|a.A>>2,a.F^=32896)}function Wc(a){return a.Ca&-2262|(a.b&a.A?1:0)|(ub[a.R&255]?4:0)|((a.R^a.F)&16?16:0)|(a.b&a.A-1?0:64)|Xc(a)}function Vc(a,b){a.A=256;a.b=a.R=a.F=0;b&1&&(a.b|=a.A);b&4||(a.R|=1);b&16&&(a.F|=16);b&64||(a.b|=a.A-1);b&128&&Yc(a);a.Ca=a.Ca&-513|b&512|2}
|
||||
g.ba=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "D":case "E":case "H":case "L":case "SP":case "PC":case "F":case "C":case "P":case "A":case "Z":case "S":case "V":this.H[b]=c;this.T++;d=!0;break;default:d=this.parent.ba.call(this,a,b,c)}return d};function Zc(a){var b;b=a.N+1|0;var c;c=a.N;c=a.sa[(c&a.P)>>>a.O].lb(c&a.M,c);a.N=b;return c}
|
||||
function N(a,b,c,d){d=d||2;a.H[b]&&(void 0===c&&(sb(a,"Value for "+b+" is invalid"),a.S()),c=!a.j.V||a.j.Bb?n(c,d):"--------".substr(0,d),a.H[b].textContent!=c&&(a.H[b].textContent=c))}
|
||||
g.ca=function(a){this.T&&(a||!this.j.V||this.j.Bb)&&(N(this,"A",this.za),N(this,"B",this.ka),N(this,"C",this.na),N(this,"D",this.oa),N(this,"E",this.Aa),N(this,"H",this.pa),N(this,"L",this.Ba),N(this,"SP",this.Da,4),N(this,"PC",this.N,4),a=Wc(this),N(this,"F",a,2),N(this,"S",a&128,1),N(this,"Z",a&64,1),N(this,"A",a&16,1),N(this,"P",a&4,1),N(this,"C",a&1,1));if(a=this.H.speed)a.textContent=this.j.V&&this.i.va?this.i.va.toFixed(2)+"Mhz":"Stopped"};
|
||||
g.Ra=function(a){this.j.ib=!0;var b=this.j.Qb=this.C&&$c(this.C),c=a?this.j.ob?0:1:-1;this.j.ob=!1;this.G=this.u=a;this.D&&!a&&this.D.Kb();a||(this.K|=4);do{if(this.L&&this.L&4){this.K=this.u=0;break}if(b){if(ad(this.C,this.N,c)){this.S();break}c=1}this.K=0;this.Y[Zc(this)].call(this)}while(0<this.u);return this.j.ib?this.G-this.u:void 0===this.j.ib?0:-1};Qa(function(){for(var a=F(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new Sc(d);mb(d,c)}});
|
||||
function O(){this.N=this.N-1&65535;nb(this,"unimplemented opcode",!0);this.S()}
|
||||
var Tc=[function(){this.u-=4},function(){this.na=Zc(this);this.ka=Zc(this);this.u-=10},O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,
|
||||
O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O];function bd(a){x.call(this,"ROM",a,bd);this.s=null;this.F=a.addr;this.u=a.size;this.A=a.alias;this.D=a.file;this.G=ea(this.D);if(this.D){a=this.D;var b=fa(this.G);"json"!=b&&"hex"!=b&&(a=xa()+"/api/v1/dump?file="+this.D+"&format=bytes&decimal=true");var c=this;u(a,null,!0,function(a,b,f){cd(c,a,b,f)})}}z(bd);bd.prototype.Ka=function(a,b,c,d){this.B=b;this.b=c;this.C=d;dd(this)};
|
||||
bd.prototype.ja=function(){if(this.ha){if(this.C){var a=this.C,b=this.id,c=this.F,d=this.u,e=this.ha,f=[],k;for(k in e){var h=e[k];"number"==typeof h&&(e[k]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var p=f,l=[l>>>0,k],r=ta(p,l,a.tb);0>r&&p.splice(-(r+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.G.push({Zb:b,w:c,Ub:d,ha:e,ub:f})}delete this.ha}return!0};bd.prototype.ia=function(){return!0};
|
||||
function cd(a,b,c,d){if(d)a.Z("Unable to load system ROM (error "+d+": "+b+")");else{kb(a.wb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,k=e.data;if(f)a.s=f;else if(k)for(a.s=Array(4*k.length),d=c=0;c<k.length;c++)a.s[d++]=k[c]&255,a.s[d++]=k[c]>>8&255,a.s[d++]=k[c]>>16&255,a.s[d++]=k[c]>>24&255;else a.s=e;a.ha=e.symbols;if(!a.s.length){v("Empty ROM: "+b);return}if(1==a.s.length){v(a.s[0]);return}}catch(h){a.Z("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.s=Array(b.length),e=0;e<b.length;e++)a.s[e]=da(b[e],16);dd(a)}}
|
||||
function dd(a){if(!rb(a))if(!a.D)G(a);else if(a.s&&a.B){if(a.s.length!=a.u)sb(a,"ROM size (0x"+n(a.s.length)+") does not match specified size ("+("0x"+n(a.u))+")");else{var b;b=a.F;if(Ab(a.B,b,a.u,Wb)){for(var c=0;c<a.s.length;c++){var d=a.B,e=b+c;d.B[(e&d.u)>>>d.O].Sa(e&d.s,a.s[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.B,k=f.u,h=[],l=f.F>>>e.O;0<k&&l<e.B.length;)h.push(e.B[l++]),k-=e.X;e=f.B;
|
||||
f=f.u;k=0;for(d>>>=e.O;0<f&&d<e.B.length;){l=h[k++];if(!l)break;e.B[d++]=l;f-=e.X}}delete a.s}}G(a)}}Qa(function(){for(var a=F(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new bd(d);mb(d,c)}});function ed(a){x.call(this,"RAM",a,ed);this.A=a.addr;this.u=a.size;this.s=!1}z(ed);g=ed.prototype;g.Ka=function(a,b,c,d){this.B=b;this.b=c;this.C=d;G(this)};g.ja=function(a,b){b||this.reset();return!0};g.ia=function(a){return a?this.save():!0};
|
||||
g.reset=function(){!this.s&&this.u&&Ab(this.B,this.A,this.u,1)&&(this.s=!0,this.status(Math.floor(this.u/1024)+"Kb allocated"));this.s||v("No RAM allocated")};g.save=function(){return null};g.restore=function(){return!0};Qa(function(){for(var a=F(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new ed(d);mb(d,c)}});function fd(a){x.call(this,"Keyboard",a,fd,65536);G(this)}z(fd);
|
||||
Qa(function(){for(var a=F(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new fd(d);mb(d,c)}});function gd(a){x.call(this,"Video",a,gd,262144);G(this)}z(gd);
|
||||
Qa(function(){for(var a=F(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=E(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<=ya().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height=
|
||||
(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Va.aspect);f&&.3<=f&&3.33>=f&&(Pa("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");Ja("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);e.getContext("2d");d=new gd(d);mb(d,c)}});
|
||||
function hd(a){x.call(this,"Debugger",a,hd);this.T=this.Fa=this.J=0;this.L=P();this.vb=P();this.D=-1;this.A=[];this.da=!1;this.Y=P();this.G=[];this.aa={};this.u=this.M=this.F=[];id(this);this.qa=0;jd(this);this.Ta=[];kd(this,a.messages);this.Va=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return mc(b,a)}):void 0===global.$&&(global.$=function(a){return mc(b,a)})}z(hd);
|
||||
var ld={"?":"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",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","t [#]":"trace","u [#]":"unassemble",x:"execution options",v:"print version","var":"assign variable"},md="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(" "),
|
||||
nd="B C D E H L M A F BC DE HL PSW SP PC".split(" "),od=[[45],[42,2323,32],[71,2387],[29,2323],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,6419],[40,2387],[23,2323],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2579,32],[71,2643],[29,2579],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,6675],[40,2643],[23,2579],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2835,32],[68,99],[29,2835],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,6931],[41,99],[23,2835],[28,1297],[22,1297],[44,
|
||||
1297,32],[16],[45,32768],[42,3347,32],[70,97],[29,3347],[28,1553],[22,1553],[44,1553,32],[72],[45,32768],[21,7443],[39,97],[23,3347],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1553],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1553],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,785],[43,529,1041],[43,529,1297],[43,529,1553],[43,529,1809],[43,785,17],[43,785,
|
||||
273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1553],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1553],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1553],[43,1297,1809],[43,1553,17],[43,1553,273],[43,1553,529],[43,1553,785],[43,1553,1041],[43,1553,1297],[43,1553,1553],[43,1553,1809],[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],
|
||||
[43,1809,1297],[43,1809,1553],[43,1809,1809],[3,17],[3,273],[3,529],[3,785],[3,1041],[3,1297],[3,1553],[3,1809],[2,17],[2,273],[2,529],[2,785],[2,1041],[2,1297],[2,1553],[2,1809],[73,17],[73,273],[73,529],[73,785],[73,1041],[73,1297],[73,1553],[73,1809],[66,17],[66,273],[66,529],[66,785],[66,1041],[66,1297],[66,1553],[66,1809],[5,17],[5,273],[5,529],[5,785],[5,1041],[5,1297],[5,1553],[5,1809],[76,17],[76,273],[76,529],[76,785],[76,1041],[76,1297],[76,1553],[76,1809],[46,17],[46,273],[46,529],[46,
|
||||
785],[46,1041],[46,1297],[46,1553],[46,1809],[18,17],[18,273],[18,529],[18,785],[18,1041],[18,1297],[18,1553],[18,1809],[58],[50,2323],[34,35],[30,35],[11,35],[51,2323],[4,33],[65],[62],[54],[38,35],[30,32803],[15,35],[7,35],[1,33],[65],[57],[50,2579],[33,35],[48,33],[10,35],[51,2579],[74,33],[65],[55],[54,32768],[31,35],[27,33],[8,35],[7,32803],[67,33],[65],[61],[50,2835],[37,35],[78],[14,35],[51,2835],[6,33],[65],[60],[49],[36,35],[75],[13,35],[7,32803],[77,33],[65],[59],[50,3091],[35,35],[24],
|
||||
[12,35],[51,3091],[47,33],[65],[56],[69],[32,35],[25],[9,35],[7,32803],[19,33],[65]],Q={cpu:1,bus:64,mem:128,port:256,timer:2048,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:536870912,warn:1073741824,halt:-2147483648};g=hd.prototype;
|
||||
g.Ka=function(a,b,c,d){this.B=b;this.b=c;this.s=a;(a=jc(a,"messages"))&&kd(this,a);this.gb=od;pd(this,function(a){a:{var b=d.b.sa,c=a[0],h=a=0,l=b.length;if(c){a=T(U(d,c));if(-1===a){d.g("invalid address: "+c);break a}h=a>>>d.b.O;l=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var p=b[h];p.type==c?m++||d.g("..."):(c=p.type,m=ac[c],p&&d.g(n(p.id)+" %"+n(h<<d.b.O)+" %%"+n(p.w)+" "+q(p.eb)+" "+q(p.size)+
|
||||
" "+m),c!=Vb&&(c=-1),m=0);a+=d.b.X;h++}}});G(this)};
|
||||
g.ba=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ga=this.H[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",mc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.D<d.A.length-1&&(b=d.A[++d.D]):40==a.keyCode&&(0<d.D?b=d.A[--d.D]:(b="",d.D=-1)),null!=b){var k=b.length;c.value=b;c.setSelectionRange(k,k)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.H[b]=c,La(c,function(){if(d.ga){var a=d.ga.value;d.ga.value=
|
||||
"";mc(d,a,!0);return!0}return!1}),!0;case "step":return this.H[b]=c,La(c,function(a){var b=!1;qb(d,!0)||(pb(d,!0),b=d.Ra(a?1:0),pb(d,!1));return b}),!0}return!1};g.cb=function(){this.ga&&this.ga.focus()};function T(a){a=a&&a.w;null==a&&(a=-1);return a}g.la=function(a,b){var c=255,d=T(a);-1!==d&&(c=Cb(this.B,d),b&&qd(a,b));return c};g.fb=function(a,b){var c=65535,d=T(a);if(-1!==d){var c=this.B,e=d&c.s,f=(d&c.u)>>>c.O,c=e!=c.s?c.B[f].Ib(e,d):c.B[f++].bb(e,d)|c.B[f&c.K].bb(0,d+1)<<8;b&&qd(a,b)}return c};
|
||||
g.sb=function(a,b,c){var d=T(a);if(-1!==d){var e=this.B;e.B[(d&e.u)>>>e.O].Sa(d&e.s,b&255,d);c&&qd(a,c);I(this.b,!0)}};g.Mb=function(a,b,c){var d=T(a);if(-1!==d){var e=this.B,f=d&e.s,k=(d&e.u)>>>e.O;f!=e.s?e.B[k].Lb(f,b&65535,d):(e.B[k++].Sa(f,b&255,d),e.B[k&e.K].Sa(0,b>>8&255,d+1));c&&qd(a,c);I(this.b,!0)}};function P(a){return{w:a||0,fa:!1}}function rd(a){return[a.w,a.fa]}function sd(a){return{w:a[0],fa:a[1]}}
|
||||
function U(a,b,c){var d;c=(c?a.L:a.vb).w;if(void 0!==b){d=b=td(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var f=a.G[c].ha[d];if(void 0!==f){d=f.o;void 0!==d&&(e=P(d));break}}if(d=e)return d;c=ud(a,b,void 0)}null!=c&&(d=P(c));return d}function vd(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Nb=wd(a,b.Jb=c[2]))}function qd(a,b){null!=a.w&&(a.w+=b||1)}
|
||||
function xd(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.la(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function kd(a,b){a.C=a;a.W=a.Ob=1073741824;a.ra=null;var c=wd(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in Q)0<=wa(c,d)&&(a.W|=Q[d],a.g(d+" messages enabled"))}function pd(a,b){for(var c in Q)if(64==Q[c]){a.Ta[c]=b;break}}
|
||||
function yd(a,b){var c;a=a.toUpperCase();null==b?c=wa(nd,a):(c=wa(nd,a.substr(b,3)),0>c&&(c=wa(nd,a.substr(b,2))));return c}function zd(a,b){var c=0,d=Ad(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 8:c=2;break;case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?n(d,c):"??"}
|
||||
function Ad(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.za;break;case 8:c=Wc(d)&255;break;case 0:c=d.ka;break;case 1:c=d.na;break;case 9:c=d.ka<<8|d.na;break;case 2:c=d.oa;break;case 3:c=d.Aa;break;case 10:c=d.oa<<8|d.Aa;break;case 4:c=d.pa;break;case 5:c=d.Ba;break;case 11:c=d.pa<<8|d.Ba;break;case 12:c=d.za<<8|Wc(d)&255;break;case 13:c=d.Da;break;case 14:c=d.N}}return c}
|
||||
function Bd(a,b){b=td(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=yd(b,c+1),0<=e&&(b=b.substr(0,c)+zd(a,e)+b.substr(c+1+nd[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=da(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=U(a,e))?(d=e+' "'+xd(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=U(a,e))?(qd(d),d=e+' "'+
|
||||
xd(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}g.message=function(a,b){b&&(a+=" at "+n(P(this.b.N).w,4));if(!this.ra||a!=this.ra)if(this.ra=a,this.W&-2147483648&&(this.S(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.Pa=0;c.G-=c.u;c.u=0;I(c)}};function Cd(a,b,c,d){a.message(b.Ua+"."+(null!=d?"outPort":"inPort")+"("+q(c)+",unknown"+(null!=d?",0x"+n(d,2):"")+")")}
|
||||
function jd(a){var b;if($c(a)){if(!a.K||!a.K.length){a.K=Array(1E3);for(b=0;b<a.K.length;b++)a.K[b]=P();a.ea=0;a.g("instruction history buffer allocated")}if(!a.I||!a.I.length)for(a.I=Array(256),b=0;b<a.I.length;b++)a.I[b]=[b,0]}else a.K&&a.K.length&&a.g("instruction history buffer freed"),a.ea=0,a.K=[],a.I=[]}g.Ea=function(a){if(!Dd(this))return!1;this.b.Ea(a);return!0};
|
||||
g.Ra=function(a,b,c){if(!Dd(this))return!1;this.J=0;a||$c(this)&&ad(this,this.b.N,0);try{var d=this.b.Ra(a);0<d&&(this.J+=d,rc(this.b,d,!0),oc(this.b,d),this.T++)}catch(e){"number"!=typeof e&&(this.J=0,sb(this.b,e.stack||e.message))}!1!==c&&I(this.b);this.ca(b||!1);return 0<this.J};g.S=function(a){this.b&&this.b.S(a)};g.ca=function(a){void 0===a&&(a=!0);this.L=P(this.b.N);a&&1!=this.P?Ed(this):Fd(this)};
|
||||
function Dd(a){var b;if(b=a.b&&rb(a.b))b=a.b,b.j.U?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!qb(a.b)?(a=a.b,a.j.Ia?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}g.ja=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};g.ia=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};g.reset=function(a){jd(this);this.T=this.Fa=0;this.ra=null;this.J=0;this.L=P(this.b.N);this.j.V=!1;Gd(this);a||this.ca()};
|
||||
g.save=function(){var a=new J(this);M(a,0,rd(this.L));M(a,1,rd(this.Y));M(a,2,[this.A,this.da,this.W]);M(a,3,this.G);return a.data()};g.restore=function(a){var b=0;void 0!==a[2]&&(this.L=sd(a[b++]),this.Y=sd(a[b++]),this.A=a[b][0],"string"==typeof this.A&&(this.A=[this.A]),this.da=a[b][1],this.W|=a[b][2]);a[3]&&(this.G=a[3]);return!0};g.start=function(a,b){this.P||this.g("running");this.j.V=!0;this.Pb=a;this.Sb=b};
|
||||
g.stop=function(a,b){if(this.j.V){this.j.V=!1;this.J=b-this.Sb;if(!this.P){var c="stopped";if(this.J){var d=a-this.Pb,e=0<d?Math.round(1E3*this.J/d):0,c=c+" (";$c(this)&&(c+=this.T+" opcodes, ",this.Fa-=this.T,this.T=0);c+=this.J+" cycles, "+d+" ms, "+e+" hz)"}else ob(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.ca(!0);this.cb();Gd(this,this.b.N)}};function $c(a){return 1<a.u.length||!!a.qa}
|
||||
function ad(a,b,c){var d=a.b;if(0<c&&(a.qa&&!--a.qa||ec(a,b,1,a.u)))return!0;0<=c&&a.I.length&&(a.T++,b=Cb(a.B,b),null!=b&&(a.I[b][1]++,b=a.K[a.ea],b.w=d.N,b.fa=!1,++a.ea==a.K.length&&(a.ea=0)));return!1}function Hd(a,b,c){a.g("break on input from port "+q(b)+": "+n(c));a.S(!0)}function Id(a,b,c){a.g("break on output to port "+q(b)+": "+n(c));a.S(!0)}
|
||||
function id(a){var b,c;a.u=["bp"];if(void 0!==a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.b;fc(d.sa[T(c)>>>d.O],!1)}a.M=["br"];if(void 0!==a.F)for(b=1;b<a.F.length;b++)c=a.F[b],d=a.b,fc(d.sa[T(c)>>>d.O],!0);a.F=["bw"];a.xb=0}g.ta=function(a,b,c){var d=!0;c||Jd(this,a,b,!1,!0);if(a!=this.u){var e=T(b);if(-1===e)this.g("invalid address: "+n(b.w,4)),d=!1;else{var f=this.b;f.sa[e>>>f.O].ta(e&f.M,a==this.F)}}d&&(a.push(b),c?b.fa=!0:(Kd(this,a,a.length-1,"set"),jd(this)));return d};
|
||||
function Jd(a,b,c,d,e){var f=!1;c=T(c);for(var k=1;k<b.length;k++){var h=b[k];if(c==T(h)&&(!d||h.fa)){f=!0;h.fa||e||Kd(a,b,k,"cleared");b.splice(k,1);b!=a.u&&(d=a.b,fc(d.sa[c>>>d.O],b==a.F));h.fa||jd(a);break}}return f}function Ld(a,b){for(var c=1;c<b.length;c++)Kd(a,b,c);return b.length-1}function Kd(a,b,c,d){c=b[c];a.g(b[0]+" "+n(c.w,4)+(d?" "+d:c.Jb?' "'+c.Jb+'"':""))}
|
||||
function Gd(a,b){if(void 0!==b)ec(a,b,1,a.u,!0),a.P=0;else for(var c=1;c<a.u.length;c++){var d=a.u[c];if(d.fa){if(!Jd(a,a.u,d,!0))break;c=0}}}
|
||||
function ec(a,b,c,d,e){var f=!1;if(!a.xb++)for(var k=1;!f&&k<d.length;k++){var h=d[k];if(!e||h.fa)for(var l=T(h),m=0;m<c;m++)if(b+m==l){var p,f=!0;h.fa&&(Jd(a,d,h,!0),e=!0);if(p=h.Nb){for(var f=!1,r=0;r<p.length;r++)if(!Md(a,p[r],!0)){if(p[r].indexOf("if")){f=!0;break}for(var t=r+1;t<p.length&&p[t].indexOf("else");t++)r++;if(t==p.length){f=!0;break}}a.b.j.V||(f=!0)}if(f){e||Kd(a,d,k,"hit");break}}}a.xb--;return f}
|
||||
function Nd(a,b,c,d){for(var e=P(b.w),f=a.la(b,1),k=a.gb[f],f="",h=null,l=md[k[0]],m=k.length-1,p=1;p<=m;p++){var r="",t=k[p];if(void 0!==t){var K=t&15;if(0==K){if(null==h)continue;K=h}h=K;K=t&240;if(32==K){var r=a,K=b,B=" ";switch(t&15){case 1:t&12288&&(B=n(r.la(K,1),2));break;case 2:B=n(r.la(K,1)<<24>>24,4);break;case 3:B=n(r.fb(K,2),4);break;default:B="imm("+q(t)+")"}r=B}else 16==K&&(r=nd[(t&3840)>>8]);if(!r||!r.length){f="INVALID";break}0<f.length&&(f+=",");f+=r||"???"}}k="";h=n(e.w,4)+" ";if(-1!==
|
||||
e.w&&-1!==b.w){do if(k+=n(a.la(e,1),2),null==e.w)break;while(e.w!=b.w)}h+=ra(k,11);h+=ra(l,7);f&&(h+=" "+f);c&&(h=ra(h,40)+";"+c,h=a.b.j.Ha?h+("cycles="+pc(a.b).toString()+" cs="+n(a.b.i.Wa)):h+(null!=d?"="+d.toString():""));return h}
|
||||
function Od(a,b){var c;switch(b){case "I":c=a.b.Ca&512;break;case "S":c=Xc(a.b);break;case "Z":c=a.b;c=c.b&c.A-1?0:64;break;case "A":c=a.b;c=(c.R^c.F)&16?16:0;break;case "P":c=ub[a.b.R&255]?4:0;break;case "C":c=a.b;c=c.b&c.A?1:0;break;default:c=0}return b+(c?"1":"0")+" "}function V(a,b){return nd[b]+"="+zd(a,b)+" "}var Pd={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
|
||||
function Qd(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 ud(a,b,c){var d;if(b){b=td(a,b);for(var e=0,f=!1,k=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var p=m[e++],r=p.length,p=sa(p);if(!p){f=!0;break}p=Rd(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}h.push(p);if(e==m.length)break;var p=m[e++],t=p.length;l.length&&Pd[p]<Pd[l[l.length-1]]&&Qd(h,l,1);l.push(p);b=b.substr(r+t)}Qd(h,l)&&1==h.length||(f=!0);f?c&&a.g("error parsing '"+k+"' at character "+(k.length-b.length)):(d=h.pop(),c&&re(a,null,
|
||||
d))}return d}function td(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=ud(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=U(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.fb(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.T-a.Fa}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
|
||||
function Rd(a,b,c,d){var e;void 0!==b?(e=yd(b),0<=e?e=Ad(a,e):(e=a.aa[b],void 0===e&&(e=da(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function re(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,k="";if(!f||4<f)f=4;for(var h=0;h<f;h++){k&&(k=","+k);var l=d&255,m=8,p="";void 0===m?m=32:32<m&&(m=32);if(null==l||isNaN(l))for(;0<m--;)p="?"+p;else for(;0<m--;)p=(l&1?"1":"0")+p,l>>=1;k=p+"b"+k;d>>=8}d="0x"+n(c)+" "+c+". ("+k+")"}a.g((null!=b?b+": ":"")+d);return e}function se(a,b){if(b)return re(a,b,a.aa[b]);var c=0;for(b in a.aa)re(a,b,a.aa[b]),c++;return 0<c}hd.prototype.tb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function te(a,b,c){var d=[],e=T(b)>>>0;for(b=0;b<a.G.length;b++){var f=a.G[b],k=f.w>>>0,h=f.Ub;if(e>=k&&e<k+h){e=ta(f.ub,[e-k],a.tb);0<=e?ue(a,b,e,d):c&&(e=~e,ue(a,b,e-1,d),ue(a,b,e,d));break}}return d}function ue(a,b,c,d){var e={},f=a.G[b].ub,k=0,h=null;0<=c&&c<f.length&&(k=f[c][0],h=f[c][1]);h&&(e=a.G[b].ha[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(k);d.push(e.a);d.push(e.c)}
|
||||
function ve(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.I)if("clear"==b){for(c=0;c<a.I.length;c++)a.I[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.I.slice();e.sort(function(a,b){return b[1]-a[1]});for(c=0;c<e.length;c++){var f=e[c][0],k=e[c][1];k&&(a.g((md[a.gb[f][0]]+" ").substr(0,5)+" ("+("0x"+n(f,2))+"): "+k+" times"),d++)}}d||a.g("no frequency data available")}}
|
||||
function we(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return se(a)||a.g("no variables"),!0;if(!c[2])return se(a,c[1]);if(!c[3])return delete a.aa[c[1]],!0;var d=ud(a,c[3]);return void 0!==d?(a.aa[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function xe(a,b,c){var d=null;if(b=U(a,b,!0)){var e=te(a,b,!0);if(e.length){var f,k;e[0]&&(k="",(f=b.w-e[1])&&(k=" + "+q(f)),f=e[0]+" ("+n(e[1],4)+")"+k,c&&a.g(f),d=f);4<e.length&&e[4]&&(k="",(f=e[5]-b.w)&&(k=" - "+q(f)),f=e[4]+" ("+n(e[5],4)+")"+k,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
|
||||
function Ed(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{null==c&&(c=!0);if(null!=b&&1<b.length){var d=b[1],e=null,f=d.indexOf("=");if(0<f)e=d.substr(f+1),d=d.substr(0,f);else if(2<b.length)e=b[2];else{a.g("missing value for "+b[1]);return}var f=!1,k=ud(a,e);if(void 0!==k){var f=!0,h=d.toUpperCase();"E"==h.charAt(0)&&(h=null);switch(h){case "A":a.b.za=k&255;break;case "B":a.b.ka=k&255;break;case "BC":a.b.ka=k<<
|
||||
8&255;case "C":a.b.na=k&255;break;case "D":a.b.oa=k&255;break;case "DE":a.b.oa=k<<8&255;case "E":a.b.Aa=k&255;break;case "H":a.b.pa=k&255;break;case "HL":a.b.pa=k<<8&255;case "L":a.b.Ba=k&255;break;case "SP":a.b.Da=k&65535;break;case "PC":a.b.N=k&65535;a.L=P(a.b.N);break;case "PS":Vc(a.b,k);break;case "C":k?(d=a.b,d.b|=d.A):(d=a.b,d.b&=~d.A);break;case "P":k?(d=a.b,ub[d.R&255]||(d.R^=1)):(d=a.b,ub[d.R&255]&&(d.R^=1));break;case "A":k?(d=a.b,d.F=~(d.R&16)&16|d.F&-17):(d=a.b,d.F=d.R&16|d.F&-17);break;
|
||||
case "Z":k?(d=a.b,d.b&=~(d.A-1)):(d=a.b,d.b|=d.A-1);break;case "S":k?Yc(a.b):(d=a.b,Xc(d)&&(d.R^=d.A>>1|d.A>>2,d.F^=32896));break;case "I":k?(d=a.b,d.Ca|=512):(d=a.b,d.Ca&=-513);break;default:a.g("unknown register: "+d);return}}if(!f){a.g("invalid value: "+e);return}I(a.b);a.g("updated registers:")}a.g(V(a,7)+V(a,8)+V(a,0)+V(a,1)+V(a,2)+V(a,3)+V(a,4)+V(a,5)+V(a,13)+Od(a,"I")+Od(a,"S")+Od(a,"Z")+Od(a,"A")+Od(a,"P")+Od(a,"C"));c&&(a.L=P(a.b.N),Fd(a,n(a.L.w,4)))}}
|
||||
function ye(a,b){b=sa(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Bd(a,c[2])):ud(a,b,!0)}function ze(a,b,c){var d="t"!=b;c=Rd(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ka(c,function(){return pb(a,!0)&&a.Ra(e,d,!1)},function(){I(a.b);pb(a,!1)})}
|
||||
function Fd(a,b,c,d){if(b=U(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=U(a,c,!0);if(!d||d.w<b.w)return;e=d.w-b.w;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=qb(a,!1)||a.P?a.J:null;var k=null!=f?"cycles":null,h=te(a,b),l=b.w;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.g(m)}h[3]&&(k=h[3],f=null);f=Nd(a,b,k,f);a.g(f);a.L=b;e-=b.w-l;c++}}}
|
||||
function wd(a,b,c,d){if(c)if(b){0>a.D&&a.A.length&&(a.D=0);if(0>a.D||b!=a.A[a.D])a.A.splice(0,0,b),a.D=0;a.D--}else b=a.A[a.D+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 k=b.charAt(f);if('"'==k||"'"==k)e?k==e&&(e=null):e=k;else if(k==d&&!e||!k)a.push(sa(b.substring(c,f))),c=f+1}}return a}
|
||||
function Md(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.da&&(a.g("ended assemble at "+n(a.Y.w,4)),a.L=a.Y,a.da=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ra=null;if(rb(a)&&0<b.length){a.da&&(b="a "+n(a.Y.w,4)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var k=f[0],h=k.charAt(0),l=1;l<k.length;l++){var m=k.charAt(l);if("?"==h||"r"==h||"a">m||"z"<m){f[0]=k.substr(l);f.unshift(k.substr(0,l));break}}switch(f[0].charAt(0)){case "a":var p=U(a,f[1],!0);if(p)if(a.Y=
|
||||
p,void 0===f[2])a.g("begin assemble at "+n(p.w,4)),a.da=!0,I(a.b);else{var r;a.g("not supported yet");r=[];if(r.length){for(var t=0;t<r.length;t++)a.sb(p,r[t],1);a.g(Nd(a,a.Y))}}break;case "b":a:{var K=f[0],B=f[1],Ue=b;if("?"==B)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=K.charAt(1);if("l"==X){var Ba=0,Ba=Ba+Ld(a,a.u),Ba=Ba+Ld(a,a.M);(Ba+=Ld(a,a.F))||a.g("no breakpoints")}else if("n"==X)a.qa=Rd(a,B),a.g("break after "+a.qa+" instruction(s)");else if(void 0===B)a.g("missing breakpoint address");else{var A=P();if("*"!=B&&(A=U(a,B,!0),!A))break a;B=q(A.w);"c"==X?null==A.w?(id(a),a.g("all breakpoints cleared")):Jd(a,a.u,A)||Jd(a,a.M,
|
||||
A)||Jd(a,a.F,A)||a.g("breakpoint missing: "+n(A.w,4)):"i"==X?a.g("breakpoint "+(Db(a.B,A.w)?"enabled":"cleared")+": port "+B+" (input)"):"o"==X?a.g("breakpoint "+(Eb(a.B,A.w)?"enabled":"cleared")+": port "+B+" (output)"):null!=A.w&&(vd(a,A,Ue),"p"==X?a.ta(a.u,A):"r"==X?a.ta(a.M,A):"w"==X?a.ta(a.F,A):a.g("unknown breakpoint command: "+X))}}}break;case "c":a.ua&&(a.ua.value="");break;case "d":a:{var Ca,Da=f[0],Y=f[1],na=f[2],Ve=f[3];if("?"==Y){var Z="";for(Ca in Q)a.Ta[Ca]&&(Z&&(Z+=","),Z+=Ca);Z+=",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");Z.length&&a.g("dump extension commands:\n\t"+Z)}else if("state"==Y){var Sd=Ae(a.s,!0);"console"==na?console.log(Sd):(a.ua&&(a.ua.value=""),a.g(Sd))}else if("symbols"==Y)for(var tc=0;tc<a.G.length;tc++){var uc=a.G[tc],Fa;for(Fa in uc.ha)if("."!=Fa.charAt(0)){var Td=uc.ha[Fa].o;
|
||||
if(void 0!==Td){var Ud=uc.ha[Fa].l;Ud&&(Fa=Ud);a.g(n(Td,4)+" "+Fa)}}}else{if("d"==Da){for(Ca in Q)if(f[1]==Ca){var Vd=a.Ta[Ca];Vd?(f.shift(),f.shift(),Vd(f)):a.g("no dump registered for "+Y);break a}Y||(Da=a.Tb||"db")}else a.Tb=Da;if("dh"==Da){var Wd=Y,Xd=na,Yd="",Zd=0,D=a.ea,aa=a.K;if(aa.length){var L=+Wd||a.yb,Ga=+Xd||10;isNaN(L)?L=Ga:Yd="more ";L>aa.length&&(a.g("note: only "+aa.length+" available"),L=aa.length);D-=L;0>D&&(null==aa[aa.length-1].w?(L=D+L,D=0):D+=aa.length);var vc=[];"call"==Xd&&
|
||||
(Ga=1E5,vc=["CALL"]);for(void 0!==Wd&&a.g(L+" instructions earlier:");0<Ga&&D!=a.ea;){var $d=aa[D++];if(null==$d.w)break;var Za=P($d.w),We=L--,ae=Nd(a,Za,"history",We);(!vc.length||0<=ae.indexOf(vc[0]))&&a.g(ae);Za.mb&&(D+=Za.mb,Ga-=Za.mb,L-=Za.mb);D>=aa.length&&(D=0);a.yb=L;Zd++;Ga--}}Zd||(a.g("no "+Yd+"history available"),a.yb=void 0)}else{var Fb=U(a,Y);if(Fb){var Gb=0;na&&("l"==na.charAt(0)&&(na=na.substr(1)||Ve),Gb=Rd(a,na)>>>0,65536<Gb&&(Gb=65536));for(var oa="",Xe=(Gb||128)+15>>4||1,wc="dd"==
|
||||
Da?4:"dw"==Da?2:1,be=0;be<Xe;be++){for(var Hb=0,xc=0,$a="",yc="",Y=n(Fb.w,4),zc=0;16>zc;zc++){var Ib=a.la(Fb,1),Hb=Hb|Ib<<(xc++<<3);xc==wc&&($a+=n(Hb,2*wc),$a+=1==wc?7==zc?"-":" ":" ",Hb=xc=0);yc+=32<=Ib&&128>Ib?String.fromCharCode(Ib):"."}oa&&(oa+="\n");oa+=Y+" "+$a+" "+yc}oa&&a.g(oa);a.vb=Fb}}}}break;case "e":if("else"==f[0])break;var Jb=1,ce=255,de=a.la,ee=a.sb;"ew"==f[0]&&(Jb=2,ce=65535,de=a.fb,ee=a.Mb);var fe=Jb<<1,ge=f[1];if(null==ge)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 Kb=U(a,ge);if(Kb)for(var Lb=2;Lb<f.length;Lb++){var ab=ud(a,f[Lb]);if(void 0===ab){a.g("unrecognized value: "+f[Lb]);break}ab&~ce&&a.g("warning: "+n(ab)+" exceeds "+Jb+"-byte value");var Ye=de.call(a,Kb);a.g("changing "+n(Kb.w,4)+" from 0x"+n(Ye,fe)+" to 0x"+n(ab,fe));ee.call(a,Kb,ab,Jb)}}break;case "f":ve(a,f[1]);break;case "g":a:{var he=f[1],Ze=b;if(void 0!==he){var Ac=U(a,he,!0);if(!Ac)break a;vd(a,Ac,Ze);a.ta(a.u,Ac,!0)}a.Ea(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;
|
||||
case "h":var Bc;a.j.V?(Bc="halting",a.S()):Bc="already halted";c||a.g(Bc);break;case "i":if("if"==f[0]){var Cc;var bb=b.substr(2),bb=sa(bb);ud(a,bb)?(c||a.g("true: "+bb),Cc=!0):(c||a.g("false: "+bb),Cc=!1);Cc||(d=!1);break}var Dc=f[1];if(Dc&&"?"!=Dc){var Ec=Rd(a,Dc);if(void 0!==Ec){for(var R=a.B,ga=Ec,Fc=1,Gc=0,Hc=0;0<Fc;){var Mb=R.A[ga],cb=R.P[ga]||1,Ic=1==cb?255:2==cb?65535:-1,ha=Ic;void 0!==Mb?(Mb[0]&&(ha=Mb[0](ga,void 0),void 0===ha?ha=Ic:ha&=Ic),R.C&&R.F!=Mb[1]&&Hd(R.C,ga,ha)):R.C&&(Cd(R.C,R,
|
||||
ga,null),R.F&&Hd(R.C,ga,ha));Gc|=ha<<Hc;Hc+=cb<<3;ga+=cb;Fc-=cb}a.g(q(Ec)+": "+("0x"+n(Gc,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 $e=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var Jc=0,ie=P(),db=P(a.b.Da);for(a.g("stack trace for "+n(db.w,4));10>Jc;){for(var pa=null,af=256;65536>db.w>>>0;){ie.w=a.fb(db,2);if(null==db.w||!af--)break;
|
||||
for(var bf=a,Nb=ie,je=null,eb=Nb.w,ke=eb,Kc=1;6>=Kc&&eb;Kc++){if(2<Kc){Nb.w=eb;var Ob=Nd(bf,Nb);if(0<Ob.indexOf("CALL")){var le=Ob.indexOf(" ");if(eb+(Ob.indexOf(" ",le+1)-le-1)/2==ke){je=Ob;break}}}eb--}Nb.w=ke;if(pa=je)break}if(!pa||null==pa)break;var me=null;if("ks"==$e){var ne=pa.match(/[0-9A-F]+$/);ne&&(me=xe(a,ne[0]))}pa=ra(pa,50)+" ;"+(me||"stack="+n(db.w,4));a.g(pa);Jc++}Jc||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){xe(a,f[1],!0);break}break;case "m":a:{var ba,ca=null,
|
||||
w=f[1];"?"==w&&(w=void 0);if(void 0!==w){var qa=0;if("all"==w)qa=1610481663,w=null;else if("on"==w)ca=!0,w=null;else if("off"==w)ca=!1,w=null;else{"keys"==w&&(w="key");"kbd"==w&&(w="keyboard");for(ba in Q)if(w==ba){qa=Q[ba];ca=!!(a.W&qa);break}if(!qa){a.g("unknown message category: "+w);break a}}qa&&("on"==f[2]?(a.W|=qa,ca=!0):"off"==f[2]&&(a.W&=~qa,ca=!1))}var cf=0,ia="";for(ba in Q)if(!w||w==ba){var df=!!(a.W&Q[ba]);if(null===ca||ca==df)ia&&(ia+=","),++cf%10||(ia+="\n\t"),"key"==ba&&(ba="keys"),
|
||||
ia+=ba}void 0===w&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==ca?ca?"messages on: ":"messages off: ":"message categories:\n\t")+(ia||"none"));jd(a)}break;case "o":var Lc=f[1],ef=f[2];if(Lc&&"?"!=Lc){var Mc=Rd(a,Lc,"port #"),Nc=Rd(a,ef);if(void 0!==Mc&&void 0!==Nc){for(var S=a.B,ja=Mc,oe=Nc,Oc=1,Pc=0;0<Oc;){var Pb=S.D[ja],fb=S.T[ja]||1,ff=1==fb?255:2==fb?65535:-1,Qb=(oe>>>=Pc)&ff;if(void 0!==Pb){if(Pb[0])Pb[0](ja,Qb,void 0);S.C&&S.G!=Pb[1]&&Id(S.C,ja,Qb)}else S.C&&
|
||||
(Cd(S.C,S,ja,Qb),S.G&&Id(S.C,ja,Qb));Pc+=fb<<3;ja+=fb;Oc-=fb}a.g(q(Mc)+": "+("0x"+n(Nc,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]){ye(a,b.substr(5));break}var pe="pr"==f[0]?1:0,gf=1+pe;if(a.P)a.g("step in progress");else{var Qc=P(a.b.N);switch(a.la(Qc)){case 205:a.P=gf,qd(Qc,3)}a.P?(a.ta(a.u,Qc,!0),a.Ea()||(a.s&&a.s.cb(),a.P=0)):ze(a,pe?"tr":"t")}break;case "r":if("reset"==
|
||||
b){a.s&&a.s.reset();break}Ed(a,f);break;case "t":ze(a,f[0],f[1]);break;case "u":Fd(a,f[1],f[2],8);break;case "v":if("var"==f[0]){we(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.21.7 ("+a.b.Db+",RELEASE"+(tb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(ya());break;case "x":a:if(f[1]&&"?"!=f[1])switch(f[1]){case "cs":var gb;void 0!==f[3]&&(gb=+f[3]);switch(f[2]){case "int":a.b.i.Ma=gb;break;case "start":a.b.i.Xa=gb;break;case "stop":a.b.i.Oa=gb;break;default:a.g("unknown cs option");break a}void 0!==
|
||||
gb&&lc(a.b);a.g("checksums "+(a.b.j.Ha?"enabled":"disabled"));break;case "sp":void 0!==f[2]&&(qc(a.b,+f[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)");break;default:a.g("unknown option: "+f[1])}else a.g("execution options:"),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;case "?":if(f[1]){ye(a,b.substr(1));break}var hb="commands:",Rc;for(Rc in ld)hb+="\n"+ra(Rc,7)+ld[Rc];$c(a)||(hb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(hb);break;default:a.g("unknown command: "+b),d=!1}}}catch(qe){a.g("debugger error: "+(qe.stack||qe.message)),d=!1}return d}function mc(a,b,c){b=wd(a,b,c);for(var d in b)if(!Md(a,b[d]))return!1;return!0}Qa(function(){for(var a=F(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new hd(d);mb(d,c)}});
|
||||
function J(a,b,c){this.id=a.id;this.key=Be(a,b,c);this.C=a.C;Ce(this,a.Hb)}function Be(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}
|
||||
J.prototype={constructor:J,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){Ce(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 Ce(a,b){a[a.id]={};b&&M(a,"parms",b);a.b=!1}function De(a){var b=!0;if(Ea()){var c=JSON.stringify(a[a.id]);Ia(a.key,c)||(v("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ee(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){v(c.message||c),b=!1}return b}function Fe(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ea()&&(b=Ha(a.key))?(a[a.id]=b,a.b=!0):!1}function Ge(a,b){return a[a.id][b]||null}function M(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function He(a,b,c){x.call(this,"Computer",a,He,67108864);this.j.U=!1;Ie(this,b);this.M=jc(this,"autoPower",a);this.A=0;this.da=a.busWidth||a.buswidth;this.s=Je;this.K=null;this.G=this.aa=!1;this.ea=jc(this,"url")||"";(Math.random()+.1).toString(36);this.u=Ke(this);if(this.b=lb("CPU",this.id)){this.C=lb("Debugger",this.id);this.ga=[];for(b=null;b=wb(this,"Video",b);)this.ga.push(b);this.B=new yb({id:this.wb+".bus",buswidth:this.da},this.b,this.C);var d,e=C(this.id);if((this.D=lb("Panel",this.id))&&
|
||||
this.D.ua)for(b=0;b<e.length;b++)d=e[b],d.Z=this.D.Z,d.g=this.D.g,d.ua=this.D.ua;for(b=0;b<e.length;b++)d=e[b],d.Ka&&d.Ka(this,this.B,this.b,this.C);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.J=d:this.s=parseInt(d,10));var f;if(a=jc(this,"state")||(f=!0,a.state))b=this.P=a,f||(this.G=!0,this.s=Je),this.s&&(this.L=new J(this,W),Fe(this.L)?b=null:delete this.L);!b&&this.s&&(b=Le(this))&&(this.G=!0);if(b){var k=this;u(b,null,!0,function(a,b,c){c?(k.J=null,k.G=!1,k.Z("Unable to load machine state from server (error "+
|
||||
c+(b?": "+sa(b):"")+")")):(k.K=b,k.aa=!0);G(k)})}else G(this);this.H.power||(this.M=!0);!c&&this.M&&Me(this,this.ab)}else v("Unable to find CPU component")}z(He);var W="1.21.7",Je=0;function Ie(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){v(d.message+" ("+c+")")}}a.I=b}
|
||||
function jc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.I&&(d=a.I[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Me(a,b,c){for(var d=C(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!rb(f)){rb(f,function(){Me(a,b,c)});return}}b.call(a,c)}
|
||||
function Ne(a,b){var c=new J(a,W,"validate");if(Fe(c)&&Ee(c)){var d=Ge(c,"timestamp"),e=b?Ge(b,"timestamp"):"unknown";d!=e&&(a.Z("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}g=He.prototype;
|
||||
g.ab=function(a){void 0===a&&(a=this.s||(this.K?1:Je));if(!this.A){this.A++;var b=!1,c=!1;this.Y=!1;var d=this.L||new J(this,W);if(-1==a)b=!0;else if(a>Je){if(Fe(d,this.K)){this.F=new J(this,W,"failsafe");Fe(this.F)&&(Oe(this,d),a=2,Ce(this.F));M(this.F,"timestamp",va());De(this.F);var e=this.s&&!this.G;if(1==a||za("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Ee(d)){var f=Ge(d,"code"),k=Ge(d,"data");f&&("ok"==f?Fe(d,k):("error"==f&&"no machine state"!=
|
||||
k?(this.Z("Error: "+k),"unable to verify user"==k&&(Ia("user",""),this.u=null)):this.g(f+": "+k),Ce(d),Fe(d)?(c=Ee(d),e=!0):c=!1))}e&&Ne(this,c?d:null)}else 2==a&&d.clear()}else Ne(this);delete this.K;delete this.L}e=C(this.id);for(f=0;f<e.length;f++)k=e[f],k!==this&&k!=this.b&&(c=Pe(this,k,d,b,c));b=[d,a,c];-1!=a?Me(this,this.zb,b):this.zb(b)}};
|
||||
function Pe(a,b,c,d,e){if(!b.j.U){b.j.U=!0;if(b.ja){var f=null;e&&((f=Ge(c,b.id))||(f=Ge(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ja(f,d)&&f&&(v("Unable to restore state for "+b.type),a.P&&!a.aa?(c.clear(),a.s=Je,window&&window.location.reload()):a.Y=!0,b.ja(null),e=!1)}if(!d&&b.hb)for(a=b.hb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
g.zb=function(a){var b=a[0],c=0>a[1];a=a[2];this.j.U=!0;var d=this.H.power;d&&(d.textContent="Shutdown");this.T||(this.g("PC8080 v"+W+"\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.T=!0);this.b&&(Pe(this,this.b,b,c,a),nc(this.b));this.Y&&(Oe(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.A=0};
|
||||
function Oe(a,b){if(za("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.ea,d=a.u||"",e=b.toString(),f={app:"PC8080"};f.ver=W;f.url=c;f.user=d;f.type="bug";f.data=e;u("http://www.pcjs.org/api/v1/report",f,!0)}}
|
||||
function Ae(a,b,c){var d,e="none";if(a.A)return null;a.A--;var f=new J(a,W),k=new J(a,W,"validate"),h=va();M(k,"timestamp",h);M(f,"timestamp",h);M(f,"version","1.21.7");M(f,"url",window?window.location.href:null);M(f,"browser",ya());a.b&&a.b.ia&&(c&&a.b.S(),d=a.b.ia(b,c),"object"===typeof d&&M(f,a.b.id,d),c&&(a.b.j.U=!1,!1===d&&(e=null)));for(var h=C(a.id),l=0;l<h.length;l++){var m=h[l];m.j.U&&(m.ia&&(d=m.ia(b,c),"object"===typeof d&&M(f,m.id,d)),c&&(m.j.U=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.u&&
|
||||
Qe(a,a.u,f.toString()),De(k)&&De(f)||(e=null,d=h=!0)):a.s&&(d=!0,h=3==a.s),d&&f.clear(h)):e=f.toString());c&&(a.j.U=!1,b=a.H.power)&&(b.textContent="Power");a.A=0;return e}g.reset=function(){this.B&&this.B.reset&&(nb(this,"Resetting "+this.B.type),this.B.reset());for(var a=C(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(nb(this,"Resetting "+c.type),c.reset())}};
|
||||
g.start=function(a,b){for(var c=C(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};g.stop=function(a,b){for(var c=C(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
||||
g.ba=function(a,b,c){var d=this;switch(b){case "power":return this.H[b]=c,c.onclick=function(){d.A||(d.j.U?Ae(d,!1,!0):Me(d,d.ab))},!0;case "reset":return this.H[b]=c,c.onclick=function(){if(d.j.U&&!d.A)if(d.s&&!d.J){var a=za("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ae(d,a,!0);!a&&d.P?window&&window.location.reload():d.ab(Je)}else d.reset(),d.b&&nc(d.b)},!0;case "save":if(ka(xa(),"pcjs.org")){c.parentNode.removeChild(c);break}this.H[b]=
|
||||
c;c.onclick=function(){var a=Ke(d,!0);if(a){var b=!!(d.s&&!d.J||d.P),c=Ae(d,b);b?Qe(d,a,c):d.Z("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function Ke(a,b){var c=a.u;c||(c=Ha("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=Re(a,c))||a.Z("The user ID is invalid."))):b&&a.Z("Browser local storage is not available"));return c}
|
||||
function Re(a,b){a.u=null;var c=u(xa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(Ia("user",c.data),a.u=c.data)}catch(e){v(e.message+" ("+d+")")}return a.u}function Le(a){var b=null;a.u&&(b=xa()+"/api/v1/user?req=load&user="+a.u+"&state="+Be(a,W));return b}
|
||||
function Qe(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Be(a,W);d.data=c;b=u(xa()+"/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.Z("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.Z(c),Ia("user",""),a.u=null)}}
|
||||
function wb(a,b,c){a=C(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}g.cb=function(){};g.ca=function(a){this.b&&this.b.ca(a);this.D&&this.D.ca(a)};Qa(function(){for(var a=F(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=E(c),c=F(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],k=E(f),k=new He(k,d,!0);mb(k,f);k.M&&Me(k,k.ab)}});
|
||||
Ma.show.push(function(){for(var a=F(document,"pc8080","computer"),b=0;b<a.length;b++){var c=E(a[b]);(c=lb("Computer",c.id))&&c.T&&!c.j.U&&c.ab(-1)}});Ma.exit.push(function(){for(var a=F(document,"pc8080","computer"),b=0;b<a.length;b++){var c=E(a[b]);(c=lb("Computer",c.id))&&c.j.U&&Ae(c,!(!c.s||c.J),!0)}});var Se=0;function Te(a,b,c,d,e,f){e("Loading "+a+"...");u(a,null,!0,function(k,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):hf(h,a,b,c,d,e,f)})}
|
||||
function hf(a,b,c,d,e,f,k){function h(a,f){if(f)k(f,null);else{if(c){kb(c,b,a);var h=b;h&&0>h.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(h=window.location.pathname+h);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+h+'"}';"object"==typeof resources&&(h=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(h?' url="'+h+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));
|
||||
h=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(r){h=null,a=r.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,h)}}a?e?jf(a,f,h):h(a,null):k("no data"+(b?" for file: "+b:""),null)}
|
||||
function jf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");u(e,null,!0,function(f,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],k);jf(a,b,c)}})}else c(a,null)}
|
||||
function kf(a,b,c,d){function e(a){if(void 0===h){var b=k&&F(k,"machine-warning");h=b&&b[0]||k}h&&(h.innerHTML=ma(a))}function f(a){e("Error: "+a);l&&(--Se||Sa(!0));l=!1}var k,h,l=!0;Se++;jb[a]={};try{if(k=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));p.appendChild(r)}c||
|
||||
(c="/versions/pc8080/1.21.7/components.xsl");m=function(d,h){h?Te(c,null,null,!1,e,function(d,m){if(m)if(kb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=h.transformNode(m);l?(k.outerHTML=l,--Se||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(m),(l=l.transformToFragment(h,document))?k.parentNode?(k.parentNode.replaceChild(l,k),--Se||Sa(!0)):f("invalid machine element: "+
|
||||
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Te(b,a,d,!0,e,m):hf(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(t){f(t.message)}return l}window.embedPC8080=function(a,b,c,d){Sa(!1);return kf(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;
|
||||
function lf(a,b,c,d){if(!c&&b){d.push(b);a=jb[d[0]];b=null;for(var e in a)if(ka(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?u(b,null,!0,function(a,b){mf(b,d)}):mf(null,d)}else v("Error ("+c+") requesting "+a)}
|
||||
function mf(a,b){var c,d,e,f=b[0],k=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=jb[f],l={},m;for(m in h){var p=h[m],r=fa(m);if("xml"==r){for(r=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=r.exec(h[m]);){var t=d[2];t&&(h[t]||(p=p.replace(d[0],"")))}d=m=ea(m)}else"xsl"==r&&(e=m=ea(m));l[m]=p}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),k+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
"©"),m=k,h=null,l="data:application/javascript,",l=Ja("Firefox")?l+encodeURIComponent(c):l+encodeURI(c),m&&(h=document.createElement("a"),"string"!=typeof h.download&&(h=null)),h?(h.href=l,h.download=m,document.body.appendChild(h),h.click(),document.body.removeChild(h),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 "'+k+'", 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="'+k+'">\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.",v(c)):v("Missing XML/XSL resources")}
|
||||
window.savePC=function(a,b,c){var d=lb("Computer",a),e=lb("Debugger",a);if(d){var f=Ae(d,!0),k=d.I?JSON.stringify(d.I):null;b||(b="/versions/pcjs/1.21.7/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Hb:k}))return!0;u(b,null,!0,function(c,d,e){lf(c,d,e,[a,ea(b,!0),k,f])});return!0}v("Unable to identify machine '"+a+"'");return!1};})();
|
||||
92
versions/pc8080/1.21.7/pc8080.js
Normal file
92
versions/pc8080/1.21.7/pc8080.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
(function(){var e;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 f,d=a,g=b;(g&&10!=g?16==g?null!==d.match(/^[0-9a-f]+$/i):2==g&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|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 p=Date.now||function(){return+new Date};function ga(){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 f=0,g=null,k=null;if("object"==typeof resources&&(g=resources[a]))return d&&d(a,g,f),[g,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),k;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(g=h.responseText,200==h.status||!h.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,g,f))});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,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(g=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,g,f),k=[g,f]);return k}function t(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function u(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}var ia=null;function ja(){if(null==ia){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}ia=a}return ia}function ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function la(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function ma(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},na=!1,oa=!0;function qa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function w(a){v.init.push(a)}
|
||||
function ra(a){if(oa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){u("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function x(a){!oa&&a?(oa=!0,na&&sa("init")):oa=a}function sa(a){v[a]&&ra(v[a])}qa("onload",function(){na=!0;ra(v.init)});qa("onpageshow",function(){ra(v.show)});qa(ma("Opera")||ma("iOS")?"onunload":"onbeforeunload",function(){ra(v.exit)});
|
||||
function y(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.ua=b.comment;this.Ua=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Ka=this.id.substr(0,b),this.va=this.id.substr(b+1)):this.va=this.id;this[a]=c;this.c={aa:!1,ha:!1,Ea:!1,u:!1,S:!1};this.ya=null;this.c.S=!1;this.h={};this.w=null;z.push(this)}var ta=void 0,ua={};
|
||||
if(window){ta||(ta=window.location.search.substr(1));for(var va,wa=/\+/g,xa=/([^&=]+)=?([^&]*)/g;va=xa.exec(ta);)ua[decodeURIComponent(va[1].replace(wa," "))]=decodeURIComponent(va[2].replace(wa," "))}function ya(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 B(a,b){b||(b=y);a.prototype=ya(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var z=[],C={};function za(a,b,c){C[a]&&b&&(C[a][b]=c)}function D(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<z.length;b++){var d=z[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function E(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<z.length;d++)if(c)c==z[d]&&(c=null);else if(!(a!=z[d].type||b&&z[d].id.indexOf(b)))return z[d]}return null}function F(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){u(c.message+" ("+a+")")}return b}
|
||||
function G(a,b){for(var c=H(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var f=c[d].childNodes,g=0;g<f.length;g++){var k=f[g];if(1===k.nodeType){var h=k.getAttribute("class");if(h)for(var l=h.split(" "),m=0;m<l.length;m++)switch(h=l[m],h){case "pc8080-binding":(h=F(k))&&h.binding&&a.G(h.type,h.binding,k,h.value),m=l.length}}}}
|
||||
function H(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
|
||||
y.prototype={constructor:y,parent:null,toString:function(){return this.name?this.name:this.id||this.type},G:function(a,b,c){switch(b){case "clear":return this.h[b]||(this.h[b]=c,c.onclick=function(a){return function(){a.h.print&&(a.h.print.value="")}}(this)),!0;case "print":return this.h[b]||(this.Da=this.h[b]=c,c.value="",this.F=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.v=function(a,b,c){this.F(a,"notice",c)}),!0;default:return!1}},log:function(){},F:function(){},status:function(a){this.F(this.va+": "+a)},v:function(a,b){b||u(a)},R:function(){return this.c.u=!0},P:function(a,b){b&&(this.c.u=!1);return!0}};function Aa(a,b){if(a.c.Ea)return a.c.ha&&(a.c.ha=!1),a.c.Ea=!1;if(a.c.S)return a.F(a.toString()+" error"),!1;a.c.ha=b;return a.c.ha}function I(a){if(!a.c.S&&(a.c.aa=!0,a.c.aa)){var b=a.ya;a.ya=null;b&&b()}}
|
||||
function Ba(a,b){b&&(a.c.aa?b():a.ya=b);return a.c.aa}
|
||||
var J="undefined"!==typeof ArrayBuffer,Ca=[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 Da(a){y.call(this,"Panel",a,Da)}B(Da);e=Da.prototype;e.G=function(a,b,c,d){return this.b&&this.b.G(a,b,c,d)||this.a&&this.a.G(a,b,c,d)||this.f&&this.f.G(a,b,c,d)?!0:this.parent.G.call(this,a,b,c,d)};e.ia=function(a,b,c,d){this.b=a;this.j=b;this.a=c;this.w=d;this.f=Ea(a,"Keyboard")};e.R=function(a,b){b||Fa();return!0};e.P=function(){return!0};e.V=function(){};
|
||||
function Fa(){for(var a=!1,b=H(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],f=F(d),g;a:{g=f.id;if(void 0!==g)for(var k=void 0,k=0;k<z.length;k++)if(z[k].id===g){g=z[k];break a}g=null}g||(a=!0,g=new Da(f));G(g,d);a&&I(g)}}w(Fa);
|
||||
function K(a,b,c){y.call(this,"Bus",a,K);this.a=b;this.w=c;this.g=a.buswidth||16;this.m=Math.pow(2,this.g);this.i=this.m-1|0;this.l=20>=this.g?12:24>=this.g?14:15;this.f=1<<this.l;this.o=this.f>>2;this.s=this.f-1;this.j=this.m/this.f|0;a=new L;Ga(a,this.w);this.b=Array(this.j);for(b=0;b<this.j;b++)this.b[b]=a;a=this.a;b=this.l;c=this.i;a.sa=this.b;a.l=b;a.f=1<<a.l;a.qa=a.f-1;a.ra=c;I(this)}B(K);K.prototype.reset=function(){};K.prototype.R=function(a,b){b||this.reset();return!0};
|
||||
function Ha(a,b,c,d){for(var f=b>>>a.l;0<c&&f<a.b.length;){var g=a.b[f],k=f*a.f,h=c>a.f?a.f:c;if(g&&g.size){if(g.type==d){if(b+c<=g.ga)return g.Ca+=g.ga-b,g.ga=b,!0;if(b>=g.ga+g.Ca){h=g.size-(b-k);h>c&&(h=c);g.Ca=b-g.ga+h;c-=h;b=k+a.f;continue}}return Ia(1,b,c)}g=a.b[f];b=new L(b,h,a.f,d);Ga(b,a.w,g);a.b[f++]=b;b=k+a.f;c-=h}return 0>=c?!0:Ia(2,b,c)}function Ia(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ja;
|
||||
if(J){var Ka=new ArrayBuffer(2);(new DataView(Ka)).setUint16(0,256,!0);Ja=256===(new Uint16Array(Ka))[0]}else Ja=!1;var La=Ja;
|
||||
function L(a,b,c,d){this.id=Ma+=2;this.a=null;this.ga=a;this.Ca=b;this.size=c||0;this.type=d||Na;this.i=d==Oa;Ga(this);this.O=this.bb=!1;if(c)if(J)this.b=new ArrayBuffer(c),this.j=new DataView(this.b,0,c),this.h=new Uint8Array(this.b,0,c),this.l=new Uint16Array(this.b,0,c>>1),this.a=new Int32Array(this.b,0,c>>2),Pa(this,La?Qa:Ra);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;Pa(this,Sa)}else Pa(this)}var Na=0,Oa=2,Ma=0;
|
||||
L.prototype={constructor:L,parent:null,save:function(){var a,b;if(J)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.j.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(J)for(b=0;b<a.length;b++)this.j.setInt32(b<<2,a[b],!0);else this.a=a;return this.O=!0}return!1},m:function(){return 255},s:function(){},L:function(a,b){return this.Ia(a++,b++)|this.Ia(a,b)<<8},sa:function(a,b,c){this.o(a++,b&255,c++);this.o(a,b>>8,c)},H:function(a){return this.a[a>>
|
||||
2]>>>((a&3)<<3)&255},W: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},$:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.O=!0},va: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.O=!0},B:function(a,b){return this.C(a,b)},J:function(a,b){return this.M(a,b)},Y:function(a,b,c){this.i||this.Xa(a,b,c)},ra:function(a,b,
|
||||
c){this.i||this.ta(a,b,c)},A:function(a){return this.h[a]},D:function(a){return this.h[a]},I:function(a){return this.j.getUint16(a,!0)},N:function(a){return a&1?this.h[a]|this.h[a+1]<<8:this.l[a>>1]},X:function(a,b){this.h[a]=b;this.O=!0},Z:function(a,b){this.h[a]=b;this.O=!0},qa:function(a,b){this.j.setUint16(a,b,!0);this.O=!0},ua:function(a,b){a&1?(this.h[a]=b,this.h[a+1]=b>>8):this.l[a>>1]=b;this.O=!0}};function Ga(a,b,c){a.w=b;a.f=a.g=0;c&&((a.f=c.f)&&Ta(a,Ua,!1),(a.g=c.g)&&Va(a,Ua,!1))}
|
||||
function Va(a,b,c){c&&a.g||(a.o=!a.i&&b[2]||a.s);if(c||void 0===c)a.Xa=b[2]||a.s,a.ta=b[3]||a.sa}function Ta(a,b,c){c&&a.f||(a.Ia=b[0]||a.m);if(c||void 0===c)a.C=b[0]||a.m,a.M=b[1]||a.L}function Pa(a,b){b||(b=Wa);Ta(a,b,void 0);Va(a,b,void 0)}var Wa=[],Sa=[L.prototype.H,L.prototype.W,L.prototype.$,L.prototype.va],Ua=[L.prototype.B,L.prototype.J,L.prototype.Y,L.prototype.ra];if(J)var Ra=[L.prototype.A,L.prototype.I,L.prototype.X,L.prototype.qa],Qa=[L.prototype.D,L.prototype.N,L.prototype.Z,L.prototype.ua];
|
||||
function M(a,b){y.call(this,"CPU",a,M);var c=a.cycles||b,d=a.multiplier||1;this.a={};this.a.fa=c;this.a.ea=d;this.a.Fa=Math.round(this.a.fa/1E4)/100;this.a.ba=this.a.Fa*this.a.ea;this.c.K=!1;this.c.Pa=!1;this.c.Na=a.autoStart;this.c.Oa=!1;this.c.wa=!1;this.a.Aa=this.a.da=0;this.a.Ba=a.csStart;this.a.ja=a.csInterval;this.a.ka=a.csStop;this.$a=this.Ja.bind(this);I(this)}B(M);var Xa=["power","reset"];e=M.prototype;
|
||||
e.ia=function(a,b,c,d){this.b=a;this.j=b;this.w=d;for(b=0;b<Xa.length;b++)(c=this.h[Xa[b]])&&this.b.G(null,Xa[b],c);Ea(a,"FPU");this.i=Ea(a,"ChipSet");a=Ya(a,"autoStart");null!=a&&(this.c.Na="true"==a?!0:"false"==a?!1:!!a);I(this)};e.reset=function(){};e.save=function(){return null};e.restore=function(){return!1};e.R=function(a,b){if(!b){if(a&&this.restore){Za(this);if(!this.restore(a))return!1;$a(this)}else this.reset();this.F("No debugger detected")}ab(this);return!0};
|
||||
e.P=function(a){return a?this.save():!0};function bb(a){(a.c.Na||void 0===a.h.run)&&a.Ja()}e.Qa=function(){return 0};function $a(a){void 0===a.a.Ba&&(a.a.Ba=0);void 0===a.a.ja&&(a.a.ja=-1);void 0===a.a.ka&&(a.a.ka=-1);a.c.wa=0<=a.a.Ba&&0<a.a.ja;a.c.wa&&(a.a.Aa=0,a.a.da=a.a.Ba-a.C)}
|
||||
e.G=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.h[b]=c;a=!0;break;case "run":this.h[b]=c;c.onclick=function(){var a;if(a=d.b)if(a=d.b,a.c.u)a=!0;else{var b=null,c,h=D(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.c.aa);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.c.u);c++);c==h.length&&(b=a);u("The "+b.type+" component ("+b.id+") is not "+(b.c.aa?"powered yet":"ready yet"+(b.ya?" (waiting for notification)":""))+".");a=!1}a&&(d.c.K?N(d,!0):d.Ja())};a=!0;break;
|
||||
case "speed":this.h[b]=c;a=!0;break;case "setSpeed":this.h[b]=c,c.onclick=function(){O(d,d.a.ea<<1)},c.textContent=this.a.ba.toFixed(2)+"Mhz",a=!0}return a};function cb(a,b,c){a.C+=b;c&&(a.B=a.g=0)}function db(a,b){var c=30;60>c&&(c=60);2>c&&(c=2);var d=1;b&&1<a.a.ea&&a.a.T&&(d=a.a.T/a.a.Fa);a.a.Ra=Math.round(1E3/30);a.a.cb=Math.floor(a.a.fa/c*d);a.a.Ga=Math.floor(a.a.fa/30*d);a.a.Ta=Math.floor(a.a.fa/60*d);a.a.Sa=Math.floor(a.a.fa/2*d);b||(a.a.na=a.a.Ga,a.a.ma=a.a.Ta,a.a.la=a.a.Sa);a.a.Ha=0}
|
||||
function P(a){return a.C+a.o+a.B-a.g}function Za(a){a.a.T=0;a.C=a.o=a.B=a.g=0;$a(a);O(a,1)}function O(a,b){if(void 0!==b){.8>a.a.T/a.a.ba&&(b=1);a.a.ea=b;var c=a.a.Fa*a.a.ea;if(a.a.ba!=c){a.a.ba=c;var c=a.a.ba.toFixed(2)+"Mhz",d=a.h.setSpeed;d&&(d.textContent=c);a.F("target speed: "+c)}}cb(a,a.o);a.o=0;a.a.ca=p();a.a.U=0;db(a)}
|
||||
e.Ja=function(){if(Aa(this,!0)){if(!this.c.K){O(this);this.b&&this.b.start(this.a.ca,P(this));this.c.K=!0;this.c.Pa=!0;this.i&&this.i.eb();var a=this.h.run;a&&(a.textContent="Halt");this.b&&this.b.V(!0)}this.a.Ha>=this.a.fa&&db(this,!0);this.a.oa=0;this.a.za=p();this.a.U&&(a=this.a.za-this.a.U,a>this.a.Ra&&(this.a.ca+=a,this.a.ca>this.a.za&&(this.a.ca=this.a.za)));try{do{var b=this.c.wa?1:this.a.cb;this.i&&(this.i.Wa(),b=this.i.gb(0,b),b=this.i.fb(b));try{this.Va(b)}catch(f){if("number"!=typeof f)throw f;
|
||||
}var c=this.B-this.g;this.o+=c;this.a.oa+=c;cb(this,0,!0);a=c;if(this.c.wa){var d=!1;this.a.Aa=this.a.Aa+this.Qa()|0;this.a.da-=a;0>=this.a.da&&(this.a.da+=this.a.ja,d=!0);0<=this.a.ka&&this.a.ka<=P(this)&&(this.a.ja=this.a.ka=-1,$a(this),N(this),d=!0);d&&this.F(P(this)+" cycles: checksum="+n(this.a.Aa))}this.a.ma-=c;0>=this.a.ma&&(this.a.ma+=this.a.Ta);this.a.la-=c;0>=this.a.la&&(this.a.la+=this.a.Sa,this.b&&this.b.V());this.a.na-=c;if(0>=this.a.na){this.a.na+=this.a.Ga;break}}while(this.c.K)}catch(f){N(this);
|
||||
ab(this);this.b&&this.b.stop(p(),P(this));Aa(this,!1);b=f.stack||f.message;this.c.S=!0;this.v(b);return}b=setTimeout;c=this.$a;this.a.U=p();a=this.a.Ra;this.a.oa&&(a=Math.round(a*this.a.oa/this.a.Ga));a-=this.a.U-this.a.za;if(d=this.a.U-this.a.ca)this.a.T=Math.round(this.o/(10*d))/100,864E5<=d&&(this.C=0,this.i&&this.i.Wa(!0),O(this));if(0>a||this.a.T<this.a.ba)a=0;this.a.Ha+=this.a.oa;this.a.U+=a;b(c,a)}else ab(this),this.b&&this.b.stop(p(),P(this))};e.Va=function(){return 0};
|
||||
function N(a,b){a.c.ha&&(a.c.Ea=!0);a.B-=a.g;a.g=0;cb(a,a.o);a.o=0;if(a.c.K){a.c.K=!1;a.i&&a.i.eb();var c=a.h.run;c&&(c.textContent="Run")}a.c.xa=b}function ab(a){a.b&&a.b.V(void 0)}function eb(a){this.Za=a.model||8080;M.call(this,a,1E6);this.Ya=fb;Za(this);this.c.xa=this.c.ab=!1;this.ta=0;this.sa=[];this.l=this.f=this.qa=this.ra=0;gb(this)}B(eb,M);e=eb.prototype;e.reset=function(){this.c.K&&N(this);gb(this);Za(this);this.c.S=!1};
|
||||
function gb(a){a.N=0;a.I=0;a.J=0;a.W=0;a.X=0;a.Y=0;a.Z=0;a.$=0;a.m=0;hb(a,0);a.M=0}e.Qa=function(){var a=this.N+this.I+this.J+this.W+this.X+this.Y+this.Z|0;return a=a+this.$+this.m+ib(this)|0};
|
||||
e.save=function(){var a=new Q(this);R(a,0,[this.N,this.I,this.J,this.W,this.X,this.Y,this.Z,this.$,this.m,ib(this)]);R(a,1,[this.H,this.M,this.C,this.a.ea]);for(var b=this.j,c=0,d=[],f=0;f<b.j;f++){var g=b.b[f];if(g.O||g.bb){d[c++]=f;var k=c++;a:if(g=g.save()){for(var h=0,l=0,m=[];h<g.length;){for(var A=g[h],r=h+1;r<g.length&&g[r]===A;)r++;m[l++]=r-h;m[l++]=A;h=r}if(m.length<g.length){g=m;break a}}d[k]=g}}R(a,2,d);return a.data()};
|
||||
e.restore=function(a){var b=a[0];this.N=b[0];this.I=b[1];this.J=b[2];this.W=b[3];this.X=b[4];this.Y=b[5];this.Z=b[6];this.$=b[7]&65535;this.m=b[8]&65535;hb(this,b[9]);b=a[1];this.H=b[0];this.M=b[1];this.C=b[2];O(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],f=a[c+1];if(f&&f.length<b.o){for(var g=0,k=Array(b.o),h=0;h<f.length-1;)for(var l=f[h++],m=f[h++];l--;)k[g++]=m;f=k}g=b.b[d];if(!g||!g.restore(f)){u("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
function ib(a){return a.La&-2262|(a.D&a.A?1:0)|(Ca[a.s&255]?4:0)|((a.s^a.L)&16?16:0)|(a.D&a.A-1?0:64)|(a.s&a.A>>1?128:0)}function hb(a,b){a.A=256;a.D=a.s=a.L=0;b&1&&(a.D|=a.A);b&4||(a.s|=1);b&16&&(a.L|=16);b&64||(a.D|=a.A-1);b&128&&!(a.s&a.A>>1)&&(a.s^=a.A>>1|a.A>>2,a.L^=32896);a.La=a.La&-513|b&512|2}
|
||||
e.G=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "D":case "E":case "H":case "L":case "SP":case "PC":case "F":case "C":case "P":case "A":case "Z":case "S":case "V":this.h[b]=c;this.ta++;d=!0;break;default:d=this.parent.G.call(this,a,b,c)}return d};function jb(a){var b;b=a.m+1|0;var c;c=a.m;c=a.sa[(c&a.ra)>>>a.l].Ia(c&a.qa,c);a.m=b;return c}
|
||||
function S(a,b,c,d){d=d||2;a.h[b]&&(void 0===c&&(a.c.S=!0,a.v("Value for "+b+" is invalid"),N(a)),c=!a.c.K||a.c.Oa?n(c,d):"--------".substr(0,d),a.h[b].textContent!=c&&(a.h[b].textContent=c))}
|
||||
e.V=function(a){this.ta&&(a||!this.c.K||this.c.Oa)&&(S(this,"A",this.N),S(this,"B",this.I),S(this,"C",this.J),S(this,"D",this.W),S(this,"E",this.X),S(this,"H",this.Y),S(this,"L",this.Z),S(this,"SP",this.$,4),S(this,"PC",this.m,4),a=ib(this),S(this,"F",a,2),S(this,"S",a&128,1),S(this,"Z",a&64,1),S(this,"A",a&16,1),S(this,"P",a&4,1),S(this,"C",a&1,1));if(a=this.h.speed)a.textContent=this.c.K&&this.a.T?this.a.T.toFixed(2)+"Mhz":"Stopped"};
|
||||
e.Va=function(a){this.c.xa=!0;this.c.ab=!1;this.c.Pa=!1;this.B=this.g=a;this.i&&!a&&this.i.Wa();a||(this.H|=4);do{if(this.M&&this.M&4){this.H=this.g=0;break}this.H=0;this.Ya[jb(this)].call(this)}while(0<this.g);return this.c.xa?this.B-this.g:void 0===this.c.xa?0:-1};w(function(){for(var a=H(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=F(c),d=new eb(d);G(d,c)}});function T(){this.m=this.m-1&65535;N(this)}
|
||||
var fb=[function(){this.g-=4},function(){this.J=jb(this);this.I=jb(this);this.g-=10},T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,
|
||||
T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T];function U(a){y.call(this,"ROM",a,U);this.b=null;this.m=a.addr;this.f=a.size;this.g=a.alias;this.i=a.file;this.o=ba(this.i);if(this.i){a=this.i;var b=ca(this.o);"json"!=b&&"hex"!=b&&(a=t()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,g){kb(c,a,b,g)})}}B(U);U.prototype.ia=function(a,b,c,d){this.j=b;this.a=c;this.w=d;lb(this)};
|
||||
U.prototype.R=function(){this.l&&(this.w&&this.w.a(this.id,this.m,this.f,this.l),delete this.l);return!0};U.prototype.P=function(){return!0};
|
||||
function kb(a,b,c,d){if(d)a.v("Unable to load system ROM (error "+d+": "+b+")");else{za(a.Ka,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var f=eval("("+c+")"),g=f.bytes,k=f.data;if(g)a.b=g;else if(k)for(a.b=Array(4*k.length),d=c=0;c<k.length;c++)a.b[d++]=k[c]&255,a.b[d++]=k[c]>>8&255,a.b[d++]=k[c]>>16&255,a.b[d++]=k[c]>>24&255;else a.b=f;a.l=f.symbols;if(!a.b.length){u("Empty ROM: "+b);return}if(1==a.b.length){u(a.b[0]);return}}catch(h){a.v("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f<b.length;f++)a.b[f]=aa(b[f]);lb(a)}}
|
||||
function lb(a){if(!Ba(a))if(!a.i)I(a);else if(a.b&&a.j){if(a.b.length!=a.f){var b="ROM size (0x"+n(a.b.length)+") does not match specified size ("+("0x"+n(a.f))+")";a.c.S=!0;a.v(b)}else{b=a.m;if(Ha(a.j,b,a.f,Oa)){for(var c=0;c<a.b.length;c++){var d=a.j,f=b+c;d.b[(f&d.i)>>>d.l].Xa(f&d.s,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){for(var g=a,d=b[c],f=g.j,k=g.f,h=[],l=g.m>>>f.l;0<k&&l<f.b.length;)h.push(f.b[l++]),k-=
|
||||
f.f;f=g.j;g=g.f;k=0;for(d>>>=f.l;0<g&&d<f.b.length;){l=h[k++];if(!l)break;f.b[d++]=l;g-=f.f}}delete a.b}}I(a)}}w(function(){for(var a=H(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=F(c),d=new U(d);G(d,c)}});function mb(a){y.call(this,"RAM",a,mb);this.g=a.addr;this.f=a.size;this.b=!1}B(mb);e=mb.prototype;e.ia=function(a,b,c,d){this.j=b;this.a=c;this.w=d;I(this)};e.R=function(a,b){b||this.reset();return!0};e.P=function(a){return a?this.save():!0};
|
||||
e.reset=function(){!this.b&&this.f&&Ha(this.j,this.g,this.f,1)&&(this.b=!0,this.status(Math.floor(this.f/1024)+"Kb allocated"));this.b||u("No RAM allocated")};e.save=function(){return null};e.restore=function(){return!0};w(function(){for(var a=H(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=F(c),d=new mb(d);G(d,c)}});function nb(a){y.call(this,"Keyboard",a,nb);I(this)}B(nb);w(function(){for(var a=H(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=F(c),d=new nb(d);G(d,c)}});
|
||||
function ob(a){y.call(this,"Video",a,ob);I(this)}B(ob);
|
||||
w(function(){for(var a=H(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=F(c),f=document.createElement("canvas");if(void 0===f||!f.getContext){c.innerHTML="<br/>Missing <canvas> support. Please try a newer web browser.";break}f.setAttribute("class","pcjs-canvas");f.setAttribute("width",d.screenWidth);f.setAttribute("height",d.screenHeight);f.style.backgroundColor=d.screenColor;f.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,f,d.screenWidth,d.screenHeight),c.onresize());var g=+(d.aspect||ua.aspect);g&&.3<=g&&3.33>=g&&(qa("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,f,g)),window.onresize());c.appendChild(f);g=document.createElement("textarea");ma("iOS")&&(g.setAttribute("autocapitalize","off"),g.setAttribute("autocorrect","off"));c.appendChild(g);f.getContext("2d");d=new ob(d);G(d,c)}});
|
||||
function Q(a,b,c){this.id=a.id;this.key=pb(a,b,c);this.w=a.w;qb(this,a.Ua)}function pb(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}
|
||||
Q.prototype={constructor:Q,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){qb(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(f){}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(f){}b.splice(c,1);c=0}}};
|
||||
function qb(a,b){a[a.id]={};b&&R(a,"parms",b);a.a=!1}function rb(a){var b=!0;if(ja()){var c=JSON.stringify(a[a.id]);la(a.key,c)||(u("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function sb(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){u(c.message||c),b=!1}return b}function V(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ja()&&(b=ka(a.key))?(a[a.id]=b,a.a=!0):!1}function W(a,b){return a[a.id][b]||null}function R(a,b,c){try{a[a.id][b]=c}catch(d){}}
|
||||
function tb(a,b,c){y.call(this,"Computer",a,tb);this.c.u=!1;ub(this,b);this.C=Ya(this,"autoPower",a);this.g=0;this.L=a.busWidth||a.buswidth;this.b=X;this.A=null;this.m=this.J=!1;this.M=Ya(this,"url")||"";(Math.random()+.1).toString(36);this.f=vb(this);if(this.a=E("CPU",this.id)){this.w=E("Debugger",this.id);this.N=[];for(b=null;b=Ea(this,"Video",b);)this.N.push(b);this.j=new K({id:this.Ka+".bus",buswidth:this.L},this.a,this.w);var d,f=D(this.id);if((this.i=E("Panel",this.id))&&this.i.Da)for(b=0;b<
|
||||
f.length;b++)d=f[b],d.v=this.i.v,d.F=this.i.F,d.Da=this.i.Da;for(b=0;b<f.length;b++)d=f[b],d.ia&&d.ia(this,this.j,this.a,this.w);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var g;if(a=Ya(this,"state")||(g=!0,a.state))b=this.D=a,g||(this.m=!0,this.b=X),this.b&&(this.B=new Q(this,Y),V(this.B)?b=null:delete this.B);!b&&this.b&&(b=wb(this))&&(this.m=!0);if(b){var k=this;q(b,null,!0,function(a,b,c){c?(k.s=null,k.m=!1,k.v("Unable to load machine state from server (error "+
|
||||
c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(k.A=b,k.J=!0);I(k)})}else I(this);this.h.power||(this.C=!0);!c&&this.C&&Z(this,this.pa)}else u("Unable to find CPU component")}B(tb);var Y="1.21.7",X=0;function ub(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){u(d.message+" ("+c+")")}}a.o=b}
|
||||
function Ya(a,b,c){var d=b.toLowerCase(),d=ua[b]||ua[d];void 0===d&&a.o&&(d=a.o[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Z(a,b,c){for(var d=D(a.id),f=0;f<=d.length;f++){var g=f<d.length?d[f]:a;if(!Ba(g)){Ba(g,function(){Z(a,b,c)});return}}b.call(a,c)}
|
||||
function xb(a,b){var c=new Q(a,Y,"validate");if(V(c)&&sb(c)){var d=W(c,"timestamp"),f=b?W(b,"timestamp"):"unknown";d!=f&&(a.v("Machine state may be out-of-date\n("+d+" vs. "+f+")\nCheck your browser's local storage limits"),b||c.clear())}}e=tb.prototype;
|
||||
e.pa=function(a){void 0===a&&(a=this.b||(this.A?1:X));if(!this.g){this.g++;var b=!1,c=!1;this.I=!1;var d=this.B||new Q(this,Y);if(-1==a)b=!0;else if(a>X){if(V(d,this.A)){this.l=new Q(this,Y,"failsafe");V(this.l)&&(yb(this,d),a=2,qb(this.l));R(this.l,"timestamp",ga());rb(this.l);var f=this.b&&!this.m;if(1==a||ha("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=sb(d)){var g=W(d,"code"),k=W(d,"data");g&&("ok"==g?V(d,k):("error"==g&&"no machine state"!=k?
|
||||
(this.v("Error: "+k),"unable to verify user"==k&&(la("user",""),this.f=null)):this.F(g+": "+k),qb(d),V(d)?(c=sb(d),f=!0):c=!1))}f&&xb(this,c?d:null)}else 2==a&&d.clear()}else xb(this);delete this.A;delete this.B}f=D(this.id);for(g=0;g<f.length;g++)k=f[g],k!==this&&k!=this.a&&(c=zb(this,k,d,b,c));b=[d,a,c];-1!=a?Z(this,this.Ma,b):this.Ma(b)}};
|
||||
function zb(a,b,c,d,f){if(!b.c.u){b.c.u=!0;if(b.R){var g=null;f&&((g=W(c,b.id))||(g=W(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof g&&(g=null);!b.R(g,d)&&g&&(u("Unable to restore state for "+b.type),a.D&&!a.J?(c.clear(),a.b=X,window&&window.location.reload()):a.I=!0,b.R(null),f=!1)}if(!d&&b.ua)for(a=b.ua.split("|"),c=0;c<a.length;c++)b.status(a[c])}return f}
|
||||
e.Ma=function(a){var b=a[0],c=0>a[1];a=a[2];this.c.u=!0;var d=this.h.power;d&&(d.textContent="Shutdown");this.H||(this.F("PC8080 v"+Y+"\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.H=!0);this.a&&(zb(this,this.a,b,c,a),bb(this.a));this.I&&(yb(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
|
||||
function yb(a,b){if(ha("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.M,d=a.f||"",f=b.toString(),g={app:"PC8080"};g.ver=Y;g.url=c;g.user=d;g.type="bug";g.data=f;q("http://www.pcjs.org/api/v1/report",g,!0)}}
|
||||
function Ab(a,b,c){var d,f="none";if(a.g)return null;a.g--;var g=new Q(a,Y),k=new Q(a,Y,"validate"),h=ga();R(k,"timestamp",h);R(g,"timestamp",h);R(g,"version","1.21.7");R(g,"url",window?window.location.href:null);R(g,"browser",window?window.navigator.userAgent:"");a.a&&a.a.P&&(c&&N(a.a),d=a.a.P(b,c),"object"===typeof d&&R(g,a.a.id,d),c&&(a.a.c.u=!1,!1===d&&(f=null)));for(var h=D(a.id),l=0;l<h.length;l++){var m=h[l];m.c.u&&(m.P&&(d=m.P(b,c),"object"===typeof d&&R(g,m.id,d)),c&&(m.c.u=!1,!1===d&&(f=
|
||||
null)))}f&&(c?(h=d=!1,b?(a.f&&Bb(a,a.f,g.toString()),rb(k)&&rb(g)||(f=null,d=h=!0)):a.b&&(d=!0,h=3==a.b),d&&g.clear(h)):f=g.toString());c&&(a.c.u=!1,b=a.h.power)&&(b.textContent="Power");a.g=0;return f}e.reset=function(){this.j&&this.j.reset&&this.j.reset();for(var a=D(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.j&&c.reset&&c.reset()}};e.start=function(a,b){for(var c=D(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.start&&f.start(a,b)}};
|
||||
e.stop=function(a,b){for(var c=D(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.stop&&f.stop(a,b)}};
|
||||
e.G=function(a,b,c){var d=this;switch(b){case "power":return this.h[b]=c,c.onclick=function(){d.g||(d.c.u?Ab(d,!1,!0):Z(d,d.pa))},!0;case "reset":return this.h[b]=c,c.onclick=function(){if(d.c.u&&!d.g)if(d.b&&!d.s){var a=ha("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ab(d,a,!0);!a&&d.D?window&&window.location.reload():d.pa(X)}else d.reset(),d.a&&bb(d.a)},!0;case "save":if(da(t(),"pcjs.org")){c.parentNode.removeChild(c);break}this.h[b]=
|
||||
c;c.onclick=function(){var a=vb(d,!0);if(a){var b=!!(d.b&&!d.s||d.D),c=Ab(d,b);b?Bb(d,a,c):d.v("Resume disabled, machine state not saved")}};return!0}return!1};
|
||||
function vb(a,b){var c=a.f;c||(c=ka("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=Cb(a,c))||a.v("The user ID is invalid."))):b&&a.v("Browser local storage is not available"));return c}
|
||||
function Cb(a,b){a.f=null;var c=q(t()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(la("user",c.data),a.f=c.data)}catch(f){u(f.message+" ("+d+")")}return a.f}function wb(a){var b=null;a.f&&(b=t()+"/api/v1/user?req=load&user="+a.f+"&state="+pb(a,Y));return b}
|
||||
function Bb(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=pb(a,Y);d.data=c;b=q(t()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0<f&&(d=d.substr(0,f));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.v("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.v(c),la("user",""),a.f=null)}}
|
||||
function Ea(a,b,c){a=D(a.id);for(var d=0;d<a.length;d++){var f=a[d];if(c)c==f&&(c=null);else if(f.type==b)return f}return null}e.V=function(a){this.a&&this.a.V(a);this.i&&this.i.V(a)};w(function(){for(var a=H(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=F(c),c=H(c,"pc8080","computer"),f=0;f<c.length;f++){var g=c[f],k=F(g),k=new tb(k,d,!0);G(k,g);k.C&&Z(k,k.pa)}});
|
||||
v.show.push(function(){for(var a=H(document,"pc8080","computer"),b=0;b<a.length;b++){var c=F(a[b]);(c=E("Computer",c.id))&&c.H&&!c.c.u&&c.pa(-1)}});v.exit.push(function(){for(var a=H(document,"pc8080","computer"),b=0;b<a.length;b++){var c=F(a[b]);(c=E("Computer",c.id))&&c.c.u&&Ab(c,!(!c.b||c.s),!0)}});var Db=0;function Eb(a,b,c,d,f,g){f("Loading "+a+"...");q(a,null,!0,function(k,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),g(h,null)):Fb(h,a,b,c,d,f,g)})}
|
||||
function Fb(a,b,c,d,f,g,k){function h(a,g){if(g)k(g,null);else{if(c){za(c,b,a);var h=b;h&&0>h.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(h=window.location.pathname+h);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+h+'"}';"object"==typeof resources&&(h=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(h?' url="'+h+'"':""))}f||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));
|
||||
h=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(r){h=null,a=r.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,h)}}a?f?Gb(a,g,h):h(a,null):k("no data"+(b?" for file: "+b:""),null)}
|
||||
function Gb(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");q(f,null,!0,function(g,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(g=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,A=/( [a-z]+=)(['"])(.*?)\2/g;m=A.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],k);Gb(a,b,c)}})}else c(a,null)}
|
||||
function Hb(a,b,c,d){function f(a){if(void 0===h){var b=k&&H(k,"machine-warning");h=b&&b[0]||k}h&&(h.innerHTML=fa(a))}function g(a){f("Error: "+a);l&&(--Db||x(!0));l=!1}var k,h,l=!0;Db++;C[a]={};try{if(k=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var A=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));A.appendChild(r)}c||(c=
|
||||
"/versions/pc8080/1.21.7/components.xsl");m=function(d,h){h?Eb(c,null,null,!1,f,function(d,m){if(m)if(za(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=h.transformNode(m);l?(k.outerHTML=l,--Db||x(!0)):g("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(m),(l=l.transformToFragment(h,document))?k.parentNode?(k.parentNode.replaceChild(l,k),--Db||x(!0)):g("invalid machine element: "+
|
||||
a):g("transformToFragment failed")):g("unable to transform XML: unsupported browser");else g(d)}):g(d)};"<"!=b.charAt(0)?Eb(b,a,d,!0,f,m):Fb(b,null,a,d,!1,f,m)}else g("missing machine element: "+a)}catch(pa){g(pa.message)}return l}window.embedPC8080=function(a,b,c,d){x(!1);return Hb(a,b,c,d)};window.enableEvents=x;window.sendEvent=sa;
|
||||
function Ib(a,b,c,d){if(!c&&b){d.push(b);a=C[d[0]];b=null;for(var f in a)if(da(f,"components.xsl")){b=f.replace(".xsl",".css");break}b?q(b,null,!0,function(a,b){Jb(b,d)}):Jb(null,d)}else u("Error ("+c+") requesting "+a)}
|
||||
function Jb(a,b){var c,d,f,g=b[0],k=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=C[g],l={},m;for(m in h){var A=h[m],r=ca(m);if("xml"==r){for(r=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=r.exec(h[m]);){var pa=d[2];pa&&(h[pa]||(A=A.replace(d[0],"")))}d=m=ba(m)}else"xsl"==r&&(f=m=ba(m));l[m]=A}a&&(l[m="css"]=a);b[2]&&(l[m="parms"]=b[2]);b[3]&&(l[m="state"]=b[3]);d&&f?(m=JSON.stringify(l),k+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
|
||||
"©"),m=k,h=null,l="data:application/javascript,",l=ma("Firefox")?l+encodeURIComponent(c):l+encodeURI(c),m&&(h=document.createElement("a"),"string"!=typeof h.download&&(h=null)),h?(h.href=l,h.download=m,document.body.appendChild(h),h.click(),document.body.removeChild(h),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 "'+k+'", and then add the following to your web page:\n\n',
|
||||
c+='<div id="'+g+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+k+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+g+'","'+d+'","'+f+'");\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=E("Computer",a),f=E("Debugger",a);if(d){var g=Ab(d,!0),k=d.o?JSON.stringify(d.o):null;b||(b="/versions/pcjs/1.21.7/pc"+(f?"-dbg":"")+".js");if(c&&c({state:g,Ua:k}))return!0;q(b,null,!0,function(c,d,f){Ib(c,d,f,[a,ba(b,!0),k,g])});return!0}u("Unable to identify machine '"+a+"'");return!1};})();
|
||||
Loading…
Reference in a new issue