📄 random.lst
字号:
ARM Macro Assembler Page 1
1 00000000 ;#******************************************************
***************************************
2 00000000 ;# File: random.s
*
3 00000000 ;# Author: Wuhan R&D Center, embest
*
4 00000000 ;# Desc: Random number generator
*
5 00000000 ;# This uses a 33-bit feedback shift register
to generate a pseudo-randomly *
6 00000000 ;# ordered sequence of numbers which repeats i
n a cycle of length 2^33 - 1 *
7 00000000 ;# NOTE: randomseed should not be set to 0, ot
herwise a zero will be generated *
8 00000000 ;# continuously (not particularly random
!). *
9 00000000 ;# This is a good application of direct ARM as
sembler, because the 33-bit *
10 00000000 ;# shift register can be implemented using RRX
(which uses reg + carry). *
11 00000000 ;# An ANSI C version would be less efficient a
s the compiler would not use RRX. *
12 00000000 ;# AREA |Random$$code|, CODE, READONLY
*
13 00000000 ;# History: *
14 00000000 ;#******************************************************
***************************************
15 00000000
16 00000000 ;/*-----------------------------------------------------
-------------------------------------*/
17 00000000 ;/* global symbol define */
18 00000000 ;/*-----------------------------------------------------
-------------------------------------*/
19 00000000 global randomnumber
20 00000000 global seed
21 00000000
22 00000000 ;/*-----------------------------------------------------
-------------------------------------*/
23 00000000 ;/* code */
24 00000000 ;/*-----------------------------------------------------
-------------------------------------*/
25 00000000 AREA BLOCK, code , readonly
26 00000000
27 00000000 EXPORT randomnumber
28 00000000 randomnumber
29 00000000 ;# on exit:
30 00000000 ;# a1 = low 32-bits of pseudo-random number
31 00000000 ;# a2 = high bit (if you want to know it)
32 00000000 E59FC01C ldr ip, seedpointer
33 00000004 E89C0003 ldmia ip, {a1, a2}
34 00000008 E11100A1 tst a2, a2, lsr #1 ;/* to bit into
carry */
35 0000000C E1B02060 movs a3, a1, rrx ;/* 33-bit rotate r
ight */
36 00000010 E0A11001 adc a2, a2, a2 ;/* carry into LSB
of a2 */
37 00000014 E0222600 eor a3, a3, a1, lsl #12 ;/* (involv
ed!) */
38 00000018 E0220A22 eor a1, a3, a3, lsr #20 ;/* (simila
ARM Macro Assembler Page 2
rly involved!)*/
39 0000001C E88C0003 stmia ip, {a1, a2}
40 00000020 E12FFF1E BX lr
41 00000024
42 00000024
43 00000024 seedpointer
44 00000024 00000000 DCD seed
45 00000028
46 00000028 seed
47 00000028 55555555 DCD 0x55555555
48 0000002C 55555555 DCD 0x55555555
49 00000030
50 00000030 END
Command Line: --debug --xref --device=DARMST9 --apcs=interwork -o.\obj\random.o
-Id:\Keil\ARM\INC\Samsung --list=.\lst\random.lst random.s
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
BLOCK 00000000
Symbol: BLOCK
Definitions
At line 25 in file random.s
Uses
None
Comment: BLOCK unused
randomnumber 00000000
Symbol: randomnumber
Definitions
At line 28 in file random.s
Uses
At line 19 in file random.s
At line 27 in file random.s
seed 00000028
Symbol: seed
Definitions
At line 46 in file random.s
Uses
At line 20 in file random.s
At line 44 in file random.s
seedpointer 00000024
Symbol: seedpointer
Definitions
At line 43 in file random.s
Uses
At line 32 in file random.s
Comment: seedpointer used once
4 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.debug_info$$$BLOCK 00000000
Symbol: .debug_info$$$BLOCK
Definitions
None
Uses
None
Warning: .debug_info$$$BLOCK undefinedComment: .debug_info$$$BLOCK unused
1 symbol
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.debug_line$$$BLOCK 00000000
Symbol: .debug_line$$$BLOCK
Definitions
None
Uses
None
Warning: .debug_line$$$BLOCK undefinedComment: .debug_line$$$BLOCK unused
1 symbol
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.debug_abbrev 00000000
Symbol: .debug_abbrev
Definitions
None
Uses
None
Warning: .debug_abbrev undefinedComment: .debug_abbrev unused
__ARM_asm.debug_abbrev 00000000
Symbol: __ARM_asm.debug_abbrev
Definitions
None
Uses
None
Warning: __ARM_asm.debug_abbrev undefinedComment: __ARM_asm.debug_abbrev unused
2 symbols
327 symbols in table
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -