ARM Addressing Modes

Objective of this lab:


	To explore ARM addressing modes and implement them in Keil uVision 5 

Preparation


	Read lab lecture notes.

Lab Assignment

Program#1:

Write an ARM assembly language program AddGT.s to add up all the numbers that are great than 5 in the number array NUM1. Look at the following given code for more details and complete it.

;The semicolon is used to lead an inline documentation
;When you write your program, you could have your info at the top document lock
;For Example:  Your Name, Student Number, what the program is for, and what it does etc.

;;; Directives
          PRESERVE8
          THUMB       
 
; Vector Table Mapped to Address 0 at Reset
; Linker requires __Vectors to be exported
 
          AREA    RESET, DATA, READONLY
          EXPORT  __Vectors
 
__Vectors 
	  DCD  0x20001000     ; stack pointer value when stack is empty
          DCD  Reset_Handler  ; reset vector
  
          ALIGN
		  
;Your Data section
	;AREA DATA
SUM 	DCD 0
SUMP    DCD SUM
N 	DCD 7
NUM1 	DCD 3, -7, 2, -2, 10, 20, 30
POINTER DCD NUM1

 
; The program
; Linker requires Reset_Handler
 
          AREA    MYCODE, CODE, READONLY
 
   	  ENTRY
   	  EXPORT Reset_Handler
 
 
Reset_Handler

;;;;;;;;;;User Code Start from the next line;;;;;;;;;;;;

;	Please complete the program to add up all the 
;	numbers in the array NUM1 that are greater than 5.
;	Put the sum in the register R0.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Hint: Check the example in the lab notes.

You will hand in the following:

  1. The source code in the file AddGT.s
  2. The screenshot (print screen) to show the program has been successfully built
  3. The screenshot showing the sum in R0.

Program#2:

Write an ARM assembly language program Min-Max.s to find the maximum value and the minimum value in the number array NUM1. Look at the following given code for more details and complete it.

;The semicolon is uded to lead an inline documentation
;When you write your program, you could have your info at the top document lock
;For Example:  Your Name, Student Number, what the program is for, and what it does etc.

;;; Directives
          PRESERVE8
          THUMB       
 
; Vector Table Mapped to Address 0 at Reset
; Linker requires __Vectors to be exported
 
          AREA    RESET, DATA, READONLY
          EXPORT  __Vectors
 
__Vectors 
	  DCD  0x20001000     ; stack pointer value when stack is empty
          DCD  Reset_Handler  ; reset vector
  
          ALIGN
		  
;Your Data section
	;AREA DATA
Max 	DCD 0
MaxP 	DCD Max
Min	DCD 0
MinP	DCD Min

N 	DCD 12
NUM1 	DCD 3, -7, 2, -2, 10, 20, 30, 15, 32, 8, 64, 66
POINTER DCD NUM1

 
; The program
; Linker requires Reset_Handler
 
          AREA    MYCODE, CODE, READONLY
 
   	  ENTRY
   	  EXPORT Reset_Handler
 
 
Reset_Handler

;;;;;;;;;;User Code Start from the next line;;;;;;;;;;;;;;;;;

;	Add code below to find the maximum value and 
;	the minimum value in the number array NUM1.
;	You can use the example in the notes as a reference.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

You will hand in the following:

  1. The source code in the file Min-Max.s
  2. The screenshot (print screen) to show the program has been successfully built
  3. The screenshot showing the Min in R5 and the Max in R6.


Copyright: Department of Computer Science, University of Regina.