LMC Emulator in Scratch
Updated 14May14 to combine instruction and data in one array value
There is a basic microprocessor concept called the LMC http://www.yorku.ca/sychen/research/LMC/ which introduces the concepts of basic assembly language programming using only 10 instructions.
I’ve made a Scratch version that is a working copy of the simulator.
The way to use it is to enter your instructions into the list called Memory and then press the run button.
The main difference between this version and the original LMC is in he entering of pure data. To just enter a number into memory you would use:
The LMC computer will then ignore the DAT instruction and move the program counter to the next instruction
The INP instruction will pause and let you enter a value into accumulator.
The OUT instruction will cause the cat to say the value of the accumulator
All other LMC instructions (LDA,STA,ADD,SUB,BRA,BRZ,BRP and HLT ) should work the same as the original simulator.
The simulator is available here
Any feedback greatly appreciated 🙂