Computer Science 251
Computer Organization
Dickinson College
Fall Semester 2001
Grant Braught
Class #3 - Addressing Modes & Arrays
Main Ideas For Today 
- Addressing Modes
- Immediate
- Direct
- Immediate Label
- Indirect
- Array representation
- References
- Implementing Arrays
Lecture Notes 
Homework Assigned Today 
Due Date: 9/18/01
- Consider the following fragment of Java code:
int[] x = {1, 2, 3, 4};
int[] y;
...
y = x;
...
Translate this Java fragment into assembly language. Recall that the assignment y = x does not copy the array but just copies the value of x, which is a reference, into y.
- The following fragment of Java code rotates the values in an array one position to the right. The value at the highest array location wraps arround to the lowest location.
int[] x = new int[20];
...
int tmp = x[19];
for (int i=19; i>=1; i--) {
x[i] = x[i-1];
}
x[0]=tmp;
...
Write an assembly language equivalent of this java program fragment.
Solutions - posted after due date.