================================= Assignment #05 - LMC Intermediate ================================= - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Wednesday October 14, 2009 Due date in the Blackboard Digital Dropbox: due at 08:00 AM on Wednesday October 21, 2009 Answers will be posted after the due date/time 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_05_lmc2.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. Develop an algorithm and then code a program using LMC mnemonic code ("LM-Assembly Language") that inputs two numbers and outputs the difference of the larger minus the smaller. Your program should not assume which number (larger or smaller) will be input first. Give the algorithm (pseudocode) followed by the LMC program here: 2. Convert the LM-Assembler program from the previous question into LM-Numeric machine code. (You may now optionally load and test the code in the LMC Simulator, if you like.) Give the machine code here: 3. Develop an algorithm and then code a program using LMC mnemonic code ("LM-Assembly Language") that outputs the numbers from 002 to 010 inclusive in steps of 2 using only one OUT instruction inside a loop. Give the algorithm (pseudocode) followed by the LMC program here: 4. Convert the LM-Assembler program from the previous question into LM-Numeric machine code. (You may now optionally load and test the code in the LMC Simulator, if you like.) Give the machine code here: 5. Code an LM-Assembler main program and its subroutine. The main program should input two numbers, load the numbers into subroutine argument variables, then call a subroutine that returns in the calculator the difference of the larger minus the smaller. Your subroutine should not assume which number (larger or smaller) will be in which argument. Pass the two input values by copying them to argument/parameter mailboxes within the subroutine before you call the subroutine. Return the value from the subroutine via the Calculator. Give the algorithm (pseudocode) followed by the LMC program here: 6. Convert the LM-Assembler program from the previous question into LM-Numeric machine code. (You may now optionally load and test the code in the LMC Simulator, if you like.) Give the machine code here: 7. Identify the components of an "Object" file and describe the purpose of each component. 8. Explain how a "linker" program uses the relocatable address list, the public (or "global") definition table, and the external reference table (all from within a collection of object files) to generate an "executable" version of a program.