mirror of https://github.com/chyyuu/v8-cpu.git
128 lines
5.2 KiB
HTML
128 lines
5.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Simple 8-bit V8-CPU Assembler - Instruction Set Help</title>
|
|
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="assets/style.css">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-inverse" role="navigation" style="background-color:#428BCA;border:0px;border-radius:0px;">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a type="button" class="btn btn-default navbar-btn" href="index.html">Simulator</a>
|
|
</div>
|
|
<div class="navbar-header navbar-right">
|
|
<a class="navbar-brand" style="color:#FFFFFF">Simple 8-bit V8-CPU Assembler Simulator</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div class="container">
|
|
<h4>Introduction</h4>
|
|
<p>This simulator provides a simplified assembler syntax (based on TEXT BOOK "Computer Science: An Overview") and is simulating a 8-bit cpu. </p>
|
|
<p>The simulator consists of a 8-bit cpu and 256 bytes of memory. All instructions (code) and variables (data) needs to fit inside the memory. For simplicity every instruction (and operand) is 2 byte.</p>
|
|
<h4>Syntax</h4>
|
|
<p>The syntax is similar as most assemblers are using. Every instruction must be on their own line. Labels are optional and must either start with a letter or a dot (.) and end with a colon.</p>
|
|
<pre>label: instruction operands ; Comment</pre>
|
|
<p>Valid number formats for constants are:</p>
|
|
<pre>
|
|
Decimal: 200
|
|
Hex: 0xA4
|
|
</pre>
|
|
<p>It is possible to define a number using a character or multiple numbers (see instruction <i>DB</i>) by using a string.</p>
|
|
<pre>
|
|
Character: 'A'
|
|
String: "Hello World!"
|
|
</pre>
|
|
<p>Operands can either be one of the 16 general purpose registers, a memory address or a constant.
|
|
Instead of defining an address as a constant or by using a register you can use labels. The assembler will then replace the label with the corresponding constant.</p>
|
|
<pre>
|
|
General purpose (GP) register: R0-RE
|
|
Timer interrupt register: RF
|
|
Address using a constant: 100
|
|
Address using a label: label
|
|
</pre>
|
|
<h4>MOVE S, R</h4>
|
|
<p> MOVE the bit pattern found in register R to register S.</p>
|
|
<pre>
|
|
MOVE reg, reg
|
|
</pre>
|
|
<h4>DB - Variable</h4>
|
|
<p>Defines a variable. A variable can either be a single number, character or a string.</p>
|
|
<pre>
|
|
DB constant
|
|
</pre>
|
|
<h4>integer/float Addition </h4>
|
|
<p>Adds two numbers together. </p>
|
|
<pre>
|
|
ADDI regR, regS, regT ; regR=regS+regT integer
|
|
ADDF regR, regS, regT ; regR=regS+regT float
|
|
</pre>
|
|
<b>Logical instructions</b>
|
|
<p>The following logical instructions are supported: AND, OR, XOR.</p>
|
|
<pre>
|
|
AND regR, regS, regT ; R=S & T
|
|
OR regR, regS, regT ; R=S | T
|
|
XOR regR, regS, regT ; R=S ^ T
|
|
</pre>
|
|
<b>Shift instructions</b>
|
|
<p>The following shift instructions are supported: ROTATE to right. </p>
|
|
<pre>
|
|
ROT regR, numX ; regR=regR rotate-right numX times
|
|
</pre>
|
|
<h4>JUMP - jump if equal</h4>
|
|
<p>JUMP to the instruction located in the memory cell at address XY if the bit pattern in register R is equal to the bit
|
|
pattern in register 0. Otherwise, continue with the normal sequence of execution. (The jump is implemented by
|
|
copying XY into the program counter during the execute phase.)
|
|
</p>
|
|
<pre>
|
|
JUMP regR, numXY
|
|
</pre>
|
|
<h4>JUMPL - jump if less</h4>
|
|
<p>JUMPL to the instruction located in the memory cell at address XY if the bit pattern in register R is less than the bit
|
|
pattern in register 0. Otherwise, continue with the normal sequence of execution. (The jump is implemented by
|
|
copying XY into the program counter during the execute phase.)
|
|
</p>
|
|
<pre>
|
|
JUMPL regR, numXY
|
|
</pre>
|
|
|
|
<h4>HALT</h4>
|
|
<p>Stops operation of the processor. Hit Reset button to reset IP before restarting.</p>
|
|
<pre>
|
|
HALT
|
|
</pre>
|
|
<h4>LOADM (Load from Memory) </h4>
|
|
<p>LOAD the register R with the bit pattern found in the memory cell whose address is XY. </p>
|
|
<pre>
|
|
LOADM regR, numXY
|
|
</pre>
|
|
<h4>LOADB (Load with Bit Pattern) </h4>
|
|
<p>LOAD the register R with the bit pattern XY. </p>
|
|
<pre>
|
|
LOADB regR, numXY
|
|
</pre>
|
|
<h4>LOADP (Load via Pointer) </h4>
|
|
<p>LOAD the register R with the contents of the memory cell whose address is found in register S.</p>
|
|
<pre>
|
|
LOADP regR, regS
|
|
</pre>
|
|
<h4>STOREM (Store to Memory) </h4>
|
|
<p>STORE the bit pattern found in register R in the memory cell whose address is XY. </p>
|
|
<pre>
|
|
STOREM regR, numXY
|
|
</pre>
|
|
<h4>STOREP (Store via Pointer) </h4>
|
|
<p>STORE the contents of register R in the memory cell whose address is found in register S. </p>
|
|
<pre>
|
|
STOREP regR, regS
|
|
</pre>
|
|
|
|
|
|
<hr style="margin-bottom:10px;"/>
|
|
<p><small>by Yuanchun Shi, Yu Chen, Junjie Mao, Yukang Yan (2015) | MIT License | <a href="https://www.github.com/chyyuu/v8-cpu" target="_blank">Source Code</a></small></p>
|
|
<p><small>by Marco Schweighauser (2015) | MIT License | <a href="https://www.mschweighauser.com/make-your-own-assembler-simulator-in-javascript-part1/" target="_blank">Blog</a></small></p>
|
|
</div>
|
|
</body>
|
|
</html>
|