541 lines
18 KiB
Plaintext
541 lines
18 KiB
Plaintext
|
|
|
|
|
|
ARM Macro Assembler Page 1
|
|
|
|
|
|
1 00000000 ; ------------------------------------------------------
|
|
------------
|
|
2 00000000 ; -- _____ ______ _____
|
|
-
|
|
3 00000000 ; -- |_ _| | ____|/ ____|
|
|
-
|
|
4 00000000 ; -- | | _ __ | |__ | (___ Institute of Embedded
|
|
Systems -
|
|
5 00000000 ; -- | | | '_ \| __| \___ \ Zurich University of
|
|
-
|
|
6 00000000 ; -- _| |_| | | | |____ ____) | Applied Sciences
|
|
-
|
|
7 00000000 ; -- |_____|_| |_|______|_____/ 8401 Winterthur, Switz
|
|
erland -
|
|
8 00000000 ; ------------------------------------------------------
|
|
------------
|
|
9 00000000 ; --
|
|
10 00000000 ; -- main.s
|
|
11 00000000 ; --
|
|
12 00000000 ; -- CT1 P06 "ALU und Sprungbefehle" mit MUL
|
|
13 00000000 ; --
|
|
14 00000000 ; -- $Id: main.s 4857 2019-09-10 17:30:17Z akdi $
|
|
15 00000000 ; ------------------------------------------------------
|
|
------------
|
|
16 00000000 ;Directives
|
|
17 00000000 PRESERVE8
|
|
18 00000000 THUMB
|
|
19 00000000
|
|
20 00000000 ; ------------------------------------------------------
|
|
------------
|
|
21 00000000 ; -- Address Defines
|
|
22 00000000 ; ------------------------------------------------------
|
|
------------
|
|
23 00000000
|
|
24 00000000 60000100
|
|
ADDR_LED_15_0
|
|
EQU 0x60000100
|
|
25 00000000 60000102
|
|
ADDR_LED_31_16
|
|
EQU 0x60000102
|
|
26 00000000 60000200
|
|
ADDR_DIP_SWITCH_7_0
|
|
EQU 0x60000200
|
|
27 00000000 60000201
|
|
ADDR_DIP_SWITCH_15_8
|
|
EQU 0x60000201
|
|
28 00000000 60000114
|
|
ADDR_7_SEG_BIN_DS3_0
|
|
EQU 0x60000114
|
|
29 00000000 60000210
|
|
ADDR_BUTTONS
|
|
EQU 0x60000210
|
|
30 00000000
|
|
31 00000000 60000340
|
|
ADDR_LCD_RED
|
|
EQU 0x60000340
|
|
32 00000000 60000342
|
|
ADDR_LCD_GREEN
|
|
EQU 0x60000342
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 2
|
|
|
|
|
|
33 00000000 60000344
|
|
ADDR_LCD_BLUE
|
|
EQU 0x60000344
|
|
34 00000000 0000FFFF
|
|
LCD_BACKLIGHT_FULL
|
|
EQU 0xffff
|
|
35 00000000 00000000
|
|
LCD_BACKLIGHT_OFF
|
|
EQU 0x0000
|
|
36 00000000
|
|
37 00000000 0000000F
|
|
MASK_LOW_NIBBLE
|
|
EQU 0xf
|
|
38 00000000 0000000A
|
|
FACTOR_10
|
|
EQU 0xa
|
|
39 00000000 00000001
|
|
BITMASK_KEY_T0
|
|
EQU 0x01
|
|
40 00000000
|
|
41 00000000 ; ------------------------------------------------------
|
|
------------
|
|
42 00000000 ; -- myCode
|
|
43 00000000 ; ------------------------------------------------------
|
|
------------
|
|
44 00000000 AREA myCode, CODE, READONLY
|
|
45 00000000
|
|
46 00000000 ENTRY
|
|
47 00000000
|
|
48 00000000 main PROC
|
|
49 00000000 export main
|
|
50 00000000
|
|
51 00000000 ; STUDENTS: To be programmed
|
|
52 00000000
|
|
53 00000000 4A23 LDR R2, =MASK_LOW_NIBBLE
|
|
54 00000002
|
|
55 00000002 ; Load BCD Tens in R0
|
|
56 00000002 4824 LDR R0, =ADDR_DIP_SWITCH_15_8
|
|
57 00000004 7800 LDRB R0, [R0]
|
|
58 00000006 4010 ANDS R0, R0, R2
|
|
59 00000008
|
|
60 00000008 ; Load BCD Ones in R1
|
|
61 00000008 4923 LDR R1, =ADDR_DIP_SWITCH_7_0
|
|
62 0000000A 7809 LDRB R1, [R1]
|
|
63 0000000C 4011 ANDS R1, R1, R2
|
|
64 0000000E
|
|
65 0000000E ; Check if T0 is pressed. If pressed goto CalcByMult
|
|
66 0000000E 4B23 LDR R3, =ADDR_BUTTONS ; load base a
|
|
ddress of keys
|
|
67 00000010 4C23 LDR R4, =BITMASK_KEY_T0
|
|
; load key mask T0
|
|
68 00000012 781A LDRB R2, [R3] ; load key values
|
|
69 00000014 4222 TST R2, R4 ; check, if key T0
|
|
is pressed
|
|
70 00000016 D00A BEQ CalcByMult ; goto CalcByMult
|
|
71 00000018
|
|
72 00000018
|
|
73 00000018 CalcByBitShift
|
|
74 00000018 ; set the LCD background to red
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 3
|
|
|
|
|
|
75 00000018 4A22 LDR R2, =ADDR_LCD_RED
|
|
76 0000001A 4B23 LDR R3, =0xffff
|
|
77 0000001C 8013 STRH R3, [R2]
|
|
78 0000001E 4A23 LDR R2, =ADDR_LCD_BLUE
|
|
79 00000020 4B23 LDR R3, =0x0
|
|
80 00000022 8013 STRH R3, [R2]
|
|
81 00000024
|
|
82 00000024 ; Calculate Bin Value to R2 by Bit Shifting
|
|
83 00000024 ; R2 = R0 * 10
|
|
84 00000024 00C2 LSLS R2, R0, #3
|
|
85 00000026 0043 LSLS R3, R0, #1
|
|
86 00000028 18D2 ADDS R2, R2, R3
|
|
87 0000002A 1852 ADDS R2, R2, R1
|
|
88 0000002C
|
|
89 0000002C EndCalcByBitShift
|
|
90 0000002C
|
|
91 0000002C ; goto EndCalcByMult
|
|
92 0000002C E008 B EndCalcByMult
|
|
93 0000002E
|
|
94 0000002E CalcByMult
|
|
95 0000002E
|
|
96 0000002E ; set the LCD background to blue
|
|
97 0000002E 4A1D LDR R2, =ADDR_LCD_RED
|
|
98 00000030 4B1F LDR R3, =0x0
|
|
99 00000032 8013 STRH R3, [R2]
|
|
100 00000034 4A1D LDR R2, =ADDR_LCD_BLUE
|
|
101 00000036 4B1C LDR R3, =0xffff
|
|
102 00000038 8013 STRH R3, [R2]
|
|
103 0000003A
|
|
104 0000003A ; Calculate Bin Value to R2 by Multiplication
|
|
105 0000003A ; R2 = R0 * 10
|
|
106 0000003A 4A1E LDR R2, =FACTOR_10
|
|
107 0000003C 4342 MULS R2, R0, R2
|
|
108 0000003E 1852 ADDS R2, R2, R1
|
|
109 00000040
|
|
110 00000040 EndCalcByMult
|
|
111 00000040
|
|
112 00000040 ; Shift BCD Tens in high Nibble in R0
|
|
113 00000040 ; Add BCD Ones in low Nibble in R0
|
|
114 00000040 0100 LSLS R0, R0, #4
|
|
115 00000042 4308 ORRS R0, R0, R1
|
|
116 00000044
|
|
117 00000044 ; Add Bin Value in higher Byte in R0
|
|
118 00000044 0212 LSLS R2, R2, #8
|
|
119 00000046 4310 ORRS R0, R0, R2
|
|
120 00000048
|
|
121 00000048 ; Show R0 on LEDs 15-0
|
|
122 00000048 4B1B LDR R3, =ADDR_LED_15_0
|
|
123 0000004A 8018 STRH R0, [R3]
|
|
124 0000004C
|
|
125 0000004C ; Show R0 on 7-Segment
|
|
126 0000004C 4B1B LDR R3, =ADDR_7_SEG_BIN_DS3_0
|
|
127 0000004E 8018 STRH R0, [R3]
|
|
128 00000050
|
|
129 00000050 ; Count positive Bits in Higher Byte of R2 to R1
|
|
130 00000050 4917 LDR R1, =0 ; initialize R1 wit
|
|
h 0
|
|
131 00000052 4B13 LDR R3, =0x1 ; mask to set first
|
|
bit and to substra
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 4
|
|
|
|
|
|
ct counter
|
|
132 00000054 4C1A LDR R4, =9 ; counter for loop
|
|
133 00000056 0412 LSLS R2, R2, #16
|
|
134 00000058 CheckBitLoop
|
|
135 00000058 1AE4 SUBS R4, R4, R3
|
|
136 0000005A D004 BEQ EndCheckBitLoop ; goto EndCheck
|
|
BitLoop if R4 (coun
|
|
ter) = 0
|
|
137 0000005C 0052 LSLS R2, R2, #1 ; Shift Bits in R2
|
|
138 0000005E D3FB BCC CheckBitLoop ; goto CheckBitLoo
|
|
p if carry = 0
|
|
139 00000060 4319 ORRS R1, R3 ; Add Carry to R1
|
|
140 00000062 0049 LSLS R1, R1, #1 ; Shift Bits in R1
|
|
141 00000064 E7F8 B CheckBitLoop
|
|
; goto checkBitLoop
|
|
|
|
142 00000066 EndCheckBitLoop
|
|
143 00000066 0849 LSRS R1, R1, #1 ; Shift Bits in R1
|
|
144 00000068
|
|
145 00000068 ; Rotate LEDs 31-16
|
|
146 00000068 4A16 LDR R2, =ADDR_LED_31_16
|
|
147 0000006A 4C17 LDR R4, =17 ; Counter for LedRo
|
|
tationLoop
|
|
148 0000006C LedRotationLoop
|
|
149 0000006C 1AE4 SUBS R4, R4, R3
|
|
150 0000006E D007 BEQ EndLedRotationLoop ; goto EndCh
|
|
eckBitLoop if R4 (c
|
|
ounter) = 0
|
|
151 00000070 F7FF FFFE BL pause
|
|
152 00000074 8011 STRH R1, [R2] ; Show R1 on LEDs 3
|
|
1-16
|
|
153 00000076 460D MOV R5, R1 ; Coppy R1 to R5
|
|
154 00000078 042D LSLS R5, R5, #16 ; Shift Bits in R5
|
|
155 0000007A 4329 ORRS R1, R1, R5 ; Coppy lower bytes
|
|
of R1 in upper byt
|
|
es in R1
|
|
156 0000007C 41D9 RORS R1, R1, R3
|
|
157 0000007E E7F5 B LedRotationLoop
|
|
158 00000080 EndLedRotationLoop
|
|
159 00000080
|
|
160 00000080 ; END: To be programmed
|
|
161 00000080
|
|
162 00000080 E7FE B main
|
|
163 00000082 ENDP
|
|
164 00000082
|
|
165 00000082 ;----------------------------------------------------
|
|
166 00000082 ; Subroutines
|
|
167 00000082 ;----------------------------------------------------
|
|
168 00000082
|
|
169 00000082 ;----------------------------------------------------
|
|
170 00000082 ; pause for disco_lights
|
|
171 00000082 pause PROC
|
|
172 00000082 B403 PUSH {R0, R1}
|
|
173 00000084 4906 LDR R1, =1
|
|
174 00000086 4811 LDR R0, =0x000FFFFF
|
|
175 00000088
|
|
176 00000088 loop
|
|
177 00000088 1A40 SUBS R0, R0, R1
|
|
178 0000008A D2FD BCS loop
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 5
|
|
|
|
|
|
179 0000008C
|
|
180 0000008C BC03 POP {R0, R1}
|
|
181 0000008E 4770 BX LR
|
|
182 00000090 ALIGN
|
|
183 00000090 ENDP
|
|
184 00000090
|
|
185 00000090 ; ------------------------------------------------------
|
|
------------
|
|
186 00000090 ; End of code
|
|
187 00000090 ; ------------------------------------------------------
|
|
------------
|
|
188 00000090 END
|
|
0000000F
|
|
60000201
|
|
60000200
|
|
60000210
|
|
00000001
|
|
60000340
|
|
0000FFFF
|
|
60000344
|
|
00000000
|
|
0000000A
|
|
60000100
|
|
60000114
|
|
00000009
|
|
60000102
|
|
00000011
|
|
000FFFFF
|
|
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M0 --depend=.\bu
|
|
ild\main.d -o.\build\main.o -I.\RTE\_Target_1 -IC:\Users\roman\AppData\Local\Ar
|
|
m\Packs\InES\CTBoard14_DFP\4.0.2\Device\Include -IC:\Users\roman\AppData\Local\
|
|
Arm\Packs\InES\CTBoard14_DFP\4.0.2\Device\Include\m0 -IC:\Users\roman\AppData\L
|
|
ocal\Arm\Packs\InES\CTBoard14_DFP\4.0.2\HAL\Include --predefine="__EVAL SETA 1"
|
|
--predefine="__UVISION_VERSION SETA 537" --predefine="_RTE_ SETA 1" --predefin
|
|
e="_RTE_ SETA 1" --list=.\build\main.lst app\main.s
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
|
Relocatable symbols
|
|
|
|
CalcByBitShift 00000018
|
|
|
|
Symbol: CalcByBitShift
|
|
Definitions
|
|
At line 73 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: CalcByBitShift unused
|
|
CalcByMult 0000002E
|
|
|
|
Symbol: CalcByMult
|
|
Definitions
|
|
At line 94 in file app\main.s
|
|
Uses
|
|
At line 70 in file app\main.s
|
|
Comment: CalcByMult used once
|
|
CheckBitLoop 00000058
|
|
|
|
Symbol: CheckBitLoop
|
|
Definitions
|
|
At line 134 in file app\main.s
|
|
Uses
|
|
At line 138 in file app\main.s
|
|
At line 141 in file app\main.s
|
|
|
|
EndCalcByBitShift 0000002C
|
|
|
|
Symbol: EndCalcByBitShift
|
|
Definitions
|
|
At line 89 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: EndCalcByBitShift unused
|
|
EndCalcByMult 00000040
|
|
|
|
Symbol: EndCalcByMult
|
|
Definitions
|
|
At line 110 in file app\main.s
|
|
Uses
|
|
At line 92 in file app\main.s
|
|
Comment: EndCalcByMult used once
|
|
EndCheckBitLoop 00000066
|
|
|
|
Symbol: EndCheckBitLoop
|
|
Definitions
|
|
At line 142 in file app\main.s
|
|
Uses
|
|
At line 136 in file app\main.s
|
|
Comment: EndCheckBitLoop used once
|
|
EndLedRotationLoop 00000080
|
|
|
|
Symbol: EndLedRotationLoop
|
|
Definitions
|
|
At line 158 in file app\main.s
|
|
Uses
|
|
At line 150 in file app\main.s
|
|
Comment: EndLedRotationLoop used once
|
|
LedRotationLoop 0000006C
|
|
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 2 Alphabetic symbol ordering
|
|
Relocatable symbols
|
|
|
|
Symbol: LedRotationLoop
|
|
Definitions
|
|
At line 148 in file app\main.s
|
|
Uses
|
|
At line 157 in file app\main.s
|
|
Comment: LedRotationLoop used once
|
|
loop 00000088
|
|
|
|
Symbol: loop
|
|
Definitions
|
|
At line 176 in file app\main.s
|
|
Uses
|
|
At line 178 in file app\main.s
|
|
Comment: loop used once
|
|
main 00000000
|
|
|
|
Symbol: main
|
|
Definitions
|
|
At line 48 in file app\main.s
|
|
Uses
|
|
At line 49 in file app\main.s
|
|
At line 162 in file app\main.s
|
|
|
|
myCode 00000000
|
|
|
|
Symbol: myCode
|
|
Definitions
|
|
At line 44 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: myCode unused
|
|
pause 00000082
|
|
|
|
Symbol: pause
|
|
Definitions
|
|
At line 171 in file app\main.s
|
|
Uses
|
|
At line 151 in file app\main.s
|
|
Comment: pause used once
|
|
12 symbols
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
|
Absolute symbols
|
|
|
|
ADDR_7_SEG_BIN_DS3_0 60000114
|
|
|
|
Symbol: ADDR_7_SEG_BIN_DS3_0
|
|
Definitions
|
|
At line 28 in file app\main.s
|
|
Uses
|
|
At line 126 in file app\main.s
|
|
Comment: ADDR_7_SEG_BIN_DS3_0 used once
|
|
ADDR_BUTTONS 60000210
|
|
|
|
Symbol: ADDR_BUTTONS
|
|
Definitions
|
|
At line 29 in file app\main.s
|
|
Uses
|
|
At line 66 in file app\main.s
|
|
Comment: ADDR_BUTTONS used once
|
|
ADDR_DIP_SWITCH_15_8 60000201
|
|
|
|
Symbol: ADDR_DIP_SWITCH_15_8
|
|
Definitions
|
|
At line 27 in file app\main.s
|
|
Uses
|
|
At line 56 in file app\main.s
|
|
Comment: ADDR_DIP_SWITCH_15_8 used once
|
|
ADDR_DIP_SWITCH_7_0 60000200
|
|
|
|
Symbol: ADDR_DIP_SWITCH_7_0
|
|
Definitions
|
|
At line 26 in file app\main.s
|
|
Uses
|
|
At line 61 in file app\main.s
|
|
Comment: ADDR_DIP_SWITCH_7_0 used once
|
|
ADDR_LCD_BLUE 60000344
|
|
|
|
Symbol: ADDR_LCD_BLUE
|
|
Definitions
|
|
At line 33 in file app\main.s
|
|
Uses
|
|
At line 78 in file app\main.s
|
|
At line 100 in file app\main.s
|
|
|
|
ADDR_LCD_GREEN 60000342
|
|
|
|
Symbol: ADDR_LCD_GREEN
|
|
Definitions
|
|
At line 32 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: ADDR_LCD_GREEN unused
|
|
ADDR_LCD_RED 60000340
|
|
|
|
Symbol: ADDR_LCD_RED
|
|
Definitions
|
|
At line 31 in file app\main.s
|
|
Uses
|
|
At line 75 in file app\main.s
|
|
At line 97 in file app\main.s
|
|
|
|
ADDR_LED_15_0 60000100
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 2 Alphabetic symbol ordering
|
|
Absolute symbols
|
|
|
|
|
|
Symbol: ADDR_LED_15_0
|
|
Definitions
|
|
At line 24 in file app\main.s
|
|
Uses
|
|
At line 122 in file app\main.s
|
|
Comment: ADDR_LED_15_0 used once
|
|
ADDR_LED_31_16 60000102
|
|
|
|
Symbol: ADDR_LED_31_16
|
|
Definitions
|
|
At line 25 in file app\main.s
|
|
Uses
|
|
At line 146 in file app\main.s
|
|
Comment: ADDR_LED_31_16 used once
|
|
BITMASK_KEY_T0 00000001
|
|
|
|
Symbol: BITMASK_KEY_T0
|
|
Definitions
|
|
At line 39 in file app\main.s
|
|
Uses
|
|
At line 67 in file app\main.s
|
|
Comment: BITMASK_KEY_T0 used once
|
|
FACTOR_10 0000000A
|
|
|
|
Symbol: FACTOR_10
|
|
Definitions
|
|
At line 38 in file app\main.s
|
|
Uses
|
|
At line 106 in file app\main.s
|
|
Comment: FACTOR_10 used once
|
|
LCD_BACKLIGHT_FULL 0000FFFF
|
|
|
|
Symbol: LCD_BACKLIGHT_FULL
|
|
Definitions
|
|
At line 34 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: LCD_BACKLIGHT_FULL unused
|
|
LCD_BACKLIGHT_OFF 00000000
|
|
|
|
Symbol: LCD_BACKLIGHT_OFF
|
|
Definitions
|
|
At line 35 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: LCD_BACKLIGHT_OFF unused
|
|
MASK_LOW_NIBBLE 0000000F
|
|
|
|
Symbol: MASK_LOW_NIBBLE
|
|
Definitions
|
|
At line 37 in file app\main.s
|
|
Uses
|
|
At line 53 in file app\main.s
|
|
Comment: MASK_LOW_NIBBLE used once
|
|
14 symbols
|
|
361 symbols in table
|