A simple assembly language built for ECE3242 (Computer Architecture). We often had to write and insert binary into memory manually (see here). Furthermore, compilation and simulation took upwards of 10 minutes. By creating this program, I was able to write the program in assembly, simulate the behavior using the builtin emulator, and compile the program to the expected binary format.
Visit the website and start typing. Use Ctrl+S
to convert from assembly -> binary.
Initialize a register and double the value [link].
Store a value to memory and read it in the debug line [link].
Here is a simple for loop that counts down from 10 to 1 and stop looping at 0 [link].
A loop that never ends, using a label [link].
The following instruction sections include the specific format that each format expects and a technical description.
mov1 Ra IMM
REG[Ra] <= MEM[IMM]
mov2 Ra IMM
MEM[IMM] <= REG[Ra]
save Ra Rb
MEM[REG[Ra]] <= REG[Rb]
Previously
mov3
set Ra IMM
REG[Ra] <= IMM
Previously
mov4
load Ra Rb
REG[Ra] <= MEM[REG[Rb]]
add Ra Rb Rc
REG[Ra] <= REG[Rb] + REG[Rc]
Previously there were only two registers (
add Ra Rb
)
subt Ra Rb Rc
REG[Ra] <= REG[Rb] - REG[Rc]
Previously there were only two registers (
subt Ra Rb
)
jz Ra IMM
jump to IMM if REG[Ra] == 0
readm IMM
out <= MEM[IMM]
halt
halts program
Here is a list of the various instruction formats that could occur.
0000 0000 0000 0000
OP Ra Rb Rc
OP Ra IMM IMM
OP -- IMM IMM
Are there comments?
Yes, you can use #
to tell the compiler to ignore the rest of the line.
Are there labels?
Yes, you can use <LABEL>:
to tell the compiler to attach <LABEL>
to the following line number.
Are there variables?
Yes, you can use #define XX XX
to define a variable. For example, #define A B
tells the compiler to replace all occurrences of A
with B
.
Want to run the website locally? Just use the following commands :)
# install the deps
npm i
# run the dev server
npm run serve
# build the project -> docs/
npm run build
# run the tests
npm run test:unit