Assembler for the 6-Instruction Processor
from Chapter 8 of "Digital Design" (DD) by Frank Vahid, John Wiley and Sons, First Edition, 2006, www.ddvahid.com.
Copyright (c) 2007 Frank Vahid. Permission for educational use granted to all students and to instructors requiring DD for a course. Any other use requires explicit author permission.
To use:
Write/modify/paste assembly code (to be safe, keep a copy elsewhere).
Press "Assemble" button to generate machine code.
Press "Step" to execute one instruction, press step again to
execute next instruction.
Press "Reset" to reset the instruction simulator
Instruction Set
Name
Opcode
Instruction
Description
Load
0000
MOV Ra, d
Load data from memory location d into register a.
Store
0001
MOV d, Ra
Store data from register a into memory location d.
Add
0010
ADD Ra, Rb, Rc
Add register b and register c and store the result in register a.
Load Constant
0011
MOV Ra, #c
Load the constant c into register a.
Subtract
0100
SUB Ra, Rb, Rc
Subtract register c from register b (RF[b] - R[c]) and store the result in register a.
Jump if zero
0101
JMPZ Ra, offset
Set the program counter (PC) to PC + offset if register a is 0.
Assembly code notes: Each instruction should end with ";".
Any instruction may begin with a label-- "label:".
Constants must be decimal numbers.