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

@ -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)