PC

0AC

0SP

0out

0
0
1
2
3
4
5
6
7
8
9
00
0
0
0
0
0
0
0
0
0
0
10
0
0
0
0
0
0
0
0
0
0
20
0
0
0
0
0
0
0
0
0
0
30
0
0
0
0
0
0
0
0
0
0
40
0
0
0
0
0
0
0
0
0
0
50
0
0
0
0
0
0
0
0
0
0
60
0
0
0
0
0
0
0
0
0
0
70
0
0
0
0
0
0
0
0
0
0
80
0
0
0
0
0
0
0
0
0
0
90
0
0
0
0
0
0
0
0
0
0

SimCom has 18 instructions (Assembler equivalents in brackets) and 100 memory boxes (00 to 99). 0 halt (HLT). 2 return from subroutine (RTS). 3 load the accumulator with the number in the next box (LDA #). 5 add the number in the next box to the accumulator (ADD #). 6 subtract the number in the next box from the accumulator (SUB #) 1AA input a number from the keyboard into box AA (INP). 2AA output the number in box AA to the screen (OUT). 3AA copy the number in box AA into the accumulator (LDA). 4AA copy the number in the accumulator into box AA (STA). 5AA add the number in box AA to the accumulator (ADD). 6AA subtract the number in box AA from the accumulator (SUB). 7AA jump to box AA (JMP). 8AA jump to the subroutine starting at box AA (JSR). 9AA branch to box AA if the accumulator is negative (BMI). 10AA branch to box AA if the accumulator is equal to zero (BEQ). 11AA branch to box AA if the accumulator is positive (BPL). 12AA add one to box AA (INC). 13AA subtract one from box AA (DEC).