########## Ex 5.23 ############################# # NAME: Rumana Haque # TA's NAME: none, (July 97) # DESCRIPTION: Chapter 5, Example 23, Maccabe text pg 192 ID = 0 # id is at offset 0 AGE = 4 # age is at offset 2 SALARY = 8 # salary is at offset 4 P_SIZE = 12 # the size of each person struct .data dept : .space 120 # 120 = 10*12 = 10*P_SIZE i : .space 4 .text .globl main main: lw $8,i # $8 is going to be an index mul $8,$8,P_SIZE # scale $8 by element size la $8,dept($8) # $8 points to the structure li $11,56 sw $11,AGE($8) # dept->AGE = 56 lw $9,AGE($8) addi $9,$9,1 # increment age sw $9,AGE($8) lw $10,AGE($8) li $v0,1 move $a0,$10 # put value for printing syscall # print li $v0,10 #exit syscall #END OF PROGRAM (leave this line here)