SimCom  the Simple Computer

5
Translate (or "assemble" as it's called) this program into machine code.

Enter your code into SimCom and see if you can figure out what the program does.
STRT: INP N
 LDA #1
 STA C
 LDA #1
 STA A
 LDA #3
 STA B
LOOP: LDA C
 SUB N
 BEQ END
 INC C
 LDA A
 ADD B
 STA A
 INC B
 INC B
 JMP LOOP
END: OUT A
 HLT
Check.

[Contents] [Previous] [Next] [SimCom] [Help]