80 likes | 281 Views
LMC Intro. The Little Man Computer. LMC. Imagine a tiny man in a box with: Input and output trays List of numbers (memory) Program Data Calculator Only holds one value at a time. Excel WS. Excel Version of LMC:. Instructions. First number is Opcode 0 is end program
E N D
LMC Intro The Little Man Computer
LMC • Imagine a tiny man in a box with: • Input and output trays • List of numbers (memory) • Program • Data • Calculator • Only holds one value at a time
Excel WS • Excel Version of LMC:
Instructions • First number is Opcode • 0 is end program • 9 is input/output • Operand of 01 is input • Operand of 02 is output
Instructions • First number is Opcode • 3store what is in the accumulator • Operand gives memory location312 = store at location 12 • 5 get a value from memoryput in accumulator • Operand gives memory location512= get value at location 12
Instructions • First number is Opcode • 1/2 add or subtract givenmemory location from valuein accumulator • Operand gives memory location112 = get value from location 12 and add to accumulator
Instructions • First number is Opcode • 6/7/8 set the PC to the valuegiven in the operand • 612 jumps to instruction 12next • 7xx & 8xx look at accumulator to decide ifwe should branch
Data • Program at start of memory • Ends with 0xx instruction (or empty box) • Extra space used to store data • For Store/Load/Add/Subtract • Program can include data • This program always adds 10 to input