Computer Organization and Assembly Language - Assignment 1 | CS 061, Assignments of Computer Science

Material Type: Assignment; Class: MACHINE ORG&ASSEMBLY LANG PRGRM; Subject: Computer Science; University: University of California-Riverside; Term: Spring 2004;

Typology: Assignments

Pre 2010

Uploaded on 03/28/2010

koofers-user-j23
koofers-user-j23 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 061 – Computer Org. & Assembly Lang. Spring - 2004
Assignment 1 - due Saturday 4/3, 11 pm (e-turnin)
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):
1. the .asm source code file – i.e. the file produced by the LC-3 Editor.
Do NOT include the .obj, .exe, etc. files that are created when you assemble the source
code.
2. a plain text file (with extension .txt) with answers to the questions below.
Remember to include in BOTH files your personal header (the initial semicolons indicate comments
in LC-3 source code)::
;Name: (last name, first name)
;Student id:
;Login id:
;Email address:
;Lab section:
;Assignment name: (in this case, assn 1)
pf2

Partial preview of the text

Download Computer Organization and Assembly Language - Assignment 1 | CS 061 and more Assignments Computer Science in PDF only on Docsity!

CS 061 – Computer Org. & Assembly Lang. Spring - 2004

Assignment 1 - due Saturday 4/3, 11 pm (e-turnin)

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):

  1. the .asm source code file – i.e. the file produced by the LC-3 Editor. Do NOT include the .obj, .exe, etc. files that are created when you assemble the source code.
  2. a plain text file (with extension .txt ) with answers to the questions below. Remember to include in BOTH files your personal header (the initial semicolons indicate comments in LC-3 source code):: ;Name: (last name, first name) ;Student id: ;Login id: ;Email address: ;Lab section: ;Assignment name: (in this case, assn 1)

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!