Autopower support in place
This commit is contained in:
parent
3b4cc494c8
commit
f2bfecd83f
5 changed files with 41 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
{% comment %}
|
{% comment %}
|
||||||
As documented in /modules/markout/lib/markout.js, the following machine properties are recognized in Front Matter:
|
As documented in /modules/markout/lib/markout.js, our Node web server recognizes the following machine properties
|
||||||
|
in the Front Matter of Markdown files, for compatibility with the Jekyll web server:
|
||||||
|
|
||||||
'id' (eg, "ibm5150")
|
'id' (eg, "ibm5150")
|
||||||
'name' (eg, "IBM PC (Model 5150) with Monochrome Display")
|
'name' (eg, "IBM PC (Model 5150) with Monochrome Display")
|
||||||
|
|
@ -9,25 +10,24 @@ As documented in /modules/markout/lib/markout.js, the following machine properti
|
||||||
'uncompiled' (eg, true)
|
'uncompiled' (eg, true)
|
||||||
'parms'
|
'parms'
|
||||||
|
|
||||||
and the following properties (along with any property not listed above) will be added to the 'parms' property:
|
And the following properties (along with any property not listed above) will be added to the 'parms' property:
|
||||||
|
|
||||||
'autopower' (eg, "true")
|
'autopower' (eg, "true")
|
||||||
'automount' (eg, {"A":{"name":"OS/2 FOOTBALL Boot Disk (v7.68.17)","path":"/disks/pc/os2/misc/football/debugger/FOOTBALL-7.68.17.json"}})
|
'automount' (eg, {"A":{"name":"OS/2 FOOTBALL Boot Disk (v7.68.17)","path":"/disks/pc/os2/misc/football/debugger/FOOTBALL-7.68.17.json"}})
|
||||||
'state' (eg, "state.json")
|
'state' (eg, "state.json")
|
||||||
'messages' (eg, "disk")
|
'messages' (eg, "disk")
|
||||||
|
|
||||||
Of all the above properties, the following are purely cosmetic:
|
And all our JavaScript components expect multi-word property names to use camelCase, so that conversion happens both
|
||||||
|
here and in markout.js. Examples include 'autopower' ('autoPower') and 'automount' ('autoMount').
|
||||||
'name' (used by machine.html, not machine-engines.html)
|
|
||||||
|
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% for machine in page.machines %}
|
{% for machine in page.machines %}
|
||||||
{% capture machine_embed %}window.embed{{ machine.type | remove:'-dbg' | upcase }}{% endcapture %}
|
{% capture machine_embed %}window.embed{{ machine.type | remove:'-dbg' | upcase }}{% endcapture %}
|
||||||
{% unless machine.autopower %}
|
{% if machine.autopower == nil %}
|
||||||
{% assign machine_autopower = "true" %}
|
{% assign machine_autopower = "true" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% capture machine_autopower %}{{ machine.autopower }}{% endcapture %}
|
{% capture machine_autopower %}{{ machine.autopower }}{% endcapture %}
|
||||||
{% endunless %}
|
{% endif %}
|
||||||
{% unless machine.config %}
|
{% unless machine.config %}
|
||||||
{% assign machine_config = "machine.xml" %}
|
{% assign machine_config = "machine.xml" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ permalink: /devices/pc/machine/custom/
|
||||||
machines:
|
machines:
|
||||||
- type: pc
|
- type: pc
|
||||||
id: custom
|
id: custom
|
||||||
autopower: true
|
autopower: false
|
||||||
config: /devices/pc/machine/5150/mda/64kb/machine.xml
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Build Your Own PC
|
Build Your Own PC
|
||||||
|
|
|
||||||
18
devices/pc/machine/custom/machine.xml
Normal file
18
devices/pc/machine/custom/machine.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?xml-stylesheet type="text/xsl" href="/versions/pcjs/1.20.9/machine.xsl"?>
|
||||||
|
<machine id="ibm5150" class="pc" border="1" pos="center" background="#FAEBD7">
|
||||||
|
<name pos="center">IBM PC (Model 5150) with Monochrome Display</name>
|
||||||
|
<computer id="pc-mda-64k" name="IBM PC"/>
|
||||||
|
<ram id="ramLow" addr="0x00000"/>
|
||||||
|
<rom id="romBASIC" addr="0xf6000" size="0x8000" file="/devices/pc/rom/5150/basic/BASIC100.json"/>
|
||||||
|
<rom id="romBIOS" addr="0xfe000" size="0x2000" file="/devices/pc/rom/5150/bios/1981-04-24/PCBIOS-REV1.json"/>
|
||||||
|
<video ref="/devices/pc/video/ibm/mda/ibm-mda.xml"/>
|
||||||
|
<cpu id="cpu8088" model="8088" autostart="true" padleft="8px">
|
||||||
|
<control type="button" binding="power">Power</control>
|
||||||
|
<control type="button" binding="run">Run</control>
|
||||||
|
<control type="button" binding="reset">Reset</control>
|
||||||
|
</cpu>
|
||||||
|
<keyboard ref="/devices/pc/keyboard/keyboard-minimal.xml"/>
|
||||||
|
<fdc ref="/disks/pc/samples.xml" pos="right"/>
|
||||||
|
<chipset id="chipset" model="5150" sw1="01000001" sw2="11110000"/>
|
||||||
|
</machine>
|
||||||
|
|
@ -309,9 +309,9 @@ MarkOut.aHTMLEntities = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a list of "reserved" Front Matter machine properties (ie, properties that will NOT be
|
* This is a list of "reserved" Front Matter machine properties (ie, properties that will NOT be bundled as
|
||||||
* bundled as strings in the 'parms' property). Any machine property not in this list will be added
|
* strings in the 'parms' property). Any machine property not in this list will be added to the 'parms' object
|
||||||
* to the 'parms' object as a string property.
|
* as a string property.
|
||||||
*
|
*
|
||||||
* 'id' (eg, "ibm5150")
|
* 'id' (eg, "ibm5150")
|
||||||
* 'name' (eg, "IBM PC (Model 5150) with Monochrome Display")
|
* 'name' (eg, "IBM PC (Model 5150) with Monochrome Display")
|
||||||
|
|
@ -329,6 +329,16 @@ MarkOut.aHTMLEntities = {
|
||||||
* 'autopower' (eg, true)
|
* 'autopower' (eg, true)
|
||||||
*
|
*
|
||||||
* and any other string-based property you wish to pass through to PCjs (via the embedPC() sParms parameter).
|
* and any other string-based property you wish to pass through to PCjs (via the embedPC() sParms parameter).
|
||||||
|
*
|
||||||
|
* As for any other NON-string-based property you might want to pass through sParms, like 'autopower', add it to the
|
||||||
|
* aFMBooleanMachineProps table, and it will be unquoted (ie, true or false rather than "true" or "false"); also note
|
||||||
|
* that even though the only non-reserved, non-string properties we currently use are booleans, that table is not
|
||||||
|
* really limited to booleans (eg, they could just as well be numeric properties).
|
||||||
|
*
|
||||||
|
* The other purpose that aFMBooleanMachineProps serves is to remap any lower-case Front Matter keywords to their
|
||||||
|
* camelCase equivalents; although in hindsight it was probably a stupid decision, all our machine definition properties
|
||||||
|
* (whether as attributes in a XML file or as Front Matter keywords at the top of a Markdown file) are purely lower-case,
|
||||||
|
* which are then converted to camelCase prior to calling the JavaScript components.
|
||||||
*/
|
*/
|
||||||
MarkOut.aFMBooleanMachineProps = {
|
MarkOut.aFMBooleanMachineProps = {
|
||||||
'autopower': "autoPower"
|
'autopower': "autoPower"
|
||||||
|
|
|
||||||
|
|
@ -713,7 +713,7 @@ Computer.prototype.donePowerOn = function(aParms)
|
||||||
|
|
||||||
this.aFlags.fPowered = true;
|
this.aFlags.fPowered = true;
|
||||||
var controlPower = this.bindings["power"];
|
var controlPower = this.bindings["power"];
|
||||||
if (controlPower) controlPower.textContent = "On";
|
if (controlPower) controlPower.textContent = "Shutdown";
|
||||||
|
|
||||||
if (!this.fInitialized) {
|
if (!this.fInitialized) {
|
||||||
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
||||||
|
|
@ -923,7 +923,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
||||||
if (fShutdown) {
|
if (fShutdown) {
|
||||||
this.aFlags.fPowered = false;
|
this.aFlags.fPowered = false;
|
||||||
var controlPower = this.bindings["power"];
|
var controlPower = this.bindings["power"];
|
||||||
if (controlPower) controlPower.textContent = "Off";
|
if (controlPower) controlPower.textContent = "Power";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nPowerChange = 0;
|
this.nPowerChange = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue