Tom Kelliher, CS 240
Jan. 27, 1999
Everyone should ``try'' out their accounts.
To be handed out.
Operands, registers.
Branches. Finally!

# int a, b, c;
# c = a + b;
# Assume a is pointed to by $s0 and that b and c are in
# successive memory locations.
lw $t0, 0($s0)
lw $t1, 4($s0)
add $t0, $t0, $t1
sw $t0 8($s0)
Base, offset addressing.

Endianess.
g = h + A[8];where g is in
$s1, h is in $s2, and the base
address of A, an array of 100 words, is in $s3.
Compile each of the following:
A[12] = h + A[8]; A[j] = h + A[i];
Notes:
struct foo {
int a;
char b;
int c;
};

lw $t0, 0($s0) # load foo.a.
lb $t0, 4($s0) # Etc.
lw $t0, 8($s0)
(Section 3.4)
Instruction formats for instructions we've seen so far:

Field meanings?
addi $t0, $s0, 8 # An immediate operand.
lui $s0, 0x5555
ori $s0, $0, 0xaaaa
$at.