Arrays in Assembly Programs
One reason for lw syntax is arrays
keep the base address in a register
lw and sw on offsets into the array
Example:
int A[10];
A[0] = 0;
A[1] = 0;
# addr of A in $t0
sw $0, 0($t0)
sw $0, 4($t0)
Previous slide
Next slide
Back to first slide
View graphic version