

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: MACHINE ORG&ASSEMBLY LANG PRGRM; Subject: Computer Science; University: University of California-Riverside; Term: Spring 2004;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Collaboration policy: Collaboration on home programming assignments is strictly FORBIDDEN. Programs must represent YOUR OWN original work. Sharing code or team-coding are not allowed. Copying code from ANY source (any book, current or past students, past solutions, the web, etc.) is not allowed. Cooperation to the extent of helping to debug, or discussing the general approach to solving the problem is encouraged, but should never involve communicating code or even pseudo- code or explicit algorithms. Your code must be unique. Instructions: Turn in the following to the folder assn1_021, assn1_022 or assn1_023 (according to your lab section):
Assignment: Repeat the exercise you performed in lab 1 – i.e. multiply two numbers. Place a breakpoint in the indicated place in the code: Program to multiply a number by the constant 6 orig x .ld r1, six .ld r2 numbr ,and r3, r3 #0 ;clear r3 - it will contain the result the loop adds nmbr to itself r1 times (note the use of register decrementing) again .add r3, r3, r2 ;r1 keeps track of place a breakpoint here .add r1 r1, # -1 ;the number of iterations .BRp again .halt nmbr fill # six fill # end WARNING: I have inserted all sorts of horrible little booby traps in the code, so don’t try to copy & paste – it will give you more assembly errors than lines of code. You must figure out the correct format of each line and type it into the LC-3 Editor yourself… Help! Don’t worry – help is at hand: First, the LC-3 simulator handbook at http://highered.mcgraw-hill.com/sites/dl/free/0072467509/104652/LC3WinGuide.pdf Also Appendix A3 (p. 525 ff) of the text, which describes each of the 15 LC-3 assembly language commands; and chapter 7, section 2.2, which describes assembly directives. Also, go back to the lab notes on ilearn, (under the Assignments / labs tab), including the lab tutorial, or check out Shalen’s lab 1 tutorial at http://www.cs.ucr.edu/~schhabra/teaching_assistantship.htm Some of these sources will contain much that you won’t understand yet – that’s ok, you should be able to get the code working anyway. Once you have it working, run it with the break point set. In the accompanying text file, list the contents of R1, R2 and R3 at both the breakpoint and after the program has halted. Grading policy: This assignment will be graded with extreme leniency!