๐
Program
๐ก This program takes two numbers as input and adds them together.
One instruction per line. Labels before the mnemonic. Comments after //
๐ค
Output
Ready. Click โ๏ธ Assemble, then โถ Run to see the program execute.
๐
Instruction Set
| Mnemonic | Code | Description |
|---|---|---|
| INP | 901 | Input from user โ Accumulator |
| OUT | 902 | Output Accumulator value |
| LDA xx | 5xx | Load from address xx โ Accumulator |
| STA xx | 3xx | Store Accumulator โ address xx |
| ADD xx | 1xx | Add value at address xx to Accumulator |
| SUB xx | 2xx | Subtract value at address xx from Accumulator |
| BRA xx | 6xx | Branch always to address xx |
| BRZ xx | 7xx | Branch to xx if Accumulator = 0 |
| BRP xx | 8xx | Branch to xx if Accumulator โฅ 0 |
| HLT | 000 | Halt the program |
| DAT xx | xx | Reserve memory with optional initial value |
Fetch
Get instruction from memory
Get instruction from memory
Decode
Work out what it means
Work out what it means
Execute
Carry out the instruction
Carry out the instruction
๐ง
Registers
PC
Program Counter
Program Counter
0
ACC
Accumulator
Accumulator
0
MAR
Memory Address Register
Memory Address Register
-
MDR
Memory Data Register
Memory Data Register
-
CIR
Current Instruction Register
Current Instruction Register
-
Flag
Status indicator
Status indicator
-
๐ฆ
Memory (100 mailboxes)
๐ฅ