What are addressing modes? Describe different types of addressing modes. code example

Example 1: different addressing modes

.data
student: .word 10000 #field code
.ascii "Smith" #field name
.byte # field test
.byte 80,80,90,100 # fields hw1,hw2,hw3,hw4
.text
__start:
la $3, student 	# load address of the structure in $3
		# $3 base register
add $17,$0,90 	# value 90 in register $17
		# displacement of field "test" is 9 bytes
		#
sb $17, 9($3) 	# store contents of register $17 in field "test"
		# displacement addressing mode
done

Example 2: different addressing modes

add $14,$14,$13     # add contents of register $13 plus contents of 
		    # register $14 and save the result in register $14

Tags:

Misc Example