CSCI 370: IAS
Overview
- Let A, B, and C be arrays of 100 integers. Assume the arrays begin at locations 500, 600, and 700, respectively. Write an IAS program to compute C[J] = A[J] + B[J], for J = 99, 98, ā¦, 0. You MUST start at the end of each array and work your way toward the beginning. This will result in cleaner, more concise and efficient code.
I have started the program for you below. You MUST use this tabular format. Fill in missing cells and add as many rows as necessary (as a hint, the last address should be LESS THAN 14L). Note integer data are stored in locations 0, 1, and 2, and instructions begin at 3L.
Make your comments as descriptive as possible, using variables like āJā instead of memory addresses.
Hint: Your code will have to modify itself using the address modify instructions (there are two of them).
Location Contents Comment
-------- -------- -------
0 1 Constant
1 100 Constant
2 99 J
3L LOAD M(?) AC <-- A[J]
3R ? AC <-- A[J] + B[J]
4L ? Write C[J]
4R LOAD M(2) ?
5L ? AC <-- J - 1
5R ? Branch to 6R if AC >= 0
6L HALT Terminate program
...
How does the CPU read from memory? Mention the MAR and MBR registers, what they represent, and how they are used.
Why are the address modify instructions vital to the code above?
Additional Requirements
Use ONLY the 21 IAS instructions given in the slides, and use the SAME syntax.
Write a comment for every line, making it as descriptive as possible.
Format your IAS program NEATLY as above.
Number your answers to match the questions.
Use blank lines between paragraphs and questions.
cat
your file at the command line to ensure it is plain text and formatted properly.Keep lines 80 characters or less.
If you submit a non-plain text file you will receive a ZERO.
Submission
Submit your PLAIN TEXT file using Autolab. Ensure your file ONLY consists of printable characters and is neatly formatted, PARTICULARLY the table that contains the IAS program.