920 lines
141 KiB
JavaScript
920 lines
141 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.
|
|
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 l,m={me:1,ne:3,oe:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,Ub:65,Hc:66,Jc:67,Xb:68,E:69,Mc:70,Nc:71,Oc:72,Pc:73,Wc:74,Xc:75,Zb:76,dd:77,ed:78,gd:79,hd:80,Q:81,od:82,rd:83,xd:84,yd:85,zd:86,Ad:87,Cd:88,Dd:89,Ed:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ve:97,We:98,Xe:99,d:100,e:101,Ye:102,Ze:103,$e:104,af:105,bf:106,k:107,cf:108,
|
|
df:109,n:110,ef:111,p:112,q:113,r:114,ff:115,t:116,hf:117,jf:118,kf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126};
|
|
function aa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
|
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ba(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function t(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 ca(a){return t(a,2,!0)}
|
|
function u(a){return t(a,4,!0)}function ea(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ha(){var a=ja();return-1!==a.indexOf("pcjs.org",a.length-8)}var ka={"&":"&","<":"<",">":">",'"':""","'":"'"};function la(a){return a.replace(/[&<>"']/g,function(a){return ka[a]})}
|
|
function ma(a,b){return(a+" ").slice(0,b)}function na(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var oa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
|
|
function pa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var qa=Date.now||function(){return+new Date};function ra(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
|
function sa(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1}
|
|
function va(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
|
|
typeof b){var k="",n;for(n in b)b.hasOwnProperty(n)&&(k&&(k+="&"),k+=n+"="+encodeURIComponent(b[n]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}function ja(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
|
function wa(){return window?window.navigator.userAgent:""}function w(a){window&&window.alert(a)}function xa(a){var b=!1;window&&(b=window.confirm(a));return b}var ya=null;function za(){if(null==ya){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ya=a}return ya}
|
|
function Aa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ba(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ca(a){if(window){var b=wa();return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Da(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
|
function Ea(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ia={init:[],show:[],exit:[]},Ja=!1,Ka=!1,La=!0;function Ma(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Na(a){Ia.init.push(a)}
|
|
function Oa(a){if(La)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Pa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function Qa(a){!La&&a?(La=!0,Ja&&Sa("init"),Ka&&Sa("show")):La=a}function Sa(a){Ia[a]&&Oa(Ia[a])}Ma("onload",function(){Ja=!0;Oa(Ia.init)});Ma("onpageshow",function(){Ka=!0;Oa(Ia.show)});Ma(Ca("Opera")||Ca("iOS")?"onunload":"onbeforeunload",function(){Oa(Ia.exit)});
|
|
function z(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.ec=b.comment;this.Ld=b;b=this.id.indexOf(".");0>b?this.cb=this.id:(this.Bb=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=c;this.C={ready:!1,sb:!1,Kb:!1,xa:!1,error:!1};this.Eb=null;this.C.error=!1;this.N={};this.H=null;this.ta=d||0;Ta.push(this)}var Ua=void 0,Va={};
|
|
if(window){Ua||(Ua=window.location.search.substr(1));for(var Xa,Ya=/\+/g,Za=/([^&=]+)=?([^&]*)/g;Xa=Za.exec(Ua);)Va[decodeURIComponent(Xa[1].replace(Ya," "))]=decodeURIComponent(Xa[2].replace(Ya," "))}function $a(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
|
function A(a,b){b||(b=z);a.prototype=$a(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ab=window.PCjs.Machines||(window.PCjs.Machines={}),Ta=window.PCjs.Components||(window.PCjs.Components=[])}else ab={},Ta=[];function bb(a,b,c){ab[a]&&b&&(ab[a][b]=c)}function Pa(a,b,c){b||w((c?c+": ":"")+a)}
|
|
function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Ta.length;b++){var d=Ta[b];a&&d.id.indexOf(a)||c.push(d)}return c}function db(a){if(void 0!==a){var b;for(b=0;b<Ta.length;b++)if(Ta[b].id===a)return Ta[b]}return null}function eb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<Ta.length;d++)if(c)c==Ta[d]&&(c=null);else if(!(a!=Ta[d].type||b&&Ta[d].id.indexOf(b)))return Ta[d]}return null}
|
|
function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){w(c.message+" ("+a+")")}return b}function fb(a,b){b=D(b.parentNode,"pc8080-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pc8080-binding":(g=B(f))&&g.binding&&a.pa(g.type,g.binding,f,g.value),k=h.length}}}}
|
|
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
|
z.prototype={constructor:z,parent:null,toString:function(){return this.name?this.name:this.id||this.type},pa:function(a,b,c){switch(b){case "clear":return this.N[b]||(this.N[b]=c,c.onclick=function(a){return function(){a.N.print&&(a.N.print.value="")}}(this)),!0;case "print":return this.N[b]||(this.Ga=this.N[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
|
this.ka=function(a){this.g(a,this.cb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.cb+": "+a)},ka:function(a,b,c){Pa(a,b,c||this.type)},Ea:function(){return this.C.xa=!0},Ia:function(a,b){b&&(this.C.xa=!1);return!0}};function E(a,b,c,d,e,f,g){a.H&&(!0===g?g=0:null==g&&(g=a.ta),gb(a.H,a,b,c,d,e,f,g))}function hb(a,b){a.H&&ib(a,0)&&a.H.message(b,void 0)}function ib(a,b){if(a.H){a===a.H?b|=0:b=b||a.ta;var c=a.H.ta&b;return!!b&&c===b||!!(c&a.H.Id)}return!1}
|
|
function jb(a,b){if(a.C.Kb)return a.C.sb=!1,a.C.Kb=!1;if(a.C.error)return a.g(a.toString()+" error"),!1;a.C.sb=b;return a.C.sb}function kb(a,b){a.C.sb&&(b?a.C.Kb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.C.sb}function F(a){if(!a.C.error&&(a.C.ready=!0,a.C.ready)){var b=a.Eb;a.Eb=null;b&&b()}}function nb(a,b){b&&(a.C.ready?b():a.Eb=b);return a.C.ready}function ob(a,b){a.C.error=!0;a.ka(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});
|
|
var pb="undefined"!==typeof ArrayBuffer,qb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
|
|
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1],rb={cpu:1,bus:64,mem:128,port:256,nvr:16384,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function sb(a){z.call(this,"Panel",a,sb)}A(sb);l=sb.prototype;
|
|
l.pa=function(a,b,c,d){return this.B&&this.B.pa(a,b,c,d)||this.b&&this.b.pa(a,b,c,d)||this.J&&this.J.pa(a,b,c,d)||this.H&&this.H.pa(a,b,c,d)?!0:this.parent.pa.call(this,a,b,c,d)};l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;this.J=tb(a,"Keyboard")};l.Ea=function(a,b){b||ub();return!0};l.Ia=function(){return!0};l.Ja=function(){};function ub(){for(var a=!1,b=D(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=B(d),f=db(e.id);f||(a=!0,f=new sb(e));fb(f,d);a&&F(f)}}Na(ub);
|
|
function vb(a,b,c){z.call(this,"Bus",a,vb);this.b=b;this.H=c;this.K=a.busWidth||16;this.L=Math.pow(2,this.K);this.w=this.L-1|0;this.ia=(this.K>>1)+2;10>this.ia&&(this.ia=10);15<this.ia&&(this.ia=15);this.Ha=1<<this.ia;this.M=this.Ha>>2;this.u=this.Ha-1;this.J=this.L/this.Ha|0;this.G=this.J-1;this.B=[];this.j=[];this.I=this.D=!1;this.O=[];this.P=[];a=new H;wb(a,this.H);this.X=Array(this.J);for(b=0;b<this.J;b++)this.X[b]=a;F(this)}A(vb);l=vb.prototype;l.reset=function(){};
|
|
l.Ea=function(a,b){b||this.reset();return!0};function xb(a,b,c,d){for(var e=b,f=c,g=e>>>a.ia;0<f&&g<a.X.length;){var h=a.X[g],k=g*a.Ha,n=a.Ha-(e-k);n>f&&(n=f);if(h&&h.size){if(h.type==d){if(e+f<=h.F)return h.yb+=h.F-e,h.F=e,!0;if(e>=h.F+h.yb){n=h.size-(e-k);n>f&&(n=f);h.yb=e-h.F+n;e=k+a.Ha;f-=n;g++;continue}}return yb(1,e,f)}e=new H(e,n,a.Ha,d);wb(e,a.H,h);a.X[g++]=e;e=k+a.Ha;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+zb[d]+" at "+u(b)),!0):yb(2,b,c)}
|
|
l.aa=function(a){return this.X[(a&this.w)>>>this.ia].jb(a&this.u,a)};function Ab(a,b){return a.X[(b&a.w)>>>a.ia].wb(b&a.u,b)}l.$a=function(a){var b=a&this.u,c=(a&this.w)>>>this.ia;return b!=this.u?this.X[c].Ac(b,a):this.X[c++].jb(b,a)|this.X[c&this.G].jb(0,a+1)<<8};function Bb(a,b){var c=b&a.u,d=(b&a.w)>>>a.ia;return c!=a.u?a.X[d].Pb(c,b):a.X[d++].wb(c,b)|a.X[d&a.G].wb(0,b+1)<<8}l.va=function(a,b){this.X[(a&this.w)>>>this.ia].lb(a&this.u,b&255,a)};
|
|
function Db(a,b,c){a.X[(b&a.w)>>>a.ia].zb(b&a.u,c&255,b)}l.Ib=function(a,b){var c=a&this.u,d=(a&this.w)>>>this.ia;c!=this.u?this.X[d].Cc(c,b&65535,a):(this.X[d++].lb(c,b&255,a),this.X[d&this.G].lb(0,b>>8&255,a+1))};function Eb(a){for(var b=0,c=[],d=0;d<a.J;d++){var e=a.X[d];if(e.Na||e.xc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,k=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;k[h++]=p-g;k[h++]=n;g=p}k.length<e.length&&(e=k)}c[f]=e}}return c}
|
|
function Fb(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.B[b]&&(a.B[b]=[null,!1]);a.B[b][1]=!a.B[b][1];return a.B[b][1]}function Pb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,g=+e+d,h=c[e].bind(b);if(h)for(var k=+e+d;k<=g;k++)void 0!==f.B[k]?w("Input port "+u(k)+" already registered"):f.B[k]=[h,!1]}}
|
|
function Qb(a,b,c){for(var d=1,e=0,f=0;0<d;){var g=a.B[b],h=a.O[b]||1,k=1==h?255:2==h?65535:-1,n=k;void 0!==g?(g[0]&&(n=g[0](b,c),void 0===n?n=k:n&=k),a.H&&a.I!=g[1]&&Rb(a.H,b,n)):a.H&&(gb(a.H,a,b,null,c),a.I&&Rb(a.H,b,n));e|=n<<f;f+=h<<3;b+=h;d-=h}return e}function Sb(a,b){if(void 0===b)return a.D=!a.D,a.D;void 0===a.j[b]&&(a.j[b]=[null,!1]);a.j[b][1]=!a.j[b][1];return a.j[b][1]}
|
|
function Tb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,g=+e+d,h=c[e].bind(b);if(h)for(var k=+e+d;k<=g;k++)void 0!==f.j[k]?w("Output port "+u(k)+" already registered"):f.j[k]=[h,!1]}}function Ub(a,b,c,d){for(var e=1,f=0;0<e;){var g=a.j[b],h=a.P[b]||1,k=1==h?255:2==h?65535:-1,k=(c>>>=f)&k;if(void 0!==g){if(g[0])g[0](b,k,d);a.H&&a.D!=g[1]&&Vb(a.H,b,k)}else a.H&&(gb(a.H,a,b,k,d),a.D&&Vb(a.H,b,k));f+=h<<3;b+=h;e-=h}}
|
|
function yb(a,b,c){w("Memory block error ("+a+": "+t(b)+","+t(c)+")");return!1}var Wb;if(pb){var Xb=new ArrayBuffer(2);(new DataView(Xb)).setUint16(0,256,!0);Wb=256===(new Uint16Array(Xb))[0]}else Wb=!1;var Yb=Wb;
|
|
function H(a,b,c,d){this.id=Zb+=2;this.b=null;this.F=a;this.yb=b;this.size=c||0;this.type=d||$b;this.N=d==ac;wb(this);this.Na=this.xc=!1;if(c)if(pb)this.I=new ArrayBuffer(c),this.D=new DataView(this.I,0,c),this.u=new Uint8Array(this.I,0,c),this.J=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),bc(this,Yb?cc:dc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;bc(this,ec)}else bc(this)}var $b=0,ac=2,zb=["NONE","RAM","ROM","VID","H/W"],Zb=0;
|
|
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(pb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(pb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Na=!0}return!1},Za:function(a,b){b?this.j++||fc(this,gc,!1):this.B++||hc(this,gc,!1)},K:function(){this.H&&ib(this.H,129)&&this.H.message("attempt to read invalid block %"+t(this.F),!0);return 255},
|
|
w:function(a,b){this.H&&ib(this.H,129)&&this.H.message("attempt to write "+u(b)+" to invalid block %"+t(this.F),!0)},L:function(a,b){return this.jb(a++,b++)|this.jb(a,b)<<8},G:function(a,b,c){this.lb(a++,b&255,c++);this.lb(a,b>>8,c)},Y:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},fa:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},la:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Na=!0},za:function(a,b){var c=a>>
|
|
2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Na=!0},O:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,1,c.O)&&c.qa(!0)}return this.wb(a,b)},ca:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,2,c.O)&&c.qa(!0)}return this.Pb(a,b)},ja:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,1,d.D)&&d.qa(!0)}this.N?this.w(a,b,c):this.zb(a,b,c)},ma:function(a,b,c){if(this.H&&
|
|
null!=this.F){var d=this.H;ic(d,this.F+a,2,d.D)&&d.qa(!0)}this.N?this.w(a,b,c):this.Tb(a,b,c)},M:function(a){return this.u[a]},P:function(a){return this.u[a]},ba:function(a){return this.D.getUint16(a,!0)},ea:function(a){return a&1?this.u[a]|this.u[a+1]<<8:this.J[a>>1]},ha:function(a,b){this.u[a]=b;this.Na=!0},cb:function(a,b){this.u[a]=b;this.Na=!0},ra:function(a,b){this.D.setUint16(a,b,!0);this.Na=!0},wa:function(a,b){a&1?(this.u[a]=b,this.u[a+1]=b>>8):this.J[a>>1]=b;this.Na=!0}};
|
|
function wb(a,b,c){a.H=b;a.B=a.j=0;c&&((a.B=c.B)&&hc(a,gc,!1),(a.j=c.j)&&fc(a,gc,!1))}function jc(a,b){b?--a.j||(a.lb=a.N?a.w:a.zb,a.Cc=a.N?a.G:a.Tb):--a.B||(a.jb=a.wb,a.Ac=a.Pb)}function fc(a,b,c){c&&a.j||(a.lb=!a.N&&b[1]||a.w,a.Cc=!a.N&&b[3]||a.G);if(c||void 0===c)a.zb=b[1]||a.w,a.Tb=b[3]||a.G}function hc(a,b,c){c&&a.B||(a.jb=b[0]||a.K,a.Ac=b[2]||a.L);if(c||void 0===c)a.wb=b[0]||a.K,a.Pb=b[2]||a.L}function bc(a,b){b||(b=kc);hc(a,b,void 0);fc(a,b,void 0)}
|
|
var kc=[],ec=[H.prototype.Y,H.prototype.la,H.prototype.fa,H.prototype.za],gc=[H.prototype.O,H.prototype.ja,H.prototype.ca,H.prototype.ma];if(pb)var dc=[H.prototype.M,H.prototype.ha,H.prototype.ba,H.prototype.ra],cc=[H.prototype.P,H.prototype.cb,H.prototype.ea,H.prototype.wa];
|
|
function lc(a,b){z.call(this,"CPU",a,lc,1);var c=a.multiplier||1;this.Y=a.cycles||b;this.Ra=c;this.ha=Math.round(this.Y/1E4)/100;this.ab=this.ha*this.Ra;this.C.Aa=!1;this.C.Sb=!1;this.C.rb=a.autoStart;this.C.vc=!1;this.C.fb=!1;this.tb=this.O=0;this.ub=a.csStart;this.hb=a.csInterval;this.ib=a.csStop;this.w=[];this.Fa=this.bb.bind(this);F(this)}A(lc);var mc=["power","reset"];l=lc.prototype;
|
|
l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.H=d;for(b=0;b<mc.length;b++)(c=this.N[mc[b]])&&this.B.pa(null,mc[b],c);this.I=tb(a,"ChipSet");a=nc(a,"autoStart");null!=a&&(this.C.rb="true"==a?!0:"false"==a?!1:!!a);F(this)};l.reset=function(){};l.save=function(){return null};l.restore=function(){return!1};
|
|
l.Ea=function(a,b){if(!b){if(a&&this.restore){Ac(this);if(!this.restore(a))return!1;Bc(this)}else this.reset();this.H?(a=this.H,a.g("Type ? for help with PC8080 Debugger commands"),a.Ja(),a.za&&(b=a.za,a.za=null,Cc(a,b))):this.g("No debugger detected")}Dc(this);return!0};l.Ia=function(a){return a?this.save():!0};l.rb=function(){return this.C.rb||!this.H&&void 0===this.N.run?(this.bb(!0),!0):!1};l.yc=function(){return 0};
|
|
function Bc(a){void 0===a.ub&&(a.ub=0);void 0===a.hb&&(a.hb=-1);void 0===a.ib&&(a.ib=-1);a.C.fb=0<=a.ub&&0<a.hb;a.C.fb&&(a.tb=0,a.O=a.ub-a.M)}function Ec(a,b){if(a.C.fb){var c=!1;a.tb=a.tb+a.yc()|0;a.O-=b;0>=a.O&&(a.O+=a.hb,c=!0);0<=a.ib&&a.ib<=Fc(a)&&(a.hb=a.ib=-1,Bc(a),a.qa(),c=!0);c&&a.g(Fc(a)+" cycles: checksum="+t(a.tb))}}
|
|
l.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.N[b]=c;a=!0;break;case "run":this.N[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.C.xa)a=!0;else{var b=null,c,h=cb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.C.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.C.xa);c++);c==h.length&&(b=a);w("The "+b.type+" component ("+b.id+") is not "+(b.C.ready?"powered yet":"ready yet"+(b.Eb?" (waiting for notification)":""))+".");a=!1}a&&(d.C.Aa?d.qa():d.bb())};
|
|
a=!0;break;case "speed":this.N[b]=c;a=!0;break;case "setSpeed":this.N[b]=c,c.onclick=function(){Gc(d,d.Ra<<1,!0)},c.textContent=this.ab.toFixed(2)+"Mhz",a=!0}return a};function Hc(a,b,c){a.M+=b;c&&(a.L=a.b=0)}function Ic(a,b){var c=1;b&&1<a.Ra&&a.J&&(c=a.J/a.ha);a.wa=Math.round(1E3/30);a.fa=Math.floor(a.Y/30*c);b||(a.P=a.fa);a.ja=0}function Fc(a){return a.M+a.G+a.L-a.b}function Ac(a){a.J=0;a.za=0;a.M=a.G=a.L=a.b=0;Bc(a);Gc(a,1)}
|
|
function Gc(a,b,c){var d=!1;if(void 0!==b){.8>a.J/a.ab?b=1:d=!0;a.Ra=b;b=a.ha*a.Ra;if(a.ab!=b){a.ab=b;b=a.ab.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.xb()}Hc(a,a.G);a.G=0;a.D=qa();a.K=0;Ic(a);return d}function Jc(a,b){var c=a.w.length;a.w.push([-1,b]);return c}function Kc(a,b,c){0<=b&&b<a.w.length&&0>a.w[b][0]&&(c*=a.Y*a.Ra/1E3,a.w[b][0]=c)}function Lc(a){a.L-=a.b;a.b=0}
|
|
l.bb=function(a){if(jb(this,!0)){if(!this.C.Aa){Gc(this);this.B&&this.B.start(this.D,Fc(this));this.C.Aa=!0;this.C.Sb=!0;this.I&&this.I.start();var b=this.N.run;b&&(b.textContent="Halt");this.B&&(this.B.Ja(!0),a&&this.B.xb(!0))}this.ja>=this.Y&&Ic(this,!0);this.ba=0;this.ea=qa();this.K&&(a=this.ea-this.K,a>this.wa&&(this.D+=a,this.D>this.ea&&(this.D=this.ea)));try{do{for(var c=this.C.fb?1:this.fa,d=this.w.length-1;0<=d;d--){var e=this.w[d];0>e[0]||c>e[0]&&(c=e[0])}this.kb(c);var f=this.L-this.b;a=
|
|
f;for(var g=this.w.length-1;0<=g;g--){var h=this.w[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.ba+=f;this.G+=f;Hc(this,0,!0);Ec(this,f);this.P-=f;if(0>=this.P){this.P+=this.fa;15<=++this.za&&(this.B&&this.B.Ja(),this.za=0);break}}while(this.C.Aa)}catch(k){this.qa();Dc(this);this.B&&this.B.stop(qa(),Fc(this));jb(this,!1);ob(this,k.stack||k.message);return}c=setTimeout;d=this.Fa;this.K=qa();e=this.wa;this.ba&&(e=Math.round(e*this.ba/this.fa));e-=this.K-this.ea;if(f=this.K-this.D)this.J=Math.round(this.G/
|
|
(10*f))/100,864E5<=f&&(this.M=0,Gc(this));if(0>e||this.J<this.ab)-1E3>e&&(this.D-=e),e=0;this.ja+=this.ba;this.K+=e;c(d,e)}else Dc(this),this.B&&this.B.stop(qa(),Fc(this))};l.kb=function(){return 0};l.qa=function(a){kb(this,!0);Lc(this);Hc(this,this.G);this.G=0;if(this.C.Aa){this.C.Aa=!1;this.I&&this.I.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.complete=a};function Dc(a,b){if(a.B){for(var c=a.B,d=0;d<c.G.length;d++)Mc(c.G[d],b);a.B.Ja(b)}}
|
|
function Nc(a){this.Wd=+a.model||8080;lc.call(this,a,1E6);this.la=Oc;Ac(this);this.C.complete=this.C.Kd=!1;this.ma=0;this.ca=[];this.ra=0;Pc(this)}A(Nc,lc);function Qc(a,b){a.ca.push(b)}l=Nc.prototype;l.reset=function(){this.C.Aa&&this.qa();Pc(this);Ac(this);this.C.error=!1;this.parent.reset.call(this)};function Pc(a){a.i=0;a.S=0;a.T=0;a.U=0;a.V=0;a.W=0;a.Z=0;a.oa=0;I(a,a.ra);Rc(a,0);a.j=0}function Sc(a,b){a.ra=b;I(a,b)}
|
|
l.yc=function(){var a=this.i+this.S+this.T+this.U+this.V+this.W+this.Z|0;return a=a+this.oa+this.R+Tc(this)|0};l.save=function(){var a=new J(this);a.set(0,[this.i,this.S,this.T,this.U,this.V,this.W,this.Z,this.oa,this.R,Tc(this)]);a.set(1,[this.j,this.M,this.Ra]);a.set(2,Eb(this.u));return a.data()};
|
|
l.restore=function(a){var b=a[0];this.i=b[0];this.S=b[1];this.T=b[2];this.U=b[3];this.V=b[4];this.W=b[5];this.Z=b[6];this.oa=b[7]&65535;I(this,b[8]);Rc(this,b[9]);b=a[1];this.j=b[0];this.M=b[1];Gc(this,b[3]);a:{b=this.u;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.M){for(var f=0,g=Array(b.M),h=0;h<e.length-1;)for(var k=e[h++],n=e[h++];k--;)g[f++]=n;e=g}f=b.X[d];if(!f||!f.restore(e)){w("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
|
l.pa=function(a,b,c){switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.N[b]=c;this.ma++;a=!0;break;default:a=this.parent.pa.call(this,a,b,c)}return a};function Uc(a){return a.S<<8|a.T}function Vc(a,b){a.S=b>>8&255;a.T=b&255}function Wc(a){return a.U<<8|a.V}function Xc(a,b){a.U=b>>8&255;a.V=b&255}function K(a){return a.W<<8|a.Z}
|
|
function Yc(a,b){a.W=b>>8&255;a.Z=b&255}function I(a,b){a.R=b&65535}function Zc(a){return a.da&256?1:0}function $c(a,b){a.da=a.da&255|b}function ad(a){return qb[a.ga&255]?4:0}function bd(a){return(a.ga^a.ya)&16?16:0}function cd(a){return a.da&255?0:64}function dd(a){return a.ga&128?128:0}function Tc(a){return a.ua&-214|dd(a)|cd(a)|bd(a)|ad(a)|Zc(a)}function Rc(a,b){a.da=a.ga=a.ya=0;b&1&&(a.da|=256);b&4||(a.ga|=1);b&16&&(a.ya|=16);b&64||(a.da|=255);b&128&&(a.ga^=192);a.ua=a.ua&-726|b&512|2}
|
|
function ed(a,b){a.ya=a.i^b;return a.ga=(a.da=a.i+b)&255}function fd(a,b){a.ya=a.i^b;return a.ga=(a.da=a.i+b+(a.da&256?1:0))&255}function gd(a,b){a.da=a.ga=a.ya=a.i&b;(a.i|b)&8&&(a.ya^=16);return a.da}function hd(a,b){a.ya=b^255;b=a.ga=b+255&255;a.da=a.da&-256|b;return b}function id(a,b){a.ya=b;b=a.ga=b+1&255;a.da=a.da&-256|b;return b}function Dd(a,b){return a.ga=a.da=a.ya=a.i|b}function L(a,b){b^=255;a.ya=a.i^b;return a.ga=(a.da=a.i+b+1^256)&255}
|
|
function Ed(a,b){b^=255;a.ya=a.i^b;return a.ga=(a.da=a.i+b+(a.da&256?0:1)^256)&255}function Fd(a,b){return a.ga=a.da=a.ya=a.i^b}l.aa=function(a){return this.u.aa(a)};l.va=function(a,b){this.u.va(a,b)};function M(a){var b=a.aa(a.R);I(a,a.R+1);return b}function O(a){var b=a.u.$a(a.R);I(a,a.R+2);return b}function P(a){var b=a.u.$a(a.oa);a.oa=a.oa+2&65535;return b}function Q(a,b){a.oa=a.oa-2&65535;a.u.Ib(a.oa,b)}
|
|
function Gd(a){if(a.b&&a.j&255&&a.ua&512){for(var b=0;8>b&&!(a.j&1<<b);b++);a.j&=~(0>b?255:1<<b);a.ua&=-513;a.j&=-257;a.la[199|b<<3].call(a)}return a.j&256?(Lc(a),!1):!0}function Hd(a,b){a.j|=1<<b;a.ua&512&&Lc(a)}function R(a,b,c,d){d=d||2;a.N[b]&&(void 0===c&&(ob(a,"Value for "+b+" is invalid"),a.qa()),c=!a.C.Aa||a.C.vc?t(c,d):"--------".substr(0,d),a.N[b].textContent!=c&&(a.N[b].textContent=c))}
|
|
l.Ja=function(a){this.ma&&(a||!this.C.Aa||this.C.vc)&&(R(this,"A",this.i),R(this,"B",this.S),R(this,"C",this.T),R(this,"BC",Uc(this),4),R(this,"D",this.U),R(this,"E",this.V),R(this,"DE",Wc(this),4),R(this,"H",this.W),R(this,"L",this.Z),R(this,"HL",K(this),4),R(this,"SP",this.oa,4),R(this,"PC",this.R,4),a=Tc(this),R(this,"PS",a,4),R(this,"IF",a&512?1:0,1),R(this,"SF",a&128?1:0,1),R(this,"ZF",a&64?1:0,1),R(this,"AF",a&16?1:0,1),R(this,"PF",a&4?1:0,1),R(this,"CF",a&1?1:0,1));if(a=this.N.speed)a.textContent=
|
|
this.C.Aa&&this.J?this.J.toFixed(2)+"Mhz":"Stopped"};l.kb=function(a){this.C.complete=!0;var b=this.C.Kd=this.H&&Id(this.H),c=a?this.C.Sb?0:1:-1;this.C.Sb=!1;this.L=this.b=a;if(Gd(this)){do{if(b){if(Jd(this.H,this.R,c)){this.qa();break}c=1}this.la[M(this)].call(this)}while(0<this.b)}return this.C.complete?this.L-this.b:void 0===this.C.complete?0:-1};Na(function(){for(var a=D(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Nc(d);fb(d,c)}});function Kd(){this.b-=4}
|
|
function Ld(){I(this,O(this));this.b-=10}function Md(){I(this,P(this));this.b-=10}function Nd(){var a=O(this);Q(this,this.R);I(this,a);this.b-=17}
|
|
var Oc=[Kd,function(){Vc(this,O(this));this.b-=10},function(){this.va(Uc(this),this.i);this.b-=7},function(){Vc(this,Uc(this)+1);this.b-=5},function(){this.S=id(this,this.S);this.b-=5},function(){this.S=hd(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|a>>8;$c(this,a&256);this.b-=4},Kd,function(){var a;Yc(this,a=K(this)+Uc(this));$c(this,a>>8&256);this.b-=10},function(){this.i=this.aa(Uc(this));this.b-=7},function(){Vc(this,Uc(this)-1);this.b-=
|
|
5},function(){this.T=id(this,this.T);this.b-=5},function(){this.T=hd(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.i<<8&256;this.i=(a|this.i)>>1;$c(this,a);this.b-=4},Kd,function(){Xc(this,O(this));this.b-=10},function(){this.va(Wc(this),this.i);this.b-=7},function(){Xc(this,Wc(this)+1);this.b-=5},function(){this.U=id(this,this.U);this.b-=5},function(){this.U=hd(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255|
|
|
Zc(this);$c(this,a&256);this.b-=4},Kd,function(){var a;Yc(this,a=K(this)+Wc(this));$c(this,a>>8&256);this.b-=10},function(){this.i=this.aa(Wc(this));this.b-=7},function(){Xc(this,Wc(this)-1);this.b-=5},function(){this.V=id(this,this.V);this.b-=5},function(){this.V=hd(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=this.i<<8;this.i=(Zc(this)<<8|this.i)>>1;$c(this,a&256);this.b-=4},Kd,function(){Yc(this,O(this));this.b-=10},function(){var a=O(this);this.u.Ib(a,K(this));
|
|
this.b-=16},function(){Yc(this,K(this)+1);this.b-=5},function(){this.W=id(this,this.W);this.b-=5},function(){this.W=hd(this,this.W);this.b-=5},function(){this.W=M(this);this.b-=7},function(){var a=0,b=Zc(this);if(bd(this)||9<(this.i&15))a|=6;if(b||154<=this.i)a|=96,b=1;this.i=ed(this,a);$c(this,b?256:0);this.b-=4},Kd,function(){var a;Yc(this,a=K(this)+K(this));$c(this,a>>8&256);this.b-=10},function(){var a;a=O(this);a=this.u.$a(a);Yc(this,a);this.b-=16},function(){Yc(this,K(this)-1);this.b-=5},function(){this.Z=
|
|
id(this,this.Z);this.b-=5},function(){this.Z=hd(this,this.Z);this.b-=5},function(){this.Z=M(this);this.b-=7},function(){this.i=~this.i&255;this.b-=4},Kd,function(){this.oa=O(this)&65535;this.b-=10},function(){this.va(O(this),this.i);this.b-=13},function(){this.oa=this.oa+1&65535;this.b-=5},function(){var a=K(this);this.va(a,id(this,this.aa(a)));this.b-=10},function(){var a=K(this);this.va(a,hd(this,this.aa(a)));this.b-=10},function(){this.va(K(this),M(this));this.b-=10},function(){this.da|=256;this.b-=
|
|
4},Kd,function(){var a;Yc(this,a=K(this)+this.oa);$c(this,a>>8&256);this.b-=10},function(){this.i=this.aa(O(this));this.b-=13},function(){this.oa=this.oa-1&65535;this.b-=5},function(){this.i=id(this,this.i);this.b-=5},function(){this.i=hd(this,this.i);this.b-=5},function(){this.i=M(this);this.b-=7},function(){$c(this,Zc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;
|
|
this.b-=5},function(){this.S=this.Z;this.b-=5},function(){this.S=this.aa(K(this));this.b-=7},function(){this.S=this.i;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Z;this.b-=5},function(){this.T=this.aa(K(this));this.b-=7},function(){this.T=this.i;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=
|
|
5},function(){this.U=this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Z;this.b-=5},function(){this.U=this.aa(K(this));this.b-=7},function(){this.U=this.i;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Z;this.b-=5},function(){this.V=this.aa(K(this));this.b-=7},function(){this.V=this.i;this.b-=5},function(){this.W=this.S;
|
|
this.b-=5},function(){this.W=this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Z;this.b-=5},function(){this.W=this.aa(K(this));this.b-=7},function(){this.W=this.i;this.b-=5},function(){this.Z=this.S;this.b-=5},function(){this.Z=this.T;this.b-=5},function(){this.Z=this.U;this.b-=5},function(){this.Z=this.V;this.b-=5},function(){this.Z=this.W;this.b-=5},function(){this.b-=5},function(){this.Z=this.aa(K(this));this.b-=
|
|
7},function(){this.Z=this.i;this.b-=5},function(){this.va(K(this),this.S);this.b-=7},function(){this.va(K(this),this.T);this.b-=7},function(){this.va(K(this),this.U);this.b-=7},function(){this.va(K(this),this.V);this.b-=7},function(){this.va(K(this),this.W);this.b-=7},function(){this.va(K(this),this.Z);this.b-=7},function(){var a=this.R-1;if(this.ca.length)for(var b=0;b<this.ca.length;b++)if(this.ca[b](a))return;this.b-=7;this.j|=256;Lc(this);this.H&&ib(this,-2147483648)?(I(this,a),this.H.qa()):this.ua&
|
|
512||(this.H&&I(this,a),this.qa())},function(){this.va(K(this),this.i);this.b-=7},function(){this.i=this.S;this.b-=5},function(){this.i=this.T;this.b-=5},function(){this.i=this.U;this.b-=5},function(){this.i=this.V;this.b-=5},function(){this.i=this.W;this.b-=5},function(){this.i=this.Z;this.b-=5},function(){this.i=this.aa(K(this));this.b-=7},function(){this.b-=5},function(){this.i=ed(this,this.S);this.b-=4},function(){this.i=ed(this,this.T);this.b-=4},function(){this.i=ed(this,this.U);this.b-=4},
|
|
function(){this.i=ed(this,this.V);this.b-=4},function(){this.i=ed(this,this.W);this.b-=4},function(){this.i=ed(this,this.Z);this.b-=4},function(){this.i=ed(this,this.aa(K(this)));this.b-=7},function(){this.i=ed(this,this.i);this.b-=4},function(){this.i=fd(this,this.S);this.b-=4},function(){this.i=fd(this,this.T);this.b-=4},function(){this.i=fd(this,this.U);this.b-=4},function(){this.i=fd(this,this.V);this.b-=4},function(){this.i=fd(this,this.W);this.b-=4},function(){this.i=fd(this,this.Z);this.b-=
|
|
4},function(){this.i=fd(this,this.aa(K(this)));this.b-=7},function(){this.i=fd(this,this.i);this.b-=4},function(){this.i=L(this,this.S);this.b-=4},function(){this.i=L(this,this.T);this.b-=4},function(){this.i=L(this,this.U);this.b-=4},function(){this.i=L(this,this.V);this.b-=4},function(){this.i=L(this,this.W);this.b-=4},function(){this.i=L(this,this.Z);this.b-=4},function(){this.i=L(this,this.aa(K(this)));this.b-=7},function(){this.i=L(this,this.i);this.b-=4},function(){this.i=Ed(this,this.S);this.b-=
|
|
4},function(){this.i=Ed(this,this.T);this.b-=4},function(){this.i=Ed(this,this.U);this.b-=4},function(){this.i=Ed(this,this.V);this.b-=4},function(){this.i=Ed(this,this.W);this.b-=4},function(){this.i=Ed(this,this.Z);this.b-=4},function(){this.i=Ed(this,this.aa(K(this)));this.b-=7},function(){this.i=Ed(this,this.i);this.b-=4},function(){this.i=gd(this,this.S);this.b-=4},function(){this.i=gd(this,this.T);this.b-=4},function(){this.i=gd(this,this.U);this.b-=4},function(){this.i=gd(this,this.V);this.b-=
|
|
4},function(){this.i=gd(this,this.W);this.b-=4},function(){this.i=gd(this,this.Z);this.b-=4},function(){this.i=gd(this,this.aa(K(this)));this.b-=7},function(){this.i=gd(this,this.i);this.b-=4},function(){this.i=Fd(this,this.S);this.b-=4},function(){this.i=Fd(this,this.T);this.b-=4},function(){this.i=Fd(this,this.U);this.b-=4},function(){this.i=Fd(this,this.V);this.b-=4},function(){this.i=Fd(this,this.W);this.b-=4},function(){this.i=Fd(this,this.Z);this.b-=4},function(){this.i=Fd(this,this.aa(K(this)));
|
|
this.b-=7},function(){this.i=Fd(this,this.i);this.b-=4},function(){this.i=Dd(this,this.S);this.b-=4},function(){this.i=Dd(this,this.T);this.b-=4},function(){this.i=Dd(this,this.U);this.b-=4},function(){this.i=Dd(this,this.V);this.b-=4},function(){this.i=Dd(this,this.W);this.b-=4},function(){this.i=Dd(this,this.Z);this.b-=4},function(){this.i=Dd(this,this.aa(K(this)));this.b-=7},function(){this.i=Dd(this,this.i);this.b-=4},function(){L(this,this.S);this.b-=4},function(){L(this,this.T);this.b-=4},function(){L(this,
|
|
this.U);this.b-=4},function(){L(this,this.V);this.b-=4},function(){L(this,this.W);this.b-=4},function(){L(this,this.Z);this.b-=4},function(){L(this,this.aa(K(this)));this.b-=7},function(){L(this,this.i);this.b-=4},function(){cd(this)||(I(this,P(this)),this.b-=6);this.b-=5},function(){Vc(this,P(this));this.b-=10},function(){var a=O(this);cd(this)||I(this,a);this.b-=10},Ld,function(){var a=O(this);cd(this)||(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},function(){Q(this,Uc(this));this.b-=11},function(){this.i=
|
|
ed(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,0);this.b-=11},function(){cd(this)&&(I(this,P(this)),this.b-=6);this.b-=5},Md,function(){var a=O(this);cd(this)&&I(this,a);this.b-=10},Ld,function(){var a=O(this);cd(this)&&(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=fd(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,8);this.b-=11},function(){Zc(this)||(I(this,P(this)),this.b-=6);this.b-=5},function(){Xc(this,P(this));this.b-=10},function(){var a=O(this);
|
|
Zc(this)||I(this,a);this.b-=10},function(){var a=M(this);Ub(this.u,a,this.i,this.R+-2&65535);this.b-=10},function(){var a=O(this);Zc(this)||(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},function(){Q(this,Wc(this));this.b-=11},function(){this.i=L(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,16);this.b-=11},function(){Zc(this)&&(I(this,P(this)),this.b-=6);this.b-=5},Md,function(){var a=O(this);Zc(this)&&I(this,a);this.b-=10},function(){var a=M(this);this.i=Qb(this.u,a,this.R+-2&65535)&
|
|
255;this.b-=10},function(){var a=O(this);Zc(this)&&(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=Ed(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,24);this.b-=11},function(){ad(this)||(I(this,P(this)),this.b-=6);this.b-=5},function(){Yc(this,P(this));this.b-=10},function(){var a=O(this);ad(this)||I(this,a);this.b-=10},function(){var a=P(this);Q(this,K(this));Yc(this,a);this.b-=18},function(){var a=O(this);ad(this)||(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},
|
|
function(){Q(this,K(this));this.b-=11},function(){this.i=gd(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,32);this.b-=11},function(){ad(this)&&(I(this,P(this)),this.b-=6);this.b-=5},function(){I(this,K(this));this.b-=5},function(){var a=O(this);ad(this)&&I(this,a);this.b-=10},function(){var a=K(this);Yc(this,Wc(this));Xc(this,a);this.b-=5},function(){var a=O(this);ad(this)&&(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},Nd,function(){this.i=Fd(this,M(this));this.b-=7},function(){Q(this,
|
|
this.R);I(this,40);this.b-=11},function(){dd(this)||(I(this,P(this)),this.b-=6);this.b-=5},function(){var a=P(this);Rc(this,a&255|this.ua&-256);this.i=a>>8;this.b-=10},function(){var a=O(this);dd(this)||I(this,a);this.b-=10},function(){this.ua&=-513;this.b-=4},function(){var a=O(this);dd(this)||(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},function(){Q(this,Tc(this)&255|this.i<<8);this.b-=11},function(){this.i=Dd(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,48);this.b-=11},function(){dd(this)&&
|
|
(I(this,P(this)),this.b-=6);this.b-=5},function(){this.oa=K(this)&65535;this.b-=5},function(){var a=O(this);dd(this)&&I(this,a);this.b-=10},function(){this.ua|=512;this.b-=4;Gd(this)},function(){var a=O(this);dd(this)&&(Q(this,this.R),I(this,a),this.b-=6);this.b-=11},Nd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.R);I(this,56);this.b-=11}];
|
|
function S(a){z.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Od[b]&&Pa("Unrecognized ChipSet model: "+b);this.w=Od[b]||{};a.sound&&(this.fa=null,window&&(this.fa=window.AudioContext||window.webkitAudioContext),this.fa&&new this.fa);F(this)}A(S);
|
|
var U={Ba:1978.1,vd:{Ca:0,qe:1,ue:16,Be:32,Ke:64,Je:128,mb:14},Ya:{Ca:1,Kc:1,nd:2,jd:4,kd:16,ld:32,md:64,mb:8},wd:{Ca:2,pe:3,Se:4,re:8,Fe:16,Ge:32,He:64,se:128,mb:0},Oe:{Ca:3},Me:{Ca:2,Ce:7},Qe:{Ca:3,Te:1,Pe:2,Ie:4,ze:8,te:16,je:32},Ne:{Ca:4},Re:{Ca:5,ve:1,we:2,xe:4,ye:8,Ue:16}},V={Ba:100,Ka:{Ca:66,mc:1,bc:2,fd:4,Ee:8,De:16,dc:32,cc:64,Yb:128},Ic:{Ca:66,INIT:0},Ta:{Ca:194,le:0,Wb:16,pd:32,ic:48,Sc:0,Tc:32},Ab:{Ca:162,Le:0,Vc:0,Rc:0,Uc:0,Qc:0},La:{Ae:{Ca:98},Sa:{Fc:0,Ec:1,sd:2,Bd:4,Lc:5,qd:6,td:7},
|
|
Cb:16383}},Od={SI1978:U,VT100:V};S.prototype.pa=function(){return!1};S.prototype.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;this.B=a;this.J=tb(a,"Keyboard");this.Fa=tb(a,"SerialPort");this.video=tb(a,"Video");Pb(b,this,this.w.Gb);Tb(b,this,this.w.Hb);if(d){var e=this;Pd(d,16384,function(){for(var a="",b=0;b<e.I.length;b++)a&&(a+=b&&b%10?", ":",\n"),a+=u(e.I[b]);e.H.g(a)})}};S.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
S.prototype.Ia=function(a){return a?this.save():!0};U.INIT=[[U.vd.mb,U.Ya.mb,U.wd.mb,0,0,0,0]];
|
|
V.INIT=[[V.Ic.INIT,V.Ka.bc|V.Ka.fd],[V.Ta.Sc,V.Ta.Tc],[V.Ab.Vc,V.Ab.Rc,V.Ab.Uc,V.Ab.Qc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
|
[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];l=S.prototype;l.reset=function(){this.w.INIT&&!this.restore(this.w.INIT)&&this.ka("reset error")};
|
|
l.save=function(){var a=new J(this);switch(this.w.Ba){case U.Ba:a.set(0,[this.wa,this.G,this.za,this.Y,this.ea,this.ra,this.ma]);break;case V.Ba:a.set(0,[this.ha,this.K]),a.set(1,[this.L,this.M]),a.set(2,[this.D,this.ba,this.la,this.ja]),a.set(3,[this.P,this.j,this.O,this.ca,this.I])}return a.data()};
|
|
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.w.Ba){case U.Ba:return this.wa=b[0],this.G=b[1],this.za=b[2],this.Y=b[3],this.ea=b[4],this.ra=b[5],this.ma=b[6],!0;case V.Ba:return this.ha=b[0],this.K=b[1],b=a[1],this.L=b[0],this.M=b[1],b=a[2],this.D=b[0],this.ba=b[1],this.la=b[2],this.ja=b[3],b=a[3],this.P=b[0],this.j=b[1],this.O=b[2],this.ca=b[3],this.I=b[4],!0}return!1};l.start=function(){};l.stop=function(){};l.Qd=function(a,b){var c=this.wa;E(this,a,null,b,"STATUS0",c,!0);return c};
|
|
l.Rd=function(a,b){var c=this.G;E(this,a,null,b,"STATUS1",c,!0);return c};l.Sd=function(a,b){var c=this.za;E(this,a,null,b,"STATUS2",c,!0);return c};l.Pd=function(a,b){var c=this.Y>>8-this.ea&255;E(this,a,null,b,"SHIFT.RESULT",c,!0);return c};l.$d=function(a,b,c){E(this,a,b,c,"SHIFT.COUNT",null,!0);this.ea=b};l.be=function(a,b,c){E(this,a,b,c,"SOUND1",null,!0);this.ra=b};l.ae=function(a,b,c){E(this,a,b,c,"SHIFT.DATA",null,!0);this.Y=b<<8|this.Y>>8};
|
|
l.ce=function(a,b,c){E(this,a,b,c,"SOUND2",null,!0);this.ma=b};l.de=function(a,b,c){E(this,a,b,c,"WATCHDOG",null,!0)};function Qd(a){var b=0,c=0,d=~a.P;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
|
|
l.Td=function(a,b){var c=this.K,c=c&~V.Ka.cc;if((Fc(this.b)&64)<<1&&(c|=V.Ka.cc,c!=this.K)){var d,e;d=this.O&1;e=this.O>>1&7;switch(e){case V.La.Sa.td:break;case V.La.Sa.Ec:this.P=this.P<<1|d;break;case V.La.Sa.Lc:d=Qd(this);this.I[d]=V.La.Cb;hb(this,"doNVRCommand(): erase data at addr "+u(d));break;case V.La.Sa.Fc:this.j=this.j<<1|d;break;case V.La.Sa.Bd:d=Qd(this);e=this.j&V.La.Cb;this.I[d]=e;hb(this,"doNVRCommand(): write data "+u(e)+" to addr "+u(d));break;case V.La.Sa.qd:d=Qd(this);e=this.I[d];
|
|
null==e&&(e=V.La.Cb);this.j=e;hb(this,"doNVRCommand(): read data "+u(e)+" from addr "+u(d));break;case V.La.Sa.sd:this.j<<=1;this.ca=this.j&V.La.Cb+1;break;default:hb(this,"doNVRCommand(): unrecognized command "+ca(e))}}c&=~V.Ka.dc;this.ca&&(c|=V.Ka.dc);c&=~V.Ka.Yb;if(d=this.J){d=this.J;if(e=d.D)e=d.b,e=Fc(d.b)>=d.K+e.Y*e.Ra/1E3*1.2731488;e&&(d.D=!1);d=!d.D}d&&(c|=V.Ka.Yb);c&=~V.Ka.mc;this.Fa&&this.Fa.Da&1&&(c|=V.Ka.mc);this.K=c;E(this,a,null,b,"FLAGS",c);return c};
|
|
l.ee=function(a,b,c){E(this,a,b,c,"BRIGHTNESS");this.ha=b};l.he=function(a,b,c){E(this,a,b,c,"NVR.LATCH");this.O=b};l.ge=function(a,b,c){E(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.D=this.D&-4|a;break;case 1:this.D=this.D&-13|a<<2;this.video&&(b=this.video,a=this.D,hb(b,"updateScrollOffset("+a+")"),b.eb!==a&&((b.eb=a)?Mc(b,!0):b.ob=!0));break;case 2:switch(a){case 0:this.ba=~this.ba;break;case 2:case 3:this.la=3-a}break;case 3:this.ja=a}};
|
|
l.fe=function(a,b,c){E(this,a,b,c,"DC011");b&V.Ta.pd?(b&=V.Ta.ic,this.M!=b&&(this.M=b,this.video&&(a=this.video,b=this.M==V.Ta.ic?50:60,hb(a,"updateRate("+b+")"),a.qc=b))):(b&=V.Ta.Wb,this.L!=b&&(this.L=b,this.video&&(a=this.L==V.Ta.Wb?132:80,b=this.video,hb(b,"updateDimensions("+a+","+(80<a&&this.K&V.Ka.bc?14:24)+")"),b.ca=a,b.sa=b.fc,80<a&&b.sa--,Rd(b)&&Sd(b))))};U.Gb={0:S.prototype.Qd,1:S.prototype.Rd,2:S.prototype.Sd,3:S.prototype.Pd};
|
|
U.Hb={2:S.prototype.$d,3:S.prototype.be,4:S.prototype.ae,5:S.prototype.ce,6:S.prototype.de};V.Gb={66:S.prototype.Td};V.Hb={66:S.prototype.ee,98:S.prototype.he,162:S.prototype.ge,194:S.prototype.fe};Na(function(){for(var a=D(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new S(d);fb(d,c)}});
|
|
function Td(a){z.call(this,"ROM",a,Td);this.B=null;this.D=a.addr;this.j=a.size;this.G=a.writable;this.w=a.alias;this.I=a.file;this.J=ea(this.I);if(this.I){a=this.I;var b=fa(this.J);"json"!=b&&"hex"!=b&&(a=ja()+"/api/v1/dump?file="+this.I+"&format=bytes&decimal=true");var c=this;va(a,null,!0,function(a,b,f){Ud(c,a,b,f)})}}A(Td);var Vd=[0,5];Td.prototype.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;Wd(this)};
|
|
Td.prototype.Ea=function(){if(this.Qa){if(this.H){var a=this.H,b=this.id,c=this.D,d=this.j,e=this.Qa,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var k=h.o,n=h.a;if(void 0!==k){var p=f,k=[k>>>0,g],q=pa(p,k,a.uc);0>q&&p.splice(-(q+1),0,k)}n&&(h.a=n.replace(/''/g,'"'))}a.G.push({gf:b,F:c,Vd:d,Qa:e,tc:f})}delete this.Qa}return!0};Td.prototype.Ia=function(){return!0};
|
|
function Ud(a,b,c,d){if(d)a.ka("Unable to load system ROM (error "+d+": "+b+")");else{bb(a.Bb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.B=f;else if(g)for(a.B=Array(4*g.length),d=c=0;c<g.length;c++)a.B[d++]=g[c]&255,a.B[d++]=g[c]>>8&255,a.B[d++]=g[c]>>16&255,a.B[d++]=g[c]>>24&255;else a.B=e;a.Qa=e.symbols;if(!a.B.length){w("Empty ROM: "+b);return}if(1==a.B.length){w(a.B[0]);return}}catch(h){a.ka("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
|
|
" ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e<b.length;e++)a.B[e]=aa(b[e],16);Wd(a)}}
|
|
function Wd(a){if(!nb(a))if(!a.I)F(a);else if(a.B&&a.u){a.j||(a.j=a.B.length);if(a.B.length!=a.j)ob(a,"ROM size ("+t(a.B.length,8,!0)+") does not match specified size ("+t(a.j,8,!0)+")");else if(Xd(a,a.D)){var b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.u,g=d.j,h=[],k=d.D>>>f.ia;0<g&&k<f.X.length;)h.push(f.X[k++]),g-=f.Ha;f=d.u;d=d.j;g=0;for(e>>>=f.ia;0<d&&e<f.X.length;){k=h[g++];if(!k)break;f.X[e++]=k;d-=f.Ha}}delete a.B}F(a)}}
|
|
function Xd(a,b){if(xb(a.u,b,a.j,a.G?1:ac)){var c;for(c=0;c<a.B.length;c++)Db(a.u,b+c,a.B[c]);if(a.G&&256==b){for(c=0;c<Vd.length;c++)Db(a.u,Vd[c],118);Qc(a.b,function(a){return function(b){if(0<=Vd.indexOf(b)){var c=!1,d=a.b,e=a.H;if(5==b)switch(c=!0,d.T){case 2:Yd(a,String.fromCharCode(d.V));break;case 9:for(var k=Wc(d),n="",p=255;p--;){var q=a.b.aa(k++);if(36==q)break;n+=String.fromCharCode(q)}Yd(a,n);break;default:c=!1}c?Md.call(d):e&&(a.g("\nCP/M vector "+u(b)),I(d,b),e.qa());b=!0}else b=!1;
|
|
return b}}(a));Sc(a.b,b)}return!0}return!1}function Yd(a,b){b=b.replace(/\r/g,"");a.Ga&&(a.Ga.value+=b,a.Ga.scrollTop=a.Ga.scrollHeight)}Na(function(){for(var a=D(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Td(d);fb(d,c)}});function Zd(a){z.call(this,"RAM",a,Zd);this.w=a.addr;this.j=a.size;this.B=!1}A(Zd);l=Zd.prototype;l.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;F(this)};l.Ea=function(a,b){b||this.reset();return!0};l.Ia=function(a){return a?this.save():!0};
|
|
l.reset=function(){!this.B&&this.j&&xb(this.u,this.w,this.j,1)&&(this.B=!0);this.B||w("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};Na(function(){for(var a=D(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Zd(d);fb(d,c)}});function $d(a){z.call(this,"Keyboard",a,$d,65536);(a=a.model)&&!ae[a]&&Pa("Unrecognized Keyboard8080 model: "+a);this.u=ae[a]||{};this.reset();F(this)}A($d);var be={};be[m.Ub]=37;be[m.Xb]=39;be[m.Zb]=32;
|
|
var ce={Ba:1978.1,A:{},Vb:be,pb:{},Xa:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},W={Ba:100,A:{},Vb:{},pb:{},Xa:{setup:120},Gc:{Ca:130,INIT:127},Ma:{Ca:130,bd:1,ad:2,$c:4,Zc:8,cd:16,ac:32,$b:63,ud:64,ke:128,INIT:0},Yc:127};W.A[46]=3;W.A[m.hd]=5;W.A[m.gd]=6;W.A[m.Dd]=7;W.A[m.xd]=8;W.A[m.Ad]=9;W.A[m.Q]=10;W.A[39]=16;W.A[221]=20;W.A[219]=21;W.A[m.Pc]=22;W.A[m.yd]=23;W.A[m.od]=24;W.A[m.E]=25;W.A[49]=26;W.A[37]=32;W.A[40]=34;W.A[117]=35;W.A[19]=35;W.A[192]=36;W.A[189]=37;W.A[57]=38;W.A[55]=39;
|
|
W.A[52]=40;W.A[51]=41;W.A[27]=42;W.A[38]=48;W.A[114]=49;W.A[112]=50;W.A[8]=51;W.A[187]=52;W.A[48]=53;W.A[56]=54;W.A[54]=55;W.A[53]=56;W.A[50]=57;W.A[9]=58;W.A[103]=64;W.A[115]=65;W.A[113]=66;W.A[96]=67;W.A[118]=68;W.A[220]=69;W.A[m.Zb]=70;W.A[m.Xc]=71;W.A[m.Nc]=72;W.A[m.Mc]=73;W.A[m.Ub]=74;W.A[104]=80;W.A[2013]=81;W.A[98]=82;W.A[97]=83;W.A[222]=85;W.A[186]=86;W.A[m.Wc]=87;W.A[m.Oc]=88;W.A[m.Xb]=89;W.A[m.rd]=90;W.A[110]=96;W.A[116]=97;W.A[101]=98;W.A[100]=99;W.A[13]=100;W.A[190]=101;W.A[188]=102;
|
|
W.A[m.ed]=103;W.A[m.Hc]=104;W.A[m.Cd]=105;W.A[119]=106;W.A[105]=112;W.A[99]=113;W.A[102]=114;W.A[109]=115;W.A[191]=117;W.A[m.dd]=118;W.A[m[" "]]=119;W.A[m.zd]=120;W.A[m.Jc]=121;W.A[m.Ed]=122;W.A[120]=123;W.A[17]=124;W.A[16]=125;W.A[20]=126;W.pb={l4:W.Ma.bd,l3:W.Ma.ad,l2:W.Ma.$c,l1:W.Ma.Zc,locked:W.Ma.cd,local:W.Ma.ac,online:~W.Ma.ac};var ae={SI1978:ce,VT100:W};
|
|
$d.prototype.pa=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.N[e]){if("led"==a&&this.u.pb[b])return this.N[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return de(d,a,!0)},c.onkeyup=function(a){return de(d,a,!1)},!0;default:if(this.u.Xa&&void 0!==this.u.Xa[b])return this.N[e]=c,a=function(a,b){return function(c){c.preventDefault();ee(a,b,!0)}}(this,this.u.Xa[b]),b=function(a,b){return function(){ee(a,b,!1)}}(this,this.u.Xa[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
|
|
b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};$d.prototype.Pa=function(a,b,c,d){this.B=a;this.b=c;this.H=d;this.I=tb(a,"ChipSet");Pb(b,this,this.u.Gb);Tb(b,this,this.u.Hb)};$d.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};$d.prototype.Ia=function(a){return a?this.save():!0};W.INIT=[[W.Ma.INIT,W.Gc.INIT,!1,0,-1]];l=$d.prototype;l.reset=function(){this.j=[];this.u.INIT&&!this.restore(this.u.INIT)&&this.ka("reset error")};
|
|
l.save=function(){var a=new J(this);switch(this.u.Ba){case W.Ba:a.set(0,[this.J,this.G,this.D,this.K,-1])}return a.data()};l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.u.Ba){case ce.Ba:return!0;case W.Ba:return this.J=b[0],fe(this,this.J&W.Ma.$b),this.G=b[1],this.D=b[2],this.K=b[3],this.w=b[4],!0}return!1};function fe(a,b){for(var c in a.u.pb){var d=a.N["led-"+c];if(d){var e=a.u.pb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
|
|
function de(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.u.Vb[e]||e,!a.u.A[e]){for(var f in a.u.Xa)if(a.u.Xa[f]===e){e=f;break a}e=null}e&&(d=ee(a,e,c),b.preventDefault());return d}
|
|
function ee(a,b,c){var d;a:{for(d=0;d<a.j.length;d++)if(a.j[d].Rb==b)break a;d=-1}if(c)0>d?a.j.push({Rb:b,Ob:Date.now(),Db:!1}):(a.j[d].Ob=Date.now(),a.j[d].Db=!1);else if(0<=d){if(!a.j[d].Db){var e=a.j[d].Ob;if(e&&100>Date.now()-e)return a.j[d].Db=!0,ge(a),!0}a.j.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Ya.jd;break;case "2p":d=U.Ya.nd;break;case "coin":d=U.Ya.Kc;break;case "left":d=U.Ya.ld;break;case "right":d=U.Ya.md;break;case "fire":d=U.Ya.kd}d&&(a=a.I,b=d,a.G&=~b,c&&(a.G|=b))}return!0}
|
|
function ge(a){for(var b=0,c=-1;b<a.j.length;){if(a.j[b].Db){var d=a.j[b].Rb,e=100-(Date.now()-a.j[b].Ob);if(0<e){if(0>c||c>e)c=e}else{ee(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){ge(a)},c)}l.Ud=function(a,b){var c=this.G;0<=this.w&&(this.w<this.j.length?(c=this.j[this.w],this.w++,c=W.A[c.Rb],c&128&&(c&=127)):(this.w=-1,c=W.Yc),this.G=c,Hd(this.b,1));E(this,a,null,b,"KBDUART.ADDRESS",c);return c};
|
|
l.ie=function(a,b,c){E(this,a,b,c,"KBDUART.STATUS");this.J=b;this.D=!0;this.K=Fc(this.b);fe(this,b&W.Ma.$b);b&W.Ma.ud&&(this.w=0,Hd(this.b,1))};W.Gb={130:$d.prototype.Ud};W.Hb={130:$d.prototype.ie};Na(function(){for(var a=D(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new $d(d);fb(d,c)}});
|
|
function he(a,b,c,d,e){var f=this;this.kc=Ca("Gecko/");var g=["","moz","ms","webkit"];z.call(this,"Video",a,he,262144);this.Y=a.screenWidth;this.O=a.screenHeight;this.Ua=a.bufferAddr;this.Hd=a.bufferRAM;var h=a.bufferFormat;this.ma=h&&ie[h.toUpperCase()]||je;this.ca=a.bufferCols;this.wa=a.bufferRows;this.fc=this.sa=a.cellWidth||1;this.na=a.cellHeight||1;this.za=null;this.jc=!1;this.Va=a.bufferBits||1;this.Jd=a.bufferLeft||0;if(this.w=a.bufferRotate)this.w=this.w%360,0<this.w&&(this.w-=360),-90!=this.w&&
|
|
(this.ka("unsupported buffer rotation: "+this.w),this.w=0);this.Wa=a.interruptRate;this.rc=a.refreshRate||60;this.M=b;this.I=c;this.la=(this.Md=d)||b||null;this.Dc=this.Y;this.Gd=this.O;this.gc=this.Y/this.ca|0;this.hc=this.O/this.wa|0;1<this.na&&(this.wa++,this.eb=0,this.ob=!1);b=a.smoothing;(c=Va.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<g.length;c++)if(d=(d=g[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.I[d]){this.I[d]=b;break}if(this.D=a.screenRotate)this.D=this.D%
|
|
360,0<this.D&&(this.D-=360),-90!=this.D?(this.ka("unsupported screen rotation: "+this.D),this.D=0):(this.I.translate(0,this.O),this.I.rotate(this.D*Math.PI/180),this.I.scale(this.O/this.Y,this.Y/this.O));if(this.j=e)if(this.j.gb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.j.gb){for(c=0;c<g.length;c++)if(d=g[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){ke(f,document.fullscreenElement||document.msFullscreenElement||
|
|
document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);break}for(c=0;c<g.length;c++)if(d=g[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){ke(f,null)},!1);break}}if(this.ea=a.fontROM)"json"!=fa(this.ea)&&(this.ea=ja()+"/api/v1/dump?file="+this.ea+"&format=bytes"),va(this.ea,null,!0,function(a,b,c){le(f,a,b,c)});this.Jb={}}A(he);var je=0,ie={SI1978:1,VT100:2};
|
|
function Rd(a){a.K=a.ca*a.sa;a.ba=a.wa*a.na;var b=a.K,c=a.ba;a.w&&(b=a.ba,c=a.K);a.P=0;if(!a.Hd&&(a.P=(a.K*a.Va>>3)*a.ba,!xb(a.u,a.Ua,a.P,3)))return!1;a.P?(a.lc=a.I.createImageData(b,c),a.oc=16/a.Va|0,me(a,a.P>>1)):me(a,(a.ca+1)*a.wa);a.L=document.createElement("canvas");a.L.width=b;a.L.height=c;a.nb=a.L.getContext("2d");a.fa={};a.ra=1<<a.Va;a.ha=Array(a.ra+2);a.ha[0]=[0,0,0,255];a.ha[1]=[255,255,255,255];1==a.ma&&(a.ha[a.ra+0]=[255,255,0,255],a.ha[a.ra+1]=[0,255,0,255]);2==a.ma&&(a.qc=60,a.qb=!1,
|
|
a.Fa=Array(a.ca));return!0}he.prototype.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;Rd(this);if(this.J=tb(a,"Keyboard")){for(var e in this.Jb)this.J.pa("led",e,this.Jb[e]);this.M&&this.J.pa(this.Md?"textarea":"canvas","kbd",this.la)}var f=this;this.sc=Jc(this.b,function(){Mc(f)});Kc(this.b,this.sc,1E3/Math.max(this.rc,this.Wa));this.pc=0;this.ea||F(this)};
|
|
function le(a,b,c,d){if(d)a.ka("Unable to load font ROM (error "+d+": "+b+")");else{bb(a.Bb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){w("Empty font ROM: "+b);return}if(1==f.length){w(f[0]);return}if(2048==f.length)a.za=f,Sd(a);else{a.ka("Unrecognized font data length ("+f.length+")");return}}catch(g){a.ka("Font ROM data error: "+g.message);return}(a.I||a.H)&&F(a)}}
|
|
function Sd(a){a.za&&(a.jc=2==a.ma,a.fa[96]=[ne(a,a.sa,a.na),ne(a,a.sa,a.na,a.qb)],a.fa[64]=[ne(a,2*a.sa,a.na),ne(a,2*a.sa,a.na,a.qb)],a.fa[32]=a.fa[0]=[ne(a,2*a.sa,2*a.na),ne(a,2*a.sa,2*a.na,a.qb)])}
|
|
function ne(a,b,c,d){var e=8>=a.fc?8:16,f=8<e?15:0,g=a.za.length/e,h=!1===d,k={sa:b,na:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=g/16*c;k.context=k.canvas.getContext("2d");for(var n=k.context.createImageData(b,c),p=0;p<g;p++){for(var q=0,x=q;q<a.na;q++)for(var v=p*e+(f+q&e-1),v=d&&8==q?255:a.za[v],r=0;r<c/a.na;r++){for(var y=0,G=0,ga=G;G<a.sa;G++){for(var C=v&128>>(7<G?7:G),y=a.jc&&!C&&y?y:C,T=0;T<b/a.sa;T++)h&&(y=!y),oe(a,n,ga,x,y?1:0),ga++;y=C}x++}k.context.putImageData(n,
|
|
(p&15)*b,(p>>4)*c)}return k}he.prototype.Ea=function(){return!0};he.prototype.pa=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Jb[b]=c,!0;switch(b){case "fullScreen":return this.N[b]=c,this.j&&this.j.gb?c.onclick=function(){d.gb()}:c.parentNode.removeChild(c),!0}return!1};
|
|
he.prototype.gb=function(){var a=!1;if(this.j){if(this.j.gb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.Y/this.O;b>c&&(a=Math.round(c/b*100)+"%")}this.kc?(this.M.style.width=a,this.M.style.width=a,this.M.style.display="block",this.M.style.margin="auto"):(this.j.style.width=a,this.j.style.height="auto");this.j.style.backgroundColor="black";this.j.gb();a=!0}this.la&&this.la.focus()}return a};
|
|
function ke(a,b){!b&&a.j&&(a.kc?a.M.style.width=a.M.style.height="":a.j.style.width=a.j.style.height="");hb(a,"notifyFullScreen("+b+")")}function me(a,b){a.nc=b;a.ja=!1;if(void 0===a.G||a.G.length!=a.nc)a.G=Array(a.nc)}function oe(a,b,c,d,e){d=a.w?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ma&&(208<=c&&236>c?e=a.ra+0:28<=c&&72>c&&(e=a.ra+1));a=a.ha[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
|
|
function Mc(a,b){var c=!0;if(!b){a.Wa&&(120==a.Wa?a.pc&1?(Hd(a.b,2),c=!1):Hd(a.b,1):Hd(a.b,4));if(c&&a.ja&&a.P){for(var d=a.u,e=a.P,f=!0,g=a.Ua>>>d.ia;0<e&&g<d.X.length;)d.X[g].Na&&(d.X[g].Na=f=!1,d.X[g].xc=!0),e-=d.Ha,g++;f&&(c=!1)}Kc(a.b,a.sc,1E3/Math.max(a.rc,a.Wa));a.pc++}if(c)if(1<a.sa)switch(a.ma){case 2:for(var c=a.Ua,d=-1,e=0,f=60==a.qc?2:5,h=g=0,k=-1;e<a.wa;){var n=0,p=c,q=d,x=a.ca;for(96!=q&&(x>>=1);;){var v=Ab(a.u,p++);if(127==(v&127)){var r=Ab(a.u,p++),d=r&96,c=(r&15)<<8|Ab(a.u,p),c=c+
|
|
(r&16?8192:16384);break}if(n<x)a.Fa[n++]=v;else break}if(f)f--;else{for(;n<a.Fa.length;)a.Fa[n++]=0;if(0<=q)for(p=a.ja&&a.G[g]==x,a.G[g++]=x,x=0;x<n;x++){v=a.Fa[x];if(!p||v!==a.G[g]){a.G[k=g]=v;var r=a,y=a.nb,G=v&127;if(v=r.fa[q][v&128?1:0]){var ga=(G&15)*v.sa,G=(G>>4)*v.na,C,T,da,X,ta=v.sa,Cb=v.na;y?(C=x*r.sa,T=e*r.na,da=r.sa,X=r.na):(C=x*r.gc,T=e*r.hc,da=r.gc,X=r.hc);v.sa>r.sa&&(C*=2,da*=2);v.na>r.na&&(q||(G+=r.na),Cb=r.na);y?y.drawImage(v.canvas,ga,G,ta,Cb,C,T,da,X):(C+=0,T+=0,r.I.drawImage(v.canvas,
|
|
ga,G,ta,Cb,C,T,da,X))}h++}g++}e++}}a.ja=!0;!b&&a.ob&&1==h&&(a.G[k]=-1,h=0);a.ob=!1;(h||b)&&a.nb&&a.I.drawImage(a.L,0,a.eb,a.K,a.ba-a.na,0,0,a.Dc,a.Gd)}else{e=a.Ua;f=e+a.P;k=h=g=0;b=a.K;n=0;c=a.ba;q=d=0;p=a.Va;x=(1<<p)-1;a.Jd&&(p=-p,q=16+p);for(;e<f;){r=Bb(a.u,e);if(a.ja&&r===a.G[g])h+=a.oc;else{a.G[g]=r;(y=q)&&(r=r>>8|(r&255)<<8);h<b&&(b=h);for(v=a.oc;v--;)ga=r>>y&x,oe(a,a.lc,h++,k,ga),y+=p;h>n&&(n=h);k<c&&(c=k);k>=d&&(d=k+1)}e+=2;g++;if(h>=a.K&&(h=0,k++,k>a.ba))break}a.ja=!0;b<a.K&&(e=n-b,d-=c,a.w&&
|
|
(f=b,g=e,b=c,e=d,c=a.K-(f+g),d=g),a.nb.putImageData(a.lc,0,0,b,c,e,d),a.I.drawImage(a.L,0,0,a.L.width,a.L.height,0,0,a.Y,a.O))}}
|
|
Na(function(){for(var a=D(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=B(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","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=wa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height=
|
|
(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Va.aspect);f&&.3<=f&&3.33>=f&&(Ma("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");Ca("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new he(d,e,g,f,c);fb(d,c)}});
|
|
function pe(a){this.fa=+a.adapter;switch(this.fa){case 0:this.ha=0;this.la=2;break;default:w("Unrecognized serial adapter #"+this.fa);return}this.j=this.w=null;this.ja=a.tabSize;this.ea=a.charBOL;this.D=0;this.ba=!1;z.call(this,"SerialPort",a,pe,8388608);var b=a.binding;if("console"==b)this.w="";else{var c;a=qe;b&&(void 0===c&&(c="Panel"),(c=eb(c,this.id))&&(b=c.N[b])&&this.pa(null,a,b))}this.G="";this.J=this.M=null;this.exports={connect:this.zc,receiveData:this.Qb}}A(pe);
|
|
var re=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],se=[!1,0,0,133,142,39,238],qe="buffer";l=pe.prototype;
|
|
l.pa=function(a,b,c,d){var e=this;switch(b){case qe:return this.N[b]=this.j=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),te(e,b);return!0},c.onkeypress=function(a){a=a||window.event;te(e,a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.N[b]=c,d=d.replace(/\\e/g,String.fromCharCode(27)),c.onclick=function(){e.Qb(d);return!0},
|
|
!0}return!1};l.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;var e=this;this.ra=Jc(this.b,function(){e.Qb()});this.ma=Jc(this.b,function(){e.Da|=5});this.I=tb(a,"ChipSet");Pb(b,this,ue,this.ha);Tb(b,this,ve,this.ha);F(this)};
|
|
l.zc=function(){if(!this.J){var a=nc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=na(b[0]);if(c!=this.cb)return;b=na(b[1]);if(this.J=db(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.M=d.receiveData){this.status(this.Bb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};l.Ea=function(a,b){if(!b)if(this.zc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
l.Ia=function(a){return a?this.save():!0};l.reset=function(){we(this)};l.save=function(){var a=new J(this),b=0,c=[];c[b++]=this.L;c[b++]=this.Y;c[b++]=this.ca;c[b++]=this.Da;c[b++]=this.K;c[b++]=this.P;c[b]=this.O;a.set(0,c);return a.data()};l.restore=function(a){return we(this,a[0])};function we(a,b){var c=0;b||(b=se);a.L=b[c++];a.Y=b[c++];a.ca=b[c++];a.Da=b[c++];a.K=b[c++];a.P=b[c++];a.O=b[c];return!0}
|
|
function xe(a,b){var c=a.O&b;b&15||(c>>=4);b=re[c];c=((a.K&12)>>2)+6;a.K&16&&c++;c+=((a.K&192)>>6)+1>>1;return 1E3/Math.round(b/c)}function te(a,b){hb(a,"receiveByte("+ca(b)+"), status="+ca(a.Da));return a.ba||a.Da&2?!1:(a.Y=b,a.Da|=2,Hd(a.b,a.la),!0)}l.Qb=function(a){null!=a&&(this.G="number"!=typeof a?a:this.G+String.fromCharCode(a));this.G&&(te(this,this.G.charCodeAt(0))&&(this.G=this.G.substr(1)),this.G&&this.b&&Kc(this.b,this.ra,xe(this,15)));return!0};
|
|
l.Od=function(a,b){var c=this.Y;E(this,a,null,b,"DATA",c);this.Da&=-3;return c};l.Nd=function(a,b){var c=this.Da;E(this,a,null,b,"STATUS",c);return c};
|
|
l.Zd=function(a,b,c){E(this,a,b,c,"DATA");this.ca=b;this.Da&=-6;hb(this,"transmitByte("+ca(b)+")");if(19==b)this.ba=!0;else if(17==b)this.ba=!1;else if(this.M&&this.M.call(this.J,b),this.j)8==b?(this.j.value=this.j.value.slice(0,-1),0<this.D&&this.D--):(a=(a=oa[b])?"<"+a+">":String.fromCharCode(b),c=a.length,9==b?(b=this.ja||8,c=b-this.D%b,this.ja&&(a=ma("",c))):13==b&&(this.D=c=0,a="\n"),this.ea&&!this.D&&c&&(a=String.fromCharCode(this.ea)+a),this.j.value+=a,this.j.scrollTop=this.j.scrollHeight,
|
|
this.D+=c);else if(null!=this.w){if(10==b||1024<=this.w.length)this.g(this.w),this.w="";10!=b&&(this.w+=String.fromCharCode(b))}this.b&&Kc(this.b,this.ma,xe(this,240))};l.Yd=function(a,b,c){E(this,a,b,c,"CONTROL");this.L?(this.P=b,this.P&64&&(this.L=!1)):(this.K=b,this.L=!0)};l.Xd=function(a,b,c){E(this,a,b,c,"BAUDRATES");this.O=b};var ue={0:pe.prototype.Od,1:pe.prototype.Nd},ve={0:pe.prototype.Zd,1:pe.prototype.Yd,2:pe.prototype.Xd};
|
|
Na(function(){for(var a=D(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new pe(d);fb(d,c)}});function ye(a){z.call(this,"Debugger",a,ye);this.Va=a.base||16;this.ba=this.ma=this.K=0;this.P=!1;this.j=-1;this.w=[];this.ea={}}A(ye);var ze={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};ye.prototype.Mb=function(){return-1};ye.prototype.Nb=function(){};
|
|
ye.prototype.Fb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(na(a.substring(d,f))),d=f+1}}return b};
|
|
function Ae(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
|
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
|
|
function Be(a,b,c){var d;if(b){b=Ce(a,b);for(var e=0,f=!1,g=b,h=[],k=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var p=n[e++],q=p.length,p=na(p);if(!p){f=!0;break}p=De(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}h.push(p);if(e==n.length)break;var p=n[e++],x=p.length;k.length&&ze[p]<ze[k[k.length-1]]&&Ae(h,k,1);k.push(p);b=b.substr(q+x)}Ae(h,k)&&1==h.length||(f=!0);f?c&&a.g("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Ee(a,null,
|
|
d))}return d}function Ce(a,b){for(var c,d=/\{(.*?)\}/;(c=b.match(d))&&!(0<=c[1].indexOf("{"));){var e=Be(a,c[1]);b=b.replace("{"+c[1]+"}",null!=e?Fe(a,e):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.ba-a.ma}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
|
function De(a,b,c,d){var e;null!=b?(e=a.Mb(b),0<=e?e=a.Nb(e):(e=a.ea[b],null==e&&(e=aa(b,a.Va))),null!=e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
|
function Ee(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var k=d&255,n=8,p="";n?32<n&&(n=32):n=32;if(null==k||isNaN(k))for(;0<n--;)p="?"+p;else for(;0<n--;)p=(k&1?"1":"0")+p,k>>=1;g=p+g;d>>=8}d=t(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.g((null!=b?b+": ":"")+d);return e}function Ge(a,b){if(b)return Ee(a,b,a.ea[b]);var c=0;for(b in a.ea)Ee(a,b,a.ea[b]),c++;return 0<c}
|
|
function Fe(a,b){switch(a.Va){case 8:a=ba(b,NaN);break;case 10:a=b.toString();break;default:a=t(b,NaN)}return a}function He(a){ye.call(this,a);this.style=Ie;this.M=Y();this.Ua=Y();this.ca=Y();this.G=[];this.I=this.O=this.D=[];Je(this);this.ja=0;Ke(this);this.wa={};Le(this,a.messages);this.za=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return Cc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return Cc(b,a)})}A(He,ye);
|
|
var Me={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},
|
|
Ie=8080,Ne="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),Oe="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),
|
|
Pe="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),Qe=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,18963,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,18963,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,18963,
|
|
2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617],[44,1617,32],[72],[45,32768],[21,18963,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,
|
|
785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[26],[43,1617,1809],
|
|
[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193,273],[3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66,
|
|
18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193,785],[5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193,
|
|
785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128],[62],[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[13,51],[7,32819],[77,
|
|
18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19,18193,33],[65,128]];l=He.prototype;
|
|
l.Pa=function(a,b,c,d){this.u=b;this.b=c;this.B=a;(a=nc(a,"messages"))&&Le(this,a);this.Fa=Qe;Pd(this,64,function(a){a:{var b=d.u.X,c=a[0],e=a=0,k=b.length;if(c){a=Re(Se(d,c));if(-1===a){d.g("invalid address: "+c);break a}e=a>>>d.u.ia;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;k--;){var p=b[e];p.type==c?n++||d.g("..."):(c=p.type,n=zb[c],p&&d.g(t(p.id)+" %"+t(e<<d.u.ia)+" %%"+t(p.F)+" "+u(p.yb)+" "+
|
|
u(p.size)+" "+n),c!=$b&&(c=-1),n=0);a+=d.u.Ha;e++}}});F(this)};
|
|
l.pa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ha=this.N[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Cc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.j<d.w.length-1&&(b=d.w[++d.j])):40==a.keyCode&&(0<d.j?b=d.w[--d.j]:(b="",d.j=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.N[b]=c,Ea(c,function(){if(d.ha){var a=d.ha.value;
|
|
d.ha.value="";Cc(d,a,!0);return!0}return!1}),!0;case "step":return this.N[b]=c,Ea(c,function(a){var b=!1;kb(d,!0)||(jb(d,!0),b=d.kb(a?1:0),jb(d,!1));return b}),!0}return!1};l.xb=function(){this.ha&&this.ha.focus()};function Re(a){a=a&&a.F;null==a&&(a=-1);return a}l.aa=function(a,b){var c=255,d=Re(a);-1!==d&&(c=Ab(this.u,d),b&&sf(a,b));return c};l.$a=function(a,b){var c=65535,d=Re(a);-1!==d&&(c=Bb(this.u,d),b&&sf(a,b));return c};
|
|
l.va=function(a,b,c){var d=Re(a);-1!==d&&(Db(this.u,d,b),c&&sf(a,c),Dc(this.b,!0))};l.Ib=function(a,b,c){var d=Re(a);if(-1!==d){var e=this.u,f=d&e.u,g=(d&e.w)>>>e.ia;f!=e.u?e.X[g].Tb(f,b&65535,d):(e.X[g++].zb(f,b&255,d),e.X[g&e.G].zb(0,b>>8&255,d+1));c&&sf(a,c);Dc(this.b,!0)}};function Y(a){return{F:a,Oa:!1}}function tf(a){return[a.F,a.Oa]}function uf(a){return{F:a[0],Oa:a[1]}}
|
|
function Se(a,b,c){var d;c=(c?a.M:a.Ua).F;if(void 0!==b){d=b=Ce(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var f=a.G[c].Qa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=Y(d));break}}if(d=e)return d;c=Be(a,b,void 0)}null!=c&&(d=Y(c));return d}function vf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Fd=a.Fb(b.Bc=c[2]))}function sf(a,b){null!=a.F&&(a.F+=b||1)}function Z(a){return t(a,4)}
|
|
function wf(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.aa(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function Le(a,b){a.H=a;a.ta=a.Id=536870912;a.la=null;a.ra=[];b=a.Fb(b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in rb)0<=sa(b,c)&&(a.ta|=rb[c],a.g(c+" messages enabled"))}function Pd(a,b,c){for(var d in rb)if(b==rb[d]){a.wa[d]=c;break}}
|
|
l.Mb=function(a,b){var c;a=a.toUpperCase();null==b?c=sa(Pe,a):(c=sa(Pe,a.substr(b,2)),0>c&&(c=sa(Pe,a.substr(b,1))));return c};function xf(a,b){var c=0;a=a.Nb(b);if(void 0!==a)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?t(a,c):"??"}
|
|
l.Nb=function(a){var b;if(0<=a){var c=this.b;switch(a){case 7:b=c.i;break;case 0:b=c.S;break;case 1:b=c.T;break;case 8:b=Uc(c);break;case 2:b=c.U;break;case 3:b=c.V;break;case 9:b=Wc(c);break;case 4:b=c.W;break;case 5:b=c.Z;break;case 10:b=K(c);break;case 6:b=c.aa(K(c));break;case 11:b=c.oa;break;case 12:b=c.R;break;case 13:b=Tc(c);break;case 14:b=Tc(c)&255|c.i<<8}}return b};
|
|
function yf(a,b){b=Ce(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=a.Mb(b,c+1),0<=e&&(b=b.substr(0,c)+xf(a,e)+b.substr(c+1+Pe[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=aa(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=Se(a,e))?(d=e+' "'+wf(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=Se(a,e))?(sf(d),d=e+
|
|
' "'+wf(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}l.message=function(a,b){b&&(a+=" at "+Z(Y(this.b.R).F));this.ta&1073741824?this.ra.push(a):this.la&&a==this.la||(this.la=a,this.ta&-2147483648&&(this.qa(),a+=" (cpu halted)"),this.g(a),this.b&&(a=this.b,Lc(a),a.P=0,Dc(a)))};
|
|
function gb(a,b,c,d,e,f,g,h){h|=256;null!=f&&(a.ta&h)!=h||a.message(b.cb+"."+(null!=d?"outPort":"inPort")+"("+u(c)+","+(f?f:"unknown")+(null!=d?","+ca(d):"")+")"+(null!=g?": "+ca(g):"")+(null!=e?" at "+Z(e):""))}
|
|
function Ke(a){var b;if(Id(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=Y();a.fa=0;a.g("instruction history buffer allocated")}if(!a.J||!a.J.length)for(a.J=Array(256),b=0;b<a.J.length;b++)a.J[b]=[b,0]}else a.L&&a.L.length&&a.g("instruction history buffer freed"),a.fa=0,a.L=[],a.J=[]}l.bb=function(a){if(!zf(this))return!1;this.b.bb(a);return!0};
|
|
l.kb=function(a,b,c){if(!zf(this))return!1;this.K=0;a||Id(this)&&Jd(this,this.b.R,0);try{var d=this.b.kb(a);0<d&&(this.K+=d,Hc(this.b,d,!0),Ec(this.b,d),this.ba++)}catch(e){"number"!=typeof e&&(this.K=0,ob(this.b,e.stack||e.message))}!1!==c&&Dc(this.b);this.Ja(b||!1);return 0<this.K};l.qa=function(a){this.b&&this.b.qa(a)};l.Ja=function(a){void 0===a&&(a=!0);this.M=Y(this.b.R);a&&1!=this.Y?Af(this):Bf(this)};
|
|
function zf(a){var b;if(b=a.b&&nb(a.b))b=a.b,b.C.xa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!kb(a.b)?(a=a.b,a.C.error?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}l.Ea=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};l.Ia=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};l.reset=function(a){Ke(this);this.ba=this.ma=0;this.la=null;this.K=0;this.M=Y(this.b.R);this.C.Aa=!1;Cf(this);a||this.Ja()};
|
|
l.save=function(){var a=new J(this);a.set(0,tf(this.M));a.set(1,tf(this.ca));a.set(2,[this.w,this.P,this.ta]);a.set(3,this.G);return a.data()};l.restore=function(a){var b=0;void 0!==a[2]&&(this.M=uf(a[b++]),this.ca=uf(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.P=a[b][1],this.ta|=a[b][2]);a[3]&&(this.G=a[3]);return!0};l.start=function(a,b){this.Y||this.g("running");this.C.Aa=!0;this.nb=a;this.ob=b};
|
|
l.stop=function(a,b){if(this.C.Aa){this.C.Aa=!1;this.K=b-this.ob;if(!this.Y){b="stopped";if(this.K){a-=this.nb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";Id(this)&&(b+=this.ba+" opcodes, ",this.ma-=this.ba,this.ba=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else ib(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.g(b)}this.Ja(!0);this.xb();Cf(this,this.b.R)}};function Id(a){return 1<a.I.length||!!a.ja}
|
|
function Jd(a,b,c){var d=a.b;if(0<c&&(a.ja&&!--a.ja||ic(a,b,1,a.I)))return!0;0<=c&&a.J.length&&(a.ba++,b=Ab(a.u,b),null!=b&&(a.J[b][1]++,b=a.L[a.fa],b.F=d.R,b.Oa=!1,++a.fa==a.L.length&&(a.fa=0)));return!1}function Rb(a,b,c){a.g("break on input from port "+u(b)+": "+t(c));a.qa(!0)}function Vb(a,b,c){a.g("break on output to port "+u(b)+": "+t(c));a.qa(!0)}
|
|
function Je(a){var b,c;a.I=["bp"];if(a.O)for(b=1;b<a.O.length;b++){c=a.O[b];var d=a.u;jc(d.X[Re(c)>>>d.ia],!1)}a.O=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.u,jc(d.X[Re(c)>>>d.ia],!0);a.D=["bw"];a.Wa=0}l.Za=function(a,b,c){var d=!0;c||Df(this,a,b,!1,!0);if(a!=this.I){var e=Re(b);if(-1===e)this.g("invalid address: "+Z(b.F)),d=!1;else{var f=this.u;f.X[e>>>f.ia].Za(e&f.u,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(Ef(this,a,a.length-1,"set"),Ke(this)));return d};
|
|
function Df(a,b,c,d,e){var f=!1;c=Re(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==Re(h)&&(!d||h.Oa)){f=!0;h.Oa||e||Ef(a,b,g,"cleared");b.splice(g,1);b!=a.I&&(d=a.u,jc(d.X[c>>>d.ia],b==a.D));h.Oa||Ke(a);break}}return f}function Ff(a,b){for(var c=1;c<b.length;c++)Ef(a,b,c);return b.length-1}function Ef(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.F)+(d?" "+d:c.Bc?' "'+c.Bc+'"':""))}
|
|
function Cf(a,b){if(void 0!==b)ic(a,b,1,a.I,!0),a.Y=0;else for(b=1;b<a.I.length;b++){var c=a.I[b];if(c.Oa){if(!Df(a,a.I,c,!0))break;b=0}}}
|
|
function ic(a,b,c,d,e){var f=!1;if(!a.Wa++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var k=Re(h),n=0;n<c;n++)if(b+n==k){var p,f=!0;h.Oa&&(Df(a,d,h,!0),e=!0);if(p=h.Fd){for(var f=!1,q=0;q<p.length;q++)if(!Gf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var x=q+1;x<p.length&&p[x].indexOf("else");x++)q++;if(x==p.length){f=!0;break}}a.b.C.Aa||(f=!0)}if(f){e||Ef(a,d,g,"hit");break}}}a.Wa--;return f}
|
|
function Hf(a,b,c,d){for(var e=Y(b.F),f=a.aa(b,1),g=a.Fa[f],h="",k=(8086!=a.style?Ne:Oe)[g[0]],n=g.length-1,p=0,q,x=1;x<=n;x++){var v="";q=g[x];if(void 0!==q&&!(q&16384&&a.style==Ie)){var r=q&240;if(r){var y=q&15;y?p=y:q|=p;q&61440||(q|=1==x?8192:4096);if(r&32)a:{v=a;r=q;y=b;switch(r&15){case 1:y=t(v.aa(y,1),2);break;case 2:y=t(v.aa(y,1)<<24>>24,4);break;case 3:y=t(v.$a(y,2),4);break;default:v="imm("+u(r)+")";break a}8086==v.style&&r&64?y="["+y+"]":r&16||(y=(v.style==Ie?"$":"0x")+y);v=y}else r&16?
|
|
(v=(q&3840)>>8,r=Pe[v],8086==a.style&&q&64&&(6==v&&(r="HL"),r="["+r+"]"),v=r):r&128&&(v=(f>>3&7).toString());if(!v||!v.length){h="INVALID";break}0<h.length&&(h+=",");h+=v||"???"}}}f="";g=Z(e.F)+" ";if(-1!==e.F&&-1!==b.F){do if(f+=t(a.aa(e,1),2),null==e.F)break;while(e.F!=b.F)}g+=ma(f,10);g=g+(q&32768?"*":" ")+ma(k,7);h&&(g+=" "+h);c&&(g=ma(g,40)+";"+c,g=a.b.C.fb?g+("cycles="+Fc(a.b).toString()+" cs="+t(a.b.tb)):g+(null!=d?"="+d.toString():""));return g}
|
|
function If(a,b){switch(b){case "IF":a=a.b.ua&512;break;case "SF":a=dd(a.b);break;case "ZF":a=cd(a.b);break;case "AF":a=bd(a.b);break;case "PF":a=ad(a.b);break;case "CF":a=Zc(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}function Jf(a,b){return Pe[b]+"="+xf(a,b)+" "}function Kf(a){return Jf(a,7)+Jf(a,8)+Jf(a,9)+Jf(a,10)+Jf(a,11)+If(a,"IF")+If(a,"SF")+If(a,"ZF")+If(a,"AF")+If(a,"PF")+If(a,"CF")}l.uc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
function Lf(a,b,c){var d=[],e=Re(b)>>>0;for(b=0;b<a.G.length;b++){var f=a.G[b],g=f.F>>>0,h=f.Vd;if(e>=g&&e<g+h){e=pa(f.tc,[e-g],a.uc);0<=e?Mf(a,b,e,d):c&&(e=~e,Mf(a,b,e-1,d),Mf(a,b,e,d));break}}return d}function Mf(a,b,c,d){var e={},f=a.G[b].tc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.G[b].Qa[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}
|
|
function Nf(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c=0;if(a.J)if("clear"==b){for(b=0;b<a.J.length;b++)a.J[b]=[b,0];a.g("frequency data cleared");c++}else if(void 0!==b)a.g("unknown frequency command: "+b),c++;else{var d=a.J.slice();d.sort(function(a,b){return b[1]-a[1]});var e=8086!=a.style?Ne:Oe;for(b=0;b<d.length;b++){var f=d[b][0],g=d[b][1];g&&(a.g((e[a.Fa[f][0]]+" ").substr(0,5)+" ("+ca(f)+"): "+g+" times"),c++)}}c||a.g("no frequency data available")}}
|
|
function Of(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Ge(a)||a.g("no variables"),!0;if(!c[2])return Ge(a,c[1]);if(!c[3])return delete a.ea[c[1]],!0;b=Be(a,c[3]);return void 0!==b?(a.ea[c[1]]=b,!0):!1}a.g("invalid assignment:"+b);return!1}
|
|
function Pf(a,b,c){var d=null;if(b=Se(a,b,!0)){var e=Lf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+u(f)),f=e[0]+" ("+Z(e[1])+")"+g,c&&a.g(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.F)&&(g=" - "+u(f)),f=e[4]+" ("+Z(e[5])+")"+g,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
|
|
function Qf(a,b){switch(b[1]){case "8080":a.style=Ie;break;case "8086":a.style=8086;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.hb=c;break;case "start":a.b.ub=c;break;case "stop":a.b.ib=c;break;default:a.g("unknown cs option");return}void 0!==c&&Bc(a.b);a.g("checksums "+(a.b.C.fb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Gc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.ab.toFixed(2)+"Mhz")+" ("+
|
|
a.b.Ra+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.style+"-style mnemonics enabled")}
|
|
function Af(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.g("missing value for "+b[1]);return}f=Be(a,b);if(void 0===f)return;switch(e.toUpperCase()){case "A":d.i=f&255;break;case "B":d.S=f&255;break;case "BC":d.S=f>>8&255;case "C":d.T=f&255;break;case "D":d.U=f&255;break;
|
|
case "DE":d.U=f>>8&255;case "E":d.V=f&255;break;case "H":d.W=f&255;break;case "HL":d.W=f>>8&255;case "L":d.Z=f&255;break;case "SP":d.oa=f&65535;break;case "PC":I(d,f);a.M=Y(d.R);break;case "PS":Rc(d,f);break;case "PSW":Rc(d,f&255|d.ua&-256);d.i=f>>8;break;case "CF":d.da=f?d.da|256:d.da&255;break;case "PF":f?ad(d)||(d.ga^=1):ad(d)&&(d.ga^=1);break;case "AF":d.ya=f?~d.ga&16|d.ya&-17:d.ga&16|d.ya&-17;break;case "ZF":d.da=f?d.da&-256:d.da|255;break;case "SF":f?dd(d)||(d.ga^=192):dd(d)&&(d.ga^=192);break;
|
|
case "IF":d.ua=f?d.ua|512:d.ua&-513;break;default:a.g("unknown register: "+e);return}Dc(d);a.g("updated registers:")}a.g(Kf(a));c&&(a.M=Y(d.R),Bf(a,Z(a.M.F)))}}function Rf(a,b){b=na(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(yf(a,c[2])):Be(a,b,!0)}function Sf(a,b,c){var d="t"!=b;c=De(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Da(c,function(){return jb(a,!0)&&a.kb(e,d,!1)},function(){Dc(a.b);jb(a,!1)})}
|
|
function Bf(a,b,c,d){if(b=Se(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Se(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=kb(a,!1)||a.Y?a.K:null;var g=null!=f?"cycles":null,h=Lf(a,b),k=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var n=h[0]+":";h[2]&&(n+=" "+h[2]);a.g(n)}h[3]&&(g=h[3],f=null);f=Hf(a,b,g,f);a.g(f);a.M=b;e-=b.F-k;c++}}}
|
|
l.Fb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(na(a.substring(d,f))),d=f+1}}return b};
|
|
function Gf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.P&&(a.g("ended assemble at "+Z(a.ca.F)),a.M=a.ca,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.la=null;if(nb(a)&&0<b.length){a.P&&(b="a "+Z(a.ca.F)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var g=f[0],h=g.charAt(0),k=1;k<g.length;k++){var n=g.charAt(k);if("?"==h||"r"==h||"a">n||"z"<n){f[0]=g.substr(k);f.unshift(g.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=Se(a,f[1],!0);if(p)if(a.ca=
|
|
p,void 0===f[2])a.g("begin assemble at "+Z(p.F)),a.P=!0,Dc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var x=0;x<q.length;x++)a.va(p,q[x],1);a.g(Hf(a,a.ca))}}break;case "b":a:{var v=f[0],r=f[1],y=b;if("?"==r)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),a.g("\tbc [a]\tclear breakpoint at addr [a]"),
|
|
a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var G=v.charAt(1);if("l"==G){var ga;ga=0+Ff(a,a.I);ga+=Ff(a,a.O);(ga+=Ff(a,a.D))||a.g("no breakpoints")}else if("n"==G)a.ja=De(a,r),a.g("break after "+a.ja+" instruction(s)");else if(void 0===r)a.g("missing breakpoint address");else{var C=Y();if("*"!=r&&(C=Se(a,r,!0),!C))break a;r=u(C.F);"c"==G?null==C.F?(Je(a),a.g("all breakpoints cleared")):Df(a,a.I,C)||Df(a,a.O,C)||Df(a,a.D,C)||a.g("breakpoint missing: "+Z(C.F)):
|
|
"i"==G?a.g("breakpoint "+(Fb(a.u,C.F)?"enabled":"cleared")+": port "+r+" (input)"):"o"==G?a.g("breakpoint "+(Sb(a.u,C.F)?"enabled":"cleared")+": port "+r+" (output)"):null!=C.F&&(vf(a,C,y),"p"==G?a.Za(a.I,C):"r"==G?a.Za(a.O,C):"w"==G?a.Za(a.D,C):a.g("unknown breakpoint command: "+G))}}}break;case "c":a.Ga&&(a.Ga.value="");break;case "d":a:{var T,da=f[0],X=f[1],ta=f[2],Cb=f[3];if("?"==X){var lb="";for(T in rb)a.wa[T]&&(lb&&(lb+=","),lb+=T);lb+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");
|
|
a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");lb.length&&a.g("dump extension commands:\n\t"+lb)}else if("state"==X){var Te=Tf(a.B,!0);"console"==ta?console.log(Te):(a.Ga&&(a.Ga.value=""),a.g(Te))}else if("symbols"==X)for(var jd=0;jd<a.G.length;jd++){var kd=a.G[jd],mb;for(mb in kd.Qa)if("."!=mb.charAt(0)){var Ue=kd.Qa[mb].o;if(void 0!==Ue){var Ve=kd.Qa[mb].l;Ve&&(mb=Ve);a.g(Z(Ue)+" "+mb)}}}else{if("d"==
|
|
da){for(T in rb)if(f[1]==T){var We=a.wa[T];We?(f.shift(),f.shift(),We(f)):a.g("no dump registered for "+X);break a}X||(da=a.qb||"db")}else a.qb=da;if("dh"==da){var Xe=X,Ye=ta,Ze="",$e=0,ua=a.fa,Fa=a.L;if(Fa.length){var ia=+Xe||a.eb,Gb=+Ye||10;isNaN(ia)?ia=Gb:Ze="more ";ia>Fa.length&&(a.g("note: only "+Fa.length+" available"),ia=Fa.length);ua-=ia;0>ua&&(null==Fa[Fa.length-1].F?(ia=ua+ia,ua=0):ua+=Fa.length);var ld=[];"call"==Ye&&(Gb=1E5,ld=["CALL"]);for(void 0!==Xe&&a.g(ia+" instructions earlier:");0<
|
|
Gb&&ua!=a.fa;){var af=Fa[ua++];if(null==af.F)break;var Hb=Y(af.F),kg=ia--,bf=Hf(a,Hb,"history",kg);(!ld.length||0<=bf.indexOf(ld[0]))&&a.g(bf);Hb.Lb&&(ua+=Hb.Lb,Gb-=Hb.Lb,ia-=Hb.Lb);ua>=Fa.length&&(ua=0);a.eb=ia;$e++;Gb--}}$e||(a.g("no "+Ze+"history available"),a.eb=void 0)}else{var oc=Se(a,X);if(oc){var pc=0;ta&&("l"==ta.charAt(0)&&(ta=ta.substr(1)||Cb),pc=De(a,ta)>>>0,65536<pc&&(pc=65536));for(var Ib="",qc="dd"==da?4:"dw"==da?2:1,rc=qc*pc||128,lg=rc+15>>4||1;lg--&&0<rc;){var sc=0,md=0,Jb,nd="",
|
|
cf="",X=Z(oc.F);for(Jb=16;0<Jb&&0<rc;Jb--){var tc=a.aa(oc,1),sc=sc|tc<<(md++<<3);md==qc&&(nd+=t(sc,2*qc),nd+=1==qc?9==Jb?"-":" ":" ",sc=md=0);cf+=32<=tc&&128>tc?String.fromCharCode(tc):".";rc--}Ib&&(Ib+="\n");Ib+=X+" "+nd+(Jb?"":" "+cf)}Ib&&a.g(Ib);a.Ua=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,df=255,ef=a.aa,ff=a.va;"ew"==f[0]&&(uc=2,df=65535,ef=a.$a,ff=a.Ib);var gf=uc<<1,hf=f[1];if(null==hf)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");
|
|
else{var vc=Se(a,hf);if(vc)for(var wc=2;wc<f.length;wc++){var Kb=Be(a,f[wc]);if(void 0===Kb){a.g("unrecognized value: "+f[wc]);break}Kb&~df&&a.g("warning: "+t(Kb)+" exceeds "+uc+"-byte value");var mg=ef.call(a,vc);a.g("changing "+Z(vc.F)+" from "+t(mg,gf,!0)+" to "+t(Kb,gf,!0));ff.call(a,vc,Kb,uc)}}break;case "f":Nf(a,f[1]);break;case "g":a:{var jf=f[1],ng=b;if(void 0!==jf){var od=Se(a,jf,!0);if(!od)break a;vf(a,od,ng);a.Za(a.I,od,!0)}a.bb(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;
|
|
case "h":a:{var pd;if(a.C.Aa)pd="halting",a.qa();else{if(kb(a,!0))break a;pd="already halted"}c||a.g(pd)}break;case "i":if("if"==f[0]){var qd;var Lb=b.substr(2),Lb=na(Lb);Be(a,Lb)?(c||a.g("true: "+Lb),qd=!0):(c||a.g("false: "+Lb),qd=!1);qd||(d=!1);break}if("int"==f[0]){var xc;var og=f[1];if(a.b.ua&512){var rd=Be(a,og);null==rd?xc=!1:(a.g("requesting interrupt level "+rd),Hd(a.b,rd),xc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),xc=!1;xc||(d=!1);break}var sd=f[1];if(sd&&"?"!=sd){var td=
|
|
De(a,sd);if(void 0!==td){var pg=Qb(a.u,td);a.g(u(td)+": "+ca(pg))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");break;case "k":var qg=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var ud=0,kf=Y(),Mb=Y(a.b.oa);for(a.g("stack trace for "+Z(Mb.F));10>ud;){for(var Wa=null,rg=256;65536>Mb.F>>>0;){kf.F=a.$a(Mb,2);if(null==Mb.F||!rg--)break;for(var sg=a,yc=kf,lf=
|
|
null,Nb=yc.F,mf=Nb,vd=1;6>=vd&&Nb;vd++){if(2<vd){yc.F=Nb;var zc=Hf(sg,yc);if(0<=zc.indexOf("CALL")){var nf=zc.indexOf(" ");if(Nb+(zc.indexOf(" ",nf+1)-nf-1)/2==mf){lf=zc;break}}}Nb--}yc.F=mf;if(Wa=lf)break}if(!Wa||null==Wa)break;var of=null;if("ks"==qg){var pf=Wa.match(/[0-9A-F]+$/);pf&&(of=Pf(a,pf[0]))}Wa=ma(Wa,50)+" ;"+(of||"stack="+Z(Mb.F));a.g(Wa);ud++}ud||a.g("no return addresses found")}break;case "l":"ln"==f[0]&&Pf(a,f[1],!0);break;case "m":a:{var Ga,Ha=null,N=f[1];"?"==N&&(N=void 0);if(void 0!==
|
|
N){var Ra=0;if("all"==N)Ra=1878917119,N=null;else if("on"==N)Ha=!0,N=null;else if("off"==N)Ha=!1,N=null;else{"keys"==N&&(N="key");"kbd"==N&&(N="keyboard");for(Ga in rb)if(N==Ga){Ra=rb[Ga];Ha=!!(a.ta&Ra);break}if(!Ra){a.g("unknown message category: "+N);break a}}if(Ra)if("on"==f[2])a.ta|=Ra,Ha=!0;else if("off"==f[2]&&(a.ta&=~Ra,Ha=!1,1073741824==Ra)){for(var wd=0;wd<a.ra.length;wd++)a.g(a.ra[wd]);a.ra=[]}}var tg=0,Ob="";for(Ga in rb)if(!N||N==Ga){var ug=!!(a.ta&rb[Ga]);if(null===Ha||Ha==ug)Ob&&(Ob+=
|
|
","),++tg%10||(Ob+="\n\t"),"key"==Ga&&(Ga="keys"),Ob+=Ga}void 0===N&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Ha?Ha?"messages on: ":"messages off: ":"message categories:\n\t")+(Ob||"none"));Ke(a)}break;case "o":var xd=f[1],vg=f[2];if(xd&&"?"!=xd){var yd=De(a,xd,"port #"),zd=De(a,vg);void 0!==yd&&void 0!==zd&&(Ub(a.u,yd,zd),a.g(u(yd)+": "+ca(zd)))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),a.g("warning: port accesses can affect hardware state");
|
|
break;case "p":if("print"==f[0]){Rf(a,b.substr(5));break}var qf="pr"==f[0]?1:0,wg=1+qf;if(a.Y)a.g("step in progress");else{var Ad=Y(a.b.R);switch(a.aa(Ad)){case 205:a.Y=wg,sf(Ad,3)}a.Y?(a.Za(a.I,Ad,!0),a.bb()||(a.B&&a.B.xb(),a.Y=0)):Sf(a,qf?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Af(a,f);break;case "s":Qf(a,f);break;case "t":Sf(a,f[0],f[1]);break;case "u":Bf(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Of(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.30.1 ("+a.b.Wd+",RELEASE"+
|
|
(pb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(wa());break;case "?":if(f[1]){Rf(a,b.substr(1));break}var Bd="commands:",Cd;for(Cd in Me)Bd+="\n"+ma(Cd,9)+Me[Cd];Id(a)||(Bd+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Bd);break;default:a.g("unknown command: "+b),d=!1}}}catch(rf){a.g("debugger error: "+(rf.stack||rf.message)),d=!1}return d}function Cc(a,b,c){b=a.Fb(b,c);for(var d in b)if(!Gf(a,b[+d]))return!1;return!0}
|
|
Na(function(){for(var a=D(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new He(d);fb(d,c)}});
|
|
function Uf(a,b,c){z.call(this,"Computer",a,Uf,67108864);this.C.xa=!1;Vf(this,b);this.O=nc(this,"autoPower",a);this.w=0;this.ea=a.busWidth||a.buswidth;this.B=Wf;this.L=null;this.J=this.ba=!1;this.fa=nc(this,"url")||"";(Math.random()+.1).toString(36);this.j=Xf(this);if(this.b=eb("CPU",this.id)){this.H=eb("Debugger",this.id);this.G=[];for(b=null;b=tb(this,"Video",b);)this.G.push(b);this.u=new vb({id:this.Bb+".bus",busWidth:this.ea},this.b,this.H);var d,e=cb(this.id);if((this.I=eb("Panel",this.id))&&
|
|
this.I.Ga)for(b=0;b<e.length;b++)d=e[b],d.ka=this.I.ka,d.g=this.I.g,d.Ga=this.I.Ga;this.g("PC8080 v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Pa&&d.Pa(this,this.u,this.b,this.H);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.K=d:this.B=parseInt(d,10));var f;if(a=nc(this,"state")||(f=!0,a.state))b=this.P=a,f||(this.J=!0,this.B=Wf),this.B&&(this.M=new J(this,"1.30.1"),Yf(this.M)?
|
|
b=null:delete this.M);!b&&this.B&&(b=Zf(this))&&(this.J=!0);if(b){var g=this;va(b,null,!0,function(a,b,c){c?(g.K=null,g.J=!1,g.ka("Unable to load machine state from server (error "+c+(b?": "+na(b):"")+")")):(g.L=b,g.ba=!0);F(g)})}else F(this);this.N.power||(this.O=!0);!c&&this.O&&$f(this,this.vb)}else w("Unable to find CPU component")}A(Uf);var Wf=0;function Vf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){w(d.message+" ("+c+")")}}a.ca=b}
|
|
function nc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.ca&&(d=a.ca[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function $f(a,b,c){for(var d=cb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!nb(f)){nb(f,function(){$f(a,b,c)});return}}b.call(a,c)}
|
|
function ag(a,b){var c=new J(a,"1.30.1","validate");if(Yf(c)&&bg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ka("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Uf.prototype;
|
|
l.vb=function(a){void 0===a&&(a=this.B||(this.L?1:Wf));if(!this.w){this.w++;var b=!1,c=!1;this.Y=!1;var d=this.M||new J(this,"1.30.1");if(-1==a)b=!0;else if(a>Wf){if(Yf(d,this.L)){this.D=new J(this,"1.30.1","failsafe");Yf(this.D)&&(cg(this,d),a=2,dg(this.D));this.D.set("timestamp",ra());eg(this.D);var e=this.B&&!this.J;if(1==a||xa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=bg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Yf(d,g):("error"==
|
|
f&&"no machine state"!=g?(this.ka("Error: "+g),"unable to verify user"==g&&(Ba("user",""),this.j=null)):this.g(f+": "+g),dg(d),Yf(d)?(c=bg(d),e=!0):c=!1))}e&&ag(this,c?d:null)}else 2==a&&d.clear()}else ag(this);delete this.L;delete this.M}e=cb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=fg(this,g,d,b,c));b=[d,a,c];-1!=a?$f(this,this.wc,b):this.wc(b)}};
|
|
function fg(a,b,c,d,e){if(!b.C.xa){b.C.xa=!0;if(b.Ea){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ea(f,d)&&f&&(w("Unable to restore state for "+b.type),a.P&&!a.ba?(c.clear(),a.B=Wf,window&&window.location.reload()):a.Y=!0,b.Ea(null),e=!1)}if(!d&&b.ec)for(a=b.ec.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
l.wc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ha=!0;this.C.xa=!0;var d=this.N.power;d&&(d.textContent="Shutdown");this.b&&(fg(this,this.b,b,c,a),this.b.rb());this.Y&&(cg(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.w=0};
|
|
function cg(a,b){if(xa("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.j||"";b=b.toString();var d={app:"PC8080",ver:"1.30.1"};d.url=a.fa;d.user=c;d.type="bug";d.data=b;va("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
function Tf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new J(a,"1.30.1"),g=new J(a,"1.30.1","validate"),h=ra();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",wa());a.b&&a.b.Ia&&(c&&a.b.qa(),d=a.b.Ia(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.C.xa=!1,!1===d&&(e=null)));for(var h=cb(a.id),k=0;k<h.length;k++){var n=h[k];n.C.xa&&(n.Ia&&(d=n.Ia(b,c),"object"===typeof d&&f.set(n.id,d)),c&&(n.C.xa=!1,!1===
|
|
d&&(e=null)))}e&&(c?(h=d=!1,b?(a.j&&gg(a,a.j,f.toString()),eg(g)&&eg(f)||(e=null,d=h=!0)):a.B&&(d=!0,h=3==a.B),d&&f.clear(h)):e=f.toString());c&&(a.C.xa=!1,b=a.N.power)&&(b.textContent="Power");a.w=0;return e}l.reset=function(){this.u&&this.u.reset&&(hb(this,"Resetting "+this.u.type),this.u.reset());for(var a=cb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.u&&c.reset&&(hb(this,"Resetting "+c.type),c.reset())}};
|
|
l.start=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};l.stop=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
|
l.pa=function(a,b,c){var d=this;switch(b){case "power":return this.N[b]=c,c.onclick=function(){d.w||(d.C.xa?Tf(d,!1,!0):$f(d,d.vb))},!0;case "reset":return this.N[b]=c,c.onclick=function(){if(d.C.xa&&!d.w)if(d.B&&!d.K){var a=xa("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Tf(d,a,!0);!a&&d.P?window&&window.location.reload():d.vb(Wf)}else d.reset(),d.b&&d.b.rb()},!0;case "save":if(ha())c.parentNode.removeChild(c);else return this.N[b]=
|
|
c,c.onclick=function(){var a=Xf(d,!0);if(a){var b=!!(d.B&&!d.K||d.P),c=Tf(d,b);b?gg(d,a,c):d.ka("Resume disabled, machine state not saved")}},!0}return!1};
|
|
function Xf(a,b){var c=a.j;c||((c=Aa("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=hg(a,c))||a.ka("The user ID is invalid.")):b&&a.ka("Browser local storage is not available"));return c}
|
|
function hg(a,b){a.j=null;b=va(ja()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ba("user",b.data),a.j=b.data)}catch(d){w(d.message+" ("+c+")")}return a.j}function Zf(a){var b=null;a.j&&(b=ja()+"/api/v1/user?req=load&user="+a.j+"&state="+ig(a,"1.30.1"));return b}
|
|
function gg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ig(a,"1.30.1");d.data=c;b=va(ja()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ka("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ka(c),Ba("user",""),a.j=null)}}
|
|
function tb(a,b,c){a=cb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}l.xb=function(a){if(this.G.length){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.G[0];d.la&&d.la.focus();!a&&window&&window.scrollTo(b,c)}};l.Ja=function(a){this.b&&this.b.Ja(a);this.I&&this.I.Ja(a)};
|
|
Na(function(){for(var a=D(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=D(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new Uf(g,d,!0);fb(g,f);g.O&&$f(g,g.vb)}});Ia.show.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=eb("Computer",c.id))&&c.ha&&!c.C.xa&&c.vb(-1)}});
|
|
Ia.exit.push(function(){for(var a=D(document,"pc8080","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=eb("Computer",c.id))&&c.C.xa&&Tf(c,!(!c.B||c.K),!0)}});function J(a,b,c){this.id=a.id;this.key=ig(a,b,c);this.H=a.H;dg(this,a.Ld)}function ig(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
|
J.prototype={constructor:J,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){dg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
|
|
1);c=0}}};function dg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function eg(a){var b=!0;if(za()){var c=JSON.stringify(a[a.id]);Ba(a.key,c)||(w("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function bg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){w(c.message||c),b=!1}return b}function Yf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:za()&&(b=Aa(a.key))?(a[a.id]=b,a.b=!0):!1}var jg=0;
|
|
function xg(a,b,c,d,e,f){e("Loading "+a+"...");va(a,null,!0,function(g,h,k){k?(h||(h="unable to load "+a+" ("+k+")"),f(h,null)):yg(h,a,b,c,d,e,f)})}
|
|
function yg(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(bb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PC8080$2"),
|
|
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?zg(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),
|
|
null)}
|
|
function zg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");va(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],n,p=/( [a-z]+=)(['"])(.*?)\2/g;n=p.exec(f);)k=0>k.indexOf(n[1])?k.replace(">",n[0]+">"):k.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,"");
|
|
a=a.replace(d[0],g);zg(a,b,c)}})}else c(a,null)}
|
|
function Ag(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=la(a))}function f(a){e("Error: "+a);k&&(--jg||Qa(!0));k=!1}var g,h,k=!0;jg++;ab[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=n:q.appendChild(document.createTextNode(n));p.appendChild(q)}c||
|
|
(c="/versions/pc8080/1.30.1/components.xsl");n=function(d,h){h?xg(c,null,null,!1,e,function(d,k){k?(bb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--jg||Qa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--jg||Qa(!0)):f("invalid machine element: "+
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?xg(b,a,d,!0,e,n):yg(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Qa(!1);return Ag(a,b,c,d)};window.enableEvents=Qa;window.sendEvent=Sa;})();
|