-
Notifications
You must be signed in to change notification settings - Fork 1
/
random.lst
114 lines (95 loc) · 3.64 KB
/
random.lst
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ARM Macro Assembler Page 1
1 00000000 ;Random number generator;
2 00000000 ; Linear congruential generator
3 00000000 ; from Numerical Recipes by Press et al.
4 00000000 ; Jonathan Valvano
5 00000000
6 00000000 ; How to use:
7 00000000 ; 1) call Random_Init once with a seed
8 00000000 ; Random_Init(1);
9 00000000 ; Random_Init(NVIC_CURRENT_R);
10 00000000 ; 2) call Random over and over to get a new random numbe
r
11 00000000 ; n = Random(); // 32 bit number
12 00000000 ; m = (Random()>>24)%60; // a number from 0 to 59
13 00000000
14 00000000 THUMB
15 00000000 AREA DATA, ALIGN=2
16 00000000 00 00 00
00 M SPACE 4
17 00000004 ALIGN
18 00000004 AREA |.text|, CODE, READONLY, ALIGN=
2
19 00000000 EXPORT Random_Init
20 00000000 EXPORT Random
21 00000000 Random_Init
22 00000000 4A06 LDR R2,=M ; R4 = &M, R4 point
s to M
23 00000002 F04F 0001 MOV R0,#1 ; Initial seed
24 00000006 6010 STR R0,[R2] ; M=1
25 00000008 4770 BX LR
26 0000000A ;------------Random------------
27 0000000A ; Return R0= random number
28 0000000A ; Linear congruential generator
29 0000000A ; from Numerical Recipes by Press et al.
30 0000000A 4A04 Random LDR R2,=M ; R2 = &M, R4 point
s to M
31 0000000C 6810 LDR R0,[R2] ; R0=M
32 0000000E 4904 LDR R1,=1664525
33 00000010 FB00 F001 MUL R0,R0,R1 ; R0 = 1664525*M
34 00000014 4903 LDR R1,=1013904223
35 00000016 4408 ADD R0,R1 ; 1664525*M+1013904
223
36 00000018 6010 STR R0,[R2] ; store M
37 0000001A 4770 BX LR
38 0000001C ALIGN
39 0000001C END
00000000
0019660D
3C6EF35F
Command Line: --debug --xref --cpu=Cortex-M4 --apcs=interwork --depend=.\random
.d -o.\random.o -IC:\Keil\ARM\RV31\INC -IC:\Keil\ARM\CMSIS\Include -IC:\Keil\AR
M\Inc\Luminary --predefine="__RTX SETA 1" --predefine="__EVAL SETA 1" --list=.\
random.lst random.s
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
DATA 00000000
Symbol: DATA
Definitions
At line 15 in file random.s
Uses
None
Comment: DATA unused
M 00000000
Symbol: M
Definitions
At line 16 in file random.s
Uses
At line 22 in file random.s
At line 30 in file random.s
2 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.text 00000000
Symbol: .text
Definitions
At line 18 in file random.s
Uses
None
Comment: .text unused
Random 0000000A
Symbol: Random
Definitions
At line 30 in file random.s
Uses
At line 20 in file random.s
Comment: Random used once
Random_Init 00000000
Symbol: Random_Init
Definitions
At line 21 in file random.s
Uses
At line 19 in file random.s
Comment: Random_Init used once
3 symbols
339 symbols in table