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