changeset 40:413e7b9c0db1

Added flag change documentation for all instructions. Added hyperlinks to individual instructions. Added overviews for all the peripherals
author Michael Pavone <pavone@retrodev.com>
date Thu, 07 Apr 2016 21:58:27 -0700
parents 52d601e13ea4
children 23bea9b9569f
files simple16.html
diffstat 1 files changed, 188 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/simple16.html	Wed Apr 06 12:15:25 2016 -0700
+++ b/simple16.html	Thu Apr 07 21:58:27 2016 -0700
@@ -26,8 +26,19 @@
 				<li><a href="#interrupts">Exceptions and Interrupts</a></li>
 			</ul>
 		</li>
-		<li><a href="#video">Video</a></li>
+		<li><a href="#video">Video</a>
+			<ul>
+				<li><a href="#vidover">Overview</a></li>
+				<li><a href="#vidregs">IO Ports</a></li>
+				<li><a href="#vidmem">Memory Map</a></li>
+				<li><a href="#vidrender">Rendering</a></li>
+			</ul>
+		</li>
 		<li><a href="#audio">Audio</a></li>
+			<ul>
+				<li><a href="#audover">Overview</a></li>
+				<li><a href="#audregs">IO Ports</a></li>
+			</ul>
 		<li><a href="#timer">Timer</a></li>
 		<li><a href="#controllers">Controllers</a></li>
 		<li><a href="#serial">Serial Port</a></li>
@@ -91,10 +102,43 @@
 		<li><a href="#str8">str8 rA, rB, rD</a></li>
 		<li><a href="#str16">str16 rA, rB, rD</a></li>
 		<li><a href="#add">add rA, rB, rD</a></li>
-		<li><a href="#adc">add rA, rB, rD</a></li>
+		<li><a href="#adc">adc rA, rB, rD</a></li>
 		<li><a href="#and">and rA, rB, rD</a></li>
 		<li><a href="#or">or rA, rB, rD</a></li>
 		<li><a href="#xor">xor rA, rB, rD</a></li>
+		<li><a href="#lsl">lsl rA, rB, rD</a></li>
+		<li><a href="#lsr">lsr rA, rB, rD</a></li>
+		<li><a href="#asr">asr rA, rB, rD</a></li>
+		<li><a href="#bcc">bCC LABEL</a></li>
+		<li><a href="#mov">mov rA, rD</a></li>
+		<li><a href="#neg">neg rA, rD</a></li>
+		<li><a href="#not">not rA, rD</a></li>
+		<li><a href="#cmp">cmp rA, rD</a></li>
+		<li><a href="#call">call rA, rD</a></li>
+		<li><a href="#swap">swap rA, rD</a></li>
+		<li><a href="#in">in rA, rD</a></li>
+		<li><a href="#out">out rA, rD</a></li>
+		<li><a href="#ini">ini IM, rD</a></li>
+		<li><a href="#outi">outi IM, rD</a></li>
+		<li><a href="#addi">addi IM, rD</a></li>
+		<li><a href="#andi">andi IM, rD</a></li>
+		<li><a href="#ori">ori IM, rD</a></li>
+		<li><a href="#lsli">lsli IM, rD</a></li>
+		<li><a href="#lsri">lsri IM, rD</a></li>
+		<li><a href="#cmpi">cmpi IM, rD</a></li>
+		<li><a href="#reti">reti rD</a></li>
+		<li><a href="#trap">trap rD</a></li>
+		<li><a href="#trapi">trapi IM</a></li>
+		<li><a href="#getepc">getepc rD</a></li>
+		<li><a href="#setepc">setepc rD</a></li>
+		<li><a href="#getesr">getesr rD</a></li>
+		<li><a href="#setesr">setser rD</a></li>
+		<li><a href="#geteur">geteur rD</a></li>
+		<li><a href="#seteur">seteur rD</a></li>
+		<li><a href="#getenum">getenum rD</a></li>
+		<li><a href="#setenum">setenum rD</a></li>
+		<li><a href="#getvbr">getvbr rD</a></li>
+		<li><a href="#setvbr">setvbr rD</a></li>
 	</ul>
 	<h4 id="ldim">ldim IM, rD</h4>
 	<p>
@@ -192,7 +236,10 @@
 		The value in rA is arithmetically shifted right by rB bits and stored in rD. The most significant bit of rA is copied
 		into the newly shifted bits. This allows asr to be used for signed division by powers of 2 as the sign is preserved.
 	</p>
-	<h4 id="bcc">bCC</h4>
+	<p>
+		<strong>Flags:</strong> C = last bit shifted out of rA, N = result is negative, Z = result is zero
+	</p>
+	<h4 id="bcc">bCC LABEL</h4>
 	<p>
 		bCC performs a relative branch if the condition indicated by CC is true. It has a range of 131 instructions forward or
 		124 instructions backwards. CC must be one of the following values
@@ -266,120 +313,248 @@
 		</table>
 		Use of CC values greater than 9 will result in an invalid instruction exception.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="mov">mov rA, rD</h4>
 	<p>
 		Stores the value of rA in rD. This can be used as a return or jump instruction if rD is PC.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="neg">neg rA, rD</h4>
 	<p>
 		Calculates the 2s complement of rA and stores it in rD. This can be used in combination with add to implement subtraction.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = carry out of bit 15, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="not">not rA, rD</h4>
 	<p>
 		Calculates the 1s complement of rA and stores it in rD.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = unmodified, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="cmp">cmp rA, rD</h4>
 	<p>
 		Subtracts rA from rD and discards the result, but still updates flags.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = carry out of bit 15, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="call">call rA, rD</h4>
 	<p>
 		Stores the address of the next instruction in rD and sets PC to the value in rA. Used for calling subroutines.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="swap">swap rA, rD</h4>
 	<p>
 		Swaps the values in rA and rD.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="in">in rA, rD</h4>
 	<p>
 		Reads a word from the IO port indicated by rA and stores it in rD.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="out">out rA, rD</h4>
 	<p>
 		Writes the word stored in rD to the IO port indicated by rA.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="ini">ini IM, rD</h4>
 	<p>
 		Reads a word from the IO port indicated by IM and stores it in rD. IM can range from 0 to 15.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="outi">outi</h4>
 	<p>
 		Writes the word stored in rD to the IO port indicated by IM. IM can range from 0 to 15.
 	</p>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
 	<h4 id="addi">addi IM, rD</h4>
 	<p>
 		Adds IM to the value in rD and stores the result in rD. IM range from -8 to -1 or 1 to 8. A value of 0 is used to indicate 8.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = carry out of bit 15, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="andi">andi IM, rD</h4>
 	<p>
 		Performs a logical and of  IM and the value in rD and stores the result in rD. IM can range from -8 to -1 or 1 to 8. A value of 0 is used to indicate 8.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = unmodified, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="ori">ori IM, rD</h4>
 	<p>
 		Performs a logical or of  IM and the value in rD and stores the result in rD. IM can range from-8 to -1 or 1 to 8. A value of 0 is used to indicate 8.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = unmodified, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="lsli">lsli IM, rD</h4>
 	<p>
 		Shifts the value in rD IM bits to the left. IM can range from 1 to 8.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = last bit shifted out of rA, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="lsri">lsri IM, rD</h4>
 	<p>
 		Shifts the value in rD IM bits to the right. IM can range from 1 to 8.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = last bit shifted out of rA, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="cmpi">cmpi IM, rd</h4>
 	<p>
 		Subtracts IM from rD and discards the result, but updates flags. IM can range from -8 to 7.
 	</p>
+	<p>
+		<strong>Flags:</strong> C = carry out of bit 15, N = result is negative, Z = result is zero
+	</p>
 	<h4 id="reti">reti rD</h4>
 	<p>
 		Sets rD to the value storeed in EUR, SR to the value stored in ESR and PC to the value stored in EPC. This instruction is used for returning from an
 		exception or interrupt.
 	</p>
+	<p>
+		<strong>Flags:</strong> Updated corresponding to the value in ESR.
+	</p>
 	<h4 id="trap">trap rD</h4>
 	<p>
 		Causes an exception to be taken to the vector indicated by rD.
 	</p>
+	<p>
+		<strong>Flags:</strong> Condition code flags unchanged, interrupt enable bits cleared.
+	</p>
 	<h4 id="trapi">trapi IM</h4>
 	<p>
-		Causes an exception to be taken to the vecotr indicated by IM
+		Causes an exception to be taken to the vector indicated by IM
+	</p>
+	<p>
+		<strong>Flags:</strong> Condition code flags unchanged, interrupt enable bits cleared.
 	</p>
 	<h4 id="getepc">getepc rD</h4>
 	<p>
 		Stores the value of EPC in rD.
 	</p>
-	<h4 id="setepc">setepc</h4>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="setepc">setepc rD</h4>
 	<p>
 		Stores the vaule of rD in EPC.
 	</p>
-	<h4 id="getesr">getesr</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="getesr">getesr rD</h4>
+	<p>
+		Stores the value of ESR in rD.
 	</p>
-	<h4 id="setesr">setesr</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="setesr">setesr rD</h4>
+	<p>
+		Stores the value of rD in ESR.
 	</p>
-	<h4 id="geteur">geteur</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="geteur">geteur rD</h4>
+	<p>
+		Stores the value of EUR in rD.
 	</p>
-	<h4 id="seteur">seteur</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="seteur">seteur rD</h4>
+	<p>
+		Stores the value of rd in EUR.
 	</p>
-	<h4 id="getenum">getenum</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="getenum">getenum rD</h4>
+	<p>
+		Stores the value of ENUM in rD.
 	</p>
-	<h4 id="setenum">setenum</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="setenum">setenum rD</h4>
+	<p>
+		Stores the value of rd in ENUM.
 	</p>
-	<h4 id="getvbr">getvbr</h4>
 	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="getvbr">getvbr rD</h4>
+	<p>
+		Stores the value of VBR in rD.
 	</p>
-	<h4 id="setvbr">setvbr</h4>
+	<p>
+		<strong>Flags:</strong> No change
+	</p>
+	<h4 id="setvbr">setvbr rD</h4>
 	<p>
+		Stores the valueof rD in VBR.
+	</p>
+	<p>
+		<strong>Flags:</strong> No change
 	</p>
 	<h2 id="video">Video</h2>
+	<h3 id="vidover">Overview</h3>
+	<p>
+		Simple 16 features a tile-based video processor using 8x8 pixel tiles. It supports a single background plane with a fixed width of 64 tiles and configurable height.
+		64 sprites can be displayed simultaneously and 20 can be displayed on each line. Each sprite can either be 8x8 or 16x16 pixels and can use either of the first two
+		16 color palettes. The background plane can make use of all 4 palettes.
+	</p>
 	<h2 id="audio">Audio</h2>
+	<h3 id="audover">Overview</h3>
+	<p>
+		Simple 16 has four square-wave tone generators with a 16-bit period and an 8-bit volume. The special value of 0 for the period causes the volume to be output constantly
+		allowing the volume register to be used as a simple 8-bit DAC.
+	</p>
 	<h2 id="timer">Timer</h2>
+	<h3 id="timeover">Overview</h3>
+	<p>
+		Simple 16 has a single timer with a 16-bit period. Interrupt 0 is triggered on timer expiration.
+	</p>
 	<h2 id="controllers">Controllers</h2>
+	<h3 id="contover">Overview</h3>
+	<p>
+		Simple 16 supports 2 controllers, each with a D-pad and 8 buttons configured in either an SNES (4 action buttons on the face + 2 shoulder buttons + Start and Select)
+		or Genesis 6-button controller (6 action buttons on the face + Start and Mode) arrangement. In this document, the buttons are given using the Genesis naming scheme.
+		For a controller following the SNES layout, the right trigger is 'C', the left trigger is 'Z' and 'Select' is 'Mode'.
+	</p>
 	<h2 id="serial">Serial Port</h2>
+	<h3>Overview</h3>
+	<p>
+		This port can be thought of a simple UART for debugging purposes. In an emulator, a write should result in a byte being written to stdout and a read should return
+		a byte read from stdin. This peripheral can be omitted in which case writes should be ignored and reads should return $FFFF. The primary purpose of this port is
+		to enable easy debugging of the CPU core before other, more complicated, peripherals are working.
 	<h2 id="cart">Cartridge</h2>
+	<h3>Overview</h3>
+	<p>
+		Simple 16 allows for 48KB of flat mapped cartridge ROM. Future revisions may allow banking.
+	</p>
 </body>
 </html>
\ No newline at end of file