=========================== Assignment #04 - LMC Basics =========================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Thursday October 8, 2009 Due date in the Blackboard Digital Dropbox: due at 08:00 AM on Wednesday October 14, 2009 Answers will be posted after 8AM on Wednesday so that you can check your answers before coming to class and ask questions in class. Please check your answers (and my answers!). I go over each assignment in class if there are questions about the answers. No questions means no review. See the heading "Homework Exercises / Assignments" in the week01notes.txt file (in the course notes) for the marking scheme for this assignment. Upload drop box file name template: abcd0001_04_lmc.txt Use your own userid, not abcd0001. The rest of the name must be exactly as given. Typing mistakes in the name mean no credit. Be precise. Upload only plain text, not HTML, not MSWord. No fonts. Plain text only. Plain text only. Did I mention that the format is plain text? ------------------ 1. List the Instruction Cycle activities for the Little Man Computer (LMC). ANSWER: 2. For each of the following situations, assume that the Accumulator starts with the value 600. For each question, give the final value in the Accumulator and indicate which of the three indicator light(s) (Z, N, and P) is turned on: 2.1. 400 is added to the 600 in the accumulator. ANSWERS: 2.2. 700 is subtracted from the 600 in the accumulator and then 500 is subtracted from the accumulator. ANSWERS: 2.3. 800 is added to the 600 in the accumulator. ANSWERS: 2.4 601 is subtracted from the 600 in the accumulator. ANSWERS: 3. With reference to the full extended LMC opcode table (lmc_opcodes.htm), which LMC instruction(s) would not work "properly" if the LM incremented the counter *after* performing the instruction instead of before? ANSWER: 4. List the output which would be generated if the following numeric code were entered into the LMC mailboxes starting at address 00, and then the LM was awakened. (You may want to translate this numeric program into more readable LMC mnemonics before understanding it!) 111 412 802 908 211 313 600 901 413 600 700 010 004 001 ANSWER: 5. What is the purpose of the LMC mnemonic pseudo-instructions: DAT and ORG? ANSWER: 6. Translate the following LMC mnemonic code ("assembly language") into LMC numeric code ("machine language") starting in mailbox 00: LDA total SUB total STO total IN STO count rpete LDA count SUB one STO count SKP JMP done IN ADD total STO total JMP rpete done LDA total OUT HLT total DAT count DAT one DAT 001 ANSWER: 7. Re-code the previous LMC mnemonic program into a Java or C++ program that performs, as closely as possible, the same opearations in the same order. Do not optimize your program or re-order the statments. ANSWER: