====================================================== Assignment #07 - Little Man Computer Intermediate ====================================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Monday November 15, 2010 Upload due date in the Blackboard Assignment Area: Upload "assignment07.txt" before 19:00 (7pm) on Monday November 22, 2010 Answers will be posted shortly after the due date/time and discussed in class, if there are any questions about the answers. Submission method: Upload via the "Assignments" assignment07 upload. Use the file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only. Did I mention that the format is plain text (e.g. using Notepad)? Answers will be posted after the due date/time so that you can check your answers before coming to class and ask questions about the answers 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 - I'll presume you know the material. Questions similar to ones on these assignments will appear on your tests and exams. Not all assignments will be marked. See the Week 1 Notes for details. ============================================================================== Edit this file and answer the following questions, showing the method or formula you used to get the answer, if appropriate. Upload the file containing the methods, formulas, questions and answers before the due date. Some of the answers below will require reading the links published in the weekly course notes. ============================================================================== 0. What is the date, time, and room of your Final Exam? 1. What is the difference between a Symbol and a Label? (trick question) 2. What is the difference between a Public Symbol and a Global Symbol? (trick question) 3. What is the purpose of the LMC mnemonic pseudo-instruction ORG? See the LMC_bootstrap.html example. 4. What is the purpose of the LMC mnemonic pseudo-instruction PUB? See the LMC_link.html example. 5. What is the purpose of the LMC mnemonic pseudo-instruction EXT? See the LMC_link.html example. 6. Code the pseudocode below in LMC assembly language. Identify constants and variables. Use the pseudocode as comments to the right of the associated LMC assembly language, as done in LMC_sample6.txt and LMC_sample7.txt. (Reference: LMC_control.html) int x = 10 while ( x != 0 ) { output --x } 7. Code the pseudocode below in LMC assembly language. Identify constants and variables. Use the pseudocode as comments to the right of the associated LMC assembly language, as done in LMC_sample6.txt and LMC_sample7.txt. (Reference: LMC_control.html) int x input x if ( x <= 5 ) { output x } else { output 10-x } 8. Develop an algorithm and then code a program using LMC mnemonic code ("LM-Assembly Language") that inputs two numbers and outputs the smaller number followed by the larger number followed by the sum. Your program should not assume which number (larger or smaller) will be input first. Identify constants and variables. Use the pseudocode as comments to the right of the associated LMC assembly language, as done in LMC_sample6.txt and LMC_sample7.txt. (Reference: LMC_control.html) Give the algorithm (pseudocode) followed by the LMC program here: 9. Develop an algorithm and then code a program using LMC mnemonic code ("LM-Assembly Language") that reads in ten input numbers (from the input slot) and produces two half-sums as output, SUMA and SUMB: SUMA - a sum of input numbers 1,3,5,7,9 SUMB - a sum of input numbers 2,4,6,8,10 Identify constants and variables. Use the pseudocode as comments to the right of the associated LMC assembly language, as done in LMC_sample6.txt and LMC_sample7.txt. (Reference: LMC_control.html). Give the algorithm (pseudocode) followed by the LMC program here: 10. Identify the four components of an "Object" file and describe the purpose of each component in your own words. 11. In your own words, explain how a "linker" program uses the relocatable address list, the public (or "global") label definition table, and the external reference table (all from within a collection of object files) to generate an "executable" version of a program. -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/