<?xml version='1.0'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
               "http://www.oasis-open.org/docbook/xml/4.2CR1/docbookx.dtd">
<book><title>The EDUC-8 Microcomputer</title>
<bookinfo>
<author><firstname>Lawrence</firstname><surname>Wilkinson</surname>
<authorblurb>
<para><ulink url="http://www.ljw.me.uk">http://www.ljw.me.uk</ulink></para>
<para><address><email>lawrence@ljw.me.uk</email></address></para>
</authorblurb>
</author>
<revhistory>
<revision><revnumber>1.0</revnumber><date>28-Sep-2003</date><authorinitials>LJW</authorinitials><revremark>Initial version</revremark></revision>
</revhistory>
</bookinfo>
<chapter><title>Introduction</title>
<figure><title>The EDUC-8</title>
<graphic fileref="h90004.jpg" format="JPG"/>
</figure>
<note><para>Image from <ulink url="http://www.acms.org.au">ACMS</ulink></para></note>
<para>The <acronym>EDUC-8</acronym> is a <abbrev>TTL</abbrev>-based 8-bit microcomputer.  It was designed by Jim Rowe and construction details were published in Electronics Australia magazine between August 1974 and January 1975.  Additional peripherals were described in further articles up to August 1975.</para>
<para>The internal implementation is bit-serial which gives good economy of components as most data paths are only 1 bit wide.  It does mean that processing is rather slow, as 24 clock cycles are required to perform one major cycle, and 2 or 3 major cycles are required per instruction.</para>
<para>Technically it might not be a microcomputer as it is not based on a microprocessor, but it seems to be stretching things a bit to call it a minicomputer and in any event the original articles referred to it as a 'micro-computer'.</para>
<para>My page for the EDUC-8 is at <ulink url="http://www.ljw.me.uk/educ8">http://www.ljw.me.uk/educ8</ulink></para>
<table><title>Specifications</title>
<tgroup cols="2">
<tbody>
<row><entry>Dimensions (mm)</entry><entry>293Wx103Hx357D</entry></row>
<row><entry>Dimensions (in)</entry><entry>12Wx4Hx14D</entry></row>
<row><entry>Memory</entry><entry>256 bytes</entry></row>
<row><entry>Clock frequency</entry><entry>500kHz</entry></row>
<row><entry>Cycle rate</entry><entry>Approx 20kHz</entry></row>
<row><entry>Instruction rate</entry><entry>Approx 10k<abbrev>IPS</abbrev></entry></row>
</tbody>
</tgroup>
</table>

</chapter>

<chapter><title>Basic architecture</title>

<para>The <abbrev>EDUC-8</abbrev> is based on the <acronym>DEC</acronym> <abbrev>PDP</abbrev>-8 (which was a 12-bit machine).  It has a similar instruction set and <link 
linkend="instructionformat">op-code layout</link>, but because of the shorter instruction words there are fewer instruction variants and more limited addressing.  In particular there is no link/carry flag.</para>
<sect1><title>Registers</title>
<sect2 id="AC"><title>Accumulator (AC)</title>
<para>The AC register is used to hold values for computation, loading and storing.  It is the only register which the programmer can explicitly control.</para>
</sect2>
<sect2 id="PC"><title>Program Counter (PC)</title>
<para>The PC register holds the address of the next instruction to be executed.</para>
</sect2>
<sect2 id="MB"><title>Memory Buffer (MB)</title>
<para>The MB register is used to hold values which are being stored into memory, or have just been read from memory, including instructions.</para>
</sect2>
<sect2 id="MA"><title>Memory Address (MA)</title>
<para>The MA register is used to hold the memory address which is being used to reference memory, including instruction addresses.</para>
</sect2>
<sect2><title>Instruction Execution</title>
<para>A standard instruction requires two cycles to execute.</para>
<orderedlist>
<listitem><para>Fetch, during which the instruction is fetched and decoded</para></listitem>
<listitem><para>Execute, during which the instruction is processed</para></listitem>
</orderedlist>
<para>There is an addition cycle type, Defer, which appears between Fetch and Execute if <link linkend="indirect">indirect addressing</link> is used.
</para>
</sect2>
<sect2><title>Memory Addressing</title>
<sect3><title>Direct Addressing</title>
<para>Most instructions have a 4-bit address specifier.  This can be used to refer to a memory address in the same 16-byte memory page as the instruction:</para>
<para>Addr = PC[7:4] + Instruction[3:0]</para>
</sect3>
<sect3 id="indirect"><title>Indirect Addressing</title>
<para>To provide more flexible addressing and the possibility of indexing, instructions can optionally specify indirect addressing.  In this case the final memory address is obtained by reading the location specified by the 4-bit address:
</para>
<para id="DEFER">When an instruction uses indirect addressing, an extra DEFER cycle is required for the additional memory access.</para>
<para>Addr = Mem( PC[7:4] + Instruction[3:0] )</para>
</sect3>
</sect2>
</sect1>
<sect1><title>Front Panel</title>
<para>The front panel contains LEDs to display register contents, instruction type and run status. It also has switches to set register and memory contents, and to start and stop program execution.</para>
<sect2><title>Register LEDs</title>
<para>4 sets of 8 LEDs display the <link linkend="PC">PC</link>, <link linkend="MA">MA</link>, <link linkend="MB">MB</link> and <link linkend="AC">AC</link> registers.
</para>
</sect2>
<sect2><title>Instruction LEDs</title>
<para>8 LEDs indicate the current instruction as <link linkend="AND">AND</link>, <link linkend="TAD">TAD</link>, <link linkend="ISZ">ISZ</link>, <link linkend="DCA">DCA</link>, <link linkend="JMS">JMS</link>, <link linkend="JMP">JMP</link>, <link linkend="IOT">IOT</link> or <link linkend="OPR">OPR</link>.</para>
</sect2>
<sect2><title>Status LEDs</title>
<para>4 LEDs indicate RUN status and FETCH, <link linkend="DEFER">DEFER</link> or EXECute instruction phases.</para>
</sect2>
<sect2><title>Entry switches</title>
<para>8 switches can be used to set the value of the PC register (using the LOAD ADDR switch) or the memory at the address specified by the PC register (using the DEP switch).</para>
<para>The switches are divided into groups of 3,2,3, which match the instruction layout with the top 3 bits being the opcode.  This leads to program listings being represented in a 3,2,3 octal format, rather than the more conventionsl 2,3,3 format for an 8-bit number.</para>
</sect2>
<sect2><title>Control Switches</title>
<itemizedlist mark="bullet">
<listitem>
<para>LOAD ADDRess sets the PC register to the switch settings.</para>
</listitem>
<listitem>
<para id="depswitch">DEPosit stores the switch settings in the memory location specified by the PC register, and increments the PC register.  The MA register contains the address which has just been written.</para>
</listitem>
<listitem>
<para>EXAMine reads the memory location specified by the PC register into the MB register, and increments the PC register.  The MA register contains the address which has just been read.</para>
</listitem>
<listitem>
<para>RUN starts program execution at the address specified by the PC register.</para>
</listitem>
<listitem>
<para>HALT stops program execution at the end of the current instruction, leaving the PC register pointing at the next instruction ready for re-starting with the RUN switch.</para>
</listitem>
<listitem>
<para>SINGLE/CONTinuous selects whether the program should run continuously when RUN is pressed, or only execute one instruction for debugging purposes.</para>
</listitem>
<listitem>
<para>SLOW/FAST selects the rate at which instructions are executed, with the slow setting reducing the clock rate from 500kHz to 2Hz.</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1><title>Input/Output</title>
<para>The EDUC-8 has 4 serial I/O links, 2 input and 2 output.  Devices designed along with the computer are:
<itemizedlist mark="bullet">
<listitem>
<para>Input</para>
	<itemizedlist mark="dash">
	<listitem><para>Paper-tape reader</para></listitem>
	<listitem><para>Octal Keypad</para></listitem>
	<listitem><para>Keyboard</para></listitem>
	</itemizedlist>
</listitem>
<listitem>
<para>Output</para>
	<itemizedlist mark="dash">
	<listitem><para>Paper-tape punch</para></listitem>
	<listitem><para>Printer</para></listitem>
	<listitem><para>Octal display</para></listitem>
	<listitem><para>Music player</para></listitem>
	<listitem><para>Burroughs self-scan display panel</para></listitem>
	</itemizedlist>
</listitem>
<listitem>
<para>Bidirectional</para>
	<itemizedlist mark="dash">
	<listitem><para>Asynchronous Current-Loop interface</para></listitem>
	<listitem><para>FSK tape interface</para></listitem>
	</itemizedlist>
</listitem>
</itemizedlist>
</para>
</sect1>
<sect1 id="instructionformat"><title>Instruction format</title>
<para>Each instruction is one byte.  The top 3 bits of an instruction are always the opcode.  There are three types of instruction layout for the remaining 5 bits.</para>
<para>Full instruction details are given in <xref linkend="ProgrammingChapter"/>.</para>
<table><title>Memory Reference Instructions</title>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">Opcode</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</table>
<para>The opcode can be from 000 to 101 (binary).  The Ind flag is set to specify indirect addressing.</para>
<table><title>OPR Instructions</title>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry>1</entry><entry>1</entry><entry>1</entry><entry>Sel</entry><entry>Opr3</entry><entry>Opr2</entry><entry>Opr1</entry><entry>Opr0</entry></row>
<!--
<row><entry>1</entry><entry>1</entry><entry>1</entry><entry>0</entry><entry>CLA</entry><entry>CMA</entry><entry>RAL</entry><entry>IAC</entry></row>
<row><entry>1</entry><entry>1</entry><entry>1</entry><entry>1</entry><entry>SZA</entry><entry>SMA</entry><entry>RAR</entry><entry>HLT</entry></row>
-->
</tbody>
</tgroup>
</table>
<para>Bit 4 specifies which group of functions can be selected.  Bits 3 through 0 specify a combination of the 4 different functions, though not all are meaningful.</para>
<table><title>IOT Instructions</title>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IOS"/>
<colspec colname="DES"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry>1</entry><entry>1</entry><entry>0</entry><entry>I/O</entry><entry>Dev</entry><entry>Clear</entry><entry>Shift</entry><entry>Skip</entry></row>
</tbody>
</tgroup>
</table>
<para>Bit 4 specifies whether the Input (0) or Output (1) devices are used.  Bit 3 specifies which of the two devices (2 input, 2 output) should be used.</para>
</sect1>
</chapter>
<chapter><title>Physical Construction</title>
<para>The EDUC-8 is constructed of 8 circuit boards:</para>
<itemizedlist>
<listitem>
<para>Front panel</para>
<para>11 ICs, 44 LEDs and 15 switches</para>
</listitem>
<listitem>
<para>Mother board</para>
<para>A passive board with connectors for the following 6 boards</para>
</listitem>
<listitem>
<para>Timing</para>
<para>21 ICs to generate timing and synchronisation signals for instruction execution</para>
</listitem>
<listitem>
<para>Instruction Decoder</para>
<para>14 ICs to generates control signals for the following boards depending on the current instruction and timing</para>
</listitem>
<listitem>
<para>Memory</para>
<para>256 bytes of volatile memory in two 256x4 devices, with another 16 ICs</para>
</listitem>
<listitem>
<para>Program Counter and Adder</para>
<para>14 ICs hold the PC register and provide a 1-bit serial adder used to increment the PC and AC as required</para>
</listitem>
<listitem>
<para>Accumulator</para>
<para>10 ICs mean this is the simplest of the boards</para>
</listitem>
<listitem>
<para>Input/Output</para>
<para>11 ICs to provide the four I/O channels</para>
</listitem>
</itemizedlist>
</chapter>
<chapter id="ProgrammingChapter"><title>Programming</title>
<sect1><title>Instruction Set</title>
<para>For memory reference instructions, the address is computed as:</para>
<para>Addr = (PC AND 11110000) OR (instruction AND 00001111)</para>
<para>and provision for indirect addressing:</para>
<para>If (instruction AND 00010000) > 0 Then Addr = Mem[Addr]</para>
<para>Note that the PC value used here is that of the instruction itself, the increment occurs afterward.</para>
<para>After each instruction fetch there is an implied:</para>
<para>PC = PC + 1</para>
<para>between fetching the instruction and executing it.</para>
<para>All addition is modulo 256.</para>
<sect2 id="AND"><title>AND</title>
<para>Logical AND</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">000</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = AC AND Mem[Addr]</para>
</sect2>
<sect2 id="TAD"><title>TAD</title>
<para>Two's complement addition</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">001</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = AC + Mem[Addr]</para>
</sect2>
<sect2 id="ISZ"><title>ISZ</title>
<para>Increment and Skip if Zero</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">010</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Mem[Addr] = Mem[Addr] + 1</para>
<para>If Mem[Addr] = 0 Then PC = PC + 1</para>
</sect2>
<sect2 id="DCA"><title>DCA</title>
<para>Deposit and Clear Accumulator</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">011</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Mem[Addr] = AC</para>
<para>AC = 0</para>
</sect2>
<sect2 id="JMS"><title>JMS</title>
<para>Jump to Subroutine</para>
<para>The return address is stored in the target location, and execution commences from the next location.</para>
<para>To return, do a JMP I Entry</para>
<para>Re-entry is not possible unless you save the address somewhere else!</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">100</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Mem[Addr] = PC</para>
<para>PC = Addr + 1</para>
</sect2>
<sect2 id="JMP"><title>JMP</title>
<para>Jump</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IND"/>
<colspec colname="AD3"/>
<colspec colname="AD2"/>
<colspec colname="AD1"/>
<colspec colname="AD0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<spanspec nameend="AD0" namest="AD3" spanname="ADDRESS"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">101</entry><entry>Ind</entry><entry spanname="ADDRESS">Address</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>PC = Addr</para>
</sect2>
<sect2 id="OPR"><title>OPR Group</title>
<para>Operate</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>CLA</entry><entry>CMA</entry><entry>RAL</entry><entry>IAC</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>SZA</entry><entry>SMA</entry><entry>RAR</entry><entry>HLT</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Instructions from the same group of 4 can be combined.  Execution of functions takes place from Bit 3 to Bit 0.</para>
<sect3><title>CLA</title>
<para>Clear accumulator</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>1</entry><entry>0</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = 0</para>
</sect3>
<sect3><title>CMA</title>
<para>Complement accumulator</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>0</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = 11111111 - AC</para>
</sect3>
<sect3><title>RAL</title>
<para>Rotate accumulator left</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>0</entry><entry>0</entry><entry>1</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = AC + AC</para>
</sect3>
<sect3><title>IAC</title>
<para>Increment accumulator</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>0</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = AC + 1</para>
</sect3>
<sect3><title>CLA,IAC</title>
<para>Clear and increment accumulator (i.e. set it to 1)</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>1</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = 1</para>
</sect3>
<sect3><title>CLA,CMA</title>
<para>Clear and complement accumulator (i.e. set it to 255 or -1)</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>1</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = 11111111</para>
</sect3>
<sect3><title>CMA,IAC</title>
<para>Negate accumulator</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>0</entry><entry>0</entry><entry>1</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>AC = 100000000 - AC</para>
</sect3>
<sect3><title>SZA</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>1</entry><entry>0</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Skip on Zero Accumulator</para>
<para>If AC = 0 Then PC = PC + 1</para>
</sect3>
<sect3><title>SMA</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>0</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Skip on Minus Accumulator</para>
<para>If (AC bit 7) = 1 Then PC = PC + 1</para>
</sect3>
<sect3><title>SZA,SMA</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>1</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Skip on Zero or Minus Accumulator</para>
<para>If AC = 0 OR (AC bit 7) = 1 Then PC = PC + 1</para>
</sect3>
<sect3><title>RAR</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>0</entry><entry>0</entry><entry>1</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Rotate accumulator right</para>
<para>AC = (AC AND 11111110) / 2</para>
<para>AC bit 7 is always set to 0</para>
</sect3>
<sect3><title>HLT</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">111</entry><entry>1</entry><entry>0</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Halt execution, PC is left pointing at the instruction after HLT</para>
</sect3>
</sect2>
<sect2 id="IOT"><title>IOT Group</title>
<para>I/O Transfer</para>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="IOS"/>
<colspec colname="DES"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>I/O</entry><entry>Dev</entry><entry>Clear</entry><entry>Shift</entry><entry>Skip</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>There are 2 input devices and 2 output devices.  The device number (0 or 1) is specified by bit 3 of the instruction.</para>
<para>When an I/O device is ready to transfer data, it sets a flag.  This flag is checked by the SKF and SDF instructions, and reset by the RKF and RDF instructions.</para>
<sect3><title>SKF</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>0</entry><entry>Dev</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Skip on input flag - if input device's input-ready flag is set then PC = PC + 1</para>
</sect3>
<sect3><title>KRS</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>0</entry><entry>Dev</entry><entry>0</entry><entry>1</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Read input data - transfer input device data into AC</para>
</sect3>
<sect3><title>RKF</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>0</entry><entry>Dev</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Reset input flag - indicate data has been transferred</para>
</sect3>
<sect3><title>KRB</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>1</entry><entry>Dev</entry><entry>1</entry><entry>1</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Read input data and reset flag - combination of KRS and RKF</para>
</sect3>
<sect3><title>SDF</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>1</entry><entry>Dev</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Skip on device flag - if output device's ready-to-accept-data flag is set then PC = PC + 1</para>
</sect3>
<sect3><title>LDS</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>1</entry><entry>Dev</entry><entry>0</entry><entry>1</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Load data - transfer AC to output device and set AC to 0</para>
</sect3>
<sect3><title>RDF</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>1</entry><entry>Dev</entry><entry>1</entry><entry>0</entry><entry>0</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Reset device flag - indicate data has been transferred</para>
</sect3>
<sect3><title>LDB</title>
<informaltable>
<tgroup cols="8" align="center">
<colspec colname="OP2"/>
<colspec colname="OP1"/>
<colspec colname="OP0"/>
<colspec colname="SEL"/>
<colspec colname="FL3"/>
<colspec colname="FL2"/>
<colspec colname="FL1"/>
<colspec colname="FL0"/>
<spanspec nameend="OP0" namest="OP2" spanname="OPCODE"/>
<tbody>
<row><entry>7</entry><entry>6</entry><entry>5</entry><entry>4</entry><entry>3</entry><entry>2</entry><entry>1</entry><entry>0</entry></row>
<row><entry spanname="OPCODE">110</entry><entry>1</entry><entry>Dev</entry><entry>0</entry><entry>0</entry><entry>1</entry></row>
</tbody>
</tgroup>
</informaltable>
<para>Load buffer - combination of LDS and RDF</para>
</sect3>
</sect2>
</sect1>
</chapter>
<chapter><title>Sample programs</title>
<sect1>
<title>Counting program</title>
<para>This program increments AC 256 times, and after each increment loops 256 times to provide a delay.</para>
<programlisting>
START,  LA          / clears AC
INCR,   IAC         / increments AC
BACK,   NOP         / delay
        NOP         / delay
        ISZ INDX    / loop on INDX
        JMP BACK    / if INDX non-zero
        ISZ INDY    / loop on INDY
        JMP INCR    / if INDY non-zero
        HLT         / INDY is zero
INDX,   0           / Delay counter
INDY,   0           / Follows AC
</programlisting>
</sect1>
<sect1>
<title>Paper-tape punching program</title>
<para>This program accepts 3 digits from the numeric keypad (Input device 0) while displaying them on the 7-segment display (Output device 0), and if the LF key is then pressed the specified byte is punched onto paper tape (Output device 1).  If a fourth digit key is pressed instead of LF, the display is cleared and no byte is punched.</para>
<programlisting>
READ,   0           / Read byte from keypad subroutine
TEST,   SKF
        JMP TEST    / Loop until byte ready
        KRB         / Read it
        JMP I READ  / Return
BUFF,   0
START,  RKF
        JMS READ    / Get first digit 'A'
        DCA BUFF    / Store it
        TAD BUFF    / Get it again
        LDB         / Display digit 'A'
        TAD BUFF    / Get digit yet again
        RAL
        RAL         / Multiply by 8
        DCA BUFF    / Save it
        JMS READ    / Get second digit 'B'
        TAD I BUFD  / Combine with first
        RAL
        RAL
        RAL         / Multiply by 8
        DCA I BUFD  / Save
        TAD I BUFD  / Reload
        LDB         / Display digits 'AB'
        JMS I REDD  / Get third digit 'C'
        TAD I BUFD  / Combine with first two
        DCA I BUFD  / Save
        TAD I BUFD  / Reload
        LDB         / Display digits 'ABC'
        JMP I CONT  / Jump to loc 040
CONT,   040         / Points to following instruction
REDD,   000         / Points to read-byte subroutine
BUFD,   005         / Points to BUFF
        JMS I REDB  / Get command digit (this is loc 040)
        SMA         / Punch?
        JMP SCRB    / No, Scrub
        CLA
        TAD I BUFB  / Get the byte
        LPB         / Punch it, LPB = LDB for second device
CHEK,   SPF         / SPF = SDF for second device
        JMP CHEK    / Wait for it to be punched
SCRB,   CLA
        LDB         / Clear display
        JMP I STAD
REDB,   000         / Read-byte subroutine
BUFB,   005         / BUFF
STAD,   007         / START
</programlisting>
</sect1>
</chapter>
</book>
