Instructions
Objective
Write an ARM assignment program to run assembly language program executed in Keil ARM simulator assignment solution.
Requirements and Specifications

Screenshots of output



Source Code
Program 1
PRESERVE8
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD 0x20008000 ; initial stack pointer
DCD Reset_Handler ; reset vector
ALIGN
AREA Program1, CODE
ENTRY
EXPORT Reset_Handler
Reset_Handler ; start of program
LDR R0, =0xAABBCCDD ; initialize R0 with the required value
LDR R1, =0x20004000 ; load R1 with the address to save value
STR R0, [R1] ; save R0 value in given address
; convert to big endian
MOV R0, #0 ; clear r0 to save big endian number
MOV R2, #0 ; clear r2 to use it as index
LOOP
LDRB R3, [R1, R2] ; load byte from number
LSL R0, R0, #8 ; move number 1 byte left
ADD R0, R0, R3 ; add loaded byte to big endian number
ADD R2, R2, #1 ; increment index
CMP R2, #4 ; compare index with 4
BLT LOOP ; repeat while index < 4
STR R0, [R1] ; save big endian number
DONE
B DONE ; infinite loop to end program
ALIGN
END
Program 2
PRESERVE8
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD 0x20008000 ; initial stack pointer
DCD Reset_Handler ; reset vector
ALIGN
AREA Program2, CODE
ENTRY
EXPORT Reset_Handler
Reset_Handler ; start of program
MOV R1, #1 ; initialize R1 with the required value
MOV R2, #2 ; initialize R2 with the required value
MOV R3, #3 ; initialize R3 with the required value
MOV R4, #4 ; initialize R4 with the required value
MOV R5, #5 ; initialize R5 with the required value
MOV R6, #6 ; initialize R6 with the required value
MOV R7, #7 ; initialize R7 with the required value
MOV R8, #8 ; initialize R8 with the required value
MOV R9, #9 ; initialize R9 with the required value
MOV R10, #10 ; initialize R10 with the required value
LDR R0, =0x20004000 ; load R0 with the address to save registers
STMIA R0, {R1-R10} ; save registers R1-R10 starting in the given address
; add saved values
MOV R0, #0 ; clear r0 to save sum
LDR R1, =0x20004000 ; load R1 with the address to save registers
MOV R2, #10 ; load 10 in R2 to sum 10 values
LOOP
LDR R3, [R1], #4 ; load value, advance pointer after load
ADD R0, R0, R3 ; add loaded value to sum
SUBS R2, R2, #1 ; decrement values to sum
BNE LOOP ; repeat while not zero
DONE
B DONE ; infinite loop to end program
ALIGN
END