From 31d1b5c7e55fb2608b07f72afbe80fcc19075ea6 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Wed, 20 Apr 2016 19:21:12 -0700 Subject: [PATCH] Fixed Jekyll rendering of pages with PC8080 machines --- _config.yml | 27 +++++ _includes/machine-engines.html | 13 +- _includes/machine-styles.html | 9 +- devices/pc8080/machine/invaders/README.md | 137 ++++++++++++++++++++++ modules/README.md | 1 + modules/pc8080/lib/debugger.js | 4 +- versions/pcjs/1.21.7/components.css | 4 +- versions/pcjs/1.21.7/components.xsl | 6 +- 8 files changed, 190 insertions(+), 11 deletions(-) create mode 100644 devices/pc8080/machine/invaders/README.md diff --git a/_config.yml b/_config.yml index 6478df75a..0166c35a9 100644 --- a/_config.yml +++ b/_config.yml @@ -98,3 +98,30 @@ pcjs: - /modules/c1pjs/lib/debugger.js - /modules/c1pjs/lib/computer.js - /modules/shared/lib/embed.js + pc8080_scripts: + - /modules/shared/lib/defines.js + - /modules/shared/lib/dumpapi.js + - /modules/shared/lib/reportapi.js + - /modules/shared/lib/userapi.js + - /modules/shared/lib/strlib.js + - /modules/shared/lib/usrlib.js + - /modules/shared/lib/weblib.js + - /modules/shared/lib/component.js + - /modules/pc8080/lib/defines.js + - /modules/pc8080/lib/cpudef.js + - /modules/pc8080/lib/messages.js + - /modules/pc8080/lib/panel.js + - /modules/pc8080/lib/bus.js + - /modules/pc8080/lib/memory.js + - /modules/pc8080/lib/cpu.js + - /modules/pc8080/lib/cpusim.js + - /modules/pc8080/lib/cpuops.js + - /modules/pc8080/lib/rom.js + - /modules/pc8080/lib/ram.js + - /modules/pc8080/lib/keyboard.js + - /modules/pc8080/lib/video.js + - /modules/pc8080/lib/debugger.js + - /modules/pc8080/lib/state.js + - /modules/pc8080/lib/computer.js + - /modules/shared/lib/embed.js + - /modules/shared/lib/save.js diff --git a/_includes/machine-engines.html b/_includes/machine-engines.html index 4f570bbc5..c148b21c7 100644 --- a/_includes/machine-engines.html +++ b/_includes/machine-engines.html @@ -5,7 +5,7 @@ in the Front Matter of our Markdown documents, for compatibility with the Jekyll 'id' (eg, "ibm5150") 'name' (eg, "IBM PC (Model 5150) with Monochrome Display") - 'type' ("pc" or "c1p") + 'type' (eg. "pc", "c1p", etc) 'debugger' (default is false) 'config' (default is "machine.xml") 'template' (default is "machine.xsl") @@ -97,8 +97,9 @@ of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'a {% capture machine_template %}{{ site.baseurl }}/versions/{{ machine_type }}js/{{ site.pcjs.version }}/components.xsl{% endcapture %} {% endif %} {% else %} - {% if machine_type == "pc" %}{% assign array_scripts = site.pcjs.pc_scripts %}{% endif %} {% if machine_type == "c1p" %}{% assign array_scripts = site.pcjs.c1p_scripts %}{% endif %} + {% if machine_type == "pc" %}{% assign array_scripts = site.pcjs.pc_scripts %}{% endif %} + {% if machine_type == "pc8080" %}{% assign array_scripts = site.pcjs.pc8080_scripts %}{% endif %} {% for script in array_scripts %} {% if script != "/modules/shared/lib/nodebug.js" or machine.debug != true %} {% capture machine_script %}{% endcapture %} @@ -118,8 +119,12 @@ of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'a {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} {% endif %} {% endfor %} - {% if machine_template == "" %} - {% capture machine_template %}{{ site.baseurl }}/modules/{{ machine_type }}js/templates/components.xsl{% endcapture %} + {% if machine_template == "" %} + {% if machine_type != "c1p" %} + {% capture machine_template %}{{ site.baseurl }}/modules/shared/templates/components.xsl{% endcapture %} + {% else %} + {% capture machine_template %}{{ site.baseurl }}/modules/{{ machine_type }}js/templates/components.xsl{% endcapture %} + {% endif %} {% endif %} {% endif %} diff --git a/_includes/machine-styles.html b/_includes/machine-styles.html index c20ee94de..9a2403b78 100644 --- a/_includes/machine-styles.html +++ b/_includes/machine-styles.html @@ -1,8 +1,13 @@ {% for machine in page.machines %} + {% capture machine_type %}{{ machine.type | remove:"-dbg" }}{% endcapture %} {% unless site.pcjs.compiled == true and machine.uncompiled != true %} - {% capture machine_style %}{{ site.baseurl }}/modules/{{ machine.type | remove:'-dbg' }}js/templates/components.css{% endcapture %} + {% if machine_type != "c1p" %} + {% capture machine_style %}{{ site.baseurl }}/modules/shared/templates/components.css{% endcapture %} + {% else %} + {% capture machine_style %}{{ site.baseurl }}/modules/{{ machine_type }}js/templates/components.css{% endcapture %} + {% endif %} {% else %} - {% capture machine_style %}{{ site.baseurl }}/versions/{{ machine.type | remove:'-dbg' }}js/{{ site.pcjs.version }}/components.css{% endcapture %} + {% capture machine_style %}{{ site.baseurl }}/versions/{{ machine_type }}js/{{ site.pcjs.version }}/components.css{% endcapture %} {% endunless %} {% unless machine_styles contains machine_style %} diff --git a/devices/pc8080/machine/invaders/README.md b/devices/pc8080/machine/invaders/README.md new file mode 100644 index 000000000..4b949ad4d --- /dev/null +++ b/devices/pc8080/machine/invaders/README.md @@ -0,0 +1,137 @@ +--- +layout: page +title: Space Invaders (Prototype) +permalink: /devices/pc8080/machine/invaders/ +machines: + - type: pc8080 + id: invaders +--- + +Space Invaders (Prototype) +--- + +This is a work-in-progress, with [Development Notes](#development-notes) below. + +{% include machine.html id="invaders" %} + +Development Notes +--- + +From [emutalk.net](http://www.emutalk.net/threads/38177-Space-Invaders): + + Space Invaders, (C) Taito 1978, Midway 1979 + + CPU: Intel 8080 @ 2MHz (CPU similar to the (newer) Zilog Z80) + + Interrupts: $cf (RST 8) at the start of vblank, $d7 (RST $10) at the end of vblank. + + Video: 256(x)*224(y) @ 60Hz, vertical monitor. Colours are simulated with a + plastic transparent overlay and a background picture. + Video hardware is very simple: 7168 bytes 1bpp bitmap (32 bytes per scanline). + + Sound: SN76477 and samples. + + Memory map: + ROM + $0000-$07ff: invaders.h + $0800-$0fff: invaders.g + $1000-$17ff: invaders.f + $1800-$1fff: invaders.e + + RAM + $2000-$23ff: work RAM + $2400-$3fff: video RAM + + $4000-: RAM mirror + + Ports: + Read 1 + BIT 0 coin (0 when active) + 1 P2 start button + 2 P1 start button + 3 ? + 4 P1 shoot button + 5 P1 joystick left + 6 P1 joystick right + 7 ? + + Read 2 + BIT 0,1 dipswitch number of lives (0:3,1:4,2:5,3:6) + 2 tilt 'button' + 3 dipswitch bonus life at 1:1000,0:1500 + 4 P2 shoot button + 5 P2 joystick left + 6 P2 joystick right + 7 dipswitch coin info 1:off,0:on + + Read 3 shift register result + + Write 2 shift register result offset (bits 0,1,2) + Write 3 sound related + Write 4 fill shift register + Write 5 sound related + Write 6 strange 'debug' port? eg. it writes to this port when + it writes text to the screen (0=a,1=b,2=c, etc) + + (write ports 3,5,6 can be left unemulated, read port 1=$01 and 2=$00 + will make the game run, but but only in attract mode) + + I haven't looked into sound details. + + 16 bit shift register: + f 0 bit + xxxxxxxxyyyyyyyy + + Writing to port 4 shifts x into y, and the new value into x, eg. + $0000, + write $aa -> $aa00, + write $ff -> $ffaa, + write $12 -> $12ff, .. + + Writing to port 2 (bits 0,1,2) sets the offset for the 8 bit result, eg. + offset 0: + rrrrrrrr result=xxxxxxxx + xxxxxxxxyyyyyyyy + + offset 2: + rrrrrrrr result=xxxxxxyy + xxxxxxxxyyyyyyyy + + offset 7: + rrrrrrrr result=xyyyyyyy + xxxxxxxxyyyyyyyy + + Reading from port 3 returns said result. + + Overlay dimensions (screen rotated 90 degrees anti-clockwise): + ,_______________________________. + |WHITE ^ | + | 32 | + | v | + |-------------------------------| + |RED ^ | + | 32 | + | v | + |-------------------------------| + |WHITE | + | < 224 > | + | | + | ^ | + | 120 | + | v | + | | + | | + | | + |-------------------------------| + |GREEN | + | ^ ^ | + |56 ^ 56 | + | v 72 v | + |____ v ______________| + | ^ | | ^ | + |<16> | < 118 > |16 < 122 > | + | v | | v | + |WHITE| | WHITE| + `-------------------------------' + + Way of out of proportion :P diff --git a/modules/README.md b/modules/README.md index 400d10de8..b33b77845 100644 --- a/modules/README.md +++ b/modules/README.md @@ -14,6 +14,7 @@ The project includes these emulation modules: * C1Pjs, the 6502-based C1P Emulation Module * [PCjs](pcjs/), the x86-based IBM PC Emulation Module +* PC8080, an 8080 CPU Emulation Module (work-in-progress) along with variety of Node support modules, such as: diff --git a/modules/pc8080/lib/debugger.js b/modules/pc8080/lib/debugger.js index 16b05d44c..ccbe8d293 100644 --- a/modules/pc8080/lib/debugger.js +++ b/modules/pc8080/lib/debugger.js @@ -2473,11 +2473,11 @@ if (DEBUGGER) { } sLine += str.pad(sBytes, 11); - sLine += str.pad(sOpcode, 8); + sLine += str.pad(sOpcode, 7); if (sOperands) sLine += ' ' + sOperands; if (sComment) { - sLine = str.pad(sLine, 56) + ';' + sComment; + sLine = str.pad(sLine, 40) + ';' + sComment; if (!this.cpu.flags.fChecksum) { sLine += (nSequence != null? '=' + nSequence.toString() : ""); } else { diff --git a/versions/pcjs/1.21.7/components.css b/versions/pcjs/1.21.7/components.css index 3fa6fff6e..03664918e 100644 --- a/versions/pcjs/1.21.7/components.css +++ b/versions/pcjs/1.21.7/components.css @@ -106,13 +106,13 @@ line-height: 19px; background-color: #000000; } -.pcjs-video-object { +.pcjs-screen { clear: both; height: auto; position: relative; line-height: 0; } -.pcjs-video-object textarea { +.pcjs-screen textarea { position: absolute; left: 0; top: 0; diff --git a/versions/pcjs/1.21.7/components.xsl b/versions/pcjs/1.21.7/components.xsl index 9fd3dc2e9..89aa05628 100644 --- a/versions/pcjs/1.21.7/components.xsl +++ b/versions/pcjs/1.21.7/components.xsl @@ -162,6 +162,7 @@ width:; + width:;max-width:; width:auto;max-width:; @@ -217,8 +218,11 @@ + + --object -screen + -
+