-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl02_t01.s
39 lines (36 loc) · 853 Bytes
/
l02_t01.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
-------------------------------------------------------
l02_t01.s
Assign to and add contents of registers.
-------------------------------------------------------
Author: David Brown
ID: 999999999
Email: dbrown@wlu.ca
Date: 2020-12-13
-------------------------------------------------------
*/
.org 0x1000 // Start at memory location 1000
.text // Code section
.global _start
_start:
// Copy data from memory to registers
LDR R3, =A;
LDR R0, [R3]
LDR R3, =B;
LDR R1, [R3]
ADD R2, R1, R0
// Copy data to memory
LDR R3, =Result // Assign address of Result to R3
STR R2, [R3] // Store contents of R2 to address in R3
// End program
_stop:
B _stop
.data // Initialized data section
A:
.word 4
B:
.word 8
.bss // Uninitialized data section
Result:
.space 4 // Set aside 4 bytes for result
.end