493 lines
15 KiB
Plaintext
493 lines
15 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, Swit
|
|
zerland -
|
|
8 00000000 ;* -----------------------------------------------------
|
|
-------------
|
|
9 00000000 ;* --
|
|
10 00000000 ;* -- Project : CT1 - Lab 7
|
|
11 00000000 ;* -- Description : Control structures
|
|
12 00000000 ;* --
|
|
13 00000000 ;* -- $Id: main.s 3748 2016-10-31 13:26:44Z kesr $
|
|
14 00000000 ;* -----------------------------------------------------
|
|
-------------
|
|
15 00000000
|
|
16 00000000
|
|
17 00000000 ; ------------------------------------------------------
|
|
-------------
|
|
18 00000000 ; -- Constants
|
|
19 00000000 ; ------------------------------------------------------
|
|
-------------
|
|
20 00000000
|
|
21 00000000 AREA myCode, CODE, READONLY
|
|
22 00000000
|
|
23 00000000 THUMB
|
|
24 00000000
|
|
25 00000000 60000100
|
|
ADDR_LED_15_0
|
|
EQU 0x60000100
|
|
26 00000000 60000102
|
|
ADDR_LED_31_16
|
|
EQU 0x60000102
|
|
27 00000000 60000114
|
|
ADDR_7_SEG_BIN_DS1_0
|
|
EQU 0x60000114
|
|
28 00000000 60000200
|
|
ADDR_DIP_SWITCH_15_0
|
|
EQU 0x60000200
|
|
29 00000000 60000211
|
|
ADDR_HEX_SWITCH
|
|
EQU 0x60000211
|
|
30 00000000
|
|
31 00000000 0000000B
|
|
NR_CASES
|
|
EQU 0xB
|
|
32 00000000
|
|
33 00000000 jump_table ; ordered table con
|
|
taining the labels
|
|
of all cases
|
|
34 00000000 ; STUDENTS: To be programmed
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 2
|
|
|
|
|
|
35 00000000
|
|
36 00000000
|
|
37 00000000 ; END: To be programmed
|
|
38 00000000
|
|
39 00000000
|
|
40 00000000 ; ------------------------------------------------------
|
|
-------------
|
|
41 00000000 ; -- Main
|
|
42 00000000 ; ------------------------------------------------------
|
|
-------------
|
|
43 00000000
|
|
44 00000000 main PROC
|
|
45 00000000 EXPORT main
|
|
46 00000000
|
|
47 00000000 read_dipsw ; Read operands int
|
|
o R0 and R1 and dis
|
|
play on LEDs
|
|
48 00000000 ; STUDENTS: To be programmed
|
|
49 00000000
|
|
50 00000000 4817 LDR R0, =ADDR_DIP_SWITCH_15_0
|
|
51 00000002 8800 LDRH R0, [R0] ; Load Values of DI
|
|
P Switches 15-0 in
|
|
R0
|
|
52 00000004
|
|
53 00000004 4A17 LDR R2, =ADDR_LED_15_0
|
|
54 00000006 8010 STRH R0, [R2] ; Display R0 on LED
|
|
s 15-0
|
|
55 00000008
|
|
56 00000008 0001 MOVS R1, R0 ; Coppy Bits to R1
|
|
57 0000000A 0A00 LSRS R0, R0, #8 ; Shift Bits in R0
|
|
right to only have
|
|
DIP SWITCH 15-8
|
|
58 0000000C 4A16 LDR R2, =0xff ; Bitmask to get on
|
|
ly lower Byte
|
|
59 0000000E 4011 ANDS R1, R1, R2 ; Only keep lower B
|
|
yte in R1
|
|
60 00000010
|
|
61 00000010 4A14 LDR R2, =ADDR_LED_15_0
|
|
62 00000012 8010 STRH R0, [R2]
|
|
63 00000014
|
|
64 00000014 ; END: To be programmed
|
|
65 00000014
|
|
66 00000014 read_hexsw ; Read operation in
|
|
to R2 and display o
|
|
n 7seg.
|
|
67 00000014 ; STUDENTS: To be programmed
|
|
68 00000014
|
|
69 00000014 4A15 LDR R2, =ADDR_HEX_SWITCH
|
|
70 00000016 7812 LDRB R2, [R2]
|
|
71 00000018
|
|
72 00000018 4B15 LDR R3, =ADDR_7_SEG_BIN_DS1_0
|
|
73 0000001A 701A STRB R2, [R3]
|
|
74 0000001C
|
|
75 0000001C ; END: To be programmed
|
|
76 0000001C
|
|
77 0000001C case_switch ; Implement switch
|
|
statement as shown
|
|
on lecture slide
|
|
78 0000001C ; STUDENTS: To be programmed
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 3
|
|
|
|
|
|
79 0000001C
|
|
80 0000001C 4B15 LDR R3, =0x0a
|
|
81 0000001E 429A CMP R2, R3
|
|
82 00000020 D806 BHI case_bright
|
|
83 00000022
|
|
84 00000022 4B15 LDR R3, =jump_table ; Get Address o
|
|
f Jumptable
|
|
85 00000024 5C9B LDRB R3, [R3, R2] ; Load Label Addre
|
|
ss from J
|
|
86 00000026 4718 BX R3 ; GOTO Speified lab
|
|
el
|
|
87 00000028
|
|
88 00000028 ; END: To be programmed
|
|
89 00000028
|
|
90 00000028
|
|
91 00000028 ; Add the code for the individual cases below
|
|
92 00000028 ; - operand 1 in R0
|
|
93 00000028 ; - operand 2 in R1
|
|
94 00000028 ; - result in R0
|
|
95 00000028
|
|
96 00000028 case_dark
|
|
97 00000028 4814 LDR R0, =0
|
|
98 0000002A E018 B display_result
|
|
99 0000002C
|
|
100 0000002C case_add
|
|
101 0000002C 1840 ADDS R0, R0, R1
|
|
102 0000002E E016 B display_result
|
|
103 00000030
|
|
104 00000030 ; STUDENTS: To be programmed
|
|
105 00000030
|
|
106 00000030 case_bright
|
|
107 00000030 4813 LDR R0, =0xFFFF
|
|
108 00000032 E014 B display_result
|
|
109 00000034
|
|
110 00000034 case_sub
|
|
111 00000034 1A40 SUBS R0, R0, R1
|
|
112 00000036 E012 B display_result
|
|
113 00000038
|
|
114 00000038 case_mult
|
|
115 00000038 4348 MULS R0, R1, R0
|
|
116 0000003A E010 B display_result
|
|
117 0000003C
|
|
118 0000003C case_and
|
|
119 0000003C 4008 ANDS R0, R0, R1
|
|
120 0000003E E00E B display_result
|
|
121 00000040
|
|
122 00000040 case_or
|
|
123 00000040 4308 ORRS R0, R0, R1
|
|
124 00000042 E00C B display_result
|
|
125 00000044
|
|
126 00000044 case_xor
|
|
127 00000044 4048 EORS R0, R0, R1
|
|
128 00000046 E00A B display_result
|
|
129 00000048
|
|
130 00000048 case_not
|
|
131 00000048 43C0 MVNS R0, R0
|
|
132 0000004A E008 B display_result
|
|
133 0000004C
|
|
134 0000004C case_nand
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 4
|
|
|
|
|
|
135 0000004C 4008 ANDS R0, R0, R1
|
|
136 0000004E 43C0 MVNS R0, R0
|
|
137 00000050 E005 B display_result
|
|
138 00000052
|
|
139 00000052 case_nor
|
|
140 00000052 4308 ORRS R0, R0, R1
|
|
141 00000054 43C0 MVNS R0, R0
|
|
142 00000056 E002 B display_result
|
|
143 00000058
|
|
144 00000058 case_xnor
|
|
145 00000058 4048 EORS R0, R0, R1
|
|
146 0000005A 43C0 MVNS R0, R0
|
|
147 0000005C E7FF B display_result
|
|
148 0000005E
|
|
149 0000005E
|
|
150 0000005E ; END: To be programmed
|
|
151 0000005E
|
|
152 0000005E
|
|
153 0000005E display_result ; Display result on
|
|
LEDs
|
|
154 0000005E ; STUDENTS: To be programmed
|
|
155 0000005E
|
|
156 0000005E
|
|
157 0000005E ; END: To be programmed
|
|
158 0000005E
|
|
159 0000005E E7CF B read_dipsw
|
|
160 00000060
|
|
161 00000060 ALIGN
|
|
162 00000060 ENDP
|
|
163 00000060
|
|
164 00000060 ; ------------------------------------------------------
|
|
-------------
|
|
165 00000060 ; -- End of file
|
|
166 00000060 ; ------------------------------------------------------
|
|
-------------
|
|
167 00000060 END
|
|
60000200
|
|
60000100
|
|
000000FF
|
|
60000211
|
|
60000114
|
|
0000000A
|
|
00000000
|
|
00000000
|
|
0000FFFF
|
|
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
|
|
|
|
case_add 0000002C
|
|
|
|
Symbol: case_add
|
|
Definitions
|
|
At line 100 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_add unused
|
|
case_and 0000003C
|
|
|
|
Symbol: case_and
|
|
Definitions
|
|
At line 118 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_and unused
|
|
case_bright 00000030
|
|
|
|
Symbol: case_bright
|
|
Definitions
|
|
At line 106 in file app\main.s
|
|
Uses
|
|
At line 82 in file app\main.s
|
|
Comment: case_bright used once
|
|
case_dark 00000028
|
|
|
|
Symbol: case_dark
|
|
Definitions
|
|
At line 96 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_dark unused
|
|
case_mult 00000038
|
|
|
|
Symbol: case_mult
|
|
Definitions
|
|
At line 114 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_mult unused
|
|
case_nand 0000004C
|
|
|
|
Symbol: case_nand
|
|
Definitions
|
|
At line 134 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_nand unused
|
|
case_nor 00000052
|
|
|
|
Symbol: case_nor
|
|
Definitions
|
|
At line 139 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_nor unused
|
|
case_not 00000048
|
|
|
|
Symbol: case_not
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 2 Alphabetic symbol ordering
|
|
Relocatable symbols
|
|
|
|
Definitions
|
|
At line 130 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_not unused
|
|
case_or 00000040
|
|
|
|
Symbol: case_or
|
|
Definitions
|
|
At line 122 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_or unused
|
|
case_sub 00000034
|
|
|
|
Symbol: case_sub
|
|
Definitions
|
|
At line 110 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_sub unused
|
|
case_switch 0000001C
|
|
|
|
Symbol: case_switch
|
|
Definitions
|
|
At line 77 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_switch unused
|
|
case_xnor 00000058
|
|
|
|
Symbol: case_xnor
|
|
Definitions
|
|
At line 144 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_xnor unused
|
|
case_xor 00000044
|
|
|
|
Symbol: case_xor
|
|
Definitions
|
|
At line 126 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: case_xor unused
|
|
display_result 0000005E
|
|
|
|
Symbol: display_result
|
|
Definitions
|
|
At line 153 in file app\main.s
|
|
Uses
|
|
At line 98 in file app\main.s
|
|
At line 102 in file app\main.s
|
|
At line 108 in file app\main.s
|
|
At line 112 in file app\main.s
|
|
At line 116 in file app\main.s
|
|
At line 120 in file app\main.s
|
|
At line 124 in file app\main.s
|
|
At line 128 in file app\main.s
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 3 Alphabetic symbol ordering
|
|
Relocatable symbols
|
|
|
|
At line 132 in file app\main.s
|
|
At line 137 in file app\main.s
|
|
At line 142 in file app\main.s
|
|
At line 147 in file app\main.s
|
|
|
|
jump_table 00000000
|
|
|
|
Symbol: jump_table
|
|
Definitions
|
|
At line 33 in file app\main.s
|
|
Uses
|
|
At line 84 in file app\main.s
|
|
Comment: jump_table used once
|
|
main 00000000
|
|
|
|
Symbol: main
|
|
Definitions
|
|
At line 44 in file app\main.s
|
|
Uses
|
|
At line 45 in file app\main.s
|
|
Comment: main used once
|
|
myCode 00000000
|
|
|
|
Symbol: myCode
|
|
Definitions
|
|
At line 21 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: myCode unused
|
|
read_dipsw 00000000
|
|
|
|
Symbol: read_dipsw
|
|
Definitions
|
|
At line 47 in file app\main.s
|
|
Uses
|
|
At line 159 in file app\main.s
|
|
Comment: read_dipsw used once
|
|
read_hexsw 00000014
|
|
|
|
Symbol: read_hexsw
|
|
Definitions
|
|
At line 66 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: read_hexsw unused
|
|
19 symbols
|
|
|
|
|
|
|
|
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
|
Absolute symbols
|
|
|
|
ADDR_7_SEG_BIN_DS1_0 60000114
|
|
|
|
Symbol: ADDR_7_SEG_BIN_DS1_0
|
|
Definitions
|
|
At line 27 in file app\main.s
|
|
Uses
|
|
At line 72 in file app\main.s
|
|
Comment: ADDR_7_SEG_BIN_DS1_0 used once
|
|
ADDR_DIP_SWITCH_15_0 60000200
|
|
|
|
Symbol: ADDR_DIP_SWITCH_15_0
|
|
Definitions
|
|
At line 28 in file app\main.s
|
|
Uses
|
|
At line 50 in file app\main.s
|
|
Comment: ADDR_DIP_SWITCH_15_0 used once
|
|
ADDR_HEX_SWITCH 60000211
|
|
|
|
Symbol: ADDR_HEX_SWITCH
|
|
Definitions
|
|
At line 29 in file app\main.s
|
|
Uses
|
|
At line 69 in file app\main.s
|
|
Comment: ADDR_HEX_SWITCH used once
|
|
ADDR_LED_15_0 60000100
|
|
|
|
Symbol: ADDR_LED_15_0
|
|
Definitions
|
|
At line 25 in file app\main.s
|
|
Uses
|
|
At line 53 in file app\main.s
|
|
At line 61 in file app\main.s
|
|
|
|
ADDR_LED_31_16 60000102
|
|
|
|
Symbol: ADDR_LED_31_16
|
|
Definitions
|
|
At line 26 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: ADDR_LED_31_16 unused
|
|
NR_CASES 0000000B
|
|
|
|
Symbol: NR_CASES
|
|
Definitions
|
|
At line 31 in file app\main.s
|
|
Uses
|
|
None
|
|
Comment: NR_CASES unused
|
|
6 symbols
|
|
360 symbols in table
|