-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl2_3.lst
219 lines (205 loc) · 7.93 KB
/
l2_3.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
l2_3.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00000118 0000018c 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000118 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .stab 000006e4 00000000 00000000 0000018c 2**2
CONTENTS, READONLY, DEBUGGING
3 .stabstr 00000cb7 00000000 00000000 00000870 2**0
CONTENTS, READONLY, DEBUGGING
4 .comment 00000011 00000000 00000000 00001527 2**0
CONTENTS, READONLY
5 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00001538 2**2
CONTENTS, READONLY
6 .debug_info 000005f4 00000000 00000000 00001578 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 000005a2 00000000 00000000 00001b6c 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 0000001a 00000000 00000000 0000210e 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000208 00000000 00000000 00002128 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
8: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
10: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
14: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
18: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
1c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
20: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
24: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
28: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
2c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
30: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
34: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
38: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
3c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
40: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
44: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
48: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
4c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
50: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
54: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
58: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
5c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
60: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
64: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
00000068 <__ctors_end>:
68: 11 24 eor r1, r1
6a: 1f be out 0x3f, r1 ; 63
6c: cf ef ldi r28, 0xFF ; 255
6e: d8 e0 ldi r29, 0x08 ; 8
70: de bf out 0x3e, r29 ; 62
72: cd bf out 0x3d, r28 ; 61
74: 0e 94 45 00 call 0x8a ; 0x8a <main>
78: 0c 94 8a 00 jmp 0x114 ; 0x114 <_exit>
0000007c <__bad_interrupt>:
7c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000080 <convert_to_gray_and_set>:
#define LEDs_PORT PORTD
#define BUTTONs_DDR DDRC
#define BUTTONs_PORT PORTC
void convert_to_gray_and_set(uint8_t num){
uint8_t temp = num ^ (num >> 1);
80: 98 2f mov r25, r24
82: 96 95 lsr r25
84: 89 27 eor r24, r25
LEDs_PORT = temp;
86: 8b b9 out 0x0b, r24 ; 11
88: 08 95 ret
0000008a <main>:
}
int main()
{//konfigurowanie portow
UCSR0B &= ~_BV(RXEN0) & ~_BV(TXEN0);
8a: 80 91 c1 00 lds r24, 0x00C1 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
8e: 87 7e andi r24, 0xE7 ; 231
90: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
LEDs_DDR |= 0b11111111;
94: 8a b1 in r24, 0x0a ; 10
96: 8f ef ldi r24, 0xFF ; 255
98: 8a b9 out 0x0a, r24 ; 10
LEDs_PORT &= 0b00000000;
9a: 8b b1 in r24, 0x0b ; 11
9c: 1b b8 out 0x0b, r1 ; 11
BUTTONs_DDR &= 0b11111000;
9e: 87 b1 in r24, 0x07 ; 7
a0: 88 7f andi r24, 0xF8 ; 248
a2: 87 b9 out 0x07, r24 ; 7
BUTTONs_PORT |= 0b00000111;
a4: 88 b1 in r24, 0x08 ; 8
a6: 87 60 ori r24, 0x07 ; 7
a8: 88 b9 out 0x08, r24 ; 8
// program testowany
uint8_t pressed1 = 0, pressed2 = 0, pressed3 = 0, num = 0;
aa: 20 e0 ldi r18, 0x00 ; 0
ac: 50 e0 ldi r21, 0x00 ; 0
ae: 40 e0 ldi r20, 0x00 ; 0
b0: 30 e0 ldi r19, 0x00 ; 0
b2: 1a c0 rjmp .+52 ; 0xe8 <main+0x5e>
while(1) {
//czy naciśnięto guzik kolejnego kodu Gray-a
if (!(PINC & 0b00000001) && !pressed1){
b4: 31 11 cpse r19, r1
b6: 1a c0 rjmp .+52 ; 0xec <main+0x62>
num ++;
b8: 2f 5f subi r18, 0xFF ; 255
pressed1 = 1;
ba: 31 e0 ldi r19, 0x01 ; 1
} else if((PINC & 0b00000001) && pressed1)
pressed1 = 0;
//czy naciśnięto guzik poprzedniego kodu Gray-a
if (!(PINC & 0b00000010) && !pressed2){
bc: 31 99 sbic 0x06, 1 ; 6
be: 1b c0 rjmp .+54 ; 0xf6 <main+0x6c>
c0: 41 11 cpse r20, r1
c2: 19 c0 rjmp .+50 ; 0xf6 <main+0x6c>
num --;
c4: 21 50 subi r18, 0x01 ; 1
pressed2 = 1;
c6: 41 e0 ldi r20, 0x01 ; 1
} else if((PINC & 0b00000010) && pressed2)
pressed2 = 0;
//czy naciśnięto guzik resetowanie kodu Gray-a
if (!(PINC & 0b00000100) && !pressed3){
c8: 96 b1 in r25, 0x06 ; 6
ca: 89 2f mov r24, r25
cc: 84 70 andi r24, 0x04 ; 4
ce: 92 fd sbrc r25, 2
d0: 1a c0 rjmp .+52 ; 0x106 <main+0x7c>
d2: 51 11 cpse r21, r1
d4: 18 c0 rjmp .+48 ; 0x106 <main+0x7c>
num = 0;
d6: 20 e0 ldi r18, 0x00 ; 0
pressed3 = 1;
d8: 51 e0 ldi r21, 0x01 ; 1
#define BUTTONs_DDR DDRC
#define BUTTONs_PORT PORTC
void convert_to_gray_and_set(uint8_t num){
uint8_t temp = num ^ (num >> 1);
LEDs_PORT = temp;
da: 8b b9 out 0x0b, r24 ; 11
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
dc: 8f e3 ldi r24, 0x3F ; 63
de: 9c e9 ldi r25, 0x9C ; 156
e0: 01 97 sbiw r24, 0x01 ; 1
e2: f1 f7 brne .-4 ; 0xe0 <main+0x56>
e4: 00 c0 rjmp .+0 ; 0xe6 <main+0x5c>
e6: 00 00 nop
BUTTONs_PORT |= 0b00000111;
// program testowany
uint8_t pressed1 = 0, pressed2 = 0, pressed3 = 0, num = 0;
while(1) {
//czy naciśnięto guzik kolejnego kodu Gray-a
if (!(PINC & 0b00000001) && !pressed1){
e8: 30 9b sbis 0x06, 0 ; 6
ea: e4 cf rjmp .-56 ; 0xb4 <main+0x2a>
num ++;
pressed1 = 1;
} else if((PINC & 0b00000001) && pressed1)
ec: 30 9b sbis 0x06, 0 ; 6
ee: e6 cf rjmp .-52 ; 0xbc <main+0x32>
pressed1 = 0;
f0: 30 e0 ldi r19, 0x00 ; 0
//czy naciśnięto guzik poprzedniego kodu Gray-a
if (!(PINC & 0b00000010) && !pressed2){
f2: 31 9b sbis 0x06, 1 ; 6
f4: e5 cf rjmp .-54 ; 0xc0 <main+0x36>
num --;
pressed2 = 1;
} else if((PINC & 0b00000010) && pressed2)
f6: 31 9b sbis 0x06, 1 ; 6
f8: e7 cf rjmp .-50 ; 0xc8 <main+0x3e>
pressed2 = 0;
fa: 40 e0 ldi r20, 0x00 ; 0
//czy naciśnięto guzik resetowanie kodu Gray-a
if (!(PINC & 0b00000100) && !pressed3){
fc: 96 b1 in r25, 0x06 ; 6
fe: 89 2f mov r24, r25
100: 84 70 andi r24, 0x04 ; 4
102: 92 ff sbrs r25, 2
104: e6 cf rjmp .-52 ; 0xd2 <main+0x48>
106: 82 2f mov r24, r18
108: 86 95 lsr r24
10a: 82 27 eor r24, r18
num = 0;
pressed3 = 1;
} else if((PINC & 0b00000100) && pressed3)
10c: 32 9b sbis 0x06, 2 ; 6
10e: e5 cf rjmp .-54 ; 0xda <main+0x50>
pressed3 = 0;
110: 50 e0 ldi r21, 0x00 ; 0
112: e3 cf rjmp .-58 ; 0xda <main+0x50>
00000114 <_exit>:
114: f8 94 cli
00000116 <__stop_program>:
116: ff cf rjmp .-2 ; 0x116 <__stop_program>