97 lines
6.1 KiB
XML
97 lines
6.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<?xml-stylesheet type="text/xsl" href="/modules/shared/templates/outline.xsl"?>
|
|
<outline id="osi-6502-overview">
|
|
<title>C1Pjs</title>
|
|
<excerpt>The following document describes the C1Pjs source code.</excerpt>
|
|
<content>
|
|
<machine id="c1psim" type="c1p" border="1" width="272px" pos="right" padLeft="50px" padRight="50px">
|
|
<computer id="c1p" name="Challenger 1P">
|
|
<module type="cpu" refid="cpu6502" start="0x0000" end="0xffff"/>
|
|
<module type="ram" refid="ram8K" start="0x0000" end="0x1fff"/>
|
|
<module type="rom" refid="romNull" start="0x2000" end="0x9fff"/>
|
|
<module type="rom" refid="romBasic" start="0xa000" end="0xbfff"/>
|
|
<module type="video" refid="video" start="0xd000" end="0xd3ff"/>
|
|
<module type="keyboard" refid="keyboard" start="0xdf00" end="0xdfff"/>
|
|
<module type="serial" refid="serialPort" start="0xf000" end="0xf0ff"/>
|
|
<module type="rom" refid="romSystem" start="0xf800" end="0xffff"/>
|
|
</computer>
|
|
<cpu id="cpu6502"/>
|
|
<ram id="ram8K" size="0x2000"/>
|
|
<rom id="romNull" size="0x8000"/>
|
|
<rom id="romBasic" size="0x2000" image="/devices/c1p/rom/basic-gcpatch.hex"/>
|
|
<rom id="romSystem" size="0x0800" image="/devices/c1p/rom/system.hex"/>
|
|
<video id="video" screenwidth="256" screenheight="200" cols="32" rows="32" charset="/devices/c1p/video/chargen1x.png" padding="8px"/>
|
|
<keyboard id="keyboard">
|
|
<control type="button" binding="ctrl-c">CTRL-C</control>
|
|
<control type="button" binding="break">BREAK</control>
|
|
</keyboard>
|
|
<serial id="serialPort" demo="true"/>
|
|
</machine>
|
|
<p>C1Pjs is a simulation of the <a href="/devices/c1p/">Challenger 1P</a> micro-computer, a 6502-based system built by Ohio Scientific in the late 1970's.
|
|
This simulation is implemented entirely in JavaScript, and it is built from the following files:
|
|
<ul>
|
|
<li><a href="../../shared/lib/component.js">Component</a></li>
|
|
<li><a href="computer.js">Computer</a></li>
|
|
<li><a href="panel.js">Control Panel</a></li>
|
|
<li><a href="cpu.js">CPU</a></li>
|
|
<li><a href="debugger.js">Debugger</a></li>
|
|
<li><a href="disk.js">Disk Controller</a></li>
|
|
<li><a href="keyboard.js">Keyboard</a></li>
|
|
<li><a href="ram.js">RAM</a></li>
|
|
<li><a href="rom.js">ROM</a></li>
|
|
<li><a href="serial.js">Serial Port</a></li>
|
|
<li><a href="video.js">Video Display</a></li>
|
|
<li><a href="embed.js">Embed Support</a></li>
|
|
</ul>
|
|
</p>
|
|
<p>The <a href="../../shared/lib/component.js">Component</a> file defines a generic Component object with some common functionality, and
|
|
each of the other files copy and extend the Component object to define new components that simulate various pieces of computer
|
|
hardware, such as the 6502 CPU, the keyboard, the video display, etc. Each file implements exactly one type of component,
|
|
which are all "compiled" into a single JavaScript file using Google's <a href="https://developers.google.com/closure/compiler/">Closure Compiler</a>.</p>
|
|
<p>Most of the components are optional. You assemble them into a virtual machine by creating a virtual machine definition file, which is
|
|
an XML file that lists the components to be used, along with the HTML elements that will visually represent those components, and all
|
|
the "bindings" that connect the components to the visual elements.</p>
|
|
<p>Here are some working examples:
|
|
<ul>
|
|
<li><a href="/devices/c1p/machine/8kb/large/debugger/">Challenger 1P w/Debugger</a></li>
|
|
<li><a href="/devices/c1p/machine/8kb/array/">Challenger 1P "Server Array" Demo</a></li>
|
|
</ul>
|
|
</p>
|
|
<p>Here's what a machine definition XML file typically looks like:
|
|
<pre>
|
|
<lt/>?xml version="1.0" encoding="UTF-8"?<gt/>
|
|
<lt/>?xml-stylesheet type="text/xsl" href="/versions/c1pjs/1.12.1/machine.xsl"?<gt/>
|
|
<lt/>machine id="c1psim" type="c1p" border="1" width="272px"<gt/>
|
|
<lt/>name<gt/>Challenger 1P Simulation<lt/>/name<gt/>
|
|
<lt/>computer id="c1p" name="Challenger 1P"<gt/>
|
|
<lt/>module type="cpu" refid="cpu6502" start="0x0000" end="0xffff"/<gt/>
|
|
<lt/>module type="ram" refid="ram8K" start="0x0000" end="0x1fff"/<gt/>
|
|
<lt/>module type="rom" refid="romNull" start="0x2000" end="0x9fff"/<gt/>
|
|
<lt/>module type="rom" refid="romBasic" start="0xa000" end="0xbfff"/<gt/>
|
|
<lt/>module type="video" refid="video" start="0xd000" end="0xd3ff"/<gt/>
|
|
<lt/>module type="keyboard" refid="keyboard" start="0xdf00" end="0xdfff"/<gt/>
|
|
<lt/>module type="rom" refid="romSystem" start="0xf800" end="0xffff"/<gt/>
|
|
<lt/>/computer<gt/>
|
|
<lt/>cpu id="cpu6502"/<gt/>
|
|
<lt/>ram id="ram8K" size="0x2000"/<gt/>
|
|
<lt/>rom id="romNull" size="0x8000"/<gt/>
|
|
<lt/>rom id="romBasic" size="0x2000" image="/devices/c1p/rom/basic-gcpatch.hex"/<gt/>
|
|
<lt/>rom id="romSystem" size="0x0800" image="/devices/c1p/rom/system.hex"/<gt/>
|
|
<lt/>video id="video" screenwidth="256" screenheight="192" cols="32" rows="32"
|
|
charset="/devices/c1p/video/chargen1x.png" width="256px" padding="8px"/<gt/>
|
|
<lt/>keyboard id="keyboard"<gt/>
|
|
<lt/>control type="button" binding="ctrl-c"<gt/>CTRL-C<lt/>/control<gt/>
|
|
<lt/>control type="button" binding="ctrl-o"<gt/>CTRL-O<lt/>/control<gt/>
|
|
<lt/>control type="button" binding="break"<gt/>BREAK<lt/>/control<gt/>
|
|
<lt/>/keyboard<gt/>
|
|
<lt/>/machine<gt/>
|
|
</pre>
|
|
</p>
|
|
<p>The order of the components (and any controls they define) determines the order in which the corresponding HTML elements are laid out on the page.
|
|
It has no bearing on the initialization sequence of the JavaScript components, which is determined entirely by the order in which the JavaScript files
|
|
were "compiled" (or by the order the individual JavaScript files are listed on the page).</p>
|
|
<p>NOTE: If you're debugging a simulation using the browser's Developer Tools, then obviously you'll want to load the original, individual JavaScript files,
|
|
but in general, you'll get much better performance -- both load-time and run-time -- by loading a single "compiled" JavaScript file.</p>
|
|
<p class="noindent"><em>Jeff Parsons<br/>August 28, 2012</em></p>
|
|
</content>
|
|
</outline>
|