Online Assembler & Emulator
This is an online emulator, assembler and disassembler for the base QuAC ISA (v3.0). This means that you will be able to:
- Observe how QuAC programs are executed (without having to finish implementing the full CPU yourself)
- Use the assembler to convert QuAC assembly to machine code
- Disassemble machine code back into QuAC assembly.
This semester (Semester 1, 2025) is the first time we have provided this online assembler and emulator. As a result there may be a few minor bugs. If you believe you have found such a bug1 please let us know on by making a post on the course forum.
How To Use#
This page provides both an online assembler and emulator.
Using the Assembler#
The assembler below functions similarly to the assembler included with the VsCode QuAC Extension.
The different buttons used to control the assembler are:
Assemble Input#
This button will assemble the input you provide into machine code. Either the
output (machine code) will be displayed below the input box, or an error message
if the assembler could not assemble the input you provide. These machine codes
can be copy-and-pasted into the RAM component of your CPU while it is running,
saved to a ram.bin file or copied to the emulator.
Copy to Emulator#
This button will copy the assembled bytes into the text input box for the emulator.
Save to ram.bin File#
This will allow you to save the assembled bytes
Using the Emulator#
The different buttons used to control the emulator are:
Load Program#
The “Load Program” button will load the current input into the emulator’s RAM.
This operates in the same way as a ram.bin file or program(...) statement in
a Digital test case. The first instruction is stored at memory address 0, the
second at memory address 1, and so on. Once you have loaded a program the
“Step CPU” button will allow you to see the emulator’s execution step by step.
Disassemble Program#
This will attempt to disassemble the currently input instruction bytes into human-readable assembly (you can think of this as the opposite of “assembling”).
Step CPU#
Once you have loaded a program into the emulator’s memory, the “Step CPU” button will execute a single instruction, updating the CPU state. This is the same as pressing the C key when running a simulation in Digital.
Reset CPU#
This button will reset the CPU back to its initial state, including the loading of a program into memory.
Converter#
Use the following tool to convert between different representations (hexadecimal, decimal and binary) of numbers.
| Decimal | |
| Hex | |
| Binary |
Assembler#
Emulator#
When running a program in the emulator, this table will contain the current
values of the registers and a disassembled view of the current instruction (i.e.
the value stored at [pc]).
| Register | Value |
|---|---|
| r0 | 0x0000 |
| r1 | 0x0000 |
| r2 | 0x0000 |
| r3 | 0x0000 |
| r4 | 0x0000 |
| pc | 0x0000 |
| r6 | 0x0000 |
| fl | 0b0000 |
| Current Instruction | ------ |
| Disassembled Instruction |
------
|
Enter any memory address in the field below to see what the current value stored at that address is in RAM:
Why is any of this Useful?#
Good question! With the tools above you can:
- Assemble
QuACprograms and save them asram.binfiles to use in your CPU directly. This is especially helpful for situations where you don’t want to use VsCode/can’t get the debugger extension working. - Alternatively it will allow you to see how QuAC assembly is converted into machine code (useful for checking your answers to Exercise 3 of Lab 5).
- Or, in the case of diagnosing a tricky bug in your CPU, allow you to see how a CPU should behave for a given instruction.
- Disassemble
QuACprograms, such as those included in the test cases for Assignment 1. If you are failing a test case you may find it easier to use the above disassembler to get human-readable assembly. This assembly code could then be used with the debugger interface for step-by-step debugging of your CPU. - You might find it fun to use, regardless of any benefit to your assignment or lab work ✨.
-
And you’re sure you haven’t misunderstood some aspect of the ISA specification ↩