-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path086 7seg8.s
66 lines (55 loc) · 1.1 KB
/
086 7seg8.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Some testing code
.global _start
_start:
ldr r0, =8
bl hexdisplay
1: b 1b // done
// Your function starts here:
hexdisplay:
push {r4}
ldr r4, =pattern
mov r3, r0
mov r1, #0
mov r2, #0xf
and r2, r3, lsr #28
ldrb r2, [r4, r2]
orr r1, r2
lsl r1, #8
mov r2, #0xf
and r2, r3, lsr #24
ldrb r2, [r4, r2]
orr r1, r2
lsl r1, #8
mov r2, #0xf
and r2, r3, lsr #20
ldrb r2, [r4, r2]
orr r1, r2
lsl r1, #8
mov r2, #0xf
and r2, r3, lsr #16
ldrb r2, [r4, r2]
orr r1, r2
mov r0, #0
mov r2, #0xf
and r2, r3, lsr #12
ldrb r2, [r4, r2]
orr r0, r2
lsl r0, #8
mov r2, #0xf
and r2, r3, lsr #8
ldrb r2, [r4, r2]
orr r0, r2
lsl r0, #8
mov r2, #0xf
and r2, r3, lsr #4
ldrb r2, [r4, r2]
orr r0, r2
lsl r0, #8
mov r2, #0xf
and r2, r3, lsr #0
ldrb r2, [r4, r2]
orr r0, r2
pop {r4}
bx lr
pattern:
.byte 0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x7, 0x7f, 0x6f, 0x77, 0x7c, 0x58, 0x5e, 0x79, 0x71