Machine Code

Show machine code

Registers

PC
0
ACC
0

CPU Playground Help

CPU Playground is an integrated development environment (IDE) for a simulated CPU the author wrote as part of their Computer Architecture coursework. It brings together a bespoke assembler written for the CPU simulation, an accurate emulator of the CPU simulation, and a code editor with support for the assembly language.

Jamie's Assembly Language

Jamie's Assembly is the assembly language used by CPU Playground, it takes inspriation from Little Man Computer and Intel 8086 Assembly.

Format Example(s)
address 0x0f (hexadecimal), 15 (decimal)
immediate #0x05 (hexadecimal), #5 (decimal), #'H' (ASCII)
label name
string "Hello, World!"

Instructions

Mnemonic Format Description Output
HLT Halts the CPU. f000
LDA <address> Loads the value from the memory address into the accumulator. 20XX
<immediate> Loads the immediate value into the accumulator. 10XX
STA <address> Stores the value from the accumulator into the memory address. 30XX
ADD <address> Adds the value from the memory address and the accumulator. 21XX
<immediate> Adds the immediate value and the accumulator. 11XX
AND <address> Bitwise ANDs the value from the memory address and the accumulator. 22XX
<immediate> Bitwise ANDs the immediate value and the accumulator. 12XX
XOR <address> Bitwise XORs the value from the memory address and the accumulator. 23XX
<immediate> Bitwise XORs the immediate value and the accumulator. 13XX
SLT <address> Sets the accumulator to one if the accumulator value is less than the value from the memory address; zero otherwise. 25XX
<immediate> Sets the accumulator to one if the accumulator value is less than the immediate, zero otherwise. 15XX
EQL <address> Sets the accumulator to one if the accumulator value is equal to the value from the memory address; zero otherwise. 27XX
<immediate> Sets the accumulator to one if the accumulator value is equal to the immediate, zero otherwise. 17XX
SUB <address> Subtracts the value from the memory address from the accumulator. 28XX
<immediate> Subtracts the immediate value from the accumulator. 18XX
BNEZ <label> Branches to the label, if the accumulator is not equal to zero. 40XX
DSP Outputs the current accumulator value to the TTY. 5000
READ_CHAR Reads a character from the TTY to the accumulator. 6000

Macros

Jamie's Assembly supports some macros, designed to emit efficient machine code and simplify writing programs.

Mnemonic Format Description
write <string> Writes the given string to the TTY.
write_hex <address> Writes the value at the given memory address to the TTY in hexadecimal.
jmp <label> Jumps to the label, unconditionally.

Open Source Software

CPU Playground makes use of the following open-source software:

CPU Playground Settings

TTY