============================ Added LMC Coding Exercise #1 ============================ -IAN! idallen@ncf.ca 1. Download the LMC Simulator. Test it with a very simple program, e.g. assemble this into code and enter it in the LMC mailboxes: LDA ONE ADD ONE OUT HLT ONE DAT 001 Press "RESET COUNTER" and then "GO". See 002 in the output slot? Good. What happens if you forget to push RESET and you push GO a second time? 2. Now try this charming little infinte loop (push HALT to stop it): TOP ADD ONE OUT JMP TOP ONE DAT 001 3. Here's another cute program. It looks like an infinite loop; but, it eventually stops. Try it in the Enhanced or Basic simulator. (If you try it in the Clone simulator, it will eventually ask you for 100 input values, and the Clone simulator will stop and demand that you enter something for each one. The other simulators will just read the current value out of the input box.) Just hit "GO" and watch it run. (Watch the contents of location 03.) You might want to single-step it at first, to see what it is doing. 103 305 203 206 900 001 Translate the program to five-column format (locations, codes, labels, opcodes, and operands). Add helpful comments as a sixth column. Which codes are instructions, and which are data? Questions: a) Hand in the six-column listing from this program. b) Why does this code eventually stop, if there is no HALT instruction in the program? c) What value is in the counter when this program finally stops? d) What value is stored in mailbox 99 when the program stops? e) What is the first and the last value output by this program? (And how is it possible that this program generates any output when there are no output instructions in the program?)