-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram_01_aaron.s
More file actions
61 lines (49 loc) · 978 Bytes
/
program_01_aaron.s
File metadata and controls
61 lines (49 loc) · 978 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.text
.global _main
main:
@ load in a,b,c
LDR r3, =a
LDR r3,[r3]
LDR r4, =b
LDR r4, [r4]
LDR r5, =c
LDR r5, [r5]
CMP r3, r4 @compare a and b
BGE a_greater_b
BLT b_greater_a
B error
a_greater_b:
CMP r3,r5 @compare a and c
BGE a_greater_all
BLT c_greater_all
B error
b_greater_a:
CMP r4, r5 @compare c and b
BGE b_greater_all
BLT c_greater_all
B error
a_greater_all:
LDR r1, =MessageA @load MessageA
B EXIT
b_greater_all: @ load MessageB
LDR r1, =MessageB
B EXIT
c_greater_all: @load MessageC
LDR r1, =MessageC
B EXIT
error:
LDR r1, =MessageError @ load MessageError
B EXIT
EXIT:
@ print out result
MOV r0, #1
SWI 0x69
SWI 0x11
.data
MessageA: .asciz "message_A: A > B and A > C"
MessageB: .asciz "message_B: B > C and B > A"
MessageC: .asciz "message_C: C > B and C > A"
MessageError: .asciz "error"
a: .word 12
b: .word 13
c: .word 115