============================ Added LMC Coding Exercise #2 ============================ -IAN! idallen@ncf.ca 1. Read the web page named with the button "LMC Control" under the "Resources" button on the course home page. Note in particular the structure of a WHILE loop, and how similar it is to an IF statement. 2. Translate the following pseudocode algorithm fragment into the LMC mnemonics and data items that make up a complete LMC program: x = 953 while x >= 66 x = x * 2 - 10 endwhile output x Use the method outlined in the "LMC Control" page for picking an order of subtraction and a SKIP instruction. My program turned out to be 14 instructions plus 4 data items (3 constants and one variable). Your version may differ slightly. Do not optimize your generated code. Doing so makes the code hard to read and modify. 3. Hand-assemble the mnemonics into LMC numeric codes starting at zero. (Number the instructions; make a label table; generate codes.) You should have a five-column listing, plus comments. 4. Enter the numeric codes into the LMC simulator and run the program. (Note that since the program reads no input and has only one output, you don't need to use NEXT I/O. Just hit GO!) What is the final (only) value output by running the program? (Testing Hint #1: If you change 66 to 953, the output value is 896.) (Testing Hint #2: If you change 66 to 896, the output value is 782.) 5. Reset the counter to zero and run the program a second time. Do you get the same answer? If not, your program isn't correct. Hand in: a) The five-column (plus comments) program listing from Step 3. b) The value output by running the program in Step 4.