The Little Man Computer – Reference
From teachwithict.
The little man’s instruction set: These are all the instructions the little man can execute.
Instruction |
Mnemonic |
Machine Code |
Load |
LDA |
5xx |
Store |
STA |
3xx |
Add |
ADD |
1xx |
Subtract |
SUB |
2xx |
Input |
INP |
901 |
Output |
OUT |
902 |
End |
HLT |
000 |
Branch if zero |
BRZ |
7xx |
Branch if zero or positive |
BRP |
8xx |
Branch always |
BRA |
6xx |
Data storage |
DAT |
|
xx refers to a Mailbox number (Memory Address)
Example (Using Machine Code)
Address |
Instruction |
What it does: |
|
Mnemonic |
Machine Code |
||
00 |
INP |
901 |
Input a number and put it in the calculator |
01 |
STA 99 |
399 |
Store the number in the calculator in memory slot 99 |
02 |
INP |
901 |
Input a number and put it in the calculator |
03 |
ADD 99 |
199 |
Add the number in memory slot 99 to the number in the calculator |
04 |
OUT |
902 |
Output the number which is now in the calculator |
05 |
HLT |
000 |
Halt |