Fixed Node rendering of PC8080 pages (all one of them)

This commit is contained in:
Jeff Parsons 2016-04-21 09:50:03 -07:00
commit f324b62493
5 changed files with 89 additions and 43 deletions

View file

@ -1,20 +1,32 @@
---
layout: page
title: Space Invaders (Prototype)
title: Space Invaders (Under Construction)
permalink: /devices/pc8080/machine/invaders/
sitemap: false
machines:
- type: pc8080
id: invaders
debugger: true
---
Space Invaders (Prototype)
Space Invaders (Under Construction)
---
This is a work-in-progress, with [Development Notes](#development-notes) below.
This is the first test of [PC8080](/modules/pc8080/), a new 8080-based machine emulator being added to the
PCjs Project. It's a work-in-progress, so there's not much to look at yet.
The idea is to make [PC8080](/modules/pc8080/) sufficiently configurable so that it will work with a variety of
8080-based systems, including those with memory-mapped video displays (like Space Invaders), as well as simpler
terminal-based systems, like the CP/M-based systems of old.
In fact, as soon as Space Invaders is working, my next adaptation will be a DEC VT-100 terminal emulator, which is
itself is an 8080-based machine.
Assorted [Space Invaders Hardware Notes](#space-invaders-hardware-notes) are collected below.
{% include machine.html id="invaders" %}
Development Notes
Space Invaders Hardware Notes
---
From [emutalk.net](http://www.emutalk.net/threads/38177-Space-Invaders):

View file

@ -11,7 +11,7 @@
<ram id="ram" addr="0x2000" size="0x2000"/>
<video id="video" screenWidth="224" screenHeight="256" aspect="1.33" rotate="90" addr="0x2400" width="40%" pos="left" padding="8px">
<menu>
<title>224x256 Screen</title>
<title>224x256 Screen (Rotated)</title>
</menu>
</video>
<panel ref="/devices/pc8080/panel/default.xml"/>

View file

@ -1881,57 +1881,55 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done)
asFiles.push("/versions/" + sScriptFolder + "/" + sVersion + "/" + sScriptFile);
this.addFilesToHTML(asFiles, sScriptEmbed);
}
else {
else if (asFiles = aMachineFiles[sClass]) {
/*
* SIDEBAR: Why the "slice()"? It's a handy way to create a copy of the array, and we need a copy,
* because if it turns out we need to "cut out" some of the files below (using splice), we don't want that
* affecting the original array.
*/
if ((asFiles = aMachineFiles[sClass].slice())) {
var i;
asFiles = asFiles.slice();
/*
* We need to find the shared "defines.js" source file, because we may need to follow it
* with "nodebug.js" and/or "private.js".
*/
for (var i = 0; i < asFiles.length; i++) {
if (asFiles[i].indexOf("shared/lib/defines.js") >= 0) {
if (fPrivate) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "private.js"));
}
if (fNoDebug) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebug.js"));
}
break;
}
}
if (!fDebugger) {
/*
* We need to find the shared "defines.js" source file, because we may need to follow it
* with "nodebug.js" and/or "private.js".
* Step 1: We need to find the client's "defines.js" source file, and follow it with "nodebugger.js".
*/
for (i = 0; i < asFiles.length; i++) {
if (asFiles[i].indexOf("shared/lib/defines.js") >= 0) {
if (fPrivate) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "private.js"));
}
if (fNoDebug) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebug.js"));
}
if (asFiles[i].indexOf("js/lib/defines.js") >= 0) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebugger.js"));
break;
}
}
if (!fDebugger) {
/*
* Step 1: We need to find the client's "defines.js" source file, and follow it with "nodebugger.js".
*/
for (i = 0; i < asFiles.length; i++) {
if (asFiles[i].indexOf("js/lib/defines.js") >= 0) {
asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebugger.js"));
break;
}
}
/*
* Step 2: If there's a "debugger.js" source file in the list of uncompiled files, we need to remove
* it, which we do by using the Array splice() method, removing the 1 matching element from the array.
*/
for (i = 0; i < asFiles.length; i++) {
if (asFiles[i].indexOf("/debugger.js") >= 0) {
asFiles.splice(i, 1);
break;
}
/*
* Step 2: If there's a "debugger.js" source file in the list of uncompiled files, we need to remove
* it, which we do by using the Array splice() method, removing the 1 matching element from the array.
*/
for (i = 0; i < asFiles.length; i++) {
if (asFiles[i].indexOf("/debugger.js") >= 0) {
asFiles.splice(i, 1);
break;
}
}
}
this.addFilesToHTML(asFiles, sScriptEmbed);
if (buildOptions.id) {
asFiles = [];
asFiles.push("/modules/build/lib/build.js");
sScriptEmbed = '<script type="text/javascript">buildPC("' + buildOptions.id + '")</script>';
this.addFilesToHTML(asFiles, sScriptEmbed);
if (buildOptions.id) {
asFiles = [];
asFiles.push("/modules/build/lib/build.js");
sScriptEmbed = '<script type="text/javascript">buildPC("' + buildOptions.id + '")</script>';
this.addFilesToHTML(asFiles, sScriptEmbed);
}
}
}
}

View file

@ -1157,7 +1157,8 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
sMachineVersion = ((machine['uncompiled'] == "true")? "uncompiled" : "");
sMachineParms = machine['parms'] || "";
sReplacement = machine['name'] || "Embedded PC";
sReplacement = "[" + sReplacement + "](" + sMachineXMLFile + ' "' + sMachine + 'js!' + sMachineID + '!' + sMachineXSLFile + '!!' + sMachineOptions + '!' + sMachineParms + '")';
if (sMachine == "pc" || sMachine == "c1p") sMachine += "js";
sReplacement = "[" + sReplacement + "](" + sMachineXMLFile + ' "' + sMachine + '!' + sMachineID + '!' + sMachineXSLFile + '!!' + sMachineOptions + '!' + sMachineParms + '")';
}
sBlock = sBlock.replace(aMatch[0], sReplacement);
reIncludes.lastIndex = 0; // reset lastIndex, since we just modified the string that reIncludes is iterating over

35
modules/pc8080/README.md Normal file
View file

@ -0,0 +1,35 @@
---
layout: page
title: 8080 Machine Emulation Module (PC8080)
permalink: /modules/pc8080/
---
8080 Machine Emulation Module (PC8080)
===
Overview
---
PC8080 is an 8080-based Machine Emulation Module. The code is derived from [PCjs](/modules/pcjs/),
the IBM PC Emulation Module.
It is still a work-in-progress, so it likely contains code that will be removed from the finished version.
PC8080 is currently comprised of the following non-shared components, as listed in [package.json](../../package.json)
(see the *pc8080Files* property):
* [defines.js](/modules/pc8080/lib/defines.js)
* [cpudef.js](/modules/pc8080/lib/cpudef.js)
* [messages.js](/modules/pc8080/lib/messages.js)
* [panel.js](/modules/pc8080/lib/panel.js)
* [bus.js](/modules/pc8080/lib/bus.js)
* [memory.js](/modules/pc8080/lib/memory.js)
* [cpu.js](/modules/pc8080/lib/cpu.js)
* [cpusim.js](/modules/pc8080/lib/cpusim.js)
* [cpuops.js](/modules/pc8080/lib/cpuops.js)
* [rom.js](/modules/pc8080/lib/rom.js)
* [ram.js](/modules/pc8080/lib/ram.js)
* [keyboard.js](/modules/pc8080/lib/keyboard.js)
* [video.js](/modules/pc8080/lib/video.js)
* [debugger.js](/modules/pc8080/lib/debugger.js)
* [state.js](/modules/pc8080/lib/state.js)
* [computer.js](/modules/pc8080/lib/computer.js)