CSCI 370: IAS

Overview

  1. 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         
...
  1. How does the CPU read from memory? Mention the MAR and MBR registers, what they represent, and how they are used.

  2. Why are the address modify instructions vital to the code above?

Additional Requirements

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.