Rev 1254 Rev 1296
Line 1... Line 1...
1   1  
2 glg.elf: file format elf32-avr 2 glg.elf: file format elf32-avr
3   3  
4 Sections: 4 Sections:
5 Idx Name Size VMA LMA File off Algn 5 Idx Name Size VMA LMA File off Algn
6 0 .data 00000006 00800100 000022ec 00002360 2**0 6 0 .data 0000000c 00800100 00002a28 00002a9c 2**0
7 CONTENTS, ALLOC, LOAD, DATA 7 CONTENTS, ALLOC, LOAD, DATA
8 1 .text 000022ec 00000000 00000000 00000074 2**1 8 1 .text 00002a28 00000000 00000000 00000074 2**1
9 CONTENTS, ALLOC, LOAD, READONLY, CODE 9 CONTENTS, ALLOC, LOAD, READONLY, CODE
10 2 .bss 00000341 00800106 000022f2 00002366 2**0 10 2 .bss 00000341 0080010c 00002a34 00002aa8 2**0
11 ALLOC 11 ALLOC
12 3 .stab 0000087c 00000000 00000000 00002368 2**2 12 3 .stab 00002040 00000000 00000000 00002aa8 2**2
13 CONTENTS, READONLY, DEBUGGING 13 CONTENTS, READONLY, DEBUGGING
14 4 .stabstr 0000019e 00000000 00000000 00002be4 2**0 14 4 .stabstr 00000db4 00000000 00000000 00004ae8 2**0
15 CONTENTS, READONLY, DEBUGGING 15 CONTENTS, READONLY, DEBUGGING
16 5 .debug_aranges 00000060 00000000 00000000 00002d82 2**0 16 5 .debug_aranges 00000060 00000000 00000000 0000589c 2**0
17 CONTENTS, READONLY, DEBUGGING 17 CONTENTS, READONLY, DEBUGGING
18 6 .debug_pubnames 0000019e 00000000 00000000 00002de2 2**0 18 6 .debug_pubnames 0000019e 00000000 00000000 000058fc 2**0
19 CONTENTS, READONLY, DEBUGGING 19 CONTENTS, READONLY, DEBUGGING
20 7 .debug_info 00001cfd 00000000 00000000 00002f80 2**0 20 7 .debug_info 00001f60 00000000 00000000 00005a9a 2**0
21 CONTENTS, READONLY, DEBUGGING 21 CONTENTS, READONLY, DEBUGGING
22 8 .debug_abbrev 000007a6 00000000 00000000 00004c7d 2**0 22 8 .debug_abbrev 000007b9 00000000 00000000 000079fa 2**0
23 CONTENTS, READONLY, DEBUGGING 23 CONTENTS, READONLY, DEBUGGING
24 9 .debug_line 000019a4 00000000 00000000 00005423 2**0 24 9 .debug_line 00001b85 00000000 00000000 000081b3 2**0
25 CONTENTS, READONLY, DEBUGGING 25 CONTENTS, READONLY, DEBUGGING
26 10 .debug_frame 00000260 00000000 00000000 00006dc8 2**2 26 10 .debug_frame 00000200 00000000 00000000 00009d38 2**2
27 CONTENTS, READONLY, DEBUGGING 27 CONTENTS, READONLY, DEBUGGING
28 11 .debug_str 000005e7 00000000 00000000 00007028 2**0 28 11 .debug_str 000005cc 00000000 00000000 00009f38 2**0
29 CONTENTS, READONLY, DEBUGGING 29 CONTENTS, READONLY, DEBUGGING
30 12 .debug_loc 000020ca 00000000 00000000 0000760f 2**0 30 12 .debug_loc 00002af1 00000000 00000000 0000a504 2**0
31 CONTENTS, READONLY, DEBUGGING 31 CONTENTS, READONLY, DEBUGGING
32 13 .debug_ranges 00000178 00000000 00000000 000096d9 2**0 32 13 .debug_ranges 000001d0 00000000 00000000 0000cff5 2**0
33 CONTENTS, READONLY, DEBUGGING 33 CONTENTS, READONLY, DEBUGGING
34 Disassembly of section .text: 34 Disassembly of section .text:
35   35  
36 00000000 <__vectors>: 36 00000000 <__vectors>:
37 0: 0c 94 4c 00 jmp 0x98 ; 0x98 <__ctors_end> 37 0: 0c 94 41 00 jmp 0x82 ; 0x82 <__ctors_end>
38 4: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 38 4: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
39 8: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 39 8: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
40 c: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 40 c: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
41 10: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 41 10: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
42 14: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 42 14: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
43 18: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 43 18: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
44 1c: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 44 1c: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
45 20: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 45 20: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
46 24: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 46 24: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
47 28: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 47 28: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
48 2c: 0c 94 7a 01 jmp 0x2f4 ; 0x2f4 <__vector_11> 48 2c: 0c 94 18 03 jmp 0x630 ; 0x630 <__vector_11>
49 30: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 49 30: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
50 34: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 50 34: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
51 38: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 51 38: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
52 3c: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 52 3c: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
53 40: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 53 40: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
54 44: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 54 44: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
55 48: 0c 94 d6 00 jmp 0x1ac ; 0x1ac <__vector_18> 55 48: 0c 94 b5 00 jmp 0x16a ; 0x16a <__vector_18>
56 4c: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 56 4c: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
57 50: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 57 50: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
58 54: 0c 94 6b 00 jmp 0xd6 ; 0xd6 <__vector_21> 58 54: 0c 94 60 00 jmp 0xc0 ; 0xc0 <__vector_21>
59 58: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 59 58: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
60 5c: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 60 5c: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
61 60: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 61 60: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
62 64: 0c 94 69 00 jmp 0xd2 ; 0xd2 <__bad_interrupt> 62 64: 0c 94 5e 00 jmp 0xbc ; 0xbc <__bad_interrupt>
63   63  
64 00000068 <__c.2081>: 64 00000068 <__c.1757>:
65 68: 0d 0a 00 ... 65 68: 24 47 50 52 4d 43 00 $GPRMC.
66   66  
67 0000006b <__c.2079>: 67 0000006f <__c.1755>:
68 6b: 2c 00 ,. 68 6f: 24 47 50 47 47 41 00 $GPGGA.
69   69  
70 0000006d <__c.2075>: 70 00000076 <__c.1753>:
71 6d: 24 47 50 52 4d 43 00 $GPRMC. 71 76: 2e 6c 6f 67 00 .log.
72   72  
73 00000074 <__c.2073>: 73 0000007b <__c.1747>:
74 74: 24 47 50 47 47 41 00 $GPGGA. 74 7b: 24 47 50 52 4d 43 00 $GPRMC.
75   75  
76 0000007b <__c.2071>: 76 00000082 <__ctors_end>:
-   77 82: 11 24 eor r1, r1
-   78 84: 1f be out 0x3f, r1 ; 63
77 7b: 2e 6c 6f 67 00 .log. 79 86: cf ef ldi r28, 0xFF ; 255
-   80 88: d4 e0 ldi r29, 0x04 ; 4
-   81 8a: de bf out 0x3e, r29 ; 62
-   82 8c: cd bf out 0x3d, r28 ; 61
78   83  
79 00000080 <__c.2065>: 84 0000008e <__do_copy_data>:
80 80: 24 47 50 52 4d 43 00 $GPRMC. 85 8e: 11 e0 ldi r17, 0x01 ; 1
81   -  
82 00000087 <__c.2014>: 86 90: a0 e0 ldi r26, 0x00 ; 0
-   87 92: b1 e0 ldi r27, 0x01 ; 1
-   88 94: e8 e2 ldi r30, 0x28 ; 40
-   89 96: fa e2 ldi r31, 0x2A ; 42
83 87: 24 50 53 52 46 31 30 36 2c 32 31 2a 30 46 0d 0a $PSRF106,21*0F.. 90 98: 02 c0 rjmp .+4 ; 0x9e <.do_copy_data_start>
84 ... -  
85   91  
86 00000098 <__ctors_end>: 92 0000009a <.do_copy_data_loop>:
87 98: 11 24 eor r1, r1 93 9a: 05 90 lpm r0, Z+
88 9a: 1f be out 0x3f, r1 ; 63 94 9c: 0d 92 st X+, r0
-   95  
89 9c: cf ef ldi r28, 0xFF ; 255 96 0000009e <.do_copy_data_start>:
90 9e: d4 e0 ldi r29, 0x04 ; 4 97 9e: ac 30 cpi r26, 0x0C ; 12
91 a0: de bf out 0x3e, r29 ; 62 98 a0: b1 07 cpc r27, r17
92 a2: cd bf out 0x3d, r28 ; 61 99 a2: d9 f7 brne .-10 ; 0x9a <.do_copy_data_loop>
93   100  
94 000000a4 <__do_copy_data>: 101 000000a4 <__do_clear_bss>:
95 a4: 11 e0 ldi r17, 0x01 ; 1 102 a4: 14 e0 ldi r17, 0x04 ; 4
96 a6: a0 e0 ldi r26, 0x00 ; 0 103 a6: ac e0 ldi r26, 0x0C ; 12
97 a8: b1 e0 ldi r27, 0x01 ; 1 104 a8: b1 e0 ldi r27, 0x01 ; 1
98 aa: ec ee ldi r30, 0xEC ; 236 -  
99 ac: f2 e2 ldi r31, 0x22 ; 34 -  
100 ae: 02 c0 rjmp .+4 ; 0xb4 <.do_copy_data_start> -  
101   -  
102 000000b0 <.do_copy_data_loop>: -  
103 b0: 05 90 lpm r0, Z+ -  
104 b2: 0d 92 st X+, r0 -  
105   -  
106 000000b4 <.do_copy_data_start>: -  
107 b4: a6 30 cpi r26, 0x06 ; 6 -  
108 b6: b1 07 cpc r27, r17 -  
109 b8: d9 f7 brne .-10 ; 0xb0 <.do_copy_data_loop> -  
110   -  
111 000000ba <__do_clear_bss>: -  
112 ba: 14 e0 ldi r17, 0x04 ; 4 -  
113 bc: a6 e0 ldi r26, 0x06 ; 6 -  
114 be: b1 e0 ldi r27, 0x01 ; 1 -  
115 c0: 01 c0 rjmp .+2 ; 0xc4 <.do_clear_bss_start> 105 aa: 01 c0 rjmp .+2 ; 0xae <.do_clear_bss_start>
116   -  
117 000000c2 <.do_clear_bss_loop>: -  
118 c2: 1d 92 st X+, r1 -  
119   -  
120 000000c4 <.do_clear_bss_start>: -  
121 c4: a7 34 cpi r26, 0x47 ; 71 -  
122 c6: b1 07 cpc r27, r17 -  
123 c8: e1 f7 brne .-8 ; 0xc2 <.do_clear_bss_loop> -  
124 ca: 0e 94 ba 01 call 0x374 ; 0x374 <main> -  
125 ce: 0c 94 75 11 jmp 0x22ea ; 0x22ea <_exit> -  
126   106  
127 000000d2 <__bad_interrupt>: 107 000000ac <.do_clear_bss_loop>:
128 d2: 0c 94 00 00 jmp 0 ; 0x0 <__heap_end> 108 ac: 1d 92 st X+, r1
129   109  
-   110 000000ae <.do_clear_bss_start>:
-   111 ae: ad 34 cpi r26, 0x4D ; 77
-   112 b0: b1 07 cpc r27, r17
-   113 b2: e1 f7 brne .-8 ; 0xac <.do_clear_bss_loop>
-   114 b4: 0e 94 35 01 call 0x26a ; 0x26a <main>
-   115 b8: 0c 94 12 15 jmp 0x2a24 ; 0x2a24 <_exit>
-   116  
-   117 000000bc <__bad_interrupt>:
-   118 bc: 0c 94 00 00 jmp 0 ; 0x0 <__heap_end>
-   119  
130 000000d6 <__vector_21>: 120 000000c0 <__vector_21>:
131 /*---------------------------------------------------------*/ 121 /*---------------------------------------------------------*/
132 /* ADC interrupt */ 122 /* ADC interrupt */
133 /*---------------------------------------------------------*/ 123 /*---------------------------------------------------------*/
134   124  
135 ISR(ADC_vect) 125 ISR(ADC_vect)
136 { 126 {
137 d6: 1f 92 push r1 127 c0: 1f 92 push r1
138 d8: 0f 92 push r0 128 c2: 0f 92 push r0
139 da: 0f b6 in r0, 0x3f ; 63 129 c4: 0f b6 in r0, 0x3f ; 63
140 dc: 0f 92 push r0 130 c6: 0f 92 push r0
141 de: 11 24 eor r1, r1 131 c8: 11 24 eor r1, r1
142 e0: 2f 93 push r18 132 ca: 2f 93 push r18
143 e2: 3f 93 push r19 133 cc: 3f 93 push r19
144 e4: 8f 93 push r24 134 ce: 8f 93 push r24
145 WORD n; 135 WORD n;
146 static BYTE l, h; 136 static BYTE l, h;
147   137  
148 n = ADC; 138 n = ADC;
149 e6: 20 91 78 00 lds r18, 0x0078 139 d0: 20 91 78 00 lds r18, 0x0078
150 ea: 30 91 79 00 lds r19, 0x0079 140 d4: 30 91 79 00 lds r19, 0x0079
151   141  
152 if(ADMUX == POWER_check) 142 if(ADMUX == POWER_check)
153 ee: 80 91 7c 00 lds r24, 0x007C 143 d8: 80 91 7c 00 lds r24, 0x007C
154 { 144 {
155 if (n < VTH_LOW) { 145 if (n < VTH_LOW) {
156 f2: 20 3d cpi r18, 0xD0 ; 208 146 dc: 20 3d cpi r18, 0xD0 ; 208
157 f4: 31 05 cpc r19, r1 147 de: 31 05 cpc r19, r1
158 f6: 70 f4 brcc .+28 ; 0x114 <__vector_21+0x3e> 148 e0: 70 f4 brcc .+28 ; 0xfe <__vector_21+0x3e>
159 if (l >= 15) { 149 if (l >= 15) {
160 f8: 80 91 09 01 lds r24, 0x0109 150 e2: 80 91 0f 01 lds r24, 0x010F
161 fc: 8f 30 cpi r24, 0x0F ; 15 151 e6: 8f 30 cpi r24, 0x0F ; 15
162 fe: 30 f0 brcs .+12 ; 0x10c <__vector_21+0x36> 152 e8: 30 f0 brcs .+12 ; 0xf6 <__vector_21+0x36>
163 Stat |= 0x01; 153 Stat |= 0x01;
164 100: 80 91 69 01 lds r24, 0x0169 154 ea: 80 91 6f 01 lds r24, 0x016F
165 104: 81 60 ori r24, 0x01 ; 1 155 ee: 81 60 ori r24, 0x01 ; 1
166 106: 80 93 69 01 sts 0x0169, r24 156 f0: 80 93 6f 01 sts 0x016F, r24
167 10a: 06 c0 rjmp .+12 ; 0x118 <__vector_21+0x42> 157 f4: 06 c0 rjmp .+12 ; 0x102 <__vector_21+0x42>
168 } 158 }
169 else {l++;} 159 else {l++;}
170 10c: 8f 5f subi r24, 0xFF ; 255 160 f6: 8f 5f subi r24, 0xFF ; 255
171 10e: 80 93 09 01 sts 0x0109, r24 161 f8: 80 93 0f 01 sts 0x010F, r24
172 112: 02 c0 rjmp .+4 ; 0x118 <__vector_21+0x42> 162 fc: 02 c0 rjmp .+4 ; 0x102 <__vector_21+0x42>
173 } 163 }
174 else {l = 0;} 164 else {l = 0;}
175 114: 10 92 09 01 sts 0x0109, r1 165 fe: 10 92 0f 01 sts 0x010F, r1
176   166  
177 if (n > VTH_HIGH) { 167 if (n > VTH_HIGH) {
178 118: 81 e0 ldi r24, 0x01 ; 1 168 102: 81 e0 ldi r24, 0x01 ; 1
179 11a: 2c 32 cpi r18, 0x2C ; 44 169 104: 2c 32 cpi r18, 0x2C ; 44
180 11c: 38 07 cpc r19, r24 170 106: 38 07 cpc r19, r24
181 11e: 70 f0 brcs .+28 ; 0x13c <__vector_21+0x66> 171 108: 70 f0 brcs .+28 ; 0x126 <__vector_21+0x66>
182 if (h >= 15) { 172 if (h >= 15) {
183 120: 80 91 08 01 lds r24, 0x0108 173 10a: 80 91 0e 01 lds r24, 0x010E
184 124: 8f 30 cpi r24, 0x0F ; 15 174 10e: 8f 30 cpi r24, 0x0F ; 15
185 126: 30 f0 brcs .+12 ; 0x134 <__vector_21+0x5e> 175 110: 30 f0 brcs .+12 ; 0x11e <__vector_21+0x5e>
186 Stat &= 0xFE; 176 Stat &= 0xFE;
187 128: 80 91 69 01 lds r24, 0x0169 177 112: 80 91 6f 01 lds r24, 0x016F
188 12c: 8e 7f andi r24, 0xFE ; 254 178 116: 8e 7f andi r24, 0xFE ; 254
189 12e: 80 93 69 01 sts 0x0169, r24 179 118: 80 93 6f 01 sts 0x016F, r24
190 132: 06 c0 rjmp .+12 ; 0x140 <__vector_21+0x6a> 180 11c: 06 c0 rjmp .+12 ; 0x12a <__vector_21+0x6a>
191 } 181 }
192 else {h++;} 182 else {h++;}
193 134: 8f 5f subi r24, 0xFF ; 255 183 11e: 8f 5f subi r24, 0xFF ; 255
194 136: 80 93 08 01 sts 0x0108, r24 184 120: 80 93 0e 01 sts 0x010E, r24
195 13a: 02 c0 rjmp .+4 ; 0x140 <__vector_21+0x6a> 185 124: 02 c0 rjmp .+4 ; 0x12a <__vector_21+0x6a>
196 } 186 }
197 else {h = 0;} 187 else {h = 0;}
198 13c: 10 92 08 01 sts 0x0108, r1 188 126: 10 92 0e 01 sts 0x010E, r1
199   189  
200 battery = n; 190 battery = n;
201 140: 30 93 6f 01 sts 0x016F, r19 191 12a: 30 93 75 01 sts 0x0175, r19
202 144: 20 93 6e 01 sts 0x016E, r18 192 12e: 20 93 74 01 sts 0x0174, r18
203 ADMUX = ANALOG_IN1; 193 ADMUX = ANALOG_IN1;
204 148: 82 e4 ldi r24, 0x42 ; 66 194 132: 82 e4 ldi r24, 0x42 ; 66
205 14a: 80 93 7c 00 sts 0x007C, r24 195 134: 80 93 7c 00 sts 0x007C, r24
206 } 196 }
207   197  
208 if(ADMUX == ANALOG_IN1) 198 if(ADMUX == ANALOG_IN1)
209 14e: 80 91 7c 00 lds r24, 0x007C 199 138: 80 91 7c 00 lds r24, 0x007C
210 { 200 {
211 intensity = n; 201 intensity = n;
212 152: 30 93 0a 02 sts 0x020A, r19 202 13c: 30 93 10 02 sts 0x0210, r19
213 156: 20 93 09 02 sts 0x0209, r18 203 140: 20 93 0f 02 sts 0x020F, r18
214 ADMUX = POWER_check; 204 ADMUX = POWER_check;
215 15a: 81 e4 ldi r24, 0x41 ; 65 205 144: 81 e4 ldi r24, 0x41 ; 65
216 15c: 80 93 7c 00 sts 0x007C, r24 206 146: 80 93 7c 00 sts 0x007C, r24
217 } 207 }
218   208  
219 //!!!! 209 //!!!!
220 //Stat &= 0xFE; 210 //Stat &= 0xFE;
221   211  
222 ADCSRA = _BV(ADEN)|_BV(ADSC)|_BV(ADIF)|_BV(ADIE)|0b111; 212 ADCSRA = _BV(ADEN)|_BV(ADSC)|_BV(ADIF)|_BV(ADIE)|0b111;
223 160: 8f ed ldi r24, 0xDF ; 223 213 14a: 8f ed ldi r24, 0xDF ; 223
224 162: 80 93 7a 00 sts 0x007A, r24 214 14c: 80 93 7a 00 sts 0x007A, r24
-   215 }
225 166: 8f 91 pop r24 216 150: 8f 91 pop r24
226 168: 3f 91 pop r19 217 152: 3f 91 pop r19
227 16a: 2f 91 pop r18 218 154: 2f 91 pop r18
228 16c: 0f 90 pop r0 219 156: 0f 90 pop r0
229 16e: 0f be out 0x3f, r0 ; 63 220 158: 0f be out 0x3f, r0 ; 63
230 170: 0f 90 pop r0 221 15a: 0f 90 pop r0
231 172: 1f 90 pop r1 222 15c: 1f 90 pop r1
232 174: 18 95 reti 223 15e: 18 95 reti
233   224  
234 00000176 <get_fattime>: 225 00000160 <get_fattime>:
235 /* FatFs module. Any valid time must be returned even if */ 226 /* FatFs module. Any valid time must be returned even if */
236 /* the system does not support a real time clock. */ 227 /* the system does not support a real time clock. */
237   228  
238   229  
239 DWORD get_fattime () 230 DWORD get_fattime ()
240 { 231 {
241 176: 60 e0 ldi r22, 0x00 ; 0 232 160: 60 e0 ldi r22, 0x00 ; 0
242 178: 70 e0 ldi r23, 0x00 ; 0 233 162: 70 e0 ldi r23, 0x00 ; 0
243 17a: 81 ea ldi r24, 0xA1 ; 161 234 164: 81 ea ldi r24, 0xA1 ; 161
244 17c: 96 e3 ldi r25, 0x36 ; 54 235 166: 96 e3 ldi r25, 0x36 ; 54
245 17e: 08 95 ret -  
246   -  
247 00000180 <uart_init>: -  
248 /* UART control */ -  
249   -  
250   -  
251 static -  
252 void uart_init (void) -  
253 { -  
254 180: f8 94 cli -  
255 cli(); -  
256 UCSR0B = 0; -  
257 182: e1 ec ldi r30, 0xC1 ; 193 -  
258 184: f0 e0 ldi r31, 0x00 ; 0 -  
259 186: 10 82 st Z, r1 -  
260 rxfifo.idx_r = 0; -  
261 188: 10 92 71 01 sts 0x0171, r1 -  
262 rxfifo.idx_w = 0; -  
263 18c: 10 92 70 01 sts 0x0170, r1 -  
264 rxfifo.count = 0; -  
265 190: 10 92 72 01 sts 0x0172, r1 -  
266 UBRR0L = SYSCLK/16/9600; // Enable USRAT0 in N81,4800bps -  
267 194: 81 e4 ldi r24, 0x41 ; 65 -  
268 196: 80 93 c4 00 sts 0x00C4, r24 -  
269 UCSR0B = _BV(RXCIE0)|_BV(RXEN0)|_BV(TXEN0); -  
270 19a: 88 e9 ldi r24, 0x98 ; 152 -  
271 19c: 80 83 st Z, r24 -  
272 Stat &= 0xFD; // Clear overflow flag -  
273 19e: 80 91 69 01 lds r24, 0x0169 -  
274 1a2: 8d 7f andi r24, 0xFD ; 253 -  
275 1a4: 80 93 69 01 sts 0x0169, r24 -  
276 sei(); -  
277 1a8: 78 94 sei -  
278 1aa: 08 95 ret 236 168: 08 95 ret
279   237  
280 000001ac <__vector_18>: 238 0000016a <__vector_18>:
-   239 return d;
281 } 240 }
282   241  
283   -  
284 /* USART0 RXC interrupt */ 242 /* USART0 RXC interrupt */
285 ISR(USART_RX_vect) 243 ISR(USART_RX_vect)
286 { 244 {
287 1ac: 1f 92 push r1 245 16a: 1f 92 push r1
288 1ae: 0f 92 push r0 246 16c: 0f 92 push r0
289 1b0: 0f b6 in r0, 0x3f ; 63 247 16e: 0f b6 in r0, 0x3f ; 63
290 1b2: 0f 92 push r0 248 170: 0f 92 push r0
291 1b4: 11 24 eor r1, r1 249 172: 11 24 eor r1, r1
292 1b6: 8f 93 push r24 250 174: 8f 93 push r24
293 1b8: 9f 93 push r25 251 176: 9f 93 push r25
294 1ba: ef 93 push r30 252 178: ef 93 push r30
295 1bc: ff 93 push r31 253 17a: ff 93 push r31
296 uint8_t d, n, i; 254 uint8_t d, n, i;
297   255  
298   256  
299 d = UDR0; 257 d = UDR0;
300 1be: 90 91 c6 00 lds r25, 0x00C6 258 17c: 90 91 c6 00 lds r25, 0x00C6
301 n = rxfifo.count; 259 n = rxfifo.count;
302 1c2: 80 91 72 01 lds r24, 0x0172 260 180: 80 91 78 01 lds r24, 0x0178
303 if(n < sizeof(rxfifo.buff)) { 261 if(n < sizeof(rxfifo.buff)) {
304 1c6: 86 39 cpi r24, 0x96 ; 150 262 184: 86 39 cpi r24, 0x96 ; 150
305 1c8: 88 f4 brcc .+34 ; 0x1ec <__vector_18+0x40> 263 186: 88 f4 brcc .+34 ; 0x1aa <__vector_18+0x40>
306 rxfifo.count = ++n; 264 rxfifo.count = ++n;
307 1ca: 8f 5f subi r24, 0xFF ; 255 265 188: 8f 5f subi r24, 0xFF ; 255
308 1cc: 80 93 72 01 sts 0x0172, r24 266 18a: 80 93 78 01 sts 0x0178, r24
309 i = rxfifo.idx_w; 267 i = rxfifo.idx_w;
310 1d0: 80 91 70 01 lds r24, 0x0170 268 18e: 80 91 76 01 lds r24, 0x0176
311 rxfifo.buff[i++] = d; 269 rxfifo.buff[i++] = d;
312 1d4: e8 2f mov r30, r24 270 192: e8 2f mov r30, r24
313 1d6: ff 27 eor r31, r31 271 194: f0 e0 ldi r31, 0x00 ; 0
314 1d8: e0 59 subi r30, 0x90 ; 144 272 196: ea 58 subi r30, 0x8A ; 138
315 1da: fe 4f sbci r31, 0xFE ; 254 273 198: fe 4f sbci r31, 0xFE ; 254
316 1dc: 93 83 std Z+3, r25 ; 0x03 274 19a: 93 83 std Z+3, r25 ; 0x03
317 1de: 8f 5f subi r24, 0xFF ; 255 275 19c: 8f 5f subi r24, 0xFF ; 255
318 if(i >= sizeof(rxfifo.buff)) 276 if(i >= sizeof(rxfifo.buff))
319 1e0: 86 39 cpi r24, 0x96 ; 150 277 19e: 86 39 cpi r24, 0x96 ; 150
320 1e2: 08 f0 brcs .+2 ; 0x1e6 <__vector_18+0x3a> 278 1a0: 08 f0 brcs .+2 ; 0x1a4 <__vector_18+0x3a>
321 1e4: 80 e0 ldi r24, 0x00 ; 0 279 1a2: 80 e0 ldi r24, 0x00 ; 0
322 i = 0; 280 i = 0;
323 rxfifo.idx_w = i; 281 rxfifo.idx_w = i;
324 1e6: 80 93 70 01 sts 0x0170, r24 282 1a4: 80 93 76 01 sts 0x0176, r24
325 1ea: 05 c0 rjmp .+10 ; 0x1f6 <__vector_18+0x4a> 283 1a8: 05 c0 rjmp .+10 ; 0x1b4 <__vector_18+0x4a>
326 } else { 284 } else {
327 Stat |= 2; 285 Stat |= 2;
328 1ec: 80 91 69 01 lds r24, 0x0169 286 1aa: 80 91 6f 01 lds r24, 0x016F
329 1f0: 82 60 ori r24, 0x02 ; 2 287 1ae: 82 60 ori r24, 0x02 ; 2
330 1f2: 80 93 69 01 sts 0x0169, r24 288 1b0: 80 93 6f 01 sts 0x016F, r24
-   289 }
-   290 }
331 1f6: ff 91 pop r31 291 1b4: ff 91 pop r31
332 1f8: ef 91 pop r30 292 1b6: ef 91 pop r30
333 1fa: 9f 91 pop r25 293 1b8: 9f 91 pop r25
334 1fc: 8f 91 pop r24 294 1ba: 8f 91 pop r24
335 1fe: 0f 90 pop r0 295 1bc: 0f 90 pop r0
336 200: 0f be out 0x3f, r0 ; 63 296 1be: 0f be out 0x3f, r0 ; 63
337 202: 0f 90 pop r0 297 1c0: 0f 90 pop r0
338 204: 1f 90 pop r1 298 1c2: 1f 90 pop r1
339 206: 18 95 reti 299 1c4: 18 95 reti
340   300  
341 00000208 <get_line>: 301 000001c6 <get_line>:
-   302 /* Get a line received from GPS module */
-   303 /*----------------------------------------------------*/
-   304  
-   305 static
-   306 BYTE get_line (void) // 0: Power fail occured, >0: Number of bytes received.
-   307 {
-   308 1c6: 90 e0 ldi r25, 0x00 ; 0
-   309 cli();
-   310 UCSR0B = 0;
-   311 rxfifo.idx_r = 0;
-   312 rxfifo.idx_w = 0;
-   313 rxfifo.count = 0;
-   314 UBRR0L = SYSCLK/16/GPS_BAUDRATE;
-   315 1c8: 51 e4 ldi r21, 0x41 ; 65
-   316 UCSR0B = _BV(RXCIE0)|_BV(RXEN0)|_BV(TXEN0);
-   317 1ca: 48 e9 ldi r20, 0x98 ; 152
-   318 1cc: 01 c0 rjmp .+2 ; 0x1d0 <get_line+0xa>
342 /* Get a line received from GPS module */ 319 /* Get a line received from GPS module */
343 /*----------------------------------------------------*/ 320 /*----------------------------------------------------*/
344   321  
345 static 322 static
346 BYTE get_line (void) // 0: Power fail occured, >0: Number of bytes received. 323 BYTE get_line (void) // 0: Power fail occured, >0: Number of bytes received.
347 { 324 {
348 208: 90 e0 ldi r25, 0x00 ; 0 325 1ce: 90 e0 ldi r25, 0x00 ; 0
349 BYTE c, i = 0; 326 BYTE c, i = 0;
350   327  
351   328  
352 for (;;) { 329 for (;;) {
353 if (Stat & 1) return 0; // When power fail is detected, return with zero. 330 if (Stat & 1) return 0; // When power fail is detected, return with zero.
354 20a: 80 91 69 01 lds r24, 0x0169 331 1d0: 80 91 6f 01 lds r24, 0x016F
355 20e: 80 ff sbrs r24, 0 332 1d4: 80 fd sbrc r24, 0
356 210: 03 c0 rjmp .+6 ; 0x218 <get_line+0x10> 333 1d6: 46 c0 rjmp .+140 ; 0x264 <get_line+0x9e>
357 212: 80 e0 ldi r24, 0x00 ; 0 -  
358 214: 90 e0 ldi r25, 0x00 ; 0 -  
359 216: 08 95 ret -  
360 uint8_t uart_get () 334 uint8_t uart_get ()
361 { 335 {
362 uint8_t d, i; 336 uint8_t d, i;
363   337  
364   338  
365 i = rxfifo.idx_r; 339 i = rxfifo.idx_r;
366 218: 20 91 71 01 lds r18, 0x0171 340 1d8: 30 91 77 01 lds r19, 0x0177
367 if (rxfifo.count == 0) return 0; 341 if (rxfifo.count == 0) return 0;
368 21c: 80 91 72 01 lds r24, 0x0172 342 1dc: 80 91 78 01 lds r24, 0x0178
369 220: 88 23 and r24, r24 343 1e0: 88 23 and r24, r24
370 222: 19 f4 brne .+6 ; 0x22a <get_line+0x22> 344 1e2: 11 f4 brne .+4 ; 0x1e8 <get_line+0x22>
371 224: 20 e0 ldi r18, 0x00 ; 0 345 1e4: 20 e0 ldi r18, 0x00 ; 0
372 226: 30 e0 ldi r19, 0x00 ; 0 -  
373 228: 15 c0 rjmp .+42 ; 0x254 <get_line+0x4c> 346 1e6: 13 c0 rjmp .+38 ; 0x20e <get_line+0x48>
374 d = rxfifo.buff[i++]; 347 d = rxfifo.buff[i++];
375 22a: e2 2f mov r30, r18 348 1e8: e3 2f mov r30, r19
376 22c: ff 27 eor r31, r31 349 1ea: f0 e0 ldi r31, 0x00 ; 0
377 22e: e0 59 subi r30, 0x90 ; 144 350 1ec: ea 58 subi r30, 0x8A ; 138
378 230: fe 4f sbci r31, 0xFE ; 254 351 1ee: fe 4f sbci r31, 0xFE ; 254
379 232: 33 81 ldd r19, Z+3 ; 0x03 352 1f0: 23 81 ldd r18, Z+3 ; 0x03
380 234: e2 2f mov r30, r18 353 1f2: e3 2f mov r30, r19
381 236: ef 5f subi r30, 0xFF ; 255 354 1f4: ef 5f subi r30, 0xFF ; 255
382 cli(); 355 cli();
383 238: f8 94 cli 356 1f6: f8 94 cli
384 rxfifo.count--; 357 rxfifo.count--;
385 23a: 80 91 72 01 lds r24, 0x0172 358 1f8: 80 91 78 01 lds r24, 0x0178
386 23e: 81 50 subi r24, 0x01 ; 1 359 1fc: 81 50 subi r24, 0x01 ; 1
387 240: 80 93 72 01 sts 0x0172, r24 360 1fe: 80 93 78 01 sts 0x0178, r24
388 sei(); 361 sei();
389 244: 78 94 sei 362 202: 78 94 sei
390 if(i >= sizeof(rxfifo.buff)) 363 if(i >= sizeof(rxfifo.buff))
391 246: e6 39 cpi r30, 0x96 ; 150 364 204: e6 39 cpi r30, 0x96 ; 150
392 248: 08 f0 brcs .+2 ; 0x24c <get_line+0x44> 365 206: 08 f0 brcs .+2 ; 0x20a <get_line+0x44>
393 24a: e0 e0 ldi r30, 0x00 ; 0 366 208: e0 e0 ldi r30, 0x00 ; 0
394 i = 0; 367 i = 0;
395 rxfifo.idx_r = i; 368 rxfifo.idx_r = i;
396 24c: e0 93 71 01 sts 0x0171, r30 369 20a: e0 93 77 01 sts 0x0177, r30
397   -  
398 return d; -  
399 250: 23 2f mov r18, r19 -  
400 252: 33 27 eor r19, r19 -  
401   370  
402   371  
403 for (;;) { 372 for (;;) {
404 if (Stat & 1) return 0; // When power fail is detected, return with zero. 373 if (Stat & 1) return 0; // When power fail is detected, return with zero.
405 c = uart_get(); 374 c = uart_get();
406 if (Stat & 2) { // When buffer overflow has occured, restert to receive line. 375 if (Stat & 2) { // When buffer overflow has occured, restart to receive line.
407 254: 80 91 69 01 lds r24, 0x0169 376 20e: 80 91 6f 01 lds r24, 0x016F
408 258: 81 ff sbrs r24, 1 377 212: 81 ff sbrs r24, 1
409 25a: 03 c0 rjmp .+6 ; 0x262 <get_line+0x5a> 378 214: 14 c0 rjmp .+40 ; 0x23e <get_line+0x78>
410 uart_init(); -  
411 25c: 0e 94 c0 00 call 0x180 ; 0x180 <uart_init> -  
412 260: d3 cf rjmp .-90 ; 0x208 <get_line> -  
413 BYTE c, i = 0; -  
414   379  
415   380  
-   381 static
-   382 void uart_init (void)
-   383 {
416 for (;;) { 384 cli();
-   385 216: f8 94 cli
-   386 UCSR0B = 0;
-   387 218: 10 92 c1 00 sts 0x00C1, r1
-   388 rxfifo.idx_r = 0;
-   389 21c: 10 92 77 01 sts 0x0177, r1
-   390 rxfifo.idx_w = 0;
-   391 220: 10 92 76 01 sts 0x0176, r1
-   392 rxfifo.count = 0;
-   393 224: 10 92 78 01 sts 0x0178, r1
-   394 UBRR0L = SYSCLK/16/GPS_BAUDRATE;
-   395 228: 50 93 c4 00 sts 0x00C4, r21
-   396 UCSR0B = _BV(RXCIE0)|_BV(RXEN0)|_BV(TXEN0);
-   397 22c: 40 93 c1 00 sts 0x00C1, r20
-   398 Stat &= 0xFD; // Clear overflow flag
-   399 230: 80 91 6f 01 lds r24, 0x016F
-   400 234: 8d 7f andi r24, 0xFD ; 253
-   401 236: 80 93 6f 01 sts 0x016F, r24
-   402 sei();
-   403 23a: 78 94 sei
417 if (Stat & 1) return 0; // When power fail is detected, return with zero. 404 23c: c8 cf rjmp .-112 ; 0x1ce <get_line+0x8>
418 c = uart_get(); 405 c = uart_get();
419 262: 82 2f mov r24, r18 -  
420 if (Stat & 2) { // When buffer overflow has occured, restert to receive line. 406 if (Stat & 2) { // When buffer overflow has occured, restart to receive line.
421 uart_init(); 407 uart_init();
422 i = 0; c = 0; 408 i = 0; c = 0;
423 } 409 }
424 if (!c || (i == 0 && c != '$')) continue; 410 if (!c || (i == 0 && c != '$')) continue;
425 264: 22 23 and r18, r18 411 23e: 22 23 and r18, r18
426 266: 89 f2 breq .-94 ; 0x20a <get_line+0x2> 412 240: 39 f2 breq .-114 ; 0x1d0 <get_line+0xa>
427 268: 99 23 and r25, r25 413 242: 99 23 and r25, r25
428 26a: 11 f4 brne .+4 ; 0x270 <get_line+0x68> 414 244: 19 f4 brne .+6 ; 0x24c <get_line+0x86>
429 26c: 24 32 cpi r18, 0x24 ; 36 415 246: 24 32 cpi r18, 0x24 ; 36
430 26e: 69 f6 brne .-102 ; 0x20a <get_line+0x2> 416 248: 09 f0 breq .+2 ; 0x24c <get_line+0x86>
-   417 24a: c2 cf rjmp .-124 ; 0x1d0 <get_line+0xa>
431 Buff[i++] = c; 418 Buff[i++] = c;
432 270: e9 2f mov r30, r25 419 24c: e9 2f mov r30, r25
433 272: ff 27 eor r31, r31 420 24e: f0 e0 ldi r31, 0x00 ; 0
434 274: e9 5e subi r30, 0xE9 ; 233 421 250: e3 5e subi r30, 0xE3 ; 227
435 276: fe 4f sbci r31, 0xFE ; 254 422 252: fe 4f sbci r31, 0xFE ; 254
436 278: 20 83 st Z, r18 423 254: 20 83 st Z, r18
437 27a: 9f 5f subi r25, 0xFF ; 255 424 256: 9f 5f subi r25, 0xFF ; 255
438 if (c == '\n') break; 425 if (c == '\n') break;
439 27c: 8a 30 cpi r24, 0x0A ; 10 426 258: 2a 30 cpi r18, 0x0A ; 10
440 27e: 21 f0 breq .+8 ; 0x288 <get_line+0x80> 427 25a: 29 f0 breq .+10 ; 0x266 <get_line+0xa0>
441 if (i >= sizeof(Buff)) i = 0; 428 if (i >= sizeof(Buff)) i = 0;
442 280: 92 35 cpi r25, 0x52 ; 82 429 25c: 92 35 cpi r25, 0x52 ; 82
443 282: 08 f0 brcs .+2 ; 0x286 <get_line+0x7e> 430 25e: 08 f0 brcs .+2 ; 0x262 <get_line+0x9c>
444 284: c1 cf rjmp .-126 ; 0x208 <get_line> 431 260: b6 cf rjmp .-148 ; 0x1ce <get_line+0x8>
445 286: c1 cf rjmp .-126 ; 0x20a <get_line+0x2> 432 262: b6 cf rjmp .-148 ; 0x1d0 <get_line+0xa>
-   433 264: 90 e0 ldi r25, 0x00 ; 0
446 } 434 }
447 return i; 435 return i;
448 288: 89 2f mov r24, r25 -  
449 28a: 99 27 eor r25, r25 -  
450 } -  
451 28c: 08 95 ret -  
452   -  
453 0000028e <beep>: -  
454 /*--------------------------------------------------------------------------*/ -  
455 /* Controls */ -  
456   -  
457 static -  
458 void beep (BYTE len, BYTE cnt) -  
459 { -  
460 28e: 98 2f mov r25, r24 -  
461 290: 0f c0 rjmp .+30 ; 0x2b0 <beep+0x22> -  
462 while (cnt--) { -  
463 BEEP_ON(); -  
464 292: 83 e0 ldi r24, 0x03 ; 3 -  
465 294: 85 bd out 0x25, r24 ; 37 -  
466 DELAY(len); -  
467 296: 90 93 16 01 sts 0x0116, r25 -  
468 29a: 80 91 16 01 lds r24, 0x0116 -  
469 29e: 88 23 and r24, r24 -  
470 2a0: e1 f7 brne .-8 ; 0x29a <beep+0xc> -  
471 BEEP_OFF(); -  
472 2a2: 15 bc out 0x25, r1 ; 37 -  
473 DELAY(len); -  
474 2a4: 90 93 16 01 sts 0x0116, r25 -  
475 2a8: 80 91 16 01 lds r24, 0x0116 -  
476 2ac: 88 23 and r24, r24 -  
477 2ae: e1 f7 brne .-8 ; 0x2a8 <beep+0x1a> -  
478 /* Controls */ -  
479   -  
480 static -  
481 void beep (BYTE len, BYTE cnt) -  
482 { -  
483 while (cnt--) { -  
484 2b0: 61 50 subi r22, 0x01 ; 1 -  
485 2b2: 78 f7 brcc .-34 ; 0x292 <beep+0x4> -  
486 2b4: 08 95 ret -  
487   -  
488 000002b6 <gp_comp>: -  
489   -  
490   -  
491 /* Compare sentence header string */ -  
492 static -  
493 BYTE gp_comp (BYTE *str1, const prog_uint8_t *str2) -  
494 { -  
495 2b6: dc 01 movw r26, r24 -  
496 2b8: fb 01 movw r30, r22 -  
497 BYTE c; -  
498   -  
499 do { -  
500 c = pgm_read_byte(str2++); -  
501 2ba: 6f 5f subi r22, 0xFF ; 255 -  
502 2bc: 7f 4f sbci r23, 0xFF ; 255 -  
503 2be: 94 91 lpm r25, Z -  
504 } while (c && c == *str1++); -  
505 2c0: 99 23 and r25, r25 -  
506 2c2: 29 f0 breq .+10 ; 0x2ce <gp_comp+0x18> -  
507 2c4: 8c 91 ld r24, X -  
508 2c6: 98 17 cp r25, r24 -  
509 2c8: 11 f4 brne .+4 ; 0x2ce <gp_comp+0x18> -  
510 2ca: 11 96 adiw r26, 0x01 ; 1 -  
511 2cc: f5 cf rjmp .-22 ; 0x2b8 <gp_comp+0x2> -  
512 return c; -  
513 } 436 }
514 2ce: 89 2f mov r24, r25 437 266: 89 2f mov r24, r25
515 2d0: 99 27 eor r25, r25 -  
516 2d2: 08 95 ret -  
517   -  
518 000002d4 <gp_col>: -  
519 /* Get a column item */ -  
520 static -  
521 BYTE* gp_col ( /* Returns pointer to the item (returns a NULL when not found) */ -  
522 const BYTE* buf, /* Pointer to the sentence */ -  
523 BYTE col /* Column number (0 is the 1st item) */ -  
524 ) { -  
525 2d4: fc 01 movw r30, r24 -  
526 2d6: 0a c0 rjmp .+20 ; 0x2ec <gp_col+0x18> -  
527 BYTE c; -  
528   -  
529   -  
530 while (col) { -  
531 do { -  
532 c = *buf++; -  
533 2d8: 80 81 ld r24, Z -  
534 if (c <= ' ') return NULL; -  
535 2da: 81 32 cpi r24, 0x21 ; 33 -  
536 2dc: 18 f4 brcc .+6 ; 0x2e4 <gp_col+0x10> -  
537 2de: 80 e0 ldi r24, 0x00 ; 0 -  
538 2e0: 90 e0 ldi r25, 0x00 ; 0 -  
539 2e2: 08 95 ret 438 268: 08 95 ret
540 BYTE c; -  
541   -  
542   -  
543 while (col) { -  
544 do { -  
545 c = *buf++; -  
546 2e4: 31 96 adiw r30, 0x01 ; 1 -  
547 if (c <= ' ') return NULL; -  
548 } while (c != ','); -  
549 2e6: 8c 32 cpi r24, 0x2C ; 44 -  
550 2e8: b9 f7 brne .-18 ; 0x2d8 <gp_col+0x4> -  
551 col--; -  
552 2ea: 61 50 subi r22, 0x01 ; 1 -  
553 BYTE col /* Column number (0 is the 1st item) */ -  
554 ) { -  
555 BYTE c; -  
556   -  
557   439  
558 while (col) { -  
559 2ec: 66 23 and r22, r22 -  
560 2ee: a1 f7 brne .-24 ; 0x2d8 <gp_col+0x4> -  
561 c = *buf++; -  
562 if (c <= ' ') return NULL; -  
563 } while (c != ','); -  
564 col--; -  
565 } -  
566 return (BYTE*)buf; -  
567 2f0: cf 01 movw r24, r30 -  
568 } -  
569 2f2: 08 95 ret -  
570   -  
571 000002f4 <__vector_11>: -  
572 /* 100Hz timer interrupt generated by OC1A */ -  
573 /*---------------------------------------------------------*/ -  
574   -  
575   -  
576 ISR(TIMER1_COMPA_vect) -  
577 { -  
578 2f4: 1f 92 push r1 -  
579 2f6: 0f 92 push r0 -  
580 2f8: 0f b6 in r0, 0x3f ; 63 -  
581 2fa: 0f 92 push r0 -  
582 2fc: 11 24 eor r1, r1 -  
583 2fe: 2f 93 push r18 -  
584 300: 3f 93 push r19 -  
585 302: 4f 93 push r20 -  
586 304: 5f 93 push r21 -  
587 306: 6f 93 push r22 -  
588 308: 7f 93 push r23 -  
589 30a: 8f 93 push r24 -  
590 30c: 9f 93 push r25 -  
591 30e: af 93 push r26 -  
592 310: bf 93 push r27 -  
593 312: ef 93 push r30 -  
594 314: ff 93 push r31 -  
595 BYTE n; -  
596 static WORD ivt_sync; -  
597   -  
598   -  
599 n = Timer; -  
600 316: 80 91 16 01 lds r24, 0x0116 -  
601 if (n) Timer = n - 1; -  
602 31a: 88 23 and r24, r24 -  
603 31c: 19 f0 breq .+6 ; 0x324 <__vector_11+0x30> -  
604 31e: 81 50 subi r24, 0x01 ; 1 -  
605 320: 80 93 16 01 sts 0x0116, r24 -  
606   -  
607 if (++ivt_sync >= 180 * 100) { -  
608 324: 80 91 06 01 lds r24, 0x0106 -  
609 328: 90 91 07 01 lds r25, 0x0107 -  
610 32c: 01 96 adiw r24, 0x01 ; 1 -  
611 32e: 90 93 07 01 sts 0x0107, r25 -  
612 332: 80 93 06 01 sts 0x0106, r24 -  
613 336: 80 55 subi r24, 0x50 ; 80 -  
614 338: 96 44 sbci r25, 0x46 ; 70 -  
615 33a: 48 f0 brcs .+18 ; 0x34e <__vector_11+0x5a> -  
616 ivt_sync = 0; -  
617 33c: 10 92 07 01 sts 0x0107, r1 -  
618 340: 10 92 06 01 sts 0x0106, r1 -  
619 Stat |= 4; -  
620 344: 80 91 69 01 lds r24, 0x0169 -  
621 348: 84 60 ori r24, 0x04 ; 4 -  
622 34a: 80 93 69 01 sts 0x0169, r24 -  
623 } -  
624   -  
625 disk_timerproc(); /* Drive timer procedure of low level disk I/O module */ -  
626 34e: 0e 94 c8 0d call 0x1b90 ; 0x1b90 <disk_timerproc> -  
627 352: ff 91 pop r31 -  
628 354: ef 91 pop r30 -  
629 356: bf 91 pop r27 -  
630 358: af 91 pop r26 -  
631 35a: 9f 91 pop r25 -  
632 35c: 8f 91 pop r24 -  
633 35e: 7f 91 pop r23 -  
634 360: 6f 91 pop r22 -  
635 362: 5f 91 pop r21 -  
636 364: 4f 91 pop r20 -  
637 366: 3f 91 pop r19 -  
638 368: 2f 91 pop r18 -  
639 36a: 0f 90 pop r0 -  
640 36c: 0f be out 0x3f, r0 ; 63 -  
641 36e: 0f 90 pop r0 -  
642 370: 1f 90 pop r1 -  
643 372: 18 95 reti -  
644   -  
645 00000374 <main>: 440 0000026a <main>:
646 /*-----------------------------------------------------------------------*/ 441 /*-----------------------------------------------------------------------*/
647 /* Main */ 442 /* Main */
648   443  
649   444  
650 int main () 445 int main ()
651 { 446 {
652 374: cd ef ldi r28, 0xFD ; 253 447 26a: a2 e0 ldi r26, 0x02 ; 2
653 376: d4 e0 ldi r29, 0x04 ; 4 448 26c: b0 e0 ldi r27, 0x00 ; 0
654 378: de bf out 0x3e, r29 ; 62 449 26e: eb e3 ldi r30, 0x3B ; 59
655 37a: cd bf out 0x3d, r28 ; 61 450 270: f1 e0 ldi r31, 0x01 ; 1
-   451 272: 0c 94 c7 14 jmp 0x298e ; 0x298e <__prologue_saves__>
656   452  
657   453  
658 static 454 static
659 void ioinit (void) 455 void ioinit (void)
660 { 456 {
661 PORTB = 0b00001101; // Port B 457 PORTB = 0b00001101; // Port B
662 37c: 8d e0 ldi r24, 0x0D ; 13 458 276: 8d e0 ldi r24, 0x0D ; 13
663 37e: 85 b9 out 0x05, r24 ; 5 459 278: 85 b9 out 0x05, r24 ; 5
664 DDRB = 0b00101110; 460 DDRB = 0b00101110;
665 380: 8e e2 ldi r24, 0x2E ; 46 461 27a: 8e e2 ldi r24, 0x2E ; 46
666 382: 84 b9 out 0x04, r24 ; 4 462 27c: 84 b9 out 0x04, r24 ; 4
667 PORTC = 0b00111111; // Port C 463 PORTC = 0b00111111; // Port C
668 384: 8f e3 ldi r24, 0x3F ; 63 464 27e: 8f e3 ldi r24, 0x3F ; 63
669 386: 88 b9 out 0x08, r24 ; 8 465 280: 88 b9 out 0x08, r24 ; 8
670 DDRC = 0b00000000; 466 DDRC = 0b00000000;
671 388: 17 b8 out 0x07, r1 ; 7 467 282: 17 b8 out 0x07, r1 ; 7
672 PORTD = 0b10101110; // Port D 468 PORTD = 0b10101110; // Port D
673 38a: 8e ea ldi r24, 0xAE ; 174 469 284: 8e ea ldi r24, 0xAE ; 174
674 38c: 8b b9 out 0x0b, r24 ; 11 470 286: 8b b9 out 0x0b, r24 ; 11
675 DDRD = 0b01010010; 471 DDRD = 0b01010010;
676 38e: 82 e5 ldi r24, 0x52 ; 82 472 288: 82 e5 ldi r24, 0x52 ; 82
677 390: 8a b9 out 0x0a, r24 ; 10 473 28a: 8a b9 out 0x0a, r24 ; 10
678   474  
679 SPCR = 0b01010000; /* Initialize SPI port (Mode 0) */ 475 SPCR = 0b01010000; /* Initialize SPI port (Mode 0) */
680 392: 80 e5 ldi r24, 0x50 ; 80 476 28c: 80 e5 ldi r24, 0x50 ; 80
681 394: 8c bd out 0x2c, r24 ; 44 477 28e: 8c bd out 0x2c, r24 ; 44
682 SPSR = 0b00000001; 478 SPSR = 0b00000001;
683 396: 81 e0 ldi r24, 0x01 ; 1 479 290: 81 e0 ldi r24, 0x01 ; 1
684 398: 8d bd out 0x2d, r24 ; 45 480 292: 8d bd out 0x2d, r24 ; 45
685   481  
686 OCR1A = SYSCLK/8/100-1; // Timer1: 100Hz interval (OC1A) 482 OCR1A = SYSCLK/8/100-1; // Timer1: 100Hz interval (OC1A)
687 39a: 83 ed ldi r24, 0xD3 ; 211 483 294: 83 ed ldi r24, 0xD3 ; 211
688 39c: 90 e3 ldi r25, 0x30 ; 48 484 296: 90 e3 ldi r25, 0x30 ; 48
689 39e: 90 93 89 00 sts 0x0089, r25 485 298: 90 93 89 00 sts 0x0089, r25
690 3a2: 80 93 88 00 sts 0x0088, r24 486 29c: 80 93 88 00 sts 0x0088, r24
691 TCCR1B = 0b00001010; 487 TCCR1B = 0b00001010;
692 3a6: 8a e0 ldi r24, 0x0A ; 10 488 2a0: 8a e0 ldi r24, 0x0A ; 10
693 3a8: 80 93 81 00 sts 0x0081, r24 489 2a2: 80 93 81 00 sts 0x0081, r24
694 TIMSK1 = _BV(OCIE1A); // Enable TC1.oca interrupt 490 TIMSK1 = _BV(OCIE1A); // Enable TC1.oca interrupt
695 3ac: 82 e0 ldi r24, 0x02 ; 2 491 2a6: 82 e0 ldi r24, 0x02 ; 2
696 3ae: 80 93 6f 00 sts 0x006F, r24 492 2a8: 80 93 6f 00 sts 0x006F, r24
697   493  
698 OCR0A = SYSCLK/64/4000/2-1; // Timer0: 4kHz sound (OC0A) 494 OCR0A = SYSCLK/64/4000/2-1; // Timer0: 4kHz sound (OC0A)
699 3b2: 82 e1 ldi r24, 0x12 ; 18 495 2ac: 82 e1 ldi r24, 0x12 ; 18
700 3b4: 87 bd out 0x27, r24 ; 39 496 2ae: 87 bd out 0x27, r24 ; 39
701 TCCR0A = 0b01000010; 497 TCCR0A = 0b01000010;
702 3b6: 82 e4 ldi r24, 0x42 ; 66 498 2b0: 82 e4 ldi r24, 0x42 ; 66
703 3b8: 84 bd out 0x24, r24 ; 36 499 2b2: 84 bd out 0x24, r24 ; 36
704   500  
705 ADMUX = POWER_check; // Select ADC input 501 ADMUX = POWER_check; // Select ADC input
706 3ba: 81 e4 ldi r24, 0x41 ; 65 502 2b4: 81 e4 ldi r24, 0x41 ; 65
707 3bc: 80 93 7c 00 sts 0x007C, r24 503 2b6: 80 93 7c 00 sts 0x007C, r24
708 ADCSRA = _BV(ADEN)|_BV(ADSC)|_BV(ADIF)|_BV(ADIE)|0b111; 504 ADCSRA = _BV(ADEN)|_BV(ADSC)|_BV(ADIF)|_BV(ADIE)|0b111;
709 3c0: 8f ed ldi r24, 0xDF ; 223 505 2ba: 8f ed ldi r24, 0xDF ; 223
710 3c2: 80 93 7a 00 sts 0x007A, r24 506 2bc: 80 93 7a 00 sts 0x007A, r24
711   507  
712 sei(); 508 sei();
713 3c6: 78 94 sei 509 2c0: 78 94 sei
714 BYTE b, err, *p = NULL; 510 BYTE b, err, *p = NULL;
715 WORD s; 511 WORD s;
716   512  
717   513  
718 ioinit(); 514 ioinit();
719 f_mount(0, &fatfs); /* Enable file I/O layer */ 515 f_mount(0, &fatfs); /* Enable file I/O layer */
720 3c8: 67 e2 ldi r22, 0x27 ; 39 516 2c2: 6d e2 ldi r22, 0x2D ; 45
721 3ca: 72 e0 ldi r23, 0x02 ; 2 517 2c4: 72 e0 ldi r23, 0x02 ; 2
722 3cc: 80 e0 ldi r24, 0x00 ; 0 518 2c6: 80 e0 ldi r24, 0x00 ; 0
723 3ce: 0e 94 ef 08 call 0x11de ; 0x11de <f_mount> 519 2c8: 0e 94 7f 09 call 0x12fe ; 0x12fe <f_mount>
724 3d2: cc 24 eor r12, r12 520 2cc: ee 24 eor r14, r14
725 3d4: dd 24 eor r13, r13 521 2ce: ff 24 eor r15, r15
-   522  
-   523 static
-   524 void beep (BYTE len, BYTE cnt)
-   525 {
-   526 while (cnt--) {
-   527 BEEP_ON();
726 3d6: 47 e1 ldi r20, 0x17 ; 23 528 2d0: 53 e0 ldi r21, 0x03 ; 3
727 3d8: e4 2e mov r14, r20 529 2d2: a5 2e mov r10, r21
-   530 DELAY(len);
728 3da: 41 e0 ldi r20, 0x01 ; 1 531 2d4: 45 e0 ldi r20, 0x05 ; 5
729 3dc: f4 2e mov r15, r20 532 2d6: b4 2e mov r11, r20
-   533 beep(5, 1); // Single beep. Start to get current time.
-   534 uart_init();
-   535 do { // Wait for valid RMC sentence.
-   536 b = get_line();
-   537 if (!b) break;
-   538 if (gp_comp(Buff, PSTR("$GPRMC"))) continue;
730 3de: 3b e0 ldi r19, 0x0B ; 11 539 2d8: 3d e1 ldi r19, 0x1D ; 29
731 3e0: a3 2e mov r10, r19 540 2da: c3 2e mov r12, r19
732 3e2: 32 e0 ldi r19, 0x02 ; 2 541 2dc: 31 e0 ldi r19, 0x01 ; 1
733 3e4: b3 2e mov r11, r19 542 2de: d3 2e mov r13, r19
734 // || !gp_comp(Buff, PSTR("$GPGSV")) 543 // || !gp_comp(Buff, PSTR("$GPGSV"))
735 // || !gp_comp(Buff, PSTR("$GPZDA")) 544 // || !gp_comp(Buff, PSTR("$GPZDA"))
736 // || !gp_comp(Buff, PSTR("$GPVTG")) 545 // || !gp_comp(Buff, PSTR("$GPVTG"))
737 ) 546 )
738 { 547 {
739 if (f_write(&file1, Buff, b, &s) || b != s) { err = 5; break; }; 548 if (f_write(&file1, Buff, b, &s) || b != s) { err = 5; break; };
740 3e6: 2e 01 movw r4, r28 549 2e0: 4e 01 movw r8, r28
741 3e8: 08 94 sec 550 2e2: 08 94 sec
742 3ea: 41 1c adc r4, r1 551 2e4: 81 1c adc r8, r1
743 3ec: 51 1c adc r5, r1 552 2e6: 91 1c adc r9, r1
-   553 itoa(battery,&Value1,10); // convert number to character
744 3ee: 22 e1 ldi r18, 0x12 ; 18 554 2e8: 28 e1 ldi r18, 0x18 ; 24
745 3f0: 62 2e mov r6, r18 555 2ea: 22 2e mov r2, r18
746 3f2: 21 e0 ldi r18, 0x01 ; 1 556 2ec: 21 e0 ldi r18, 0x01 ; 1
747 3f4: 72 2e mov r7, r18 557 2ee: 32 2e mov r3, r18
-   558 itoa(intensity,&Value2,10);
748 3f6: 9a e6 ldi r25, 0x6A ; 106 559 2f0: 90 e7 ldi r25, 0x70 ; 112
749 3f8: 89 2e mov r8, r25 560 2f2: 69 2e mov r6, r25
750 3fa: 91 e0 ldi r25, 0x01 ; 1 561 2f4: 91 e0 ldi r25, 0x01 ; 1
751 3fc: 99 2e mov r9, r25 562 2f6: 79 2e mov r7, r25
752 3fe: 89 e0 ldi r24, 0x09 ; 9 563 sprintf(Buff,"%d,%d\n",Value1,Value2);
753 400: 28 2e mov r2, r24 564 2f8: 80 e0 ldi r24, 0x00 ; 0
754 402: 31 2c mov r3, r1 565 2fa: 48 2e mov r4, r24
755 404: 2e 0c add r2, r14 566 2fc: 81 e0 ldi r24, 0x01 ; 1
756 406: 3f 1c adc r3, r15 567 2fe: 58 2e mov r5, r24
757   568  
758   569  
759 static 570 static
760 void uart_stop (void) 571 void uart_stop (void)
761 { 572 {
762 UCSR0B = 0; 573 UCSR0B = 0;
763 408: 10 92 c1 00 sts 0x00C1, r1 574 300: 10 92 c1 00 sts 0x00C1, r1
764 ioinit(); 575 ioinit();
765 f_mount(0, &fatfs); /* Enable file I/O layer */ 576 f_mount(0, &fatfs); /* Enable file I/O layer */
766   577  
767 for (;;) { 578 for (;;) {
768 uart_stop(); 579 uart_stop();
769 GPS_OFF(); 580 GPS_OFF();
770 40c: 29 98 cbi 0x05, 1 ; 5 581 304: 29 98 cbi 0x05, 1 ; 5
771 Timer = 100; 582 Timer = 100;
772 40e: 84 e6 ldi r24, 0x64 ; 100 583 306: 84 e6 ldi r24, 0x64 ; 100
773 410: 80 93 16 01 sts 0x0116, r24 584 308: 80 93 1c 01 sts 0x011C, r24
774 do { 585 do {
775 if (Stat & 1) Timer = 100; 586 if (Stat & 1) Timer = 100;
-   587 30c: 94 e6 ldi r25, 0x64 ; 100
776 414: 80 91 69 01 lds r24, 0x0169 588 30e: 80 91 6f 01 lds r24, 0x016F
777 418: 80 ff sbrs r24, 0 589 312: 80 ff sbrs r24, 0
778 41a: 03 c0 rjmp .+6 ; 0x422 <main+0xae> 590 314: 02 c0 rjmp .+4 ; 0x31a <main+0xb0>
779 41c: 84 e6 ldi r24, 0x64 ; 100 -  
780 41e: 80 93 16 01 sts 0x0116, r24 591 316: 90 93 1c 01 sts 0x011C, r25
781 } while (Timer); 592 } while (Timer);
782 422: 80 91 16 01 lds r24, 0x0116 593 31a: 80 91 1c 01 lds r24, 0x011C
783 426: 88 23 and r24, r24 594 31e: 88 23 and r24, r24
784 428: a9 f7 brne .-22 ; 0x414 <main+0xa0> 595 320: b1 f7 brne .-20 ; 0x30e <main+0xa4>
785   596  
786 GPS_ON(); 597 GPS_ON();
787 42a: 29 9a sbi 0x05, 1 ; 5 598 322: 29 9a sbi 0x05, 1 ; 5
788 Timer = 255; 599 Timer = 255;
789 42c: 8f ef ldi r24, 0xFF ; 255 600 324: 8f ef ldi r24, 0xFF ; 255
790 42e: 80 93 16 01 sts 0x0116, r24 601 326: 80 93 1c 01 sts 0x011C, r24
791 do { 602 do {
792 if ((Stat & 1) || (disk_status(0) & STA_NODISK)) Timer = 255; 603 if ((Stat & 1) || (disk_status(0) & STA_NODISK)) Timer = 255;
-   604 32a: 1f ef ldi r17, 0xFF ; 255
793 432: 80 91 69 01 lds r24, 0x0169 605 32c: 80 91 6f 01 lds r24, 0x016F
794 436: 80 fd sbrc r24, 0 606 330: 80 fd sbrc r24, 0
795 438: 05 c0 rjmp .+10 ; 0x444 <main+0xd0> 607 332: 05 c0 rjmp .+10 ; 0x33e <main+0xd4>
796 43a: 80 e0 ldi r24, 0x00 ; 0 608 334: 80 e0 ldi r24, 0x00 ; 0
797 43c: 0e 94 bf 0d call 0x1b7e ; 0x1b7e <disk_status> 609 336: 0e 94 95 0f call 0x1f2a ; 0x1f2a <disk_status>
798 440: 81 ff sbrs r24, 1 610 33a: 81 ff sbrs r24, 1
799 442: 03 c0 rjmp .+6 ; 0x44a <main+0xd6> 611 33c: 02 c0 rjmp .+4 ; 0x342 <main+0xd8>
800 444: 8f ef ldi r24, 0xFF ; 255 -  
801 446: 80 93 16 01 sts 0x0116, r24 612 33e: 10 93 1c 01 sts 0x011C, r17
802 } while (Timer); 613 } while (Timer);
803 44a: 80 91 16 01 lds r24, 0x0116 614 342: 80 91 1c 01 lds r24, 0x011C
804 44e: 88 23 and r24, r24 615 346: 88 23 and r24, r24
805 450: 81 f7 brne .-32 ; 0x432 <main+0xbe> 616 348: 89 f7 brne .-30 ; 0x32c <main+0xc2>
-   617 34a: 91 e0 ldi r25, 0x01 ; 1
-   618 34c: 0e c0 rjmp .+28 ; 0x36a <main+0x100>
-   619  
-   620 static
-   621 void beep (BYTE len, BYTE cnt)
-   622 {
-   623 while (cnt--) {
-   624 BEEP_ON();
-   625 34e: a5 bc out 0x25, r10 ; 37
-   626 DELAY(len);
-   627 350: b0 92 1c 01 sts 0x011C, r11
-   628 354: 80 91 1c 01 lds r24, 0x011C
-   629 358: 88 23 and r24, r24
-   630 35a: e1 f7 brne .-8 ; 0x354 <main+0xea>
-   631 BEEP_OFF();
-   632 35c: 15 bc out 0x25, r1 ; 37
-   633 DELAY(len);
-   634 35e: b0 92 1c 01 sts 0x011C, r11
-   635 362: 80 91 1c 01 lds r24, 0x011C
-   636 366: 88 23 and r24, r24
-   637 368: e1 f7 brne .-8 ; 0x362 <main+0xf8>
-   638 /* Controls */
-   639  
-   640 static
-   641 void beep (BYTE len, BYTE cnt)
-   642 {
-   643 while (cnt--) {
-   644 36a: 91 50 subi r25, 0x01 ; 1
-   645 36c: 80 f7 brcc .-32 ; 0x34e <main+0xe4>
-   646  
806   647  
807 beep(5, 1); // Single beep. Start to get current time. -  
808 452: 61 e0 ldi r22, 0x01 ; 1 -  
809 454: 85 e0 ldi r24, 0x05 ; 5 -  
810 456: 0e 94 47 01 call 0x28e ; 0x28e <beep> -  
811 uart_init(); -  
812 45a: 0e 94 c0 00 call 0x180 ; 0x180 <uart_init> -  
813 /* Initialize GPS module (depends on each product) */ -  
814 static 648 static
815 void gp_init (void) 649 void uart_init (void)
816 { 650 {
817 const prog_char *s = 651 cli();
818 PSTR("$PSRF106,21*0F\r\n"); // Select datum of WGS84 (for EM-406A) -  
819 45e: 27 e8 ldi r18, 0x87 ; 135 652 36e: f8 94 cli
-   653 UCSR0B = 0;
820 460: 30 e0 ldi r19, 0x00 ; 0 654 370: 10 92 c1 00 sts 0x00C1, r1
-   655 rxfifo.idx_r = 0;
821 462: 06 c0 rjmp .+12 ; 0x470 <main+0xfc> 656 374: 10 92 77 01 sts 0x0177, r1
822   -  
-   657 rxfifo.idx_w = 0;
823 /* Put a character to transmit */ 658 378: 10 92 76 01 sts 0x0176, r1
824 static 659 rxfifo.count = 0;
825 void uart_put (uint8_t d) 660 37c: 10 92 78 01 sts 0x0178, r1
826 { -  
827 while (bit_is_clear(UCSR0A, UDRE0)); 661 UBRR0L = SYSCLK/16/GPS_BAUDRATE;
828 464: 80 91 c0 00 lds r24, 0x00C0 662 380: 81 e4 ldi r24, 0x41 ; 65
829 468: 85 ff sbrs r24, 5 663 382: 80 93 c4 00 sts 0x00C4, r24
-   664 UCSR0B = _BV(RXCIE0)|_BV(RXEN0)|_BV(TXEN0);
830 46a: fc cf rjmp .-8 ; 0x464 <main+0xf0> 665 386: 88 e9 ldi r24, 0x98 ; 152
831 UDR0 = d; -  
832 46c: 90 93 c6 00 sts 0x00C6, r25 666 388: 80 93 c1 00 sts 0x00C1, r24
-   667 Stat &= 0xFD; // Clear overflow flag
833 470: f9 01 movw r30, r18 668 38c: 80 91 6f 01 lds r24, 0x016F
834 { -  
835 const prog_char *s = 669 390: 8d 7f andi r24, 0xFD ; 253
836 PSTR("$PSRF106,21*0F\r\n"); // Select datum of WGS84 (for EM-406A) 670 392: 80 93 6f 01 sts 0x016F, r24
837 char c; 671 sei();
838   -  
839 while ((c = pgm_read_byte(s++)) != 0) uart_put(c); -  
840 472: 2f 5f subi r18, 0xFF ; 255 672 396: 78 94 sei
841 474: 3f 4f sbci r19, 0xFF ; 255 673 398: 02 c0 rjmp .+4 ; 0x39e <main+0x134>
842 476: 94 91 lpm r25, Z 674 39a: ee 24 eor r14, r14
843 478: 99 23 and r25, r25 675 39c: ff 24 eor r15, r15
844 47a: a1 f7 brne .-24 ; 0x464 <main+0xf0> 676 } while (Timer);
845   677  
846 beep(5, 1); // Single beep. Start to get current time. 678 beep(5, 1); // Single beep. Start to get current time.
847 uart_init(); 679 uart_init();
848 gp_init(); // Initialize GPS module to let output data in NMEA-0183 format. -  
849 do { // Wait for valid RMC sentence. 680 do { // Wait for valid RMC sentence.
850 b = get_line(); 681 b = get_line();
851 47c: 0e 94 04 01 call 0x208 ; 0x208 <get_line> 682 39e: 0e 94 e3 00 call 0x1c6 ; 0x1c6 <get_line>
-   683 if (!b) break;
-   684 3a2: 88 23 and r24, r24
-   685 3a4: 09 f4 brne .+2 ; 0x3a8 <main+0x13e>
-   686 3a6: ac cf rjmp .-168 ; 0x300 <main+0x96>
-   687 if (gp_comp(Buff, PSTR("$GPRMC"))) continue;
-   688 3a8: 2b e7 ldi r18, 0x7B ; 123
-   689 3aa: 30 e0 ldi r19, 0x00 ; 0
-   690 3ac: ad e1 ldi r26, 0x1D ; 29
-   691 3ae: b1 e0 ldi r27, 0x01 ; 1
-   692 3b0: f9 01 movw r30, r18
-   693 BYTE gp_comp (BYTE *str1, const prog_uint8_t *str2)
-   694 {
-   695 BYTE c;
-   696  
-   697 do {
-   698 c = pgm_read_byte(str2++);
-   699 3b2: 2f 5f subi r18, 0xFF ; 255
-   700 3b4: 3f 4f sbci r19, 0xFF ; 255
-   701 3b6: 94 91 lpm r25, Z
-   702 } while (c && c == *str1++);
-   703 3b8: 99 23 and r25, r25
-   704 3ba: 29 f0 breq .+10 ; 0x3c6 <main+0x15c>
-   705 3bc: 8c 91 ld r24, X
-   706 3be: 98 17 cp r25, r24
-   707 3c0: 71 f4 brne .+28 ; 0x3de <main+0x174>
-   708 3c2: 11 96 adiw r26, 0x01 ; 1
-   709 3c4: f5 cf rjmp .-22 ; 0x3b0 <main+0x146>
-   710 3c6: ed e1 ldi r30, 0x1D ; 29
-   711 3c8: f1 e0 ldi r31, 0x01 ; 1
-   712 3ca: 82 e0 ldi r24, 0x02 ; 2
-   713 BYTE c;
-   714  
-   715  
-   716 while (col) {
-   717 do {
-   718 c = *buf++;
-   719 3cc: 90 81 ld r25, Z
-   720 if (c <= ' ') return NULL;
-   721 3ce: 91 32 cpi r25, 0x21 ; 33
-   722 3d0: 20 f3 brcs .-56 ; 0x39a <main+0x130>
-   723 BYTE c;
-   724  
-   725  
-   726 while (col) {
-   727 do {
-   728 c = *buf++;
-   729 3d2: 31 96 adiw r30, 0x01 ; 1
-   730 if (c <= ' ') return NULL;
-   731 } while (c != ',');
-   732 3d4: 9c 32 cpi r25, 0x2C ; 44
-   733 3d6: d1 f7 brne .-12 ; 0x3cc <main+0x162>
-   734 col--;
-   735 3d8: 81 50 subi r24, 0x01 ; 1
-   736 BYTE col /* Column number (0 is the 1st item) */
-   737 ) {
-   738 BYTE c;
-   739  
-   740  
-   741 while (col) {
-   742 3da: c1 f7 brne .-16 ; 0x3cc <main+0x162>
-   743 c = *buf++;
-   744 if (c <= ' ') return NULL;
-   745 } while (c != ',');
-   746 col--;
-   747 }
-   748 return (BYTE*)buf;
-   749 3dc: 7f 01 movw r14, r30
-   750 do { // Wait for valid RMC sentence.
-   751 b = get_line();
852 if (!b) break; 752 if (!b) break;
853 480: 88 23 and r24, r24 -  
854 482: 09 f4 brne .+2 ; 0x486 <main+0x112> -  
855 484: c1 cf rjmp .-126 ; 0x408 <main+0x94> -  
856 if (gp_comp(Buff, PSTR("$GPRMC"))) continue; 753 if (gp_comp(Buff, PSTR("$GPRMC"))) continue;
857 486: 60 e8 ldi r22, 0x80 ; 128 -  
858 488: 70 e0 ldi r23, 0x00 ; 0 -  
859 48a: c7 01 movw r24, r14 -  
860 48c: 0e 94 5b 01 call 0x2b6 ; 0x2b6 <gp_comp> -  
861 490: 88 23 and r24, r24 -  
862 492: 29 f4 brne .+10 ; 0x49e <main+0x12a> -  
863 p = gp_col(Buff,2); 754 p = gp_col(Buff,2);
864 494: 62 e0 ldi r22, 0x02 ; 2 -  
865 496: c7 01 movw r24, r14 -  
866 498: 0e 94 6a 01 call 0x2d4 ; 0x2d4 <gp_col> -  
867 49c: 6c 01 movw r12, r24 -  
868 } while (!p || *p != 'A'); 755 } while (!p || *p != 'A');
869 49e: c1 14 cp r12, r1 756 3de: e1 14 cp r14, r1
870 4a0: d1 04 cpc r13, r1 757 3e0: f1 04 cpc r15, r1
871 4a2: 61 f3 breq .-40 ; 0x47c <main+0x108> 758 3e2: e9 f2 breq .-70 ; 0x39e <main+0x134>
872 4a4: f6 01 movw r30, r12 759 3e4: f7 01 movw r30, r14
873 4a6: 80 81 ld r24, Z 760 3e6: 80 81 ld r24, Z
874 4a8: 81 34 cpi r24, 0x41 ; 65 761 3e8: 81 34 cpi r24, 0x41 ; 65
-   762 3ea: c9 f6 brne .-78 ; 0x39e <main+0x134>
-   763 3ec: ed e1 ldi r30, 0x1D ; 29
-   764 3ee: f1 e0 ldi r31, 0x01 ; 1
-   765 3f0: 89 e0 ldi r24, 0x09 ; 9
-   766 BYTE c;
-   767  
-   768  
-   769 while (col) {
-   770 do {
-   771 c = *buf++;
-   772 3f2: 90 81 ld r25, Z
-   773 if (c <= ' ') return NULL;
-   774 3f4: 91 32 cpi r25, 0x21 ; 33
-   775 3f6: 08 f4 brcc .+2 ; 0x3fa <main+0x190>
-   776 3f8: f0 c0 rjmp .+480 ; 0x5da <__stack+0xdb>
-   777 BYTE c;
-   778  
-   779  
-   780 while (col) {
-   781 do {
-   782 c = *buf++;
-   783 3fa: 31 96 adiw r30, 0x01 ; 1
-   784 if (c <= ' ') return NULL;
-   785 } while (c != ',');
-   786 3fc: 9c 32 cpi r25, 0x2C ; 44
-   787 3fe: c9 f7 brne .-14 ; 0x3f2 <main+0x188>
-   788 col--;
-   789 400: 81 50 subi r24, 0x01 ; 1
-   790 BYTE col /* Column number (0 is the 1st item) */
-   791 ) {
-   792 BYTE c;
-   793  
-   794  
-   795 while (col) {
875 4aa: 41 f7 brne .-48 ; 0x47c <main+0x108> 796 402: b9 f7 brne .-18 ; 0x3f2 <main+0x188>
-   797 c = *buf++;
-   798 if (c <= ' ') return NULL;
-   799 } while (c != ',');
-   800 col--;
-   801 }
-   802 return (BYTE*)buf;
-   803 404: 7f 01 movw r14, r30
-   804 p = gp_col(Buff,2);
-   805 } while (!p || *p != 'A');
876 if (!b) continue; 806 if (!b) continue;
877 p = gp_col(Buff,9); // Open log file with the name of current date (YYMMDD.log in UTC). 807 p = gp_col(Buff,9); // Open log file with the name of current date (YYMMDD.log in UTC).
878 4ac: 69 e0 ldi r22, 0x09 ; 9 -  
879 4ae: c7 01 movw r24, r14 -  
880 4b0: 0e 94 6a 01 call 0x2d4 ; 0x2d4 <gp_col> -  
881 4b4: 6c 01 movw r12, r24 -  
882 808
883 if (!p) {err = 3; break;} 809 if (!p) {err = 3; break;}
884 4b6: 00 97 sbiw r24, 0x00 ; 0 810 406: 30 97 sbiw r30, 0x00 ; 0
885 4b8: 11 f4 brne .+4 ; 0x4be <main+0x14a> 811 408: 09 f4 brne .+2 ; 0x40c <main+0x1a2>
886 4ba: 63 e0 ldi r22, 0x03 ; 3 -  
887 4bc: a8 c0 rjmp .+336 ; 0x60e <__stack+0x10f> 812 40a: e7 c0 rjmp .+462 ; 0x5da <__stack+0xdb>
888   813  
889 memcpy(&Buff[0], p+4, 2); 814 memcpy(&Buff[0], p+4, 2);
890 4be: fc 01 movw r30, r24 -  
891 4c0: 84 81 ldd r24, Z+4 ; 0x04 815 40c: 84 81 ldd r24, Z+4 ; 0x04
892 4c2: 95 81 ldd r25, Z+5 ; 0x05 816 40e: 95 81 ldd r25, Z+5 ; 0x05
893 4c4: 90 93 18 01 sts 0x0118, r25 817 410: 90 93 1e 01 sts 0x011E, r25
894 4c8: 80 93 17 01 sts 0x0117, r24 818 414: 80 93 1d 01 sts 0x011D, r24
895 memcpy(&Buff[2], p+2, 2); 819 memcpy(&Buff[2], p+2, 2);
896 4cc: 82 81 ldd r24, Z+2 ; 0x02 820 418: 82 81 ldd r24, Z+2 ; 0x02
897 4ce: 93 81 ldd r25, Z+3 ; 0x03 821 41a: 93 81 ldd r25, Z+3 ; 0x03
898 4d0: 90 93 1a 01 sts 0x011A, r25 822 41c: 90 93 20 01 sts 0x0120, r25
899 4d4: 80 93 19 01 sts 0x0119, r24 823 420: 80 93 1f 01 sts 0x011F, r24
900 memcpy(&Buff[4], p+0, 2); 824 memcpy(&Buff[4], p+0, 2);
901 4d8: 80 81 ld r24, Z 825 424: 80 81 ld r24, Z
902 4da: 91 81 ldd r25, Z+1 ; 0x01 826 426: 91 81 ldd r25, Z+1 ; 0x01
903 4dc: 90 93 1c 01 sts 0x011C, r25 827 428: 90 93 22 01 sts 0x0122, r25
904 4e0: 80 93 1b 01 sts 0x011B, r24 828 42c: 80 93 21 01 sts 0x0121, r24
905 strcpy_P(&Buff[6], PSTR(".log")); 829 strcpy_P(&Buff[6], PSTR(".log"));
906 4e4: 6b e7 ldi r22, 0x7B ; 123 830 430: 66 e7 ldi r22, 0x76 ; 118
907 4e6: 70 e0 ldi r23, 0x00 ; 0 831 432: 70 e0 ldi r23, 0x00 ; 0
908 4e8: 8d e1 ldi r24, 0x1D ; 29 832 434: 83 e2 ldi r24, 0x23 ; 35
909 4ea: 91 e0 ldi r25, 0x01 ; 1 833 436: 91 e0 ldi r25, 0x01 ; 1
910 4ec: 0e 94 8d 10 call 0x211a ; 0x211a <strcpy_P> 834 438: 0e 94 8f 11 call 0x231e ; 0x231e <strcpy_P>
-   835 if (f_open(&file1, Buff, FA_OPEN_ALWAYS | FA_WRITE) || f_lseek(&file1, file1.fsize)) { err = 4; break; }
-   836 43c: 42 e1 ldi r20, 0x12 ; 18
-   837 43e: 6d e1 ldi r22, 0x1D ; 29
-   838 440: 71 e0 ldi r23, 0x01 ; 1
-   839 442: 81 e1 ldi r24, 0x11 ; 17
-   840 444: 92 e0 ldi r25, 0x02 ; 2
-   841 446: 0e 94 d7 09 call 0x13ae ; 0x13ae <f_open>
-   842 44a: 89 2b or r24, r25
-   843 44c: 09 f0 breq .+2 ; 0x450 <main+0x1e6>
-   844 44e: c7 c0 rjmp .+398 ; 0x5de <__stack+0xdf>
-   845 450: 40 91 1b 02 lds r20, 0x021B
-   846 454: 50 91 1c 02 lds r21, 0x021C
-   847 458: 60 91 1d 02 lds r22, 0x021D
-   848 45c: 70 91 1e 02 lds r23, 0x021E
-   849 460: 81 e1 ldi r24, 0x11 ; 17
-   850 462: 92 e0 ldi r25, 0x02 ; 2
-   851 464: 0e 94 3c 05 call 0xa78 ; 0xa78 <f_lseek>
-   852 468: 89 2b or r24, r25
-   853 46a: 09 f0 breq .+2 ; 0x46e <main+0x204>
-   854 46c: b8 c0 rjmp .+368 ; 0x5de <__stack+0xdf>
-   855 46e: 92 e0 ldi r25, 0x02 ; 2
-   856 470: 0e c0 rjmp .+28 ; 0x48e <main+0x224>
-   857  
-   858 static
-   859 void beep (BYTE len, BYTE cnt)
-   860 {
-   861 while (cnt--) {
-   862 BEEP_ON();
-   863 472: a5 bc out 0x25, r10 ; 37
-   864 DELAY(len);
-   865 474: b0 92 1c 01 sts 0x011C, r11
-   866 478: 80 91 1c 01 lds r24, 0x011C
-   867 47c: 88 23 and r24, r24
-   868 47e: e1 f7 brne .-8 ; 0x478 <main+0x20e>
-   869 BEEP_OFF();
-   870 480: 15 bc out 0x25, r1 ; 37
-   871 DELAY(len);
-   872 482: b0 92 1c 01 sts 0x011C, r11
-   873 486: 80 91 1c 01 lds r24, 0x011C
-   874 48a: 88 23 and r24, r24
-   875 48c: e1 f7 brne .-8 ; 0x486 <main+0x21c>
-   876 /* Controls */
-   877  
-   878 static
-   879 void beep (BYTE len, BYTE cnt)
-   880 {
-   881 while (cnt--) {
-   882 48e: 91 50 subi r25, 0x01 ; 1
-   883 490: 80 f7 brcc .-32 ; 0x472 <main+0x208>
-   884 492: 85 c0 rjmp .+266 ; 0x59e <__stack+0x9f>
911 if (f_open(&file1, Buff, FA_OPEN_ALWAYS | FA_WRITE) || f_lseek(&file1, file1.fsize)) { err = 4; break; } 885 if (f_open(&file1, Buff, FA_OPEN_ALWAYS | FA_WRITE) || f_lseek(&file1, file1.fsize)) { err = 4; break; }
912 4f0: 42 e1 ldi r20, 0x12 ; 18 -  
913 4f2: b7 01 movw r22, r14 -  
914 4f4: c5 01 movw r24, r10 -  
915 4f6: 0e 94 44 09 call 0x1288 ; 0x1288 <f_open> -  
916 4fa: 89 2b or r24, r25 -  
917 4fc: 09 f0 breq .+2 ; 0x500 <__stack+0x1> -  
918 4fe: 86 c0 rjmp .+268 ; 0x60c <__stack+0x10d> -  
919 500: 40 91 15 02 lds r20, 0x0215 -  
920 504: 50 91 16 02 lds r21, 0x0216 -  
921 508: 60 91 17 02 lds r22, 0x0217 -  
922 50c: 70 91 18 02 lds r23, 0x0218 -  
923 510: c5 01 movw r24, r10 -  
924 512: 0e 94 8b 05 call 0xb16 ; 0xb16 <f_lseek> -  
925 516: 89 2b or r24, r25 -  
926 518: 09 f0 breq .+2 ; 0x51c <__stack+0x1d> -  
927 51a: 78 c0 rjmp .+240 ; 0x60c <__stack+0x10d> -  
928   886  
929 beep(5, 2); // Two beeps. Start logging. 887 beep(5, 2); // Two beeps. Start logging.
930 51c: 62 e0 ldi r22, 0x02 ; 2 -  
931 51e: 85 e0 ldi r24, 0x05 ; 5 -  
932 520: 0e 94 47 01 call 0x28e ; 0x28e <beep> -  
933 524: 65 c0 rjmp .+202 ; 0x5f0 <__stack+0xf1> -  
934 err = 0; 888 err = 0;
935 while ((b = get_line()) > 0) { 889 while ((b = get_line()) > 0) {
936 if ( !gp_comp(Buff, PSTR("$GPGGA")) // Which sentence is logged? 890 if ( !gp_comp(Buff, PSTR("$GPGGA")) // Which sentence is logged?
937 526: 64 e7 ldi r22, 0x74 ; 116 891 494: 2f e6 ldi r18, 0x6F ; 111
938 528: 70 e0 ldi r23, 0x00 ; 0 892 496: 30 e0 ldi r19, 0x00 ; 0
-   893 498: ad e1 ldi r26, 0x1D ; 29
-   894 49a: b1 e0 ldi r27, 0x01 ; 1
939 52a: c7 01 movw r24, r14 895 49c: f9 01 movw r30, r18
-   896 BYTE gp_comp (BYTE *str1, const prog_uint8_t *str2)
-   897 {
-   898 BYTE c;
-   899  
-   900 do {
-   901 c = pgm_read_byte(str2++);
-   902 49e: 2f 5f subi r18, 0xFF ; 255
940 52c: 0e 94 5b 01 call 0x2b6 ; 0x2b6 <gp_comp> 903 4a0: 3f 4f sbci r19, 0xFF ; 255
-   904 4a2: 94 91 lpm r25, Z
-   905 } while (c && c == *str1++);
941 530: 88 23 and r24, r24 906 4a4: 99 23 and r25, r25
-   907 4a6: 89 f0 breq .+34 ; 0x4ca <main+0x260>
-   908 4a8: 8c 91 ld r24, X
-   909 4aa: 98 17 cp r25, r24
942 532: 41 f0 breq .+16 ; 0x544 <__stack+0x45> 910 4ac: 09 f0 breq .+2 ; 0x4b0 <main+0x246>
-   911 4ae: ae c0 rjmp .+348 ; 0x60c <__stack+0x10d>
943 534: 6d e6 ldi r22, 0x6D ; 109 912 4b0: 11 96 adiw r26, 0x01 ; 1
-   913 4b2: f4 cf rjmp .-24 ; 0x49c <main+0x232>
-   914 BYTE gp_comp (BYTE *str1, const prog_uint8_t *str2)
-   915 {
-   916 BYTE c;
-   917  
-   918 do {
-   919 c = pgm_read_byte(str2++);
944 536: 70 e0 ldi r23, 0x00 ; 0 920 4b4: 11 96 adiw r26, 0x01 ; 1
945 538: c7 01 movw r24, r14 921 4b6: f9 01 movw r30, r18
-   922 4b8: 2f 5f subi r18, 0xFF ; 255
946 53a: 0e 94 5b 01 call 0x2b6 ; 0x2b6 <gp_comp> 923 4ba: 3f 4f sbci r19, 0xFF ; 255
-   924 4bc: 94 91 lpm r25, Z
-   925 } while (c && c == *str1++);
947 53e: 88 23 and r24, r24 926 4be: 99 23 and r25, r25
948 540: 09 f0 breq .+2 ; 0x544 <__stack+0x45> 927 4c0: 21 f0 breq .+8 ; 0x4ca <main+0x260>
-   928 4c2: 8c 91 ld r24, X
-   929 4c4: 98 17 cp r25, r24
-   930 4c6: b1 f3 breq .-20 ; 0x4b4 <main+0x24a>
949 542: 44 c0 rjmp .+136 ; 0x5cc <__stack+0xcd> 931 4c8: 57 c0 rjmp .+174 ; 0x578 <__stack+0x79>
950 // || !gp_comp(Buff, PSTR("$GPGSV")) 932 // || !gp_comp(Buff, PSTR("$GPGSV"))
951 // || !gp_comp(Buff, PSTR("$GPZDA")) 933 // || !gp_comp(Buff, PSTR("$GPZDA"))
952 // || !gp_comp(Buff, PSTR("$GPVTG")) 934 // || !gp_comp(Buff, PSTR("$GPVTG"))
953 ) 935 )
954 { 936 {
955 if (f_write(&file1, Buff, b, &s) || b != s) { err = 5; break; }; 937 if (f_write(&file1, Buff, b, &s) || b != s) { err = 5; break; };
956 544: 01 2f mov r16, r17 938 4ca: 04 2f mov r16, r20
957 546: 11 27 eor r17, r17 939 4cc: 10 e0 ldi r17, 0x00 ; 0
958 548: 92 01 movw r18, r4 940 4ce: 94 01 movw r18, r8
959 54a: a8 01 movw r20, r16 941 4d0: a8 01 movw r20, r16
960 54c: b7 01 movw r22, r14 942 4d2: 6d e1 ldi r22, 0x1D ; 29
-   943 4d4: 71 e0 ldi r23, 0x01 ; 1
961 54e: c5 01 movw r24, r10 944 4d6: 81 e1 ldi r24, 0x11 ; 17
-   945 4d8: 92 e0 ldi r25, 0x02 ; 2
962 550: 0e 94 c0 06 call 0xd80 ; 0xd80 <f_write> 946 4da: 0e 94 0e 07 call 0xe1c ; 0xe1c <f_write>
963 554: 89 2b or r24, r25 947 4de: 89 2b or r24, r25
964 556: 09 f0 breq .+2 ; 0x55a <__stack+0x5b> 948 4e0: 09 f0 breq .+2 ; 0x4e4 <main+0x27a>
965 558: 52 c0 rjmp .+164 ; 0x5fe <__stack+0xff> 949 4e2: 64 c0 rjmp .+200 ; 0x5ac <__stack+0xad>
966 55a: 89 81 ldd r24, Y+1 ; 0x01 950 4e4: 89 81 ldd r24, Y+1 ; 0x01
967 55c: 9a 81 ldd r25, Y+2 ; 0x02 951 4e6: 9a 81 ldd r25, Y+2 ; 0x02
968 55e: 08 17 cp r16, r24 952 4e8: 08 17 cp r16, r24
969 560: 19 07 cpc r17, r25 953 4ea: 19 07 cpc r17, r25
970 562: 09 f0 breq .+2 ; 0x566 <__stack+0x67> 954 4ec: 09 f0 breq .+2 ; 0x4f0 <main+0x286>
971 564: 4c c0 rjmp .+152 ; 0x5fe <__stack+0xff> 955 4ee: 5e c0 rjmp .+188 ; 0x5ac <__stack+0xad>
972 itoa(battery,&Value1,10); 956 itoa(battery,&Value1,10); // convert number to character
973 566: 4a e0 ldi r20, 0x0A ; 10 957 4f0: 4a e0 ldi r20, 0x0A ; 10
974 568: 50 e0 ldi r21, 0x00 ; 0 958 4f2: 50 e0 ldi r21, 0x00 ; 0
975 56a: b3 01 movw r22, r6 959 4f4: 68 e1 ldi r22, 0x18 ; 24
-   960 4f6: 71 e0 ldi r23, 0x01 ; 1
976 56c: 80 91 6e 01 lds r24, 0x016E 961 4f8: 80 91 74 01 lds r24, 0x0174
977 570: 90 91 6f 01 lds r25, 0x016F 962 4fc: 90 91 75 01 lds r25, 0x0175
978 574: 0e 94 b8 10 call 0x2170 ; 0x2170 <itoa> 963 500: 0e 94 b3 11 call 0x2366 ; 0x2366 <itoa>
979 itoa(intensity,&Value2,10); 964 itoa(intensity,&Value2,10);
980 578: 4a e0 ldi r20, 0x0A ; 10 965 504: 4a e0 ldi r20, 0x0A ; 10
981 57a: 50 e0 ldi r21, 0x00 ; 0 966 506: 50 e0 ldi r21, 0x00 ; 0
-   967 508: 60 e7 ldi r22, 0x70 ; 112
982 57c: b4 01 movw r22, r8 968 50a: 71 e0 ldi r23, 0x01 ; 1
983 57e: 80 91 09 02 lds r24, 0x0209 969 50c: 80 91 0f 02 lds r24, 0x020F
984 582: 90 91 0a 02 lds r25, 0x020A 970 510: 90 91 10 02 lds r25, 0x0210
985 586: 0e 94 b8 10 call 0x2170 ; 0x2170 <itoa> 971 514: 0e 94 b3 11 call 0x2366 ; 0x2366 <itoa>
986 strcpy(&Buff[0], Value1); 972 sprintf(Buff,"%d,%d\n",Value1,Value2);
-   973 518: 7f 92 push r7
987 58a: b3 01 movw r22, r6 974 51a: 6f 92 push r6
-   975 51c: 3f 92 push r3
-   976 51e: 2f 92 push r2
-   977 520: 5f 92 push r5
-   978 522: 4f 92 push r4
-   979 524: df 92 push r13
988 58c: c7 01 movw r24, r14 980 526: cf 92 push r12
989 58e: 0e 94 b1 10 call 0x2162 ; 0x2162 <strcpy> 981 528: 0e 94 d4 11 call 0x23a8 ; 0x23a8 <sprintf>
-   982 if (f_write(&file1, Buff,strlen(Buff), &s) || (strlen(Buff) != s)) { err = 8; break; };
990 strcpy_P(&Buff[4], PSTR(",")); 983 52c: f6 01 movw r30, r12
991 592: 6b e6 ldi r22, 0x6B ; 107 984 52e: 01 90 ld r0, Z+
992 594: 70 e0 ldi r23, 0x00 ; 0 985 530: 00 20 and r0, r0
-   986 532: e9 f7 brne .-6 ; 0x52e <__stack+0x2f>
993 596: 8b e1 ldi r24, 0x1B ; 27 987 534: 31 97 sbiw r30, 0x01 ; 1
994 598: 91 e0 ldi r25, 0x01 ; 1 988 536: ec 19 sub r30, r12
995 59a: 0e 94 8d 10 call 0x211a ; 0x211a <strcpy_P> 989 538: fd 09 sbc r31, r13
996 strcpy(&Buff[5], Value2); 990 53a: 94 01 movw r18, r8
997 59e: b4 01 movw r22, r8 991 53c: af 01 movw r20, r30
998 5a0: 8c e1 ldi r24, 0x1C ; 28 992 53e: 6d e1 ldi r22, 0x1D ; 29
999 5a2: 91 e0 ldi r25, 0x01 ; 1 993 540: 71 e0 ldi r23, 0x01 ; 1
-   994 542: 81 e1 ldi r24, 0x11 ; 17
-   995 544: 92 e0 ldi r25, 0x02 ; 2
1000 5a4: 0e 94 b1 10 call 0x2162 ; 0x2162 <strcpy> 996 546: 0e 94 0e 07 call 0xe1c ; 0xe1c <f_write>
1001 strcpy_P(&Buff[9], PSTR("\r\n")); 997 54a: 2d b7 in r18, 0x3d ; 61
1002 5a8: 68 e6 ldi r22, 0x68 ; 104 998 54c: 3e b7 in r19, 0x3e ; 62
1003 5aa: 70 e0 ldi r23, 0x00 ; 0 999 54e: 28 5f subi r18, 0xF8 ; 248
1004 5ac: c1 01 movw r24, r2 1000 550: 3f 4f sbci r19, 0xFF ; 255
1005 5ae: 0e 94 8d 10 call 0x211a ; 0x211a <strcpy_P> 1001 552: 0f b6 in r0, 0x3f ; 63
1006 if (f_write(&file1, Buff, 11, &s) || 11 != s) { err = 5; break; }; 1002 554: f8 94 cli
1007 5b2: 92 01 movw r18, r4 1003 556: 3e bf out 0x3e, r19 ; 62
1008 5b4: 4b e0 ldi r20, 0x0B ; 11 1004 558: 0f be out 0x3f, r0 ; 63
1009 5b6: 50 e0 ldi r21, 0x00 ; 0 1005 55a: 2d bf out 0x3d, r18 ; 61
1010 5b8: b7 01 movw r22, r14 1006 55c: 89 2b or r24, r25
-   1007 55e: 41 f5 brne .+80 ; 0x5b0 <__stack+0xb1>
1011 5ba: c5 01 movw r24, r10 1008 560: d6 01 movw r26, r12
1012 5bc: 0e 94 c0 06 call 0xd80 ; 0xd80 <f_write> 1009 562: 0d 90 ld r0, X+
1013 5c0: 89 2b or r24, r25 1010 564: 00 20 and r0, r0
1014 5c2: e9 f4 brne .+58 ; 0x5fe <__stack+0xff> 1011 566: e9 f7 brne .-6 ; 0x562 <__stack+0x63>
-   1012 568: 11 97 sbiw r26, 0x01 ; 1
-   1013 56a: ac 19 sub r26, r12
-   1014 56c: bd 09 sbc r27, r13
1015 5c4: 89 81 ldd r24, Y+1 ; 0x01 1015 56e: 89 81 ldd r24, Y+1 ; 0x01
1016 5c6: 9a 81 ldd r25, Y+2 ; 0x02 1016 570: 9a 81 ldd r25, Y+2 ; 0x02
-   1017 572: a8 17 cp r26, r24
1017 5c8: 0b 97 sbiw r24, 0x0b ; 11 1018 574: b9 07 cpc r27, r25
1018 5ca: c9 f4 brne .+50 ; 0x5fe <__stack+0xff> 1019 576: e1 f4 brne .+56 ; 0x5b0 <__stack+0xb1>
1019 } 1020 }
1020 if ((Stat & 4) == 0) continue; 1021 if ((Stat & 4) == 0) continue;
1021 5cc: 80 91 69 01 lds r24, 0x0169 1022 578: 80 91 6f 01 lds r24, 0x016F
1022 5d0: 82 ff sbrs r24, 2 1023 57c: 82 ff sbrs r24, 2
1023 5d2: 0e c0 rjmp .+28 ; 0x5f0 <__stack+0xf1> 1024 57e: 0f c0 rjmp .+30 ; 0x59e <__stack+0x9f>
1024 if (f_sync(&file1)) { err = 6; break; };// Synchronize the file in interval of 300 sec. 1025 if (f_sync(&file1)) { err = 6; break; };// Synchronize the file in interval of 300 sec.
1025 5d4: c5 01 movw r24, r10 1026 580: 81 e1 ldi r24, 0x11 ; 17
-   1027 582: 92 e0 ldi r25, 0x02 ; 2
1026 5d6: 0e 94 5d 06 call 0xcba ; 0xcba <f_sync> 1028 584: 0e 94 a9 06 call 0xd52 ; 0xd52 <f_sync>
1027 5da: 89 2b or r24, r25 1029 588: 89 2b or r24, r25
1028 5dc: 11 f0 breq .+4 ; 0x5e2 <__stack+0xe3> 1030 58a: 11 f0 breq .+4 ; 0x590 <__stack+0x91>
1029 5de: 66 e0 ldi r22, 0x06 ; 6 1031 58c: 96 e0 ldi r25, 0x06 ; 6
1030 5e0: 16 c0 rjmp .+44 ; 0x60e <__stack+0x10f> 1032 58e: 28 c0 rjmp .+80 ; 0x5e0 <__stack+0xe1>
1031 cli(); Stat &= 0xFB; sei(); // Clear sync request 1033 cli(); Stat &= 0xFB; sei(); // Clear sync request
1032 5e2: f8 94 cli 1034 590: f8 94 cli
1033 5e4: 80 91 69 01 lds r24, 0x0169 1035 592: 80 91 6f 01 lds r24, 0x016F
1034 5e8: 8b 7f andi r24, 0xFB ; 251 1036 596: 8b 7f andi r24, 0xFB ; 251
1035 5ea: 80 93 69 01 sts 0x0169, r24 1037 598: 80 93 6f 01 sts 0x016F, r24
1036 5ee: 78 94 sei 1038 59c: 78 94 sei
1037 strcpy_P(&Buff[6], PSTR(".log")); 1039 strcpy_P(&Buff[6], PSTR(".log"));
1038 if (f_open(&file1, Buff, FA_OPEN_ALWAYS | FA_WRITE) || f_lseek(&file1, file1.fsize)) { err = 4; break; } 1040 if (f_open(&file1, Buff, FA_OPEN_ALWAYS | FA_WRITE) || f_lseek(&file1, file1.fsize)) { err = 4; break; }
1039   1041  
1040 beep(5, 2); // Two beeps. Start logging. 1042 beep(5, 2); // Two beeps. Start logging.
1041 err = 0; 1043 err = 0;
1042 while ((b = get_line()) > 0) { 1044 while ((b = get_line()) > 0) {
1043 5f0: 0e 94 04 01 call 0x208 ; 0x208 <get_line> 1045 59e: 0e 94 e3 00 call 0x1c6 ; 0x1c6 <get_line>
1044 5f4: 18 2f mov r17, r24 1046 5a2: 48 2f mov r20, r24
1045 5f6: 88 23 and r24, r24 1047 5a4: 88 23 and r24, r24
1046 5f8: 09 f0 breq .+2 ; 0x5fc <__stack+0xfd> 1048 5a6: 09 f0 breq .+2 ; 0x5aa <__stack+0xab>
1047 5fa: 95 cf rjmp .-214 ; 0x526 <__stack+0x27> 1049 5a8: 75 cf rjmp .-278 ; 0x494 <main+0x22a>
1048 5fc: 0f c0 rjmp .+30 ; 0x61c <__stack+0x11d> 1050 5aa: 35 c0 rjmp .+106 ; 0x616 <__stack+0x117>
1049 5fe: 65 e0 ldi r22, 0x05 ; 5 1051 5ac: 95 e0 ldi r25, 0x05 ; 5
1050 600: 06 c0 rjmp .+12 ; 0x60e <__stack+0x10f> 1052 5ae: 18 c0 rjmp .+48 ; 0x5e0 <__stack+0xe1>
1051 uart_stop(); 1053 5b0: 98 e0 ldi r25, 0x08 ; 8
1052 GPS_OFF(); -  
1053 if (f_close(&file1)) { err = 7; break; }; 1054 5b2: 16 c0 rjmp .+44 ; 0x5e0 <__stack+0xe1>
1054   1055  
-   1056 static
-   1057 void beep (BYTE len, BYTE cnt)
-   1058 {
-   1059 while (cnt--) {
-   1060 BEEP_ON();
1055 // When a long beep is sounded, the shutdoun process has been succeeded. 1061 5b4: a5 bc out 0x25, r10 ; 37
1056 beep(50, 1); 1062 DELAY(len);
1057 602: 61 e0 ldi r22, 0x01 ; 1 1063 5b6: 32 e3 ldi r19, 0x32 ; 50
-   1064 5b8: 30 93 1c 01 sts 0x011C, r19
-   1065 5bc: 80 91 1c 01 lds r24, 0x011C
-   1066 5c0: 88 23 and r24, r24
-   1067 5c2: e1 f7 brne .-8 ; 0x5bc <__stack+0xbd>
-   1068 BEEP_OFF();
-   1069 5c4: 15 bc out 0x25, r1 ; 37
-   1070 DELAY(len);
1058 604: 82 e3 ldi r24, 0x32 ; 50 1071 5c6: 82 e3 ldi r24, 0x32 ; 50
-   1072 5c8: 80 93 1c 01 sts 0x011C, r24
1059 606: 0e 94 47 01 call 0x28e ; 0x28e <beep> 1073 5cc: 80 91 1c 01 lds r24, 0x011C
-   1074 5d0: 88 23 and r24, r24
-   1075 5d2: e1 f7 brne .-8 ; 0x5cc <__stack+0xcd>
-   1076 /* Controls */
-   1077  
-   1078 static
-   1079 void beep (BYTE len, BYTE cnt)
-   1080 {
-   1081 while (cnt--) {
-   1082 5d4: 91 50 subi r25, 0x01 ; 1
-   1083 5d6: 70 f7 brcc .-36 ; 0x5b4 <__stack+0xb5>
1060 60a: fe ce rjmp .-516 ; 0x408 <main+0x94> 1084 5d8: 93 ce rjmp .-730 ; 0x300 <main+0x96>
-   1085 5da: 93 e0 ldi r25, 0x03 ; 3
-   1086 5dc: 01 c0 rjmp .+2 ; 0x5e0 <__stack+0xe1>
1061 60c: 64 e0 ldi r22, 0x04 ; 4 1087 5de: 94 e0 ldi r25, 0x04 ; 4
1062   1088  
1063   1089  
1064 static 1090 static
1065 void uart_stop (void) 1091 void uart_stop (void)
1066 { 1092 {
1067 UCSR0B = 0; 1093 UCSR0B = 0;
1068 60e: 10 92 c1 00 sts 0x00C1, r1 1094 5e0: 10 92 c1 00 sts 0x00C1, r1
1069 beep(50, 1); 1095 beep(50, 1);
1070 } 1096 }
1071   1097  
1072 // Unrecoverble error. Enter shutdown state. 1098 // Unrecoverble error. Enter shutdown state.
1073 uart_stop(); 1099 uart_stop();
1074 GPS_OFF(); 1100 GPS_OFF();
1075 612: 29 98 cbi 0x05, 1 ; 5 1101 5e4: 29 98 cbi 0x05, 1 ; 5
-   1102  
-   1103 static
-   1104 void beep (BYTE len, BYTE cnt)
-   1105 {
-   1106 while (cnt--) {
-   1107 BEEP_ON();
-   1108 5e6: 33 e0 ldi r19, 0x03 ; 3
1076 beep(25, err); 1109 DELAY(len);
1077 614: 89 e1 ldi r24, 0x19 ; 25 1110 5e8: 29 e1 ldi r18, 0x19 ; 25
-   1111  
-   1112 static
-   1113 void beep (BYTE len, BYTE cnt)
-   1114 {
-   1115 while (cnt--) {
-   1116 BEEP_ON();
-   1117 5ea: 35 bd out 0x25, r19 ; 37
-   1118 DELAY(len);
-   1119 5ec: 20 93 1c 01 sts 0x011C, r18
-   1120 5f0: 80 91 1c 01 lds r24, 0x011C
-   1121 5f4: 88 23 and r24, r24
-   1122 5f6: e1 f7 brne .-8 ; 0x5f0 <__stack+0xf1>
-   1123 BEEP_OFF();
-   1124 5f8: 15 bc out 0x25, r1 ; 37
-   1125 DELAY(len);
-   1126 5fa: 20 93 1c 01 sts 0x011C, r18
1078 616: 0e 94 47 01 call 0x28e ; 0x28e <beep> 1127 5fe: 80 91 1c 01 lds r24, 0x011C
-   1128 602: 88 23 and r24, r24
-   1129 604: e1 f7 brne .-8 ; 0x5fe <__stack+0xff>
-   1130 606: 91 50 subi r25, 0x01 ; 1
-   1131 /* Controls */
-   1132  
-   1133 static
-   1134 void beep (BYTE len, BYTE cnt)
-   1135 {
-   1136 while (cnt--) {
-   1137 608: 81 f7 brne .-32 ; 0x5ea <__stack+0xeb>
1079 61a: ff cf rjmp .-2 ; 0x61a <__stack+0x11b> 1138 60a: ff cf rjmp .-2 ; 0x60a <__stack+0x10b>
-   1139  
-   1140 beep(5, 2); // Two beeps. Start logging.
-   1141 err = 0;
-   1142 while ((b = get_line()) > 0) {
-   1143 if ( !gp_comp(Buff, PSTR("$GPGGA")) // Which sentence is logged?
-   1144 || !gp_comp(Buff, PSTR("$GPRMC"))
-   1145 60c: 28 e6 ldi r18, 0x68 ; 104
-   1146 60e: 30 e0 ldi r19, 0x00 ; 0
-   1147 610: ad e1 ldi r26, 0x1D ; 29
-   1148 612: b1 e0 ldi r27, 0x01 ; 1
-   1149 614: 50 cf rjmp .-352 ; 0x4b6 <main+0x24c>
1080   1150  
1081   1151  
1082 static 1152 static
1083 void uart_stop (void) 1153 void uart_stop (void)
1084 { 1154 {
1085 UCSR0B = 0; 1155 UCSR0B = 0;
1086 61c: 10 92 c1 00 sts 0x00C1, r1 1156 616: 10 92 c1 00 sts 0x00C1, r1
1087 } 1157 }
1088 if (err) break; 1158 if (err) break;
1089   1159  
1090 // Turn-off GPS power and close the log file by power supply is discharged. 1160 // Turn-off GPS power and close the log file by power supply is discharged.
1091 uart_stop(); 1161 uart_stop();
1092 GPS_OFF(); 1162 GPS_OFF();
1093 620: 29 98 cbi 0x05, 1 ; 5 1163 61a: 29 98 cbi 0x05, 1 ; 5
1094 if (f_close(&file1)) { err = 7; break; }; 1164 if (f_close(&file1)) { err = 7; break; };
1095 622: c5 01 movw r24, r10 1165 61c: 81 e1 ldi r24, 0x11 ; 17
-   1166 61e: 92 e0 ldi r25, 0x02 ; 2
1096 624: 0e 94 b4 06 call 0xd68 ; 0xd68 <f_close> 1167 620: 0e 94 00 07 call 0xe00 ; 0xe00 <f_close>
1097 628: 89 2b or r24, r25 1168 624: 89 2b or r24, r25
1098 62a: 59 f3 breq .-42 ; 0x602 <__stack+0x103> 1169 626: 11 f0 breq .+4 ; 0x62c <__stack+0x12d>
1099 62c: 67 e0 ldi r22, 0x07 ; 7 1170 628: 97 e0 ldi r25, 0x07 ; 7
-   1171 62a: da cf rjmp .-76 ; 0x5e0 <__stack+0xe1>
-   1172 62c: 91 e0 ldi r25, 0x01 ; 1
1100 62e: ef cf rjmp .-34 ; 0x60e <__stack+0x10f> 1173 62e: d2 cf rjmp .-92 ; 0x5d4 <__stack+0xd5>
1101   1174  
1102 00000630 <clust2sect>: 1175 00000630 <__vector_11>:
-   1176 /* 100Hz timer interrupt generated by OC1A */
-   1177 /*---------------------------------------------------------*/
1103   1178  
1104 static -  
1105 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */ -  
1106 CLUST clust /* Cluster# to be converted */ -  
1107 ) 1179  
-   1180 ISR(TIMER1_COMPA_vect)
1108 { 1181 {
1109 630: cf 93 push r28 1182 630: 1f 92 push r1
1110 632: df 93 push r29 1183 632: 0f 92 push r0
-   1184 634: 0f b6 in r0, 0x3f ; 63
1111 FATFS *fs = FatFs; 1185 636: 0f 92 push r0
1112 634: c0 91 0a 01 lds r28, 0x010A 1186 638: 11 24 eor r1, r1
-   1187 63a: 2f 93 push r18
-   1188 63c: 8f 93 push r24
1113 638: d0 91 0b 01 lds r29, 0x010B 1189 63e: 9f 93 push r25
-   1190 BYTE n;
-   1191 static WORD ivt_sync;
1114   1192  
1115   1193  
1116 clust -= 2; 1194 n = Timer;
1117 63c: bc 01 movw r22, r24 -  
1118 63e: 62 50 subi r22, 0x02 ; 2 1195 640: 80 91 1c 01 lds r24, 0x011C
1119 640: 70 40 sbci r23, 0x00 ; 0 1196 if (n) Timer = n - 1;
1120 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */ -  
1121 642: 8e 89 ldd r24, Y+22 ; 0x16 1197 644: 88 23 and r24, r24
1122 644: 9f 89 ldd r25, Y+23 ; 0x17 1198 646: 19 f0 breq .+6 ; 0x64e <__vector_11+0x1e>
1123 646: 02 97 sbiw r24, 0x02 ; 2 1199 648: 81 50 subi r24, 0x01 ; 1
1124 648: 68 17 cp r22, r24 1200 64a: 80 93 1c 01 sts 0x011C, r24
-   1201  
1125 64a: 79 07 cpc r23, r25 1202 if (++ivt_sync >= 180 * 100) {
1126 64c: 28 f0 brcs .+10 ; 0x658 <clust2sect+0x28> -  
1127 64e: 20 e0 ldi r18, 0x00 ; 0 1203 64e: 80 91 0c 01 lds r24, 0x010C
1128 650: 30 e0 ldi r19, 0x00 ; 0 -  
1129 652: 40 e0 ldi r20, 0x00 ; 0 1204 652: 90 91 0d 01 lds r25, 0x010D
1130 654: 50 e0 ldi r21, 0x00 ; 0 1205 656: 01 96 adiw r24, 0x01 ; 1
1131 656: 12 c0 rjmp .+36 ; 0x67c <clust2sect+0x4c> -  
1132 return (DWORD)clust * fs->sects_clust + fs->database; -  
1133 658: 88 27 eor r24, r24 -  
1134 65a: 99 27 eor r25, r25 1206 658: 90 93 0d 01 sts 0x010D, r25
1135 65c: 2d 8d ldd r18, Y+29 ; 0x1d -  
1136 65e: 33 27 eor r19, r19 1207 65c: 80 93 0c 01 sts 0x010C, r24
1137 660: 44 27 eor r20, r20 1208 660: 80 55 subi r24, 0x50 ; 80
1138 662: 55 27 eor r21, r21 1209 662: 96 44 sbci r25, 0x46 ; 70
1139 664: 0e 94 e9 10 call 0x21d2 ; 0x21d2 <__mulsi3> 1210 664: 48 f0 brcs .+18 ; 0x678 <__vector_11+0x48>
1140 668: 9b 01 movw r18, r22 1211 ivt_sync = 0;
1141 66a: ac 01 movw r20, r24 1212 666: 10 92 0d 01 sts 0x010D, r1
1142 66c: 88 89 ldd r24, Y+16 ; 0x10 1213 66a: 10 92 0c 01 sts 0x010C, r1
1143 66e: 99 89 ldd r25, Y+17 ; 0x11 1214 Stat |= 4;
1144 670: aa 89 ldd r26, Y+18 ; 0x12 1215 66e: 80 91 6f 01 lds r24, 0x016F
1145 672: bb 89 ldd r27, Y+19 ; 0x13 1216 672: 84 60 ori r24, 0x04 ; 4
1146 674: 28 0f add r18, r24 1217 674: 80 93 6f 01 sts 0x016F, r24
-   1218 }
-   1219  
1147 676: 39 1f adc r19, r25 1220 disk_timerproc(); /* Drive timer procedure of low level disk I/O module */
1148 678: 4a 1f adc r20, r26 1221 678: 0e 94 6f 11 call 0x22de ; 0x22de <disk_timerproc>
1149 67a: 5b 1f adc r21, r27 -  
-   1222  
1150 } 1223 }
1151 67c: ca 01 movw r24, r20 1224 67c: 9f 91 pop r25
1152 67e: b9 01 movw r22, r18 1225 67e: 8f 91 pop r24
1153 680: df 91 pop r29 1226 680: 2f 91 pop r18
1154 682: cf 91 pop r28 1227 682: 0f 90 pop r0
-   1228 684: 0f be out 0x3f, r0 ; 63
-   1229 686: 0f 90 pop r0
-   1230 688: 1f 90 pop r1
1155 684: 08 95 ret 1231 68a: 18 95 reti
1156   1232  
1157 00000686 <validate>: 1233 0000068c <validate>:
1158 static 1234 static
1159 FRESULT validate ( /* FR_OK(0): The id is valid, !=0: Not valid */ 1235 FRESULT validate ( /* FR_OK(0): The id is valid, !=0: Not valid */
1160 const FATFS *fs, /* Pointer to the file system object */ 1236 const FATFS *fs, /* Pointer to the file system object */
1161 WORD id /* id member of the target object to be checked */ 1237 WORD id /* id member of the target object to be checked */
1162 ) 1238 )
1163 { 1239 {
1164 686: fc 01 movw r30, r24 1240 68c: fc 01 movw r30, r24
1165 if (!fs || fs->id != id) 1241 if (!fs || fs->id != id)
1166 688: 89 2b or r24, r25 1242 68e: 00 97 sbiw r24, 0x00 ; 0
1167 68a: 61 f0 breq .+24 ; 0x6a4 <validate+0x1e> 1243 690: 69 f0 breq .+26 ; 0x6ac <validate+0x20>
1168 68c: 80 81 ld r24, Z 1244 692: 80 81 ld r24, Z
1169 68e: 91 81 ldd r25, Z+1 ; 0x01 1245 694: 91 81 ldd r25, Z+1 ; 0x01
1170 690: 86 17 cp r24, r22 1246 696: 86 17 cp r24, r22
1171 692: 97 07 cpc r25, r23 1247 698: 97 07 cpc r25, r23
1172 694: 39 f4 brne .+14 ; 0x6a4 <validate+0x1e> 1248 69a: 41 f4 brne .+16 ; 0x6ac <validate+0x20>
1173 return FR_INVALID_OBJECT; 1249 return FR_INVALID_OBJECT;
1174 if (disk_status(0) & STA_NOINIT) 1250 if (disk_status(0) & STA_NOINIT)
1175 696: 80 e0 ldi r24, 0x00 ; 0 1251 69c: 80 e0 ldi r24, 0x00 ; 0
1176 698: 0e 94 bf 0d call 0x1b7e ; 0x1b7e <disk_status> 1252 69e: 0e 94 95 0f call 0x1f2a ; 0x1f2a <disk_status>
1177 69c: 99 27 eor r25, r25 1253 6a2: 28 2f mov r18, r24
1178 69e: 81 70 andi r24, 0x01 ; 1 1254 6a4: 30 e0 ldi r19, 0x00 ; 0
1179 6a0: 90 70 andi r25, 0x00 ; 0 1255 6a6: 21 70 andi r18, 0x01 ; 1
1180 6a2: 08 95 ret 1256 6a8: 30 70 andi r19, 0x00 ; 0
-   1257 6aa: 02 c0 rjmp .+4 ; 0x6b0 <validate+0x24>
1181 6a4: 8c e0 ldi r24, 0x0C ; 12 1258 6ac: 2c e0 ldi r18, 0x0C ; 12
1182 6a6: 90 e0 ldi r25, 0x00 ; 0 1259 6ae: 30 e0 ldi r19, 0x00 ; 0
1183 return FR_NOT_READY; 1260 return FR_NOT_READY;
1184   1261  
1185 return FR_OK; 1262 return FR_OK;
1186 } 1263 }
-   1264 6b0: c9 01 movw r24, r18
1187 6a8: 08 95 ret 1265 6b2: 08 95 ret
1188   1266  
1189 000006aa <move_window>: 1267 000006b4 <move_window>:
1190   1268  
1191 static 1269 static
1192 BOOL move_window ( /* TRUE: successful, FALSE: failed */ 1270 BOOL move_window ( /* TRUE: successful, FALSE: failed */
1193 DWORD sector /* Sector number to make apperance in the FatFs->win */ 1271 DWORD sector /* Sector number to make apperance in the FatFs->win */
1194 ) /* Move to zero only writes back dirty window */ 1272 ) /* Move to zero only writes back dirty window */
1195 { 1273 {
1196 6aa: a0 e0 ldi r26, 0x00 ; 0 1274 6b4: a0 e0 ldi r26, 0x00 ; 0
1197 6ac: b0 e0 ldi r27, 0x00 ; 0 1275 6b6: b0 e0 ldi r27, 0x00 ; 0
1198 6ae: eb e5 ldi r30, 0x5B ; 91 1276 6b8: e0 e6 ldi r30, 0x60 ; 96
1199 6b0: f3 e0 ldi r31, 0x03 ; 3 1277 6ba: f3 e0 ldi r31, 0x03 ; 3
1200 6b2: 0c 94 2e 11 jmp 0x225c ; 0x225c <__prologue_saves__+0x8> 1278 6bc: 0c 94 cb 14 jmp 0x2996 ; 0x2996 <__prologue_saves__+0x8>
1201 6b6: 4b 01 movw r8, r22 1279 6c0: 4b 01 movw r8, r22
1202 6b8: 5c 01 movw r10, r24 1280 6c2: 5c 01 movw r10, r24
1203 DWORD wsect; 1281 DWORD wsect;
1204 FATFS *fs = FatFs; 1282 FATFS *fs = FatFs;
1205 6ba: c0 91 0a 01 lds r28, 0x010A 1283 6c4: c0 91 10 01 lds r28, 0x0110
1206 6be: d0 91 0b 01 lds r29, 0x010B 1284 6c8: d0 91 11 01 lds r29, 0x0111
1207   1285  
1208   1286  
1209 wsect = fs->winsect; 1287 wsect = fs->winsect;
1210 6c2: cc 80 ldd r12, Y+4 ; 0x04 1288 6cc: cc 80 ldd r12, Y+4 ; 0x04
1211 6c4: dd 80 ldd r13, Y+5 ; 0x05 1289 6ce: dd 80 ldd r13, Y+5 ; 0x05
1212 6c6: ee 80 ldd r14, Y+6 ; 0x06 1290 6d0: ee 80 ldd r14, Y+6 ; 0x06
1213 6c8: ff 80 ldd r15, Y+7 ; 0x07 1291 6d2: ff 80 ldd r15, Y+7 ; 0x07
1214 if (wsect != sector) { /* Changed current window */ 1292 if (wsect != sector) { /* Changed current window */
1215 6ca: c6 16 cp r12, r22 1293 6d4: c6 16 cp r12, r22
1216 6cc: d7 06 cpc r13, r23 1294 6d6: d7 06 cpc r13, r23
1217 6ce: e8 06 cpc r14, r24 1295 6d8: e8 06 cpc r14, r24
1218 6d0: f9 06 cpc r15, r25 1296 6da: f9 06 cpc r15, r25
1219 6d2: 09 f4 brne .+2 ; 0x6d6 <move_window+0x2c> 1297 6dc: 09 f4 brne .+2 ; 0x6e0 <move_window+0x2c>
1220 6d4: 4f c0 rjmp .+158 ; 0x774 <move_window+0xca> 1298 6de: 4e c0 rjmp .+156 ; 0x77c <move_window+0xc8>
1221 #if !_FS_READONLY 1299 #if !_FS_READONLY
1222 BYTE n; 1300 BYTE n;
1223 if (fs->winflag) { /* Write back dirty window if needed */ 1301 if (fs->winflag) { /* Write back dirty window if needed */
1224 6d6: 8f 8d ldd r24, Y+31 ; 0x1f 1302 6e0: 8f 8d ldd r24, Y+31 ; 0x1f
1225 6d8: 88 23 and r24, r24 1303 6e2: 88 23 and r24, r24
1226 6da: a1 f1 breq .+104 ; 0x744 <move_window+0x9a> 1304 6e4: a1 f1 breq .+104 ; 0x74e <move_window+0x9a>
1227 if (disk_write(0, fs->win, wsect, 1) != RES_OK) 1305 if (disk_write(0, fs->win, wsect, 1) != RES_OK)
1228 6dc: 80 e2 ldi r24, 0x20 ; 32 1306 6e6: 80 e2 ldi r24, 0x20 ; 32
1229 6de: 68 2e mov r6, r24 1307 6e8: 68 2e mov r6, r24
1230 6e0: 71 2c mov r7, r1 1308 6ea: 71 2c mov r7, r1
1231 6e2: 6c 0e add r6, r28 1309 6ec: 6c 0e add r6, r28
1232 6e4: 7d 1e adc r7, r29 1310 6ee: 7d 1e adc r7, r29
1233 6e6: 01 e0 ldi r16, 0x01 ; 1 1311 6f0: 01 e0 ldi r16, 0x01 ; 1
1234 6e8: a7 01 movw r20, r14 1312 6f2: a7 01 movw r20, r14
1235 6ea: 96 01 movw r18, r12 1313 6f4: 96 01 movw r18, r12
1236 6ec: b3 01 movw r22, r6 1314 6f6: b3 01 movw r22, r6
1237 6ee: 80 e0 ldi r24, 0x00 ; 0 1315 6f8: 80 e0 ldi r24, 0x00 ; 0
1238 6f0: 0e 94 d3 0e call 0x1da6 ; 0x1da6 <disk_write> 1316 6fa: 0e 94 fb 0f call 0x1ff6 ; 0x1ff6 <disk_write>
1239 6f4: 89 2b or r24, r25 1317 6fe: 89 2b or r24, r25
1240 6f6: d9 f5 brne .+118 ; 0x76e <move_window+0xc4> 1318 700: d9 f5 brne .+118 ; 0x778 <move_window+0xc4>
1241 return FALSE; 1319 return FALSE;
1242 fs->winflag = 0; 1320 fs->winflag = 0;
1243 6f8: 1f 8e std Y+31, r1 ; 0x1f 1321 702: 1f 8e std Y+31, r1 ; 0x1f
1244 if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */ 1322 if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
1245 6fa: 8c 89 ldd r24, Y+20 ; 0x14 1323 704: 8c 89 ldd r24, Y+20 ; 0x14
1246 6fc: 9d 89 ldd r25, Y+21 ; 0x15 1324 706: 9d 89 ldd r25, Y+21 ; 0x15
1247 6fe: aa 27 eor r26, r26 1325 708: a0 e0 ldi r26, 0x00 ; 0
1248 700: bb 27 eor r27, r27 1326 70a: b0 e0 ldi r27, 0x00 ; 0
1249 702: 28 85 ldd r18, Y+8 ; 0x08 1327 70c: 28 85 ldd r18, Y+8 ; 0x08
1250 704: 39 85 ldd r19, Y+9 ; 0x09 1328 70e: 39 85 ldd r19, Y+9 ; 0x09
1251 706: 4a 85 ldd r20, Y+10 ; 0x0a 1329 710: 4a 85 ldd r20, Y+10 ; 0x0a
1252 708: 5b 85 ldd r21, Y+11 ; 0x0b 1330 712: 5b 85 ldd r21, Y+11 ; 0x0b
1253 70a: 82 0f add r24, r18 1331 714: 82 0f add r24, r18
1254 70c: 93 1f adc r25, r19 1332 716: 93 1f adc r25, r19
1255 70e: a4 1f adc r26, r20 1333 718: a4 1f adc r26, r20
1256 710: b5 1f adc r27, r21 1334 71a: b5 1f adc r27, r21
1257 712: c8 16 cp r12, r24 1335 71c: c8 16 cp r12, r24
1258 714: d9 06 cpc r13, r25 1336 71e: d9 06 cpc r13, r25
1259 716: ea 06 cpc r14, r26 1337 720: ea 06 cpc r14, r26
1260 718: fb 06 cpc r15, r27 1338 722: fb 06 cpc r15, r27
1261 71a: a0 f4 brcc .+40 ; 0x744 <move_window+0x9a> 1339 724: a0 f4 brcc .+40 ; 0x74e <move_window+0x9a>
1262 for (n = fs->n_fats; n >= 2; n--) { /* Refrect the change to all FAT copies */ 1340 for (n = fs->n_fats; n >= 2; n--) { /* Refrect the change to all FAT copies */
1263 71c: 1e 8d ldd r17, Y+30 ; 0x1e 1341 726: 1e 8d ldd r17, Y+30 ; 0x1e
1264 71e: 10 c0 rjmp .+32 ; 0x740 <move_window+0x96> 1342 728: 10 c0 rjmp .+32 ; 0x74a <move_window+0x96>
1265 wsect += fs->sects_fat; 1343 wsect += fs->sects_fat;
1266 720: 8c 89 ldd r24, Y+20 ; 0x14 1344 72a: 8c 89 ldd r24, Y+20 ; 0x14
1267 722: 9d 89 ldd r25, Y+21 ; 0x15 1345 72c: 9d 89 ldd r25, Y+21 ; 0x15
1268 724: aa 27 eor r26, r26 1346 72e: a0 e0 ldi r26, 0x00 ; 0
1269 726: bb 27 eor r27, r27 1347 730: b0 e0 ldi r27, 0x00 ; 0
1270 728: c8 0e add r12, r24 1348 732: c8 0e add r12, r24
1271 72a: d9 1e adc r13, r25 1349 734: d9 1e adc r13, r25
1272 72c: ea 1e adc r14, r26 1350 736: ea 1e adc r14, r26
1273 72e: fb 1e adc r15, r27 1351 738: fb 1e adc r15, r27
1274 disk_write(0, fs->win, wsect, 1); 1352 disk_write(0, fs->win, wsect, 1);
1275 730: 01 e0 ldi r16, 0x01 ; 1 1353 73a: 01 e0 ldi r16, 0x01 ; 1
1276 732: a7 01 movw r20, r14 1354 73c: a7 01 movw r20, r14
1277 734: 96 01 movw r18, r12 1355 73e: 96 01 movw r18, r12
1278 736: b3 01 movw r22, r6 1356 740: b3 01 movw r22, r6
1279 738: 80 e0 ldi r24, 0x00 ; 0 1357 742: 80 e0 ldi r24, 0x00 ; 0
1280 73a: 0e 94 d3 0e call 0x1da6 ; 0x1da6 <disk_write> 1358 744: 0e 94 fb 0f call 0x1ff6 ; 0x1ff6 <disk_write>
1281 if (fs->winflag) { /* Write back dirty window if needed */ 1359 if (fs->winflag) { /* Write back dirty window if needed */
1282 if (disk_write(0, fs->win, wsect, 1) != RES_OK) 1360 if (disk_write(0, fs->win, wsect, 1) != RES_OK)
1283 return FALSE; 1361 return FALSE;
1284 fs->winflag = 0; 1362 fs->winflag = 0;
1285 if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */ 1363 if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */
1286 for (n = fs->n_fats; n >= 2; n--) { /* Refrect the change to all FAT copies */ 1364 for (n = fs->n_fats; n >= 2; n--) { /* Refrect the change to all FAT copies */
1287 73e: 11 50 subi r17, 0x01 ; 1 1365 748: 11 50 subi r17, 0x01 ; 1
1288 740: 12 30 cpi r17, 0x02 ; 2 1366 74a: 12 30 cpi r17, 0x02 ; 2
1289 742: 70 f7 brcc .-36 ; 0x720 <move_window+0x76> 1367 74c: 70 f7 brcc .-36 ; 0x72a <move_window+0x76>
1290 disk_write(0, fs->win, wsect, 1); 1368 disk_write(0, fs->win, wsect, 1);
1291 } 1369 }
1292 } 1370 }
1293 } 1371 }
1294 #endif 1372 #endif
1295 if (sector) { 1373 if (sector) {
1296 744: 81 14 cp r8, r1 1374 74e: 81 14 cp r8, r1
1297 746: 91 04 cpc r9, r1 1375 750: 91 04 cpc r9, r1
1298 748: a1 04 cpc r10, r1 1376 752: a1 04 cpc r10, r1
1299 74a: b1 04 cpc r11, r1 1377 754: b1 04 cpc r11, r1
1300 74c: 99 f0 breq .+38 ; 0x774 <move_window+0xca> 1378 756: 91 f0 breq .+36 ; 0x77c <move_window+0xc8>
1301 if (disk_read(0, fs->win, sector, 1) != RES_OK) 1379 if (disk_read(0, fs->win, sector, 1) != RES_OK)
1302 74e: be 01 movw r22, r28 1380 758: be 01 movw r22, r28
1303 750: 60 5e subi r22, 0xE0 ; 224 1381 75a: 60 5e subi r22, 0xE0 ; 224
1304 752: 7f 4f sbci r23, 0xFF ; 255 1382 75c: 7f 4f sbci r23, 0xFF ; 255
1305 754: 01 e0 ldi r16, 0x01 ; 1 1383 75e: 01 e0 ldi r16, 0x01 ; 1
1306 756: a5 01 movw r20, r10 1384 760: a5 01 movw r20, r10
1307 758: 94 01 movw r18, r8 1385 762: 94 01 movw r18, r8
1308 75a: 80 e0 ldi r24, 0x00 ; 0 1386 764: 80 e0 ldi r24, 0x00 ; 0
1309 75c: 0e 94 51 0f call 0x1ea2 ; 0x1ea2 <disk_read> 1387 766: 0e 94 9c 0f call 0x1f38 ; 0x1f38 <disk_read>
1310 760: 89 2b or r24, r25 1388 76a: 89 2b or r24, r25
1311 762: 29 f4 brne .+10 ; 0x76e <move_window+0xc4> 1389 76c: 29 f4 brne .+10 ; 0x778 <move_window+0xc4>
1312 return FALSE; 1390 return FALSE;
1313 fs->winsect = sector; 1391 fs->winsect = sector;
1314 764: 8c 82 std Y+4, r8 ; 0x04 1392 76e: 8c 82 std Y+4, r8 ; 0x04
1315 766: 9d 82 std Y+5, r9 ; 0x05 1393 770: 9d 82 std Y+5, r9 ; 0x05
1316 768: ae 82 std Y+6, r10 ; 0x06 1394 772: ae 82 std Y+6, r10 ; 0x06
1317 76a: bf 82 std Y+7, r11 ; 0x07 1395 774: bf 82 std Y+7, r11 ; 0x07
1318 76c: 03 c0 rjmp .+6 ; 0x774 <move_window+0xca> 1396 776: 02 c0 rjmp .+4 ; 0x77c <move_window+0xc8>
1319 76e: 80 e0 ldi r24, 0x00 ; 0 1397 778: 80 e0 ldi r24, 0x00 ; 0
1320 770: 90 e0 ldi r25, 0x00 ; 0 -  
1321 772: 02 c0 rjmp .+4 ; 0x778 <move_window+0xce> 1398 77a: 01 c0 rjmp .+2 ; 0x77e <move_window+0xca>
1322 774: 81 e0 ldi r24, 0x01 ; 1 1399 77c: 81 e0 ldi r24, 0x01 ; 1
-   1400 }
-   1401 }
1323 776: 90 e0 ldi r25, 0x00 ; 0 1402 return TRUE;
-   1403 }
1324 778: ee e0 ldi r30, 0x0E ; 14 1404 77e: cd b7 in r28, 0x3d ; 61
1325 77a: cd b7 in r28, 0x3d ; 61 1405 780: de b7 in r29, 0x3e ; 62
1326 77c: de b7 in r29, 0x3e ; 62 1406 782: ee e0 ldi r30, 0x0E ; 14
1327 77e: 0c 94 4a 11 jmp 0x2294 ; 0x2294 <__epilogue_restores__+0x8> 1407 784: 0c 94 e7 14 jmp 0x29ce ; 0x29ce <__epilogue_restores__+0x8>
1328   1408  
1329 00000782 <put_cluster>: 1409 00000788 <put_cluster>:
1330 static 1410 static
1331 BOOL put_cluster ( /* TRUE: successful, FALSE: failed */ 1411 BOOL put_cluster ( /* TRUE: successful, FALSE: failed */
1332 CLUST clust, /* Cluster# to change */ 1412 CLUST clust, /* Cluster# to change */
1333 CLUST val /* New value to mark the cluster */ 1413 CLUST val /* New value to mark the cluster */
1334 ) 1414 )
1335 { 1415 {
1336 782: a0 e0 ldi r26, 0x00 ; 0 1416 788: a0 e0 ldi r26, 0x00 ; 0
1337 784: b0 e0 ldi r27, 0x00 ; 0 1417 78a: b0 e0 ldi r27, 0x00 ; 0
1338 786: e7 ec ldi r30, 0xC7 ; 199 1418 78c: ea ec ldi r30, 0xCA ; 202
1339 788: f3 e0 ldi r31, 0x03 ; 3 1419 78e: f3 e0 ldi r31, 0x03 ; 3
1340 78a: 0c 94 2d 11 jmp 0x225a ; 0x225a <__prologue_saves__+0x6> 1420 790: 0c 94 cb 14 jmp 0x2996 ; 0x2996 <__prologue_saves__+0x8>
1341 78e: ec 01 movw r28, r24 1421 794: ec 01 movw r28, r24
1342 790: 5b 01 movw r10, r22 1422 796: 4b 01 movw r8, r22
1343 WORD bc; 1423 WORD bc;
1344 BYTE *p; 1424 BYTE *p;
1345 DWORD fatsect; 1425 DWORD fatsect;
1346 FATFS *fs = FatFs; 1426 FATFS *fs = FatFs;
1347 792: 80 90 0a 01 lds r8, 0x010A 1427 798: e0 90 10 01 lds r14, 0x0110
1348 796: 90 90 0b 01 lds r9, 0x010B 1428 79c: f0 90 11 01 lds r15, 0x0111
1349   1429  
1350   1430  
1351 fatsect = fs->fatbase; 1431 fatsect = fs->fatbase;
1352 79a: f4 01 movw r30, r8 1432 7a0: f7 01 movw r30, r14
1353 79c: c0 84 ldd r12, Z+8 ; 0x08 1433 7a2: a0 84 ldd r10, Z+8 ; 0x08
1354 79e: d1 84 ldd r13, Z+9 ; 0x09 1434 7a4: b1 84 ldd r11, Z+9 ; 0x09
1355 7a0: e2 84 ldd r14, Z+10 ; 0x0a 1435 7a6: c2 84 ldd r12, Z+10 ; 0x0a
1356 7a2: f3 84 ldd r15, Z+11 ; 0x0b 1436 7a8: d3 84 ldd r13, Z+11 ; 0x0b
1357 switch (fs->fs_type) { 1437 switch (fs->fs_type) {
1358 7a4: 84 8d ldd r24, Z+28 ; 0x1c 1438 7aa: 84 8d ldd r24, Z+28 ; 0x1c
1359 7a6: 81 30 cpi r24, 0x01 ; 1 1439 7ac: 81 30 cpi r24, 0x01 ; 1
1360 7a8: 21 f0 breq .+8 ; 0x7b2 <put_cluster+0x30> 1440 7ae: 21 f0 breq .+8 ; 0x7b8 <put_cluster+0x30>
1361 7aa: 82 30 cpi r24, 0x02 ; 2 1441 7b0: 82 30 cpi r24, 0x02 ; 2
1362 7ac: 09 f0 breq .+2 ; 0x7b0 <put_cluster+0x2e> 1442 7b2: 09 f0 breq .+2 ; 0x7b6 <put_cluster+0x2e>
1363 7ae: 70 c0 rjmp .+224 ; 0x890 <put_cluster+0x10e> 1443 7b4: 72 c0 rjmp .+228 ; 0x89a <put_cluster+0x112>
1364 7b0: 56 c0 rjmp .+172 ; 0x85e <put_cluster+0xdc> 1444 7b6: 5a c0 rjmp .+180 ; 0x86c <put_cluster+0xe4>
1365 case FS_FAT12 : 1445 case FS_FAT12 :
1366 bc = (WORD)clust * 3 / 2; 1446 bc = (WORD)clust * 3 / 2;
1367 7b2: 8e 01 movw r16, r28 1447 7b8: 8e 01 movw r16, r28
1368 7b4: 00 0f add r16, r16 1448 7ba: 00 0f add r16, r16
1369 7b6: 11 1f adc r17, r17 1449 7bc: 11 1f adc r17, r17
1370 7b8: 0c 0f add r16, r28 1450 7be: 0c 0f add r16, r28
1371 7ba: 1d 1f adc r17, r29 1451 7c0: 1d 1f adc r17, r29
1372 7bc: 16 95 lsr r17 1452 7c2: 16 95 lsr r17
1373 7be: 07 95 ror r16 1453 7c4: 07 95 ror r16
1374 if (!move_window(fatsect + bc / 512)) return FALSE; 1454 if (!move_window(fatsect + bc / 512)) return FALSE;
1375 7c0: b8 01 movw r22, r16 1455 7c6: b8 01 movw r22, r16
1376 7c2: 67 2f mov r22, r23 1456 7c8: 67 2f mov r22, r23
1377 7c4: 77 27 eor r23, r23 1457 7ca: 77 27 eor r23, r23
1378 7c6: 66 95 lsr r22 1458 7cc: 66 95 lsr r22
1379 7c8: 88 27 eor r24, r24 1459 7ce: 80 e0 ldi r24, 0x00 ; 0
1380 7ca: 99 27 eor r25, r25 1460 7d0: 90 e0 ldi r25, 0x00 ; 0
1381 7cc: 6c 0d add r22, r12 1461 7d2: 6a 0d add r22, r10
1382 7ce: 7d 1d adc r23, r13 1462 7d4: 7b 1d adc r23, r11
1383 7d0: 8e 1d adc r24, r14 1463 7d6: 8c 1d adc r24, r12
1384 7d2: 9f 1d adc r25, r15 1464 7d8: 9d 1d adc r25, r13
1385 7d4: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1465 7da: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1386 7d8: 88 23 and r24, r24 1466 7de: 88 23 and r24, r24
1387 7da: 09 f4 brne .+2 ; 0x7de <put_cluster+0x5c> 1467 7e0: 09 f4 brne .+2 ; 0x7e4 <put_cluster+0x5c>
1388 7dc: 59 c0 rjmp .+178 ; 0x890 <put_cluster+0x10e> 1468 7e2: 5b c0 rjmp .+182 ; 0x89a <put_cluster+0x112>
1389 p = &fs->win[bc % 512]; 1469 p = &fs->win[bc % 512];
1390 7de: 60 e2 ldi r22, 0x20 ; 32 -  
1391 7e0: 66 2e mov r6, r22 -  
1392 7e2: 71 2c mov r7, r1 -  
1393 7e4: 68 0c add r6, r8 -  
1394 7e6: 79 1c adc r7, r9 -  
1395 7e8: f8 01 movw r30, r16 1470 7e4: d8 01 movw r26, r16
1396 7ea: f1 70 andi r31, 0x01 ; 1 1471 7e6: b1 70 andi r27, 0x01 ; 1
1397 7ec: e6 0d add r30, r6 -  
1398 7ee: f7 1d adc r31, r7 -  
1399 *p = (clust & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val; 1472 *p = (clust & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;
-   1473 7e8: 51 e0 ldi r21, 0x01 ; 1
1400 7f0: ce 01 movw r24, r28 1474 7ea: 65 2e mov r6, r21
1401 7f2: 81 70 andi r24, 0x01 ; 1 1475 7ec: 71 2c mov r7, r1
1402 7f4: 90 70 andi r25, 0x00 ; 0 1476 7ee: 6c 22 and r6, r28
1403 7f6: 58 2e mov r5, r24 1477 7f0: 7d 22 and r7, r29
1404 7f8: 88 23 and r24, r24 1478 7f2: c0 ff sbrs r28, 0
1405 7fa: 39 f0 breq .+14 ; 0x80a <put_cluster+0x88> 1479 7f4: 0a c0 rjmp .+20 ; 0x80a <put_cluster+0x82>
-   1480 7f6: f7 01 movw r30, r14
-   1481 7f8: ea 0f add r30, r26
-   1482 7fa: fb 1f adc r31, r27
1406 7fc: 80 81 ld r24, Z 1483 7fc: 80 a1 ldd r24, Z+32 ; 0x20
1407 7fe: 8f 70 andi r24, 0x0F ; 15 1484 7fe: 8f 70 andi r24, 0x0F ; 15
1408 800: 9a 2d mov r25, r10 1485 800: 98 2d mov r25, r8
1409 802: 92 95 swap r25 1486 802: 92 95 swap r25
1410 804: 90 7f andi r25, 0xF0 ; 240 1487 804: 90 7f andi r25, 0xF0 ; 240
1411 806: 98 2b or r25, r24 1488 806: 98 2b or r25, r24
1412 808: 01 c0 rjmp .+2 ; 0x80c <put_cluster+0x8a> 1489 808: 01 c0 rjmp .+2 ; 0x80c <put_cluster+0x84>
1413 80a: 9a 2d mov r25, r10 1490 80a: 98 2d mov r25, r8
1414 80c: 90 83 st Z, r25 1491 80c: ae 0d add r26, r14
-   1492 80e: bf 1d adc r27, r15
-   1493 810: fd 01 movw r30, r26
-   1494 812: 90 a3 std Z+32, r25 ; 0x20
1415 bc++; 1495 bc++;
1416 80e: e8 01 movw r28, r16 1496 814: e8 01 movw r28, r16
1417 810: 21 96 adiw r28, 0x01 ; 1 1497 816: 21 96 adiw r28, 0x01 ; 1
1418 fs->winflag = 1; 1498 fs->winflag = 1;
1419 812: 81 e0 ldi r24, 0x01 ; 1 1499 818: 81 e0 ldi r24, 0x01 ; 1
1420 814: f4 01 movw r30, r8 1500 81a: f7 01 movw r30, r14
1421 816: 87 8f std Z+31, r24 ; 0x1f 1501 81c: 87 8f std Z+31, r24 ; 0x1f
1422 if (!move_window(fatsect + bc / 512)) return FALSE; 1502 if (!move_window(fatsect + bc / 512)) return FALSE;
1423 818: be 01 movw r22, r28 1503 81e: be 01 movw r22, r28
1424 81a: 67 2f mov r22, r23 1504 820: 67 2f mov r22, r23
1425 81c: 77 27 eor r23, r23 1505 822: 77 27 eor r23, r23
1426 81e: 66 95 lsr r22 1506 824: 66 95 lsr r22
1427 820: 88 27 eor r24, r24 1507 826: 80 e0 ldi r24, 0x00 ; 0
1428 822: 99 27 eor r25, r25 1508 828: 90 e0 ldi r25, 0x00 ; 0
1429 824: 6c 0d add r22, r12 1509 82a: 6a 0d add r22, r10
1430 826: 7d 1d adc r23, r13 1510 82c: 7b 1d adc r23, r11
1431 828: 8e 1d adc r24, r14 1511 82e: 8c 1d adc r24, r12
1432 82a: 9f 1d adc r25, r15 1512 830: 9d 1d adc r25, r13
1433 82c: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1513 832: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1434 830: 88 23 and r24, r24 1514 836: 88 23 and r24, r24
1435 832: 71 f1 breq .+92 ; 0x890 <put_cluster+0x10e> 1515 838: 81 f1 breq .+96 ; 0x89a <put_cluster+0x112>
1436 p = &fs->win[bc % 512]; 1516 p = &fs->win[bc % 512];
1437 834: fe 01 movw r30, r28 1517 83a: de 01 movw r26, r28
1438 836: f1 70 andi r31, 0x01 ; 1 1518 83c: b1 70 andi r27, 0x01 ; 1
1439 838: e6 0d add r30, r6 -  
1440 83a: f7 1d adc r31, r7 -  
1441 *p = (clust & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F)); 1519 *p = (clust & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));
1442 83c: 55 20 and r5, r5 1520 83e: 61 14 cp r6, r1
-   1521 840: 71 04 cpc r7, r1
1443 83e: 39 f0 breq .+14 ; 0x84e <put_cluster+0xcc> 1522 842: 39 f0 breq .+14 ; 0x852 <put_cluster+0xca>
1444 840: 44 e0 ldi r20, 0x04 ; 4 1523 844: 34 e0 ldi r19, 0x04 ; 4
1445 842: b6 94 lsr r11 1524 846: 96 94 lsr r9
1446 844: a7 94 ror r10 1525 848: 87 94 ror r8
1447 846: 4a 95 dec r20 1526 84a: 3a 95 dec r19
1448 848: e1 f7 brne .-8 ; 0x842 <put_cluster+0xc0> 1527 84c: e1 f7 brne .-8 ; 0x846 <put_cluster+0xbe>
1449 84a: 2a 2d mov r18, r10 1528 84e: 98 2d mov r25, r8
1450 84c: 06 c0 rjmp .+12 ; 0x85a <put_cluster+0xd8> 1529 850: 08 c0 rjmp .+16 ; 0x862 <put_cluster+0xda>
1451 84e: 20 81 ld r18, Z 1530 852: f7 01 movw r30, r14
1452 850: 20 7f andi r18, 0xF0 ; 240 1531 854: ea 0f add r30, r26
1453 852: 8b 2d mov r24, r11 1532 856: fb 1f adc r31, r27
-   1533 858: 90 a1 ldd r25, Z+32 ; 0x20
-   1534 85a: 90 7f andi r25, 0xF0 ; 240
1454 854: 99 27 eor r25, r25 1535 85c: 89 2d mov r24, r9
1455 856: 8f 70 andi r24, 0x0F ; 15 1536 85e: 8f 70 andi r24, 0x0F ; 15
1456 858: 28 2b or r18, r24 1537 860: 98 2b or r25, r24
-   1538 862: ae 0d add r26, r14
1457 85a: 20 83 st Z, r18 1539 864: bf 1d adc r27, r15
-   1540 866: fd 01 movw r30, r26
-   1541 868: 90 a3 std Z+32, r25 ; 0x20
1458 85c: 13 c0 rjmp .+38 ; 0x884 <put_cluster+0x102> 1542 86a: 13 c0 rjmp .+38 ; 0x892 <put_cluster+0x10a>
1459 break; 1543 break;
1460   1544  
1461 case FS_FAT16 : 1545 case FS_FAT16 :
1462 if (!move_window(fatsect + clust / 256)) return FALSE; 1546 if (!move_window(fatsect + clust / 256)) return FALSE;
1463 85e: 6d 2f mov r22, r29 1547 86c: 6d 2f mov r22, r29
1464 860: 77 27 eor r23, r23 1548 86e: 77 27 eor r23, r23
1465 862: 88 27 eor r24, r24 1549 870: 80 e0 ldi r24, 0x00 ; 0
1466 864: 99 27 eor r25, r25 1550 872: 90 e0 ldi r25, 0x00 ; 0
1467 866: 6c 0d add r22, r12 1551 874: 6a 0d add r22, r10
1468 868: 7d 1d adc r23, r13 1552 876: 7b 1d adc r23, r11
1469 86a: 8e 1d adc r24, r14 1553 878: 8c 1d adc r24, r12
1470 86c: 9f 1d adc r25, r15 1554 87a: 9d 1d adc r25, r13
1471 86e: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1555 87c: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1472 872: 88 23 and r24, r24 1556 880: 88 23 and r24, r24
1473 874: 69 f0 breq .+26 ; 0x890 <put_cluster+0x10e> 1557 882: 59 f0 breq .+22 ; 0x89a <put_cluster+0x112>
1474 ST_WORD(&fs->win[((WORD)clust * 2) % 512], (WORD)val); 1558 ST_WORD(&fs->win[((WORD)clust * 2) % 512], (WORD)val);
1475 876: cc 0f add r28, r28 1559 884: cc 0f add r28, r28
1476 878: dd 1f adc r29, r29 1560 886: dd 1f adc r29, r29
1477 87a: d1 70 andi r29, 0x01 ; 1 1561 888: d1 70 andi r29, 0x01 ; 1
1478 87c: c8 0d add r28, r8 1562 88a: ce 0d add r28, r14
1479 87e: d9 1d adc r29, r9 1563 88c: df 1d adc r29, r15
1480 880: b9 a2 std Y+33, r11 ; 0x21 1564 88e: 99 a2 std Y+33, r9 ; 0x21
1481 882: a8 a2 std Y+32, r10 ; 0x20 1565 890: 88 a2 std Y+32, r8 ; 0x20
1482 break; 1566 break;
1483 #endif 1567 #endif
1484 default : 1568 default :
1485 return FALSE; 1569 return FALSE;
1486 } 1570 }
1487 fs->winflag = 1; 1571 fs->winflag = 1;
1488 884: 81 e0 ldi r24, 0x01 ; 1 1572 892: 81 e0 ldi r24, 0x01 ; 1
1489 886: f4 01 movw r30, r8 1573 894: f7 01 movw r30, r14
1490 888: 87 8f std Z+31, r24 ; 0x1f 1574 896: 87 8f std Z+31, r24 ; 0x1f
1491 88a: 81 e0 ldi r24, 0x01 ; 1 -  
1492 88c: 90 e0 ldi r25, 0x00 ; 0 -  
1493 88e: 02 c0 rjmp .+4 ; 0x894 <put_cluster+0x112> 1575 898: 01 c0 rjmp .+2 ; 0x89c <put_cluster+0x114>
1494 return TRUE; 1576 return TRUE;
1495 890: 80 e0 ldi r24, 0x00 ; 0 1577 89a: 80 e0 ldi r24, 0x00 ; 0
-   1578 }
1496 892: 90 e0 ldi r25, 0x00 ; 0 1579 89c: cd b7 in r28, 0x3d ; 61
1497 894: ef e0 ldi r30, 0x0F ; 15 -  
1498 896: cd b7 in r28, 0x3d ; 61 1580 89e: de b7 in r29, 0x3e ; 62
1499 898: de b7 in r29, 0x3e ; 62 1581 8a0: ee e0 ldi r30, 0x0E ; 14
1500 89a: 0c 94 49 11 jmp 0x2292 ; 0x2292 <__epilogue_restores__+0x6> 1582 8a2: 0c 94 e7 14 jmp 0x29ce ; 0x29ce <__epilogue_restores__+0x8>
1501   1583  
1502 0000089e <get_cluster>: 1584 000008a6 <get_cluster>:
1503   1585  
1504 static 1586 static
1505 CLUST get_cluster ( /* 0,>=2: successful, 1: failed */ 1587 CLUST get_cluster ( /* 0,>=2: successful, 1: failed */
1506 CLUST clust /* Cluster# to get the link information */ 1588 CLUST clust /* Cluster# to get the link information */
1507 ) 1589 )
1508 { 1590 {
1509 89e: a0 e0 ldi r26, 0x00 ; 0 1591 8a6: a0 e0 ldi r26, 0x00 ; 0
1510 8a0: b0 e0 ldi r27, 0x00 ; 0 1592 8a8: b0 e0 ldi r27, 0x00 ; 0
1511 8a2: e5 e5 ldi r30, 0x55 ; 85 1593 8aa: e9 e5 ldi r30, 0x59 ; 89
1512 8a4: f4 e0 ldi r31, 0x04 ; 4 1594 8ac: f4 e0 ldi r31, 0x04 ; 4
1513 8a6: 0c 94 31 11 jmp 0x2262 ; 0x2262 <__prologue_saves__+0xe> 1595 8ae: 0c 94 ce 14 jmp 0x299c ; 0x299c <__prologue_saves__+0xe>
1514 8aa: 8c 01 movw r16, r24 1596 8b2: 8c 01 movw r16, r24
1515 WORD wc, bc; 1597 WORD wc, bc;
1516 DWORD fatsect; 1598 DWORD fatsect;
1517 FATFS *fs = FatFs; 1599 FATFS *fs = FatFs;
1518 8ac: e0 90 0a 01 lds r14, 0x010A 1600 8b4: e0 90 10 01 lds r14, 0x0110
1519 8b0: f0 90 0b 01 lds r15, 0x010B 1601 8b8: f0 90 11 01 lds r15, 0x0111
1520   1602  
1521   1603  
1522 if (clust >= 2 && clust < fs->max_clust) { /* Valid cluster# */ 1604 if (clust >= 2 && clust < fs->max_clust) { /* Valid cluster# */
1523 8b4: 02 97 sbiw r24, 0x02 ; 2 1605 8bc: 82 30 cpi r24, 0x02 ; 2
-   1606 8be: 91 05 cpc r25, r1
1524 8b6: 08 f4 brcc .+2 ; 0x8ba <get_cluster+0x1c> 1607 8c0: 08 f4 brcc .+2 ; 0x8c4 <get_cluster+0x1e>
1525 8b8: 67 c0 rjmp .+206 ; 0x988 <get_cluster+0xea> 1608 8c2: 67 c0 rjmp .+206 ; 0x992 <get_cluster+0xec>
1526 8ba: f7 01 movw r30, r14 1609 8c4: e7 01 movw r28, r14
1527 8bc: 86 89 ldd r24, Z+22 ; 0x16 1610 8c6: 8e 89 ldd r24, Y+22 ; 0x16
1528 8be: 97 89 ldd r25, Z+23 ; 0x17 1611 8c8: 9f 89 ldd r25, Y+23 ; 0x17
1529 8c0: 08 17 cp r16, r24 1612 8ca: 08 17 cp r16, r24
1530 8c2: 19 07 cpc r17, r25 1613 8cc: 19 07 cpc r17, r25
1531 8c4: 08 f0 brcs .+2 ; 0x8c8 <get_cluster+0x2a> 1614 8ce: 08 f0 brcs .+2 ; 0x8d2 <get_cluster+0x2c>
1532 8c6: 60 c0 rjmp .+192 ; 0x988 <get_cluster+0xea> 1615 8d0: 60 c0 rjmp .+192 ; 0x992 <get_cluster+0xec>
1533 fatsect = fs->fatbase; 1616 fatsect = fs->fatbase;
1534 8c8: a0 84 ldd r10, Z+8 ; 0x08 1617 8d2: a8 84 ldd r10, Y+8 ; 0x08
1535 8ca: b1 84 ldd r11, Z+9 ; 0x09 1618 8d4: b9 84 ldd r11, Y+9 ; 0x09
1536 8cc: c2 84 ldd r12, Z+10 ; 0x0a 1619 8d6: ca 84 ldd r12, Y+10 ; 0x0a
1537 8ce: d3 84 ldd r13, Z+11 ; 0x0b 1620 8d8: db 84 ldd r13, Y+11 ; 0x0b
1538 switch (fs->fs_type) { 1621 switch (fs->fs_type) {
1539 8d0: 84 8d ldd r24, Z+28 ; 0x1c 1622 8da: 8c 8d ldd r24, Y+28 ; 0x1c
1540 8d2: 81 30 cpi r24, 0x01 ; 1 1623 8dc: 81 30 cpi r24, 0x01 ; 1
1541 8d4: 21 f0 breq .+8 ; 0x8de <get_cluster+0x40> 1624 8de: 21 f0 breq .+8 ; 0x8e8 <get_cluster+0x42>
1542 8d6: 82 30 cpi r24, 0x02 ; 2 1625 8e0: 82 30 cpi r24, 0x02 ; 2
1543 8d8: 09 f0 breq .+2 ; 0x8dc <get_cluster+0x3e> 1626 8e2: 09 f0 breq .+2 ; 0x8e6 <get_cluster+0x40>
1544 8da: 56 c0 rjmp .+172 ; 0x988 <get_cluster+0xea> 1627 8e4: 56 c0 rjmp .+172 ; 0x992 <get_cluster+0xec>
1545 8dc: 40 c0 rjmp .+128 ; 0x95e <get_cluster+0xc0> 1628 8e6: 40 c0 rjmp .+128 ; 0x968 <get_cluster+0xc2>
1546 case FS_FAT12 : 1629 case FS_FAT12 :
1547 bc = (WORD)clust * 3 / 2; 1630 bc = (WORD)clust * 3 / 2;
1548 8de: e8 01 movw r28, r16 1631 8e8: e8 01 movw r28, r16
1549 8e0: cc 0f add r28, r28 1632 8ea: cc 0f add r28, r28
1550 8e2: dd 1f adc r29, r29 1633 8ec: dd 1f adc r29, r29
1551 8e4: c0 0f add r28, r16 1634 8ee: c0 0f add r28, r16
1552 8e6: d1 1f adc r29, r17 1635 8f0: d1 1f adc r29, r17
1553 8e8: d6 95 lsr r29 1636 8f2: d6 95 lsr r29
1554 8ea: c7 95 ror r28 1637 8f4: c7 95 ror r28
1555 if (!move_window(fatsect + bc / 512)) break; 1638 if (!move_window(fatsect + bc / 512)) break;
1556 8ec: be 01 movw r22, r28 1639 8f6: be 01 movw r22, r28
1557 8ee: 67 2f mov r22, r23 1640 8f8: 67 2f mov r22, r23
1558 8f0: 77 27 eor r23, r23 1641 8fa: 77 27 eor r23, r23
1559 8f2: 66 95 lsr r22 1642 8fc: 66 95 lsr r22
1560 8f4: 88 27 eor r24, r24 1643 8fe: 80 e0 ldi r24, 0x00 ; 0
1561 8f6: 99 27 eor r25, r25 1644 900: 90 e0 ldi r25, 0x00 ; 0
1562 8f8: 6a 0d add r22, r10 1645 902: 6a 0d add r22, r10
1563 8fa: 7b 1d adc r23, r11 1646 904: 7b 1d adc r23, r11
1564 8fc: 8c 1d adc r24, r12 1647 906: 8c 1d adc r24, r12
1565 8fe: 9d 1d adc r25, r13 1648 908: 9d 1d adc r25, r13
1566 900: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1649 90a: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1567 904: 88 23 and r24, r24 1650 90e: 88 23 and r24, r24
1568 906: 09 f4 brne .+2 ; 0x90a <get_cluster+0x6c> 1651 910: 09 f4 brne .+2 ; 0x914 <get_cluster+0x6e>
1569 908: 3f c0 rjmp .+126 ; 0x988 <get_cluster+0xea> 1652 912: 3f c0 rjmp .+126 ; 0x992 <get_cluster+0xec>
1570 wc = fs->win[bc % 512]; bc++; 1653 wc = fs->win[bc % 512]; bc++;
1571 90a: fe 01 movw r30, r28 1654 914: fe 01 movw r30, r28
1572 90c: f1 70 andi r31, 0x01 ; 1 1655 916: f1 70 andi r31, 0x01 ; 1
1573 90e: ee 0d add r30, r14 1656 918: ee 0d add r30, r14
1574 910: ff 1d adc r31, r15 1657 91a: ff 1d adc r31, r15
1575 912: 90 a0 ldd r9, Z+32 ; 0x20 1658 91c: 90 a0 ldd r9, Z+32 ; 0x20
1576 914: 21 96 adiw r28, 0x01 ; 1 1659 91e: 21 96 adiw r28, 0x01 ; 1
1577 if (!move_window(fatsect + bc / 512)) break; 1660 if (!move_window(fatsect + bc / 512)) break;
1578 916: be 01 movw r22, r28 1661 920: be 01 movw r22, r28
1579 918: 67 2f mov r22, r23 1662 922: 67 2f mov r22, r23
1580 91a: 77 27 eor r23, r23 1663 924: 77 27 eor r23, r23
1581 91c: 66 95 lsr r22 1664 926: 66 95 lsr r22
1582 91e: 88 27 eor r24, r24 1665 928: 80 e0 ldi r24, 0x00 ; 0
1583 920: 99 27 eor r25, r25 1666 92a: 90 e0 ldi r25, 0x00 ; 0
1584 922: 6a 0d add r22, r10 1667 92c: 6a 0d add r22, r10
1585 924: 7b 1d adc r23, r11 1668 92e: 7b 1d adc r23, r11
1586 926: 8c 1d adc r24, r12 1669 930: 8c 1d adc r24, r12
1587 928: 9d 1d adc r25, r13 1670 932: 9d 1d adc r25, r13
1588 92a: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1671 934: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1589 92e: 88 23 and r24, r24 1672 938: 88 23 and r24, r24
1590 930: 59 f1 breq .+86 ; 0x988 <get_cluster+0xea> 1673 93a: 59 f1 breq .+86 ; 0x992 <get_cluster+0xec>
1591 fatsect = fs->fatbase; 1674 fatsect = fs->fatbase;
1592 switch (fs->fs_type) { 1675 switch (fs->fs_type) {
1593 case FS_FAT12 : 1676 case FS_FAT12 :
1594 bc = (WORD)clust * 3 / 2; 1677 bc = (WORD)clust * 3 / 2;
1595 if (!move_window(fatsect + bc / 512)) break; 1678 if (!move_window(fatsect + bc / 512)) break;
1596 wc = fs->win[bc % 512]; bc++; 1679 wc = fs->win[bc % 512]; bc++;
1597 932: 29 2d mov r18, r9 1680 93c: 29 2d mov r18, r9
1598 934: 33 27 eor r19, r19 1681 93e: 30 e0 ldi r19, 0x00 ; 0
1599 if (!move_window(fatsect + bc / 512)) break; 1682 if (!move_window(fatsect + bc / 512)) break;
1600 wc |= (WORD)fs->win[bc % 512] << 8; 1683 wc |= (WORD)fs->win[bc % 512] << 8;
1601 936: d1 70 andi r29, 0x01 ; 1 1684 940: d1 70 andi r29, 0x01 ; 1
1602 938: ec 0e add r14, r28 1685 942: ec 0e add r14, r28
1603 93a: fd 1e adc r15, r29 1686 944: fd 1e adc r15, r29
1604 93c: f7 01 movw r30, r14 1687 946: f7 01 movw r30, r14
1605 93e: 80 a1 ldd r24, Z+32 ; 0x20 1688 948: 90 a1 ldd r25, Z+32 ; 0x20
1606 940: 99 27 eor r25, r25 -  
1607 942: 98 2f mov r25, r24 -  
1608 944: 88 27 eor r24, r24 1689 94a: 80 e0 ldi r24, 0x00 ; 0
1609 946: 82 2b or r24, r18 1690 94c: 28 2b or r18, r24
1610 948: 93 2b or r25, r19 1691 94e: 39 2b or r19, r25
1611 return (clust & 1) ? (wc >> 4) : (wc & 0xFFF); 1692 return (clust & 1) ? (wc >> 4) : (wc & 0xFFF);
1612 94a: 00 ff sbrs r16, 0 1693 950: 00 ff sbrs r16, 0
1613 94c: 06 c0 rjmp .+12 ; 0x95a <get_cluster+0xbc> 1694 952: 07 c0 rjmp .+14 ; 0x962 <get_cluster+0xbc>
-   1695 954: f9 01 movw r30, r18
1614 94e: 24 e0 ldi r18, 0x04 ; 4 1696 956: 94 e0 ldi r25, 0x04 ; 4
1615 950: 96 95 lsr r25 1697 958: f6 95 lsr r31
1616 952: 87 95 ror r24 1698 95a: e7 95 ror r30
1617 954: 2a 95 dec r18 1699 95c: 9a 95 dec r25
1618 956: e1 f7 brne .-8 ; 0x950 <get_cluster+0xb2> 1700 95e: e1 f7 brne .-8 ; 0x958 <get_cluster+0xb2>
1619 958: 19 c0 rjmp .+50 ; 0x98c <get_cluster+0xee> 1701 960: 1a c0 rjmp .+52 ; 0x996 <get_cluster+0xf0>
-   1702 962: f9 01 movw r30, r18
1620 95a: 9f 70 andi r25, 0x0F ; 15 1703 964: ff 70 andi r31, 0x0F ; 15
1621 95c: 17 c0 rjmp .+46 ; 0x98c <get_cluster+0xee> 1704 966: 17 c0 rjmp .+46 ; 0x996 <get_cluster+0xf0>
1622   1705  
1623 case FS_FAT16 : 1706 case FS_FAT16 :
1624 if (!move_window(fatsect + clust / 256)) break; 1707 if (!move_window(fatsect + clust / 256)) break;
1625 95e: 61 2f mov r22, r17 1708 968: 61 2f mov r22, r17
1626 960: 77 27 eor r23, r23 1709 96a: 77 27 eor r23, r23
1627 962: 88 27 eor r24, r24 1710 96c: 80 e0 ldi r24, 0x00 ; 0
1628 964: 99 27 eor r25, r25 1711 96e: 90 e0 ldi r25, 0x00 ; 0
1629 966: 6a 0d add r22, r10 1712 970: 6a 0d add r22, r10
1630 968: 7b 1d adc r23, r11 1713 972: 7b 1d adc r23, r11
1631 96a: 8c 1d adc r24, r12 1714 974: 8c 1d adc r24, r12
1632 96c: 9d 1d adc r25, r13 1715 976: 9d 1d adc r25, r13
1633 96e: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 1716 978: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
1634 972: 88 23 and r24, r24 1717 97c: 88 23 and r24, r24
1635 974: 49 f0 breq .+18 ; 0x988 <get_cluster+0xea> 1718 97e: 49 f0 breq .+18 ; 0x992 <get_cluster+0xec>
1636 return LD_WORD(&fs->win[((WORD)clust * 2) % 512]); 1719 return LD_WORD(&fs->win[((WORD)clust * 2) % 512]);
1637 976: 00 0f add r16, r16 1720 980: 00 0f add r16, r16
1638 978: 11 1f adc r17, r17 1721 982: 11 1f adc r17, r17
1639 97a: 11 70 andi r17, 0x01 ; 1 1722 984: 11 70 andi r17, 0x01 ; 1
1640 97c: e0 0e add r14, r16 1723 986: e0 0e add r14, r16
1641 97e: f1 1e adc r15, r17 1724 988: f1 1e adc r15, r17
1642 980: f7 01 movw r30, r14 1725 98a: e7 01 movw r28, r14
1643 982: 80 a1 ldd r24, Z+32 ; 0x20 1726 98c: e8 a1 ldd r30, Y+32 ; 0x20
1644 984: 91 a1 ldd r25, Z+33 ; 0x21 1727 98e: f9 a1 ldd r31, Y+33 ; 0x21
1645 986: 02 c0 rjmp .+4 ; 0x98c <get_cluster+0xee> 1728 990: 02 c0 rjmp .+4 ; 0x996 <get_cluster+0xf0>
1646 988: 81 e0 ldi r24, 0x01 ; 1 1729 992: e1 e0 ldi r30, 0x01 ; 1
1647 98a: 90 e0 ldi r25, 0x00 ; 0 1730 994: f0 e0 ldi r31, 0x00 ; 0
1648 98c: eb e0 ldi r30, 0x0B ; 11 -  
1649 98e: cd b7 in r28, 0x3d ; 61 -  
1650 990: de b7 in r29, 0x3e ; 62 -  
1651 992: 0c 94 4d 11 jmp 0x229a ; 0x229a <__epilogue_restores__+0xe> -  
1652   -  
1653 00000996 <next_dir_entry>: -  
1654   -  
1655 static 1731 #endif
1656 BOOL next_dir_entry ( /* TRUE: successful, FALSE: could not move next */ -  
1657 DIR *dirobj /* Pointer to directory object */ -  
1658 ) -  
1659 { -  
1660 996: ef 92 push r14 -  
1661 998: ff 92 push r15 -  
1662 99a: 0f 93 push r16 -  
1663 99c: 1f 93 push r17 -  
1664 99e: cf 93 push r28 -  
1665 9a0: df 93 push r29 -  
1666 9a2: ec 01 movw r28, r24 -  
1667 CLUST clust; -  
1668 WORD idx; -  
1669 FATFS *fs = FatFs; -  
1670 9a4: e0 90 0a 01 lds r14, 0x010A -  
1671 9a8: f0 90 0b 01 lds r15, 0x010B -  
1672   -  
1673   -  
1674 idx = dirobj->index + 1; -  
1675 9ac: 0a 81 ldd r16, Y+2 ; 0x02 -  
1676 9ae: 1b 81 ldd r17, Y+3 ; 0x03 -  
1677 9b0: 0f 5f subi r16, 0xFF ; 255 -  
1678 9b2: 1f 4f sbci r17, 0xFF ; 255 -  
1679 if ((idx & 15) == 0) { /* Table sector changed? */ -  
1680 9b4: c8 01 movw r24, r16 -  
1681 9b6: 8f 70 andi r24, 0x0F ; 15 -  
1682 9b8: 90 70 andi r25, 0x00 ; 0 -  
1683 9ba: 89 2b or r24, r25 -  
1684 9bc: d1 f5 brne .+116 ; 0xa32 <next_dir_entry+0x9c> -  
1685 dirobj->sect++; /* Next sector */ -  
1686 9be: 8a 85 ldd r24, Y+10 ; 0x0a -  
1687 9c0: 9b 85 ldd r25, Y+11 ; 0x0b -  
1688 9c2: ac 85 ldd r26, Y+12 ; 0x0c -  
1689 9c4: bd 85 ldd r27, Y+13 ; 0x0d -  
1690 9c6: 01 96 adiw r24, 0x01 ; 1 -  
1691 9c8: a1 1d adc r26, r1 -  
1692 9ca: b1 1d adc r27, r1 -  
1693 9cc: 8a 87 std Y+10, r24 ; 0x0a -  
1694 9ce: 9b 87 std Y+11, r25 ; 0x0b -  
1695 9d0: ac 87 std Y+12, r26 ; 0x0c -  
1696 9d2: bd 87 std Y+13, r27 ; 0x0d -  
1697 if (!dirobj->clust) { /* In static table */ -  
1698 9d4: 48 85 ldd r20, Y+8 ; 0x08 -  
1699 9d6: 59 85 ldd r21, Y+9 ; 0x09 -  
1700 9d8: 41 15 cp r20, r1 -  
1701 9da: 51 05 cpc r21, r1 -  
1702 9dc: 39 f4 brne .+14 ; 0x9ec <next_dir_entry+0x56> -  
1703 if (idx >= fs->n_rootdir) return FALSE; /* Reached to end of table */ -  
1704 9de: f7 01 movw r30, r14 -  
1705 9e0: 82 81 ldd r24, Z+2 ; 0x02 -  
1706 9e2: 93 81 ldd r25, Z+3 ; 0x03 -  
1707 9e4: 08 17 cp r16, r24 -  
1708 9e6: 19 07 cpc r17, r25 -  
1709 9e8: 20 f1 brcs .+72 ; 0xa32 <next_dir_entry+0x9c> -  
1710 9ea: 28 c0 rjmp .+80 ; 0xa3c <next_dir_entry+0xa6> -  
1711 } else { /* In dynamic table */ -  
1712 if (((idx / 16) & (fs->sects_clust - 1)) == 0) { /* Cluster changed? */ -  
1713 9ec: f7 01 movw r30, r14 -  
1714 9ee: 85 8d ldd r24, Z+29 ; 0x1d -  
1715 9f0: 99 27 eor r25, r25 -  
1716 9f2: 01 97 sbiw r24, 0x01 ; 1 -  
1717 9f4: 98 01 movw r18, r16 -  
1718 9f6: b4 e0 ldi r27, 0x04 ; 4 -  
1719 9f8: 36 95 lsr r19 -  
1720 9fa: 27 95 ror r18 -  
1721 9fc: ba 95 dec r27 -  
1722 9fe: e1 f7 brne .-8 ; 0x9f8 <next_dir_entry+0x62> -  
1723 a00: 82 23 and r24, r18 -  
1724 a02: 93 23 and r25, r19 -  
1725 a04: 89 2b or r24, r25 -  
1726 a06: a9 f4 brne .+42 ; 0xa32 <next_dir_entry+0x9c> -  
1727 clust = get_cluster(dirobj->clust); /* Get next cluster */ -  
1728 a08: ca 01 movw r24, r20 -  
1729 a0a: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> -  
1730 a0e: 9c 01 movw r18, r24 -  
1731 if (clust < 2 || clust >= fs->max_clust) /* Reached to end of table */ -  
1732 a10: 02 97 sbiw r24, 0x02 ; 2 -  
1733 a12: a0 f0 brcs .+40 ; 0xa3c <next_dir_entry+0xa6> -  
1734 a14: f7 01 movw r30, r14 -  
1735 a16: 86 89 ldd r24, Z+22 ; 0x16 -  
1736 a18: 97 89 ldd r25, Z+23 ; 0x17 -  
1737 a1a: 28 17 cp r18, r24 -  
1738 a1c: 39 07 cpc r19, r25 -  
1739 a1e: 70 f4 brcc .+28 ; 0xa3c <next_dir_entry+0xa6> -  
1740 return FALSE; -  
1741 dirobj->clust = clust; /* Initialize for new cluster */ -  
1742 a20: 39 87 std Y+9, r19 ; 0x09 -  
1743 a22: 28 87 std Y+8, r18 ; 0x08 -  
1744 dirobj->sect = clust2sect(clust); -  
1745 a24: c9 01 movw r24, r18 -  
1746 a26: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
1747 a2a: 6a 87 std Y+10, r22 ; 0x0a -  
1748 a2c: 7b 87 std Y+11, r23 ; 0x0b -  
1749 a2e: 8c 87 std Y+12, r24 ; 0x0c -  
1750 a30: 9d 87 std Y+13, r25 ; 0x0d -  
1751 } -  
1752 } 1732 }
1753 } 1733 }
1754 dirobj->index = idx; /* Lower 4 bit of dirobj->index indicates offset in dirobj->sect */ -  
1755 a32: 1b 83 std Y+3, r17 ; 0x03 -  
1756 a34: 0a 83 std Y+2, r16 ; 0x02 -  
1757 a36: 81 e0 ldi r24, 0x01 ; 1 -  
1758 a38: 90 e0 ldi r25, 0x00 ; 0 -  
1759 a3a: 02 c0 rjmp .+4 ; 0xa40 <next_dir_entry+0xaa> -  
1760 return TRUE; -  
1761 a3c: 80 e0 ldi r24, 0x00 ; 0 -  
1762 a3e: 90 e0 ldi r25, 0x00 ; 0 -  
1763 a40: e6 e0 ldi r30, 0x06 ; 6 -  
1764 a42: cd b7 in r28, 0x3d ; 61 -  
1765 a44: de b7 in r29, 0x3e ; 62 -  
1766 a46: 0c 94 52 11 jmp 0x22a4 ; 0x22a4 <__epilogue_restores__+0x18> -  
1767   1734  
-   1735 return 1; /* There is no cluster information, or an error occured */
-   1736 }
-   1737 996: cf 01 movw r24, r30
-   1738 998: cd b7 in r28, 0x3d ; 61
-   1739 99a: de b7 in r29, 0x3e ; 62
-   1740 99c: eb e0 ldi r30, 0x0B ; 11
-   1741 99e: 0c 94 ea 14 jmp 0x29d4 ; 0x29d4 <__epilogue_restores__+0xe>
-   1742  
1768 00000a4a <create_chain>: 1743 000009a2 <create_chain>:
1769 #if !_FS_READONLY 1744 #if !_FS_READONLY
1770 static 1745 static
1771 CLUST create_chain ( /* 0: no free cluster, 1: error, >=2: new cluster number */ 1746 CLUST create_chain ( /* 0: no free cluster, 1: error, >=2: new cluster number */
1772 CLUST clust /* Cluster# to stretch, 0 means create new */ 1747 CLUST clust /* Cluster# to stretch, 0 means create new */
1773 ) 1748 )
1774 { 1749 {
1775 a4a: a0 e0 ldi r26, 0x00 ; 0 1750 9a2: a0 e0 ldi r26, 0x00 ; 0
1776 a4c: b0 e0 ldi r27, 0x00 ; 0 1751 9a4: b0 e0 ldi r27, 0x00 ; 0
1777 a4e: eb e2 ldi r30, 0x2B ; 43 1752 9a6: e7 ed ldi r30, 0xD7 ; 215
1778 a50: f5 e0 ldi r31, 0x05 ; 5 1753 9a8: f4 e0 ldi r31, 0x04 ; 4
1779 a52: 0c 94 32 11 jmp 0x2264 ; 0x2264 <__prologue_saves__+0x10> 1754 9aa: 0c 94 cf 14 jmp 0x299e ; 0x299e <__prologue_saves__+0x10>
1780 a56: 7c 01 movw r14, r24 1755 9ae: 7c 01 movw r14, r24
1781 CLUST cstat, ncl, scl, mcl; 1756 CLUST cstat, ncl, scl, mcl;
1782 FATFS *fs = FatFs; 1757 FATFS *fs = FatFs;
1783 a58: a0 90 0a 01 lds r10, 0x010A 1758 9b0: c0 90 10 01 lds r12, 0x0110
1784 a5c: b0 90 0b 01 lds r11, 0x010B 1759 9b4: d0 90 11 01 lds r13, 0x0111
1785   1760  
1786   1761  
1787 mcl = fs->max_clust; 1762 mcl = fs->max_clust;
1788 a60: f5 01 movw r30, r10 1763 9b8: f6 01 movw r30, r12
1789 a62: c6 88 ldd r12, Z+22 ; 0x16 1764 9ba: a6 88 ldd r10, Z+22 ; 0x16
1790 a64: d7 88 ldd r13, Z+23 ; 0x17 1765 9bc: b7 88 ldd r11, Z+23 ; 0x17
1791 if (clust == 0) { /* Create new chain */ 1766 if (clust == 0) { /* Create new chain */
1792 a66: 00 97 sbiw r24, 0x00 ; 0 1767 9be: 00 97 sbiw r24, 0x00 ; 0
1793 a68: 49 f4 brne .+18 ; 0xa7c <create_chain+0x32> 1768 9c0: 49 f4 brne .+18 ; 0x9d4 <create_chain+0x32>
1794 scl = fs->last_clust; /* Get last allocated cluster */ 1769 scl = fs->last_clust; /* Get last allocated cluster */
1795 a6a: 00 8d ldd r16, Z+24 ; 0x18 1770 9c2: 00 8d ldd r16, Z+24 ; 0x18
1796 a6c: 11 8d ldd r17, Z+25 ; 0x19 1771 9c4: 11 8d ldd r17, Z+25 ; 0x19
1797 if (scl < 2 || scl >= mcl) scl = 1; 1772 if (scl < 2 || scl >= mcl) scl = 1;
1798 a6e: 02 30 cpi r16, 0x02 ; 2 1773 9c6: 02 30 cpi r16, 0x02 ; 2
1799 a70: 11 05 cpc r17, r1 1774 9c8: 11 05 cpc r17, r1
1800 a72: 80 f0 brcs .+32 ; 0xa94 <create_chain+0x4a> 1775 9ca: 88 f0 brcs .+34 ; 0x9ee <create_chain+0x4c>
1801 a74: 0c 15 cp r16, r12 1776 9cc: 0a 15 cp r16, r10
1802 a76: 1d 05 cpc r17, r13 1777 9ce: 1b 05 cpc r17, r11
1803 a78: 68 f4 brcc .+26 ; 0xa94 <create_chain+0x4a> 1778 9d0: 70 f4 brcc .+28 ; 0x9ee <create_chain+0x4c>
1804 a7a: 0e c0 rjmp .+28 ; 0xa98 <create_chain+0x4e> 1779 9d2: 0f c0 rjmp .+30 ; 0x9f2 <create_chain+0x50>
1805 } 1780 }
1806 else { /* Stretch existing chain */ 1781 else { /* Stretch existing chain */
1807 cstat = get_cluster(clust); /* Check the cluster status */ 1782 cstat = get_cluster(clust); /* Check the cluster status */
1808 a7c: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> 1783 9d4: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
-   1784 9d8: 9c 01 movw r18, r24
1809 if (cstat < 2) return 1; /* It is an invalid cluster */ 1785 if (cstat < 2) return 1; /* It is an invalid cluster */
1810 a80: 82 30 cpi r24, 0x02 ; 2 1786 9da: 82 30 cpi r24, 0x02 ; 2
1811 a82: 91 05 cpc r25, r1 1787 9dc: 91 05 cpc r25, r1
1812 a84: e8 f1 brcs .+122 ; 0xb00 <create_chain+0xb6> 1788 9de: 08 f4 brcc .+2 ; 0x9e2 <create_chain+0x40>
-   1789 9e0: 40 c0 rjmp .+128 ; 0xa62 <create_chain+0xc0>
1813 if (cstat < mcl) return cstat; /* It is already followed by next cluster */ 1790 if (cstat < mcl) return cstat; /* It is already followed by next cluster */
1814 a86: 8c 15 cp r24, r12 1791 9e2: 8a 15 cp r24, r10
1815 a88: 9d 05 cpc r25, r13 1792 9e4: 9b 05 cpc r25, r11
1816 a8a: 10 f4 brcc .+4 ; 0xa90 <create_chain+0x46> 1793 9e6: 08 f4 brcc .+2 ; 0x9ea <create_chain+0x48>
1817 a8c: bc 01 movw r22, r24 -  
1818 a8e: 3d c0 rjmp .+122 ; 0xb0a <create_chain+0xc0> 1794 9e8: 41 c0 rjmp .+130 ; 0xa6c <create_chain+0xca>
1819 a90: 87 01 movw r16, r14 1795 9ea: 87 01 movw r16, r14
1820 a92: 02 c0 rjmp .+4 ; 0xa98 <create_chain+0x4e> 1796 9ec: 02 c0 rjmp .+4 ; 0x9f2 <create_chain+0x50>
1821 a94: 01 e0 ldi r16, 0x01 ; 1 1797 9ee: 01 e0 ldi r16, 0x01 ; 1
1822 a96: 10 e0 ldi r17, 0x00 ; 0 1798 9f0: 10 e0 ldi r17, 0x00 ; 0
1823 a98: e8 01 movw r28, r16 1799 9f2: e8 01 movw r28, r16
1824 scl = clust; 1800 scl = clust;
1825 } 1801 }
1826   1802  
1827 ncl = scl; /* Start cluster */ 1803 ncl = scl; /* Start cluster */
1828 for (;;) { 1804 for (;;) {
1829 ncl++; /* Next cluster */ 1805 ncl++; /* Next cluster */
1830 a9a: 21 96 adiw r28, 0x01 ; 1 1806 9f4: 21 96 adiw r28, 0x01 ; 1
1831 if (ncl >= mcl) { /* Wrap around */ 1807 if (ncl >= mcl) { /* Wrap around */
1832 a9c: cc 15 cp r28, r12 1808 9f6: ca 15 cp r28, r10
1833 a9e: dd 05 cpc r29, r13 1809 9f8: db 05 cpc r29, r11
1834 aa0: 28 f0 brcs .+10 ; 0xaac <create_chain+0x62> 1810 9fa: 28 f0 brcs .+10 ; 0xa06 <create_chain+0x64>
1835 ncl = 2; 1811 ncl = 2;
1836 if (ncl > scl) return 0; /* No free custer */ 1812 if (ncl > scl) return 0; /* No free custer */
1837 aa2: 02 30 cpi r16, 0x02 ; 2 1813 9fc: 02 30 cpi r16, 0x02 ; 2
1838 aa4: 11 05 cpc r17, r1 1814 9fe: 11 05 cpc r17, r1
1839 aa6: 78 f1 brcs .+94 ; 0xb06 <create_chain+0xbc> 1815 a00: 98 f1 brcs .+102 ; 0xa68 <create_chain+0xc6>
1840 aa8: c2 e0 ldi r28, 0x02 ; 2 1816 a02: c2 e0 ldi r28, 0x02 ; 2
1841 aaa: d0 e0 ldi r29, 0x00 ; 0 1817 a04: d0 e0 ldi r29, 0x00 ; 0
1842 } 1818 }
1843 cstat = get_cluster(ncl); /* Get the cluster status */ 1819 cstat = get_cluster(ncl); /* Get the cluster status */
1844 aac: ce 01 movw r24, r28 1820 a06: ce 01 movw r24, r28
1845 aae: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> 1821 a08: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
-   1822 a0c: 9c 01 movw r18, r24
1846 if (cstat == 0) break; /* Found a free cluster */ 1823 if (cstat == 0) break; /* Found a free cluster */
1847 ab2: 00 97 sbiw r24, 0x00 ; 0 1824 a0e: 00 97 sbiw r24, 0x00 ; 0
1848 ab4: 31 f0 breq .+12 ; 0xac2 <create_chain+0x78> 1825 a10: 39 f0 breq .+14 ; 0xa20 <create_chain+0x7e>
1849 if (cstat == 1) return 1; /* Any error occured */ 1826 if (cstat == 1) return 1; /* Any error occured */
1850 ab6: 01 97 sbiw r24, 0x01 ; 1 1827 a12: 81 30 cpi r24, 0x01 ; 1
-   1828 a14: 91 05 cpc r25, r1
1851 ab8: 19 f1 breq .+70 ; 0xb00 <create_chain+0xb6> 1829 a16: 51 f1 breq .+84 ; 0xa6c <create_chain+0xca>
1852 if (ncl == scl) return 0; /* No free custer */ 1830 if (ncl == scl) return 0; /* No free custer */
1853 aba: c0 17 cp r28, r16 1831 a18: c0 17 cp r28, r16
1854 abc: d1 07 cpc r29, r17 1832 a1a: d1 07 cpc r29, r17
1855 abe: 19 f1 breq .+70 ; 0xb06 <create_chain+0xbc> 1833 a1c: 59 f7 brne .-42 ; 0x9f4 <create_chain+0x52>
1856 ac0: ec cf rjmp .-40 ; 0xa9a <create_chain+0x50> 1834 a1e: 24 c0 rjmp .+72 ; 0xa68 <create_chain+0xc6>
-   1835 a20: 1c 2f mov r17, r28
-   1836 a22: 0d 2f mov r16, r29
1857 } 1837 }
1858   1838  
1859 if (!put_cluster(ncl, (CLUST)0x0FFFFFFF)) return 1; /* Mark the new cluster "in use" */ 1839 if (!put_cluster(ncl, (CLUST)0x0FFFFFFF)) return 1; /* Mark the new cluster "in use" */
1860 ac2: 6f ef ldi r22, 0xFF ; 255 1840 a24: 6f ef ldi r22, 0xFF ; 255
1861 ac4: 7f ef ldi r23, 0xFF ; 255 1841 a26: 7f ef ldi r23, 0xFF ; 255
1862 ac6: ce 01 movw r24, r28 1842 a28: ce 01 movw r24, r28
1863 ac8: 0e 94 c1 03 call 0x782 ; 0x782 <put_cluster> 1843 a2a: 0e 94 c4 03 call 0x788 ; 0x788 <put_cluster>
1864 acc: 88 23 and r24, r24 1844 a2e: 88 23 and r24, r24
1865 ace: c1 f0 breq .+48 ; 0xb00 <create_chain+0xb6> 1845 a30: c1 f0 breq .+48 ; 0xa62 <create_chain+0xc0>
1866 if (clust && !put_cluster(clust, ncl)) return 1; /* Link it to previous one if needed */ 1846 if (clust && !put_cluster(clust, ncl)) return 1; /* Link it to previous one if needed */
1867 ad0: e1 14 cp r14, r1 1847 a32: e1 14 cp r14, r1
1868 ad2: f1 04 cpc r15, r1 1848 a34: f1 04 cpc r15, r1
1869 ad4: 31 f0 breq .+12 ; 0xae2 <create_chain+0x98> 1849 a36: 31 f0 breq .+12 ; 0xa44 <create_chain+0xa2>
1870 ad6: be 01 movw r22, r28 1850 a38: be 01 movw r22, r28
1871 ad8: c7 01 movw r24, r14 1851 a3a: c7 01 movw r24, r14
1872 ada: 0e 94 c1 03 call 0x782 ; 0x782 <put_cluster> 1852 a3c: 0e 94 c4 03 call 0x788 ; 0x788 <put_cluster>
1873 ade: 88 23 and r24, r24 1853 a40: 88 23 and r24, r24
1874 ae0: 79 f0 breq .+30 ; 0xb00 <create_chain+0xb6> 1854 a42: 79 f0 breq .+30 ; 0xa62 <create_chain+0xc0>
1875   1855  
1876 fs->last_clust = ncl; /* Update fsinfo */ 1856 fs->last_clust = ncl; /* Update fsinfo */
1877 ae2: f5 01 movw r30, r10 1857 a44: f6 01 movw r30, r12
1878 ae4: d1 8f std Z+25, r29 ; 0x19 1858 a46: 10 8f std Z+24, r17 ; 0x18
1879 ae6: c0 8f std Z+24, r28 ; 0x18 1859 a48: 01 8f std Z+25, r16 ; 0x19
1880 if (fs->free_clust != (CLUST)0xFFFFFFFF) { 1860 if (fs->free_clust != (CLUST)0xFFFFFFFF) {
1881 ae8: 82 8d ldd r24, Z+26 ; 0x1a 1861 a4a: 82 8d ldd r24, Z+26 ; 0x1a
1882 aea: 93 8d ldd r25, Z+27 ; 0x1b 1862 a4c: 93 8d ldd r25, Z+27 ; 0x1b
1883 aec: ff ef ldi r31, 0xFF ; 255 1863 a4e: ff ef ldi r31, 0xFF ; 255
1884 aee: 8f 3f cpi r24, 0xFF ; 255 1864 a50: 8f 3f cpi r24, 0xFF ; 255
1885 af0: 9f 07 cpc r25, r31 1865 a52: 9f 07 cpc r25, r31
1886 af2: 21 f0 breq .+8 ; 0xafc <create_chain+0xb2> 1866 a54: 21 f0 breq .+8 ; 0xa5e <create_chain+0xbc>
1887 fs->free_clust--; 1867 fs->free_clust--;
1888 af4: 01 97 sbiw r24, 0x01 ; 1 1868 a56: 01 97 sbiw r24, 0x01 ; 1
1889 af6: f5 01 movw r30, r10 1869 a58: f6 01 movw r30, r12
1890 af8: 93 8f std Z+27, r25 ; 0x1b 1870 a5a: 93 8f std Z+27, r25 ; 0x1b
1891 afa: 82 8f std Z+26, r24 ; 0x1a 1871 a5c: 82 8f std Z+26, r24 ; 0x1a
1892 afc: be 01 movw r22, r28 1872 a5e: 9e 01 movw r18, r28
1893 afe: 05 c0 rjmp .+10 ; 0xb0a <create_chain+0xc0> 1873 a60: 05 c0 rjmp .+10 ; 0xa6c <create_chain+0xca>
1894 b00: 61 e0 ldi r22, 0x01 ; 1 1874 a62: 21 e0 ldi r18, 0x01 ; 1
1895 b02: 70 e0 ldi r23, 0x00 ; 0 1875 a64: 30 e0 ldi r19, 0x00 ; 0
1896 b04: 02 c0 rjmp .+4 ; 0xb0a <create_chain+0xc0> 1876 a66: 02 c0 rjmp .+4 ; 0xa6c <create_chain+0xca>
1897 b06: 60 e0 ldi r22, 0x00 ; 0 1877 a68: 20 e0 ldi r18, 0x00 ; 0
1898 b08: 70 e0 ldi r23, 0x00 ; 0 1878 a6a: 30 e0 ldi r19, 0x00 ; 0
1899 fs->fsi_flag = 1; 1879 fs->fsi_flag = 1;
1900 #endif 1880 #endif
1901 } 1881 }
1902   1882  
1903 return ncl; /* Return new cluster number */ 1883 return ncl; /* Return new cluster number */
1904 } 1884 }
1905 b0a: cb 01 movw r24, r22 1885 a6c: c9 01 movw r24, r18
1906 b0c: ea e0 ldi r30, 0x0A ; 10 1886 a6e: cd b7 in r28, 0x3d ; 61
1907 b0e: cd b7 in r28, 0x3d ; 61 1887 a70: de b7 in r29, 0x3e ; 62
1908 b10: de b7 in r29, 0x3e ; 62 1888 a72: ea e0 ldi r30, 0x0A ; 10
1909 b12: 0c 94 4e 11 jmp 0x229c ; 0x229c <__epilogue_restores__+0x10> 1889 a74: 0c 94 eb 14 jmp 0x29d6 ; 0x29d6 <__epilogue_restores__+0x10>
1910   1890  
1911 00000b16 <f_lseek>: 1891 00000a78 <f_lseek>:
1912   1892  
1913 FRESULT f_lseek ( 1893 FRESULT f_lseek (
1914 FIL *fp, /* Pointer to the file object */ 1894 FIL *fp, /* Pointer to the file object */
1915 DWORD ofs /* File pointer from top of file */ 1895 DWORD ofs /* File pointer from top of file */
1916 ) 1896 )
1917 { 1897 {
1918 b16: a0 e0 ldi r26, 0x00 ; 0 1898 a78: a0 e0 ldi r26, 0x00 ; 0
1919 b18: b0 e0 ldi r27, 0x00 ; 0 1899 a7a: b0 e0 ldi r27, 0x00 ; 0
1920 b1a: e1 e9 ldi r30, 0x91 ; 145 1900 a7c: e2 e4 ldi r30, 0x42 ; 66
1921 b1c: f5 e0 ldi r31, 0x05 ; 5 1901 a7e: f5 e0 ldi r31, 0x05 ; 5
1922 b1e: 0c 94 2a 11 jmp 0x2254 ; 0x2254 <__prologue_saves__> 1902 a80: 0c 94 cb 14 jmp 0x2996 ; 0x2996 <__prologue_saves__+0x8>
1923 b22: ec 01 movw r28, r24 1903 a84: ec 01 movw r28, r24
1924 b24: 3a 01 movw r6, r20 1904 a86: 7a 01 movw r14, r20
1925 b26: 4b 01 movw r8, r22 1905 a88: 8b 01 movw r16, r22
1926 CLUST clust; 1906 CLUST clust;
1927 DWORD csize; 1907 DWORD csize;
1928 BYTE csect; 1908 BYTE csect;
1929 FRESULT res; 1909 FRESULT res;
1930 FATFS *fs = fp->fs; 1910 FATFS *fs = fp->fs;
1931 b28: 4c 80 ldd r4, Y+4 ; 0x04 1911 a8a: 6c 80 ldd r6, Y+4 ; 0x04
1932 b2a: 5d 80 ldd r5, Y+5 ; 0x05 1912 a8c: 7d 80 ldd r7, Y+5 ; 0x05
1933   1913  
1934   1914  
1935 res = validate(fs, fp->id); /* Check validity of the object */ 1915 res = validate(fs, fp->id); /* Check validity of the object */
1936 b2c: 68 81 ld r22, Y 1916 a8e: 68 81 ld r22, Y
1937 b2e: 79 81 ldd r23, Y+1 ; 0x01 1917 a90: 79 81 ldd r23, Y+1 ; 0x01
1938 b30: c2 01 movw r24, r4 1918 a92: c3 01 movw r24, r6
1939 b32: 0e 94 43 03 call 0x686 ; 0x686 <validate> 1919 a94: 0e 94 46 03 call 0x68c ; 0x68c <validate>
1940 b36: 1c 01 movw r2, r24 1920 a98: 4c 01 movw r8, r24
1941 if (res) return res; 1921 if (res) return res;
1942 b38: 89 2b or r24, r25 1922 a9a: 00 97 sbiw r24, 0x00 ; 0
1943 b3a: 09 f0 breq .+2 ; 0xb3e <f_lseek+0x28> 1923 a9c: 09 f0 breq .+2 ; 0xaa0 <f_lseek+0x28>
1944 b3c: b8 c0 rjmp .+368 ; 0xcae <f_lseek+0x198> 1924 a9e: d6 c0 rjmp .+428 ; 0xc4c <f_lseek+0x1d4>
1945   1925  
1946 if (fp->flag & FA__ERROR) return FR_RW_ERROR; 1926 if (fp->flag & FA__ERROR) return FR_RW_ERROR;
1947 b3e: 2a 81 ldd r18, Y+2 ; 0x02 1927 aa0: 8a 81 ldd r24, Y+2 ; 0x02
1948 b40: 22 23 and r18, r18 1928 aa2: 87 fd sbrc r24, 7
1949 b42: 0c f4 brge .+2 ; 0xb46 <f_lseek+0x30> -  
1950 b44: b1 c0 rjmp .+354 ; 0xca8 <f_lseek+0x192> 1929 aa4: d0 c0 rjmp .+416 ; 0xc46 <f_lseek+0x1ce>
1951 #if !_FS_READONLY 1930 #if !_FS_READONLY
1952 if (ofs > fp->fsize && !(fp->flag & FA_WRITE)) 1931 if (ofs > fp->fsize && !(fp->flag & FA_WRITE))
1953 b46: 8a 85 ldd r24, Y+10 ; 0x0a 1932 aa6: aa 84 ldd r10, Y+10 ; 0x0a
1954 b48: 9b 85 ldd r25, Y+11 ; 0x0b 1933 aa8: bb 84 ldd r11, Y+11 ; 0x0b
1955 b4a: ac 85 ldd r26, Y+12 ; 0x0c 1934 aaa: cc 84 ldd r12, Y+12 ; 0x0c
1956 b4c: bd 85 ldd r27, Y+13 ; 0x0d 1935 aac: dd 84 ldd r13, Y+13 ; 0x0d
1957 b4e: 86 15 cp r24, r6 1936 aae: ae 14 cp r10, r14
1958 b50: 97 05 cpc r25, r7 1937 ab0: bf 04 cpc r11, r15
1959 b52: a8 05 cpc r26, r8 1938 ab2: c0 06 cpc r12, r16
1960 b54: b9 05 cpc r27, r9 1939 ab4: d1 06 cpc r13, r17
1961 b56: 20 f4 brcc .+8 ; 0xb60 <f_lseek+0x4a> 1940 ab6: 10 f4 brcc .+4 ; 0xabc <f_lseek+0x44>
1962 b58: 21 fd sbrc r18, 1 1941 ab8: 81 ff sbrs r24, 1
1963 b5a: 02 c0 rjmp .+4 ; 0xb60 <f_lseek+0x4a> 1942 aba: 02 c0 rjmp .+4 ; 0xac0 <f_lseek+0x48>
1964 b5c: 3c 01 movw r6, r24 1943 abc: 57 01 movw r10, r14
1965 b5e: 4d 01 movw r8, r26 1944 abe: 68 01 movw r12, r16
1966 #else 1945 #else
1967 if (ofs > fp->fsize) 1946 if (ofs > fp->fsize)
1968 #endif 1947 #endif
1969 ofs = fp->fsize; 1948 ofs = fp->fsize;
1970 fp->fptr = 0; fp->sect_clust = 1; /* Set file R/W pointer to top of the file */ 1949 fp->fptr = 0; fp->sect_clust = 1; /* Set file R/W pointer to top of the file */
1971 b60: 1e 82 std Y+6, r1 ; 0x06 1950 ac0: 1e 82 std Y+6, r1 ; 0x06
1972 b62: 1f 82 std Y+7, r1 ; 0x07 1951 ac2: 1f 82 std Y+7, r1 ; 0x07
1973 b64: 18 86 std Y+8, r1 ; 0x08 1952 ac4: 18 86 std Y+8, r1 ; 0x08
1974 b66: 19 86 std Y+9, r1 ; 0x09 1953 ac6: 19 86 std Y+9, r1 ; 0x09
1975 b68: 81 e0 ldi r24, 0x01 ; 1 1954 ac8: 81 e0 ldi r24, 0x01 ; 1
1976 b6a: 8b 83 std Y+3, r24 ; 0x03 1955 aca: 8b 83 std Y+3, r24 ; 0x03
1977   1956  
1978 /* Move file R/W pointer if needed */ 1957 /* Move file R/W pointer if needed */
1979 if (ofs) { 1958 if (ofs) {
1980 b6c: 61 14 cp r6, r1 1959 acc: a1 14 cp r10, r1
1981 b6e: 71 04 cpc r7, r1 1960 ace: b1 04 cpc r11, r1
1982 b70: 81 04 cpc r8, r1 1961 ad0: c1 04 cpc r12, r1
1983 b72: 91 04 cpc r9, r1 1962 ad2: d1 04 cpc r13, r1
1984 b74: 09 f4 brne .+2 ; 0xb78 <f_lseek+0x62> 1963 ad4: 09 f4 brne .+2 ; 0xad8 <f_lseek+0x60>
1985 b76: 7e c0 rjmp .+252 ; 0xc74 <f_lseek+0x15e> 1964 ad6: 9d c0 rjmp .+314 ; 0xc12 <f_lseek+0x19a>
1986 clust = fp->org_clust; /* Get start cluster */ 1965 clust = fp->org_clust; /* Get start cluster */
1987 b78: 2e 85 ldd r18, Y+14 ; 0x0e 1966 ad8: 6e 85 ldd r22, Y+14 ; 0x0e
1988 b7a: 3f 85 ldd r19, Y+15 ; 0x0f 1967 ada: 7f 85 ldd r23, Y+15 ; 0x0f
1989 #if !_FS_READONLY 1968 #if !_FS_READONLY
1990 if (!clust) { /* If the file does not have a cluster chain, create new cluster chain */ 1969 if (!clust) { /* If the file does not have a cluster chain, create new cluster chain */
1991 b7c: 21 15 cp r18, r1 1970 adc: 61 15 cp r22, r1
1992 b7e: 31 05 cpc r19, r1 1971 ade: 71 05 cpc r23, r1
1993 b80: 71 f4 brne .+28 ; 0xb9e <f_lseek+0x88> 1972 ae0: 71 f4 brne .+28 ; 0xafe <f_lseek+0x86>
1994 clust = create_chain(0); 1973 clust = create_chain(0);
1995 b82: 80 e0 ldi r24, 0x00 ; 0 1974 ae2: 80 e0 ldi r24, 0x00 ; 0
1996 b84: 90 e0 ldi r25, 0x00 ; 0 1975 ae4: 90 e0 ldi r25, 0x00 ; 0
1997 b86: 0e 94 25 05 call 0xa4a ; 0xa4a <create_chain> 1976 ae6: 0e 94 d1 04 call 0x9a2 ; 0x9a2 <create_chain>
1998 b8a: 9c 01 movw r18, r24 1977 aea: bc 01 movw r22, r24
1999 if (clust == 1) goto fk_error; 1978 if (clust == 1) goto fk_error;
2000 b8c: 81 30 cpi r24, 0x01 ; 1 1979 aec: 81 30 cpi r24, 0x01 ; 1
2001 b8e: 91 05 cpc r25, r1 1980 aee: 91 05 cpc r25, r1
2002 b90: 09 f4 brne .+2 ; 0xb94 <f_lseek+0x7e> 1981 af0: 09 f4 brne .+2 ; 0xaf4 <f_lseek+0x7c>
2003 b92: 87 c0 rjmp .+270 ; 0xca2 <f_lseek+0x18c> 1982 af2: a6 c0 rjmp .+332 ; 0xc40 <f_lseek+0x1c8>
2004 fp->org_clust = clust; 1983 fp->org_clust = clust;
2005 b94: 9f 87 std Y+15, r25 ; 0x0f 1984 af4: 9f 87 std Y+15, r25 ; 0x0f
2006 b96: 8e 87 std Y+14, r24 ; 0x0e 1985 af6: 8e 87 std Y+14, r24 ; 0x0e
2007 } 1986 }
2008 #endif 1987 #endif
2009 if (clust) { /* If the file has a cluster chain, it can be followed */ 1988 if (clust) { /* If the file has a cluster chain, it can be followed */
2010 b98: 89 2b or r24, r25 1989 af8: 00 97 sbiw r24, 0x00 ; 0
2011 b9a: 09 f4 brne .+2 ; 0xb9e <f_lseek+0x88> 1990 afa: 09 f4 brne .+2 ; 0xafe <f_lseek+0x86>
2012 b9c: 6b c0 rjmp .+214 ; 0xc74 <f_lseek+0x15e> 1991 afc: 8a c0 rjmp .+276 ; 0xc12 <f_lseek+0x19a>
2013 csize = (DWORD)fs->sects_clust * 512; /* Cluster size in unit of byte */ 1992 csize = (DWORD)fs->sects_clust * 512; /* Cluster size in unit of byte */
2014 b9e: f2 01 movw r30, r4 1993 afe: f3 01 movw r30, r6
2015 ba0: 85 8d ldd r24, Z+29 ; 0x1d 1994 b00: 85 8d ldd r24, Z+29 ; 0x1d
2016 ba2: e8 2e mov r14, r24 1995 b02: e8 2e mov r14, r24
2017 ba4: ff 24 eor r15, r15 1996 b04: ff 24 eor r15, r15
2018 ba6: 00 27 eor r16, r16 1997 b06: 00 e0 ldi r16, 0x00 ; 0
2019 ba8: 11 27 eor r17, r17 1998 b08: 10 e0 ldi r17, 0x00 ; 0
2020 baa: 89 e0 ldi r24, 0x09 ; 9 1999 b0a: f9 e0 ldi r31, 0x09 ; 9
2021 bac: ee 0c add r14, r14 2000 b0c: ee 0c add r14, r14
2022 bae: ff 1c adc r15, r15 2001 b0e: ff 1c adc r15, r15
2023 bb0: 00 1f adc r16, r16 2002 b10: 00 1f adc r16, r16
2024 bb2: 11 1f adc r17, r17 2003 b12: 11 1f adc r17, r17
2025 bb4: 8a 95 dec r24 2004 b14: fa 95 dec r31
2026 bb6: d1 f7 brne .-12 ; 0xbac <f_lseek+0x96> 2005 b16: d1 f7 brne .-12 ; 0xb0c <f_lseek+0x94>
2027 for (;;) { /* Loop to skip leading clusters */ 2006 for (;;) { /* Loop to skip leading clusters */
2028 fp->curr_clust = clust; /* Update current cluster */ 2007 fp->curr_clust = clust; /* Update current cluster */
2029 bb8: 39 8b std Y+17, r19 ; 0x11 2008 b18: 79 8b std Y+17, r23 ; 0x11
2030 bba: 28 8b std Y+16, r18 ; 0x10 2009 b1a: 68 8b std Y+16, r22 ; 0x10
2031 if (ofs <= csize) break; 2010 if (ofs <= csize) break;
2032 bbc: e6 14 cp r14, r6 2011 b1c: ea 14 cp r14, r10
2033 bbe: f7 04 cpc r15, r7 2012 b1e: fb 04 cpc r15, r11
2034 bc0: 08 05 cpc r16, r8 2013 b20: 0c 05 cpc r16, r12
2035 bc2: 19 05 cpc r17, r9 2014 b22: 1d 05 cpc r17, r13
2036 bc4: 50 f5 brcc .+84 ; 0xc1a <f_lseek+0x104> 2015 b24: 58 f5 brcc .+86 ; 0xb7c <f_lseek+0x104>
2037 #if !_FS_READONLY 2016 #if !_FS_READONLY
2038 if (fp->flag & FA_WRITE) /* Check if in write mode or not */ 2017 if (fp->flag & FA_WRITE) /* Check if in write mode or not */
2039 bc6: 8a 81 ldd r24, Y+2 ; 0x02 2018 b26: 8a 81 ldd r24, Y+2 ; 0x02
2040 bc8: 81 ff sbrs r24, 1 2019 b28: 81 ff sbrs r24, 1
2041 bca: 04 c0 rjmp .+8 ; 0xbd4 <f_lseek+0xbe> 2020 b2a: 04 c0 rjmp .+8 ; 0xb34 <f_lseek+0xbc>
2042 clust = create_chain(clust); /* Force streached if in write mode */ 2021 clust = create_chain(clust); /* Force streached if in write mode */
2043 bcc: c9 01 movw r24, r18 2022 b2c: cb 01 movw r24, r22
2044 bce: 0e 94 25 05 call 0xa4a ; 0xa4a <create_chain> 2023 b2e: 0e 94 d1 04 call 0x9a2 ; 0x9a2 <create_chain>
2045 bd2: 03 c0 rjmp .+6 ; 0xbda <f_lseek+0xc4> 2024 b32: 03 c0 rjmp .+6 ; 0xb3a <f_lseek+0xc2>
2046 else 2025 else
2047 #endif 2026 #endif
2048 clust = get_cluster(clust); /* Only follow cluster chain if not in write mode */ 2027 clust = get_cluster(clust); /* Only follow cluster chain if not in write mode */
2049 bd4: c9 01 movw r24, r18 2028 b34: cb 01 movw r24, r22
2050 bd6: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> 2029 b36: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
2051 bda: 9c 01 movw r18, r24 2030 b3a: bc 01 movw r22, r24
2052 if (clust == 0) { /* Stop if could not follow the cluster chain */ 2031 if (clust == 0) { /* Stop if could not follow the cluster chain */
2053 bdc: 00 97 sbiw r24, 0x00 ; 0 2032 b3c: 00 97 sbiw r24, 0x00 ; 0
2054 bde: d9 f0 breq .+54 ; 0xc16 <f_lseek+0x100> 2033 b3e: e1 f0 breq .+56 ; 0xb78 <f_lseek+0x100>
2055 ofs = csize; break; 2034 ofs = csize; break;
2056 } 2035 }
2057 if (clust == 1 || clust >= fs->max_clust) goto fk_error; 2036 if (clust == 1 || clust >= fs->max_clust) goto fk_error;
2058 be0: 01 97 sbiw r24, 0x01 ; 1 2037 b40: 81 30 cpi r24, 0x01 ; 1
-   2038 b42: 91 05 cpc r25, r1
2059 be2: 09 f4 brne .+2 ; 0xbe6 <f_lseek+0xd0> 2039 b44: 09 f4 brne .+2 ; 0xb48 <f_lseek+0xd0>
2060 be4: 5e c0 rjmp .+188 ; 0xca2 <f_lseek+0x18c> 2040 b46: 7c c0 rjmp .+248 ; 0xc40 <f_lseek+0x1c8>
2061 be6: f2 01 movw r30, r4 2041 b48: f3 01 movw r30, r6
2062 be8: 86 89 ldd r24, Z+22 ; 0x16 2042 b4a: 86 89 ldd r24, Z+22 ; 0x16
2063 bea: 97 89 ldd r25, Z+23 ; 0x17 2043 b4c: 97 89 ldd r25, Z+23 ; 0x17
2064 bec: 28 17 cp r18, r24 2044 b4e: 68 17 cp r22, r24
2065 bee: 39 07 cpc r19, r25 2045 b50: 79 07 cpc r23, r25
2066 bf0: 08 f0 brcs .+2 ; 0xbf4 <f_lseek+0xde> 2046 b52: 08 f0 brcs .+2 ; 0xb56 <f_lseek+0xde>
2067 bf2: 57 c0 rjmp .+174 ; 0xca2 <f_lseek+0x18c> 2047 b54: 75 c0 rjmp .+234 ; 0xc40 <f_lseek+0x1c8>
-   2048 fp->fptr += csize; /* Update R/W pointer */
-   2049 b56: 8e 81 ldd r24, Y+6 ; 0x06
-   2050 b58: 9f 81 ldd r25, Y+7 ; 0x07
-   2051 b5a: a8 85 ldd r26, Y+8 ; 0x08
-   2052 b5c: b9 85 ldd r27, Y+9 ; 0x09
-   2053 b5e: 8e 0d add r24, r14
-   2054 b60: 9f 1d adc r25, r15
-   2055 b62: a0 1f adc r26, r16
-   2056 b64: b1 1f adc r27, r17
-   2057 b66: 8e 83 std Y+6, r24 ; 0x06
-   2058 b68: 9f 83 std Y+7, r25 ; 0x07
-   2059 b6a: a8 87 std Y+8, r26 ; 0x08
-   2060 b6c: b9 87 std Y+9, r27 ; 0x09
-   2061 ofs -= csize;
-   2062 b6e: ae 18 sub r10, r14
-   2063 b70: bf 08 sbc r11, r15
-   2064 b72: c0 0a sbc r12, r16
-   2065 b74: d1 0a sbc r13, r17
-   2066 b76: d0 cf rjmp .-96 ; 0xb18 <f_lseek+0xa0>
-   2067 }
-   2068 b78: 57 01 movw r10, r14
-   2069 b7a: 68 01 movw r12, r16
-   2070 csect = (BYTE)((ofs - 1) / 512); /* Sector offset in the cluster */
-   2071 b7c: d6 01 movw r26, r12
-   2072 b7e: c5 01 movw r24, r10
-   2073 b80: 01 97 sbiw r24, 0x01 ; 1
-   2074 b82: a1 09 sbc r26, r1
-   2075 b84: b1 09 sbc r27, r1
-   2076 b86: e9 e0 ldi r30, 0x09 ; 9
-   2077 b88: b6 95 lsr r27
-   2078 b8a: a7 95 ror r26
-   2079 b8c: 97 95 ror r25
-   2080 b8e: 87 95 ror r24
-   2081 b90: ea 95 dec r30
-   2082 b92: d1 f7 brne .-12 ; 0xb88 <f_lseek+0x110>
-   2083 b94: f8 2e mov r15, r24
-   2084 static
-   2085 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   2086 CLUST clust /* Cluster# to be converted */
-   2087 )
-   2088 {
-   2089 FATFS *fs = FatFs;
-   2090 b96: 00 91 10 01 lds r16, 0x0110
-   2091 b9a: 10 91 11 01 lds r17, 0x0111
-   2092  
-   2093  
-   2094 clust -= 2;
-   2095 b9e: 62 50 subi r22, 0x02 ; 2
-   2096 ba0: 70 40 sbci r23, 0x00 ; 0
-   2097 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   2098 ba2: f8 01 movw r30, r16
-   2099 ba4: 86 89 ldd r24, Z+22 ; 0x16
-   2100 ba6: 97 89 ldd r25, Z+23 ; 0x17
-   2101 ba8: 02 97 sbiw r24, 0x02 ; 2
-   2102 baa: 68 17 cp r22, r24
-   2103 bac: 79 07 cpc r23, r25
-   2104 bae: 28 f0 brcs .+10 ; 0xbba <f_lseek+0x142>
-   2105 bb0: 20 e0 ldi r18, 0x00 ; 0
-   2106 bb2: 30 e0 ldi r19, 0x00 ; 0
-   2107 bb4: 40 e0 ldi r20, 0x00 ; 0
-   2108 bb6: 50 e0 ldi r21, 0x00 ; 0
-   2109 bb8: 14 c0 rjmp .+40 ; 0xbe2 <f_lseek+0x16a>
-   2110 return (DWORD)clust * fs->sects_clust + fs->database;
-   2111 bba: 80 e0 ldi r24, 0x00 ; 0
-   2112 bbc: 90 e0 ldi r25, 0x00 ; 0
-   2113 bbe: f8 01 movw r30, r16
-   2114 bc0: 25 8d ldd r18, Z+29 ; 0x1d
-   2115 bc2: 30 e0 ldi r19, 0x00 ; 0
-   2116 bc4: 40 e0 ldi r20, 0x00 ; 0
-   2117 bc6: 50 e0 ldi r21, 0x00 ; 0
-   2118 bc8: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   2119 bcc: 9b 01 movw r18, r22
-   2120 bce: ac 01 movw r20, r24
-   2121 bd0: f8 01 movw r30, r16
-   2122 bd2: 80 89 ldd r24, Z+16 ; 0x10
-   2123 bd4: 91 89 ldd r25, Z+17 ; 0x11
-   2124 bd6: a2 89 ldd r26, Z+18 ; 0x12
-   2125 bd8: b3 89 ldd r27, Z+19 ; 0x13
-   2126 bda: 28 0f add r18, r24
-   2127 bdc: 39 1f adc r19, r25
-   2128 bde: 4a 1f adc r20, r26
-   2129 be0: 5b 1f adc r21, r27
-   2130 if (clust == 1 || clust >= fs->max_clust) goto fk_error;
2068 fp->fptr += csize; /* Update R/W pointer */ 2131 fp->fptr += csize; /* Update R/W pointer */
2069 bf4: 8e 81 ldd r24, Y+6 ; 0x06 -  
2070 bf6: 9f 81 ldd r25, Y+7 ; 0x07 -  
2071 bf8: a8 85 ldd r26, Y+8 ; 0x08 -  
2072 bfa: b9 85 ldd r27, Y+9 ; 0x09 -  
2073 bfc: 8e 0d add r24, r14 -  
2074 bfe: 9f 1d adc r25, r15 -  
2075 c00: a0 1f adc r26, r16 -  
2076 c02: b1 1f adc r27, r17 -  
2077 c04: 8e 83 std Y+6, r24 ; 0x06 -  
2078 c06: 9f 83 std Y+7, r25 ; 0x07 -  
2079 c08: a8 87 std Y+8, r26 ; 0x08 -  
2080 c0a: b9 87 std Y+9, r27 ; 0x09 -  
2081 ofs -= csize; 2132 ofs -= csize;
2082 c0c: 6e 18 sub r6, r14 -  
2083 c0e: 7f 08 sbc r7, r15 -  
2084 c10: 80 0a sbc r8, r16 -  
2085 c12: 91 0a sbc r9, r17 -  
2086 c14: d1 cf rjmp .-94 ; 0xbb8 <f_lseek+0xa2> -  
2087 } 2133 }
2088 c16: 37 01 movw r6, r14 -  
2089 c18: 48 01 movw r8, r16 -  
2090 csect = (BYTE)((ofs - 1) / 512); /* Sector offset in the cluster */ 2134 csect = (BYTE)((ofs - 1) / 512); /* Sector offset in the cluster */
2091 c1a: 64 01 movw r12, r8 -  
2092 c1c: 53 01 movw r10, r6 -  
2093 c1e: 08 94 sec -  
2094 c20: a1 08 sbc r10, r1 -  
2095 c22: b1 08 sbc r11, r1 -  
2096 c24: c1 08 sbc r12, r1 -  
2097 c26: d1 08 sbc r13, r1 -  
2098 c28: 09 e0 ldi r16, 0x09 ; 9 -  
2099 c2a: d6 94 lsr r13 -  
2100 c2c: c7 94 ror r12 -  
2101 c2e: b7 94 ror r11 -  
2102 c30: a7 94 ror r10 -  
2103 c32: 0a 95 dec r16 -  
2104 c34: d1 f7 brne .-12 ; 0xc2a <f_lseek+0x114> -  
2105 fp->curr_sect = clust2sect(clust) + csect; /* Current sector */ 2135 fp->curr_sect = clust2sect(clust) + csect; /* Current sector */
2106 c36: ea 2c mov r14, r10 -  
2107 c38: ff 24 eor r15, r15 2136 be2: 2f 0d add r18, r15
2108 c3a: 00 27 eor r16, r16 -  
2109 c3c: 11 27 eor r17, r17 -  
2110 c3e: c9 01 movw r24, r18 -  
2111 c40: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
2112 c44: e6 0e add r14, r22 2137 be4: 31 1d adc r19, r1
2113 c46: f7 1e adc r15, r23 2138 be6: 41 1d adc r20, r1
2114 c48: 08 1f adc r16, r24 2139 be8: 51 1d adc r21, r1
2115 c4a: 19 1f adc r17, r25 -  
2116 c4c: ea 8a std Y+18, r14 ; 0x12 2140 bea: 2a 8b std Y+18, r18 ; 0x12
2117 c4e: fb 8a std Y+19, r15 ; 0x13 2141 bec: 3b 8b std Y+19, r19 ; 0x13
2118 c50: 0c 8b std Y+20, r16 ; 0x14 2142 bee: 4c 8b std Y+20, r20 ; 0x14
2119 c52: 1d 8b std Y+21, r17 ; 0x15 2143 bf0: 5d 8b std Y+21, r21 ; 0x15
2120 fp->sect_clust = fs->sects_clust - csect; /* Left sector counter in the cluster */ 2144 fp->sect_clust = fs->sects_clust - csect; /* Left sector counter in the cluster */
2121 c54: f2 01 movw r30, r4 2145 bf2: f3 01 movw r30, r6
2122 c56: 85 8d ldd r24, Z+29 ; 0x1d 2146 bf4: 85 8d ldd r24, Z+29 ; 0x1d
2123 c58: 8a 19 sub r24, r10 2147 bf6: 8f 19 sub r24, r15
2124 c5a: 8b 83 std Y+3, r24 ; 0x03 2148 bf8: 8b 83 std Y+3, r24 ; 0x03
2125 fp->fptr += ofs; /* Update file R/W pointer */ 2149 fp->fptr += ofs; /* Update file R/W pointer */
2126 c5c: 8e 81 ldd r24, Y+6 ; 0x06 2150 bfa: 8e 81 ldd r24, Y+6 ; 0x06
2127 c5e: 9f 81 ldd r25, Y+7 ; 0x07 2151 bfc: 9f 81 ldd r25, Y+7 ; 0x07
2128 c60: a8 85 ldd r26, Y+8 ; 0x08 2152 bfe: a8 85 ldd r26, Y+8 ; 0x08
2129 c62: b9 85 ldd r27, Y+9 ; 0x09 2153 c00: b9 85 ldd r27, Y+9 ; 0x09
2130 c64: 86 0d add r24, r6 2154 c02: 8a 0d add r24, r10
2131 c66: 97 1d adc r25, r7 2155 c04: 9b 1d adc r25, r11
2132 c68: a8 1d adc r26, r8 2156 c06: ac 1d adc r26, r12
2133 c6a: b9 1d adc r27, r9 2157 c08: bd 1d adc r27, r13
2134 c6c: 8e 83 std Y+6, r24 ; 0x06 2158 c0a: 8e 83 std Y+6, r24 ; 0x06
2135 c6e: 9f 83 std Y+7, r25 ; 0x07 2159 c0c: 9f 83 std Y+7, r25 ; 0x07
2136 c70: a8 87 std Y+8, r26 ; 0x08 2160 c0e: a8 87 std Y+8, r26 ; 0x08
2137 c72: b9 87 std Y+9, r27 ; 0x09 2161 c10: b9 87 std Y+9, r27 ; 0x09
2138 } 2162 }
2139 } 2163 }
2140 #if !_FS_READONLY 2164 #if !_FS_READONLY
2141 if ((fp->flag & FA_WRITE) && fp->fptr > fp->fsize) { /* Set updated flag if in write mode */ 2165 if ((fp->flag & FA_WRITE) && fp->fptr > fp->fsize) { /* Set updated flag if in write mode */
2142 c74: 6a 81 ldd r22, Y+2 ; 0x02 2166 c12: 6a 81 ldd r22, Y+2 ; 0x02
2143 c76: 61 ff sbrs r22, 1 2167 c14: 61 ff sbrs r22, 1
2144 c78: 1a c0 rjmp .+52 ; 0xcae <f_lseek+0x198> 2168 c16: 1a c0 rjmp .+52 ; 0xc4c <f_lseek+0x1d4>
2145 c7a: 2e 81 ldd r18, Y+6 ; 0x06 2169 c18: 2e 81 ldd r18, Y+6 ; 0x06
2146 c7c: 3f 81 ldd r19, Y+7 ; 0x07 2170 c1a: 3f 81 ldd r19, Y+7 ; 0x07
2147 c7e: 48 85 ldd r20, Y+8 ; 0x08 2171 c1c: 48 85 ldd r20, Y+8 ; 0x08
2148 c80: 59 85 ldd r21, Y+9 ; 0x09 2172 c1e: 59 85 ldd r21, Y+9 ; 0x09
2149 c82: 8a 85 ldd r24, Y+10 ; 0x0a 2173 c20: 8a 85 ldd r24, Y+10 ; 0x0a
2150 c84: 9b 85 ldd r25, Y+11 ; 0x0b 2174 c22: 9b 85 ldd r25, Y+11 ; 0x0b
2151 c86: ac 85 ldd r26, Y+12 ; 0x0c 2175 c24: ac 85 ldd r26, Y+12 ; 0x0c
2152 c88: bd 85 ldd r27, Y+13 ; 0x0d 2176 c26: bd 85 ldd r27, Y+13 ; 0x0d
2153 c8a: 82 17 cp r24, r18 2177 c28: 82 17 cp r24, r18
2154 c8c: 93 07 cpc r25, r19 2178 c2a: 93 07 cpc r25, r19
2155 c8e: a4 07 cpc r26, r20 2179 c2c: a4 07 cpc r26, r20
2156 c90: b5 07 cpc r27, r21 2180 c2e: b5 07 cpc r27, r21
2157 c92: 68 f4 brcc .+26 ; 0xcae <f_lseek+0x198> 2181 c30: 68 f4 brcc .+26 ; 0xc4c <f_lseek+0x1d4>
2158 fp->fsize = fp->fptr; 2182 fp->fsize = fp->fptr;
2159 c94: 2a 87 std Y+10, r18 ; 0x0a 2183 c32: 2a 87 std Y+10, r18 ; 0x0a
2160 c96: 3b 87 std Y+11, r19 ; 0x0b 2184 c34: 3b 87 std Y+11, r19 ; 0x0b
2161 c98: 4c 87 std Y+12, r20 ; 0x0c 2185 c36: 4c 87 std Y+12, r20 ; 0x0c
2162 c9a: 5d 87 std Y+13, r21 ; 0x0d 2186 c38: 5d 87 std Y+13, r21 ; 0x0d
2163 fp->flag |= FA__WRITTEN; 2187 fp->flag |= FA__WRITTEN;
2164 c9c: 60 62 ori r22, 0x20 ; 32 2188 c3a: 60 62 ori r22, 0x20 ; 32
2165 c9e: 6a 83 std Y+2, r22 ; 0x02 2189 c3c: 6a 83 std Y+2, r22 ; 0x02
2166 ca0: 06 c0 rjmp .+12 ; 0xcae <f_lseek+0x198> 2190 c3e: 06 c0 rjmp .+12 ; 0xc4c <f_lseek+0x1d4>
2167 #endif 2191 #endif
2168   2192  
2169 return FR_OK; 2193 return FR_OK;
2170   2194  
2171 fk_error: /* Abort this function due to an unrecoverable error */ 2195 fk_error: /* Abort this function due to an unrecoverable error */
2172 fp->flag |= FA__ERROR; 2196 fp->flag |= FA__ERROR;
2173 ca2: 8a 81 ldd r24, Y+2 ; 0x02 2197 c40: 8a 81 ldd r24, Y+2 ; 0x02
2174 ca4: 80 68 ori r24, 0x80 ; 128 2198 c42: 80 68 ori r24, 0x80 ; 128
2175 ca6: 8a 83 std Y+2, r24 ; 0x02 2199 c44: 8a 83 std Y+2, r24 ; 0x02
2176 ca8: 18 e0 ldi r17, 0x08 ; 8 2200 c46: 68 e0 ldi r22, 0x08 ; 8
2177 caa: 21 2e mov r2, r17 2201 c48: 86 2e mov r8, r22
2178 cac: 31 2c mov r3, r1 2202 c4a: 91 2c mov r9, r1
2179 return FR_RW_ERROR; 2203 return FR_RW_ERROR;
2180 } 2204 }
2181 cae: c1 01 movw r24, r2 2205 c4c: c4 01 movw r24, r8
-   2206 c4e: cd b7 in r28, 0x3d ; 61
-   2207 c50: de b7 in r29, 0x3e ; 62
2182 cb0: e2 e1 ldi r30, 0x12 ; 18 2208 c52: ee e0 ldi r30, 0x0E ; 14
-   2209 c54: 0c 94 e7 14 jmp 0x29ce ; 0x29ce <__epilogue_restores__+0x8>
-   2210  
-   2211 00000c58 <next_dir_entry>:
-   2212  
-   2213 static
-   2214 BOOL next_dir_entry ( /* TRUE: successful, FALSE: could not move next */
-   2215 DIR *dirobj /* Pointer to directory object */
-   2216 )
-   2217 {
-   2218 c58: ef 92 push r14
-   2219 c5a: ff 92 push r15
-   2220 c5c: 0f 93 push r16
-   2221 c5e: 1f 93 push r17
-   2222 c60: cf 93 push r28
-   2223 c62: df 93 push r29
-   2224 c64: 8c 01 movw r16, r24
-   2225 CLUST clust;
-   2226 WORD idx;
-   2227 FATFS *fs = FatFs;
-   2228 c66: c0 91 10 01 lds r28, 0x0110
-   2229 c6a: d0 91 11 01 lds r29, 0x0111
-   2230  
-   2231  
-   2232 idx = dirobj->index + 1;
-   2233 c6e: fc 01 movw r30, r24
-   2234 c70: e2 80 ldd r14, Z+2 ; 0x02
-   2235 c72: f3 80 ldd r15, Z+3 ; 0x03
-   2236 c74: 08 94 sec
-   2237 c76: e1 1c adc r14, r1
-   2238 c78: f1 1c adc r15, r1
-   2239 if ((idx & 15) == 0) { /* Table sector changed? */
-   2240 c7a: c7 01 movw r24, r14
-   2241 c7c: 8f 70 andi r24, 0x0F ; 15
-   2242 c7e: 90 70 andi r25, 0x00 ; 0
-   2243 c80: 89 2b or r24, r25
-   2244 c82: 09 f0 breq .+2 ; 0xc86 <next_dir_entry+0x2e>
-   2245 c84: 5b c0 rjmp .+182 ; 0xd3c <next_dir_entry+0xe4>
-   2246 dirobj->sect++; /* Next sector */
-   2247 c86: 82 85 ldd r24, Z+10 ; 0x0a
-   2248 c88: 93 85 ldd r25, Z+11 ; 0x0b
-   2249 c8a: a4 85 ldd r26, Z+12 ; 0x0c
-   2250 c8c: b5 85 ldd r27, Z+13 ; 0x0d
-   2251 c8e: 01 96 adiw r24, 0x01 ; 1
-   2252 c90: a1 1d adc r26, r1
-   2253 c92: b1 1d adc r27, r1
-   2254 c94: 82 87 std Z+10, r24 ; 0x0a
-   2255 c96: 93 87 std Z+11, r25 ; 0x0b
-   2256 c98: a4 87 std Z+12, r26 ; 0x0c
-   2257 c9a: b5 87 std Z+13, r27 ; 0x0d
-   2258 if (!dirobj->clust) { /* In static table */
-   2259 c9c: 40 85 ldd r20, Z+8 ; 0x08
-   2260 c9e: 51 85 ldd r21, Z+9 ; 0x09
-   2261 ca0: 41 15 cp r20, r1
-   2262 ca2: 51 05 cpc r21, r1
-   2263 ca4: 39 f4 brne .+14 ; 0xcb4 <next_dir_entry+0x5c>
-   2264 if (idx >= fs->n_rootdir) return FALSE; /* Reached to end of table */
-   2265 ca6: 8a 81 ldd r24, Y+2 ; 0x02
-   2266 ca8: 9b 81 ldd r25, Y+3 ; 0x03
-   2267 caa: e8 16 cp r14, r24
-   2268 cac: f9 06 cpc r15, r25
-   2269 cae: 08 f4 brcc .+2 ; 0xcb2 <next_dir_entry+0x5a>
-   2270 cb0: 45 c0 rjmp .+138 ; 0xd3c <next_dir_entry+0xe4>
-   2271 cb2: 49 c0 rjmp .+146 ; 0xd46 <next_dir_entry+0xee>
-   2272 } else { /* In dynamic table */
-   2273 if (((idx / 16) & (fs->sects_clust - 1)) == 0) { /* Cluster changed? */
-   2274 cb4: 8d 8d ldd r24, Y+29 ; 0x1d
-   2275 cb6: 90 e0 ldi r25, 0x00 ; 0
-   2276 cb8: 01 97 sbiw r24, 0x01 ; 1
-   2277 cba: 97 01 movw r18, r14
-   2278 cbc: a4 e0 ldi r26, 0x04 ; 4
-   2279 cbe: 36 95 lsr r19
-   2280 cc0: 27 95 ror r18
-   2281 cc2: aa 95 dec r26
-   2282 cc4: e1 f7 brne .-8 ; 0xcbe <next_dir_entry+0x66>
-   2283 cc6: 82 23 and r24, r18
-   2284 cc8: 93 23 and r25, r19
-   2285 cca: 89 2b or r24, r25
-   2286 ccc: b9 f5 brne .+110 ; 0xd3c <next_dir_entry+0xe4>
-   2287 clust = get_cluster(dirobj->clust); /* Get next cluster */
-   2288 cce: ca 01 movw r24, r20
-   2289 cd0: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
-   2290 cd4: bc 01 movw r22, r24
-   2291 if (clust < 2 || clust >= fs->max_clust) /* Reached to end of table */
-   2292 cd6: 82 30 cpi r24, 0x02 ; 2
-   2293 cd8: 91 05 cpc r25, r1
-   2294 cda: a8 f1 brcs .+106 ; 0xd46 <next_dir_entry+0xee>
-   2295 cdc: 8e 89 ldd r24, Y+22 ; 0x16
-   2296 cde: 9f 89 ldd r25, Y+23 ; 0x17
-   2297 ce0: 68 17 cp r22, r24
-   2298 ce2: 79 07 cpc r23, r25
-   2299 ce4: 80 f5 brcc .+96 ; 0xd46 <next_dir_entry+0xee>
-   2300 return FALSE;
-   2301 dirobj->clust = clust; /* Initialize for new cluster */
-   2302 ce6: f8 01 movw r30, r16
-   2303 ce8: 71 87 std Z+9, r23 ; 0x09
-   2304 cea: 60 87 std Z+8, r22 ; 0x08
-   2305 static
-   2306 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   2307 CLUST clust /* Cluster# to be converted */
-   2308 )
-   2309 {
-   2310 FATFS *fs = FatFs;
-   2311 cec: c0 91 10 01 lds r28, 0x0110
-   2312 cf0: d0 91 11 01 lds r29, 0x0111
-   2313  
-   2314  
-   2315 clust -= 2;
-   2316 cf4: 62 50 subi r22, 0x02 ; 2
-   2317 cf6: 70 40 sbci r23, 0x00 ; 0
-   2318 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   2319 cf8: 8e 89 ldd r24, Y+22 ; 0x16
-   2320 cfa: 9f 89 ldd r25, Y+23 ; 0x17
-   2321 cfc: 02 97 sbiw r24, 0x02 ; 2
-   2322 cfe: 68 17 cp r22, r24
-   2323 d00: 79 07 cpc r23, r25
-   2324 d02: 28 f0 brcs .+10 ; 0xd0e <next_dir_entry+0xb6>
-   2325 d04: 20 e0 ldi r18, 0x00 ; 0
-   2326 d06: 30 e0 ldi r19, 0x00 ; 0
-   2327 d08: 40 e0 ldi r20, 0x00 ; 0
-   2328 d0a: 50 e0 ldi r21, 0x00 ; 0
-   2329 d0c: 12 c0 rjmp .+36 ; 0xd32 <next_dir_entry+0xda>
-   2330 return (DWORD)clust * fs->sects_clust + fs->database;
-   2331 d0e: 80 e0 ldi r24, 0x00 ; 0
-   2332 d10: 90 e0 ldi r25, 0x00 ; 0
-   2333 d12: 2d 8d ldd r18, Y+29 ; 0x1d
-   2334 d14: 30 e0 ldi r19, 0x00 ; 0
-   2335 d16: 40 e0 ldi r20, 0x00 ; 0
-   2336 d18: 50 e0 ldi r21, 0x00 ; 0
-   2337 d1a: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   2338 d1e: 9b 01 movw r18, r22
-   2339 d20: ac 01 movw r20, r24
-   2340 d22: 88 89 ldd r24, Y+16 ; 0x10
-   2341 d24: 99 89 ldd r25, Y+17 ; 0x11
-   2342 d26: aa 89 ldd r26, Y+18 ; 0x12
-   2343 d28: bb 89 ldd r27, Y+19 ; 0x13
-   2344 d2a: 28 0f add r18, r24
-   2345 d2c: 39 1f adc r19, r25
-   2346 d2e: 4a 1f adc r20, r26
-   2347 d30: 5b 1f adc r21, r27
-   2348 if (((idx / 16) & (fs->sects_clust - 1)) == 0) { /* Cluster changed? */
-   2349 clust = get_cluster(dirobj->clust); /* Get next cluster */
-   2350 if (clust < 2 || clust >= fs->max_clust) /* Reached to end of table */
-   2351 return FALSE;
-   2352 dirobj->clust = clust; /* Initialize for new cluster */
-   2353 dirobj->sect = clust2sect(clust);
-   2354 d32: f8 01 movw r30, r16
-   2355 d34: 22 87 std Z+10, r18 ; 0x0a
-   2356 d36: 33 87 std Z+11, r19 ; 0x0b
-   2357 d38: 44 87 std Z+12, r20 ; 0x0c
-   2358 d3a: 55 87 std Z+13, r21 ; 0x0d
-   2359 }
-   2360 }
-   2361 }
-   2362 dirobj->index = idx; /* Lower 4 bit of dirobj->index indicates offset in dirobj->sect */
-   2363 d3c: f8 01 movw r30, r16
-   2364 d3e: f3 82 std Z+3, r15 ; 0x03
-   2365 d40: e2 82 std Z+2, r14 ; 0x02
-   2366 d42: 81 e0 ldi r24, 0x01 ; 1
-   2367 d44: 01 c0 rjmp .+2 ; 0xd48 <next_dir_entry+0xf0>
-   2368 return TRUE;
-   2369 d46: 80 e0 ldi r24, 0x00 ; 0
-   2370 }
2183 cb2: cd b7 in r28, 0x3d ; 61 2371 d48: cd b7 in r28, 0x3d ; 61
2184 cb4: de b7 in r29, 0x3e ; 62 2372 d4a: de b7 in r29, 0x3e ; 62
-   2373 d4c: e6 e0 ldi r30, 0x06 ; 6
2185 cb6: 0c 94 46 11 jmp 0x228c ; 0x228c <__epilogue_restores__> 2374 d4e: 0c 94 ef 14 jmp 0x29de ; 0x29de <__epilogue_restores__+0x18>
2186   2375  
2187 00000cba <f_sync>: 2376 00000d52 <f_sync>:
2188 /*-----------------------------------------------------------------------*/ 2377 /*-----------------------------------------------------------------------*/
2189   2378  
2190 FRESULT f_sync ( 2379 FRESULT f_sync (
2191 FIL *fp /* Pointer to the file object */ 2380 FIL *fp /* Pointer to the file object */
2192 ) 2381 )
2193 { 2382 {
2194 cba: ef 92 push r14 2383 d52: ef 92 push r14
2195 cbc: ff 92 push r15 2384 d54: ff 92 push r15
2196 cbe: 0f 93 push r16 2385 d56: 0f 93 push r16
2197 cc0: 1f 93 push r17 2386 d58: 1f 93 push r17
2198 cc2: cf 93 push r28 2387 d5a: cf 93 push r28
2199 cc4: df 93 push r29 2388 d5c: df 93 push r29
2200 cc6: ec 01 movw r28, r24 2389 d5e: ec 01 movw r28, r24
2201 BYTE *dir; 2390 BYTE *dir;
2202 FRESULT res; 2391 FRESULT res;
2203 FATFS *fs = fp->fs; 2392 FATFS *fs = fp->fs;
2204   2393  
2205   2394  
2206 res = validate(fs, fp->id); /* Check validity of the object */ 2395 res = validate(fs, fp->id); /* Check validity of the object */
2207 cc8: 68 81 ld r22, Y 2396 d60: 68 81 ld r22, Y
2208 cca: 79 81 ldd r23, Y+1 ; 0x01 2397 d62: 79 81 ldd r23, Y+1 ; 0x01
2209 ccc: 8c 81 ldd r24, Y+4 ; 0x04 2398 d64: 8c 81 ldd r24, Y+4 ; 0x04
2210 cce: 9d 81 ldd r25, Y+5 ; 0x05 2399 d66: 9d 81 ldd r25, Y+5 ; 0x05
2211 cd0: 0e 94 43 03 call 0x686 ; 0x686 <validate> 2400 d68: 0e 94 46 03 call 0x68c ; 0x68c <validate>
2212 cd4: 7c 01 movw r14, r24 2401 d6c: 7c 01 movw r14, r24
2213 if (res == FR_OK) { 2402 if (res == FR_OK) {
2214 cd6: 89 2b or r24, r25 2403 d6e: 00 97 sbiw r24, 0x00 ; 0
2215 cd8: 09 f0 breq .+2 ; 0xcdc <f_sync+0x22> 2404 d70: 09 f0 breq .+2 ; 0xd74 <f_sync+0x22>
2216 cda: 40 c0 rjmp .+128 ; 0xd5c <f_sync+0xa2> 2405 d72: 40 c0 rjmp .+128 ; 0xdf4 <f_sync+0xa2>
2217 if (fp->flag & FA__WRITTEN) { /* Has the file been written? */ 2406 if (fp->flag & FA__WRITTEN) { /* Has the file been written? */
2218 cdc: 8a 81 ldd r24, Y+2 ; 0x02 2407 d74: 8a 81 ldd r24, Y+2 ; 0x02
2219 cde: 85 ff sbrs r24, 5 2408 d76: 85 ff sbrs r24, 5
2220 ce0: 3d c0 rjmp .+122 ; 0xd5c <f_sync+0xa2> 2409 d78: 3d c0 rjmp .+122 ; 0xdf4 <f_sync+0xa2>
2221 /* Update the directory entry */ 2410 /* Update the directory entry */
2222 if (!move_window(fp->dir_sect)) 2411 if (!move_window(fp->dir_sect))
2223 ce2: 6e 89 ldd r22, Y+22 ; 0x16 2412 d7a: 6e 89 ldd r22, Y+22 ; 0x16
2224 ce4: 7f 89 ldd r23, Y+23 ; 0x17 2413 d7c: 7f 89 ldd r23, Y+23 ; 0x17
2225 ce6: 88 8d ldd r24, Y+24 ; 0x18 2414 d7e: 88 8d ldd r24, Y+24 ; 0x18
2226 ce8: 99 8d ldd r25, Y+25 ; 0x19 2415 d80: 99 8d ldd r25, Y+25 ; 0x19
2227 cea: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 2416 d82: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
2228 cee: 88 23 and r24, r24 2417 d86: 88 23 and r24, r24
2229 cf0: 91 f1 breq .+100 ; 0xd56 <f_sync+0x9c> 2418 d88: 91 f1 breq .+100 ; 0xdee <f_sync+0x9c>
2230 return FR_RW_ERROR; 2419 return FR_RW_ERROR;
2231 dir = fp->dir_ptr; 2420 dir = fp->dir_ptr;
2232 cf2: 0a 8d ldd r16, Y+26 ; 0x1a 2421 d8a: 0a 8d ldd r16, Y+26 ; 0x1a
2233 cf4: 1b 8d ldd r17, Y+27 ; 0x1b 2422 d8c: 1b 8d ldd r17, Y+27 ; 0x1b
2234 dir[DIR_Attr] |= AM_ARC; /* Set archive bit */ 2423 dir[DIR_Attr] |= AM_ARC; /* Set archive bit */
2235 cf6: f8 01 movw r30, r16 2424 d8e: f8 01 movw r30, r16
2236 cf8: 83 85 ldd r24, Z+11 ; 0x0b 2425 d90: 83 85 ldd r24, Z+11 ; 0x0b
2237 cfa: 80 62 ori r24, 0x20 ; 32 2426 d92: 80 62 ori r24, 0x20 ; 32
2238 cfc: 83 87 std Z+11, r24 ; 0x0b 2427 d94: 83 87 std Z+11, r24 ; 0x0b
2239 ST_DWORD(&dir[DIR_FileSize], fp->fsize); /* Update file size */ 2428 ST_DWORD(&dir[DIR_FileSize], fp->fsize); /* Update file size */
2240 cfe: 8a 85 ldd r24, Y+10 ; 0x0a 2429 d96: 8a 85 ldd r24, Y+10 ; 0x0a
2241 d00: 9b 85 ldd r25, Y+11 ; 0x0b 2430 d98: 9b 85 ldd r25, Y+11 ; 0x0b
2242 d02: ac 85 ldd r26, Y+12 ; 0x0c 2431 d9a: ac 85 ldd r26, Y+12 ; 0x0c
2243 d04: bd 85 ldd r27, Y+13 ; 0x0d 2432 d9c: bd 85 ldd r27, Y+13 ; 0x0d
2244 d06: 84 8f std Z+28, r24 ; 0x1c 2433 d9e: 84 8f std Z+28, r24 ; 0x1c
2245 d08: 95 8f std Z+29, r25 ; 0x1d 2434 da0: 95 8f std Z+29, r25 ; 0x1d
2246 d0a: a6 8f std Z+30, r26 ; 0x1e 2435 da2: a6 8f std Z+30, r26 ; 0x1e
2247 d0c: b7 8f std Z+31, r27 ; 0x1f 2436 da4: b7 8f std Z+31, r27 ; 0x1f
2248 ST_WORD(&dir[DIR_FstClusLO], fp->org_clust); /* Update start cluster */ 2437 ST_WORD(&dir[DIR_FstClusLO], fp->org_clust); /* Update start cluster */
2249 d0e: 8e 85 ldd r24, Y+14 ; 0x0e 2438 da6: 8e 85 ldd r24, Y+14 ; 0x0e
2250 d10: 9f 85 ldd r25, Y+15 ; 0x0f 2439 da8: 9f 85 ldd r25, Y+15 ; 0x0f
2251 d12: 93 8f std Z+27, r25 ; 0x1b 2440 daa: 93 8f std Z+27, r25 ; 0x1b
2252 d14: 82 8f std Z+26, r24 ; 0x1a 2441 dac: 82 8f std Z+26, r24 ; 0x1a
2253 #if _FAT32 2442 #if _FAT32
2254 ST_WORD(&dir[DIR_FstClusHI], fp->org_clust >> 16); 2443 ST_WORD(&dir[DIR_FstClusHI], fp->org_clust >> 16);
2255 #endif 2444 #endif
2256 tim = get_fattime(); /* Updated time */ 2445 tim = get_fattime(); /* Updated time */
2257 d16: 0e 94 bb 00 call 0x176 ; 0x176 <get_fattime> 2446 dae: 0e 94 b0 00 call 0x160 ; 0x160 <get_fattime>
2258 ST_DWORD(&dir[DIR_WrtTime], tim); 2447 ST_DWORD(&dir[DIR_WrtTime], tim);
2259 d1a: f8 01 movw r30, r16 2448 db2: f8 01 movw r30, r16
2260 d1c: 66 8b std Z+22, r22 ; 0x16 2449 db4: 66 8b std Z+22, r22 ; 0x16
2261 d1e: 77 8b std Z+23, r23 ; 0x17 2450 db6: 77 8b std Z+23, r23 ; 0x17
2262 d20: 80 8f std Z+24, r24 ; 0x18 2451 db8: 80 8f std Z+24, r24 ; 0x18
2263 d22: 91 8f std Z+25, r25 ; 0x19 2452 dba: 91 8f std Z+25, r25 ; 0x19
2264 fp->flag &= ~FA__WRITTEN; 2453 fp->flag &= ~FA__WRITTEN;
2265 d24: 8a 81 ldd r24, Y+2 ; 0x02 2454 dbc: 8a 81 ldd r24, Y+2 ; 0x02
2266 d26: 8f 7d andi r24, 0xDF ; 223 2455 dbe: 8f 7d andi r24, 0xDF ; 223
2267 d28: 8a 83 std Y+2, r24 ; 0x02 2456 dc0: 8a 83 std Y+2, r24 ; 0x02
2268 FRESULT sync (void) /* FR_OK: successful, FR_RW_ERROR: failed */ 2457 FRESULT sync (void) /* FR_OK: successful, FR_RW_ERROR: failed */
2269 { 2458 {
2270 FATFS *fs = FatFs; 2459 FATFS *fs = FatFs;
2271   2460  
2272   2461  
2273 fs->winflag = 1; 2462 fs->winflag = 1;
2274 d2a: e0 91 0a 01 lds r30, 0x010A 2463 dc2: e0 91 10 01 lds r30, 0x0110
2275 d2e: f0 91 0b 01 lds r31, 0x010B 2464 dc6: f0 91 11 01 lds r31, 0x0111
2276 d32: 81 e0 ldi r24, 0x01 ; 1 2465 dca: 81 e0 ldi r24, 0x01 ; 1
2277 d34: 87 8f std Z+31, r24 ; 0x1f 2466 dcc: 87 8f std Z+31, r24 ; 0x1f
2278 if (!move_window(0)) return FR_RW_ERROR; 2467 if (!move_window(0)) return FR_RW_ERROR;
2279 d36: 60 e0 ldi r22, 0x00 ; 0 2468 dce: 60 e0 ldi r22, 0x00 ; 0
2280 d38: 70 e0 ldi r23, 0x00 ; 0 2469 dd0: 70 e0 ldi r23, 0x00 ; 0
2281 d3a: 80 e0 ldi r24, 0x00 ; 0 2470 dd2: 80 e0 ldi r24, 0x00 ; 0
2282 d3c: 90 e0 ldi r25, 0x00 ; 0 2471 dd4: 90 e0 ldi r25, 0x00 ; 0
2283 d3e: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 2472 dd6: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
2284 d42: 88 23 and r24, r24 2473 dda: 88 23 and r24, r24
2285 d44: 41 f0 breq .+16 ; 0xd56 <f_sync+0x9c> 2474 ddc: 41 f0 breq .+16 ; 0xdee <f_sync+0x9c>
2286 ST_DWORD(&fs->win[FSI_Nxt_Free], fs->last_clust); 2475 ST_DWORD(&fs->win[FSI_Nxt_Free], fs->last_clust);
2287 disk_write(0, fs->win, fs->fsi_sector, 1); 2476 disk_write(0, fs->win, fs->fsi_sector, 1);
2288 fs->fsi_flag = 0; 2477 fs->fsi_flag = 0;
2289 } 2478 }
2290 #endif 2479 #endif
2291 if (disk_ioctl(0, CTRL_SYNC, NULL) != RES_OK) return FR_RW_ERROR; 2480 if (disk_ioctl(0, CTRL_SYNC, NULL) != RES_OK) return FR_RW_ERROR;
2292 d46: 40 e0 ldi r20, 0x00 ; 0 2481 dde: 40 e0 ldi r20, 0x00 ; 0
2293 d48: 50 e0 ldi r21, 0x00 ; 0 2482 de0: 50 e0 ldi r21, 0x00 ; 0
2294 d4a: 63 e0 ldi r22, 0x03 ; 3 2483 de2: 63 e0 ldi r22, 0x03 ; 3
2295 d4c: 80 e0 ldi r24, 0x00 ; 0 2484 de4: 80 e0 ldi r24, 0x00 ; 0
2296 d4e: 0e 94 e8 0d call 0x1bd0 ; 0x1bd0 <disk_ioctl> 2485 de6: 0e 94 77 10 call 0x20ee ; 0x20ee <disk_ioctl>
2297 d52: 89 2b or r24, r25 2486 dea: 89 2b or r24, r25
2298 d54: 19 f0 breq .+6 ; 0xd5c <f_sync+0xa2> 2487 dec: 19 f0 breq .+6 ; 0xdf4 <f_sync+0xa2>
2299 d56: 98 e0 ldi r25, 0x08 ; 8 2488 dee: b8 e0 ldi r27, 0x08 ; 8
2300 d58: e9 2e mov r14, r25 2489 df0: eb 2e mov r14, r27
2301 d5a: f1 2c mov r15, r1 2490 df2: f1 2c mov r15, r1
2302 fp->flag &= ~FA__WRITTEN; 2491 fp->flag &= ~FA__WRITTEN;
2303 res = sync(); 2492 res = sync();
2304 } 2493 }
2305 } 2494 }
2306 return res; 2495 return res;
2307 } 2496 }
2308 d5c: c7 01 movw r24, r14 2497 df4: c7 01 movw r24, r14
2309 d5e: e6 e0 ldi r30, 0x06 ; 6 2498 df6: cd b7 in r28, 0x3d ; 61
2310 d60: cd b7 in r28, 0x3d ; 61 2499 df8: de b7 in r29, 0x3e ; 62
2311 d62: de b7 in r29, 0x3e ; 62 2500 dfa: e6 e0 ldi r30, 0x06 ; 6
2312 d64: 0c 94 52 11 jmp 0x22a4 ; 0x22a4 <__epilogue_restores__+0x18> 2501 dfc: 0c 94 ef 14 jmp 0x29de ; 0x29de <__epilogue_restores__+0x18>
2313   2502  
2314 00000d68 <f_close>: 2503 00000e00 <f_close>:
2315 /*-----------------------------------------------------------------------*/ 2504 /*-----------------------------------------------------------------------*/
2316   2505  
2317 FRESULT f_close ( 2506 FRESULT f_close (
2318 FIL *fp /* Pointer to the file object to be closed */ 2507 FIL *fp /* Pointer to the file object to be closed */
2319 ) 2508 )
2320 { 2509 {
2321 d68: cf 93 push r28 2510 e00: cf 93 push r28
2322 d6a: df 93 push r29 2511 e02: df 93 push r29
2323 d6c: ec 01 movw r28, r24 2512 e04: ec 01 movw r28, r24
2324 FRESULT res; 2513 FRESULT res;
2325   2514  
2326   2515  
2327 #if !_FS_READONLY 2516 #if !_FS_READONLY
2328 res = f_sync(fp); 2517 res = f_sync(fp);
2329 d6e: 0e 94 5d 06 call 0xcba ; 0xcba <f_sync> 2518 e06: 0e 94 a9 06 call 0xd52 ; 0xd52 <f_sync>
-   2519 e0a: 9c 01 movw r18, r24
2330 #else 2520 #else
2331 res = validate(fp->fs, fp->id); 2521 res = validate(fp->fs, fp->id);
2332 #endif 2522 #endif
2333 if (res == FR_OK) 2523 if (res == FR_OK)
2334 d72: 00 97 sbiw r24, 0x00 ; 0 2524 e0c: 00 97 sbiw r24, 0x00 ; 0
2335 d74: 11 f4 brne .+4 ; 0xd7a <f_close+0x12> 2525 e0e: 11 f4 brne .+4 ; 0xe14 <f_close+0x14>
2336 fp->fs = NULL; 2526 fp->fs = NULL;
2337 d76: 1d 82 std Y+5, r1 ; 0x05 2527 e10: 1d 82 std Y+5, r1 ; 0x05
2338 d78: 1c 82 std Y+4, r1 ; 0x04 2528 e12: 1c 82 std Y+4, r1 ; 0x04
2339 d7a: df 91 pop r29 -  
2340 d7c: cf 91 pop r28 -  
2341 d7e: 08 95 ret -  
2342   2529  
-   2530 return res;
-   2531 }
-   2532 e14: c9 01 movw r24, r18
-   2533 e16: df 91 pop r29
-   2534 e18: cf 91 pop r28
-   2535 e1a: 08 95 ret
-   2536  
2343 00000d80 <f_write>: 2537 00000e1c <f_write>:
2344 FIL *fp, /* Pointer to the file object */ 2538 FIL *fp, /* Pointer to the file object */
2345 const void *buff, /* Pointer to the data to be written */ 2539 const void *buff, /* Pointer to the data to be written */
2346 WORD btw, /* Number of bytes to write */ 2540 WORD btw, /* Number of bytes to write */
2347 WORD *bw /* Pointer to number of bytes written */ 2541 WORD *bw /* Pointer to number of bytes written */
2348 ) 2542 )
2349 { 2543 {
2350 d80: a0 e0 ldi r26, 0x00 ; 0 2544 e1c: a0 e0 ldi r26, 0x00 ; 0
2351 d82: b0 e0 ldi r27, 0x00 ; 0 2545 e1e: b0 e0 ldi r27, 0x00 ; 0
2352 d84: e6 ec ldi r30, 0xC6 ; 198 2546 e20: e4 e1 ldi r30, 0x14 ; 20
2353 d86: f6 e0 ldi r31, 0x06 ; 6 2547 e22: f7 e0 ldi r31, 0x07 ; 7
2354 d88: 0c 94 2c 11 jmp 0x2258 ; 0x2258 <__prologue_saves__+0x4> 2548 e24: 0c 94 c8 14 jmp 0x2990 ; 0x2990 <__prologue_saves__+0x2>
2355 d8c: ec 01 movw r28, r24 2549 e28: ec 01 movw r28, r24
-   2550 e2a: 16 2f mov r17, r22
2356 d8e: 8b 01 movw r16, r22 2551 e2c: 07 2f mov r16, r23
2357 d90: 7a 01 movw r14, r20 2552 e2e: 7a 01 movw r14, r20
2358 d92: 39 01 movw r6, r18 2553 e30: 39 01 movw r6, r18
2359 WORD wcnt; 2554 WORD wcnt;
2360 CLUST clust; 2555 CLUST clust;
2361 BYTE cc; 2556 BYTE cc;
2362 FRESULT res; 2557 FRESULT res;
2363 const BYTE *wbuff = buff; 2558 const BYTE *wbuff = buff;
2364 FATFS *fs = fp->fs; 2559 FATFS *fs = fp->fs;
2365 d94: cc 80 ldd r12, Y+4 ; 0x04 2560 e32: ac 80 ldd r10, Y+4 ; 0x04
2366 d96: dd 80 ldd r13, Y+5 ; 0x05 2561 e34: bd 80 ldd r11, Y+5 ; 0x05
2367   2562  
2368   2563  
2369 *bw = 0; 2564 *bw = 0;
2370 d98: f9 01 movw r30, r18 2565 e36: f9 01 movw r30, r18
2371 d9a: 11 82 std Z+1, r1 ; 0x01 2566 e38: 11 82 std Z+1, r1 ; 0x01
2372 d9c: 10 82 st Z, r1 2567 e3a: 10 82 st Z, r1
2373 res = validate(fs, fp->id); /* Check validity of the object */ 2568 res = validate(fs, fp->id); /* Check validity of the object */
2374 d9e: 68 81 ld r22, Y 2569 e3c: 68 81 ld r22, Y
2375 da0: 79 81 ldd r23, Y+1 ; 0x01 2570 e3e: 79 81 ldd r23, Y+1 ; 0x01
2376 da2: c6 01 movw r24, r12 2571 e40: c5 01 movw r24, r10
2377 da4: 0e 94 43 03 call 0x686 ; 0x686 <validate> 2572 e42: 0e 94 46 03 call 0x68c ; 0x68c <validate>
2378 da8: 4c 01 movw r8, r24 2573 e46: 4c 01 movw r8, r24
2379 if (res) return res; 2574 if (res) return res;
2380 daa: 89 2b or r24, r25 2575 e48: 00 97 sbiw r24, 0x00 ; 0
2381 dac: 09 f0 breq .+2 ; 0xdb0 <f_write+0x30> 2576 e4a: 09 f0 breq .+2 ; 0xe4e <f_write+0x32>
2382 dae: 1a c1 rjmp .+564 ; 0xfe4 <f_write+0x264> 2577 e4c: 3b c1 rjmp .+630 ; 0x10c4 <f_write+0x2a8>
2383 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */ 2578 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */
2384 db0: 8a 81 ldd r24, Y+2 ; 0x02 2579 e4e: 8a 81 ldd r24, Y+2 ; 0x02
2385 db2: 88 23 and r24, r24 2580 e50: 87 fd sbrc r24, 7
2386 db4: 0c f4 brge .+2 ; 0xdb8 <f_write+0x38> -  
2387 db6: 13 c1 rjmp .+550 ; 0xfde <f_write+0x25e> 2581 e52: 35 c1 rjmp .+618 ; 0x10be <f_write+0x2a2>
2388 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */ 2582 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */
2389 db8: 81 fd sbrc r24, 1 2583 e54: 81 fd sbrc r24, 1
2390 dba: 04 c0 rjmp .+8 ; 0xdc4 <f_write+0x44> 2584 e56: 04 c0 rjmp .+8 ; 0xe60 <f_write+0x44>
2391 dbc: e6 e0 ldi r30, 0x06 ; 6 2585 e58: 36 e0 ldi r19, 0x06 ; 6
2392 dbe: 8e 2e mov r8, r30 2586 e5a: 83 2e mov r8, r19
2393 dc0: 91 2c mov r9, r1 2587 e5c: 91 2c mov r9, r1
2394 dc2: 10 c1 rjmp .+544 ; 0xfe4 <f_write+0x264> 2588 e5e: 32 c1 rjmp .+612 ; 0x10c4 <f_write+0x2a8>
2395 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */ 2589 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */
2396 dc4: 2a 85 ldd r18, Y+10 ; 0x0a 2590 e60: 2a 85 ldd r18, Y+10 ; 0x0a
2397 dc6: 3b 85 ldd r19, Y+11 ; 0x0b 2591 e62: 3b 85 ldd r19, Y+11 ; 0x0b
2398 dc8: 4c 85 ldd r20, Y+12 ; 0x0c 2592 e64: 4c 85 ldd r20, Y+12 ; 0x0c
2399 dca: 5d 85 ldd r21, Y+13 ; 0x0d 2593 e66: 5d 85 ldd r21, Y+13 ; 0x0d
2400 dcc: c7 01 movw r24, r14 2594 e68: c7 01 movw r24, r14
2401 dce: aa 27 eor r26, r26 2595 e6a: a0 e0 ldi r26, 0x00 ; 0
2402 dd0: bb 27 eor r27, r27 2596 e6c: b0 e0 ldi r27, 0x00 ; 0
2403 dd2: 82 0f add r24, r18 2597 e6e: 82 0f add r24, r18
2404 dd4: 93 1f adc r25, r19 2598 e70: 93 1f adc r25, r19
2405 dd6: a4 1f adc r26, r20 2599 e72: a4 1f adc r26, r20
2406 dd8: b5 1f adc r27, r21 2600 e74: b5 1f adc r27, r21
2407 dda: 82 17 cp r24, r18 2601 e76: 82 17 cp r24, r18
2408 ddc: 93 07 cpc r25, r19 2602 e78: 93 07 cpc r25, r19
2409 dde: a4 07 cpc r26, r20 2603 e7a: a4 07 cpc r26, r20
2410 de0: b5 07 cpc r27, r21 2604 e7c: b5 07 cpc r27, r21
2411 de2: 08 f4 brcc .+2 ; 0xde6 <f_write+0x66> 2605 e7e: 08 f4 brcc .+2 ; 0xe82 <f_write+0x66>
2412 de4: ff c0 rjmp .+510 ; 0xfe4 <f_write+0x264> 2606 e80: 21 c1 rjmp .+578 ; 0x10c4 <f_write+0x2a8>
2413 DWORD sect; 2607 DWORD sect;
2414 WORD wcnt; 2608 WORD wcnt;
2415 CLUST clust; 2609 CLUST clust;
2416 BYTE cc; 2610 BYTE cc;
2417 FRESULT res; 2611 FRESULT res;
2418 const BYTE *wbuff = buff; 2612 const BYTE *wbuff = buff;
-   2613 e82: 81 2f mov r24, r17
-   2614 e84: 90 2f mov r25, r16
-   2615 e86: 9c 01 movw r18, r24
2419 de6: 58 01 movw r10, r16 2616 e88: 69 01 movw r12, r18
-   2617 fs->winsect = fp->curr_sect;
-   2618 }
2420 } 2619 }
2421 if (!move_window(fp->curr_sect)) /* Move sector window */ 2620 if (!move_window(fp->curr_sect)) /* Move sector window */
2422 goto fw_error; 2621 goto fw_error;
2423 wcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes bytes to sector window */ 2622 wcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes bytes to sector window */
-   2623 e8a: 41 2c mov r4, r1
-   2624 e8c: 22 e0 ldi r18, 0x02 ; 2
-   2625 e8e: 52 2e mov r5, r18
2424 if (wcnt > btw) wcnt = btw; 2626 if (wcnt > btw) wcnt = btw;
2425 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt); 2627 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt);
2426 de8: 70 e2 ldi r23, 0x20 ; 32 -  
2427 dea: 47 2e mov r4, r23 2628 fs->winflag = 1;
2428 dec: 51 2c mov r5, r1 2629 e90: 33 24 eor r3, r3
2429 dee: 4c 0c add r4, r12 -  
2430 df0: 5d 1c adc r5, r13 2630 e92: 33 94 inc r3
2431 df2: d9 c0 rjmp .+434 ; 0xfa6 <f_write+0x226> 2631 e94: f8 c0 rjmp .+496 ; 0x1086 <f_write+0x26a>
2432 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */ 2632 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */
2433 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */ 2633 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */
2434   2634  
2435 for ( ; btw; /* Repeat until all data transferred */ 2635 for ( ; btw; /* Repeat until all data transferred */
2436 wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) { 2636 wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
2437 if ((fp->fptr % 512) == 0) { /* On the sector boundary */ 2637 if ((fp->fptr % 512) == 0) { /* On the sector boundary */
2438 df4: 2e 81 ldd r18, Y+6 ; 0x06 2638 e96: 2e 81 ldd r18, Y+6 ; 0x06
2439 df6: 3f 81 ldd r19, Y+7 ; 0x07 2639 e98: 3f 81 ldd r19, Y+7 ; 0x07
2440 df8: 48 85 ldd r20, Y+8 ; 0x08 2640 e9a: 48 85 ldd r20, Y+8 ; 0x08
2441 dfa: 59 85 ldd r21, Y+9 ; 0x09 2641 e9c: 59 85 ldd r21, Y+9 ; 0x09
2442 dfc: da 01 movw r26, r20 2642 e9e: da 01 movw r26, r20
2443 dfe: c9 01 movw r24, r18 2643 ea0: c9 01 movw r24, r18
2444 e00: 91 70 andi r25, 0x01 ; 1 2644 ea2: 91 70 andi r25, 0x01 ; 1
2445 e02: a0 70 andi r26, 0x00 ; 0 2645 ea4: a0 70 andi r26, 0x00 ; 0
2446 e04: b0 70 andi r27, 0x00 ; 0 2646 ea6: b0 70 andi r27, 0x00 ; 0
2447 e06: 00 97 sbiw r24, 0x00 ; 0 2647 ea8: 00 97 sbiw r24, 0x00 ; 0
2448 e08: a1 05 cpc r26, r1 2648 eaa: a1 05 cpc r26, r1
2449 e0a: b1 05 cpc r27, r1 2649 eac: b1 05 cpc r27, r1
2450 e0c: 09 f0 breq .+2 ; 0xe10 <f_write+0x90> 2650 eae: 09 f0 breq .+2 ; 0xeb2 <f_write+0x96>
2451 e0e: 93 c0 rjmp .+294 ; 0xf36 <f_write+0x1b6> 2651 eb0: b1 c0 rjmp .+354 ; 0x1014 <f_write+0x1f8>
2452 if (--(fp->sect_clust)) { /* Decrement left sector counter */ 2652 if (--(fp->sect_clust)) { /* Decrement left sector counter */
2453 e10: 8b 81 ldd r24, Y+3 ; 0x03 2653 eb2: 8b 81 ldd r24, Y+3 ; 0x03
2454 e12: 81 50 subi r24, 0x01 ; 1 2654 eb4: 81 50 subi r24, 0x01 ; 1
2455 e14: 8b 83 std Y+3, r24 ; 0x03 2655 eb6: 8b 83 std Y+3, r24 ; 0x03
2456 e16: 88 23 and r24, r24 2656 eb8: 88 23 and r24, r24
2457 e18: 49 f0 breq .+18 ; 0xe2c <f_write+0xac> 2657 eba: 49 f0 breq .+18 ; 0xece <f_write+0xb2>
2458 sect = fp->curr_sect + 1; /* Get current sector */ 2658 sect = fp->curr_sect + 1; /* Get current sector */
2459 e1a: 2a 89 ldd r18, Y+18 ; 0x12 2659 ebc: 2a 89 ldd r18, Y+18 ; 0x12
2460 e1c: 3b 89 ldd r19, Y+19 ; 0x13 2660 ebe: 3b 89 ldd r19, Y+19 ; 0x13
2461 e1e: 4c 89 ldd r20, Y+20 ; 0x14 2661 ec0: 4c 89 ldd r20, Y+20 ; 0x14
2462 e20: 5d 89 ldd r21, Y+21 ; 0x15 2662 ec2: 5d 89 ldd r21, Y+21 ; 0x15
2463 e22: 2f 5f subi r18, 0xFF ; 255 2663 ec4: 2f 5f subi r18, 0xFF ; 255
2464 e24: 3f 4f sbci r19, 0xFF ; 255 2664 ec6: 3f 4f sbci r19, 0xFF ; 255
2465 e26: 4f 4f sbci r20, 0xFF ; 255 2665 ec8: 4f 4f sbci r20, 0xFF ; 255
2466 e28: 5f 4f sbci r21, 0xFF ; 255 2666 eca: 5f 4f sbci r21, 0xFF ; 255
2467 e2a: 30 c0 rjmp .+96 ; 0xe8c <f_write+0x10c> 2667 ecc: 51 c0 rjmp .+162 ; 0xf70 <f_write+0x154>
2468 } else { /* On the cluster boundary, get next cluster */ 2668 } else { /* On the cluster boundary, get next cluster */
2469 if (fp->fptr == 0) { /* Is top of the file */ 2669 if (fp->fptr == 0) { /* Is top of the file */
2470 e2c: 21 15 cp r18, r1 2670 ece: 21 15 cp r18, r1
2471 e2e: 31 05 cpc r19, r1 2671 ed0: 31 05 cpc r19, r1
2472 e30: 41 05 cpc r20, r1 2672 ed2: 41 05 cpc r20, r1
2473 e32: 51 05 cpc r21, r1 2673 ed4: 51 05 cpc r21, r1
2474 e34: 69 f4 brne .+26 ; 0xe50 <f_write+0xd0> 2674 ed6: 69 f4 brne .+26 ; 0xef2 <f_write+0xd6>
2475 clust = fp->org_clust; 2675 clust = fp->org_clust;
2476 e36: 2e 85 ldd r18, Y+14 ; 0x0e 2676 ed8: 6e 85 ldd r22, Y+14 ; 0x0e
2477 e38: 3f 85 ldd r19, Y+15 ; 0x0f 2677 eda: 7f 85 ldd r23, Y+15 ; 0x0f
2478 if (clust == 0) /* No cluster is created yet */ 2678 if (clust == 0) /* No cluster is created yet */
2479 e3a: 21 15 cp r18, r1 2679 edc: 61 15 cp r22, r1
2480 e3c: 31 05 cpc r19, r1 2680 ede: 71 05 cpc r23, r1
2481 e3e: 89 f4 brne .+34 ; 0xe62 <f_write+0xe2> 2681 ee0: 89 f4 brne .+34 ; 0xf04 <f_write+0xe8>
2482 fp->org_clust = clust = create_chain(0); /* Create a new cluster chain */ 2682 fp->org_clust = clust = create_chain(0); /* Create a new cluster chain */
2483 e40: 80 e0 ldi r24, 0x00 ; 0 2683 ee2: 80 e0 ldi r24, 0x00 ; 0
2484 e42: 90 e0 ldi r25, 0x00 ; 0 2684 ee4: 90 e0 ldi r25, 0x00 ; 0
2485 e44: 0e 94 25 05 call 0xa4a ; 0xa4a <create_chain> 2685 ee6: 0e 94 d1 04 call 0x9a2 ; 0x9a2 <create_chain>
2486 e48: 9c 01 movw r18, r24 2686 eea: bc 01 movw r22, r24
2487 e4a: 9f 87 std Y+15, r25 ; 0x0f 2687 eec: 9f 87 std Y+15, r25 ; 0x0f
2488 e4c: 8e 87 std Y+14, r24 ; 0x0e 2688 eee: 8e 87 std Y+14, r24 ; 0x0e
2489 e4e: 05 c0 rjmp .+10 ; 0xe5a <f_write+0xda> 2689 ef0: 05 c0 rjmp .+10 ; 0xefc <f_write+0xe0>
2490 } else { /* Middle or end of file */ 2690 } else { /* Middle or end of file */
2491 clust = create_chain(fp->curr_clust); /* Trace or streach cluster chain */ 2691 clust = create_chain(fp->curr_clust); /* Trace or streach cluster chain */
2492 e50: 88 89 ldd r24, Y+16 ; 0x10 2692 ef2: 88 89 ldd r24, Y+16 ; 0x10
2493 e52: 99 89 ldd r25, Y+17 ; 0x11 2693 ef4: 99 89 ldd r25, Y+17 ; 0x11
2494 e54: 0e 94 25 05 call 0xa4a ; 0xa4a <create_chain> 2694 ef6: 0e 94 d1 04 call 0x9a2 ; 0x9a2 <create_chain>
-   2695 efa: bc 01 movw r22, r24
-   2696 }
-   2697 if (clust == 0) break; /* Disk full */
-   2698 efc: 61 15 cp r22, r1
-   2699 efe: 71 05 cpc r23, r1
-   2700 f00: 09 f4 brne .+2 ; 0xf04 <f_write+0xe8>
-   2701 f02: c5 c0 rjmp .+394 ; 0x108e <f_write+0x272>
-   2702 if (clust == 1 || clust >= fs->max_clust) goto fw_error;
-   2703 f04: 61 30 cpi r22, 0x01 ; 1
-   2704 f06: 71 05 cpc r23, r1
-   2705 f08: 09 f4 brne .+2 ; 0xf0c <f_write+0xf0>
-   2706 f0a: d6 c0 rjmp .+428 ; 0x10b8 <f_write+0x29c>
-   2707 f0c: f5 01 movw r30, r10
-   2708 f0e: 86 89 ldd r24, Z+22 ; 0x16
-   2709 f10: 97 89 ldd r25, Z+23 ; 0x17
-   2710 f12: 68 17 cp r22, r24
-   2711 f14: 79 07 cpc r23, r25
-   2712 f16: 08 f0 brcs .+2 ; 0xf1a <f_write+0xfe>
-   2713 f18: cf c0 rjmp .+414 ; 0x10b8 <f_write+0x29c>
-   2714 fp->curr_clust = clust; /* Current cluster */
-   2715 f1a: 79 8b std Y+17, r23 ; 0x11
-   2716 f1c: 68 8b std Y+16, r22 ; 0x10
-   2717 static
-   2718 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   2719 CLUST clust /* Cluster# to be converted */
-   2720 )
-   2721 {
-   2722 FATFS *fs = FatFs;
-   2723 f1e: 00 91 10 01 lds r16, 0x0110
-   2724 f22: 10 91 11 01 lds r17, 0x0111
-   2725  
-   2726  
-   2727 clust -= 2;
-   2728 f26: 62 50 subi r22, 0x02 ; 2
-   2729 f28: 70 40 sbci r23, 0x00 ; 0
-   2730 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   2731 f2a: f8 01 movw r30, r16
-   2732 f2c: 86 89 ldd r24, Z+22 ; 0x16
-   2733 f2e: 97 89 ldd r25, Z+23 ; 0x17
-   2734 f30: 02 97 sbiw r24, 0x02 ; 2
-   2735 f32: 68 17 cp r22, r24
-   2736 f34: 79 07 cpc r23, r25
-   2737 f36: 28 f0 brcs .+10 ; 0xf42 <f_write+0x126>
-   2738 f38: 20 e0 ldi r18, 0x00 ; 0
-   2739 f3a: 30 e0 ldi r19, 0x00 ; 0
-   2740 f3c: 40 e0 ldi r20, 0x00 ; 0
-   2741 f3e: 50 e0 ldi r21, 0x00 ; 0
-   2742 f40: 14 c0 rjmp .+40 ; 0xf6a <f_write+0x14e>
-   2743 return (DWORD)clust * fs->sects_clust + fs->database;
-   2744 f42: 80 e0 ldi r24, 0x00 ; 0
-   2745 f44: 90 e0 ldi r25, 0x00 ; 0
-   2746 f46: f8 01 movw r30, r16
-   2747 f48: 25 8d ldd r18, Z+29 ; 0x1d
-   2748 f4a: 30 e0 ldi r19, 0x00 ; 0
-   2749 f4c: 40 e0 ldi r20, 0x00 ; 0
-   2750 f4e: 50 e0 ldi r21, 0x00 ; 0
-   2751 f50: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
2495 e58: 9c 01 movw r18, r24 2752 f54: 9b 01 movw r18, r22
-   2753 f56: ac 01 movw r20, r24
-   2754 f58: f8 01 movw r30, r16
-   2755 f5a: 80 89 ldd r24, Z+16 ; 0x10
-   2756 f5c: 91 89 ldd r25, Z+17 ; 0x11
-   2757 f5e: a2 89 ldd r26, Z+18 ; 0x12
-   2758 f60: b3 89 ldd r27, Z+19 ; 0x13
-   2759 f62: 28 0f add r18, r24
-   2760 f64: 39 1f adc r19, r25
-   2761 f66: 4a 1f adc r20, r26
-   2762 f68: 5b 1f adc r21, r27
2496 } 2763 }
2497 if (clust == 0) break; /* Disk full */ 2764 if (clust == 0) break; /* Disk full */
2498 e5a: 21 15 cp r18, r1 -  
2499 e5c: 31 05 cpc r19, r1 -  
2500 e5e: 09 f4 brne .+2 ; 0xe62 <f_write+0xe2> -  
2501 e60: a6 c0 rjmp .+332 ; 0xfae <f_write+0x22e> -  
2502 if (clust == 1 || clust >= fs->max_clust) goto fw_error; 2765 if (clust == 1 || clust >= fs->max_clust) goto fw_error;
2503 e62: 21 30 cpi r18, 0x01 ; 1 -  
2504 e64: 31 05 cpc r19, r1 -  
2505 e66: 09 f4 brne .+2 ; 0xe6a <f_write+0xea> -  
2506 e68: b7 c0 rjmp .+366 ; 0xfd8 <f_write+0x258> -  
2507 e6a: f6 01 movw r30, r12 -  
2508 e6c: 86 89 ldd r24, Z+22 ; 0x16 -  
2509 e6e: 97 89 ldd r25, Z+23 ; 0x17 -  
2510 e70: 28 17 cp r18, r24 -  
2511 e72: 39 07 cpc r19, r25 -  
2512 e74: 08 f0 brcs .+2 ; 0xe78 <f_write+0xf8> -  
2513 e76: b0 c0 rjmp .+352 ; 0xfd8 <f_write+0x258> -  
2514 fp->curr_clust = clust; /* Current cluster */ 2766 fp->curr_clust = clust; /* Current cluster */
2515 e78: 39 8b std Y+17, r19 ; 0x11 -  
2516 e7a: 28 8b std Y+16, r18 ; 0x10 -  
2517 sect = clust2sect(clust); /* Get current sector */ 2767 sect = clust2sect(clust); /* Get current sector */
2518 e7c: c9 01 movw r24, r18 -  
2519 e7e: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
2520 e82: 9b 01 movw r18, r22 -  
2521 e84: ac 01 movw r20, r24 -  
2522 fp->sect_clust = fs->sects_clust; /* Re-initialize the left sector counter */ 2768 fp->sect_clust = fs->sects_clust; /* Re-initialize the left sector counter */
2523 e86: f6 01 movw r30, r12 2769 f6a: f5 01 movw r30, r10
2524 e88: 85 8d ldd r24, Z+29 ; 0x1d 2770 f6c: 85 8d ldd r24, Z+29 ; 0x1d
2525 e8a: 8b 83 std Y+3, r24 ; 0x03 2771 f6e: 8b 83 std Y+3, r24 ; 0x03
2526 } 2772 }
2527 fp->curr_sect = sect; /* Update current sector */ 2773 fp->curr_sect = sect; /* Update current sector */
2528 e8c: 2a 8b std Y+18, r18 ; 0x12 2774 f70: 2a 8b std Y+18, r18 ; 0x12
2529 e8e: 3b 8b std Y+19, r19 ; 0x13 2775 f72: 3b 8b std Y+19, r19 ; 0x13
2530 e90: 4c 8b std Y+20, r20 ; 0x14 2776 f74: 4c 8b std Y+20, r20 ; 0x14
2531 e92: 5d 8b std Y+21, r21 ; 0x15 2777 f76: 5d 8b std Y+21, r21 ; 0x15
2532 cc = btw / 512; /* When left bytes >= 512, */ 2778 cc = btw / 512; /* When left bytes >= 512, */
2533 e94: 87 01 movw r16, r14 -  
2534 e96: 01 2f mov r16, r17 2779 f78: 0f 2d mov r16, r15
2535 e98: 11 27 eor r17, r17 -  
2536 e9a: 06 95 lsr r16 2780 f7a: 06 95 lsr r16
2537 if (cc) { /* Write maximum contiguous sectors directly */ 2781 if (cc) { /* Write maximum contiguous sectors directly */
2538 e9c: 00 23 and r16, r16 -  
2539 e9e: 61 f1 breq .+88 ; 0xef8 <f_write+0x178> 2782 f7c: 61 f1 breq .+88 ; 0xfd6 <f_write+0x1ba>
2540 ea0: 8b 81 ldd r24, Y+3 ; 0x03 2783 f7e: 6b 81 ldd r22, Y+3 ; 0x03
2541 ea2: 10 2f mov r17, r16 2784 f80: 10 2f mov r17, r16
2542 ea4: 80 17 cp r24, r16 2785 f82: 60 17 cp r22, r16
2543 ea6: 08 f4 brcc .+2 ; 0xeaa <f_write+0x12a> 2786 f84: 08 f4 brcc .+2 ; 0xf88 <f_write+0x16c>
2544 ea8: 18 2f mov r17, r24 2787 f86: 16 2f mov r17, r22
2545 if (cc > fp->sect_clust) cc = fp->sect_clust; 2788 if (cc > fp->sect_clust) cc = fp->sect_clust;
2546 if (disk_write(0, wbuff, sect, cc) != RES_OK) 2789 if (disk_write(0, wbuff, sect, cc) != RES_OK)
2547 eaa: 01 2f mov r16, r17 2790 f88: 01 2f mov r16, r17
2548 eac: b5 01 movw r22, r10 2791 f8a: b6 01 movw r22, r12
2549 eae: 80 e0 ldi r24, 0x00 ; 0 2792 f8c: 80 e0 ldi r24, 0x00 ; 0
2550 eb0: 0e 94 d3 0e call 0x1da6 ; 0x1da6 <disk_write> 2793 f8e: 0e 94 fb 0f call 0x1ff6 ; 0x1ff6 <disk_write>
2551 eb4: 89 2b or r24, r25 2794 f92: 89 2b or r24, r25
2552 eb6: 09 f0 breq .+2 ; 0xeba <f_write+0x13a> 2795 f94: 09 f0 breq .+2 ; 0xf98 <f_write+0x17c>
2553 eb8: 8f c0 rjmp .+286 ; 0xfd8 <f_write+0x258> 2796 f96: 90 c0 rjmp .+288 ; 0x10b8 <f_write+0x29c>
2554 goto fw_error; 2797 goto fw_error;
2555 fp->sect_clust -= cc - 1; 2798 fp->sect_clust -= cc - 1;
2556 eba: 8b 81 ldd r24, Y+3 ; 0x03 2799 f98: 8b 81 ldd r24, Y+3 ; 0x03
2557 ebc: 8f 5f subi r24, 0xFF ; 255 2800 f9a: 8f 5f subi r24, 0xFF ; 255
2558 ebe: 81 1b sub r24, r17 2801 f9c: 81 1b sub r24, r17
2559 ec0: 8b 83 std Y+3, r24 ; 0x03 2802 f9e: 8b 83 std Y+3, r24 ; 0x03
2560 fp->curr_sect += cc - 1; 2803 fp->curr_sect += cc - 1;
2561 ec2: 81 2f mov r24, r17 2804 fa0: 81 2f mov r24, r17
2562 ec4: 99 27 eor r25, r25 2805 fa2: 90 e0 ldi r25, 0x00 ; 0
2563 ec6: 01 97 sbiw r24, 0x01 ; 1 2806 fa4: 01 97 sbiw r24, 0x01 ; 1
2564 ec8: 9c 01 movw r18, r24 2807 fa6: 9c 01 movw r18, r24
2565 eca: 44 27 eor r20, r20 2808 fa8: 44 27 eor r20, r20
2566 ecc: 37 fd sbrc r19, 7 2809 faa: 37 fd sbrc r19, 7
2567 ece: 40 95 com r20 2810 fac: 40 95 com r20
2568 ed0: 54 2f mov r21, r20 2811 fae: 54 2f mov r21, r20
2569 ed2: 8c 01 movw r16, r24 2812 fb0: 8c 01 movw r16, r24
2570 ed4: 0f 5f subi r16, 0xFF ; 255 2813 fb2: 0f 5f subi r16, 0xFF ; 255
2571 ed6: 1f 4f sbci r17, 0xFF ; 255 2814 fb4: 1f 4f sbci r17, 0xFF ; 255
2572 ed8: 8a 89 ldd r24, Y+18 ; 0x12 2815 fb6: 8a 89 ldd r24, Y+18 ; 0x12
2573 eda: 9b 89 ldd r25, Y+19 ; 0x13 2816 fb8: 9b 89 ldd r25, Y+19 ; 0x13
2574 edc: ac 89 ldd r26, Y+20 ; 0x14 2817 fba: ac 89 ldd r26, Y+20 ; 0x14
2575 ede: bd 89 ldd r27, Y+21 ; 0x15 2818 fbc: bd 89 ldd r27, Y+21 ; 0x15
2576 ee0: 82 0f add r24, r18 2819 fbe: 82 0f add r24, r18
2577 ee2: 93 1f adc r25, r19 2820 fc0: 93 1f adc r25, r19
2578 ee4: a4 1f adc r26, r20 2821 fc2: a4 1f adc r26, r20
2579 ee6: b5 1f adc r27, r21 2822 fc4: b5 1f adc r27, r21
2580 ee8: 8a 8b std Y+18, r24 ; 0x12 2823 fc6: 8a 8b std Y+18, r24 ; 0x12
2581 eea: 9b 8b std Y+19, r25 ; 0x13 2824 fc8: 9b 8b std Y+19, r25 ; 0x13
2582 eec: ac 8b std Y+20, r26 ; 0x14 2825 fca: ac 8b std Y+20, r26 ; 0x14
2583 eee: bd 8b std Y+21, r27 ; 0x15 2826 fcc: bd 8b std Y+21, r27 ; 0x15
2584 wcnt = cc * 512; continue; 2827 wcnt = cc * 512; continue;
2585 ef0: 10 2f mov r17, r16 2828 fce: 10 2f mov r17, r16
2586 ef2: 00 27 eor r16, r16 2829 fd0: 00 27 eor r16, r16
2587 ef4: 11 0f add r17, r17 2830 fd2: 11 0f add r17, r17
2588 ef6: 3d c0 rjmp .+122 ; 0xf72 <f_write+0x1f2> 2831 fd4: 3e c0 rjmp .+124 ; 0x1052 <f_write+0x236>
2589 } 2832 }
2590 if (fp->fptr >= fp->fsize) { /* Flush R/W window if needed */ 2833 if (fp->fptr >= fp->fsize) { /* Flush R/W window if needed */
2591 ef8: 2e 81 ldd r18, Y+6 ; 0x06 2834 fd6: 2e 81 ldd r18, Y+6 ; 0x06
2592 efa: 3f 81 ldd r19, Y+7 ; 0x07 2835 fd8: 3f 81 ldd r19, Y+7 ; 0x07
2593 efc: 48 85 ldd r20, Y+8 ; 0x08 2836 fda: 48 85 ldd r20, Y+8 ; 0x08
2594 efe: 59 85 ldd r21, Y+9 ; 0x09 2837 fdc: 59 85 ldd r21, Y+9 ; 0x09
2595 f00: 8a 85 ldd r24, Y+10 ; 0x0a 2838 fde: 8a 85 ldd r24, Y+10 ; 0x0a
2596 f02: 9b 85 ldd r25, Y+11 ; 0x0b 2839 fe0: 9b 85 ldd r25, Y+11 ; 0x0b
2597 f04: ac 85 ldd r26, Y+12 ; 0x0c 2840 fe2: ac 85 ldd r26, Y+12 ; 0x0c
2598 f06: bd 85 ldd r27, Y+13 ; 0x0d 2841 fe4: bd 85 ldd r27, Y+13 ; 0x0d
2599 f08: 28 17 cp r18, r24 2842 fe6: 28 17 cp r18, r24
2600 f0a: 39 07 cpc r19, r25 2843 fe8: 39 07 cpc r19, r25
2601 f0c: 4a 07 cpc r20, r26 2844 fea: 4a 07 cpc r20, r26
2602 f0e: 5b 07 cpc r21, r27 2845 fec: 5b 07 cpc r21, r27
2603 f10: 90 f0 brcs .+36 ; 0xf36 <f_write+0x1b6> 2846 fee: 90 f0 brcs .+36 ; 0x1014 <f_write+0x1f8>
2604 if (!move_window(0)) goto fw_error; 2847 if (!move_window(0)) goto fw_error;
2605 f12: 60 e0 ldi r22, 0x00 ; 0 2848 ff0: 60 e0 ldi r22, 0x00 ; 0
2606 f14: 70 e0 ldi r23, 0x00 ; 0 2849 ff2: 70 e0 ldi r23, 0x00 ; 0
2607 f16: 80 e0 ldi r24, 0x00 ; 0 2850 ff4: 80 e0 ldi r24, 0x00 ; 0
2608 f18: 90 e0 ldi r25, 0x00 ; 0 2851 ff6: 90 e0 ldi r25, 0x00 ; 0
2609 f1a: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 2852 ff8: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
2610 f1e: 88 23 and r24, r24 2853 ffc: 88 23 and r24, r24
2611 f20: 09 f4 brne .+2 ; 0xf24 <f_write+0x1a4> 2854 ffe: 09 f4 brne .+2 ; 0x1002 <f_write+0x1e6>
2612 f22: 5a c0 rjmp .+180 ; 0xfd8 <f_write+0x258> 2855 1000: 5b c0 rjmp .+182 ; 0x10b8 <f_write+0x29c>
2613 fs->winsect = fp->curr_sect; 2856 fs->winsect = fp->curr_sect;
2614 f24: 8a 89 ldd r24, Y+18 ; 0x12 2857 1002: 8a 89 ldd r24, Y+18 ; 0x12
2615 f26: 9b 89 ldd r25, Y+19 ; 0x13 2858 1004: 9b 89 ldd r25, Y+19 ; 0x13
2616 f28: ac 89 ldd r26, Y+20 ; 0x14 2859 1006: ac 89 ldd r26, Y+20 ; 0x14
2617 f2a: bd 89 ldd r27, Y+21 ; 0x15 2860 1008: bd 89 ldd r27, Y+21 ; 0x15
2618 f2c: f6 01 movw r30, r12 2861 100a: f5 01 movw r30, r10
2619 f2e: 84 83 std Z+4, r24 ; 0x04 2862 100c: 84 83 std Z+4, r24 ; 0x04
2620 f30: 95 83 std Z+5, r25 ; 0x05 2863 100e: 95 83 std Z+5, r25 ; 0x05
2621 f32: a6 83 std Z+6, r26 ; 0x06 2864 1010: a6 83 std Z+6, r26 ; 0x06
2622 f34: b7 83 std Z+7, r27 ; 0x07 2865 1012: b7 83 std Z+7, r27 ; 0x07
2623 } 2866 }
2624 } 2867 }
2625 if (!move_window(fp->curr_sect)) /* Move sector window */ 2868 if (!move_window(fp->curr_sect)) /* Move sector window */
2626 f36: 6a 89 ldd r22, Y+18 ; 0x12 2869 1014: 6a 89 ldd r22, Y+18 ; 0x12
2627 f38: 7b 89 ldd r23, Y+19 ; 0x13 2870 1016: 7b 89 ldd r23, Y+19 ; 0x13
2628 f3a: 8c 89 ldd r24, Y+20 ; 0x14 2871 1018: 8c 89 ldd r24, Y+20 ; 0x14
2629 f3c: 9d 89 ldd r25, Y+21 ; 0x15 2872 101a: 9d 89 ldd r25, Y+21 ; 0x15
2630 f3e: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 2873 101c: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
2631 f42: 88 23 and r24, r24 2874 1020: 88 23 and r24, r24
2632 f44: 09 f4 brne .+2 ; 0xf48 <f_write+0x1c8> 2875 1022: 09 f4 brne .+2 ; 0x1026 <f_write+0x20a>
2633 f46: 48 c0 rjmp .+144 ; 0xfd8 <f_write+0x258> 2876 1024: 49 c0 rjmp .+146 ; 0x10b8 <f_write+0x29c>
2634 goto fw_error; 2877 goto fw_error;
2635 wcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes bytes to sector window */ 2878 wcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes bytes to sector window */
2636 f48: 8e 81 ldd r24, Y+6 ; 0x06 2879 1026: 2e 81 ldd r18, Y+6 ; 0x06
2637 f4a: 9f 81 ldd r25, Y+7 ; 0x07 2880 1028: 3f 81 ldd r19, Y+7 ; 0x07
2638 f4c: 91 70 andi r25, 0x01 ; 1 2881 102a: 31 70 andi r19, 0x01 ; 1
2639 f4e: 20 e0 ldi r18, 0x00 ; 0 -  
2640 f50: 32 e0 ldi r19, 0x02 ; 2 2882 102c: c2 01 movw r24, r4
2641 f52: 28 1b sub r18, r24 2883 102e: 82 1b sub r24, r18
2642 f54: 39 0b sbc r19, r25 2884 1030: 93 0b sbc r25, r19
2643 f56: 87 01 movw r16, r14 2885 1032: 87 01 movw r16, r14
2644 f58: 2e 15 cp r18, r14 2886 1034: 8e 15 cp r24, r14
2645 f5a: 3f 05 cpc r19, r15 2887 1036: 9f 05 cpc r25, r15
2646 f5c: 08 f4 brcc .+2 ; 0xf60 <f_write+0x1e0> 2888 1038: 08 f4 brcc .+2 ; 0x103c <f_write+0x220>
2647 f5e: 89 01 movw r16, r18 2889 103a: 8c 01 movw r16, r24
2648 if (wcnt > btw) wcnt = btw; 2890 if (wcnt > btw) wcnt = btw;
2649 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt); 2891 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt);
-   2892 103c: 20 5e subi r18, 0xE0 ; 224
-   2893 103e: 3f 4f sbci r19, 0xFF ; 255
2650 f60: a8 01 movw r20, r16 2894 1040: 2a 0d add r18, r10
-   2895 1042: 3b 1d adc r19, r11
2651 f62: b5 01 movw r22, r10 2896 1044: a8 01 movw r20, r16
2652 f64: 84 0d add r24, r4 2897 1046: b6 01 movw r22, r12
2653 f66: 95 1d adc r25, r5 2898 1048: c9 01 movw r24, r18
2654 f68: 0e 94 a1 10 call 0x2142 ; 0x2142 <memcpy> 2899 104a: 0e 94 a3 11 call 0x2346 ; 0x2346 <memcpy>
2655 fs->winflag = 1; 2900 fs->winflag = 1;
2656 f6c: 81 e0 ldi r24, 0x01 ; 1 -  
2657 f6e: f6 01 movw r30, r12 2901 104e: f5 01 movw r30, r10
2658 f70: 87 8f std Z+31, r24 ; 0x1f 2902 1050: 37 8e std Z+31, r3 ; 0x1f
2659 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */ 2903 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */
2660 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */ 2904 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */
2661 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */ 2905 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */
2662   2906  
2663 for ( ; btw; /* Repeat until all data transferred */ 2907 for ( ; btw; /* Repeat until all data transferred */
2664 wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) { 2908 wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
2665 f72: a0 0e add r10, r16 2909 1052: c0 0e add r12, r16
2666 f74: b1 1e adc r11, r17 2910 1054: d1 1e adc r13, r17
2667 f76: c8 01 movw r24, r16 2911 1056: c8 01 movw r24, r16
2668 f78: aa 27 eor r26, r26 2912 1058: a0 e0 ldi r26, 0x00 ; 0
2669 f7a: bb 27 eor r27, r27 2913 105a: b0 e0 ldi r27, 0x00 ; 0
2670 f7c: 2e 81 ldd r18, Y+6 ; 0x06 2914 105c: 2e 81 ldd r18, Y+6 ; 0x06
2671 f7e: 3f 81 ldd r19, Y+7 ; 0x07 2915 105e: 3f 81 ldd r19, Y+7 ; 0x07
2672 f80: 48 85 ldd r20, Y+8 ; 0x08 2916 1060: 48 85 ldd r20, Y+8 ; 0x08
2673 f82: 59 85 ldd r21, Y+9 ; 0x09 2917 1062: 59 85 ldd r21, Y+9 ; 0x09
2674 f84: 28 0f add r18, r24 2918 1064: 28 0f add r18, r24
2675 f86: 39 1f adc r19, r25 2919 1066: 39 1f adc r19, r25
2676 f88: 4a 1f adc r20, r26 2920 1068: 4a 1f adc r20, r26
2677 f8a: 5b 1f adc r21, r27 2921 106a: 5b 1f adc r21, r27
2678 f8c: 2e 83 std Y+6, r18 ; 0x06 2922 106c: 2e 83 std Y+6, r18 ; 0x06
2679 f8e: 3f 83 std Y+7, r19 ; 0x07 2923 106e: 3f 83 std Y+7, r19 ; 0x07
2680 f90: 48 87 std Y+8, r20 ; 0x08 2924 1070: 48 87 std Y+8, r20 ; 0x08
2681 f92: 59 87 std Y+9, r21 ; 0x09 2925 1072: 59 87 std Y+9, r21 ; 0x09
2682 f94: f3 01 movw r30, r6 2926 1074: f3 01 movw r30, r6
2683 f96: 80 81 ld r24, Z 2927 1076: 80 81 ld r24, Z
2684 f98: 91 81 ldd r25, Z+1 ; 0x01 2928 1078: 91 81 ldd r25, Z+1 ; 0x01
2685 f9a: 80 0f add r24, r16 2929 107a: 80 0f add r24, r16
2686 f9c: 91 1f adc r25, r17 2930 107c: 91 1f adc r25, r17
2687 f9e: 91 83 std Z+1, r25 ; 0x01 2931 107e: 91 83 std Z+1, r25 ; 0x01
2688 fa0: 80 83 st Z, r24 2932 1080: 80 83 st Z, r24
2689 fa2: e0 1a sub r14, r16 2933 1082: e0 1a sub r14, r16
2690 fa4: f1 0a sbc r15, r17 2934 1084: f1 0a sbc r15, r17
2691 if (res) return res; 2935 if (res) return res;
2692 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */ 2936 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */
2693 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */ 2937 if (!(fp->flag & FA_WRITE)) return FR_DENIED; /* Check access mode */
2694 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */ 2938 if (fp->fsize + btw < fp->fsize) return FR_OK; /* File size cannot reach 4GB */
2695   2939  
2696 for ( ; btw; /* Repeat until all data transferred */ 2940 for ( ; btw; /* Repeat until all data transferred */
2697 fa6: e1 14 cp r14, r1 2941 1086: e1 14 cp r14, r1
2698 fa8: f1 04 cpc r15, r1 2942 1088: f1 04 cpc r15, r1
2699 faa: 09 f0 breq .+2 ; 0xfae <f_write+0x22e> 2943 108a: 09 f0 breq .+2 ; 0x108e <f_write+0x272>
2700 fac: 23 cf rjmp .-442 ; 0xdf4 <f_write+0x74> 2944 108c: 04 cf rjmp .-504 ; 0xe96 <f_write+0x7a>
2701 if (wcnt > btw) wcnt = btw; 2945 if (wcnt > btw) wcnt = btw;
2702 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt); 2946 memcpy(&fs->win[(WORD)fp->fptr % 512], wbuff, wcnt);
2703 fs->winflag = 1; 2947 fs->winflag = 1;
2704 } 2948 }
2705   2949  
2706 if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */ 2950 if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */
2707 fae: 2e 81 ldd r18, Y+6 ; 0x06 2951 108e: 2e 81 ldd r18, Y+6 ; 0x06
2708 fb0: 3f 81 ldd r19, Y+7 ; 0x07 2952 1090: 3f 81 ldd r19, Y+7 ; 0x07
2709 fb2: 48 85 ldd r20, Y+8 ; 0x08 2953 1092: 48 85 ldd r20, Y+8 ; 0x08
2710 fb4: 59 85 ldd r21, Y+9 ; 0x09 2954 1094: 59 85 ldd r21, Y+9 ; 0x09
2711 fb6: 8a 85 ldd r24, Y+10 ; 0x0a 2955 1096: 8a 85 ldd r24, Y+10 ; 0x0a
2712 fb8: 9b 85 ldd r25, Y+11 ; 0x0b 2956 1098: 9b 85 ldd r25, Y+11 ; 0x0b
2713 fba: ac 85 ldd r26, Y+12 ; 0x0c 2957 109a: ac 85 ldd r26, Y+12 ; 0x0c
2714 fbc: bd 85 ldd r27, Y+13 ; 0x0d 2958 109c: bd 85 ldd r27, Y+13 ; 0x0d
2715 fbe: 82 17 cp r24, r18 2959 109e: 82 17 cp r24, r18
2716 fc0: 93 07 cpc r25, r19 2960 10a0: 93 07 cpc r25, r19
2717 fc2: a4 07 cpc r26, r20 2961 10a2: a4 07 cpc r26, r20
2718 fc4: b5 07 cpc r27, r21 2962 10a4: b5 07 cpc r27, r21
2719 fc6: 20 f4 brcc .+8 ; 0xfd0 <f_write+0x250> 2963 10a6: 20 f4 brcc .+8 ; 0x10b0 <f_write+0x294>
2720 fc8: 2a 87 std Y+10, r18 ; 0x0a 2964 10a8: 2a 87 std Y+10, r18 ; 0x0a
2721 fca: 3b 87 std Y+11, r19 ; 0x0b 2965 10aa: 3b 87 std Y+11, r19 ; 0x0b
2722 fcc: 4c 87 std Y+12, r20 ; 0x0c 2966 10ac: 4c 87 std Y+12, r20 ; 0x0c
2723 fce: 5d 87 std Y+13, r21 ; 0x0d 2967 10ae: 5d 87 std Y+13, r21 ; 0x0d
2724 fp->flag |= FA__WRITTEN; /* Set file changed flag */ 2968 fp->flag |= FA__WRITTEN; /* Set file changed flag */
2725 fd0: 8a 81 ldd r24, Y+2 ; 0x02 2969 10b0: 8a 81 ldd r24, Y+2 ; 0x02
2726 fd2: 80 62 ori r24, 0x20 ; 32 2970 10b2: 80 62 ori r24, 0x20 ; 32
2727 fd4: 8a 83 std Y+2, r24 ; 0x02 2971 10b4: 8a 83 std Y+2, r24 ; 0x02
2728 fd6: 06 c0 rjmp .+12 ; 0xfe4 <f_write+0x264> 2972 10b6: 06 c0 rjmp .+12 ; 0x10c4 <f_write+0x2a8>
2729 return FR_OK; 2973 return FR_OK;
2730   2974  
2731 fw_error: /* Abort this function due to an unrecoverable error */ 2975 fw_error: /* Abort this function due to an unrecoverable error */
2732 fp->flag |= FA__ERROR; 2976 fp->flag |= FA__ERROR;
2733 fd8: 8a 81 ldd r24, Y+2 ; 0x02 2977 10b8: 8a 81 ldd r24, Y+2 ; 0x02
2734 fda: 80 68 ori r24, 0x80 ; 128 2978 10ba: 80 68 ori r24, 0x80 ; 128
2735 fdc: 8a 83 std Y+2, r24 ; 0x02 2979 10bc: 8a 83 std Y+2, r24 ; 0x02
2736 fde: 28 e0 ldi r18, 0x08 ; 8 2980 10be: 88 e0 ldi r24, 0x08 ; 8
2737 fe0: 82 2e mov r8, r18 2981 10c0: 88 2e mov r8, r24
2738 fe2: 91 2c mov r9, r1 2982 10c2: 91 2c mov r9, r1
2739 return FR_RW_ERROR; 2983 return FR_RW_ERROR;
2740 } 2984 }
2741 fe4: c4 01 movw r24, r8 2985 10c4: c4 01 movw r24, r8
2742 fe6: e0 e1 ldi r30, 0x10 ; 16 2986 10c6: cd b7 in r28, 0x3d ; 61
2743 fe8: cd b7 in r28, 0x3d ; 61 2987 10c8: de b7 in r29, 0x3e ; 62
2744 fea: de b7 in r29, 0x3e ; 62 2988 10ca: e1 e1 ldi r30, 0x11 ; 17
2745 fec: 0c 94 48 11 jmp 0x2290 ; 0x2290 <__epilogue_restores__+0x4> 2989 10cc: 0c 94 e4 14 jmp 0x29c8 ; 0x29c8 <__epilogue_restores__+0x2>
2746   2990  
2747 00000ff0 <f_read>: 2991 000010d0 <f_read>:
2748 FIL *fp, /* Pointer to the file object */ 2992 FIL *fp, /* Pointer to the file object */
2749 void *buff, /* Pointer to data buffer */ 2993 void *buff, /* Pointer to data buffer */
2750 WORD btr, /* Number of bytes to read */ 2994 WORD btr, /* Number of bytes to read */
2751 WORD *br /* Pointer to number of bytes read */ 2995 WORD *br /* Pointer to number of bytes read */
2752 ) 2996 )
2753 { 2997 {
2754 ff0: a0 e0 ldi r26, 0x00 ; 0 2998 10d0: a0 e0 ldi r26, 0x00 ; 0
2755 ff2: b0 e0 ldi r27, 0x00 ; 0 2999 10d2: b0 e0 ldi r27, 0x00 ; 0
2756 ff4: ee ef ldi r30, 0xFE ; 254 3000 10d4: ee e6 ldi r30, 0x6E ; 110
2757 ff6: f7 e0 ldi r31, 0x07 ; 7 3001 10d6: f8 e0 ldi r31, 0x08 ; 8
2758 ff8: 0c 94 2c 11 jmp 0x2258 ; 0x2258 <__prologue_saves__+0x4> 3002 10d8: 0c 94 c9 14 jmp 0x2992 ; 0x2992 <__prologue_saves__+0x4>
2759 ffc: ec 01 movw r28, r24 3003 10dc: ec 01 movw r28, r24
2760 ffe: 8b 01 movw r16, r22 3004 10de: 16 2f mov r17, r22
-   3005 10e0: 07 2f mov r16, r23
2761 1000: 7a 01 movw r14, r20 3006 10e2: 7a 01 movw r14, r20
2762 1002: 39 01 movw r6, r18 3007 10e4: 39 01 movw r6, r18
2763 DWORD sect, remain; 3008 DWORD sect, remain;
2764 WORD rcnt; 3009 WORD rcnt;
2765 CLUST clust; 3010 CLUST clust;
2766 BYTE cc, *rbuff = buff; 3011 BYTE cc, *rbuff = buff;
2767 FRESULT res; 3012 FRESULT res;
2768 FATFS *fs = fp->fs; 3013 FATFS *fs = fp->fs;
2769 1004: 8c 80 ldd r8, Y+4 ; 0x04 3014 10e6: 8c 80 ldd r8, Y+4 ; 0x04
2770 1006: 9d 80 ldd r9, Y+5 ; 0x05 3015 10e8: 9d 80 ldd r9, Y+5 ; 0x05
2771   3016  
2772   3017  
2773 *br = 0; 3018 *br = 0;
2774 1008: f9 01 movw r30, r18 3019 10ea: f9 01 movw r30, r18
2775 100a: 11 82 std Z+1, r1 ; 0x01 3020 10ec: 11 82 std Z+1, r1 ; 0x01
2776 100c: 10 82 st Z, r1 3021 10ee: 10 82 st Z, r1
2777 res = validate(fs, fp->id); /* Check validity of the object */ 3022 res = validate(fs, fp->id); /* Check validity of the object */
2778 100e: 68 81 ld r22, Y 3023 10f0: 68 81 ld r22, Y
2779 1010: 79 81 ldd r23, Y+1 ; 0x01 3024 10f2: 79 81 ldd r23, Y+1 ; 0x01
2780 1012: c4 01 movw r24, r8 3025 10f4: c4 01 movw r24, r8
2781 1014: 0e 94 43 03 call 0x686 ; 0x686 <validate> 3026 10f6: 0e 94 46 03 call 0x68c ; 0x68c <validate>
2782 1018: 5c 01 movw r10, r24 3027 10fa: 5c 01 movw r10, r24
2783 if (res) return res; 3028 if (res) return res;
2784 101a: 89 2b or r24, r25 3029 10fc: 00 97 sbiw r24, 0x00 ; 0
2785 101c: 09 f0 breq .+2 ; 0x1020 <f_read+0x30> 3030 10fe: 09 f0 breq .+2 ; 0x1102 <f_read+0x32>
2786 101e: d9 c0 rjmp .+434 ; 0x11d2 <f_read+0x1e2> 3031 1100: f8 c0 rjmp .+496 ; 0x12f2 <f_read+0x222>
2787 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */ 3032 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */
2788 1020: 8a 81 ldd r24, Y+2 ; 0x02 3033 1102: 8a 81 ldd r24, Y+2 ; 0x02
2789 1022: 88 23 and r24, r24 3034 1104: 87 fd sbrc r24, 7
2790 1024: 0c f4 brge .+2 ; 0x1028 <f_read+0x38> -  
2791 1026: d2 c0 rjmp .+420 ; 0x11cc <f_read+0x1dc> 3035 1106: f2 c0 rjmp .+484 ; 0x12ec <f_read+0x21c>
2792 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */ 3036 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */
2793 1028: 80 fd sbrc r24, 0 3037 1108: 80 fd sbrc r24, 0
2794 102a: 04 c0 rjmp .+8 ; 0x1034 <f_read+0x44> 3038 110a: 04 c0 rjmp .+8 ; 0x1114 <f_read+0x44>
2795 102c: 06 e0 ldi r16, 0x06 ; 6 3039 110c: 76 e0 ldi r23, 0x06 ; 6
2796 102e: a0 2e mov r10, r16 3040 110e: a7 2e mov r10, r23
2797 1030: b1 2c mov r11, r1 3041 1110: b1 2c mov r11, r1
2798 1032: cf c0 rjmp .+414 ; 0x11d2 <f_read+0x1e2> 3042 1112: ef c0 rjmp .+478 ; 0x12f2 <f_read+0x222>
2799 remain = fp->fsize - fp->fptr; 3043 remain = fp->fsize - fp->fptr;
2800 1034: 2a 85 ldd r18, Y+10 ; 0x0a 3044 1114: 2a 85 ldd r18, Y+10 ; 0x0a
2801 1036: 3b 85 ldd r19, Y+11 ; 0x0b 3045 1116: 3b 85 ldd r19, Y+11 ; 0x0b
2802 1038: 4c 85 ldd r20, Y+12 ; 0x0c 3046 1118: 4c 85 ldd r20, Y+12 ; 0x0c
2803 103a: 5d 85 ldd r21, Y+13 ; 0x0d 3047 111a: 5d 85 ldd r21, Y+13 ; 0x0d
2804 103c: 8e 81 ldd r24, Y+6 ; 0x06 3048 111c: 8e 81 ldd r24, Y+6 ; 0x06
2805 103e: 9f 81 ldd r25, Y+7 ; 0x07 3049 111e: 9f 81 ldd r25, Y+7 ; 0x07
2806 1040: a8 85 ldd r26, Y+8 ; 0x08 3050 1120: a8 85 ldd r26, Y+8 ; 0x08
2807 1042: b9 85 ldd r27, Y+9 ; 0x09 3051 1122: b9 85 ldd r27, Y+9 ; 0x09
2808 1044: 28 1b sub r18, r24 3052 1124: 28 1b sub r18, r24
2809 1046: 39 0b sbc r19, r25 3053 1126: 39 0b sbc r19, r25
2810 1048: 4a 0b sbc r20, r26 3054 1128: 4a 0b sbc r20, r26
2811 104a: 5b 0b sbc r21, r27 3055 112a: 5b 0b sbc r21, r27
2812 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */ 3056 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */
2813 104c: c7 01 movw r24, r14 3057 112c: c7 01 movw r24, r14
2814 104e: aa 27 eor r26, r26 3058 112e: a0 e0 ldi r26, 0x00 ; 0
2815 1050: bb 27 eor r27, r27 3059 1130: b0 e0 ldi r27, 0x00 ; 0
2816 1052: 28 17 cp r18, r24 3060 1132: 28 17 cp r18, r24
2817 1054: 39 07 cpc r19, r25 3061 1134: 39 07 cpc r19, r25
2818 1056: 4a 07 cpc r20, r26 3062 1136: 4a 07 cpc r20, r26
2819 1058: 5b 07 cpc r21, r27 3063 1138: 5b 07 cpc r21, r27
2820 105a: 08 f4 brcc .+2 ; 0x105e <f_read+0x6e> 3064 113a: 08 f4 brcc .+2 ; 0x113e <f_read+0x6e>
2821 105c: 79 01 movw r14, r18 3065 113c: 79 01 movw r14, r18
2822 ) 3066 )
2823 { 3067 {
2824 DWORD sect, remain; 3068 DWORD sect, remain;
2825 WORD rcnt; 3069 WORD rcnt;
2826 CLUST clust; 3070 CLUST clust;
2827 BYTE cc, *rbuff = buff; 3071 BYTE cc, *rbuff = buff;
-   3072 113e: 81 2f mov r24, r17
-   3073 1140: 90 2f mov r25, r16
-   3074 1142: 9c 01 movw r18, r24
2828 105e: 68 01 movw r12, r16 3075 1144: 69 01 movw r12, r18
-   3076 fp->curr_sect += cc - 1;
-   3077 rcnt = cc * 512; continue;
2829 } 3078 }
2830 } 3079 }
2831 if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */ 3080 if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */
2832 rcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes from sector window */ 3081 rcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes from sector window */
2833 if (rcnt > btr) rcnt = btr; -  
2834 memcpy(rbuff, &fs->win[(WORD)fp->fptr % 512], rcnt); -  
2835 1060: 10 e2 ldi r17, 0x20 ; 32 -  
2836 1062: 41 2e mov r4, r17 3082 1146: 41 2c mov r4, r1
2837 1064: 51 2c mov r5, r1 -  
2838 1066: 48 0c add r4, r8 3083 1148: 62 e0 ldi r22, 0x02 ; 2
2839 1068: 59 1c adc r5, r9 3084 114a: 56 2e mov r5, r22
2840 106a: a8 c0 rjmp .+336 ; 0x11bc <f_read+0x1cc> 3085 114c: c7 c0 rjmp .+398 ; 0x12dc <f_read+0x20c>
2841 remain = fp->fsize - fp->fptr; 3086 remain = fp->fsize - fp->fptr;
2842 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */ 3087 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */
2843   3088  
2844 for ( ; btr; /* Repeat until all data transferred */ 3089 for ( ; btr; /* Repeat until all data transferred */
2845 rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) { 3090 rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
2846 if ((fp->fptr % 512) == 0) { /* On the sector boundary */ 3091 if ((fp->fptr % 512) == 0) { /* On the sector boundary */
2847 106c: 2e 81 ldd r18, Y+6 ; 0x06 3092 114e: 2e 81 ldd r18, Y+6 ; 0x06
2848 106e: 3f 81 ldd r19, Y+7 ; 0x07 3093 1150: 3f 81 ldd r19, Y+7 ; 0x07
2849 1070: 48 85 ldd r20, Y+8 ; 0x08 3094 1152: 48 85 ldd r20, Y+8 ; 0x08
2850 1072: 59 85 ldd r21, Y+9 ; 0x09 3095 1154: 59 85 ldd r21, Y+9 ; 0x09
2851 1074: da 01 movw r26, r20 3096 1156: da 01 movw r26, r20
2852 1076: c9 01 movw r24, r18 3097 1158: c9 01 movw r24, r18
2853 1078: 91 70 andi r25, 0x01 ; 1 3098 115a: 91 70 andi r25, 0x01 ; 1
2854 107a: a0 70 andi r26, 0x00 ; 0 3099 115c: a0 70 andi r26, 0x00 ; 0
2855 107c: b0 70 andi r27, 0x00 ; 0 3100 115e: b0 70 andi r27, 0x00 ; 0
2856 107e: 00 97 sbiw r24, 0x00 ; 0 3101 1160: 00 97 sbiw r24, 0x00 ; 0
2857 1080: a1 05 cpc r26, r1 3102 1162: a1 05 cpc r26, r1
2858 1082: b1 05 cpc r27, r1 3103 1164: b1 05 cpc r27, r1
2859 1084: 09 f0 breq .+2 ; 0x1088 <f_read+0x98> 3104 1166: 09 f0 breq .+2 ; 0x116a <f_read+0x9a>
2860 1086: 66 c0 rjmp .+204 ; 0x1154 <f_read+0x164> 3105 1168: 84 c0 rjmp .+264 ; 0x1272 <f_read+0x1a2>
2861 if (--fp->sect_clust) { /* Decrement left sector counter */ 3106 if (--fp->sect_clust) { /* Decrement left sector counter */
2862 1088: 8b 81 ldd r24, Y+3 ; 0x03 3107 116a: 8b 81 ldd r24, Y+3 ; 0x03
2863 108a: 81 50 subi r24, 0x01 ; 1 3108 116c: 81 50 subi r24, 0x01 ; 1
2864 108c: 8b 83 std Y+3, r24 ; 0x03 3109 116e: 8b 83 std Y+3, r24 ; 0x03
2865 108e: 88 23 and r24, r24 3110 1170: 88 23 and r24, r24
2866 1090: 49 f0 breq .+18 ; 0x10a4 <f_read+0xb4> 3111 1172: 49 f0 breq .+18 ; 0x1186 <f_read+0xb6>
2867 sect = fp->curr_sect + 1; /* Get current sector */ 3112 sect = fp->curr_sect + 1; /* Get current sector */
2868 1092: 2a 89 ldd r18, Y+18 ; 0x12 3113 1174: 2a 89 ldd r18, Y+18 ; 0x12
2869 1094: 3b 89 ldd r19, Y+19 ; 0x13 3114 1176: 3b 89 ldd r19, Y+19 ; 0x13
2870 1096: 4c 89 ldd r20, Y+20 ; 0x14 3115 1178: 4c 89 ldd r20, Y+20 ; 0x14
2871 1098: 5d 89 ldd r21, Y+21 ; 0x15 3116 117a: 5d 89 ldd r21, Y+21 ; 0x15
2872 109a: 2f 5f subi r18, 0xFF ; 255 3117 117c: 2f 5f subi r18, 0xFF ; 255
2873 109c: 3f 4f sbci r19, 0xFF ; 255 3118 117e: 3f 4f sbci r19, 0xFF ; 255
2874 109e: 4f 4f sbci r20, 0xFF ; 255 3119 1180: 4f 4f sbci r20, 0xFF ; 255
2875 10a0: 5f 4f sbci r21, 0xFF ; 255 3120 1182: 5f 4f sbci r21, 0xFF ; 255
2876 10a2: 22 c0 rjmp .+68 ; 0x10e8 <f_read+0xf8> 3121 1184: 43 c0 rjmp .+134 ; 0x120c <f_read+0x13c>
2877 } else { /* On the cluster boundary, get next cluster */ 3122 } else { /* On the cluster boundary, get next cluster */
2878 clust = (fp->fptr == 0) ? 3123 clust = (fp->fptr == 0) ?
2879 10a4: 21 15 cp r18, r1 3124 1186: 21 15 cp r18, r1
2880 10a6: 31 05 cpc r19, r1 3125 1188: 31 05 cpc r19, r1
2881 10a8: 41 05 cpc r20, r1 3126 118a: 41 05 cpc r20, r1
2882 10aa: 51 05 cpc r21, r1 3127 118c: 51 05 cpc r21, r1
2883 10ac: 19 f4 brne .+6 ; 0x10b4 <f_read+0xc4> 3128 118e: 19 f4 brne .+6 ; 0x1196 <f_read+0xc6>
2884 10ae: 2e 85 ldd r18, Y+14 ; 0x0e 3129 1190: 6e 85 ldd r22, Y+14 ; 0x0e
2885 10b0: 3f 85 ldd r19, Y+15 ; 0x0f 3130 1192: 7f 85 ldd r23, Y+15 ; 0x0f
2886 10b2: 05 c0 rjmp .+10 ; 0x10be <f_read+0xce> 3131 1194: 05 c0 rjmp .+10 ; 0x11a0 <f_read+0xd0>
2887 10b4: 88 89 ldd r24, Y+16 ; 0x10 3132 1196: 88 89 ldd r24, Y+16 ; 0x10
2888 10b6: 99 89 ldd r25, Y+17 ; 0x11 3133 1198: 99 89 ldd r25, Y+17 ; 0x11
2889 10b8: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> 3134 119a: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
-   3135 119e: bc 01 movw r22, r24
-   3136 fp->org_clust : get_cluster(fp->curr_clust);
-   3137 if (clust < 2 || clust >= fs->max_clust)
-   3138 11a0: 62 30 cpi r22, 0x02 ; 2
-   3139 11a2: 71 05 cpc r23, r1
-   3140 11a4: 08 f4 brcc .+2 ; 0x11a8 <f_read+0xd8>
-   3141 11a6: 9f c0 rjmp .+318 ; 0x12e6 <f_read+0x216>
-   3142 11a8: f4 01 movw r30, r8
-   3143 11aa: 86 89 ldd r24, Z+22 ; 0x16
-   3144 11ac: 97 89 ldd r25, Z+23 ; 0x17
-   3145 11ae: 68 17 cp r22, r24
-   3146 11b0: 79 07 cpc r23, r25
-   3147 11b2: 08 f0 brcs .+2 ; 0x11b6 <f_read+0xe6>
-   3148 11b4: 98 c0 rjmp .+304 ; 0x12e6 <f_read+0x216>
-   3149 goto fr_error;
-   3150 fp->curr_clust = clust; /* Current cluster */
-   3151 11b6: 79 8b std Y+17, r23 ; 0x11
-   3152 11b8: 68 8b std Y+16, r22 ; 0x10
-   3153 static
-   3154 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   3155 CLUST clust /* Cluster# to be converted */
-   3156 )
-   3157 {
-   3158 FATFS *fs = FatFs;
-   3159 11ba: 00 91 10 01 lds r16, 0x0110
-   3160 11be: 10 91 11 01 lds r17, 0x0111
-   3161  
-   3162  
-   3163 clust -= 2;
-   3164 11c2: 62 50 subi r22, 0x02 ; 2
-   3165 11c4: 70 40 sbci r23, 0x00 ; 0
-   3166 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   3167 11c6: f8 01 movw r30, r16
-   3168 11c8: 86 89 ldd r24, Z+22 ; 0x16
-   3169 11ca: 97 89 ldd r25, Z+23 ; 0x17
-   3170 11cc: 02 97 sbiw r24, 0x02 ; 2
-   3171 11ce: 68 17 cp r22, r24
-   3172 11d0: 79 07 cpc r23, r25
-   3173 11d2: 28 f0 brcs .+10 ; 0x11de <f_read+0x10e>
-   3174 11d4: 20 e0 ldi r18, 0x00 ; 0
-   3175 11d6: 30 e0 ldi r19, 0x00 ; 0
-   3176 11d8: 40 e0 ldi r20, 0x00 ; 0
-   3177 11da: 50 e0 ldi r21, 0x00 ; 0
-   3178 11dc: 14 c0 rjmp .+40 ; 0x1206 <f_read+0x136>
-   3179 return (DWORD)clust * fs->sects_clust + fs->database;
-   3180 11de: 80 e0 ldi r24, 0x00 ; 0
-   3181 11e0: 90 e0 ldi r25, 0x00 ; 0
-   3182 11e2: f8 01 movw r30, r16
-   3183 11e4: 25 8d ldd r18, Z+29 ; 0x1d
-   3184 11e6: 30 e0 ldi r19, 0x00 ; 0
-   3185 11e8: 40 e0 ldi r20, 0x00 ; 0
-   3186 11ea: 50 e0 ldi r21, 0x00 ; 0
-   3187 11ec: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
2890 10bc: 9c 01 movw r18, r24 3188 11f0: 9b 01 movw r18, r22
-   3189 11f2: ac 01 movw r20, r24
-   3190 11f4: f8 01 movw r30, r16
-   3191 11f6: 80 89 ldd r24, Z+16 ; 0x10
-   3192 11f8: 91 89 ldd r25, Z+17 ; 0x11
-   3193 11fa: a2 89 ldd r26, Z+18 ; 0x12
-   3194 11fc: b3 89 ldd r27, Z+19 ; 0x13
-   3195 11fe: 28 0f add r18, r24
-   3196 1200: 39 1f adc r19, r25
-   3197 1202: 4a 1f adc r20, r26
-   3198 1204: 5b 1f adc r21, r27
2891 fp->org_clust : get_cluster(fp->curr_clust); 3199 fp->org_clust : get_cluster(fp->curr_clust);
2892 if (clust < 2 || clust >= fs->max_clust) 3200 if (clust < 2 || clust >= fs->max_clust)
2893 10be: 22 30 cpi r18, 0x02 ; 2 -  
2894 10c0: 31 05 cpc r19, r1 -  
2895 10c2: 08 f4 brcc .+2 ; 0x10c6 <f_read+0xd6> -  
2896 10c4: 80 c0 rjmp .+256 ; 0x11c6 <f_read+0x1d6> -  
2897 10c6: f4 01 movw r30, r8 -  
2898 10c8: 86 89 ldd r24, Z+22 ; 0x16 -  
2899 10ca: 97 89 ldd r25, Z+23 ; 0x17 -  
2900 10cc: 28 17 cp r18, r24 -  
2901 10ce: 39 07 cpc r19, r25 -  
2902 10d0: 08 f0 brcs .+2 ; 0x10d4 <f_read+0xe4> -  
2903 10d2: 79 c0 rjmp .+242 ; 0x11c6 <f_read+0x1d6> -  
2904 goto fr_error; 3201 goto fr_error;
2905 fp->curr_clust = clust; /* Current cluster */ 3202 fp->curr_clust = clust; /* Current cluster */
2906 10d4: 39 8b std Y+17, r19 ; 0x11 -  
2907 10d6: 28 8b std Y+16, r18 ; 0x10 -  
2908 sect = clust2sect(clust); /* Get current sector */ 3203 sect = clust2sect(clust); /* Get current sector */
2909 10d8: c9 01 movw r24, r18 -  
2910 10da: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
2911 10de: 9b 01 movw r18, r22 -  
2912 10e0: ac 01 movw r20, r24 -  
2913 fp->sect_clust = fs->sects_clust; /* Re-initialize the left sector counter */ 3204 fp->sect_clust = fs->sects_clust; /* Re-initialize the left sector counter */
2914 10e2: f4 01 movw r30, r8 3205 1206: f4 01 movw r30, r8
2915 10e4: 85 8d ldd r24, Z+29 ; 0x1d 3206 1208: 85 8d ldd r24, Z+29 ; 0x1d
2916 10e6: 8b 83 std Y+3, r24 ; 0x03 3207 120a: 8b 83 std Y+3, r24 ; 0x03
2917 } 3208 }
2918 fp->curr_sect = sect; /* Update current sector */ 3209 fp->curr_sect = sect; /* Update current sector */
2919 10e8: 2a 8b std Y+18, r18 ; 0x12 3210 120c: 2a 8b std Y+18, r18 ; 0x12
2920 10ea: 3b 8b std Y+19, r19 ; 0x13 3211 120e: 3b 8b std Y+19, r19 ; 0x13
2921 10ec: 4c 8b std Y+20, r20 ; 0x14 3212 1210: 4c 8b std Y+20, r20 ; 0x14
2922 10ee: 5d 8b std Y+21, r21 ; 0x15 3213 1212: 5d 8b std Y+21, r21 ; 0x15
2923 cc = btr / 512; /* When left bytes >= 512, */ 3214 cc = btr / 512; /* When left bytes >= 512, */
2924 10f0: 87 01 movw r16, r14 -  
2925 10f2: 01 2f mov r16, r17 3215 1214: 0f 2d mov r16, r15
2926 10f4: 11 27 eor r17, r17 -  
2927 10f6: 06 95 lsr r16 3216 1216: 06 95 lsr r16
2928 if (cc) { /* Read maximum contiguous sectors directly */ 3217 if (cc) { /* Read maximum contiguous sectors directly */
2929 10f8: 00 23 and r16, r16 -  
2930 10fa: 61 f1 breq .+88 ; 0x1154 <f_read+0x164> 3218 1218: 61 f1 breq .+88 ; 0x1272 <f_read+0x1a2>
2931 10fc: 8b 81 ldd r24, Y+3 ; 0x03 3219 121a: 6b 81 ldd r22, Y+3 ; 0x03
2932 10fe: 10 2f mov r17, r16 3220 121c: 10 2f mov r17, r16
2933 1100: 80 17 cp r24, r16 3221 121e: 60 17 cp r22, r16
2934 1102: 08 f4 brcc .+2 ; 0x1106 <f_read+0x116> 3222 1220: 08 f4 brcc .+2 ; 0x1224 <f_read+0x154>
2935 1104: 18 2f mov r17, r24 3223 1222: 16 2f mov r17, r22
2936 if (cc > fp->sect_clust) cc = fp->sect_clust; 3224 if (cc > fp->sect_clust) cc = fp->sect_clust;
2937 if (disk_read(0, rbuff, sect, cc) != RES_OK) 3225 if (disk_read(0, rbuff, sect, cc) != RES_OK)
2938 1106: 01 2f mov r16, r17 3226 1224: 01 2f mov r16, r17
2939 1108: b6 01 movw r22, r12 3227 1226: b6 01 movw r22, r12
2940 110a: 80 e0 ldi r24, 0x00 ; 0 3228 1228: 80 e0 ldi r24, 0x00 ; 0
2941 110c: 0e 94 51 0f call 0x1ea2 ; 0x1ea2 <disk_read> 3229 122a: 0e 94 9c 0f call 0x1f38 ; 0x1f38 <disk_read>
2942 1110: 89 2b or r24, r25 3230 122e: 89 2b or r24, r25
2943 1112: 09 f0 breq .+2 ; 0x1116 <f_read+0x126> 3231 1230: 09 f0 breq .+2 ; 0x1234 <f_read+0x164>
2944 1114: 58 c0 rjmp .+176 ; 0x11c6 <f_read+0x1d6> 3232 1232: 59 c0 rjmp .+178 ; 0x12e6 <f_read+0x216>
2945 goto fr_error; 3233 goto fr_error;
2946 fp->sect_clust -= cc - 1; 3234 fp->sect_clust -= cc - 1;
2947 1116: 8b 81 ldd r24, Y+3 ; 0x03 3235 1234: 8b 81 ldd r24, Y+3 ; 0x03
2948 1118: 8f 5f subi r24, 0xFF ; 255 3236 1236: 8f 5f subi r24, 0xFF ; 255
2949 111a: 81 1b sub r24, r17 3237 1238: 81 1b sub r24, r17
2950 111c: 8b 83 std Y+3, r24 ; 0x03 3238 123a: 8b 83 std Y+3, r24 ; 0x03
2951 fp->curr_sect += cc - 1; 3239 fp->curr_sect += cc - 1;
2952 111e: 81 2f mov r24, r17 3240 123c: 81 2f mov r24, r17
2953 1120: 99 27 eor r25, r25 3241 123e: 90 e0 ldi r25, 0x00 ; 0
2954 1122: 01 97 sbiw r24, 0x01 ; 1 3242 1240: 01 97 sbiw r24, 0x01 ; 1
2955 1124: 9c 01 movw r18, r24 3243 1242: 9c 01 movw r18, r24
2956 1126: 44 27 eor r20, r20 3244 1244: 44 27 eor r20, r20
2957 1128: 37 fd sbrc r19, 7 3245 1246: 37 fd sbrc r19, 7
2958 112a: 40 95 com r20 3246 1248: 40 95 com r20
2959 112c: 54 2f mov r21, r20 3247 124a: 54 2f mov r21, r20
2960 112e: 8c 01 movw r16, r24 3248 124c: 8c 01 movw r16, r24
2961 1130: 0f 5f subi r16, 0xFF ; 255 3249 124e: 0f 5f subi r16, 0xFF ; 255
2962 1132: 1f 4f sbci r17, 0xFF ; 255 3250 1250: 1f 4f sbci r17, 0xFF ; 255
2963 1134: 8a 89 ldd r24, Y+18 ; 0x12 3251 1252: 8a 89 ldd r24, Y+18 ; 0x12
2964 1136: 9b 89 ldd r25, Y+19 ; 0x13 3252 1254: 9b 89 ldd r25, Y+19 ; 0x13
2965 1138: ac 89 ldd r26, Y+20 ; 0x14 3253 1256: ac 89 ldd r26, Y+20 ; 0x14
2966 113a: bd 89 ldd r27, Y+21 ; 0x15 3254 1258: bd 89 ldd r27, Y+21 ; 0x15
2967 113c: 82 0f add r24, r18 3255 125a: 82 0f add r24, r18
2968 113e: 93 1f adc r25, r19 3256 125c: 93 1f adc r25, r19
2969 1140: a4 1f adc r26, r20 3257 125e: a4 1f adc r26, r20
2970 1142: b5 1f adc r27, r21 3258 1260: b5 1f adc r27, r21
2971 1144: 8a 8b std Y+18, r24 ; 0x12 3259 1262: 8a 8b std Y+18, r24 ; 0x12
2972 1146: 9b 8b std Y+19, r25 ; 0x13 3260 1264: 9b 8b std Y+19, r25 ; 0x13
2973 1148: ac 8b std Y+20, r26 ; 0x14 3261 1266: ac 8b std Y+20, r26 ; 0x14
2974 114a: bd 8b std Y+21, r27 ; 0x15 3262 1268: bd 8b std Y+21, r27 ; 0x15
2975 rcnt = cc * 512; continue; 3263 rcnt = cc * 512; continue;
2976 114c: 10 2f mov r17, r16 3264 126a: 10 2f mov r17, r16
2977 114e: 00 27 eor r16, r16 3265 126c: 00 27 eor r16, r16
2978 1150: 11 0f add r17, r17 3266 126e: 11 0f add r17, r17
2979 1152: 1a c0 rjmp .+52 ; 0x1188 <f_read+0x198> 3267 1270: 1b c0 rjmp .+54 ; 0x12a8 <f_read+0x1d8>
2980 } 3268 }
2981 } 3269 }
2982 if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */ 3270 if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */
2983 1154: 6a 89 ldd r22, Y+18 ; 0x12 3271 1272: 6a 89 ldd r22, Y+18 ; 0x12
2984 1156: 7b 89 ldd r23, Y+19 ; 0x13 3272 1274: 7b 89 ldd r23, Y+19 ; 0x13
2985 1158: 8c 89 ldd r24, Y+20 ; 0x14 3273 1276: 8c 89 ldd r24, Y+20 ; 0x14
2986 115a: 9d 89 ldd r25, Y+21 ; 0x15 3274 1278: 9d 89 ldd r25, Y+21 ; 0x15
2987 115c: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 3275 127a: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
2988 1160: 88 23 and r24, r24 3276 127e: 88 23 and r24, r24
2989 1162: 89 f1 breq .+98 ; 0x11c6 <f_read+0x1d6> 3277 1280: 91 f1 breq .+100 ; 0x12e6 <f_read+0x216>
2990 rcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes from sector window */ 3278 rcnt = 512 - (WORD)(fp->fptr % 512); /* Copy fractional bytes from sector window */
2991 1164: 6e 81 ldd r22, Y+6 ; 0x06 3279 1282: 8e 81 ldd r24, Y+6 ; 0x06
2992 1166: 7f 81 ldd r23, Y+7 ; 0x07 3280 1284: 9f 81 ldd r25, Y+7 ; 0x07
2993 1168: 71 70 andi r23, 0x01 ; 1 3281 1286: 91 70 andi r25, 0x01 ; 1
2994 116a: 80 e0 ldi r24, 0x00 ; 0 -  
2995 116c: 92 e0 ldi r25, 0x02 ; 2 3282 1288: 92 01 movw r18, r4
2996 116e: 86 1b sub r24, r22 3283 128a: 28 1b sub r18, r24
2997 1170: 97 0b sbc r25, r23 3284 128c: 39 0b sbc r19, r25
2998 1172: 87 01 movw r16, r14 3285 128e: 87 01 movw r16, r14
2999 1174: 8e 15 cp r24, r14 3286 1290: 2e 15 cp r18, r14
3000 1176: 9f 05 cpc r25, r15 3287 1292: 3f 05 cpc r19, r15
3001 1178: 08 f4 brcc .+2 ; 0x117c <f_read+0x18c> 3288 1294: 08 f4 brcc .+2 ; 0x1298 <f_read+0x1c8>
3002 117a: 8c 01 movw r16, r24 3289 1296: 89 01 movw r16, r18
3003 if (rcnt > btr) rcnt = btr; 3290 if (rcnt > btr) rcnt = btr;
3004 memcpy(rbuff, &fs->win[(WORD)fp->fptr % 512], rcnt); 3291 memcpy(rbuff, &fs->win[(WORD)fp->fptr % 512], rcnt);
-   3292 1298: 80 96 adiw r24, 0x20 ; 32
3005 117c: 64 0d add r22, r4 3293 129a: 88 0d add r24, r8
3006 117e: 75 1d adc r23, r5 3294 129c: 99 1d adc r25, r9
3007 1180: a8 01 movw r20, r16 3295 129e: a8 01 movw r20, r16
-   3296 12a0: bc 01 movw r22, r24
3008 1182: c6 01 movw r24, r12 3297 12a2: c6 01 movw r24, r12
3009 1184: 0e 94 a1 10 call 0x2142 ; 0x2142 <memcpy> 3298 12a4: 0e 94 a3 11 call 0x2346 ; 0x2346 <memcpy>
3010 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */ 3299 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */
3011 remain = fp->fsize - fp->fptr; 3300 remain = fp->fsize - fp->fptr;
3012 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */ 3301 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */
3013   3302  
3014 for ( ; btr; /* Repeat until all data transferred */ 3303 for ( ; btr; /* Repeat until all data transferred */
3015 rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) { 3304 rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
3016 1188: c0 0e add r12, r16 3305 12a8: c0 0e add r12, r16
3017 118a: d1 1e adc r13, r17 3306 12aa: d1 1e adc r13, r17
3018 118c: c8 01 movw r24, r16 3307 12ac: c8 01 movw r24, r16
3019 118e: aa 27 eor r26, r26 3308 12ae: a0 e0 ldi r26, 0x00 ; 0
3020 1190: bb 27 eor r27, r27 3309 12b0: b0 e0 ldi r27, 0x00 ; 0
3021 1192: 2e 81 ldd r18, Y+6 ; 0x06 3310 12b2: 2e 81 ldd r18, Y+6 ; 0x06
3022 1194: 3f 81 ldd r19, Y+7 ; 0x07 3311 12b4: 3f 81 ldd r19, Y+7 ; 0x07
3023 1196: 48 85 ldd r20, Y+8 ; 0x08 3312 12b6: 48 85 ldd r20, Y+8 ; 0x08
3024 1198: 59 85 ldd r21, Y+9 ; 0x09 3313 12b8: 59 85 ldd r21, Y+9 ; 0x09
3025 119a: 28 0f add r18, r24 3314 12ba: 28 0f add r18, r24
3026 119c: 39 1f adc r19, r25 3315 12bc: 39 1f adc r19, r25
3027 119e: 4a 1f adc r20, r26 3316 12be: 4a 1f adc r20, r26
3028 11a0: 5b 1f adc r21, r27 3317 12c0: 5b 1f adc r21, r27
3029 11a2: 2e 83 std Y+6, r18 ; 0x06 3318 12c2: 2e 83 std Y+6, r18 ; 0x06
3030 11a4: 3f 83 std Y+7, r19 ; 0x07 3319 12c4: 3f 83 std Y+7, r19 ; 0x07
3031 11a6: 48 87 std Y+8, r20 ; 0x08 3320 12c6: 48 87 std Y+8, r20 ; 0x08
3032 11a8: 59 87 std Y+9, r21 ; 0x09 3321 12c8: 59 87 std Y+9, r21 ; 0x09
3033 11aa: f3 01 movw r30, r6 3322 12ca: f3 01 movw r30, r6
3034 11ac: 80 81 ld r24, Z 3323 12cc: 80 81 ld r24, Z
3035 11ae: 91 81 ldd r25, Z+1 ; 0x01 3324 12ce: 91 81 ldd r25, Z+1 ; 0x01
3036 11b0: 80 0f add r24, r16 3325 12d0: 80 0f add r24, r16
3037 11b2: 91 1f adc r25, r17 3326 12d2: 91 1f adc r25, r17
3038 11b4: 91 83 std Z+1, r25 ; 0x01 3327 12d4: 91 83 std Z+1, r25 ; 0x01
3039 11b6: 80 83 st Z, r24 3328 12d6: 80 83 st Z, r24
3040 11b8: e0 1a sub r14, r16 3329 12d8: e0 1a sub r14, r16
3041 11ba: f1 0a sbc r15, r17 3330 12da: f1 0a sbc r15, r17
3042 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */ 3331 if (fp->flag & FA__ERROR) return FR_RW_ERROR; /* Check error flag */
3043 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */ 3332 if (!(fp->flag & FA_READ)) return FR_DENIED; /* Check access mode */
3044 remain = fp->fsize - fp->fptr; 3333 remain = fp->fsize - fp->fptr;
3045 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */ 3334 if (btr > remain) btr = (WORD)remain; /* Truncate read count by number of bytes left */
3046   3335  
3047 for ( ; btr; /* Repeat until all data transferred */ 3336 for ( ; btr; /* Repeat until all data transferred */
3048 11bc: e1 14 cp r14, r1 3337 12dc: e1 14 cp r14, r1
3049 11be: f1 04 cpc r15, r1 3338 12de: f1 04 cpc r15, r1
3050 11c0: 09 f0 breq .+2 ; 0x11c4 <f_read+0x1d4> 3339 12e0: 09 f0 breq .+2 ; 0x12e4 <f_read+0x214>
3051 11c2: 54 cf rjmp .-344 ; 0x106c <f_read+0x7c> 3340 12e2: 35 cf rjmp .-406 ; 0x114e <f_read+0x7e>
3052 11c4: 06 c0 rjmp .+12 ; 0x11d2 <f_read+0x1e2> 3341 12e4: 06 c0 rjmp .+12 ; 0x12f2 <f_read+0x222>
3053 } 3342 }
3054   3343  
3055 return FR_OK; 3344 return FR_OK;
3056   3345  
3057 fr_error: /* Abort this function due to an unrecoverable error */ 3346 fr_error: /* Abort this function due to an unrecoverable error */
3058 fp->flag |= FA__ERROR; 3347 fp->flag |= FA__ERROR;
3059 11c6: 8a 81 ldd r24, Y+2 ; 0x02 3348 12e6: 8a 81 ldd r24, Y+2 ; 0x02
3060 11c8: 80 68 ori r24, 0x80 ; 128 3349 12e8: 80 68 ori r24, 0x80 ; 128
3061 11ca: 8a 83 std Y+2, r24 ; 0x02 3350 12ea: 8a 83 std Y+2, r24 ; 0x02
3062 11cc: f8 e0 ldi r31, 0x08 ; 8 3351 12ec: 48 e0 ldi r20, 0x08 ; 8
3063 11ce: af 2e mov r10, r31 3352 12ee: a4 2e mov r10, r20
3064 11d0: b1 2c mov r11, r1 3353 12f0: b1 2c mov r11, r1
3065 return FR_RW_ERROR; 3354 return FR_RW_ERROR;
3066 } 3355 }
3067 11d2: c5 01 movw r24, r10 3356 12f2: c5 01 movw r24, r10
3068 11d4: e0 e1 ldi r30, 0x10 ; 16 3357 12f4: cd b7 in r28, 0x3d ; 61
3069 11d6: cd b7 in r28, 0x3d ; 61 3358 12f6: de b7 in r29, 0x3e ; 62
3070 11d8: de b7 in r29, 0x3e ; 62 3359 12f8: e0 e1 ldi r30, 0x10 ; 16
3071 11da: 0c 94 48 11 jmp 0x2290 ; 0x2290 <__epilogue_restores__+0x4> 3360 12fa: 0c 94 e5 14 jmp 0x29ca ; 0x29ca <__epilogue_restores__+0x4>
3072   3361  
3073 000011de <f_mount>: 3362 000012fe <f_mount>:
3074   3363  
3075 FRESULT f_mount ( 3364 FRESULT f_mount (
3076 BYTE drv, /* Logical drive number to be mounted/unmounted */ 3365 BYTE drv, /* Logical drive number to be mounted/unmounted */
3077 FATFS *fs /* Pointer to new file system object (NULL for unmount)*/ 3366 FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
3078 ) 3367 )
3079 { 3368 {
-   3369 12fe: cf 93 push r28
-   3370 1300: df 93 push r29
3080 11de: fb 01 movw r30, r22 3371 1302: fb 01 movw r30, r22
3081 FATFS *fsobj; 3372 FATFS *fsobj;
3082   3373  
3083   3374  
3084 if (drv) return FR_INVALID_DRIVE; 3375 if (drv) return FR_INVALID_DRIVE;
3085 11e0: 88 23 and r24, r24 3376 1304: 88 23 and r24, r24
3086 11e2: 19 f0 breq .+6 ; 0x11ea <f_mount+0xc> 3377 1306: 19 f0 breq .+6 ; 0x130e <f_mount+0x10>
3087 11e4: 85 e0 ldi r24, 0x05 ; 5 3378 1308: 25 e0 ldi r18, 0x05 ; 5
3088 11e6: 90 e0 ldi r25, 0x00 ; 0 3379 130a: 30 e0 ldi r19, 0x00 ; 0
3089 11e8: 08 95 ret 3380 130c: 1d c0 rjmp .+58 ; 0x1348 <f_mount+0x4a>
3090 fsobj = FatFs; 3381 fsobj = FatFs;
3091 11ea: a0 91 0a 01 lds r26, 0x010A 3382 130e: a0 91 10 01 lds r26, 0x0110
3092 11ee: b0 91 0b 01 lds r27, 0x010B 3383 1312: b0 91 11 01 lds r27, 0x0111
3093 FatFs = fs; 3384 FatFs = fs;
3094 11f2: 70 93 0b 01 sts 0x010B, r23 3385 1316: 70 93 11 01 sts 0x0111, r23
3095 11f6: 60 93 0a 01 sts 0x010A, r22 3386 131a: 60 93 10 01 sts 0x0110, r22
3096 if (fsobj) memset(fsobj, 0, sizeof(FATFS)); 3387 if (fsobj) memset(fsobj, 0, sizeof(FATFS));
3097 11fa: 10 97 sbiw r26, 0x00 ; 0 3388 131e: 10 97 sbiw r26, 0x00 ; 0
3098 11fc: 29 f0 breq .+10 ; 0x1208 <f_mount+0x2a> 3389 1320: 41 f0 breq .+16 ; 0x1332 <f_mount+0x34>
3099 11fe: 80 e2 ldi r24, 0x20 ; 32 3390 1322: 80 e2 ldi r24, 0x20 ; 32
3100 1200: 92 e0 ldi r25, 0x02 ; 2 3391 1324: 92 e0 ldi r25, 0x02 ; 2
-   3392 1326: ed 01 movw r28, r26
-   3393 1328: 9c 01 movw r18, r24
3101 1202: 1d 92 st X+, r1 3394 132a: 19 92 st Y+, r1
3102 1204: 01 97 sbiw r24, 0x01 ; 1 3395 132c: 21 50 subi r18, 0x01 ; 1
-   3396 132e: 30 40 sbci r19, 0x00 ; 0
3103 1206: e9 f7 brne .-6 ; 0x1202 <f_mount+0x24> 3397 1330: e1 f7 brne .-8 ; 0x132a <f_mount+0x2c>
3104 if (fs) memset(fs, 0, sizeof(FATFS)); 3398 if (fs) memset(fs, 0, sizeof(FATFS));
3105 1208: 30 97 sbiw r30, 0x00 ; 0 3399 1332: 30 97 sbiw r30, 0x00 ; 0
3106 120a: 19 f4 brne .+6 ; 0x1212 <f_mount+0x34> 3400 1334: 39 f0 breq .+14 ; 0x1344 <f_mount+0x46>
3107 120c: 80 e0 ldi r24, 0x00 ; 0 3401 1336: 80 e2 ldi r24, 0x20 ; 32
3108 120e: 90 e0 ldi r25, 0x00 ; 0 3402 1338: 92 e0 ldi r25, 0x02 ; 2
3109 1210: 08 95 ret -  
3110 1212: 80 e2 ldi r24, 0x20 ; 32 3403 133a: df 01 movw r26, r30
3111 1214: 92 e0 ldi r25, 0x02 ; 2 3404 133c: ec 01 movw r28, r24
3112 1216: 11 92 st Z+, r1 3405 133e: 1d 92 st X+, r1
3113 1218: 01 97 sbiw r24, 0x01 ; 1 3406 1340: 21 97 sbiw r28, 0x01 ; 1
3114 121a: e9 f7 brne .-6 ; 0x1216 <f_mount+0x38> 3407 1342: e9 f7 brne .-6 ; 0x133e <f_mount+0x40>
3115 121c: 80 e0 ldi r24, 0x00 ; 0 3408 1344: 20 e0 ldi r18, 0x00 ; 0
3116 121e: 90 e0 ldi r25, 0x00 ; 0 3409 1346: 30 e0 ldi r19, 0x00 ; 0
3117   3410  
3118 return FR_OK; 3411 return FR_OK;
3119 } 3412 }
-   3413 1348: c9 01 movw r24, r18
-   3414 134a: df 91 pop r29
-   3415 134c: cf 91 pop r28
3120 1220: 08 95 ret 3416 134e: 08 95 ret
3121   3417  
3122 00001222 <check_fs>: 3418 00001350 <check_fs>:
3123   3419  
3124 static 3420 static
3125 BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record or error */ 3421 BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record or error */
3126 DWORD sect /* Sector# to check if it is a FAT boot record or not */ 3422 DWORD sect /* Sector# to check if it is a FAT boot record or not */
3127 ) 3423 )
3128 { 3424 {
3129 1222: 0f 93 push r16 3425 1350: 0f 93 push r16
3130 1224: cf 93 push r28 3426 1352: cf 93 push r28
3131 1226: df 93 push r29 3427 1354: df 93 push r29
3132 1228: 9b 01 movw r18, r22 3428 1356: 9b 01 movw r18, r22
3133 122a: ac 01 movw r20, r24 3429 1358: ac 01 movw r20, r24
3134 FATFS *fs = FatFs; 3430 FATFS *fs = FatFs;
3135 122c: c0 91 0a 01 lds r28, 0x010A 3431 135a: c0 91 10 01 lds r28, 0x0110
3136 1230: d0 91 0b 01 lds r29, 0x010B 3432 135e: d0 91 11 01 lds r29, 0x0111
3137   3433  
3138 if (disk_read(0, fs->win, sect, 1) != RES_OK) /* Load boot record */ 3434 if (disk_read(0, fs->win, sect, 1) != RES_OK) /* Load boot record */
3139 1234: be 01 movw r22, r28 3435 1362: be 01 movw r22, r28
3140 1236: 60 5e subi r22, 0xE0 ; 224 3436 1364: 60 5e subi r22, 0xE0 ; 224
3141 1238: 7f 4f sbci r23, 0xFF ; 255 3437 1366: 7f 4f sbci r23, 0xFF ; 255
3142 123a: 01 e0 ldi r16, 0x01 ; 1 3438 1368: 01 e0 ldi r16, 0x01 ; 1
3143 123c: 80 e0 ldi r24, 0x00 ; 0 3439 136a: 80 e0 ldi r24, 0x00 ; 0
3144 123e: 0e 94 51 0f call 0x1ea2 ; 0x1ea2 <disk_read> 3440 136c: 0e 94 9c 0f call 0x1f38 ; 0x1f38 <disk_read>
3145 1242: 89 2b or r24, r25 3441 1370: 89 2b or r24, r25
3146 1244: d9 f4 brne .+54 ; 0x127c <check_fs+0x5a> 3442 1372: c1 f4 brne .+48 ; 0x13a4 <check_fs+0x54>
3147 return 2; 3443 return 2;
3148 if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature */ 3444 if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature */
3149 1246: c2 5e subi r28, 0xE2 ; 226 3445 1374: c2 5e subi r28, 0xE2 ; 226
3150 1248: dd 4f sbci r29, 0xFD ; 253 3446 1376: dd 4f sbci r29, 0xFD ; 253
3151 124a: 88 81 ld r24, Y 3447 1378: 88 81 ld r24, Y
3152 124c: 99 81 ldd r25, Y+1 ; 0x01 3448 137a: 99 81 ldd r25, Y+1 ; 0x01
3153 124e: ce 51 subi r28, 0x1E ; 30 3449 137c: ce 51 subi r28, 0x1E ; 30
3154 1250: d2 40 sbci r29, 0x02 ; 2 3450 137e: d2 40 sbci r29, 0x02 ; 2
3155 1252: 85 55 subi r24, 0x55 ; 85 3451 1380: 85 55 subi r24, 0x55 ; 85
3156 1254: 9a 4a sbci r25, 0xAA ; 170 3452 1382: 9a 4a sbci r25, 0xAA ; 170
3157 1256: 91 f4 brne .+36 ; 0x127c <check_fs+0x5a> 3453 1384: 79 f4 brne .+30 ; 0x13a4 <check_fs+0x54>
3158 1258: 00 e0 ldi r16, 0x00 ; 0 -  
3159 return 2; 3454 return 2;
3160   3455  
3161 if (!memcmp(&fs->win[BS_FilSysType], "FAT", 3)) /* Check FAT signature */ 3456 if (!memcmp(&fs->win[BS_FilSysType], "FAT", 3)) /* Check FAT signature */
3162 125a: 43 e0 ldi r20, 0x03 ; 3 3457 1386: 43 e0 ldi r20, 0x03 ; 3
3163 125c: 50 e0 ldi r21, 0x00 ; 0 3458 1388: 50 e0 ldi r21, 0x00 ; 0
3164 125e: 60 e0 ldi r22, 0x00 ; 0 3459 138a: 67 e0 ldi r22, 0x07 ; 7
3165 1260: 71 e0 ldi r23, 0x01 ; 1 3460 138c: 71 e0 ldi r23, 0x01 ; 1
3166 1262: ce 01 movw r24, r28 3461 138e: ce 01 movw r24, r28
3167 1264: 8a 5a subi r24, 0xAA ; 170 3462 1390: 8a 5a subi r24, 0xAA ; 170
3168 1266: 9f 4f sbci r25, 0xFF ; 255 3463 1392: 9f 4f sbci r25, 0xFF ; 255
3169 1268: 0e 94 94 10 call 0x2128 ; 0x2128 <memcmp> 3464 1394: 0e 94 96 11 call 0x232c ; 0x232c <memcmp>
3170 126c: 89 2b or r24, r25 3465 1398: 9c 01 movw r18, r24
3171 126e: 09 f4 brne .+2 ; 0x1272 <check_fs+0x50> -  
3172 1270: 01 e0 ldi r16, 0x01 ; 1 -  
3173 1272: 81 e0 ldi r24, 0x01 ; 1 3466 139a: 80 e0 ldi r24, 0x00 ; 0
3174 1274: 08 27 eor r16, r24 3467 139c: 23 2b or r18, r19
3175 1276: 80 2f mov r24, r16 3468 139e: 19 f0 breq .+6 ; 0x13a6 <check_fs+0x56>
3176 1278: 99 27 eor r25, r25 3469 13a0: 81 e0 ldi r24, 0x01 ; 1
3177 127a: 02 c0 rjmp .+4 ; 0x1280 <check_fs+0x5e> 3470 13a2: 01 c0 rjmp .+2 ; 0x13a6 <check_fs+0x56>
3178 127c: 82 e0 ldi r24, 0x02 ; 2 3471 13a4: 82 e0 ldi r24, 0x02 ; 2
-   3472 #if _FAT32
3179 127e: 90 e0 ldi r25, 0x00 ; 0 3473 if (!memcmp(&fs->win[BS_FilSysType32], "FAT32", 5) && !(fs->win[BPB_ExtFlags] & 0x80))
-   3474 return 0;
-   3475 #endif
-   3476 return 1;
-   3477 }
3180 1280: df 91 pop r29 3478 13a6: df 91 pop r29
3181 1282: cf 91 pop r28 3479 13a8: cf 91 pop r28
3182 1284: 0f 91 pop r16 3480 13aa: 0f 91 pop r16
3183 1286: 08 95 ret 3481 13ac: 08 95 ret
3184   3482  
3185 00001288 <f_open>: 3483 000013ae <f_open>:
3186 FRESULT f_open ( 3484 FRESULT f_open (
3187 FIL *fp, /* Pointer to the blank file object */ 3485 FIL *fp, /* Pointer to the blank file object */
3188 const char *path, /* Pointer to the file name */ 3486 const char *path, /* Pointer to the file name */
3189 BYTE mode /* Access mode and file open mode flags */ 3487 BYTE mode /* Access mode and file open mode flags */
3190 ) 3488 )
3191 { 3489 {
3192 1288: ad e1 ldi r26, 0x1D ; 29 3490 13ae: ad e1 ldi r26, 0x1D ; 29
3193 128a: b0 e0 ldi r27, 0x00 ; 0 3491 13b0: b0 e0 ldi r27, 0x00 ; 0
3194 128c: ea e4 ldi r30, 0x4A ; 74 3492 13b2: ed ed ldi r30, 0xDD ; 221
3195 128e: f9 e0 ldi r31, 0x09 ; 9 3493 13b4: f9 e0 ldi r31, 0x09 ; 9
3196 1290: 0c 94 2a 11 jmp 0x2254 ; 0x2254 <__prologue_saves__> 3494 13b6: 0c 94 c7 14 jmp 0x298e ; 0x298e <__prologue_saves__>
3197 1294: 9d 8f std Y+29, r25 ; 0x1d 3495 13ba: 9d 8f std Y+29, r25 ; 0x1d
3198 1296: 8c 8f std Y+28, r24 ; 0x1c 3496 13bc: 8c 8f std Y+28, r24 ; 0x1c
3199 1298: 6b 01 movw r12, r22 3497 13be: 3b 01 movw r6, r22
3200 FRESULT res; 3498 FRESULT res;
3201 BYTE *dir; 3499 BYTE *dir;
3202 DIR dirobj; 3500 DIR dirobj;
3203 char fn[8+3+1]; 3501 char fn[8+3+1];
3204 FATFS *fs = FatFs; 3502 FATFS *fs = FatFs;
3205 129a: a0 90 0a 01 lds r10, 0x010A 3503 13c0: 80 90 10 01 lds r8, 0x0110
3206 129e: b0 90 0b 01 lds r11, 0x010B 3504 13c4: 90 90 11 01 lds r9, 0x0111
3207   3505  
3208   3506  
3209 fp->fs = NULL; 3507 fp->fs = NULL;
3210 12a2: fc 01 movw r30, r24 3508 13c8: fc 01 movw r30, r24
3211 12a4: 15 82 std Z+5, r1 ; 0x05 3509 13ca: 15 82 std Z+5, r1 ; 0x05
3212 12a6: 14 82 std Z+4, r1 ; 0x04 3510 13cc: 14 82 std Z+4, r1 ; 0x04
3213 #if !_FS_READONLY -  
3214 mode &= (FA_READ|FA_WRITE|FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW); -  
3215 12a8: f4 2f mov r31, r20 -  
3216 12aa: ff 71 andi r31, 0x1F ; 31 -  
3217 12ac: fb 8f std Y+27, r31 ; 0x1b -  
3218 12ae: 03 c0 rjmp .+6 ; 0x12b6 <f_open+0x2e> 3511 13ce: 03 c0 rjmp .+6 ; 0x13d6 <f_open+0x28>
3219 const char *p = *path; 3512 const char *p = *path;
3220 FATFS *fs = FatFs; 3513 FATFS *fs = FatFs;
3221   3514  
3222   3515  
3223   3516  
3224 while (*p == ' ') p++; /* Strip leading spaces */ 3517 while (*p == ' ') p++; /* Strip leading spaces */
3225 12b0: 08 94 sec 3518 13d0: 08 94 sec
3226 12b2: c1 1c adc r12, r1 3519 13d2: 61 1c adc r6, r1
3227 12b4: d1 1c adc r13, r1 3520 13d4: 71 1c adc r7, r1
3228 12b6: d6 01 movw r26, r12 3521 13d6: f3 01 movw r30, r6
3229 12b8: 8c 91 ld r24, X 3522 13d8: 80 81 ld r24, Z
3230 12ba: 80 32 cpi r24, 0x20 ; 32 3523 13da: 80 32 cpi r24, 0x20 ; 32
3231 12bc: c9 f3 breq .-14 ; 0x12b0 <f_open+0x28> 3524 13dc: c9 f3 breq .-14 ; 0x13d0 <f_open+0x22>
3232 if (*p == '/') p++; /* Strip heading slash */ 3525 if (*p == '/') p++; /* Strip heading slash */
3233 12be: 8f 32 cpi r24, 0x2F ; 47 3526 13de: 8f 32 cpi r24, 0x2F ; 47
3234 12c0: 19 f4 brne .+6 ; 0x12c8 <f_open+0x40> 3527 13e0: 19 f4 brne .+6 ; 0x13e8 <f_open+0x3a>
3235 12c2: 08 94 sec 3528 13e2: 08 94 sec
3236 12c4: c1 1c adc r12, r1 3529 13e4: 61 1c adc r6, r1
3237 12c6: d1 1c adc r13, r1 3530 13e6: 71 1c adc r7, r1
3238 *path = p; /* Return pointer to the path name */ 3531 *path = p; /* Return pointer to the path name */
3239   3532  
3240 /* Is the file system object registered? */ 3533 /* Is the file system object registered? */
3241 if (!fs) return FR_NOT_ENABLED; 3534 if (!fs) return FR_NOT_ENABLED;
3242 12c8: a1 14 cp r10, r1 3535 13e8: 81 14 cp r8, r1
3243 12ca: b1 04 cpc r11, r1 3536 13ea: 91 04 cpc r9, r1
3244 12cc: 09 f4 brne .+2 ; 0x12d0 <f_open+0x48> 3537 13ec: 09 f4 brne .+2 ; 0x13f0 <f_open+0x42>
3245 12ce: 15 c1 rjmp .+554 ; 0x14fa <f_open+0x272> 3538 13ee: 17 c1 rjmp .+558 ; 0x161e <f_open+0x270>
-   3539 FATFS *fs = FatFs;
3246   3540  
3247   3541  
3248 fp->fs = NULL; 3542 fp->fs = NULL;
3249 #if !_FS_READONLY 3543 #if !_FS_READONLY
3250 mode &= (FA_READ|FA_WRITE|FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW); 3544 mode &= (FA_READ|FA_WRITE|FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW);
-   3545 13f0: f4 2f mov r31, r20
-   3546 13f2: ff 71 andi r31, 0x1F ; 31
-   3547 13f4: fb 8f std Y+27, r31 ; 0x1b
3251 res = auto_mount(&path, (BYTE)(mode & (FA_WRITE|FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW))); 3548 res = auto_mount(&path, (BYTE)(mode & (FA_WRITE|FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW)));
3252 12d0: 1b 8d ldd r17, Y+27 ; 0x1b 3549 13f6: 14 2f mov r17, r20
3253 12d2: 1e 71 andi r17, 0x1E ; 30 3550 13f8: 1e 71 andi r17, 0x1E ; 30
3254   3551  
3255 /* Is the file system object registered? */ 3552 /* Is the file system object registered? */
3256 if (!fs) return FR_NOT_ENABLED; 3553 if (!fs) return FR_NOT_ENABLED;
3257   3554  
3258 /* Chekck if the logical drive has been mounted or not */ 3555 /* Chekck if the logical drive has been mounted or not */
3259 if (fs->fs_type) { 3556 if (fs->fs_type) {
3260 12d4: f5 01 movw r30, r10 3557 13fa: f4 01 movw r30, r8
3261 12d6: 84 8d ldd r24, Z+28 ; 0x1c 3558 13fc: 84 8d ldd r24, Z+28 ; 0x1c
3262 12d8: 88 23 and r24, r24 3559 13fe: 88 23 and r24, r24
3263 12da: 61 f0 breq .+24 ; 0x12f4 <f_open+0x6c> 3560 1400: 59 f0 breq .+22 ; 0x1418 <f_open+0x6a>
3264 stat = disk_status(0); 3561 stat = disk_status(0);
3265 12dc: 80 e0 ldi r24, 0x00 ; 0 3562 1402: 80 e0 ldi r24, 0x00 ; 0
3266 12de: 0e 94 bf 0d call 0x1b7e ; 0x1b7e <disk_status> 3563 1404: 0e 94 95 0f call 0x1f2a ; 0x1f2a <disk_status>
3267 if (!(stat & STA_NOINIT)) { /* If the physical drive is kept initialized */ 3564 if (!(stat & STA_NOINIT)) { /* If the physical drive is kept initialized */
3268 12e2: 99 27 eor r25, r25 -  
3269 12e4: 80 fd sbrc r24, 0 3565 1408: 80 fd sbrc r24, 0
3270 12e6: 06 c0 rjmp .+12 ; 0x12f4 <f_open+0x6c> 3566 140a: 06 c0 rjmp .+12 ; 0x1418 <f_open+0x6a>
3271 #if !_FS_READONLY 3567 #if !_FS_READONLY
3272 if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */ 3568 if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
3273 12e8: 11 23 and r17, r17 3569 140c: 11 23 and r17, r17
3274 12ea: 09 f4 brne .+2 ; 0x12ee <f_open+0x66> 3570 140e: 09 f4 brne .+2 ; 0x1412 <f_open+0x64>
3275 12ec: 29 c3 rjmp .+1618 ; 0x1940 <f_open+0x6b8> 3571 1410: ab c3 rjmp .+1878 ; 0x1b68 <f_open+0x7ba>
3276 12ee: 82 fd sbrc r24, 2 3572 1412: 82 fd sbrc r24, 2
3277 12f0: 07 c1 rjmp .+526 ; 0x1500 <f_open+0x278> 3573 1414: 07 c1 rjmp .+526 ; 0x1624 <f_open+0x276>
3278 12f2: 26 c3 rjmp .+1612 ; 0x1940 <f_open+0x6b8> 3574 1416: a8 c3 rjmp .+1872 ; 0x1b68 <f_open+0x7ba>
3279 } 3575 }
3280 } 3576 }
3281   3577  
3282 /* The logical drive has not been mounted, following code attempts to mount the logical drive */ 3578 /* The logical drive has not been mounted, following code attempts to mount the logical drive */
3283   3579  
3284 memset(fs, 0, sizeof(FATFS)); /* Clean-up the file system object */ 3580 memset(fs, 0, sizeof(FATFS)); /* Clean-up the file system object */
3285 12f4: 80 e2 ldi r24, 0x20 ; 32 3581 1418: 80 e2 ldi r24, 0x20 ; 32
3286 12f6: 92 e0 ldi r25, 0x02 ; 2 3582 141a: 92 e0 ldi r25, 0x02 ; 2
-   3583 141c: f4 01 movw r30, r8
3287 12f8: d5 01 movw r26, r10 3584 141e: 9c 01 movw r18, r24
3288 12fa: 1d 92 st X+, r1 3585 1420: 11 92 st Z+, r1
3289 12fc: 01 97 sbiw r24, 0x01 ; 1 3586 1422: 21 50 subi r18, 0x01 ; 1
-   3587 1424: 30 40 sbci r19, 0x00 ; 0
3290 12fe: e9 f7 brne .-6 ; 0x12fa <f_open+0x72> 3588 1426: e1 f7 brne .-8 ; 0x1420 <f_open+0x72>
3291 stat = disk_initialize(0); /* Initialize low level disk I/O layer */ 3589 stat = disk_initialize(0); /* Initialize low level disk I/O layer */
3292 1300: 80 e0 ldi r24, 0x00 ; 0 3590 1428: 80 e0 ldi r24, 0x00 ; 0
3293 1302: 0e 94 ae 0f call 0x1f5c ; 0x1f5c <disk_initialize> 3591 142a: 0e 94 b8 0e call 0x1d70 ; 0x1d70 <disk_initialize>
3294 if (stat & STA_NOINIT) /* Check if the drive is ready */ 3592 if (stat & STA_NOINIT) /* Check if the drive is ready */
3295 1306: 99 27 eor r25, r25 -  
3296 1308: 80 ff sbrs r24, 0 3593 142e: 80 ff sbrs r24, 0
3297 130a: 03 c0 rjmp .+6 ; 0x1312 <f_open+0x8a> 3594 1430: 03 c0 rjmp .+6 ; 0x1438 <f_open+0x8a>
3298 130c: 21 e0 ldi r18, 0x01 ; 1 3595 1432: 21 e0 ldi r18, 0x01 ; 1
3299 130e: 30 e0 ldi r19, 0x00 ; 0 3596 1434: 30 e0 ldi r19, 0x00 ; 0
3300 1310: 45 c3 rjmp .+1674 ; 0x199c <f_open+0x714> 3597 1436: 8b c3 rjmp .+1814 ; 0x1b4e <f_open+0x7a0>
3301 return FR_NOT_READY; 3598 return FR_NOT_READY;
3302 #if !_FS_READONLY 3599 #if !_FS_READONLY
3303 if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */ 3600 if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
3304 1312: 11 23 and r17, r17 3601 1438: 11 23 and r17, r17
3305 1314: 11 f0 breq .+4 ; 0x131a <f_open+0x92> 3602 143a: 11 f0 breq .+4 ; 0x1440 <f_open+0x92>
3306 1316: 82 fd sbrc r24, 2 3603 143c: 82 fd sbrc r24, 2
3307 1318: f3 c0 rjmp .+486 ; 0x1500 <f_open+0x278> 3604 143e: f2 c0 rjmp .+484 ; 0x1624 <f_open+0x276>
3308 return FR_WRITE_PROTECTED; 3605 return FR_WRITE_PROTECTED;
3309 #endif 3606 #endif
3310   3607  
3311 /* Search FAT partition on the drive */ 3608 /* Search FAT partition on the drive */
3312 fmt = check_fs(bootsect = 0); /* Check sector 0 as an SFD format */ 3609 fmt = check_fs(bootsect = 0); /* Check sector 0 as an SFD format */
3313 131a: 60 e0 ldi r22, 0x00 ; 0 3610 1440: 60 e0 ldi r22, 0x00 ; 0
3314 131c: 70 e0 ldi r23, 0x00 ; 0 3611 1442: 70 e0 ldi r23, 0x00 ; 0
3315 131e: 80 e0 ldi r24, 0x00 ; 0 3612 1444: 80 e0 ldi r24, 0x00 ; 0
3316 1320: 90 e0 ldi r25, 0x00 ; 0 3613 1446: 90 e0 ldi r25, 0x00 ; 0
3317 1322: 0e 94 11 09 call 0x1222 ; 0x1222 <check_fs> 3614 1448: 0e 94 a8 09 call 0x1350 ; 0x1350 <check_fs>
3318 if (fmt == 1) { /* Not a FAT boot record, it may be patitioned */ 3615 if (fmt == 1) { /* Not a FAT boot record, it may be patitioned */
3319 1326: 81 30 cpi r24, 0x01 ; 1 3616 144c: 81 30 cpi r24, 0x01 ; 1
3320 1328: 21 f0 breq .+8 ; 0x1332 <f_open+0xaa> 3617 144e: 21 f0 breq .+8 ; 0x1458 <f_open+0xaa>
3321 132a: ee 24 eor r14, r14 3618 1450: ee 24 eor r14, r14
3322 132c: ff 24 eor r15, r15 3619 1452: ff 24 eor r15, r15
3323 132e: 87 01 movw r16, r14 3620 1454: 87 01 movw r16, r14
3324 1330: 1e c0 rjmp .+60 ; 0x136e <f_open+0xe6> 3621 1456: 1e c0 rjmp .+60 ; 0x1494 <f_open+0xe6>
3325 /* Check a partition listed in top of the partition table */ 3622 /* Check a partition listed in top of the partition table */
3326 if (fs->win[MBR_Table+4]) { /* Is the 1st partition existing? */ 3623 if (fs->win[MBR_Table+4]) { /* Is the 1st partition existing? */
3327 1332: e2 ee ldi r30, 0xE2 ; 226 3624 1458: 82 ee ldi r24, 0xE2 ; 226
3328 1334: f1 e0 ldi r31, 0x01 ; 1 3625 145a: 91 e0 ldi r25, 0x01 ; 1
3329 1336: ae 0e add r10, r30 3626 145c: 88 0e add r8, r24
3330 1338: bf 1e adc r11, r31 3627 145e: 99 1e adc r9, r25
3331 133a: d5 01 movw r26, r10 3628 1460: f4 01 movw r30, r8
3332 133c: 8c 91 ld r24, X 3629 1462: 80 81 ld r24, Z
3333 133e: ee e1 ldi r30, 0x1E ; 30 3630 1464: 2e e1 ldi r18, 0x1E ; 30
3334 1340: fe ef ldi r31, 0xFE ; 254 3631 1466: 3e ef ldi r19, 0xFE ; 254
3335 1342: ae 0e add r10, r30 3632 1468: 82 0e add r8, r18
3336 1344: bf 1e adc r11, r31 3633 146a: 93 1e adc r9, r19
3337 1346: 88 23 and r24, r24 3634 146c: 88 23 and r24, r24
3338 1348: 09 f4 brne .+2 ; 0x134c <f_open+0xc4> 3635 146e: 09 f4 brne .+2 ; 0x1472 <f_open+0xc4>
3339 134a: dd c0 rjmp .+442 ; 0x1506 <f_open+0x27e> 3636 1470: dc c0 rjmp .+440 ; 0x162a <f_open+0x27c>
3340 bootsect = LD_DWORD(&fs->win[MBR_Table+8]); /* Partition offset in LBA */ 3637 bootsect = LD_DWORD(&fs->win[MBR_Table+8]); /* Partition offset in LBA */
3341 134c: 26 ee ldi r18, 0xE6 ; 230 3638 1472: 86 ee ldi r24, 0xE6 ; 230
3342 134e: 31 e0 ldi r19, 0x01 ; 1 3639 1474: 91 e0 ldi r25, 0x01 ; 1
3343 1350: a2 0e add r10, r18 3640 1476: 88 0e add r8, r24
3344 1352: b3 1e adc r11, r19 3641 1478: 99 1e adc r9, r25
3345 1354: d5 01 movw r26, r10 3642 147a: f4 01 movw r30, r8
3346 1356: ed 90 ld r14, X+ 3643 147c: e0 80 ld r14, Z
3347 1358: fd 90 ld r15, X+ 3644 147e: f1 80 ldd r15, Z+1 ; 0x01
3348 135a: 0d 91 ld r16, X+ 3645 1480: 02 81 ldd r16, Z+2 ; 0x02
3349 135c: 1c 91 ld r17, X 3646 1482: 13 81 ldd r17, Z+3 ; 0x03
3350 135e: ea e1 ldi r30, 0x1A ; 26 3647 1484: 2a e1 ldi r18, 0x1A ; 26
3351 1360: fe ef ldi r31, 0xFE ; 254 3648 1486: 3e ef ldi r19, 0xFE ; 254
3352 1362: ae 0e add r10, r30 3649 1488: 82 0e add r8, r18
3353 1364: bf 1e adc r11, r31 3650 148a: 93 1e adc r9, r19
3354 fmt = check_fs(bootsect); /* Check the partition */ 3651 fmt = check_fs(bootsect); /* Check the partition */
3355 1366: c8 01 movw r24, r16 3652 148c: c8 01 movw r24, r16
3356 1368: b7 01 movw r22, r14 3653 148e: b7 01 movw r22, r14
3357 136a: 0e 94 11 09 call 0x1222 ; 0x1222 <check_fs> 3654 1490: 0e 94 a8 09 call 0x1350 ; 0x1350 <check_fs>
3358 } 3655 }
3359 } 3656 }
3360 if (fmt || LD_WORD(&fs->win[BPB_BytsPerSec]) != 512) /* No valid FAT patition is found */ 3657 if (fmt || LD_WORD(&fs->win[BPB_BytsPerSec]) != 512) /* No valid FAT patition is found */
3361 136e: 88 23 and r24, r24 3658 1494: 88 23 and r24, r24
3362 1370: 09 f0 breq .+2 ; 0x1374 <f_open+0xec> 3659 1496: 09 f0 breq .+2 ; 0x149a <f_open+0xec>
3363 1372: c9 c0 rjmp .+402 ; 0x1506 <f_open+0x27e> 3660 1498: c8 c0 rjmp .+400 ; 0x162a <f_open+0x27c>
3364 1374: f5 01 movw r30, r10 3661 149a: f4 01 movw r30, r8
3365 1376: 83 a5 ldd r24, Z+43 ; 0x2b 3662 149c: 83 a5 ldd r24, Z+43 ; 0x2b
3366 1378: 94 a5 ldd r25, Z+44 ; 0x2c 3663 149e: 94 a5 ldd r25, Z+44 ; 0x2c
3367 137a: 80 50 subi r24, 0x00 ; 0 3664 14a0: 80 50 subi r24, 0x00 ; 0
3368 137c: 92 40 sbci r25, 0x02 ; 2 3665 14a2: 92 40 sbci r25, 0x02 ; 2
3369 137e: 09 f0 breq .+2 ; 0x1382 <f_open+0xfa> 3666 14a4: 09 f0 breq .+2 ; 0x14a8 <f_open+0xfa>
3370 1380: c2 c0 rjmp .+388 ; 0x1506 <f_open+0x27e> 3667 14a6: c1 c0 rjmp .+386 ; 0x162a <f_open+0x27c>
3371 return FR_NO_FILESYSTEM; 3668 return FR_NO_FILESYSTEM;
3372   3669  
3373 /* Initialize the file system object */ 3670 /* Initialize the file system object */
3374 fatsize = LD_WORD(&fs->win[BPB_FATSz16]); /* Number of sectors per FAT */ 3671 fatsize = LD_WORD(&fs->win[BPB_FATSz16]); /* Number of sectors per FAT */
3375 1382: f5 01 movw r30, r10 3672 14a8: f4 01 movw r30, r8
3376 1384: 66 a9 ldd r22, Z+54 ; 0x36 3673 14aa: 86 a9 ldd r24, Z+54 ; 0x36
3377 1386: 77 a9 ldd r23, Z+55 ; 0x37 3674 14ac: 97 a9 ldd r25, Z+55 ; 0x37
-   3675 14ae: bc 01 movw r22, r24
-   3676 14b0: 80 e0 ldi r24, 0x00 ; 0
-   3677 14b2: 90 e0 ldi r25, 0x00 ; 0
3378 if (!fatsize) fatsize = LD_DWORD(&fs->win[BPB_FATSz32]); 3678 if (!fatsize) fatsize = LD_DWORD(&fs->win[BPB_FATSz32]);
3379 1388: 61 15 cp r22, r1 3679 14b4: 61 15 cp r22, r1
3380 138a: 71 05 cpc r23, r1 3680 14b6: 71 05 cpc r23, r1
3381 138c: 19 f0 breq .+6 ; 0x1394 <f_open+0x10c> -  
3382 } -  
3383 if (fmt || LD_WORD(&fs->win[BPB_BytsPerSec]) != 512) /* No valid FAT patition is found */ -  
3384 return FR_NO_FILESYSTEM; -  
3385   -  
3386 /* Initialize the file system object */ -  
3387 fatsize = LD_WORD(&fs->win[BPB_FATSz16]); /* Number of sectors per FAT */ -  
3388 138e: 88 27 eor r24, r24 3681 14b8: 81 05 cpc r24, r1
3389 1390: 99 27 eor r25, r25 3682 14ba: 91 05 cpc r25, r1
3390 1392: 0d c0 rjmp .+26 ; 0x13ae <f_open+0x126> 3683 14bc: 69 f4 brne .+26 ; 0x14d8 <f_open+0x12a>
3391 if (!fatsize) fatsize = LD_DWORD(&fs->win[BPB_FATSz32]); -  
3392 1394: 24 e4 ldi r18, 0x44 ; 68 3684 14be: 24 e4 ldi r18, 0x44 ; 68
3393 1396: 30 e0 ldi r19, 0x00 ; 0 3685 14c0: 30 e0 ldi r19, 0x00 ; 0
3394 1398: a2 0e add r10, r18 3686 14c2: 82 0e add r8, r18
3395 139a: b3 1e adc r11, r19 3687 14c4: 93 1e adc r9, r19
3396 139c: d5 01 movw r26, r10 3688 14c6: f4 01 movw r30, r8
3397 139e: 6d 91 ld r22, X+ 3689 14c8: 60 81 ld r22, Z
3398 13a0: 7d 91 ld r23, X+ 3690 14ca: 71 81 ldd r23, Z+1 ; 0x01
3399 13a2: 8d 91 ld r24, X+ 3691 14cc: 82 81 ldd r24, Z+2 ; 0x02
3400 13a4: 9c 91 ld r25, X 3692 14ce: 93 81 ldd r25, Z+3 ; 0x03
3401 13a6: ec eb ldi r30, 0xBC ; 188 3693 14d0: 2c eb ldi r18, 0xBC ; 188
3402 13a8: ff ef ldi r31, 0xFF ; 255 3694 14d2: 3f ef ldi r19, 0xFF ; 255
3403 13aa: ae 0e add r10, r30 3695 14d4: 82 0e add r8, r18
3404 13ac: bf 1e adc r11, r31 3696 14d6: 93 1e adc r9, r19
3405 fs->sects_fat = (CLUST)fatsize; 3697 fs->sects_fat = (CLUST)fatsize;
3406 13ae: f5 01 movw r30, r10 3698 14d8: f4 01 movw r30, r8
3407 13b0: 75 8b std Z+21, r23 ; 0x15 3699 14da: 75 8b std Z+21, r23 ; 0x15
3408 13b2: 64 8b std Z+20, r22 ; 0x14 3700 14dc: 64 8b std Z+20, r22 ; 0x14
3409 fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */ -  
3410 13b4: 20 a9 ldd r18, Z+48 ; 0x30 -  
3411 13b6: 26 8f std Z+30, r18 ; 0x1e -  
3412 fatsize *= fs->n_fats; /* (Number of sectors in FAT area) */ -  
3413 13b8: 33 27 eor r19, r19 -  
3414 13ba: 44 27 eor r20, r20 -  
3415 13bc: 55 27 eor r21, r21 -  
3416 13be: 0e 94 e9 10 call 0x21d2 ; 0x21d2 <__mulsi3> -  
3417 13c2: 3b 01 movw r6, r22 -  
3418 13c4: 4c 01 movw r8, r24 -  
3419 fs->fatbase = bootsect + LD_WORD(&fs->win[BPB_RsvdSecCnt]); /* FAT start sector (lba) */ -  
3420 13c6: a5 01 movw r20, r10 -  
3421 13c8: 42 5d subi r20, 0xD2 ; 210 -  
3422 13ca: 5f 4f sbci r21, 0xFF ; 255 -  
3423 13cc: f5 01 movw r30, r10 -  
3424 13ce: 86 a5 ldd r24, Z+46 ; 0x2e -  
3425 13d0: 97 a5 ldd r25, Z+47 ; 0x2f -  
3426 13d2: aa 27 eor r26, r26 -  
3427 13d4: bb 27 eor r27, r27 -  
3428 13d6: e8 0e add r14, r24 -  
3429 13d8: f9 1e adc r15, r25 -  
3430 13da: 0a 1f adc r16, r26 -  
3431 13dc: 1b 1f adc r17, r27 -  
3432 13de: e0 86 std Z+8, r14 ; 0x08 -  
3433 13e0: f1 86 std Z+9, r15 ; 0x09 -  
3434 13e2: 02 87 std Z+10, r16 ; 0x0a -  
3435 13e4: 13 87 std Z+11, r17 ; 0x0b -  
3436 fs->sects_clust = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */ -  
3437 13e6: 85 a5 ldd r24, Z+45 ; 0x2d -  
3438 13e8: 85 8f std Z+29, r24 ; 0x1d -  
3439 fs->n_rootdir = LD_WORD(&fs->win[BPB_RootEntCnt]); /* Nmuber of root directory entries */ -  
3440 13ea: 21 a9 ldd r18, Z+49 ; 0x31 -  
3441 13ec: 32 a9 ldd r19, Z+50 ; 0x32 -  
3442 13ee: 33 83 std Z+3, r19 ; 0x03 -  
3443 13f0: 22 83 std Z+2, r18 ; 0x02 -  
3444 totalsect = LD_WORD(&fs->win[BPB_TotSec16]); /* Number of sectors on the file system */ -  
3445 13f2: 63 a9 ldd r22, Z+51 ; 0x33 -  
3446 13f4: 74 a9 ldd r23, Z+52 ; 0x34 -  
3447 if (!totalsect) totalsect = LD_DWORD(&fs->win[BPB_TotSec32]); -  
3448 13f6: 61 15 cp r22, r1 -  
3449 13f8: 71 05 cpc r23, r1 -  
3450 13fa: 21 f0 breq .+8 ; 0x1404 <f_open+0x17c> -  
3451 fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */ 3701 fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FAT copies */
-   3702 14de: 20 a9 ldd r18, Z+48 ; 0x30
-   3703 14e0: 26 8f std Z+30, r18 ; 0x1e
3452 fatsize *= fs->n_fats; /* (Number of sectors in FAT area) */ 3704 fatsize *= fs->n_fats; /* (Number of sectors in FAT area) */
-   3705 14e2: 30 e0 ldi r19, 0x00 ; 0
-   3706 14e4: 40 e0 ldi r20, 0x00 ; 0
-   3707 14e6: 50 e0 ldi r21, 0x00 ; 0
-   3708 14e8: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   3709 14ec: 5b 01 movw r10, r22
-   3710 14ee: 6c 01 movw r12, r24
3453 fs->fatbase = bootsect + LD_WORD(&fs->win[BPB_RsvdSecCnt]); /* FAT start sector (lba) */ 3711 fs->fatbase = bootsect + LD_WORD(&fs->win[BPB_RsvdSecCnt]); /* FAT start sector (lba) */
-   3712 14f0: f4 01 movw r30, r8
-   3713 14f2: 86 a5 ldd r24, Z+46 ; 0x2e
-   3714 14f4: 97 a5 ldd r25, Z+47 ; 0x2f
-   3715 14f6: a0 e0 ldi r26, 0x00 ; 0
-   3716 14f8: b0 e0 ldi r27, 0x00 ; 0
-   3717 14fa: e8 0e add r14, r24
-   3718 14fc: f9 1e adc r15, r25
-   3719 14fe: 0a 1f adc r16, r26
-   3720 1500: 1b 1f adc r17, r27
-   3721 1502: e0 86 std Z+8, r14 ; 0x08
-   3722 1504: f1 86 std Z+9, r15 ; 0x09
-   3723 1506: 02 87 std Z+10, r16 ; 0x0a
-   3724 1508: 13 87 std Z+11, r17 ; 0x0b
3454 fs->sects_clust = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */ 3725 fs->sects_clust = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */
-   3726 150a: 85 a5 ldd r24, Z+45 ; 0x2d
-   3727 150c: 85 8f std Z+29, r24 ; 0x1d
3455 fs->n_rootdir = LD_WORD(&fs->win[BPB_RootEntCnt]); /* Nmuber of root directory entries */ 3728 fs->n_rootdir = LD_WORD(&fs->win[BPB_RootEntCnt]); /* Nmuber of root directory entries */
-   3729 150e: 21 a9 ldd r18, Z+49 ; 0x31
-   3730 1510: 32 a9 ldd r19, Z+50 ; 0x32
-   3731 1512: 33 83 std Z+3, r19 ; 0x03
-   3732 1514: 22 83 std Z+2, r18 ; 0x02
3456 totalsect = LD_WORD(&fs->win[BPB_TotSec16]); /* Number of sectors on the file system */ 3733 totalsect = LD_WORD(&fs->win[BPB_TotSec16]); /* Number of sectors on the file system */
-   3734 1516: 83 a9 ldd r24, Z+51 ; 0x33
3457 13fc: 7b 01 movw r14, r22 3735 1518: 94 a9 ldd r25, Z+52 ; 0x34
3458 13fe: 00 27 eor r16, r16 3736 151a: 7c 01 movw r14, r24
3459 1400: 11 27 eor r17, r17 3737 151c: 00 e0 ldi r16, 0x00 ; 0
3460 1402: 0d c0 rjmp .+26 ; 0x141e <f_open+0x196> 3738 151e: 10 e0 ldi r17, 0x00 ; 0
3461 if (!totalsect) totalsect = LD_DWORD(&fs->win[BPB_TotSec32]); 3739 if (!totalsect) totalsect = LD_DWORD(&fs->win[BPB_TotSec32]);
-   3740 1520: e1 14 cp r14, r1
-   3741 1522: f1 04 cpc r15, r1
-   3742 1524: 01 05 cpc r16, r1
-   3743 1526: 11 05 cpc r17, r1
-   3744 1528: 69 f4 brne .+26 ; 0x1544 <f_open+0x196>
3462 1404: 80 e4 ldi r24, 0x40 ; 64 3745 152a: 80 e4 ldi r24, 0x40 ; 64
3463 1406: 90 e0 ldi r25, 0x00 ; 0 3746 152c: 90 e0 ldi r25, 0x00 ; 0
3464 1408: a8 0e add r10, r24 3747 152e: 88 0e add r8, r24
3465 140a: b9 1e adc r11, r25 3748 1530: 99 1e adc r9, r25
3466 140c: d5 01 movw r26, r10 3749 1532: f4 01 movw r30, r8
3467 140e: ed 90 ld r14, X+ 3750 1534: e0 80 ld r14, Z
3468 1410: fd 90 ld r15, X+ 3751 1536: f1 80 ldd r15, Z+1 ; 0x01
3469 1412: 0d 91 ld r16, X+ 3752 1538: 02 81 ldd r16, Z+2 ; 0x02
3470 1414: 1c 91 ld r17, X 3753 153a: 13 81 ldd r17, Z+3 ; 0x03
3471 1416: e0 ec ldi r30, 0xC0 ; 192 3754 153c: 80 ec ldi r24, 0xC0 ; 192
3472 1418: ff ef ldi r31, 0xFF ; 255 3755 153e: 9f ef ldi r25, 0xFF ; 255
3473 141a: ae 0e add r10, r30 3756 1540: 88 0e add r8, r24
3474 141c: bf 1e adc r11, r31 3757 1542: 99 1e adc r9, r25
3475 fs->max_clust = maxclust = (totalsect /* Last cluster# + 1 */ 3758 fs->max_clust = maxclust = (totalsect /* Last cluster# + 1 */
3476 141e: da 01 movw r26, r20 3759 1544: f4 01 movw r30, r8
3477 1420: 8d 91 ld r24, X+ 3760 1546: 86 a5 ldd r24, Z+46 ; 0x2e
3478 1422: 9c 91 ld r25, X 3761 1548: 97 a5 ldd r25, Z+47 ; 0x2f
3479 1424: aa 27 eor r26, r26 3762 154a: a0 e0 ldi r26, 0x00 ; 0
3480 1426: bb 27 eor r27, r27 3763 154c: b0 e0 ldi r27, 0x00 ; 0
3481 1428: e8 1a sub r14, r24 3764 154e: e8 1a sub r14, r24
3482 142a: f9 0a sbc r15, r25 3765 1550: f9 0a sbc r15, r25
3483 142c: 0a 0b sbc r16, r26 3766 1552: 0a 0b sbc r16, r26
3484 142e: 1b 0b sbc r17, r27 3767 1554: 1b 0b sbc r17, r27
3485 1430: e6 18 sub r14, r6 3768 1556: ea 18 sub r14, r10
3486 1432: f7 08 sbc r15, r7 3769 1558: fb 08 sbc r15, r11
3487 1434: 08 09 sbc r16, r8 3770 155a: 0c 09 sbc r16, r12
3488 1436: 19 09 sbc r17, r9 3771 155c: 1d 09 sbc r17, r13
3489 1438: e4 e0 ldi r30, 0x04 ; 4 3772 155e: a4 e0 ldi r26, 0x04 ; 4
3490 143a: 36 95 lsr r19 3773 1560: 36 95 lsr r19
3491 143c: 27 95 ror r18 3774 1562: 27 95 ror r18
3492 143e: ea 95 dec r30 3775 1564: aa 95 dec r26
3493 1440: e1 f7 brne .-8 ; 0x143a <f_open+0x1b2> 3776 1566: e1 f7 brne .-8 ; 0x1560 <f_open+0x1b2>
3494 1442: c9 01 movw r24, r18 3777 1568: c9 01 movw r24, r18
3495 1444: aa 27 eor r26, r26 3778 156a: a0 e0 ldi r26, 0x00 ; 0
3496 1446: bb 27 eor r27, r27 3779 156c: b0 e0 ldi r27, 0x00 ; 0
3497 1448: e8 1a sub r14, r24 3780 156e: e8 1a sub r14, r24
3498 144a: f9 0a sbc r15, r25 3781 1570: f9 0a sbc r15, r25
3499 144c: 0a 0b sbc r16, r26 3782 1572: 0a 0b sbc r16, r26
3500 144e: 1b 0b sbc r17, r27 3783 1574: 1b 0b sbc r17, r27
3501 1450: f5 01 movw r30, r10 -  
3502 1452: 25 8d ldd r18, Z+29 ; 0x1d 3784 1576: 25 8d ldd r18, Z+29 ; 0x1d
3503 1454: 33 27 eor r19, r19 3785 1578: 30 e0 ldi r19, 0x00 ; 0
3504 1456: 44 27 eor r20, r20 3786 157a: 40 e0 ldi r20, 0x00 ; 0
3505 1458: 55 27 eor r21, r21 3787 157c: 50 e0 ldi r21, 0x00 ; 0
3506 145a: c8 01 movw r24, r16 3788 157e: c8 01 movw r24, r16
3507 145c: b7 01 movw r22, r14 3789 1580: b7 01 movw r22, r14
3508 145e: 0e 94 08 11 call 0x2210 ; 0x2210 <__udivmodsi4> 3790 1582: 0e 94 a5 14 call 0x294a ; 0x294a <__udivmodsi4>
3509 1462: 2e 5f subi r18, 0xFE ; 254 3791 1586: 2e 5f subi r18, 0xFE ; 254
3510 1464: 3f 4f sbci r19, 0xFF ; 255 3792 1588: 3f 4f sbci r19, 0xFF ; 255
3511 1466: 4f 4f sbci r20, 0xFF ; 255 3793 158a: 4f 4f sbci r20, 0xFF ; 255
3512 1468: 5f 4f sbci r21, 0xFF ; 255 3794 158c: 5f 4f sbci r21, 0xFF ; 255
3513 146a: f5 01 movw r30, r10 3795 158e: f4 01 movw r30, r8
3514 146c: 37 8b std Z+23, r19 ; 0x17 3796 1590: 37 8b std Z+23, r19 ; 0x17
3515 146e: 26 8b std Z+22, r18 ; 0x16 3797 1592: 26 8b std Z+22, r18 ; 0x16
3516 - LD_WORD(&fs->win[BPB_RsvdSecCnt]) - fatsize - fs->n_rootdir / 16 3798 - LD_WORD(&fs->win[BPB_RsvdSecCnt]) - fatsize - fs->n_rootdir / 16
3517 ) / fs->sects_clust + 2; 3799 ) / fs->sects_clust + 2;
3518   3800  
3519 fmt = FS_FAT12; /* Determine the FAT sub type */ 3801 fmt = FS_FAT12; /* Determine the FAT sub type */
3520 if (maxclust > 0xFF7) fmt = FS_FAT16; 3802 if (maxclust > 0xFF7) fmt = FS_FAT16;
3521 1470: 28 3f cpi r18, 0xF8 ; 248 3803 1594: 28 3f cpi r18, 0xF8 ; 248
3522 1472: ff e0 ldi r31, 0x0F ; 15 3804 1596: ff e0 ldi r31, 0x0F ; 15
3523 1474: 3f 07 cpc r19, r31 3805 1598: 3f 07 cpc r19, r31
3524 1476: f0 e0 ldi r31, 0x00 ; 0 3806 159a: f0 e0 ldi r31, 0x00 ; 0
3525 1478: 4f 07 cpc r20, r31 3807 159c: 4f 07 cpc r20, r31
3526 147a: f0 e0 ldi r31, 0x00 ; 0 3808 159e: f0 e0 ldi r31, 0x00 ; 0
3527 147c: 5f 07 cpc r21, r31 3809 15a0: 5f 07 cpc r21, r31
3528 147e: 10 f4 brcc .+4 ; 0x1484 <f_open+0x1fc> 3810 15a2: 10 f4 brcc .+4 ; 0x15a8 <f_open+0x1fa>
3529 1480: 61 e0 ldi r22, 0x01 ; 1 3811 15a4: 61 e0 ldi r22, 0x01 ; 1
3530 1482: 06 c0 rjmp .+12 ; 0x1490 <f_open+0x208> 3812 15a6: 06 c0 rjmp .+12 ; 0x15b4 <f_open+0x206>
3531 if (maxclust > 0xFFF7) 3813 if (maxclust > 0xFFF7)
3532 1484: 28 5f subi r18, 0xF8 ; 248 3814 15a8: 28 5f subi r18, 0xF8 ; 248
3533 1486: 3f 4f sbci r19, 0xFF ; 255 3815 15aa: 3f 4f sbci r19, 0xFF ; 255
3534 1488: 40 40 sbci r20, 0x00 ; 0 3816 15ac: 40 40 sbci r20, 0x00 ; 0
3535 148a: 50 40 sbci r21, 0x00 ; 0 3817 15ae: 50 40 sbci r21, 0x00 ; 0
3536 148c: e0 f5 brcc .+120 ; 0x1506 <f_open+0x27e> 3818 15b0: e0 f5 brcc .+120 ; 0x162a <f_open+0x27c>
3537 148e: 62 e0 ldi r22, 0x02 ; 2 3819 15b2: 62 e0 ldi r22, 0x02 ; 2
3538 fmt = FS_FAT32; 3820 fmt = FS_FAT32;
3539 if (fmt == FS_FAT32) 3821 if (fmt == FS_FAT32)
3540 fs->dirbase = LD_DWORD(&fs->win[BPB_RootClus]); /* Root directory start cluster */ 3822 fs->dirbase = LD_DWORD(&fs->win[BPB_RootClus]); /* Root directory start cluster */
3541 else 3823 else
3542 #endif 3824 #endif
3543 fs->dirbase = fs->fatbase + fatsize; /* Root directory start sector (lba) */ 3825 fs->dirbase = fs->fatbase + fatsize; /* Root directory start sector (lba) */
3544 1490: f5 01 movw r30, r10 3826 15b4: f4 01 movw r30, r8
3545 1492: 20 85 ldd r18, Z+8 ; 0x08 3827 15b6: 20 85 ldd r18, Z+8 ; 0x08
3546 1494: 31 85 ldd r19, Z+9 ; 0x09 3828 15b8: 31 85 ldd r19, Z+9 ; 0x09
3547 1496: 42 85 ldd r20, Z+10 ; 0x0a 3829 15ba: 42 85 ldd r20, Z+10 ; 0x0a
3548 1498: 53 85 ldd r21, Z+11 ; 0x0b 3830 15bc: 53 85 ldd r21, Z+11 ; 0x0b
3549 149a: d4 01 movw r26, r8 3831 15be: d6 01 movw r26, r12
3550 149c: c3 01 movw r24, r6 3832 15c0: c5 01 movw r24, r10
3551 149e: 82 0f add r24, r18 3833 15c2: 82 0f add r24, r18
3552 14a0: 93 1f adc r25, r19 3834 15c4: 93 1f adc r25, r19
3553 14a2: a4 1f adc r26, r20 3835 15c6: a4 1f adc r26, r20
3554 14a4: b5 1f adc r27, r21 3836 15c8: b5 1f adc r27, r21
3555 14a6: 84 87 std Z+12, r24 ; 0x0c 3837 15ca: 84 87 std Z+12, r24 ; 0x0c
3556 14a8: 95 87 std Z+13, r25 ; 0x0d 3838 15cc: 95 87 std Z+13, r25 ; 0x0d
3557 14aa: a6 87 std Z+14, r26 ; 0x0e 3839 15ce: a6 87 std Z+14, r26 ; 0x0e
3558 14ac: b7 87 std Z+15, r27 ; 0x0f 3840 15d0: b7 87 std Z+15, r27 ; 0x0f
3559 fs->database = fs->fatbase + fatsize + fs->n_rootdir / 16; /* Data start sector (lba) */ 3841 fs->database = fs->fatbase + fatsize + fs->n_rootdir / 16; /* Data start sector (lba) */
3560 14ae: 82 81 ldd r24, Z+2 ; 0x02 3842 15d2: 82 81 ldd r24, Z+2 ; 0x02
3561 14b0: 93 81 ldd r25, Z+3 ; 0x03 3843 15d4: 93 81 ldd r25, Z+3 ; 0x03
3562 14b2: 74 e0 ldi r23, 0x04 ; 4 3844 15d6: 74 e0 ldi r23, 0x04 ; 4
3563 14b4: 96 95 lsr r25 3845 15d8: 96 95 lsr r25
3564 14b6: 87 95 ror r24 3846 15da: 87 95 ror r24
3565 14b8: 7a 95 dec r23 3847 15dc: 7a 95 dec r23
3566 14ba: e1 f7 brne .-8 ; 0x14b4 <f_open+0x22c> 3848 15de: e1 f7 brne .-8 ; 0x15d8 <f_open+0x22a>
3567 14bc: aa 27 eor r26, r26 3849 15e0: a0 e0 ldi r26, 0x00 ; 0
3568 14be: bb 27 eor r27, r27 3850 15e2: b0 e0 ldi r27, 0x00 ; 0
3569 14c0: 82 0f add r24, r18 3851 15e4: 82 0f add r24, r18
3570 14c2: 93 1f adc r25, r19 3852 15e6: 93 1f adc r25, r19
3571 14c4: a4 1f adc r26, r20 3853 15e8: a4 1f adc r26, r20
3572 14c6: b5 1f adc r27, r21 3854 15ea: b5 1f adc r27, r21
3573 14c8: 86 0d add r24, r6 3855 15ec: 8a 0d add r24, r10
3574 14ca: 97 1d adc r25, r7 3856 15ee: 9b 1d adc r25, r11
3575 14cc: a8 1d adc r26, r8 3857 15f0: ac 1d adc r26, r12
3576 14ce: b9 1d adc r27, r9 3858 15f2: bd 1d adc r27, r13
3577 14d0: 80 8b std Z+16, r24 ; 0x10 3859 15f4: 80 8b std Z+16, r24 ; 0x10
3578 14d2: 91 8b std Z+17, r25 ; 0x11 3860 15f6: 91 8b std Z+17, r25 ; 0x11
3579 14d4: a2 8b std Z+18, r26 ; 0x12 3861 15f8: a2 8b std Z+18, r26 ; 0x12
3580 14d6: b3 8b std Z+19, r27 ; 0x13 3862 15fa: b3 8b std Z+19, r27 ; 0x13
3581 fs->fs_type = fmt; /* FAT sub-type */ 3863 fs->fs_type = fmt; /* FAT sub-type */
3582 14d8: 64 8f std Z+28, r22 ; 0x1c 3864 15fc: 64 8f std Z+28, r22 ; 0x1c
3583   3865  
3584 #if !_FS_READONLY 3866 #if !_FS_READONLY
3585 fs->free_clust = (CLUST)0xFFFFFFFF; 3867 fs->free_clust = (CLUST)0xFFFFFFFF;
3586 14da: 8f ef ldi r24, 0xFF ; 255 3868 15fe: 8f ef ldi r24, 0xFF ; 255
3587 14dc: 9f ef ldi r25, 0xFF ; 255 3869 1600: 9f ef ldi r25, 0xFF ; 255
3588 14de: 93 8f std Z+27, r25 ; 0x1b 3870 1602: 93 8f std Z+27, r25 ; 0x1b
3589 14e0: 82 8f std Z+26, r24 ; 0x1a 3871 1604: 82 8f std Z+26, r24 ; 0x1a
3590 fs->free_clust = LD_DWORD(&fs->win[FSI_Free_Count]); 3872 fs->free_clust = LD_DWORD(&fs->win[FSI_Free_Count]);
3591 } 3873 }
3592 } 3874 }
3593 #endif 3875 #endif
3594 #endif 3876 #endif
3595 fs->id = ++fsid; /* File system mount ID */ 3877 fs->id = ++fsid; /* File system mount ID */
3596 14e2: 80 91 0c 01 lds r24, 0x010C 3878 1606: 80 91 12 01 lds r24, 0x0112
3597 14e6: 90 91 0d 01 lds r25, 0x010D 3879 160a: 90 91 13 01 lds r25, 0x0113
3598 14ea: 01 96 adiw r24, 0x01 ; 1 3880 160e: 01 96 adiw r24, 0x01 ; 1
3599 14ec: 90 93 0d 01 sts 0x010D, r25 3881 1610: 90 93 13 01 sts 0x0113, r25
3600 14f0: 80 93 0c 01 sts 0x010C, r24 3882 1614: 80 93 12 01 sts 0x0112, r24
3601 14f4: 91 83 std Z+1, r25 ; 0x01 3883 1618: 91 83 std Z+1, r25 ; 0x01
3602 14f6: 80 83 st Z, r24 3884 161a: 80 83 st Z, r24
3603 14f8: 23 c2 rjmp .+1094 ; 0x1940 <f_open+0x6b8> 3885 161c: a5 c2 rjmp .+1354 ; 0x1b68 <f_open+0x7ba>
3604 14fa: 2a e0 ldi r18, 0x0A ; 10 3886 161e: 2a e0 ldi r18, 0x0A ; 10
3605 14fc: 30 e0 ldi r19, 0x00 ; 0 3887 1620: 30 e0 ldi r19, 0x00 ; 0
3606 14fe: 4e c2 rjmp .+1180 ; 0x199c <f_open+0x714> 3888 1622: 95 c2 rjmp .+1322 ; 0x1b4e <f_open+0x7a0>
3607 1500: 29 e0 ldi r18, 0x09 ; 9 3889 1624: 29 e0 ldi r18, 0x09 ; 9
3608 1502: 30 e0 ldi r19, 0x00 ; 0 3890 1626: 30 e0 ldi r19, 0x00 ; 0
3609 1504: 4b c2 rjmp .+1174 ; 0x199c <f_open+0x714> 3891 1628: 92 c2 rjmp .+1316 ; 0x1b4e <f_open+0x7a0>
3610 1506: 2b e0 ldi r18, 0x0B ; 11 3892 162a: 2b e0 ldi r18, 0x0B ; 11
3611 1508: 30 e0 ldi r19, 0x00 ; 0 3893 162c: 30 e0 ldi r19, 0x00 ; 0
3612 150a: 48 c2 rjmp .+1168 ; 0x199c <f_open+0x714> 3894 162e: 8f c2 rjmp .+1310 ; 0x1b4e <f_open+0x7a0>
3613 150c: 36 01 movw r6, r12 -  
3614 ) 3895 )
3615 { 3896 {
3616 BYTE n, t, c, a, b; 3897 BYTE n, t, c, a, b;
3617   3898  
3618   3899  
3619 memset(dirname, ' ', 8+3); /* Fill buffer with spaces */ 3900 memset(dirname, ' ', 8+3); /* Fill buffer with spaces */
3620 150e: 4e 01 movw r8, r28 3901 1630: 2e 01 movw r4, r28
3621 1510: 08 94 sec 3902 1632: 08 94 sec
3622 1512: 81 1c adc r8, r1 3903 1634: 41 1c adc r4, r1
3623 1514: 91 1c adc r9, r1 3904 1636: 51 1c adc r5, r1
3624 for (;;) { -  
3625 ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */ -  
3626 if (ds == 1) return FR_INVALID_NAME; 3905 ((DWORD)LD_WORD(&dptr[DIR_FstClusHI]) << 16) |
3627 for (;;) { 3906 #endif
3628 if (!move_window(dirobj->sect)) return FR_RW_ERROR; 3907 LD_WORD(&dptr[DIR_FstClusLO]);
3629 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */ 3908 dirobj->clust = dirobj->sclust = clust; /* Restart scannig with the new directory */
3630 1516: 50 e2 ldi r21, 0x20 ; 32 -  
3631 1518: 45 2e mov r4, r21 -  
3632 151a: 51 2c mov r5, r1 -  
3633 151c: 4e 0e add r4, r30 -  
3634 151e: 5f 1e adc r5, r31 -  
3635 if (dptr[DIR_Name] == 0) /* Has it reached to end of dir? */ -  
3636 return !ds ? FR_NO_FILE : FR_NO_PATH; 3909 dirobj->sect = clust2sect(clust);
3637 if (dptr[DIR_Name] != 0xE5 /* Matched? */ -  
3638 && !(dptr[DIR_Attr] & AM_VOL) 3910 dirobj->index = 2;
3639 && !memcmp(&dptr[DIR_Name], fn, 8+3) ) break; -  
3640 if (!next_dir_entry(dirobj)) /* Next directory pointer */ -  
3641 1520: 4d e0 ldi r20, 0x0D ; 13 3911 1638: 92 e0 ldi r25, 0x02 ; 2
3642 1522: 24 2e mov r2, r20 3912 163a: 29 2e mov r2, r25
3643 1524: 31 2c mov r3, r1 3913 163c: 31 2c mov r3, r1
3644 1526: 2c 0e add r2, r28 -  
3645 1528: 3d 1e adc r3, r29 -  
3646 ) 3914 )
3647 { 3915 {
3648 BYTE n, t, c, a, b; 3916 BYTE n, t, c, a, b;
3649   3917  
3650   3918  
3651 memset(dirname, ' ', 8+3); /* Fill buffer with spaces */ 3919 memset(dirname, ' ', 8+3); /* Fill buffer with spaces */
3652 152a: 4b e0 ldi r20, 0x0B ; 11 3920 163e: 4b e0 ldi r20, 0x0B ; 11
3653 152c: 50 e0 ldi r21, 0x00 ; 0 3921 1640: 50 e0 ldi r21, 0x00 ; 0
3654 152e: 60 e2 ldi r22, 0x20 ; 32 3922 1642: 60 e2 ldi r22, 0x20 ; 32
3655 1530: 70 e0 ldi r23, 0x00 ; 0 3923 1644: 70 e0 ldi r23, 0x00 ; 0
3656 1532: c4 01 movw r24, r8 3924 1646: c2 01 movw r24, r4
3657 1534: 0e 94 aa 10 call 0x2154 ; 0x2154 <memset> 3925 1648: 0e 94 ac 11 call 0x2358 ; 0x2358 <memset>
3658 1538: 40 e0 ldi r20, 0x00 ; 0 3926 164c: 20 e0 ldi r18, 0x00 ; 0
3659 153a: 68 e0 ldi r22, 0x08 ; 8 3927 164e: 48 e0 ldi r20, 0x08 ; 8
3660 153c: 30 e0 ldi r19, 0x00 ; 0 3928 1650: 90 e0 ldi r25, 0x00 ; 0
3661 153e: 58 e1 ldi r21, 0x18 ; 24 3929 1652: 38 e1 ldi r19, 0x18 ; 24
3662 1540: 02 c0 rjmp .+4 ; 0x1546 <f_open+0x2be> 3930 1654: 02 c0 rjmp .+4 ; 0x165a <f_open+0x2ac>
3663 1542: 48 e0 ldi r20, 0x08 ; 8 3931 1656: 28 e0 ldi r18, 0x08 ; 8
3664 1544: 6b e0 ldi r22, 0x0B ; 11 3932 1658: 4b e0 ldi r20, 0x0B ; 11
3665 a = 0; b = 0x18; /* NT flag */ 3933 a = 0; b = 0x18; /* NT flag */
3666 n = 0; t = 8; 3934 n = 0; t = 8;
3667 for (;;) { 3935 for (;;) {
3668 c = *(*path)++; 3936 c = *(*path)++;
3669 1546: d3 01 movw r26, r6 3937 165a: f3 01 movw r30, r6
3670 1548: 2d 91 ld r18, X+ 3938 165c: 11 91 ld r17, Z+
3671 154a: 3d 01 movw r6, r26 3939 165e: 3f 01 movw r6, r30
3672 if (c == '\0' || c == '/') { /* Reached to end of str or directory separator */ 3940 if (c == '\0' || c == '/') { /* Reached to end of str or directory separator */
3673 154c: 22 23 and r18, r18 3941 1660: 11 23 and r17, r17
3674 154e: 11 f0 breq .+4 ; 0x1554 <f_open+0x2cc> 3942 1662: 11 f0 breq .+4 ; 0x1668 <f_open+0x2ba>
3675 1550: 2f 32 cpi r18, 0x2F ; 47 3943 1664: 1f 32 cpi r17, 0x2F ; 47
3676 1552: 51 f4 brne .+20 ; 0x1568 <f_open+0x2e0> 3944 1666: 49 f4 brne .+18 ; 0x167a <f_open+0x2cc>
3677 if (n == 0) break; 3945 if (n == 0) break;
3678 1554: 44 23 and r20, r20 3946 1668: 22 23 and r18, r18
3679 1556: 09 f4 brne .+2 ; 0x155a <f_open+0x2d2> 3947 166a: 09 f4 brne .+2 ; 0x166e <f_open+0x2c0>
3680 1558: 43 c0 rjmp .+134 ; 0x15e0 <f_open+0x358> 3948 166c: c7 c0 rjmp .+398 ; 0x17fc <f_open+0x44e>
3681 dirname[11] = _USE_NTFLAG ? (a & b) : 0; 3949 dirname[11] = _USE_NTFLAG ? (a & b) : 0;
3682 155a: 53 23 and r21, r19 3950 166e: 39 23 and r19, r25
3683 155c: 5c 87 std Y+12, r21 ; 0x0c 3951 1670: 3c 87 std Y+12, r19 ; 0x0c
3684 return c; 3952 *dir = NULL; return FR_OK;
3685 155e: 82 2f mov r24, r18 -  
3686 1560: 99 27 eor r25, r25 -  
3687 1562: 87 fd sbrc r24, 7 -  
3688 1564: 90 95 com r25 -  
3689 1566: 3e c0 rjmp .+124 ; 0x15e4 <f_open+0x35c> -  
-   3953 }
3690   3954  
3691 memset(dirname, ' ', 8+3); /* Fill buffer with spaces */ -  
3692 a = 0; b = 0x18; /* NT flag */ -  
3693 n = 0; t = 8; -  
3694 for (;;) { 3955 for (;;) {
-   3956 ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */
3695 c = *(*path)++; 3957 if (ds == 1) return FR_INVALID_NAME;
3696 1568: 92 2f mov r25, r18 3958 1672: 11 30 cpi r17, 0x01 ; 1
-   3959 1674: 09 f0 breq .+2 ; 0x1678 <f_open+0x2ca>
-   3960 1676: 44 c0 rjmp .+136 ; 0x1700 <f_open+0x352>
-   3961 1678: c1 c0 rjmp .+386 ; 0x17fc <f_open+0x44e>
3697 if (c == '\0' || c == '/') { /* Reached to end of str or directory separator */ 3962 if (c == '\0' || c == '/') { /* Reached to end of str or directory separator */
3698 if (n == 0) break; 3963 if (n == 0) break;
3699 dirname[11] = _USE_NTFLAG ? (a & b) : 0; 3964 dirname[11] = _USE_NTFLAG ? (a & b) : 0;
3700 return c; 3965 return c;
3701 } 3966 }
3702 if (c <= ' ' || c == 0x7F) break; /* Reject invisible chars */ 3967 if (c <= ' ' || c == 0x7F) break; /* Reject invisible chars */
3703 156a: 21 32 cpi r18, 0x21 ; 33 3968 167a: 11 32 cpi r17, 0x21 ; 33
3704 156c: c8 f1 brcs .+114 ; 0x15e0 <f_open+0x358> 3969 167c: 08 f4 brcc .+2 ; 0x1680 <f_open+0x2d2>
-   3970 167e: be c0 rjmp .+380 ; 0x17fc <f_open+0x44e>
3705 156e: 2f 37 cpi r18, 0x7F ; 127 3971 1680: 1f 37 cpi r17, 0x7F ; 127
3706 1570: b9 f1 breq .+110 ; 0x15e0 <f_open+0x358> 3972 1682: 09 f4 brne .+2 ; 0x1686 <f_open+0x2d8>
-   3973 1684: bb c0 rjmp .+374 ; 0x17fc <f_open+0x44e>
3707 if (c == '.') { 3974 if (c == '.') {
3708 1572: 2e 32 cpi r18, 0x2E ; 46 3975 1686: 1e 32 cpi r17, 0x2E ; 46
3709 1574: 39 f4 brne .+14 ; 0x1584 <f_open+0x2fc> 3976 1688: 41 f4 brne .+16 ; 0x169a <f_open+0x2ec>
3710 if (!(a & 1) && n >= 1 && n <= 8) { /* Enter extension part */ 3977 if (!(a & 1) && n >= 1 && n <= 8) { /* Enter extension part */
3711 1576: 30 fd sbrc r19, 0 3978 168a: 90 fd sbrc r25, 0
3712 1578: 33 c0 rjmp .+102 ; 0x15e0 <f_open+0x358> 3979 168c: b7 c0 rjmp .+366 ; 0x17fc <f_open+0x44e>
3713 157a: 44 23 and r20, r20 3980 168e: 22 23 and r18, r18
3714 157c: 89 f1 breq .+98 ; 0x15e0 <f_open+0x358> 3981 1690: 09 f4 brne .+2 ; 0x1694 <f_open+0x2e6>
-   3982 1692: b4 c0 rjmp .+360 ; 0x17fc <f_open+0x44e>
3715 157e: 49 30 cpi r20, 0x09 ; 9 3983 1694: 29 30 cpi r18, 0x09 ; 9
3716 1580: 00 f3 brcs .-64 ; 0x1542 <f_open+0x2ba> 3984 1696: f8 f2 brcs .-66 ; 0x1656 <f_open+0x2a8>
3717 1582: 2e c0 rjmp .+92 ; 0x15e0 <f_open+0x358> 3985 1698: b1 c0 rjmp .+354 ; 0x17fc <f_open+0x44e>
3718 (c >= 0xE0 && c <= 0xFC))) { 3986 (c >= 0xE0 && c <= 0xFC))) {
3719 if (n == 0 && c == 0xE5) /* Change heading \xE5 to \x05 */ 3987 if (n == 0 && c == 0xE5) /* Change heading \xE5 to \x05 */
3720 c = 0x05; 3988 c = 0x05;
3721 a ^= 1; goto md_l2; 3989 a ^= 1; goto md_l2;
3722 } 3990 }
3723 if (c == '"') break; /* Reject " */ 3991 if (c == '"') break; /* Reject " */
3724 1584: 22 32 cpi r18, 0x22 ; 34 3992 169a: 12 32 cpi r17, 0x22 ; 34
3725 1586: 61 f1 breq .+88 ; 0x15e0 <f_open+0x358> 3993 169c: 09 f4 brne .+2 ; 0x16a0 <f_open+0x2f2>
-   3994 169e: ae c0 rjmp .+348 ; 0x17fc <f_open+0x44e>
3726 if (c <= ')') goto md_l1; /* Accept ! # $ % & ' ( ) */ 3995 if (c <= ')') goto md_l1; /* Accept ! # $ % & ' ( ) */
3727 1588: 2a 32 cpi r18, 0x2A ; 42 3996 16a0: 1a 32 cpi r17, 0x2A ; 42
3728 158a: 08 f1 brcs .+66 ; 0x15ce <f_open+0x346> 3997 16a2: 20 f1 brcs .+72 ; 0x16ec <f_open+0x33e>
3729 if (c <= ',') break; /* Reject * + , */ 3998 if (c <= ',') break; /* Reject * + , */
3730 158c: 2d 32 cpi r18, 0x2D ; 45 3999 16a4: 1d 32 cpi r17, 0x2D ; 45
3731 158e: 40 f1 brcs .+80 ; 0x15e0 <f_open+0x358> 4000 16a6: 08 f4 brcc .+2 ; 0x16aa <f_open+0x2fc>
-   4001 16a8: a9 c0 rjmp .+338 ; 0x17fc <f_open+0x44e>
3732 if (c <= '9') goto md_l1; /* Accept - 0-9 */ 4002 if (c <= '9') goto md_l1; /* Accept - 0-9 */
3733 1590: 2a 33 cpi r18, 0x3A ; 58 4003 16aa: 1a 33 cpi r17, 0x3A ; 58
3734 1592: e8 f0 brcs .+58 ; 0x15ce <f_open+0x346> 4004 16ac: f8 f0 brcs .+62 ; 0x16ec <f_open+0x33e>
3735 if (c <= '?') break; /* Reject : ; < = > ? */ 4005 if (c <= '?') break; /* Reject : ; < = > ? */
3736 1594: 20 34 cpi r18, 0x40 ; 64 4006 16ae: 10 34 cpi r17, 0x40 ; 64
3737 1596: 20 f1 brcs .+72 ; 0x15e0 <f_open+0x358> 4007 16b0: 08 f4 brcc .+2 ; 0x16b4 <f_open+0x306>
-   4008 16b2: a4 c0 rjmp .+328 ; 0x17fc <f_open+0x44e>
3738 if (!(a & 1)) { /* These checks are not applied to S-JIS 2nd byte */ 4009 if (!(a & 1)) { /* These checks are not applied to S-JIS 2nd byte */
3739 1598: 30 fd sbrc r19, 0 4010 16b4: 90 fd sbrc r25, 0
3740 159a: 19 c0 rjmp .+50 ; 0x15ce <f_open+0x346> 4011 16b6: 1a c0 rjmp .+52 ; 0x16ec <f_open+0x33e>
3741 if (c == '|') break; /* Reject | */ 4012 if (c == '|') break; /* Reject | */
3742 159c: 2c 37 cpi r18, 0x7C ; 124 4013 16b8: 1c 37 cpi r17, 0x7C ; 124
3743 159e: 01 f1 breq .+64 ; 0x15e0 <f_open+0x358> 4014 16ba: 09 f4 brne .+2 ; 0x16be <f_open+0x310>
-   4015 16bc: 9f c0 rjmp .+318 ; 0x17fc <f_open+0x44e>
3744 if (c >= '[' && c <= ']') break;/* Reject [ \ ] */ 4016 if (c >= '[' && c <= ']') break;/* Reject [ \ ] */
3745 15a0: 82 2f mov r24, r18 4017 16be: 81 2f mov r24, r17
3746 15a2: 8b 55 subi r24, 0x5B ; 91 4018 16c0: 8b 55 subi r24, 0x5B ; 91
3747 15a4: 83 30 cpi r24, 0x03 ; 3 4019 16c2: 83 30 cpi r24, 0x03 ; 3
3748 15a6: e0 f0 brcs .+56 ; 0x15e0 <f_open+0x358> 4020 16c4: 08 f4 brcc .+2 ; 0x16c8 <f_open+0x31a>
-   4021 16c6: 9a c0 rjmp .+308 ; 0x17fc <f_open+0x44e>
3749 if (_USE_NTFLAG && c >= 'A' && c <= 'Z') 4022 if (_USE_NTFLAG && c >= 'A' && c <= 'Z')
3750 15a8: 86 5e subi r24, 0xE6 ; 230 4023 16c8: 86 5e subi r24, 0xE6 ; 230
3751 15aa: 8a 31 cpi r24, 0x1A ; 26 4024 16ca: 8a 31 cpi r24, 0x1A ; 26
3752 15ac: 28 f4 brcc .+10 ; 0x15b8 <f_open+0x330> 4025 16cc: 28 f4 brcc .+10 ; 0x16d8 <f_open+0x32a>
3753 (t == 8) ? (b &= ~0x08) : (b &= ~0x10); 4026 (t == 8) ? (b &= ~0x08) : (b &= ~0x10);
3754 15ae: 68 30 cpi r22, 0x08 ; 8 4027 16ce: 48 30 cpi r20, 0x08 ; 8
3755 15b0: 11 f4 brne .+4 ; 0x15b6 <f_open+0x32e> 4028 16d0: 11 f4 brne .+4 ; 0x16d6 <f_open+0x328>
3756 15b2: 57 7f andi r21, 0xF7 ; 247 4029 16d2: 37 7f andi r19, 0xF7 ; 247
3757 15b4: 01 c0 rjmp .+2 ; 0x15b8 <f_open+0x330> 4030 16d4: 01 c0 rjmp .+2 ; 0x16d8 <f_open+0x32a>
3758 15b6: 5f 7e andi r21, 0xEF ; 239 4031 16d6: 3f 7e andi r19, 0xEF ; 239
3759 if (c >= 'a' && c <= 'z') { /* Convert to upper case */ 4032 if (c >= 'a' && c <= 'z') { /* Convert to upper case */
3760 15b8: 82 2f mov r24, r18 4033 16d8: 81 2f mov r24, r17
3761 15ba: 81 56 subi r24, 0x61 ; 97 4034 16da: 81 56 subi r24, 0x61 ; 97
3762 15bc: 8a 31 cpi r24, 0x1A ; 26 4035 16dc: 8a 31 cpi r24, 0x1A ; 26
3763 15be: 38 f4 brcc .+14 ; 0x15ce <f_open+0x346> 4036 16de: 30 f4 brcc .+12 ; 0x16ec <f_open+0x33e>
3764 c -= 0x20; 4037 c -= 0x20;
3765 15c0: 92 2f mov r25, r18 -  
3766 15c2: 90 52 subi r25, 0x20 ; 32 4038 16e0: 10 52 subi r17, 0x20 ; 32
3767 if (_USE_NTFLAG) (t == 8) ? (a |= 0x08) : (a |= 0x10); 4039 if (_USE_NTFLAG) (t == 8) ? (a |= 0x08) : (a |= 0x10);
3768 15c4: 68 30 cpi r22, 0x08 ; 8 4040 16e2: 48 30 cpi r20, 0x08 ; 8
3769 15c6: 11 f4 brne .+4 ; 0x15cc <f_open+0x344> 4041 16e4: 11 f4 brne .+4 ; 0x16ea <f_open+0x33c>
3770 15c8: 38 60 ori r19, 0x08 ; 8 4042 16e6: 98 60 ori r25, 0x08 ; 8
3771 15ca: 01 c0 rjmp .+2 ; 0x15ce <f_open+0x346> 4043 16e8: 01 c0 rjmp .+2 ; 0x16ec <f_open+0x33e>
3772 15cc: 30 61 ori r19, 0x10 ; 16 4044 16ea: 90 61 ori r25, 0x10 ; 16
3773 } 4045 }
3774 } 4046 }
3775 md_l1: 4047 md_l1:
3776 a &= ~1; 4048 a &= ~1;
3777 md_l2: 4049 md_l2:
3778 if (n >= t) break; 4050 if (n >= t) break;
3779 15ce: 46 17 cp r20, r22 4051 16ec: 24 17 cp r18, r20
3780 15d0: 38 f4 brcc .+14 ; 0x15e0 <f_open+0x358> 4052 16ee: 08 f0 brcs .+2 ; 0x16f2 <f_open+0x344>
-   4053 16f0: 85 c0 rjmp .+266 ; 0x17fc <f_open+0x44e>
3781 c -= 0x20; 4054 c -= 0x20;
3782 if (_USE_NTFLAG) (t == 8) ? (a |= 0x08) : (a |= 0x10); 4055 if (_USE_NTFLAG) (t == 8) ? (a |= 0x08) : (a |= 0x10);
3783 } 4056 }
3784 } 4057 }
3785 md_l1: 4058 md_l1:
3786 a &= ~1; 4059 a &= ~1;
3787 15d2: 3e 7f andi r19, 0xFE ; 254 4060 16f2: 9e 7f andi r25, 0xFE ; 254
3788 md_l2: 4061 md_l2:
3789 if (n >= t) break; 4062 if (n >= t) break;
3790 dirname[n++] = c; 4063 dirname[n++] = c;
3791 15d4: f4 01 movw r30, r8 4064 16f4: f2 01 movw r30, r4
3792 15d6: e4 0f add r30, r20 4065 16f6: e2 0f add r30, r18
3793 15d8: f1 1d adc r31, r1 4066 16f8: f1 1d adc r31, r1
3794 15da: 90 83 st Z, r25 4067 16fa: 10 83 st Z, r17
3795 15dc: 4f 5f subi r20, 0xFF ; 255 4068 16fc: 2f 5f subi r18, 0xFF ; 255
3796 15de: b3 cf rjmp .-154 ; 0x1546 <f_open+0x2be> 4069 16fe: ad cf rjmp .-166 ; 0x165a <f_open+0x2ac>
3797 15e0: 81 e0 ldi r24, 0x01 ; 1 -  
3798 15e2: 90 e0 ldi r25, 0x00 ; 0 -  
3799 if (*path == '\0') { /* Null path means the root directory */ -  
3800 *dir = NULL; return FR_OK; -  
3801 } -  
3802   4070  
3803 for (;;) { 4071 for (;;) {
3804 ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */ 4072 ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */
3805 15e4: d8 2e mov r13, r24 -  
3806 if (ds == 1) return FR_INVALID_NAME; 4073 if (ds == 1) return FR_INVALID_NAME;
3807 15e6: b1 e0 ldi r27, 0x01 ; 1 -  
3808 15e8: 8b 17 cp r24, r27 -  
3809 15ea: 19 f4 brne .+6 ; 0x15f2 <f_open+0x36a> -  
3810 15ec: 24 e0 ldi r18, 0x04 ; 4 -  
3811 15ee: 30 e0 ldi r19, 0x00 ; 0 -  
3812 15f0: 55 c0 rjmp .+170 ; 0x169c <f_open+0x414> -  
3813 for (;;) { 4074 for (;;) {
3814 if (!move_window(dirobj->sect)) return FR_RW_ERROR; 4075 if (!move_window(dirobj->sect)) return FR_RW_ERROR;
3815 15f2: 6f 89 ldd r22, Y+23 ; 0x17 4076 1700: 6f 89 ldd r22, Y+23 ; 0x17
3816 15f4: 78 8d ldd r23, Y+24 ; 0x18 4077 1702: 78 8d ldd r23, Y+24 ; 0x18
3817 15f6: 89 8d ldd r24, Y+25 ; 0x19 4078 1704: 89 8d ldd r24, Y+25 ; 0x19
3818 15f8: 9a 8d ldd r25, Y+26 ; 0x1a 4079 1706: 9a 8d ldd r25, Y+26 ; 0x1a
3819 15fa: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 4080 1708: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
3820 15fe: 88 23 and r24, r24 4081 170c: 88 23 and r24, r24
3821 1600: 19 f4 brne .+6 ; 0x1608 <f_open+0x380> 4082 170e: 31 f4 brne .+12 ; 0x171c <f_open+0x36e>
-   4083 1710: 90 e0 ldi r25, 0x00 ; 0
-   4084 1712: 9c 01 movw r18, r24
-   4085 1714: 59 01 movw r10, r18
3822 1602: 28 e0 ldi r18, 0x08 ; 8 4086 1716: 28 e0 ldi r18, 0x08 ; 8
3823 1604: 30 e0 ldi r19, 0x00 ; 0 4087 1718: 30 e0 ldi r19, 0x00 ; 0
3824 1606: 4a c0 rjmp .+148 ; 0x169c <f_open+0x414> 4088 171a: 84 c0 rjmp .+264 ; 0x1824 <f_open+0x476>
3825 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */ 4089 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */
3826 1608: 0f 85 ldd r16, Y+15 ; 0x0f 4090 171c: 2f 85 ldd r18, Y+15 ; 0x0f
3827 160a: 18 89 ldd r17, Y+16 ; 0x10 4091 171e: 38 89 ldd r19, Y+16 ; 0x10
3828 160c: 0f 70 andi r16, 0x0F ; 15 4092 1720: 2f 70 andi r18, 0x0F ; 15
3829 160e: 10 70 andi r17, 0x00 ; 0 4093 1722: 30 70 andi r19, 0x00 ; 0
3830 1610: 35 e0 ldi r19, 0x05 ; 5 4094 1724: 85 e0 ldi r24, 0x05 ; 5
3831 1612: 00 0f add r16, r16 4095 1726: 22 0f add r18, r18
3832 1614: 11 1f adc r17, r17 4096 1728: 33 1f adc r19, r19
3833 1616: 3a 95 dec r19 4097 172a: 8a 95 dec r24
3834 1618: e1 f7 brne .-8 ; 0x1612 <f_open+0x38a> 4098 172c: e1 f7 brne .-8 ; 0x1726 <f_open+0x378>
3835 161a: 04 0d add r16, r4 -  
3836 161c: 15 1d adc r17, r5 -  
3837 if (dptr[DIR_Name] == 0) /* Has it reached to end of dir? */ 4099 if (dptr[DIR_Name] == 0) /* Has it reached to end of dir? */
3838 161e: f8 01 movw r30, r16 4100 172e: f6 01 movw r30, r12
3839 1620: 80 81 ld r24, Z 4101 1730: e2 0f add r30, r18
-   4102 1732: f3 1f adc r31, r19
-   4103 1734: 80 a1 ldd r24, Z+32 ; 0x20
3840 1622: 88 23 and r24, r24 4104 1736: 88 23 and r24, r24
3841 1624: a9 f0 breq .+42 ; 0x1650 <f_open+0x3c8> 4105 1738: e1 f0 breq .+56 ; 0x1772 <f_open+0x3c4>
3842 return !ds ? FR_NO_FILE : FR_NO_PATH; 4106 return !ds ? FR_NO_FILE : FR_NO_PATH;
3843 if (dptr[DIR_Name] != 0xE5 /* Matched? */ 4107 if (dptr[DIR_Name] != 0xE5 /* Matched? */
3844 1626: 85 3e cpi r24, 0xE5 ; 229 4108 173a: 85 3e cpi r24, 0xE5 ; 229
3845 1628: 71 f0 breq .+28 ; 0x1646 <f_open+0x3be> 4109 173c: a1 f0 breq .+40 ; 0x1766 <f_open+0x3b8>
-   4110 for (;;) {
-   4111 ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */
-   4112 if (ds == 1) return FR_INVALID_NAME;
-   4113 for (;;) {
-   4114 if (!move_window(dirobj->sect)) return FR_RW_ERROR;
-   4115 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */
-   4116 173e: 00 e2 ldi r16, 0x20 ; 32
3846 162a: f8 01 movw r30, r16 4117 1740: a0 2e mov r10, r16
-   4118 1742: b1 2c mov r11, r1
-   4119 1744: a2 0e add r10, r18
-   4120 1746: b3 1e adc r11, r19
3847 162c: 83 85 ldd r24, Z+11 ; 0x0b 4121 1748: ac 0c add r10, r12
-   4122 174a: bd 1c adc r11, r13
-   4123 if (dptr[DIR_Name] == 0) /* Has it reached to end of dir? */
-   4124 return !ds ? FR_NO_FILE : FR_NO_PATH;
-   4125 if (dptr[DIR_Name] != 0xE5 /* Matched? */
3848 162e: e8 2e mov r14, r24 4126 174c: f5 01 movw r30, r10
-   4127 174e: 83 85 ldd r24, Z+11 ; 0x0b
3849 1630: ff 24 eor r15, r15 4128 1750: 08 2f mov r16, r24
3850 1632: e3 fc sbrc r14, 3 4129 1752: 83 fd sbrc r24, 3
3851 1634: 08 c0 rjmp .+16 ; 0x1646 <f_open+0x3be> 4130 1754: 08 c0 rjmp .+16 ; 0x1766 <f_open+0x3b8>
3852 1636: 4b e0 ldi r20, 0x0B ; 11 4131 1756: 4b e0 ldi r20, 0x0B ; 11
3853 1638: 50 e0 ldi r21, 0x00 ; 0 4132 1758: 50 e0 ldi r21, 0x00 ; 0
3854 163a: b4 01 movw r22, r8 4133 175a: b2 01 movw r22, r4
3855 163c: c8 01 movw r24, r16 4134 175c: c5 01 movw r24, r10
3856 163e: 0e 94 94 10 call 0x2128 ; 0x2128 <memcmp> 4135 175e: 0e 94 96 11 call 0x232c ; 0x232c <memcmp>
3857 1642: 89 2b or r24, r25 4136 1762: 00 97 sbiw r24, 0x00 ; 0
3858 1644: 51 f0 breq .+20 ; 0x165a <f_open+0x3d2> 4137 1764: 51 f0 breq .+20 ; 0x177a <f_open+0x3cc>
3859 && !(dptr[DIR_Attr] & AM_VOL) 4138 && !(dptr[DIR_Attr] & AM_VOL)
3860 && !memcmp(&dptr[DIR_Name], fn, 8+3) ) break; 4139 && !memcmp(&dptr[DIR_Name], fn, 8+3) ) break;
3861 if (!next_dir_entry(dirobj)) /* Next directory pointer */ 4140 if (!next_dir_entry(dirobj)) /* Next directory pointer */
3862 1646: c1 01 movw r24, r2 4141 1766: ce 01 movw r24, r28
-   4142 1768: 0d 96 adiw r24, 0x0d ; 13
3863 1648: 0e 94 cb 04 call 0x996 ; 0x996 <next_dir_entry> 4143 176a: 0e 94 2c 06 call 0xc58 ; 0xc58 <next_dir_entry>
3864 164c: 88 23 and r24, r24 4144 176e: 88 23 and r24, r24
3865 164e: 89 f6 brne .-94 ; 0x15f2 <f_open+0x36a> 4145 1770: 39 f6 brne .-114 ; 0x1700 <f_open+0x352>
3866 return !ds ? FR_NO_FILE : FR_NO_PATH; 4146 return !ds ? FR_NO_FILE : FR_NO_PATH;
3867 1650: dd 20 and r13, r13 4147 1772: 11 23 and r17, r17
3868 1652: 59 f4 brne .+22 ; 0x166a <f_open+0x3e2> 4148 1774: 09 f0 breq .+2 ; 0x1778 <f_open+0x3ca>
3869 1654: 22 e0 ldi r18, 0x02 ; 2 -  
3870 1656: 30 e0 ldi r19, 0x00 ; 0 4149 1776: 49 c0 rjmp .+146 ; 0x180a <f_open+0x45c>
3871 1658: 21 c0 rjmp .+66 ; 0x169c <f_open+0x414> 4150 1778: 4f c0 rjmp .+158 ; 0x1818 <f_open+0x46a>
3872 } 4151 }
3873 if (!ds) { *dir = dptr; return FR_OK; } /* Matched with end of path */ 4152 if (!ds) { *dir = dptr; return FR_OK; } /* Matched with end of path */
3874 165a: dd 20 and r13, r13 4153 177a: 11 23 and r17, r17
3875 165c: 21 f4 brne .+8 ; 0x1666 <f_open+0x3de> 4154 177c: 19 f4 brne .+6 ; 0x1784 <f_open+0x3d6>
3876 165e: 68 01 movw r12, r16 -  
3877 1660: 20 e0 ldi r18, 0x00 ; 0 4155 177e: 20 e0 ldi r18, 0x00 ; 0
3878 1662: 30 e0 ldi r19, 0x00 ; 0 4156 1780: 30 e0 ldi r19, 0x00 ; 0
3879 1664: 1b c0 rjmp .+54 ; 0x169c <f_open+0x414> 4157 1782: 50 c0 rjmp .+160 ; 0x1824 <f_open+0x476>
3880 if (!(dptr[DIR_Attr] & AM_DIR)) return FR_NO_PATH; /* Cannot trace because it is a file */ 4158 if (!(dptr[DIR_Attr] & AM_DIR)) return FR_NO_PATH; /* Cannot trace because it is a file */
3881 1666: e4 fc sbrc r14, 4 4159 1784: 04 ff sbrs r16, 4
3882 1668: 03 c0 rjmp .+6 ; 0x1670 <f_open+0x3e8> -  
3883 166a: 23 e0 ldi r18, 0x03 ; 3 -  
3884 166c: 30 e0 ldi r19, 0x00 ; 0 -  
3885 166e: 16 c0 rjmp .+44 ; 0x169c <f_open+0x414> 4160 1786: 41 c0 rjmp .+130 ; 0x180a <f_open+0x45c>
3886 clust = /* Get cluster# of the directory */ 4161 clust = /* Get cluster# of the directory */
3887 1670: f8 01 movw r30, r16 4162 1788: f5 01 movw r30, r10
3888 1672: 82 8d ldd r24, Z+26 ; 0x1a 4163 178a: e2 8c ldd r14, Z+26 ; 0x1a
3889 1674: 93 8d ldd r25, Z+27 ; 0x1b 4164 178c: f3 8c ldd r15, Z+27 ; 0x1b
3890 #if _FAT32 4165 #if _FAT32
3891 ((DWORD)LD_WORD(&dptr[DIR_FstClusHI]) << 16) | 4166 ((DWORD)LD_WORD(&dptr[DIR_FstClusHI]) << 16) |
3892 #endif 4167 #endif
3893 LD_WORD(&dptr[DIR_FstClusLO]); 4168 LD_WORD(&dptr[DIR_FstClusLO]);
3894 dirobj->clust = dirobj->sclust = clust; /* Restart scannig with the new directory */ 4169 dirobj->clust = dirobj->sclust = clust; /* Restart scannig with the new directory */
3895 1676: 9c 8b std Y+20, r25 ; 0x14 4170 178e: fe 8a std Y+22, r15 ; 0x16
3896 1678: 8b 8b std Y+19, r24 ; 0x13 4171 1790: ed 8a std Y+21, r14 ; 0x15
-   4172 static
-   4173 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   4174 CLUST clust /* Cluster# to be converted */
-   4175 )
-   4176 {
-   4177 FATFS *fs = FatFs;
-   4178 1792: 00 91 10 01 lds r16, 0x0110
-   4179 1796: 10 91 11 01 lds r17, 0x0111
-   4180  
-   4181  
-   4182 clust -= 2;
-   4183 179a: b7 01 movw r22, r14
-   4184 179c: 62 50 subi r22, 0x02 ; 2
-   4185 179e: 70 40 sbci r23, 0x00 ; 0
-   4186 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   4187 17a0: f8 01 movw r30, r16
-   4188 17a2: 86 89 ldd r24, Z+22 ; 0x16
-   4189 17a4: 97 89 ldd r25, Z+23 ; 0x17
-   4190 17a6: 02 97 sbiw r24, 0x02 ; 2
-   4191 17a8: 68 17 cp r22, r24
-   4192 17aa: 79 07 cpc r23, r25
-   4193 17ac: 28 f0 brcs .+10 ; 0x17b8 <f_open+0x40a>
-   4194 17ae: 20 e0 ldi r18, 0x00 ; 0
-   4195 17b0: 30 e0 ldi r19, 0x00 ; 0
-   4196 17b2: 40 e0 ldi r20, 0x00 ; 0
-   4197 17b4: 50 e0 ldi r21, 0x00 ; 0
-   4198 17b6: 14 c0 rjmp .+40 ; 0x17e0 <f_open+0x432>
-   4199 return (DWORD)clust * fs->sects_clust + fs->database;
-   4200 17b8: 80 e0 ldi r24, 0x00 ; 0
-   4201 17ba: 90 e0 ldi r25, 0x00 ; 0
-   4202 17bc: f8 01 movw r30, r16
-   4203 17be: 25 8d ldd r18, Z+29 ; 0x1d
-   4204 17c0: 30 e0 ldi r19, 0x00 ; 0
-   4205 17c2: 40 e0 ldi r20, 0x00 ; 0
-   4206 17c4: 50 e0 ldi r21, 0x00 ; 0
-   4207 17c6: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   4208 17ca: 9b 01 movw r18, r22
-   4209 17cc: ac 01 movw r20, r24
-   4210 17ce: f8 01 movw r30, r16
-   4211 17d0: 80 89 ldd r24, Z+16 ; 0x10
-   4212 17d2: 91 89 ldd r25, Z+17 ; 0x11
-   4213 17d4: a2 89 ldd r26, Z+18 ; 0x12
-   4214 17d6: b3 89 ldd r27, Z+19 ; 0x13
-   4215 17d8: 28 0f add r18, r24
-   4216 17da: 39 1f adc r19, r25
-   4217 17dc: 4a 1f adc r20, r26
-   4218 17de: 5b 1f adc r21, r27
-   4219 clust = /* Get cluster# of the directory */
-   4220 #if _FAT32
-   4221 ((DWORD)LD_WORD(&dptr[DIR_FstClusHI]) << 16) |
-   4222 #endif
-   4223 LD_WORD(&dptr[DIR_FstClusLO]);
-   4224 dirobj->clust = dirobj->sclust = clust; /* Restart scannig with the new directory */
3897 167a: 9e 8b std Y+22, r25 ; 0x16 4225 17e0: fc 8a std Y+20, r15 ; 0x14
3898 167c: 8d 8b std Y+21, r24 ; 0x15 4226 17e2: eb 8a std Y+19, r14 ; 0x13
3899 dirobj->sect = clust2sect(clust); 4227 dirobj->sect = clust2sect(clust);
3900 167e: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
3901 1682: 6f 8b std Y+23, r22 ; 0x17 4228 17e4: 2f 8b std Y+23, r18 ; 0x17
3902 1684: 78 8f std Y+24, r23 ; 0x18 4229 17e6: 38 8f std Y+24, r19 ; 0x18
3903 1686: 89 8f std Y+25, r24 ; 0x19 4230 17e8: 49 8f std Y+25, r20 ; 0x19
3904 1688: 9a 8f std Y+26, r25 ; 0x1a 4231 17ea: 5a 8f std Y+26, r21 ; 0x1a
3905 dirobj->index = 2; 4232 dirobj->index = 2;
-   4233 17ec: 38 8a std Y+16, r3 ; 0x10
-   4234 17ee: 2f 86 std Y+15, r2 ; 0x0f
-   4235 17f0: 26 cf rjmp .-436 ; 0x163e <f_open+0x290>
-   4236 17f2: 20 e0 ldi r18, 0x00 ; 0
-   4237 17f4: 30 e0 ldi r19, 0x00 ; 0
-   4238 17f6: aa 24 eor r10, r10
-   4239 17f8: bb 24 eor r11, r11
-   4240 17fa: 14 c0 rjmp .+40 ; 0x1824 <f_open+0x476>
3906 168a: 82 e0 ldi r24, 0x02 ; 2 4241 17fc: 80 e0 ldi r24, 0x00 ; 0
3907 168c: 90 e0 ldi r25, 0x00 ; 0 4242 17fe: 90 e0 ldi r25, 0x00 ; 0
-   4243 1800: 9c 01 movw r18, r24
-   4244 1802: 59 01 movw r10, r18
3908 168e: 98 8b std Y+16, r25 ; 0x10 4245 1804: 24 e0 ldi r18, 0x04 ; 4
3909 1690: 8f 87 std Y+15, r24 ; 0x0f 4246 1806: 30 e0 ldi r19, 0x00 ; 0
3910 1692: 4b cf rjmp .-362 ; 0x152a <f_open+0x2a2> 4247 1808: 0d c0 rjmp .+26 ; 0x1824 <f_open+0x476>
-   4248 180a: 80 e0 ldi r24, 0x00 ; 0
-   4249 180c: 90 e0 ldi r25, 0x00 ; 0
-   4250 180e: 9c 01 movw r18, r24
-   4251 1810: 59 01 movw r10, r18
3911 1694: 20 e0 ldi r18, 0x00 ; 0 4252 1812: 23 e0 ldi r18, 0x03 ; 3
3912 1696: 30 e0 ldi r19, 0x00 ; 0 4253 1814: 30 e0 ldi r19, 0x00 ; 0
-   4254 1816: 06 c0 rjmp .+12 ; 0x1824 <f_open+0x476>
-   4255 1818: 80 e0 ldi r24, 0x00 ; 0
-   4256 181a: 90 e0 ldi r25, 0x00 ; 0
3913 1698: cc 24 eor r12, r12 4257 181c: 9c 01 movw r18, r24
3914 169a: dd 24 eor r13, r13 4258 181e: 59 01 movw r10, r18
-   4259 1820: 22 e0 ldi r18, 0x02 ; 2
-   4260 1822: 30 e0 ldi r19, 0x00 ; 0
3915 /* Trace the file path */ 4261 /* Trace the file path */
3916 res = trace_path(&dirobj, fn, path, &dir); /* Trace the file path */ 4262 res = trace_path(&dirobj, fn, path, &dir); /* Trace the file path */
3917   4263  
3918 #if !_FS_READONLY 4264 #if !_FS_READONLY
3919 /* Create or Open a File */ 4265 /* Create or Open a File */
3920 if (mode & (FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW)) { 4266 if (mode & (FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW)) {
3921 169c: fb 8d ldd r31, Y+27 ; 0x1b 4267 1824: fb 8d ldd r31, Y+27 ; 0x1b
3922 169e: 4f 2f mov r20, r31 4268 1826: 4f 2f mov r20, r31
3923 16a0: 55 27 eor r21, r21 4269 1828: 50 e0 ldi r21, 0x00 ; 0
3924 16a2: ca 01 movw r24, r20 4270 182a: ca 01 movw r24, r20
3925 16a4: 8c 71 andi r24, 0x1C ; 28 4271 182c: 8c 71 andi r24, 0x1C ; 28
3926 16a6: 90 70 andi r25, 0x00 ; 0 4272 182e: 90 70 andi r25, 0x00 ; 0
3927 16a8: 89 2b or r24, r25 4273 1830: 89 2b or r24, r25
3928 16aa: 09 f4 brne .+2 ; 0x16ae <f_open+0x426> 4274 1832: 09 f4 brne .+2 ; 0x1836 <f_open+0x488>
3929 16ac: fe c0 rjmp .+508 ; 0x18aa <f_open+0x622> 4275 1834: 41 c1 rjmp .+642 ; 0x1ab8 <f_open+0x70a>
3930 CLUST rs; 4276 CLUST rs;
3931 DWORD dw; 4277 DWORD dw;
3932 if (res != FR_OK) { /* No file, create new */ 4278 if (res != FR_OK) { /* No file, create new */
3933 16ae: 21 15 cp r18, r1 4279 1836: 21 15 cp r18, r1
3934 16b0: 31 05 cpc r19, r1 4280 1838: 31 05 cpc r19, r1
3935 16b2: 09 f4 brne .+2 ; 0x16b6 <f_open+0x42e> 4281 183a: 09 f4 brne .+2 ; 0x183e <f_open+0x490>
3936 16b4: 8f c0 rjmp .+286 ; 0x17d4 <f_open+0x54c> 4282 183c: d6 c0 rjmp .+428 ; 0x19ea <f_open+0x63c>
3937 if (res != FR_NO_FILE) return res; 4283 if (res != FR_NO_FILE) return res;
3938 16b6: 22 30 cpi r18, 0x02 ; 2 4284 183e: 22 30 cpi r18, 0x02 ; 2
3939 16b8: 31 05 cpc r19, r1 4285 1840: 31 05 cpc r19, r1
3940 16ba: 09 f0 breq .+2 ; 0x16be <f_open+0x436> 4286 1842: 09 f0 breq .+2 ; 0x1846 <f_open+0x498>
3941 16bc: 6f c1 rjmp .+734 ; 0x199c <f_open+0x714> 4287 1844: 84 c1 rjmp .+776 ; 0x1b4e <f_open+0x7a0>
3942 ) 4288 )
3943 { 4289 {
3944 CLUST clust; 4290 CLUST clust;
3945 DWORD sector; 4291 DWORD sector;
3946 BYTE c, n, *dptr; 4292 BYTE c, n, *dptr;
3947 FATFS *fs = FatFs; 4293 FATFS *fs = FatFs;
3948 16be: 60 90 0a 01 lds r6, 0x010A 4294 1846: 60 90 10 01 lds r6, 0x0110
3949 16c2: 70 90 0b 01 lds r7, 0x010B 4295 184a: 70 90 11 01 lds r7, 0x0111
-   4296  
3950   4297  
-   4298 /* Re-initialize directory object */
-   4299 clust = dirobj->sclust;
-   4300 184e: 0b 89 ldd r16, Y+19 ; 0x13
-   4301 1850: 1c 89 ldd r17, Y+20 ; 0x14
-   4302 if (clust) { /* Dyanmic directory table */
-   4303 1852: 01 15 cp r16, r1
-   4304 1854: 11 05 cpc r17, r1
-   4305 1856: 51 f1 breq .+84 ; 0x18ac <f_open+0x4fe>
-   4306 dirobj->clust = clust;
-   4307 1858: 1e 8b std Y+22, r17 ; 0x16
-   4308 185a: 0d 8b std Y+21, r16 ; 0x15
-   4309 )
-   4310 {
-   4311 FATFS *fs = FatFs;
-   4312  
-   4313  
-   4314 clust -= 2;
-   4315 185c: b8 01 movw r22, r16
-   4316 185e: 62 50 subi r22, 0x02 ; 2
-   4317 1860: 70 40 sbci r23, 0x00 ; 0
-   4318 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   4319 1862: f3 01 movw r30, r6
-   4320 1864: 86 89 ldd r24, Z+22 ; 0x16
-   4321 1866: 97 89 ldd r25, Z+23 ; 0x17
-   4322 1868: 02 97 sbiw r24, 0x02 ; 2
-   4323 186a: 68 17 cp r22, r24
-   4324 186c: 79 07 cpc r23, r25
-   4325 186e: 28 f0 brcs .+10 ; 0x187a <f_open+0x4cc>
-   4326 1870: 20 e0 ldi r18, 0x00 ; 0
-   4327 1872: 30 e0 ldi r19, 0x00 ; 0
-   4328 1874: 40 e0 ldi r20, 0x00 ; 0
-   4329 1876: 50 e0 ldi r21, 0x00 ; 0
-   4330 1878: 14 c0 rjmp .+40 ; 0x18a2 <f_open+0x4f4>
-   4331 return (DWORD)clust * fs->sects_clust + fs->database;
-   4332 187a: 80 e0 ldi r24, 0x00 ; 0
-   4333 187c: 90 e0 ldi r25, 0x00 ; 0
-   4334 187e: f3 01 movw r30, r6
-   4335 1880: 25 8d ldd r18, Z+29 ; 0x1d
-   4336 1882: 30 e0 ldi r19, 0x00 ; 0
-   4337 1884: 40 e0 ldi r20, 0x00 ; 0
-   4338 1886: 50 e0 ldi r21, 0x00 ; 0
-   4339 1888: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   4340 188c: 9b 01 movw r18, r22
-   4341 188e: ac 01 movw r20, r24
-   4342 1890: f3 01 movw r30, r6
-   4343 1892: 80 89 ldd r24, Z+16 ; 0x10
-   4344 1894: 91 89 ldd r25, Z+17 ; 0x11
-   4345 1896: a2 89 ldd r26, Z+18 ; 0x12
-   4346 1898: b3 89 ldd r27, Z+19 ; 0x13
-   4347 189a: 28 0f add r18, r24
-   4348 189c: 39 1f adc r19, r25
-   4349 189e: 4a 1f adc r20, r26
-   4350 18a0: 5b 1f adc r21, r27
3951   4351  
3952 /* Re-initialize directory object */ 4352 /* Re-initialize directory object */
3953 clust = dirobj->sclust; 4353 clust = dirobj->sclust;
3954 16c6: 0b 89 ldd r16, Y+19 ; 0x13 -  
3955 16c8: 1c 89 ldd r17, Y+20 ; 0x14 -  
3956 if (clust) { /* Dyanmic directory table */ 4354 if (clust) { /* Dyanmic directory table */
3957 16ca: 01 15 cp r16, r1 -  
3958 16cc: 11 05 cpc r17, r1 -  
3959 16ce: 51 f0 breq .+20 ; 0x16e4 <f_open+0x45c> -  
3960 dirobj->clust = clust; 4355 dirobj->clust = clust;
3961 16d0: 1e 8b std Y+22, r17 ; 0x16 -  
3962 16d2: 0d 8b std Y+21, r16 ; 0x15 -  
3963 dirobj->sect = clust2sect(clust); 4356 dirobj->sect = clust2sect(clust);
3964 16d4: c8 01 movw r24, r16 -  
3965 16d6: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
3966 16da: 6f 8b std Y+23, r22 ; 0x17 4357 18a2: 2f 8b std Y+23, r18 ; 0x17
3967 16dc: 78 8f std Y+24, r23 ; 0x18 4358 18a4: 38 8f std Y+24, r19 ; 0x18
3968 16de: 89 8f std Y+25, r24 ; 0x19 4359 18a6: 49 8f std Y+25, r20 ; 0x19
3969 16e0: 9a 8f std Y+26, r25 ; 0x1a 4360 18a8: 5a 8f std Y+26, r21 ; 0x1a
3970 16e2: 09 c0 rjmp .+18 ; 0x16f6 <f_open+0x46e> 4361 18aa: 09 c0 rjmp .+18 ; 0x18be <f_open+0x510>
3971 } else { /* Static directory table */ 4362 } else { /* Static directory table */
3972 dirobj->sect = fs->dirbase; 4363 dirobj->sect = fs->dirbase;
3973 16e4: f3 01 movw r30, r6 4364 18ac: f3 01 movw r30, r6
3974 16e6: 84 85 ldd r24, Z+12 ; 0x0c 4365 18ae: 84 85 ldd r24, Z+12 ; 0x0c
3975 16e8: 95 85 ldd r25, Z+13 ; 0x0d 4366 18b0: 95 85 ldd r25, Z+13 ; 0x0d
3976 16ea: a6 85 ldd r26, Z+14 ; 0x0e 4367 18b2: a6 85 ldd r26, Z+14 ; 0x0e
3977 16ec: b7 85 ldd r27, Z+15 ; 0x0f 4368 18b4: b7 85 ldd r27, Z+15 ; 0x0f
3978 16ee: 8f 8b std Y+23, r24 ; 0x17 4369 18b6: 8f 8b std Y+23, r24 ; 0x17
3979 16f0: 98 8f std Y+24, r25 ; 0x18 4370 18b8: 98 8f std Y+24, r25 ; 0x18
3980 16f2: a9 8f std Y+25, r26 ; 0x19 4371 18ba: a9 8f std Y+25, r26 ; 0x19
3981 16f4: ba 8f std Y+26, r27 ; 0x1a 4372 18bc: ba 8f std Y+26, r27 ; 0x1a
3982 } 4373 }
3983 dirobj->index = 0; 4374 dirobj->index = 0;
3984 16f6: 18 8a std Y+16, r1 ; 0x10 4375 18be: 18 8a std Y+16, r1 ; 0x10
3985 16f8: 1f 86 std Y+15, r1 ; 0x0f 4376 18c0: 1f 86 std Y+15, r1 ; 0x0f
3986   -  
3987 do { -  
3988 if (!move_window(dirobj->sect)) return FR_RW_ERROR; -  
3989 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */ 4377 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */
3990 16fa: 20 e2 ldi r18, 0x20 ; 32 -  
3991 16fc: e2 2e mov r14, r18 -  
3992 16fe: f1 2c mov r15, r1 -  
3993 1700: e6 0c add r14, r6 -  
3994 1702: f7 1c adc r15, r7 -  
3995 c = dptr[DIR_Name]; 4378 c = dptr[DIR_Name];
3996 if (c == 0 || c == 0xE5) { /* Found an empty entry! */ 4379 if (c == 0 || c == 0xE5) { /* Found an empty entry! */
3997 *dir = dptr; return FR_OK; 4380 *dir = dptr; return FR_OK;
3998 } 4381 }
3999 } while (next_dir_entry(dirobj)); /* Next directory pointer */ 4382 } while (next_dir_entry(dirobj)); /* Next directory pointer */
4000 1704: 9d e0 ldi r25, 0x0D ; 13 4383 18c2: bd e0 ldi r27, 0x0D ; 13
4001 1706: 49 2e mov r4, r25 4384 18c4: eb 2e mov r14, r27
4002 1708: 51 2c mov r5, r1 4385 18c6: f1 2c mov r15, r1
4003 170a: 4c 0e add r4, r28 4386 18c8: ec 0e add r14, r28
4004 170c: 5d 1e adc r5, r29 4387 18ca: fd 1e adc r15, r29
4005 dirobj->sect = fs->dirbase; 4388 dirobj->sect = fs->dirbase;
4006 } 4389 }
4007 dirobj->index = 0; 4390 dirobj->index = 0;
4008   4391  
4009 do { 4392 do {
4010 if (!move_window(dirobj->sect)) return FR_RW_ERROR; 4393 if (!move_window(dirobj->sect)) return FR_RW_ERROR;
4011 170e: 6f 89 ldd r22, Y+23 ; 0x17 4394 18cc: 6f 89 ldd r22, Y+23 ; 0x17
4012 1710: 78 8d ldd r23, Y+24 ; 0x18 4395 18ce: 78 8d ldd r23, Y+24 ; 0x18
4013 1712: 89 8d ldd r24, Y+25 ; 0x19 4396 18d0: 89 8d ldd r24, Y+25 ; 0x19
4014 1714: 9a 8d ldd r25, Y+26 ; 0x1a 4397 18d2: 9a 8d ldd r25, Y+26 ; 0x1a
4015 1716: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> 4398 18d4: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
4016 171a: 88 23 and r24, r24 4399 18d8: 88 23 and r24, r24
4017 171c: 09 f4 brne .+2 ; 0x1720 <f_open+0x498> 4400 18da: 09 f4 brne .+2 ; 0x18de <f_open+0x530>
4018 171e: 0a c1 rjmp .+532 ; 0x1934 <f_open+0x6ac> 4401 18dc: 33 c1 rjmp .+614 ; 0x1b44 <f_open+0x796>
4019 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */ 4402 dptr = &fs->win[(dirobj->index & 15) * 32]; /* Pointer to the directory entry */
4020 1720: 47 01 movw r8, r14 -  
4021 1722: cf 84 ldd r12, Y+15 ; 0x0f 4403 18de: ef 85 ldd r30, Y+15 ; 0x0f
4022 1724: d8 88 ldd r13, Y+16 ; 0x10 4404 18e0: f8 89 ldd r31, Y+16 ; 0x10
4023 1726: ff e0 ldi r31, 0x0F ; 15 4405 18e2: ef 70 andi r30, 0x0F ; 15
4024 1728: cf 22 and r12, r31 4406 18e4: f0 70 andi r31, 0x00 ; 0
4025 172a: dd 24 eor r13, r13 -  
4026 172c: 85 e0 ldi r24, 0x05 ; 5 4407 18e6: a5 e0 ldi r26, 0x05 ; 5
4027 172e: cc 0c add r12, r12 4408 18e8: ee 0f add r30, r30
4028 1730: dd 1c adc r13, r13 4409 18ea: ff 1f adc r31, r31
4029 1732: 8a 95 dec r24 4410 18ec: aa 95 dec r26
4030 1734: e1 f7 brne .-8 ; 0x172e <f_open+0x4a6> 4411 18ee: e1 f7 brne .-8 ; 0x18e8 <f_open+0x53a>
-   4412 18f0: b0 96 adiw r30, 0x20 ; 32
-   4413 18f2: 53 01 movw r10, r6
4031 1736: ce 0c add r12, r14 4414 18f4: ae 0e add r10, r30
4032 1738: df 1c adc r13, r15 4415 18f6: bf 1e adc r11, r31
-   4416 18f8: b0 97 sbiw r30, 0x20 ; 32
4033 c = dptr[DIR_Name]; 4417 c = dptr[DIR_Name];
4034 173a: d6 01 movw r26, r12 4418 18fa: e6 0d add r30, r6
4035 173c: 8c 91 ld r24, X 4419 18fc: f7 1d adc r31, r7
-   4420 18fe: 80 a1 ldd r24, Z+32 ; 0x20
4036 if (c == 0 || c == 0xE5) { /* Found an empty entry! */ 4421 if (c == 0 || c == 0xE5) { /* Found an empty entry! */
4037 173e: 88 23 and r24, r24 4422 1900: 88 23 and r24, r24
4038 1740: 09 f4 brne .+2 ; 0x1744 <f_open+0x4bc> 4423 1902: 09 f4 brne .+2 ; 0x1906 <f_open+0x558>
4039 1742: 18 c1 rjmp .+560 ; 0x1974 <f_open+0x6ec> 4424 1904: 4c c1 rjmp .+664 ; 0x1b9e <f_open+0x7f0>
4040 1744: 85 3e cpi r24, 0xE5 ; 229 4425 1906: 85 3e cpi r24, 0xE5 ; 229
4041 1746: 09 f4 brne .+2 ; 0x174a <f_open+0x4c2> 4426 1908: 09 f4 brne .+2 ; 0x190c <f_open+0x55e>
4042 1748: 15 c1 rjmp .+554 ; 0x1974 <f_open+0x6ec> 4427 190a: 49 c1 rjmp .+658 ; 0x1b9e <f_open+0x7f0>
4043 *dir = dptr; return FR_OK; 4428 *dir = dptr; return FR_OK;
4044 } 4429 }
4045 } while (next_dir_entry(dirobj)); /* Next directory pointer */ 4430 } while (next_dir_entry(dirobj)); /* Next directory pointer */
4046 174a: c2 01 movw r24, r4 4431 190c: c7 01 movw r24, r14
4047 174c: 0e 94 cb 04 call 0x996 ; 0x996 <next_dir_entry> 4432 190e: 0e 94 2c 06 call 0xc58 ; 0xc58 <next_dir_entry>
4048 1750: 88 23 and r24, r24 4433 1912: 88 23 and r24, r24
4049 1752: e9 f6 brne .-70 ; 0x170e <f_open+0x486> 4434 1914: d9 f6 brne .-74 ; 0x18cc <f_open+0x51e>
4050 /* Reached to end of the directory table */ 4435 /* Reached to end of the directory table */
4051   4436  
4052 /* Abort when static table or could not stretch dynamic table */ 4437 /* Abort when static table or could not stretch dynamic table */
4053 if (!clust || !(clust = create_chain(dirobj->clust))) return FR_DENIED; 4438 if (!clust || !(clust = create_chain(dirobj->clust))) return FR_DENIED;
4054 1754: 01 2b or r16, r17 4439 1916: 01 15 cp r16, r1
-   4440 1918: 11 05 cpc r17, r1
4055 1756: 09 f4 brne .+2 ; 0x175a <f_open+0x4d2> 4441 191a: 09 f4 brne .+2 ; 0x191e <f_open+0x570>
4056 1758: ea c0 rjmp .+468 ; 0x192e <f_open+0x6a6> 4442 191c: 10 c1 rjmp .+544 ; 0x1b3e <f_open+0x790>
4057 175a: 8d 89 ldd r24, Y+21 ; 0x15 4443 191e: 8d 89 ldd r24, Y+21 ; 0x15
4058 175c: 9e 89 ldd r25, Y+22 ; 0x16 4444 1920: 9e 89 ldd r25, Y+22 ; 0x16
4059 175e: 0e 94 25 05 call 0xa4a ; 0xa4a <create_chain> 4445 1922: 0e 94 d1 04 call 0x9a2 ; 0x9a2 <create_chain>
4060 1762: 8c 01 movw r16, r24 4446 1926: 8c 01 movw r16, r24
4061 1764: 00 97 sbiw r24, 0x00 ; 0 4447 1928: 00 97 sbiw r24, 0x00 ; 0
-   4448 192a: 09 f4 brne .+2 ; 0x192e <f_open+0x580>
-   4449 192c: 08 c1 rjmp .+528 ; 0x1b3e <f_open+0x790>
-   4450 if (clust == 1 || !move_window(0)) return FR_RW_ERROR;
-   4451 192e: 81 30 cpi r24, 0x01 ; 1
-   4452 1930: 91 05 cpc r25, r1
-   4453 1932: 09 f4 brne .+2 ; 0x1936 <f_open+0x588>
-   4454 1934: 07 c1 rjmp .+526 ; 0x1b44 <f_open+0x796>
-   4455 1936: 60 e0 ldi r22, 0x00 ; 0
-   4456 1938: 70 e0 ldi r23, 0x00 ; 0
-   4457 193a: 80 e0 ldi r24, 0x00 ; 0
-   4458 193c: 90 e0 ldi r25, 0x00 ; 0
-   4459 193e: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
-   4460 1942: 88 23 and r24, r24
4062 1766: 09 f4 brne .+2 ; 0x176a <f_open+0x4e2> 4461 1944: 09 f4 brne .+2 ; 0x1948 <f_open+0x59a>
-   4462 1946: fe c0 rjmp .+508 ; 0x1b44 <f_open+0x796>
-   4463 static
-   4464 DWORD clust2sect ( /* !=0: sector number, 0: failed - invalid cluster# */
-   4465 CLUST clust /* Cluster# to be converted */
-   4466 )
-   4467 {
-   4468 FATFS *fs = FatFs;
-   4469 1948: a0 90 10 01 lds r10, 0x0110
-   4470 194c: b0 90 11 01 lds r11, 0x0111
-   4471  
-   4472  
-   4473 clust -= 2;
-   4474 1950: b8 01 movw r22, r16
-   4475 1952: 62 50 subi r22, 0x02 ; 2
-   4476 1954: 70 40 sbci r23, 0x00 ; 0
-   4477 if (clust >= (fs->max_clust - 2)) return 0; /* Invalid cluster# */
-   4478 1956: f5 01 movw r30, r10
-   4479 1958: 86 89 ldd r24, Z+22 ; 0x16
-   4480 195a: 97 89 ldd r25, Z+23 ; 0x17
-   4481 195c: 02 97 sbiw r24, 0x02 ; 2
-   4482 195e: 68 17 cp r22, r24
-   4483 1960: 79 07 cpc r23, r25
-   4484 1962: 20 f0 brcs .+8 ; 0x196c <f_open+0x5be>
-   4485 1964: cc 24 eor r12, r12
-   4486 1966: dd 24 eor r13, r13
-   4487 1968: 76 01 movw r14, r12
4063 1768: e2 c0 rjmp .+452 ; 0x192e <f_open+0x6a6> 4488 196a: 14 c0 rjmp .+40 ; 0x1994 <f_open+0x5e6>
-   4489 return (DWORD)clust * fs->sects_clust + fs->database;
-   4490 196c: 80 e0 ldi r24, 0x00 ; 0
-   4491 196e: 90 e0 ldi r25, 0x00 ; 0
-   4492 1970: f5 01 movw r30, r10
-   4493 1972: 25 8d ldd r18, Z+29 ; 0x1d
-   4494 1974: 30 e0 ldi r19, 0x00 ; 0
-   4495 1976: 40 e0 ldi r20, 0x00 ; 0
-   4496 1978: 50 e0 ldi r21, 0x00 ; 0
-   4497 197a: 0e 94 86 14 call 0x290c ; 0x290c <__mulsi3>
-   4498 197e: 6b 01 movw r12, r22
-   4499 1980: 7c 01 movw r14, r24
-   4500 1982: f5 01 movw r30, r10
-   4501 1984: 80 89 ldd r24, Z+16 ; 0x10
-   4502 1986: 91 89 ldd r25, Z+17 ; 0x11
-   4503 1988: a2 89 ldd r26, Z+18 ; 0x12
-   4504 198a: b3 89 ldd r27, Z+19 ; 0x13
-   4505 198c: c8 0e add r12, r24
-   4506 198e: d9 1e adc r13, r25
-   4507 1990: ea 1e adc r14, r26
-   4508 1992: fb 1e adc r15, r27
-   4509  
-   4510 /* Abort when static table or could not stretch dynamic table */
-   4511 if (!clust || !(clust = create_chain(dirobj->clust))) return FR_DENIED;
4064 if (clust == 1 || !move_window(0)) return FR_RW_ERROR; 4512 if (clust == 1 || !move_window(0)) return FR_RW_ERROR;
4065 176a: 01 97 sbiw r24, 0x01 ; 1 -  
4066 176c: 09 f4 brne .+2 ; 0x1770 <f_open+0x4e8> -  
4067 176e: e2 c0 rjmp .+452 ; 0x1934 <f_open+0x6ac> -  
4068 1770: 60 e0 ldi r22, 0x00 ; 0 -  
4069 1772: 70 e0 ldi r23, 0x00 ; 0 -  
4070 1774: 80 e0 ldi r24, 0x00 ; 0 -  
4071 1776: 90 e0 ldi r25, 0x00 ; 0 -  
4072 1778: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> -  
4073 177c: 88 23 and r24, r24 -  
4074 177e: 09 f4 brne .+2 ; 0x1782 <f_open+0x4fa> -  
4075 1780: d9 c0 rjmp .+434 ; 0x1934 <f_open+0x6ac> -  
4076   4513  
4077 fs->winsect = sector = clust2sect(clust); /* Cleanup the expanded table */ 4514 fs->winsect = sector = clust2sect(clust); /* Cleanup the expanded table */
4078 1782: c8 01 movw r24, r16 -  
4079 1784: 0e 94 18 03 call 0x630 ; 0x630 <clust2sect> -  
4080 1788: 6b 01 movw r12, r22 -  
4081 178a: 7c 01 movw r14, r24 -  
4082 178c: f3 01 movw r30, r6 4515 1994: f3 01 movw r30, r6
4083 178e: 64 83 std Z+4, r22 ; 0x04 4516 1996: c4 82 std Z+4, r12 ; 0x04
4084 1790: 75 83 std Z+5, r23 ; 0x05 4517 1998: d5 82 std Z+5, r13 ; 0x05
4085 1792: 86 83 std Z+6, r24 ; 0x06 4518 199a: e6 82 std Z+6, r14 ; 0x06
4086 1794: 97 83 std Z+7, r25 ; 0x07 4519 199c: f7 82 std Z+7, r15 ; 0x07
4087 memset(fs->win, 0, 512); 4520 memset(fs->win, 0, 512);
-   4521 199e: e0 e2 ldi r30, 0x20 ; 32
-   4522 19a0: ae 2e mov r10, r30
-   4523 19a2: b1 2c mov r11, r1
-   4524 19a4: a6 0c add r10, r6
-   4525 19a6: b7 1c adc r11, r7
4088 1796: 80 e0 ldi r24, 0x00 ; 0 4526 19a8: 80 e0 ldi r24, 0x00 ; 0
4089 1798: 92 e0 ldi r25, 0x02 ; 2 4527 19aa: 92 e0 ldi r25, 0x02 ; 2
4090 179a: d4 01 movw r26, r8 4528 19ac: f5 01 movw r30, r10
-   4529 19ae: 9c 01 movw r18, r24
4091 179c: 1d 92 st X+, r1 4530 19b0: 11 92 st Z+, r1
4092 179e: 01 97 sbiw r24, 0x01 ; 1 4531 19b2: 21 50 subi r18, 0x01 ; 1
-   4532 19b4: 30 40 sbci r19, 0x00 ; 0
4093 17a0: e9 f7 brne .-6 ; 0x179c <f_open+0x514> 4533 19b6: e1 f7 brne .-8 ; 0x19b0 <f_open+0x602>
4094 for (n = fs->sects_clust; n; n--) { 4534 for (n = fs->sects_clust; n; n--) {
-   4535 19b8: f3 01 movw r30, r6
4095 17a2: 15 8d ldd r17, Z+29 ; 0x1d 4536 19ba: 15 8d ldd r17, Z+29 ; 0x1d
4096 17a4: 10 c0 rjmp .+32 ; 0x17c6 <f_open+0x53e> 4537 19bc: 10 c0 rjmp .+32 ; 0x19de <f_open+0x630>
4097 if (disk_write(0, fs->win, sector, 1) != RES_OK) 4538 if (disk_write(0, fs->win, sector, 1) != RES_OK)
4098 17a6: 01 e0 ldi r16, 0x01 ; 1 4539 19be: 01 e0 ldi r16, 0x01 ; 1
4099 17a8: a7 01 movw r20, r14 4540 19c0: a7 01 movw r20, r14
4100 17aa: 96 01 movw r18, r12 4541 19c2: 96 01 movw r18, r12
4101 17ac: b4 01 movw r22, r8 4542 19c4: b5 01 movw r22, r10
4102 17ae: 80 e0 ldi r24, 0x00 ; 0 4543 19c6: 80 e0 ldi r24, 0x00 ; 0
4103 17b0: 0e 94 d3 0e call 0x1da6 ; 0x1da6 <disk_write> 4544 19c8: 0e 94 fb 0f call 0x1ff6 ; 0x1ff6 <disk_write>
4104 17b4: 89 2b or r24, r25 4545 19cc: 89 2b or r24, r25
4105 17b6: 09 f0 breq .+2 ; 0x17ba <f_open+0x532> 4546 19ce: 09 f0 breq .+2 ; 0x19d2 <f_open+0x624>
4106 17b8: bd c0 rjmp .+378 ; 0x1934 <f_open+0x6ac> 4547 19d0: b9 c0 rjmp .+370 ; 0x1b44 <f_open+0x796>
4107 return FR_RW_ERROR; 4548 return FR_RW_ERROR;
4108 sector++; 4549 sector++;
4109 17ba: 08 94 sec 4550 19d2: 08 94 sec
4110 17bc: c1 1c adc r12, r1 4551 19d4: c1 1c adc r12, r1
4111 17be: d1 1c adc r13, r1 4552 19d6: d1 1c adc r13, r1
4112 17c0: e1 1c adc r14, r1 4553 19d8: e1 1c adc r14, r1
4113 17c2: f1 1c adc r15, r1 4554 19da: f1 1c adc r15, r1
4114 if (!clust || !(clust = create_chain(dirobj->clust))) return FR_DENIED; 4555 if (!clust || !(clust = create_chain(dirobj->clust))) return FR_DENIED;
4115 if (clust == 1 || !move_window(0)) return FR_RW_ERROR; 4556 if (clust == 1 || !move_window(0)) return FR_RW_ERROR;
4116   4557  
4117 fs->winsect = sector = clust2sect(clust); /* Cleanup the expanded table */ 4558 fs->winsect = sector = clust2sect(clust); /* Cleanup the expanded table */
4118 memset(fs->win, 0, 512); 4559 memset(fs->win, 0, 512);
4119 for (n = fs->sects_clust; n; n--) { 4560 for (n = fs->sects_clust; n; n--) {
4120 17c4: 11 50 subi r17, 0x01 ; 1 4561 19dc: 11 50 subi r17, 0x01 ; 1
4121 17c6: 11 23 and r17, r17 4562 19de: 11 23 and r17, r17
4122 17c8: 71 f7 brne .-36 ; 0x17a6 <f_open+0x51e> 4563 19e0: 71 f7 brne .-36 ; 0x19be <f_open+0x610>
4123 if (disk_write(0, fs->win, sector, 1) != RES_OK) 4564 if (disk_write(0, fs->win, sector, 1) != RES_OK)
4124 return FR_RW_ERROR; 4565 return FR_RW_ERROR;
4125 sector++; 4566 sector++;
4126 } 4567 }
4127 fs->winflag = 1; 4568 fs->winflag = 1;
4128 17ca: 81 e0 ldi r24, 0x01 ; 1 4569 19e2: 81 e0 ldi r24, 0x01 ; 1
4129 17cc: f3 01 movw r30, r6 4570 19e4: f3 01 movw r30, r6
4130 17ce: 87 8f std Z+31, r24 ; 0x1f 4571 19e6: 87 8f std Z+31, r24 ; 0x1f
4131 17d0: 64 01 movw r12, r8 -  
4132 17d2: d0 c0 rjmp .+416 ; 0x1974 <f_open+0x6ec> 4572 19e8: da c0 rjmp .+436 ; 0x1b9e <f_open+0x7f0>
4133 memset(dir, 0, 32); /* Initialize the new entry */ 4573 memset(dir, 0, 32); /* Initialize the new entry */
4134 memcpy(&dir[DIR_Name], fn, 8+3); 4574 memcpy(&dir[DIR_Name], fn, 8+3);
4135 dir[DIR_NTres] = fn[11]; 4575 dir[DIR_NTres] = fn[11];
4136 mode |= FA_CREATE_ALWAYS; 4576 mode |= FA_CREATE_ALWAYS;
4137 } else { /* Any object is already existing */ 4577 } else { /* Any object is already existing */
4138 if (mode & FA_CREATE_NEW) /* Cannot create new */ 4578 if (mode & FA_CREATE_NEW) /* Cannot create new */
4139 17d4: 42 ff sbrs r20, 2 4579 19ea: f2 ff sbrs r31, 2
4140 17d6: 03 c0 rjmp .+6 ; 0x17de <f_open+0x556> 4580 19ec: 03 c0 rjmp .+6 ; 0x19f4 <f_open+0x646>
4141 17d8: 27 e0 ldi r18, 0x07 ; 7 4581 19ee: 27 e0 ldi r18, 0x07 ; 7
4142 17da: 30 e0 ldi r19, 0x00 ; 0 4582 19f0: 30 e0 ldi r19, 0x00 ; 0
4143 17dc: df c0 rjmp .+446 ; 0x199c <f_open+0x714> 4583 19f2: ad c0 rjmp .+346 ; 0x1b4e <f_open+0x7a0>
4144 return FR_EXIST; 4584 return FR_EXIST;
4145 if (dir == NULL || (dir[DIR_Attr] & (AM_RDO|AM_DIR))) /* Cannot overwrite (R/O or DIR) */ 4585 if (dir == NULL || (dir[DIR_Attr] & (AM_RDO|AM_DIR))) /* Cannot overwrite (R/O or DIR) */
4146 17de: c1 14 cp r12, r1 4586 19f4: a1 14 cp r10, r1
4147 17e0: d1 04 cpc r13, r1 4587 19f6: b1 04 cpc r11, r1
4148 17e2: 09 f4 brne .+2 ; 0x17e6 <f_open+0x55e> 4588 19f8: 09 f4 brne .+2 ; 0x19fc <f_open+0x64e>
4149 17e4: a4 c0 rjmp .+328 ; 0x192e <f_open+0x6a6> 4589 19fa: a1 c0 rjmp .+322 ; 0x1b3e <f_open+0x790>
4150 17e6: f6 01 movw r30, r12 4590 19fc: f5 01 movw r30, r10
4151 17e8: 83 85 ldd r24, Z+11 ; 0x0b 4591 19fe: 83 85 ldd r24, Z+11 ; 0x0b
4152 17ea: 81 71 andi r24, 0x11 ; 17 4592 1a00: 81 71 andi r24, 0x11 ; 17
4153 17ec: 09 f0 breq .+2 ; 0x17f0 <f_open+0x568> 4593 1a02: 09 f0 breq .+2 ; 0x1a06 <f_open+0x658>
4154 17ee: 9f c0 rjmp .+318 ; 0x192e <f_open+0x6a6> 4594 1a04: 9c c0 rjmp .+312 ; 0x1b3e <f_open+0x790>
4155 return FR_DENIED; 4595 return FR_DENIED;
4156 if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero */ 4596 if (mode & FA_CREATE_ALWAYS) { /* Resize it to zero */
4157 17f0: 43 ff sbrs r20, 3 4597 1a06: 43 ff sbrs r20, 3
4158 17f2: 46 c0 rjmp .+140 ; 0x1880 <f_open+0x5f8> 4598 1a08: 42 c0 rjmp .+132 ; 0x1a8e <f_open+0x6e0>
4159 #if _FAT32 4599 #if _FAT32
4160 rs = ((DWORD)LD_WORD(&dir[DIR_FstClusHI]) << 16) | LD_WORD(&dir[DIR_FstClusLO]); 4600 rs = ((DWORD)LD_WORD(&dir[DIR_FstClusHI]) << 16) | LD_WORD(&dir[DIR_FstClusLO]);
4161 ST_WORD(&dir[DIR_FstClusHI], 0); 4601 ST_WORD(&dir[DIR_FstClusHI], 0);
4162 #else 4602 #else
4163 rs = LD_WORD(&dir[DIR_FstClusLO]); 4603 rs = LD_WORD(&dir[DIR_FstClusLO]);
4164 17f4: 82 8c ldd r8, Z+26 ; 0x1a 4604 1a0a: c2 8c ldd r12, Z+26 ; 0x1a
4165 17f6: 93 8c ldd r9, Z+27 ; 0x1b 4605 1a0c: d3 8c ldd r13, Z+27 ; 0x1b
4166 #endif 4606 #endif
4167 ST_WORD(&dir[DIR_FstClusLO], 0); /* cluster = 0 */ 4607 ST_WORD(&dir[DIR_FstClusLO], 0); /* cluster = 0 */
4168 17f8: 13 8e std Z+27, r1 ; 0x1b 4608 1a0e: 13 8e std Z+27, r1 ; 0x1b
4169 17fa: 12 8e std Z+26, r1 ; 0x1a 4609 1a10: 12 8e std Z+26, r1 ; 0x1a
4170 ST_DWORD(&dir[DIR_FileSize], 0); /* size = 0 */ 4610 ST_DWORD(&dir[DIR_FileSize], 0); /* size = 0 */
4171 17fc: 14 8e std Z+28, r1 ; 0x1c 4611 1a12: 14 8e std Z+28, r1 ; 0x1c
4172 17fe: 15 8e std Z+29, r1 ; 0x1d 4612 1a14: 15 8e std Z+29, r1 ; 0x1d
4173 1800: 16 8e std Z+30, r1 ; 0x1e 4613 1a16: 16 8e std Z+30, r1 ; 0x1e
4174 1802: 17 8e std Z+31, r1 ; 0x1f 4614 1a18: 17 8e std Z+31, r1 ; 0x1f
4175 fs->winflag = 1; 4615 fs->winflag = 1;
4176 1804: 81 e0 ldi r24, 0x01 ; 1 4616 1a1a: 81 e0 ldi r24, 0x01 ; 1
4177 1806: f5 01 movw r30, r10 4617 1a1c: f4 01 movw r30, r8
4178 1808: 87 8f std Z+31, r24 ; 0x1f 4618 1a1e: 87 8f std Z+31, r24 ; 0x1f
4179 dw = fs->winsect; /* Remove the cluster chain */ 4619 dw = fs->winsect; /* Remove the cluster chain */
4180 180a: 24 80 ldd r2, Z+4 ; 0x04 4620 1a20: 24 80 ldd r2, Z+4 ; 0x04
4181 180c: 35 80 ldd r3, Z+5 ; 0x05 4621 1a22: 35 80 ldd r3, Z+5 ; 0x05
4182 180e: 46 80 ldd r4, Z+6 ; 0x06 4622 1a24: 46 80 ldd r4, Z+6 ; 0x06
4183 1810: 57 80 ldd r5, Z+7 ; 0x07 4623 1a26: 57 80 ldd r5, Z+7 ; 0x07
4184 BOOL remove_chain ( /* TRUE: successful, FALSE: failed */ 4624 BOOL remove_chain ( /* TRUE: successful, FALSE: failed */
4185 CLUST clust /* Cluster# to remove chain from */ 4625 CLUST clust /* Cluster# to remove chain from */
4186 ) 4626 )
4187 { 4627 {
4188 CLUST nxt; 4628 CLUST nxt;
4189 FATFS *fs = FatFs; 4629 FATFS *fs = FatFs;
4190 1812: e0 90 0a 01 lds r14, 0x010A 4630 1a28: e0 90 10 01 lds r14, 0x0110
4191 1816: f0 90 0b 01 lds r15, 0x010B 4631 1a2c: f0 90 11 01 lds r15, 0x0111
4192 181a: 84 01 movw r16, r8 4632 1a30: 86 01 movw r16, r12
4193 181c: 1b c0 rjmp .+54 ; 0x1854 <f_open+0x5cc> 4633 1a32: 1c c0 rjmp .+56 ; 0x1a6c <f_open+0x6be>
4194   4634  
4195   4635  
4196 while (clust >= 2 && clust < fs->max_clust) { 4636 while (clust >= 2 && clust < fs->max_clust) {
4197 nxt = get_cluster(clust); 4637 nxt = get_cluster(clust);
4198 181e: c8 01 movw r24, r16 4638 1a34: c8 01 movw r24, r16
4199 1820: 0e 94 4f 04 call 0x89e ; 0x89e <get_cluster> 4639 1a36: 0e 94 53 04 call 0x8a6 ; 0x8a6 <get_cluster>
4200 1824: 3c 01 movw r6, r24 4640 1a3a: 3c 01 movw r6, r24
4201 if (nxt == 1) return FALSE; 4641 if (nxt == 1) return FALSE;
4202 1826: 01 97 sbiw r24, 0x01 ; 1 4642 1a3c: 81 30 cpi r24, 0x01 ; 1
-   4643 1a3e: 91 05 cpc r25, r1
4203 1828: 09 f4 brne .+2 ; 0x182c <f_open+0x5a4> 4644 1a40: 09 f4 brne .+2 ; 0x1a44 <f_open+0x696>
4204 182a: 84 c0 rjmp .+264 ; 0x1934 <f_open+0x6ac> 4645 1a42: 80 c0 rjmp .+256 ; 0x1b44 <f_open+0x796>
4205 if (!put_cluster(clust, 0)) return FALSE; 4646 if (!put_cluster(clust, 0)) return FALSE;
4206 182c: 60 e0 ldi r22, 0x00 ; 0 4647 1a44: 60 e0 ldi r22, 0x00 ; 0
4207 182e: 70 e0 ldi r23, 0x00 ; 0 4648 1a46: 70 e0 ldi r23, 0x00 ; 0
4208 1830: c8 01 movw r24, r16 4649 1a48: c8 01 movw r24, r16
4209 1832: 0e 94 c1 03 call 0x782 ; 0x782 <put_cluster> 4650 1a4a: 0e 94 c4 03 call 0x788 ; 0x788 <put_cluster>
4210 1836: 88 23 and r24, r24 4651 1a4e: 88 23 and r24, r24
4211 1838: 09 f4 brne .+2 ; 0x183c <f_open+0x5b4> 4652 1a50: 09 f4 brne .+2 ; 0x1a54 <f_open+0x6a6>
4212 183a: 7c c0 rjmp .+248 ; 0x1934 <f_open+0x6ac> 4653 1a52: 78 c0 rjmp .+240 ; 0x1b44 <f_open+0x796>
4213 if (fs->free_clust != (CLUST)0xFFFFFFFF) { 4654 if (fs->free_clust != (CLUST)0xFFFFFFFF) {
4214 183c: f7 01 movw r30, r14 4655 1a54: f7 01 movw r30, r14
4215 183e: 82 8d ldd r24, Z+26 ; 0x1a 4656 1a56: 82 8d ldd r24, Z+26 ; 0x1a
4216 1840: 93 8d ldd r25, Z+27 ; 0x1b 4657 1a58: 93 8d ldd r25, Z+27 ; 0x1b
4217 1842: ff ef ldi r31, 0xFF ; 255 4658 1a5a: ff ef ldi r31, 0xFF ; 255
4218 1844: 8f 3f cpi r24, 0xFF ; 255 4659 1a5c: 8f 3f cpi r24, 0xFF ; 255
4219 1846: 9f 07 cpc r25, r31 4660 1a5e: 9f 07 cpc r25, r31
4220 1848: 21 f0 breq .+8 ; 0x1852 <f_open+0x5ca> 4661 1a60: 21 f0 breq .+8 ; 0x1a6a <f_open+0x6bc>
4221 fs->free_clust++; 4662 fs->free_clust++;
4222 184a: 01 96 adiw r24, 0x01 ; 1 4663 1a62: 01 96 adiw r24, 0x01 ; 1
4223 184c: f7 01 movw r30, r14 4664 1a64: f7 01 movw r30, r14
4224 184e: 93 8f std Z+27, r25 ; 0x1b 4665 1a66: 93 8f std Z+27, r25 ; 0x1b
4225 1850: 82 8f std Z+26, r24 ; 0x1a 4666 1a68: 82 8f std Z+26, r24 ; 0x1a
4226 1852: 83 01 movw r16, r6 4667 1a6a: 83 01 movw r16, r6
4227 { 4668 {
4228 CLUST nxt; 4669 CLUST nxt;
4229 FATFS *fs = FatFs; 4670 FATFS *fs = FatFs;
4230   4671  
4231   4672  
4232 while (clust >= 2 && clust < fs->max_clust) { 4673 while (clust >= 2 && clust < fs->max_clust) {
4233 1854: 02 30 cpi r16, 0x02 ; 2 4674 1a6c: 02 30 cpi r16, 0x02 ; 2
4234 1856: 11 05 cpc r17, r1 4675 1a6e: 11 05 cpc r17, r1
4235 1858: 30 f0 brcs .+12 ; 0x1866 <f_open+0x5de> 4676 1a70: 08 f4 brcc .+2 ; 0x1a74 <f_open+0x6c6>
-   4677 1a72: 72 c0 rjmp .+228 ; 0x1b58 <f_open+0x7aa>
4236 185a: f7 01 movw r30, r14 4678 1a74: f7 01 movw r30, r14
4237 185c: 86 89 ldd r24, Z+22 ; 0x16 4679 1a76: 86 89 ldd r24, Z+22 ; 0x16
4238 185e: 97 89 ldd r25, Z+23 ; 0x17 4680 1a78: 97 89 ldd r25, Z+23 ; 0x17
4239 1860: 08 17 cp r16, r24 4681 1a7a: 08 17 cp r16, r24
4240 1862: 19 07 cpc r17, r25 4682 1a7c: 19 07 cpc r17, r25
4241 1864: e0 f2 brcs .-72 ; 0x181e <f_open+0x596> 4683 1a7e: d0 f2 brcs .-76 ; 0x1a34 <f_open+0x686>
4242 #endif -  
4243 ST_WORD(&dir[DIR_FstClusLO], 0); /* cluster = 0 */ 4684 1a80: 6b c0 rjmp .+214 ; 0x1b58 <f_open+0x7aa>
4244 ST_DWORD(&dir[DIR_FileSize], 0); /* size = 0 */ 4685 ST_DWORD(&dir[DIR_FileSize], 0); /* size = 0 */
4245 fs->winflag = 1; 4686 fs->winflag = 1;
4246 dw = fs->winsect; /* Remove the cluster chain */ 4687 dw = fs->winsect; /* Remove the cluster chain */
4247 if (!remove_chain(rs) || !move_window(dw)) 4688 if (!remove_chain(rs) || !move_window(dw))
4248 1866: c2 01 movw r24, r4 -  
4249 1868: b1 01 movw r22, r2 -  
4250 186a: 0e 94 55 03 call 0x6aa ; 0x6aa <move_window> -  
4251 186e: 88 23 and r24, r24 -  
4252 1870: 09 f4 brne .+2 ; 0x1874 <f_open+0x5ec> -  
4253 1872: 60 c0 rjmp .+192 ; 0x1934 <f_open+0x6ac> -  
4254 return FR_RW_ERROR; 4689 return FR_RW_ERROR;
4255 fs->last_clust = rs - 1; /* Reuse the cluster hole */ 4690 fs->last_clust = rs - 1; /* Reuse the cluster hole */
4256 1874: 08 94 sec 4691 1a82: 08 94 sec
4257 1876: 81 08 sbc r8, r1 4692 1a84: c1 08 sbc r12, r1
4258 1878: 91 08 sbc r9, r1 4693 1a86: d1 08 sbc r13, r1
4259 187a: f5 01 movw r30, r10 4694 1a88: f4 01 movw r30, r8
4260 187c: 91 8e std Z+25, r9 ; 0x19 4695 1a8a: d1 8e std Z+25, r13 ; 0x19
4261 187e: 80 8e std Z+24, r8 ; 0x18 4696 1a8c: c0 8e std Z+24, r12 ; 0x18
4262 } 4697 }
4263 } 4698 }
4264 if (mode & FA_CREATE_ALWAYS) { 4699 if (mode & FA_CREATE_ALWAYS) {
4265 1880: fb 8d ldd r31, Y+27 ; 0x1b 4700 1a8e: fb 8d ldd r31, Y+27 ; 0x1b
4266 1882: f3 ff sbrs r31, 3 4701 1a90: f3 ff sbrs r31, 3
4267 1884: 23 c0 rjmp .+70 ; 0x18cc <f_open+0x644> 4702 1a92: 22 c0 rjmp .+68 ; 0x1ad8 <f_open+0x72a>
4268 dir[DIR_Attr] = AM_ARC; /* New attribute */ 4703 dir[DIR_Attr] = AM_ARC; /* New attribute */
4269 1886: 80 e2 ldi r24, 0x20 ; 32 4704 1a94: 80 e2 ldi r24, 0x20 ; 32
4270 1888: f6 01 movw r30, r12 4705 1a96: f5 01 movw r30, r10
4271 188a: 83 87 std Z+11, r24 ; 0x0b 4706 1a98: 83 87 std Z+11, r24 ; 0x0b
4272 dw = get_fattime(); 4707 dw = get_fattime();
4273 188c: 0e 94 bb 00 call 0x176 ; 0x176 <get_fattime> 4708 1a9a: 0e 94 b0 00 call 0x160 ; 0x160 <get_fattime>
4274 ST_DWORD(&dir[DIR_WrtTime], dw); /* Updated time */ 4709 ST_DWORD(&dir[DIR_WrtTime], dw); /* Updated time */
4275 1890: f6 01 movw r30, r12 4710 1a9e: f5 01 movw r30, r10
4276 1892: 66 8b std Z+22, r22 ; 0x16 4711 1aa0: 66 8b std Z+22, r22 ; 0x16
4277 1894: 77 8b std Z+23, r23 ; 0x17 4712 1aa2: 77 8b std Z+23, r23 ; 0x17
4278 1896: 80 8f std Z+24, r24 ; 0x18 4713 1aa4: 80 8f std Z+24, r24 ; 0x18
4279 1898: 91 8f std Z+25, r25 ; 0x19 4714 1aa6: 91 8f std Z+25, r25 ; 0x19
4280 ST_DWORD(&dir[DIR_CrtTime], dw); /* Created time */ 4715 ST_DWORD(&dir[DIR_CrtTime], dw); /* Created time */
4281 189a: 66 87 std Z+14, r22 ; 0x0e 4716 1aa8: 66 87 std Z+14, r22 ; 0x0e
4282 189c: 77 87 std Z+15, r23 ; 0x0f 4717 1aaa: 77 87 std Z+15, r23 ; 0x0f
4283 189e: 80 8b std Z+16, r24 ; 0x10 4718 1aac: 80 8b std Z+16, r24 ; 0x10
4284 18a0: 91 8b std Z+17, r25 ; 0x11 4719 1aae: 91 8b std Z+17, r25 ; 0x11
4285 fs->winflag = 1; 4720 fs->winflag = 1;
4286 18a2: 81 e0 ldi r24, 0x01 ; 1 4721 1ab0: 81 e0 ldi r24, 0x01 ; 1
4287 18a4: f5 01 movw r30, r10 4722 1ab2: f4 01 movw r30, r8
4288 18a6: 87 8f std Z+31, r24 ; 0x1f 4723 1ab4: 87 8f std Z+31, r24 ; 0x1f
4289 18a8: 11 c0 rjmp .+34 ; 0x18cc <f_open+0x644> 4724 1ab6: 10 c0 rjmp .+32 ; 0x1ad8 <f_open+0x72a>
4290 } 4725 }
4291 } 4726 }
4292 /* Open a File */ 4727 /* Open a File */
4293 else { 4728 else {
4294 #endif /* !_FS_READONLY */ 4729 #endif /* !_FS_READONLY */
4295 if (res != FR_OK) return res; /* Trace failed */ 4730 if (res != FR_OK) return res; /* Trace failed */
4296 18aa: 21 15 cp r18, r1 4731 1ab8: 21 15 cp r18, r1
4297 18ac: 31 05 cpc r19, r1 4732 1aba: 31 05 cpc r19, r1
4298 18ae: 09 f0 breq .+2 ; 0x18b2 <f_open+0x62a> 4733 1abc: 09 f0 breq .+2 ; 0x1ac0 <f_open+0x712>
4299 18b0: 75 c0 rjmp .+234 ; 0x199c <f_open+0x714> 4734 1abe: 47 c0 rjmp .+142 ; 0x1b4e <f_open+0x7a0>
4300 if (dir == NULL || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */ 4735 if (dir == NULL || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */
4301 18b2: c1 14 cp r12, r1 4736 1ac0: a1 14 cp r10, r1
4302 18b4: d1 04 cpc r13, r1 4737 1ac2: b1 04 cpc r11, r1
4303 18b6: 09 f4 brne .+2 ; 0x18ba <f_open+0x632> 4738 1ac4: 09 f4 brne .+2 ; 0x1ac8 <f_open+0x71a>
4304 18b8: 40 c0 rjmp .+128 ; 0x193a <f_open+0x6b2> 4739 1ac6: 41 c0 rjmp .+130 ; 0x1b4a <f_open+0x79c>
4305 18ba: f6 01 movw r30, r12 4740 1ac8: f5 01 movw r30, r10
4306 18bc: 83 85 ldd r24, Z+11 ; 0x0b 4741 1aca: 83 85 ldd r24, Z+11 ; 0x0b
4307 18be: 99 27 eor r25, r25 -  
4308 18c0: 84 fd sbrc r24, 4 4742 1acc: 84 fd sbrc r24, 4
4309 18c2: 3b c0 rjmp .+118 ; 0x193a <f_open+0x6b2> 4743 1ace: 3d c0 rjmp .+122 ; 0x1b4a <f_open+0x79c>
4310 return FR_NO_FILE; 4744 return FR_NO_FILE;
4311 #if !_FS_READONLY 4745 #if !_FS_READONLY
4312 if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */ 4746 if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */
4313 18c4: 41 ff sbrs r20, 1 4747 1ad0: 41 ff sbrs r20, 1
4314 18c6: 02 c0 rjmp .+4 ; 0x18cc <f_open+0x644> 4748 1ad2: 02 c0 rjmp .+4 ; 0x1ad8 <f_open+0x72a>
4315 18c8: 80 fd sbrc r24, 0 4749 1ad4: 80 fd sbrc r24, 0
4316 18ca: 31 c0 rjmp .+98 ; 0x192e <f_open+0x6a6> 4750 1ad6: 33 c0 rjmp .+102 ; 0x1b3e <f_open+0x790>
4317 return FR_DENIED; 4751 return FR_DENIED;
4318 } 4752 }
4319   4753  
4320 fp->dir_sect = fs->winsect; /* Pointer to the directory entry */ 4754 fp->dir_sect = fs->winsect; /* Pointer to the directory entry */
4321 18cc: f5 01 movw r30, r10 4755 1ad8: f4 01 movw r30, r8
4322 18ce: 84 81 ldd r24, Z+4 ; 0x04 4756 1ada: 84 81 ldd r24, Z+4 ; 0x04
4323 18d0: 95 81 ldd r25, Z+5 ; 0x05 4757 1adc: 95 81 ldd r25, Z+5 ; 0x05
4324 18d2: a6 81 ldd r26, Z+6 ; 0x06 4758 1ade: a6 81 ldd r26, Z+6 ; 0x06
4325 18d4: b7 81 ldd r27, Z+7 ; 0x07 4759 1ae0: b7 81 ldd r27, Z+7 ; 0x07
4326 18d6: ec 8d ldd r30, Y+28 ; 0x1c 4760 1ae2: ec 8d ldd r30, Y+28 ; 0x1c
4327 18d8: fd 8d ldd r31, Y+29 ; 0x1d 4761 1ae4: fd 8d ldd r31, Y+29 ; 0x1d
4328 18da: 86 8b std Z+22, r24 ; 0x16 4762 1ae6: 86 8b std Z+22, r24 ; 0x16
4329 18dc: 97 8b std Z+23, r25 ; 0x17 4763 1ae8: 97 8b std Z+23, r25 ; 0x17
4330 18de: a0 8f std Z+24, r26 ; 0x18 4764 1aea: a0 8f std Z+24, r26 ; 0x18
4331 18e0: b1 8f std Z+25, r27 ; 0x19 4765 1aec: b1 8f std Z+25, r27 ; 0x19
4332 fp->dir_ptr = dir; 4766 fp->dir_ptr = dir;
4333 18e2: d3 8e std Z+27, r13 ; 0x1b 4767 1aee: b3 8e std Z+27, r11 ; 0x1b
4334 18e4: c2 8e std Z+26, r12 ; 0x1a 4768 1af0: a2 8e std Z+26, r10 ; 0x1a
4335 #endif 4769 #endif
4336 fp->flag = mode; /* File access mode */ 4770 fp->flag = mode; /* File access mode */
4337 18e6: 2b 8d ldd r18, Y+27 ; 0x1b 4771 1af2: 2b 8d ldd r18, Y+27 ; 0x1b
4338 18e8: 22 83 std Z+2, r18 ; 0x02 4772 1af4: 22 83 std Z+2, r18 ; 0x02
4339 fp->org_clust = /* File start cluster */ 4773 fp->org_clust = /* File start cluster */
4340 18ea: f6 01 movw r30, r12 4774 1af6: f5 01 movw r30, r10
4341 18ec: 82 8d ldd r24, Z+26 ; 0x1a 4775 1af8: 82 8d ldd r24, Z+26 ; 0x1a
4342 18ee: 93 8d ldd r25, Z+27 ; 0x1b 4776 1afa: 93 8d ldd r25, Z+27 ; 0x1b
4343 18f0: ec 8d ldd r30, Y+28 ; 0x1c 4777 1afc: ec 8d ldd r30, Y+28 ; 0x1c
4344 18f2: fd 8d ldd r31, Y+29 ; 0x1d 4778 1afe: fd 8d ldd r31, Y+29 ; 0x1d
4345 18f4: 97 87 std Z+15, r25 ; 0x0f 4779 1b00: 97 87 std Z+15, r25 ; 0x0f
4346 18f6: 86 87 std Z+14, r24 ; 0x0e 4780 1b02: 86 87 std Z+14, r24 ; 0x0e
4347 #if _FAT32 4781 #if _FAT32
4348 ((DWORD)LD_WORD(&dir[DIR_FstClusHI]) << 16) | 4782 ((DWORD)LD_WORD(&dir[DIR_FstClusHI]) << 16) |
4349 #endif 4783 #endif
4350 LD_WORD(&dir[DIR_FstClusLO]); 4784 LD_WORD(&dir[DIR_FstClusLO]);
4351 fp->fsize = LD_DWORD(&dir[DIR_FileSize]); /* File size */ 4785 fp->fsize = LD_DWORD(&dir[DIR_FileSize]); /* File size */
4352 18f8: f6 01 movw r30, r12 4786 1b04: f5 01 movw r30, r10
4353 18fa: 84 8d ldd r24, Z+28 ; 0x1c 4787 1b06: 84 8d ldd r24, Z+28 ; 0x1c
4354 18fc: 95 8d ldd r25, Z+29 ; 0x1d 4788 1b08: 95 8d ldd r25, Z+29 ; 0x1d
4355 18fe: a6 8d ldd r26, Z+30 ; 0x1e 4789 1b0a: a6 8d ldd r26, Z+30 ; 0x1e
4356 1900: b7 8d ldd r27, Z+31 ; 0x1f 4790 1b0c: b7 8d ldd r27, Z+31 ; 0x1f
4357 1902: ec 8d ldd r30, Y+28 ; 0x1c 4791 1b0e: ec 8d ldd r30, Y+28 ; 0x1c
4358 1904: fd 8d ldd r31, Y+29 ; 0x1d 4792 1b10: fd 8d ldd r31, Y+29 ; 0x1d
4359 1906: 82 87 std Z+10, r24 ; 0x0a 4793 1b12: 82 87 std Z+10, r24 ; 0x0a
4360 1908: 93 87 std Z+11, r25 ; 0x0b 4794 1b14: 93 87 std Z+11, r25 ; 0x0b
4361 190a: a4 87 std Z+12, r26 ; 0x0c 4795 1b16: a4 87 std Z+12, r26 ; 0x0c
4362 190c: b5 87 std Z+13, r27 ; 0x0d 4796 1b18: b5 87 std Z+13, r27 ; 0x0d
4363 fp->fptr = 0; /* File ptr */ 4797 fp->fptr = 0; /* File ptr */
4364 190e: 16 82 std Z+6, r1 ; 0x06 4798 1b1a: 16 82 std Z+6, r1 ; 0x06
4365 1910: 17 82 std Z+7, r1 ; 0x07 4799 1b1c: 17 82 std Z+7, r1 ; 0x07
4366 1912: 10 86 std Z+8, r1 ; 0x08 4800 1b1e: 10 86 std Z+8, r1 ; 0x08
4367 1914: 11 86 std Z+9, r1 ; 0x09 4801 1b20: 11 86 std Z+9, r1 ; 0x09
4368 fp->sect_clust = 1; /* Sector counter */ 4802 fp->sect_clust = 1; /* Sector counter */
4369 1916: 81 e0 ldi r24, 0x01 ; 1 4803 1b22: 81 e0 ldi r24, 0x01 ; 1
4370 1918: 83 83 std Z+3, r24 ; 0x03 4804 1b24: 83 83 std Z+3, r24 ; 0x03
4371 fp->fs = fs; fp->id = fs->id; /* Owner file system object of the file */ 4805 fp->fs = fs; fp->id = fs->id; /* Owner file system object of the file */
4372 191a: b5 82 std Z+5, r11 ; 0x05 4806 1b26: 95 82 std Z+5, r9 ; 0x05
4373 191c: a4 82 std Z+4, r10 ; 0x04 4807 1b28: 84 82 std Z+4, r8 ; 0x04
4374 191e: d5 01 movw r26, r10 4808 1b2a: f4 01 movw r30, r8
4375 1920: 8d 91 ld r24, X+ 4809 1b2c: 80 81 ld r24, Z
4376 1922: 9c 91 ld r25, X 4810 1b2e: 91 81 ldd r25, Z+1 ; 0x01
-   4811 1b30: ec 8d ldd r30, Y+28 ; 0x1c
-   4812 1b32: fd 8d ldd r31, Y+29 ; 0x1d
4377 1924: 91 83 std Z+1, r25 ; 0x01 4813 1b34: 91 83 std Z+1, r25 ; 0x01
4378 1926: 80 83 st Z, r24 4814 1b36: 80 83 st Z, r24
4379 1928: 20 e0 ldi r18, 0x00 ; 0 4815 1b38: 20 e0 ldi r18, 0x00 ; 0
4380 192a: 30 e0 ldi r19, 0x00 ; 0 4816 1b3a: 30 e0 ldi r19, 0x00 ; 0
4381 192c: 37 c0 rjmp .+110 ; 0x199c <f_open+0x714> 4817 1b3c: 08 c0 rjmp .+16 ; 0x1b4e <f_open+0x7a0>
4382   4818  
4383 return FR_OK; 4819 return FR_OK;
4384 192e: 26 e0 ldi r18, 0x06 ; 6 4820 1b3e: 26 e0 ldi r18, 0x06 ; 6
4385 1930: 30 e0 ldi r19, 0x00 ; 0 4821 1b40: 30 e0 ldi r19, 0x00 ; 0
4386 1932: 34 c0 rjmp .+104 ; 0x199c <f_open+0x714> 4822 1b42: 05 c0 rjmp .+10 ; 0x1b4e <f_open+0x7a0>
4387 1934: 28 e0 ldi r18, 0x08 ; 8 4823 1b44: 28 e0 ldi r18, 0x08 ; 8
4388 1936: 30 e0 ldi r19, 0x00 ; 0 4824 1b46: 30 e0 ldi r19, 0x00 ; 0
4389 1938: 31 c0 rjmp .+98 ; 0x199c <f_open+0x714> 4825 1b48: 02 c0 rjmp .+4 ; 0x1b4e <f_open+0x7a0>
4390 193a: 22 e0 ldi r18, 0x02 ; 2 4826 1b4a: 22 e0 ldi r18, 0x02 ; 2
4391 193c: 30 e0 ldi r19, 0x00 ; 0 4827 1b4c: 30 e0 ldi r19, 0x00 ; 0
-   4828 }
-   4829 1b4e: c9 01 movw r24, r18
-   4830 1b50: 6d 96 adiw r28, 0x1d ; 29
-   4831 1b52: e2 e1 ldi r30, 0x12 ; 18
-   4832 1b54: 0c 94 e3 14 jmp 0x29c6 ; 0x29c6 <__epilogue_restores__>
-   4833 #endif
-   4834 ST_WORD(&dir[DIR_FstClusLO], 0); /* cluster = 0 */
-   4835 ST_DWORD(&dir[DIR_FileSize], 0); /* size = 0 */
-   4836 fs->winflag = 1;
-   4837 dw = fs->winsect; /* Remove the cluster chain */
-   4838 if (!remove_chain(rs) || !move_window(dw))
-   4839 1b58: c2 01 movw r24, r4
-   4840 1b5a: b1 01 movw r22, r2
-   4841 1b5c: 0e 94 5a 03 call 0x6b4 ; 0x6b4 <move_window>
-   4842 1b60: 88 23 and r24, r24
-   4843 1b62: 09 f0 breq .+2 ; 0x1b66 <f_open+0x7b8>
-   4844 1b64: 8e cf rjmp .-228 ; 0x1a82 <f_open+0x6d4>
4392 193e: 2e c0 rjmp .+92 ; 0x199c <f_open+0x714> 4845 1b66: ee cf rjmp .-36 ; 0x1b44 <f_open+0x796>
4393 ) 4846 )
4394 { 4847 {
4395 CLUST clust; 4848 CLUST clust;
4396 char ds; 4849 char ds;
4397 BYTE *dptr = NULL; 4850 BYTE *dptr = NULL;
4398 FATFS *fs = FatFs; 4851 FATFS *fs = FatFs;
4399 1940: e0 91 0a 01 lds r30, 0x010A 4852 1b68: c0 90 10 01 lds r12, 0x0110
4400 1944: f0 91 0b 01 lds r31, 0x010B 4853 1b6c: d0 90 11 01 lds r13, 0x0111
4401   4854  
4402 /* Initialize directory object */ 4855 /* Initialize directory object */
4403 clust = fs->dirbase; 4856 clust = fs->dirbase;
-   4857 1b70: f6 01 movw r30, r12
4404 1948: 84 85 ldd r24, Z+12 ; 0x0c 4858 1b72: 84 85 ldd r24, Z+12 ; 0x0c
4405 194a: 95 85 ldd r25, Z+13 ; 0x0d 4859 1b74: 95 85 ldd r25, Z+13 ; 0x0d
4406 dirobj->clust = dirobj->sclust = clust; 4860 dirobj->clust = dirobj->sclust = clust;
4407 dirobj->sect = clust2sect(clust); 4861 dirobj->sect = clust2sect(clust);
4408 } else 4862 } else
4409 #endif 4863 #endif
4410 { 4864 {
4411 dirobj->clust = dirobj->sclust = 0; 4865 dirobj->clust = dirobj->sclust = 0;
4412 194c: 1c 8a std Y+20, r1 ; 0x14 4866 1b76: 1c 8a std Y+20, r1 ; 0x14
4413 194e: 1b 8a std Y+19, r1 ; 0x13 4867 1b78: 1b 8a std Y+19, r1 ; 0x13
4414 1950: 1e 8a std Y+22, r1 ; 0x16 4868 1b7a: 1e 8a std Y+22, r1 ; 0x16
4415 1952: 1d 8a std Y+21, r1 ; 0x15 4869 1b7c: 1d 8a std Y+21, r1 ; 0x15
4416 dirobj->sect = clust; 4870 dirobj->sect = clust;
4417 1954: aa 27 eor r26, r26 4871 1b7e: a0 e0 ldi r26, 0x00 ; 0
4418 1956: bb 27 eor r27, r27 4872 1b80: b0 e0 ldi r27, 0x00 ; 0
4419 1958: 8f 8b std Y+23, r24 ; 0x17 4873 1b82: 8f 8b std Y+23, r24 ; 0x17
4420 195a: 98 8f std Y+24, r25 ; 0x18 4874 1b84: 98 8f std Y+24, r25 ; 0x18
4421 195c: a9 8f std Y+25, r26 ; 0x19 4875 1b86: a9 8f std Y+25, r26 ; 0x19
4422 195e: ba 8f std Y+26, r27 ; 0x1a 4876 1b88: ba 8f std Y+26, r27 ; 0x1a
4423 } 4877 }
4424 dirobj->index = 0; 4878 dirobj->index = 0;
4425 1960: 18 8a std Y+16, r1 ; 0x10 4879 1b8a: 18 8a std Y+16, r1 ; 0x10
4426 1962: 1f 86 std Y+15, r1 ; 0x0f 4880 1b8c: 1f 86 std Y+15, r1 ; 0x0f
4427 dirobj->fs = fs; 4881 dirobj->fs = fs;
4428 1964: fa 8b std Y+18, r31 ; 0x12 4882 1b8e: da 8a std Y+18, r13 ; 0x12
4429 1966: e9 8b std Y+17, r30 ; 0x11 4883 1b90: c9 8a std Y+17, r12 ; 0x11
4430   4884  
4431 if (*path == '\0') { /* Null path means the root directory */ 4885 if (*path == '\0') { /* Null path means the root directory */
4432 1968: d6 01 movw r26, r12 4886 1b92: f3 01 movw r30, r6
4433 196a: 8c 91 ld r24, X 4887 1b94: 80 81 ld r24, Z
4434 196c: 88 23 and r24, r24 4888 1b96: 88 23 and r24, r24
4435 196e: 09 f4 brne .+2 ; 0x1972 <f_open+0x6ea> 4889 1b98: 09 f0 breq .+2 ; 0x1b9c <f_open+0x7ee>
4436 1970: 91 ce rjmp .-734 ; 0x1694 <f_open+0x40c> 4890 1b9a: 4a cd rjmp .-1388 ; 0x1630 <f_open+0x282>
4437 1972: cc cd rjmp .-1128 ; 0x150c <f_open+0x284> 4891 1b9c: 2a ce rjmp .-940 ; 0x17f2 <f_open+0x444>
4438 DWORD dw; 4892 DWORD dw;
4439 if (res != FR_OK) { /* No file, create new */ 4893 if (res != FR_OK) { /* No file, create new */
4440 if (res != FR_NO_FILE) return res; 4894 if (res != FR_NO_FILE) return res;
4441 res = reserve_direntry(&dirobj, &dir); 4895 res = reserve_direntry(&dirobj, &dir);
4442 if (res != FR_OK) return res; 4896 if (res != FR_OK) return res;
4443 memset(dir, 0, 32); /* Initialize the new entry */ 4897 memset(dir, 0, 32); /* Initialize the new entry */
4444 1974: 80 e2 ldi r24, 0x20 ; 32 4898 1b9e: 80 e2 ldi r24, 0x20 ; 32
4445 1976: f6 01 movw r30, r12 4899 1ba0: f5 01 movw r30, r10
4446 1978: 11 92 st Z+, r1 4900 1ba2: 11 92 st Z+, r1
4447 197a: 8a 95 dec r24 4901 1ba4: 8a 95 dec r24
4448 197c: e9 f7 brne .-6 ; 0x1978 <f_open+0x6f0> 4902 1ba6: e9 f7 brne .-6 ; 0x1ba2 <f_open+0x7f4>
4449 memcpy(&dir[DIR_Name], fn, 8+3); 4903 memcpy(&dir[DIR_Name], fn, 8+3);
4450 197e: f6 01 movw r30, r12 4904 1ba8: d5 01 movw r26, r10
4451 1980: de 01 movw r26, r28 4905 1baa: fe 01 movw r30, r28
4452 1982: 11 96 adiw r26, 0x01 ; 1 4906 1bac: 31 96 adiw r30, 0x01 ; 1
4453 1984: 8b e0 ldi r24, 0x0B ; 11 4907 1bae: 8b e0 ldi r24, 0x0B ; 11
4454 1986: 0d 90 ld r0, X+ 4908 1bb0: 01 90 ld r0, Z+
4455 1988: 01 92 st Z+, r0 4909 1bb2: 0d 92 st X+, r0
4456 198a: 81 50 subi r24, 0x01 ; 1 4910 1bb4: 81 50 subi r24, 0x01 ; 1
4457 198c: e1 f7 brne .-8 ; 0x1986 <f_open+0x6fe> 4911 1bb6: e1 f7 brne .-8 ; 0x1bb0 <f_open+0x802>
4458 dir[DIR_NTres] = fn[11]; 4912 dir[DIR_NTres] = fn[11];
4459 198e: 8c 85 ldd r24, Y+12 ; 0x0c 4913 1bb8: 8c 85 ldd r24, Y+12 ; 0x0c
4460 1990: f6 01 movw r30, r12 4914 1bba: f5 01 movw r30, r10
4461 1992: 84 87 std Z+12, r24 ; 0x0c 4915 1bbc: 84 87 std Z+12, r24 ; 0x0c
4462 mode |= FA_CREATE_ALWAYS; 4916 mode |= FA_CREATE_ALWAYS;
4463 1994: fb 8d ldd r31, Y+27 ; 0x1b 4917 1bbe: fb 8d ldd r31, Y+27 ; 0x1b
4464 1996: f8 60 ori r31, 0x08 ; 8 4918 1bc0: f8 60 ori r31, 0x08 ; 8
4465 1998: fb 8f std Y+27, r31 ; 0x1b 4919 1bc2: fb 8f std Y+27, r31 ; 0x1b
4466 199a: 72 cf rjmp .-284 ; 0x1880 <f_open+0x5f8> 4920 1bc4: 64 cf rjmp .-312 ; 0x1a8e <f_open+0x6e0>
4467 fp->fptr = 0; /* File ptr */ -  
4468 fp->sect_clust = 1; /* Sector counter */ -  
4469 fp->fs = fs; fp->id = fs->id; /* Owner file system object of the file */ -  
4470   -  
4471 return FR_OK; -  
4472 } -  
4473 199c: c9 01 movw r24, r18 -  
4474 199e: e2 e1 ldi r30, 0x12 ; 18 -  
4475 19a0: 6d 96 adiw r28, 0x1d ; 29 -  
4476 19a2: 0c 94 46 11 jmp 0x228c ; 0x228c <__epilogue_restores__> -  
4477   -  
4478 000019a6 <wait_ready>: -  
4479 /* Wait for card ready */ -  
4480 /*-----------------------------------------------------------------------*/ -  
4481   4921  
4482 static -  
4483 BYTE wait_ready (void) -  
4484 { -  
4485 19a6: 82 e3 ldi r24, 0x32 ; 50 -  
4486 19a8: 80 93 10 01 sts 0x0110, r24 -  
4487 /*-----------------------------------------------------------------------*/ -  
4488   -  
4489 static -  
4490 BYTE rcvr_spi (void) -  
4491 { -  
4492 SPDR = 0xFF; -  
4493 19ac: 8f ef ldi r24, 0xFF ; 255 -  
4494 19ae: 8e bd out 0x2e, r24 ; 46 -  
4495 loop_until_bit_is_set(SPSR, SPIF); -  
4496 19b0: 0d b4 in r0, 0x2d ; 45 -  
4497 19b2: 07 fe sbrs r0, 7 -  
4498 19b4: fd cf rjmp .-6 ; 0x19b0 <wait_ready+0xa> -  
4499 return SPDR; -  
4500 19b6: 8e b5 in r24, 0x2e ; 46 -  
4501 /*-----------------------------------------------------------------------*/ -  
4502   -  
4503 static -  
4504 BYTE rcvr_spi (void) -  
4505 { -  
4506 SPDR = 0xFF; -  
4507 19b8: 8f ef ldi r24, 0xFF ; 255 -  
4508 19ba: 8e bd out 0x2e, r24 ; 46 -  
4509 loop_until_bit_is_set(SPSR, SPIF); -  
4510 19bc: 0d b4 in r0, 0x2d ; 45 -  
4511 19be: 07 fe sbrs r0, 7 -  
4512 19c0: fd cf rjmp .-6 ; 0x19bc <wait_ready+0x16> -  
4513 return SPDR; -  
4514 19c2: 8e b5 in r24, 0x2e ; 46 -  
4515 19c4: 28 2f mov r18, r24 -  
4516 19c6: 33 27 eor r19, r19 -  
4517   -  
4518 Timer2 = 50; /* Wait for ready in timeout of 500ms */ -  
4519 rcvr_spi(); -  
4520 do -  
4521 res = rcvr_spi(); -  
4522 while ((res != 0xFF) && Timer2); -  
4523 19c8: 8f 3f cpi r24, 0xFF ; 255 -  
4524 19ca: 21 f0 breq .+8 ; 0x19d4 <wait_ready+0x2e> -  
4525 19cc: 80 91 10 01 lds r24, 0x0110 -  
4526 19d0: 88 23 and r24, r24 -  
4527 19d2: 91 f7 brne .-28 ; 0x19b8 <wait_ready+0x12> -  
4528   -  
4529 return res; -  
4530 } -  
4531 19d4: c9 01 movw r24, r18 -  
4532 19d6: 08 95 ret -  
4533   -  
4534 000019d8 <rcvr_datablock>: 4922 00001bc6 <rcvr_datablock>:
4535 static 4923 static
4536 BOOL rcvr_datablock ( 4924 BOOL rcvr_datablock (
4537 BYTE *buff, /* Data buffer to store received data */ 4925 BYTE *buff, /* Data buffer to store received data */
4538 UINT btr /* Byte count (must be even number) */ 4926 UINT btr /* Byte count (must be even number) */
4539 ) 4927 )
4540 { 4928 {
4541 19d8: fc 01 movw r30, r24 4929 1bc6: fc 01 movw r30, r24
4542 BYTE token; 4930 BYTE token;
4543   4931  
4544   4932  
4545 Timer1 = 10; 4933 Timer1 = 10;
4546 19da: 8a e0 ldi r24, 0x0A ; 10 4934 1bc8: 8a e0 ldi r24, 0x0A ; 10
4547 19dc: 80 93 0f 01 sts 0x010F, r24 4935 1bca: 80 93 15 01 sts 0x0115, r24
4548 /*-----------------------------------------------------------------------*/ 4936 /*-----------------------------------------------------------------------*/
4549   4937  
4550 static 4938 static
4551 BYTE rcvr_spi (void) 4939 BYTE rcvr_spi (void)
4552 { 4940 {
4553 SPDR = 0xFF; 4941 SPDR = 0xFF;
4554 19e0: 8f ef ldi r24, 0xFF ; 255 4942 1bce: 9f ef ldi r25, 0xFF ; 255
4555 19e2: 8e bd out 0x2e, r24 ; 46 4943 1bd0: 9e bd out 0x2e, r25 ; 46
4556 loop_until_bit_is_set(SPSR, SPIF); 4944 loop_until_bit_is_set(SPSR, SPIF);
4557 19e4: 0d b4 in r0, 0x2d ; 45 4945 1bd2: 0d b4 in r0, 0x2d ; 45
4558 19e6: 07 fe sbrs r0, 7 4946 1bd4: 07 fe sbrs r0, 7
4559 19e8: fd cf rjmp .-6 ; 0x19e4 <rcvr_datablock+0xc> 4947 1bd6: fd cf rjmp .-6 ; 0x1bd2 <rcvr_datablock+0xc>
4560 return SPDR; 4948 return SPDR;
4561 19ea: 8e b5 in r24, 0x2e ; 46 4949 1bd8: 8e b5 in r24, 0x2e ; 46
4562   4950  
4563   4951  
4564 Timer1 = 10; 4952 Timer1 = 10;
4565 do { /* Wait for data packet in timeout of 100ms */ 4953 do { /* Wait for data packet in timeout of 100ms */
4566 token = rcvr_spi(); 4954 token = rcvr_spi();
4567 } while ((token == 0xFF) && Timer1); 4955 } while ((token == 0xFF) && Timer1);
4568 19ec: 8f 3f cpi r24, 0xFF ; 255 4956 1bda: 8f 3f cpi r24, 0xFF ; 255
4569 19ee: 29 f4 brne .+10 ; 0x19fa <rcvr_datablock+0x22> 4957 1bdc: 29 f4 brne .+10 ; 0x1be8 <rcvr_datablock+0x22>
4570 19f0: 80 91 0f 01 lds r24, 0x010F 4958 1bde: 80 91 15 01 lds r24, 0x0115
4571 19f4: 88 23 and r24, r24 4959 1be2: 88 23 and r24, r24
4572 19f6: 29 f1 breq .+74 ; 0x1a42 <rcvr_datablock+0x6a> 4960 1be4: a9 f7 brne .-22 ; 0x1bd0 <rcvr_datablock+0xa>
4573 19f8: f3 cf rjmp .-26 ; 0x19e0 <rcvr_datablock+0x8> 4961 1be6: 22 c0 rjmp .+68 ; 0x1c2c <rcvr_datablock+0x66>
4574 if(token != 0xFE) return FALSE; /* If not valid data token, retutn with error */ 4962 if(token != 0xFE) return FALSE; /* If not valid data token, retutn with error */
4575 19fa: 8e 3f cpi r24, 0xFE ; 254 4963 1be8: 8e 3f cpi r24, 0xFE ; 254
4576 19fc: 11 f5 brne .+68 ; 0x1a42 <rcvr_datablock+0x6a> 4964 1bea: 01 f5 brne .+64 ; 0x1c2c <rcvr_datablock+0x66>
4577   4965  
4578 do { /* Receive the data block into buffer */ 4966 do { /* Receive the data block into buffer */
4579 rcvr_spi_m(buff++); 4967 rcvr_spi_m(buff++);
4580 19fe: 8f ef ldi r24, 0xFF ; 255 4968 1bec: 9f ef ldi r25, 0xFF ; 255
4581 1a00: 8e bd out 0x2e, r24 ; 46 4969 1bee: 9e bd out 0x2e, r25 ; 46
4582 1a02: 0d b4 in r0, 0x2d ; 45 4970 1bf0: 0d b4 in r0, 0x2d ; 45
4583 1a04: 07 fe sbrs r0, 7 4971 1bf2: 07 fe sbrs r0, 7
4584 1a06: fd cf rjmp .-6 ; 0x1a02 <rcvr_datablock+0x2a> 4972 1bf4: fd cf rjmp .-6 ; 0x1bf0 <rcvr_datablock+0x2a>
4585 1a08: 8e b5 in r24, 0x2e ; 46 4973 1bf6: 8e b5 in r24, 0x2e ; 46
4586 1a0a: 80 83 st Z, r24 4974 1bf8: 80 83 st Z, r24
4587 rcvr_spi_m(buff++); 4975 rcvr_spi_m(buff++);
4588 1a0c: 8f ef ldi r24, 0xFF ; 255 -  
4589 1a0e: 8e bd out 0x2e, r24 ; 46 4976 1bfa: 9e bd out 0x2e, r25 ; 46
4590 1a10: 0d b4 in r0, 0x2d ; 45 4977 1bfc: 0d b4 in r0, 0x2d ; 45
4591 1a12: 07 fe sbrs r0, 7 4978 1bfe: 07 fe sbrs r0, 7
4592 1a14: fd cf rjmp .-6 ; 0x1a10 <rcvr_datablock+0x38> 4979 1c00: fd cf rjmp .-6 ; 0x1bfc <rcvr_datablock+0x36>
4593 1a16: 8e b5 in r24, 0x2e ; 46 4980 1c02: 8e b5 in r24, 0x2e ; 46
4594 1a18: 81 83 std Z+1, r24 ; 0x01 4981 1c04: 81 83 std Z+1, r24 ; 0x01
4595 } while (btr -= 2); 4982 } while (btr -= 2);
4596 1a1a: 62 50 subi r22, 0x02 ; 2 4983 1c06: 62 50 subi r22, 0x02 ; 2
4597 1a1c: 70 40 sbci r23, 0x00 ; 0 4984 1c08: 70 40 sbci r23, 0x00 ; 0
4598 1a1e: 11 f0 breq .+4 ; 0x1a24 <rcvr_datablock+0x4c> 4985 1c0a: 11 f0 breq .+4 ; 0x1c10 <rcvr_datablock+0x4a>
-   4986 static
-   4987 BOOL rcvr_datablock (
-   4988 BYTE *buff, /* Data buffer to store received data */
-   4989 UINT btr /* Byte count (must be even number) */
-   4990 )
-   4991 {
4599 1a20: 32 96 adiw r30, 0x02 ; 2 4992 1c0c: 32 96 adiw r30, 0x02 ; 2
4600 1a22: ed cf rjmp .-38 ; 0x19fe <rcvr_datablock+0x26> 4993 1c0e: ef cf rjmp .-34 ; 0x1bee <rcvr_datablock+0x28>
4601 /*-----------------------------------------------------------------------*/ 4994 /*-----------------------------------------------------------------------*/
4602   4995  
4603 static 4996 static
4604 BYTE rcvr_spi (void) 4997 BYTE rcvr_spi (void)
4605 { 4998 {
4606 SPDR = 0xFF; 4999 SPDR = 0xFF;
4607 1a24: 8f ef ldi r24, 0xFF ; 255 5000 1c10: 8f ef ldi r24, 0xFF ; 255
4608 1a26: 8e bd out 0x2e, r24 ; 46 5001 1c12: 8e bd out 0x2e, r24 ; 46
4609 loop_until_bit_is_set(SPSR, SPIF); 5002 loop_until_bit_is_set(SPSR, SPIF);
4610 1a28: 0d b4 in r0, 0x2d ; 45 5003 1c14: 0d b4 in r0, 0x2d ; 45
4611 1a2a: 07 fe sbrs r0, 7 5004 1c16: 07 fe sbrs r0, 7
4612 1a2c: fd cf rjmp .-6 ; 0x1a28 <rcvr_datablock+0x50> 5005 1c18: fd cf rjmp .-6 ; 0x1c14 <rcvr_datablock+0x4e>
4613 return SPDR; 5006 return SPDR;
4614 1a2e: 8e b5 in r24, 0x2e ; 46 5007 1c1a: 8e b5 in r24, 0x2e ; 46
4615 /*-----------------------------------------------------------------------*/ 5008 /*-----------------------------------------------------------------------*/
4616   5009  
4617 static 5010 static
4618 BYTE rcvr_spi (void) 5011 BYTE rcvr_spi (void)
4619 { 5012 {
4620 SPDR = 0xFF; 5013 SPDR = 0xFF;
4621 1a30: 8f ef ldi r24, 0xFF ; 255 5014 1c1c: 8f ef ldi r24, 0xFF ; 255
4622 1a32: 8e bd out 0x2e, r24 ; 46 5015 1c1e: 8e bd out 0x2e, r24 ; 46
4623 loop_until_bit_is_set(SPSR, SPIF); 5016 loop_until_bit_is_set(SPSR, SPIF);
4624 1a34: 0d b4 in r0, 0x2d ; 45 5017 1c20: 0d b4 in r0, 0x2d ; 45
4625 1a36: 07 fe sbrs r0, 7 5018 1c22: 07 fe sbrs r0, 7
4626 1a38: fd cf rjmp .-6 ; 0x1a34 <rcvr_datablock+0x5c> 5019 1c24: fd cf rjmp .-6 ; 0x1c20 <rcvr_datablock+0x5a>
4627 return SPDR; 5020 return SPDR;
4628 1a3a: 8e b5 in r24, 0x2e ; 46 5021 1c26: 8e b5 in r24, 0x2e ; 46
4629 1a3c: 81 e0 ldi r24, 0x01 ; 1 5022 1c28: 81 e0 ldi r24, 0x01 ; 1
4630 1a3e: 90 e0 ldi r25, 0x00 ; 0 -  
4631 1a40: 08 95 ret 5023 1c2a: 08 95 ret
4632 rcvr_spi_m(buff++); 5024 rcvr_spi_m(buff++);
4633 } while (btr -= 2); 5025 } while (btr -= 2);
4634 rcvr_spi(); /* Discard CRC */ 5026 rcvr_spi(); /* Discard CRC */
4635 rcvr_spi(); 5027 rcvr_spi();
4636   5028  
4637 return TRUE; /* Return with success */ 5029 return TRUE; /* Return with success */
4638 1a42: 80 e0 ldi r24, 0x00 ; 0 5030 1c2c: 80 e0 ldi r24, 0x00 ; 0
4639 1a44: 90 e0 ldi r25, 0x00 ; 0 -  
4640 } 5031 }
4641 1a46: 08 95 ret 5032 1c2e: 08 95 ret
4642   5033  
4643 00001a48 <xmit_datablock>: 5034 00001c30 <xmit_datablock>:
4644 static 5035 static
4645 BOOL xmit_datablock ( 5036 BOOL xmit_datablock (
4646 const BYTE *buff, /* 512 byte data block to be transmitted */ 5037 const BYTE *buff, /* 512 byte data block to be transmitted */
4647 BYTE token /* Data/Stop token */ 5038 BYTE token /* Data/Stop token */
4648 ) 5039 )
4649 { 5040 {
4650 1a48: 1f 93 push r17 5041 1c30: fc 01 movw r30, r24
-   5042 BYTE wait_ready (void)
-   5043 {
-   5044 BYTE res;
-   5045  
-   5046  
-   5047 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   5048 1c32: 82 e3 ldi r24, 0x32 ; 50
-   5049 1c34: 80 93 16 01 sts 0x0116, r24
-   5050 /*-----------------------------------------------------------------------*/
-   5051  
-   5052 static
-   5053 BYTE rcvr_spi (void)
-   5054 {
-   5055 SPDR = 0xFF;
-   5056 1c38: 8f ef ldi r24, 0xFF ; 255
-   5057 1c3a: 8e bd out 0x2e, r24 ; 46
-   5058 loop_until_bit_is_set(SPSR, SPIF);
-   5059 1c3c: 0d b4 in r0, 0x2d ; 45
4651 1a4a: cf 93 push r28 5060 1c3e: 07 fe sbrs r0, 7
-   5061 1c40: fd cf rjmp .-6 ; 0x1c3c <xmit_datablock+0xc>
-   5062 return SPDR;
-   5063 1c42: 8e b5 in r24, 0x2e ; 46
-   5064 /*-----------------------------------------------------------------------*/
-   5065  
-   5066 static
-   5067 BYTE rcvr_spi (void)
-   5068 {
-   5069 SPDR = 0xFF;
-   5070 1c44: 9f ef ldi r25, 0xFF ; 255
-   5071 1c46: 9e bd out 0x2e, r25 ; 46
-   5072 loop_until_bit_is_set(SPSR, SPIF);
-   5073 1c48: 0d b4 in r0, 0x2d ; 45
4652 1a4c: df 93 push r29 5074 1c4a: 07 fe sbrs r0, 7
-   5075 1c4c: fd cf rjmp .-6 ; 0x1c48 <xmit_datablock+0x18>
-   5076 return SPDR;
4653 1a4e: ec 01 movw r28, r24 5077 1c4e: 8e b5 in r24, 0x2e ; 46
-   5078  
-   5079 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   5080 rcvr_spi();
-   5081 do
-   5082 res = rcvr_spi();
-   5083 while ((res != 0xFF) && Timer2);
-   5084 1c50: 8f 3f cpi r24, 0xFF ; 255
-   5085 1c52: 31 f0 breq .+12 ; 0x1c60 <xmit_datablock+0x30>
-   5086 1c54: 80 91 16 01 lds r24, 0x0116
4654 1a50: 16 2f mov r17, r22 5087 1c58: 88 23 and r24, r24
-   5088 1c5a: a9 f7 brne .-22 ; 0x1c46 <xmit_datablock+0x16>
-   5089 1c5c: 90 e0 ldi r25, 0x00 ; 0
-   5090 1c5e: 2e c0 rjmp .+92 ; 0x1cbc <xmit_datablock+0x8c>
4655 BYTE resp, wc; 5091 BYTE resp, wc;
4656   5092  
4657   5093  
4658 if (wait_ready() != 0xFF) return FALSE; 5094 if (wait_ready() != 0xFF) return FALSE;
4659 1a52: 0e 94 d3 0c call 0x19a6 ; 0x19a6 <wait_ready> -  
4660 1a56: 8f 3f cpi r24, 0xFF ; 255 -  
4661 1a58: 19 f0 breq .+6 ; 0x1a60 <xmit_datablock+0x18> -  
4662 1a5a: 80 e0 ldi r24, 0x00 ; 0 -  
4663 1a5c: 90 e0 ldi r25, 0x00 ; 0 -  
4664 1a5e: 31 c0 rjmp .+98 ; 0x1ac2 <xmit_datablock+0x7a> -  
4665   5095  
4666 xmit_spi(token); /* Xmit data token */ 5096 xmit_spi(token); /* Xmit data token */
4667 1a60: 1e bd out 0x2e, r17 ; 46 5097 1c60: 6e bd out 0x2e, r22 ; 46
4668 1a62: 0d b4 in r0, 0x2d ; 45 5098 1c62: 0d b4 in r0, 0x2d ; 45
4669 1a64: 07 fe sbrs r0, 7 5099 1c64: 07 fe sbrs r0, 7
4670 1a66: fd cf rjmp .-6 ; 0x1a62 <xmit_datablock+0x1a> 5100 1c66: fd cf rjmp .-6 ; 0x1c62 <xmit_datablock+0x32>
4671 if (token != 0xFD) { /* Is data token */ 5101 if (token != 0xFD) { /* Is data token */
4672 1a68: 1d 3f cpi r17, 0xFD ; 253 5102 1c68: 6d 3f cpi r22, 0xFD ; 253
4673 1a6a: 19 f4 brne .+6 ; 0x1a72 <xmit_datablock+0x2a> 5103 1c6a: 11 f4 brne .+4 ; 0x1c70 <xmit_datablock+0x40>
4674 1a6c: 81 e0 ldi r24, 0x01 ; 1 5104 1c6c: 91 e0 ldi r25, 0x01 ; 1
-   5105 1c6e: 26 c0 rjmp .+76 ; 0x1cbc <xmit_datablock+0x8c>
4675 1a6e: 90 e0 ldi r25, 0x00 ; 0 5106 1c70: 90 e0 ldi r25, 0x00 ; 0
-   5107 wc = 0;
-   5108 do { /* Xmit the 512 byte data block to MMC */
-   5109 xmit_spi(*buff++);
-   5110 1c72: 80 81 ld r24, Z
-   5111 1c74: 8e bd out 0x2e, r24 ; 46
-   5112 1c76: 0d b4 in r0, 0x2d ; 45
-   5113 1c78: 07 fe sbrs r0, 7
4676 1a70: 28 c0 rjmp .+80 ; 0x1ac2 <xmit_datablock+0x7a> 5114 1c7a: fd cf rjmp .-6 ; 0x1c76 <xmit_datablock+0x46>
-   5115 xmit_spi(*buff++);
-   5116 1c7c: 81 81 ldd r24, Z+1 ; 0x01
-   5117 1c7e: 8e bd out 0x2e, r24 ; 46
-   5118 1c80: 0d b4 in r0, 0x2d ; 45
-   5119 1c82: 07 fe sbrs r0, 7
-   5120 1c84: fd cf rjmp .-6 ; 0x1c80 <xmit_datablock+0x50>
-   5121 } while (--wc);
4677 1a72: 90 e0 ldi r25, 0x00 ; 0 5122 1c86: 91 50 subi r25, 0x01 ; 1
-   5123 1c88: 11 f0 breq .+4 ; 0x1c8e <xmit_datablock+0x5e>
-   5124 static
-   5125 BOOL xmit_datablock (
-   5126 const BYTE *buff, /* 512 byte data block to be transmitted */
-   5127 BYTE token /* Data/Stop token */
-   5128 )
-   5129 {
-   5130 1c8a: 32 96 adiw r30, 0x02 ; 2
-   5131 1c8c: f2 cf rjmp .-28 ; 0x1c72 <xmit_datablock+0x42>
4678 wc = 0; 5132 wc = 0;
4679 do { /* Xmit the 512 byte data block to MMC */ 5133 do { /* Xmit the 512 byte data block to MMC */
4680 xmit_spi(*buff++); 5134 xmit_spi(*buff++);
4681 1a74: 88 81 ld r24, Y -  
4682 1a76: 8e bd out 0x2e, r24 ; 46 -  
4683 1a78: 0d b4 in r0, 0x2d ; 45 -  
4684 1a7a: 07 fe sbrs r0, 7 -  
4685 1a7c: fd cf rjmp .-6 ; 0x1a78 <xmit_datablock+0x30> -  
4686 xmit_spi(*buff++); 5135 xmit_spi(*buff++);
4687 1a7e: 89 81 ldd r24, Y+1 ; 0x01 -  
4688 1a80: 8e bd out 0x2e, r24 ; 46 -  
4689 1a82: 0d b4 in r0, 0x2d ; 45 -  
4690 1a84: 07 fe sbrs r0, 7 -  
4691 1a86: fd cf rjmp .-6 ; 0x1a82 <xmit_datablock+0x3a> -  
4692 } while (--wc); 5136 } while (--wc);
4693 1a88: 91 50 subi r25, 0x01 ; 1 -  
4694 1a8a: 11 f0 breq .+4 ; 0x1a90 <xmit_datablock+0x48> -  
4695 1a8c: 22 96 adiw r28, 0x02 ; 2 -  
4696 1a8e: f2 cf rjmp .-28 ; 0x1a74 <xmit_datablock+0x2c> -  
4697 xmit_spi(0xFF); /* CRC (Dummy) */ 5137 xmit_spi(0xFF); /* CRC (Dummy) */
4698 1a90: 8f ef ldi r24, 0xFF ; 255 5138 1c8e: 8f ef ldi r24, 0xFF ; 255
4699 1a92: 8e bd out 0x2e, r24 ; 46 5139 1c90: 8e bd out 0x2e, r24 ; 46
4700 1a94: 0d b4 in r0, 0x2d ; 45 5140 1c92: 0d b4 in r0, 0x2d ; 45
4701 1a96: 07 fe sbrs r0, 7 5141 1c94: 07 fe sbrs r0, 7
4702 1a98: fd cf rjmp .-6 ; 0x1a94 <xmit_datablock+0x4c> 5142 1c96: fd cf rjmp .-6 ; 0x1c92 <xmit_datablock+0x62>
4703 xmit_spi(0xFF); 5143 xmit_spi(0xFF);
4704 1a9a: 8f ef ldi r24, 0xFF ; 255 5144 1c98: 8f ef ldi r24, 0xFF ; 255
4705 1a9c: 8e bd out 0x2e, r24 ; 46 5145 1c9a: 8e bd out 0x2e, r24 ; 46
4706 1a9e: 0d b4 in r0, 0x2d ; 45 5146 1c9c: 0d b4 in r0, 0x2d ; 45
4707 1aa0: 07 fe sbrs r0, 7 5147 1c9e: 07 fe sbrs r0, 7
4708 1aa2: fd cf rjmp .-6 ; 0x1a9e <xmit_datablock+0x56> 5148 1ca0: fd cf rjmp .-6 ; 0x1c9c <xmit_datablock+0x6c>
4709 /*-----------------------------------------------------------------------*/ 5149 /*-----------------------------------------------------------------------*/
4710   5150  
4711 static 5151 static
4712 BYTE rcvr_spi (void) 5152 BYTE rcvr_spi (void)
4713 { 5153 {
4714 SPDR = 0xFF; 5154 SPDR = 0xFF;
4715 1aa4: 8f ef ldi r24, 0xFF ; 255 5155 1ca2: 8f ef ldi r24, 0xFF ; 255
4716 1aa6: 8e bd out 0x2e, r24 ; 46 5156 1ca4: 8e bd out 0x2e, r24 ; 46
4717 loop_until_bit_is_set(SPSR, SPIF); 5157 loop_until_bit_is_set(SPSR, SPIF);
4718 1aa8: 0d b4 in r0, 0x2d ; 45 5158 1ca6: 0d b4 in r0, 0x2d ; 45
4719 1aaa: 07 fe sbrs r0, 7 5159 1ca8: 07 fe sbrs r0, 7
4720 1aac: fd cf rjmp .-6 ; 0x1aa8 <xmit_datablock+0x60> 5160 1caa: fd cf rjmp .-6 ; 0x1ca6 <xmit_datablock+0x76>
4721 return SPDR; 5161 return SPDR;
4722 1aae: 8e b5 in r24, 0x2e ; 46 5162 1cac: 8e b5 in r24, 0x2e ; 46
4723 1ab0: 90 e0 ldi r25, 0x00 ; 0 5163 1cae: 90 e0 ldi r25, 0x00 ; 0
4724 1ab2: 8f 71 andi r24, 0x1F ; 31 5164 1cb0: 8f 71 andi r24, 0x1F ; 31
4725 1ab4: 85 30 cpi r24, 0x05 ; 5 5165 1cb2: 85 30 cpi r24, 0x05 ; 5
4726 1ab6: 09 f0 breq .+2 ; 0x1aba <xmit_datablock+0x72> 5166 1cb4: 09 f0 breq .+2 ; 0x1cb8 <xmit_datablock+0x88>
4727 1ab8: 91 e0 ldi r25, 0x01 ; 1 5167 1cb6: 91 e0 ldi r25, 0x01 ; 1
4728 1aba: 81 e0 ldi r24, 0x01 ; 1 5168 1cb8: 81 e0 ldi r24, 0x01 ; 1
4729 1abc: 98 27 eor r25, r24 5169 1cba: 98 27 eor r25, r24
4730 1abe: 89 2f mov r24, r25 -  
4731 1ac0: 99 27 eor r25, r25 5170 if ((resp & 0x1F) != 0x05) /* If not accepted, return with error */
4732 1ac2: df 91 pop r29 5171 return FALSE;
-   5172 }
-   5173  
4733 1ac4: cf 91 pop r28 5174 return TRUE;
-   5175 }
4734 1ac6: 1f 91 pop r17 5176 1cbc: 89 2f mov r24, r25
4735 1ac8: 08 95 ret 5177 1cbe: 08 95 ret
4736   5178  
4737 00001aca <send_cmd>: 5179 00001cc0 <send_cmd>:
4738 static 5180 static
4739 BYTE send_cmd ( 5181 BYTE send_cmd (
4740 BYTE cmd, /* Command byte */ 5182 BYTE cmd, /* Command byte */
4741 DWORD arg /* Argument */ 5183 DWORD arg /* Argument */
4742 ) 5184 )
4743 { 5185 {
4744 1aca: df 92 push r13 5186 1cc0: 28 2f mov r18, r24
-   5187 BYTE wait_ready (void)
-   5188 {
-   5189 BYTE res;
-   5190  
-   5191  
-   5192 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   5193 1cc2: 82 e3 ldi r24, 0x32 ; 50
-   5194 1cc4: 80 93 16 01 sts 0x0116, r24
-   5195 /*-----------------------------------------------------------------------*/
-   5196  
-   5197 static
-   5198 BYTE rcvr_spi (void)
-   5199 {
-   5200 SPDR = 0xFF;
-   5201 1cc8: 8f ef ldi r24, 0xFF ; 255
4745 1acc: ef 92 push r14 5202 1cca: 8e bd out 0x2e, r24 ; 46
-   5203 loop_until_bit_is_set(SPSR, SPIF);
4746 1ace: ff 92 push r15 5204 1ccc: 0d b4 in r0, 0x2d ; 45
4747 1ad0: 0f 93 push r16 5205 1cce: 07 fe sbrs r0, 7
-   5206 1cd0: fd cf rjmp .-6 ; 0x1ccc <send_cmd+0xc>
-   5207 return SPDR;
4748 1ad2: 1f 93 push r17 5208 1cd2: 8e b5 in r24, 0x2e ; 46
-   5209 /*-----------------------------------------------------------------------*/
-   5210  
-   5211 static
-   5212 BYTE rcvr_spi (void)
-   5213 {
-   5214 SPDR = 0xFF;
4749 1ad4: d8 2e mov r13, r24 5215 1cd4: 9f ef ldi r25, 0xFF ; 255
4750 1ad6: 7a 01 movw r14, r20 5216 1cd6: 9e bd out 0x2e, r25 ; 46
-   5217 loop_until_bit_is_set(SPSR, SPIF);
-   5218 1cd8: 0d b4 in r0, 0x2d ; 45
4751 1ad8: 8b 01 movw r16, r22 5219 1cda: 07 fe sbrs r0, 7
-   5220 1cdc: fd cf rjmp .-6 ; 0x1cd8 <send_cmd+0x18>
4752 BYTE n, res; 5221 return SPDR;
-   5222 1cde: 8e b5 in r24, 0x2e ; 46
-   5223  
-   5224 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   5225 rcvr_spi();
-   5226 do
-   5227 res = rcvr_spi();
-   5228 while ((res != 0xFF) && Timer2);
-   5229 1ce0: 8f 3f cpi r24, 0xFF ; 255
-   5230 1ce2: 31 f0 breq .+12 ; 0x1cf0 <send_cmd+0x30>
-   5231 1ce4: 80 91 16 01 lds r24, 0x0116
-   5232 1ce8: 88 23 and r24, r24
-   5233 1cea: a9 f7 brne .-22 ; 0x1cd6 <send_cmd+0x16>
-   5234 1cec: 8f ef ldi r24, 0xFF ; 255
-   5235 1cee: 08 95 ret
4753   5236  
4754   5237  
4755 if (wait_ready() != 0xFF) return 0xFF; 5238 if (wait_ready() != 0xFF) return 0xFF;
4756 1ada: 0e 94 d3 0c call 0x19a6 ; 0x19a6 <wait_ready> -  
4757 1ade: 8f 3f cpi r24, 0xFF ; 255 -  
4758 1ae0: 19 f0 breq .+6 ; 0x1ae8 <send_cmd+0x1e> -  
4759 1ae2: 2f ef ldi r18, 0xFF ; 255 -  
4760 1ae4: 30 e0 ldi r19, 0x00 ; 0 -  
4761 1ae6: 44 c0 rjmp .+136 ; 0x1b70 <send_cmd+0xa6> -  
4762   5239  
4763 /* Send command packet */ 5240 /* Send command packet */
4764 xmit_spi(cmd); /* Command */ 5241 xmit_spi(cmd); /* Command */
4765 1ae8: de bc out 0x2e, r13 ; 46 5242 1cf0: 2e bd out 0x2e, r18 ; 46
4766 1aea: 0d b4 in r0, 0x2d ; 45 5243 1cf2: 0d b4 in r0, 0x2d ; 45
4767 1aec: 07 fe sbrs r0, 7 5244 1cf4: 07 fe sbrs r0, 7
4768 1aee: fd cf rjmp .-6 ; 0x1aea <send_cmd+0x20> 5245 1cf6: fd cf rjmp .-6 ; 0x1cf2 <send_cmd+0x32>
4769 xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */ 5246 xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */
4770 1af0: 81 2f mov r24, r17 5247 1cf8: 87 2f mov r24, r23
4771 1af2: 99 27 eor r25, r25 5248 1cfa: 99 27 eor r25, r25
4772 1af4: aa 27 eor r26, r26 5249 1cfc: aa 27 eor r26, r26
4773 1af6: bb 27 eor r27, r27 5250 1cfe: bb 27 eor r27, r27
4774 1af8: 8e bd out 0x2e, r24 ; 46 5251 1d00: 8e bd out 0x2e, r24 ; 46
4775 1afa: 0d b4 in r0, 0x2d ; 45 5252 1d02: 0d b4 in r0, 0x2d ; 45
4776 1afc: 07 fe sbrs r0, 7 5253 1d04: 07 fe sbrs r0, 7
4777 1afe: fd cf rjmp .-6 ; 0x1afa <send_cmd+0x30> 5254 1d06: fd cf rjmp .-6 ; 0x1d02 <send_cmd+0x42>
4778 xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */ 5255 xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */
4779 1b00: c8 01 movw r24, r16 5256 1d08: cb 01 movw r24, r22
4780 1b02: aa 27 eor r26, r26 5257 1d0a: aa 27 eor r26, r26
4781 1b04: bb 27 eor r27, r27 5258 1d0c: bb 27 eor r27, r27
4782 1b06: 8e bd out 0x2e, r24 ; 46 5259 1d0e: 8e bd out 0x2e, r24 ; 46
4783 1b08: 0d b4 in r0, 0x2d ; 45 5260 1d10: 0d b4 in r0, 0x2d ; 45
4784 1b0a: 07 fe sbrs r0, 7 5261 1d12: 07 fe sbrs r0, 7
4785 1b0c: fd cf rjmp .-6 ; 0x1b08 <send_cmd+0x3e> 5262 1d14: fd cf rjmp .-6 ; 0x1d10 <send_cmd+0x50>
4786 xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */ 5263 xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */
4787 1b0e: bb 27 eor r27, r27 5264 1d16: bb 27 eor r27, r27
4788 1b10: a1 2f mov r26, r17 5265 1d18: a7 2f mov r26, r23
4789 1b12: 90 2f mov r25, r16 5266 1d1a: 96 2f mov r25, r22
4790 1b14: 8f 2d mov r24, r15 5267 1d1c: 85 2f mov r24, r21
4791 1b16: 8e bd out 0x2e, r24 ; 46 5268 1d1e: 8e bd out 0x2e, r24 ; 46
4792 1b18: 0d b4 in r0, 0x2d ; 45 5269 1d20: 0d b4 in r0, 0x2d ; 45
4793 1b1a: 07 fe sbrs r0, 7 5270 1d22: 07 fe sbrs r0, 7
4794 1b1c: fd cf rjmp .-6 ; 0x1b18 <send_cmd+0x4e> 5271 1d24: fd cf rjmp .-6 ; 0x1d20 <send_cmd+0x60>
4795 xmit_spi((BYTE)arg); /* Argument[7..0] */ 5272 xmit_spi((BYTE)arg); /* Argument[7..0] */
4796 1b1e: ee bc out 0x2e, r14 ; 46 5273 1d26: 4e bd out 0x2e, r20 ; 46
4797 1b20: 0d b4 in r0, 0x2d ; 45 5274 1d28: 0d b4 in r0, 0x2d ; 45
4798 1b22: 07 fe sbrs r0, 7 5275 1d2a: 07 fe sbrs r0, 7
4799 1b24: fd cf rjmp .-6 ; 0x1b20 <send_cmd+0x56> 5276 1d2c: fd cf rjmp .-6 ; 0x1d28 <send_cmd+0x68>
4800 n = 0; 5277 n = 0;
4801 if (cmd == CMD0) n = 0x95; /* CRC for CMD0(0) */ 5278 if (cmd == CMD0) n = 0x95; /* CRC for CMD0(0) */
4802 1b26: 80 e4 ldi r24, 0x40 ; 64 5279 1d2e: 20 34 cpi r18, 0x40 ; 64
4803 1b28: d8 16 cp r13, r24 -  
4804 1b2a: 11 f4 brne .+4 ; 0x1b30 <send_cmd+0x66> 5280 1d30: 11 f4 brne .+4 ; 0x1d36 <send_cmd+0x76>
4805 1b2c: 85 e9 ldi r24, 0x95 ; 149 5281 1d32: 85 e9 ldi r24, 0x95 ; 149
4806 1b2e: 06 c0 rjmp .+12 ; 0x1b3c <send_cmd+0x72> 5282 1d34: 05 c0 rjmp .+10 ; 0x1d40 <send_cmd+0x80>
4807 if (cmd == CMD8) n = 0x87; /* CRC for CMD8(0x1AA) */ 5283 if (cmd == CMD8) n = 0x87; /* CRC for CMD8(0x1AA) */
4808 1b30: 88 e4 ldi r24, 0x48 ; 72 5284 1d36: 28 34 cpi r18, 0x48 ; 72
4809 1b32: d8 16 cp r13, r24 -  
4810 1b34: 11 f4 brne .+4 ; 0x1b3a <send_cmd+0x70> 5285 1d38: 11 f4 brne .+4 ; 0x1d3e <send_cmd+0x7e>
4811 1b36: 87 e8 ldi r24, 0x87 ; 135 5286 1d3a: 87 e8 ldi r24, 0x87 ; 135
4812 1b38: 01 c0 rjmp .+2 ; 0x1b3c <send_cmd+0x72> 5287 1d3c: 01 c0 rjmp .+2 ; 0x1d40 <send_cmd+0x80>
4813 1b3a: 80 e0 ldi r24, 0x00 ; 0 5288 1d3e: 80 e0 ldi r24, 0x00 ; 0
4814 xmit_spi(n); 5289 xmit_spi(n);
4815 1b3c: 8e bd out 0x2e, r24 ; 46 5290 1d40: 8e bd out 0x2e, r24 ; 46
4816 1b3e: 0d b4 in r0, 0x2d ; 45 5291 1d42: 0d b4 in r0, 0x2d ; 45
4817 1b40: 07 fe sbrs r0, 7 5292 1d44: 07 fe sbrs r0, 7
4818 1b42: fd cf rjmp .-6 ; 0x1b3e <send_cmd+0x74> 5293 1d46: fd cf rjmp .-6 ; 0x1d42 <send_cmd+0x82>
4819   5294  
4820 /* Receive command response */ 5295 /* Receive command response */
4821 if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */ 5296 if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */
4822 1b44: 8c e4 ldi r24, 0x4C ; 76 5297 1d48: 2c 34 cpi r18, 0x4C ; 76
4823 1b46: d8 16 cp r13, r24 -  
4824 1b48: 31 f4 brne .+12 ; 0x1b56 <send_cmd+0x8c> 5298 1d4a: 31 f4 brne .+12 ; 0x1d58 <send_cmd+0x98>
4825 /*-----------------------------------------------------------------------*/ 5299 /*-----------------------------------------------------------------------*/
4826   5300  
4827 static 5301 static
4828 BYTE rcvr_spi (void) 5302 BYTE rcvr_spi (void)
4829 { 5303 {
4830 SPDR = 0xFF; 5304 SPDR = 0xFF;
4831 1b4a: 8f ef ldi r24, 0xFF ; 255 5305 1d4c: 8f ef ldi r24, 0xFF ; 255
4832 1b4c: 8e bd out 0x2e, r24 ; 46 5306 1d4e: 8e bd out 0x2e, r24 ; 46
4833 loop_until_bit_is_set(SPSR, SPIF); 5307 loop_until_bit_is_set(SPSR, SPIF);
4834 1b4e: 0d b4 in r0, 0x2d ; 45 5308 1d50: 0d b4 in r0, 0x2d ; 45
4835 1b50: 07 fe sbrs r0, 7 5309 1d52: 07 fe sbrs r0, 7
4836 1b52: fd cf rjmp .-6 ; 0x1b4e <send_cmd+0x84> 5310 1d54: fd cf rjmp .-6 ; 0x1d50 <send_cmd+0x90>
4837 return SPDR; 5311 return SPDR;
4838 1b54: 8e b5 in r24, 0x2e ; 46 5312 1d56: 8e b5 in r24, 0x2e ; 46
4839 1b56: 9a e0 ldi r25, 0x0A ; 10 5313 1d58: 9a e0 ldi r25, 0x0A ; 10
4840 /*-----------------------------------------------------------------------*/ 5314 /*-----------------------------------------------------------------------*/
4841   5315  
4842 static 5316 static
4843 BYTE rcvr_spi (void) 5317 BYTE rcvr_spi (void)
4844 { 5318 {
4845 SPDR = 0xFF; 5319 SPDR = 0xFF;
4846 1b58: 8f ef ldi r24, 0xFF ; 255 5320 1d5a: 2f ef ldi r18, 0xFF ; 255
4847 1b5a: 8e bd out 0x2e, r24 ; 46 5321 1d5c: 2e bd out 0x2e, r18 ; 46
4848 loop_until_bit_is_set(SPSR, SPIF); 5322 loop_until_bit_is_set(SPSR, SPIF);
4849 1b5c: 0d b4 in r0, 0x2d ; 45 5323 1d5e: 0d b4 in r0, 0x2d ; 45
4850 1b5e: 07 fe sbrs r0, 7 5324 1d60: 07 fe sbrs r0, 7
4851 1b60: fd cf rjmp .-6 ; 0x1b5c <send_cmd+0x92> 5325 1d62: fd cf rjmp .-6 ; 0x1d5e <send_cmd+0x9e>
4852 return SPDR; 5326 return SPDR;
4853 1b62: 8e b5 in r24, 0x2e ; 46 5327 1d64: 8e b5 in r24, 0x2e ; 46
4854 1b64: 28 2f mov r18, r24 -  
4855 1b66: 33 27 eor r19, r19 -  
4856 /* Receive command response */ 5328 /* Receive command response */
4857 if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */ 5329 if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */
4858 n = 10; /* Wait for a valid response in timeout of 10 attempts */ 5330 n = 10; /* Wait for a valid response in timeout of 10 attempts */
4859 do 5331 do
4860 res = rcvr_spi(); 5332 res = rcvr_spi();
4861 while ((res & 0x80) && --n); 5333 while ((res & 0x80) && --n);
4862 1b68: 87 ff sbrs r24, 7 5334 1d66: 87 ff sbrs r24, 7
4863 1b6a: 02 c0 rjmp .+4 ; 0x1b70 <send_cmd+0xa6> 5335 1d68: 02 c0 rjmp .+4 ; 0x1d6e <send_cmd+0xae>
4864 1b6c: 91 50 subi r25, 0x01 ; 1 5336 1d6a: 91 50 subi r25, 0x01 ; 1
4865 1b6e: a1 f7 brne .-24 ; 0x1b58 <send_cmd+0x8e> 5337 1d6c: b9 f7 brne .-18 ; 0x1d5c <send_cmd+0x9c>
4866   5338  
4867 return res; /* Return with the response value */ 5339 return res; /* Return with the response value */
4868 } 5340 }
4869 1b70: c9 01 movw r24, r18 -  
4870 1b72: 1f 91 pop r17 -  
4871 1b74: 0f 91 pop r16 -  
4872 1b76: ff 90 pop r15 -  
4873 1b78: ef 90 pop r14 -  
4874 1b7a: df 90 pop r13 -  
4875 1b7c: 08 95 ret 5341 1d6e: 08 95 ret
4876   5342  
4877 00001b7e <disk_status>: 5343 00001d70 <disk_initialize>:
4878 /*-----------------------------------------------------------------------*/ 5344 /*-----------------------------------------------------------------------*/
4879   5345  
4880 DSTATUS disk_status ( 5346 DSTATUS disk_initialize (
4881 BYTE drv /* Physical drive nmuber (0) */ 5347 BYTE drv /* Physical drive nmuber (0) */
4882 ) 5348 )
4883 { 5349 {
4884 1b7e: 88 23 and r24, r24 5350 1d70: a4 e0 ldi r26, 0x04 ; 4
4885 1b80: 19 f0 breq .+6 ; 0x1b88 <disk_status+0xa> -  
4886 if (drv) return STA_NOINIT; /* Supports only single drive */ -  
4887 1b82: 81 e0 ldi r24, 0x01 ; 1 5351 1d72: b0 e0 ldi r27, 0x00 ; 0
4888 1b84: 90 e0 ldi r25, 0x00 ; 0 5352 1d74: ee eb ldi r30, 0xBE ; 190
4889 1b86: 08 95 ret -  
4890 return Stat; -  
4891 1b88: 80 91 04 01 lds r24, 0x0104 5353 1d76: fe e0 ldi r31, 0x0E ; 14
4892 1b8c: 99 27 eor r25, r25 5354 1d78: 0c 94 d3 14 jmp 0x29a6 ; 0x29a6 <__prologue_saves__+0x18>
4893 } -  
4894 1b8e: 08 95 ret 5355 BYTE n, ty, ocr[4];
4895   5356  
4896 00001b90 <disk_timerproc>: -  
4897 /* Device timer interrupt procedure */ -  
4898 /* This must be called in period of 10ms */ -  
4899 /* (Platform dependent) */ -  
4900   5357  
-   5358 if (drv) return STA_NOINIT; /* Supports only single drive */
4901 void disk_timerproc (void) 5359 1d7c: 88 23 and r24, r24
4902 { -  
-   5360 1d7e: 11 f0 breq .+4 ; 0x1d84 <disk_initialize+0x14>
-   5361 1d80: 81 e0 ldi r24, 0x01 ; 1
-   5362 1d82: cf c0 rjmp .+414 ; 0x1f22 <disk_initialize+0x1b2>
-   5363 if (Stat & STA_NODISK) return Stat; /* No card in the socket */
4903 1b90: 80 91 0f 01 lds r24, 0x010F 5364 1d84: 80 91 0b 01 lds r24, 0x010B
4904 static BYTE pv; 5365 1d88: 81 fd sbrc r24, 1
-   5366 1d8a: c9 c0 rjmp .+402 ; 0x1f1e <disk_initialize+0x1ae>
4905 BYTE n, s; 5367 1d8c: 8a e0 ldi r24, 0x0A ; 10
-   5368 /*-----------------------------------------------------------------------*/
4906   5369  
-   5370 static
-   5371 BYTE rcvr_spi (void)
-   5372 {
-   5373 SPDR = 0xFF;
-   5374 1d8e: 9f ef ldi r25, 0xFF ; 255
-   5375 1d90: 9e bd out 0x2e, r25 ; 46
-   5376 loop_until_bit_is_set(SPSR, SPIF);
-   5377 1d92: 0d b4 in r0, 0x2d ; 45
-   5378 1d94: 07 fe sbrs r0, 7
-   5379 1d96: fd cf rjmp .-6 ; 0x1d92 <disk_initialize+0x22>
-   5380 return SPDR;
-   5381 1d98: 2e b5 in r18, 0x2e ; 46
4907   5382  
4908 n = Timer1; /* 100Hz decrement timer */ -  
4909 if (n) Timer1 = --n; -  
4910 1b94: 88 23 and r24, r24 -  
4911 1b96: 19 f0 breq .+6 ; 0x1b9e <disk_timerproc+0xe> -  
4912 1b98: 81 50 subi r24, 0x01 ; 1 -  
4913 1b9a: 80 93 0f 01 sts 0x010F, r24 -  
4914 n = Timer2; -  
4915 1b9e: 80 91 10 01 lds r24, 0x0110 -  
4916 if (n) Timer2 = --n; -  
4917 1ba2: 88 23 and r24, r24 -  
4918 1ba4: 19 f0 breq .+6 ; 0x1bac <disk_timerproc+0x1c> -  
4919 1ba6: 81 50 subi r24, 0x01 ; 1 -  
4920 1ba8: 80 93 10 01 sts 0x0110, r24 -  
4921   5383  
4922 n = pv; -  
4923 1bac: 90 91 0e 01 lds r25, 0x010E -  
4924 pv = SOCKPORT & (SOCKINS); /* Sample socket switch */ 5384 if (drv) return STA_NOINIT; /* Supports only single drive */
4925 1bb0: 83 b1 in r24, 0x03 ; 3 -  
4926 1bb2: 81 70 andi r24, 0x01 ; 1 5385 if (Stat & STA_NODISK) return Stat; /* No card in the socket */
4927 1bb4: 80 93 0e 01 sts 0x010E, r24 -  
4928   5386  
4929 if (n == pv) { /* Have contacts stabled? */ 5387 for (n = 10; n; n--) rcvr_spi(); /* 80 dummy clocks */
4930 1bb8: 98 17 cp r25, r24 -  
4931 1bba: 49 f4 brne .+18 ; 0x1bce <disk_timerproc+0x3e> -  
4932 s = Stat; -  
4933 1bbc: 80 91 04 01 lds r24, 0x0104 -  
4934 if (pv & SOCKINS) /* INS = H (Socket empty) */ -  
4935 1bc0: 90 ff sbrs r25, 0 -  
4936 1bc2: 02 c0 rjmp .+4 ; 0x1bc8 <disk_timerproc+0x38> -  
4937 s |= (STA_NODISK | STA_NOINIT); -  
4938 1bc4: 83 60 ori r24, 0x03 ; 3 5388 1d9a: 81 50 subi r24, 0x01 ; 1
4939 1bc6: 01 c0 rjmp .+2 ; 0x1bca <disk_timerproc+0x3a> 5389 1d9c: c9 f7 brne .-14 ; 0x1d90 <disk_initialize+0x20>
4940 else /* INS = L (Card inserted) */ -  
4941 s &= ~STA_NODISK; -  
4942 1bc8: 8d 7f andi r24, 0xFD ; 253 -  
4943   5390  
-   5391 SELECT(); /* CS = L */
-   5392 1d9e: 2a 98 cbi 0x05, 2 ; 5
4944 Stat = s; 5393 ty = 0;
-   5394 if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */
-   5395 1da0: 40 e0 ldi r20, 0x00 ; 0
-   5396 1da2: 50 e0 ldi r21, 0x00 ; 0
-   5397 1da4: 60 e0 ldi r22, 0x00 ; 0
-   5398 1da6: 70 e0 ldi r23, 0x00 ; 0
-   5399 1da8: 80 e4 ldi r24, 0x40 ; 64
-   5400 1daa: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5401 1dae: 81 30 cpi r24, 0x01 ; 1
-   5402 1db0: 09 f0 breq .+2 ; 0x1db4 <disk_initialize+0x44>
-   5403 1db2: a0 c0 rjmp .+320 ; 0x1ef4 <disk_initialize+0x184>
-   5404 Timer1 = 100; /* Initialization timeout of 1000 msec */
-   5405 1db4: 84 e6 ldi r24, 0x64 ; 100
4945 1bca: 80 93 04 01 sts 0x0104, r24 5406 1db6: 80 93 15 01 sts 0x0115, r24
-   5407 if (send_cmd(CMD8, 0x1AA) == 1) { /* SDC Ver2+ */
-   5408 1dba: 4a ea ldi r20, 0xAA ; 170
-   5409 1dbc: 51 e0 ldi r21, 0x01 ; 1
-   5410 1dbe: 60 e0 ldi r22, 0x00 ; 0
-   5411 1dc0: 70 e0 ldi r23, 0x00 ; 0
-   5412 1dc2: 88 e4 ldi r24, 0x48 ; 72
-   5413 1dc4: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5414 1dc8: 81 30 cpi r24, 0x01 ; 1
-   5415 1dca: 09 f0 breq .+2 ; 0x1dce <disk_initialize+0x5e>
-   5416 1dcc: 54 c0 rjmp .+168 ; 0x1e76 <disk_initialize+0x106>
-   5417 1dce: 7e 01 movw r14, r28
4946 1bce: 08 95 ret 5418 1dd0: 08 94 sec
-   5419 1dd2: e1 1c adc r14, r1
-   5420 1dd4: f1 1c adc r15, r1
-   5421 1dd6: 87 01 movw r16, r14
-   5422 /*-----------------------------------------------------------------------*/
4947   5423  
4948 00001bd0 <disk_ioctl>: -  
4949 DRESULT disk_ioctl ( 5424 static
4950 BYTE drv, /* Physical drive nmuber (0) */ -  
4951 BYTE ctrl, /* Control code */ 5425 BYTE rcvr_spi (void)
4952 void *buff /* Buffer to send/receive data block */ -  
4953 ) -  
4954 { 5426 {
-   5427 SPDR = 0xFF;
4955 1bd0: a0 e1 ldi r26, 0x10 ; 16 5428 1dd8: 9f ef ldi r25, 0xFF ; 255
-   5429 SELECT(); /* CS = L */
-   5430 ty = 0;
4956 1bd2: b0 e0 ldi r27, 0x00 ; 0 5431 if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */
4957 1bd4: ee ee ldi r30, 0xEE ; 238 5432 Timer1 = 100; /* Initialization timeout of 1000 msec */
4958 1bd6: fd e0 ldi r31, 0x0D ; 13 5433 if (send_cmd(CMD8, 0x1AA) == 1) { /* SDC Ver2+ */
4959 1bd8: 0c 94 38 11 jmp 0x2270 ; 0x2270 <__prologue_saves__+0x1c> 5434 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi();
4960 1bdc: fa 01 movw r30, r20 5435 1dda: 9e 01 movw r18, r28
4961 DRESULT res; -  
4962 BYTE n, csd[16], *ptr = buff; 5436 1ddc: 2b 5f subi r18, 0xFB ; 251
4963 WORD csize; 5437 1dde: 3f 4f sbci r19, 0xFF ; 255
4964   -  
-   5438 /*-----------------------------------------------------------------------*/
4965   5439  
4966 if (drv) return RES_PARERR; 5440 static
4967 1bde: 88 23 and r24, r24 -  
4968 1be0: 19 f0 breq .+6 ; 0x1be8 <disk_ioctl+0x18> -  
4969 1be2: 24 e0 ldi r18, 0x04 ; 4 -  
4970 1be4: 30 e0 ldi r19, 0x00 ; 0 -  
4971 1be6: da c0 rjmp .+436 ; 0x1d9c <disk_ioctl+0x1cc> -  
4972 BYTE ctrl, /* Control code */ 5441 BYTE rcvr_spi (void)
4973 void *buff /* Buffer to send/receive data block */ -  
4974 ) -  
4975 { 5442 {
4976 DRESULT res; 5443 SPDR = 0xFF;
4977 BYTE n, csd[16], *ptr = buff; 5444 1de0: 9e bd out 0x2e, r25 ; 46
4978 1be8: 8a 01 movw r16, r20 5445 loop_until_bit_is_set(SPSR, SPIF);
4979 WORD csize; 5446 1de2: 0d b4 in r0, 0x2d ; 45
4980   5447 1de4: 07 fe sbrs r0, 7
4981   5448 1de6: fd cf rjmp .-6 ; 0x1de2 <disk_initialize+0x72>
4982 if (drv) return RES_PARERR; 5449 return SPDR;
4983   5450 1de8: 8e b5 in r24, 0x2e ; 46
4984 SELECT(); /* CS = L */ 5451 SELECT(); /* CS = L */
4985 1bea: 2a 98 cbi 0x05, 2 ; 5 5452 ty = 0;
4986   5453 if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */
4987 res = RES_ERROR; 5454 Timer1 = 100; /* Initialization timeout of 1000 msec */
4988 switch (ctrl) { 5455 if (send_cmd(CMD8, 0x1AA) == 1) { /* SDC Ver2+ */
4989 1bec: 63 30 cpi r22, 0x03 ; 3 5456 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi();
4990 1bee: 09 f4 brne .+2 ; 0x1bf2 <disk_ioctl+0x22> 5457 1dea: f8 01 movw r30, r16
4991 1bf0: 82 c0 rjmp .+260 ; 0x1cf6 <disk_ioctl+0x126> 5458 1dec: 81 93 st Z+, r24
4992 1bf2: 64 30 cpi r22, 0x04 ; 4 5459 1dee: 8f 01 movw r16, r30
4993 1bf4: 28 f4 brcc .+10 ; 0x1c00 <disk_ioctl+0x30> 5460 1df0: e2 17 cp r30, r18
4994 1bf6: 61 30 cpi r22, 0x01 ; 1 5461 1df2: f3 07 cpc r31, r19
4995 1bf8: 79 f0 breq .+30 ; 0x1c18 <disk_ioctl+0x48> 5462 1df4: a9 f7 brne .-22 ; 0x1de0 <disk_initialize+0x70>
4996 1bfa: 62 30 cpi r22, 0x02 ; 2 5463 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */
4997 1bfc: 51 f4 brne .+20 ; 0x1c12 <disk_ioctl+0x42> 5464 1df6: 8b 81 ldd r24, Y+3 ; 0x03
4998 1bfe: 74 c0 rjmp .+232 ; 0x1ce8 <disk_ioctl+0x118> 5465 1df8: 81 30 cpi r24, 0x01 ; 1
4999 1c00: 6b 30 cpi r22, 0x0B ; 11 5466 1dfa: 09 f0 breq .+2 ; 0x1dfe <disk_initialize+0x8e>
5000 1c02: 09 f4 brne .+2 ; 0x1c06 <disk_ioctl+0x36> 5467 1dfc: 7b c0 rjmp .+246 ; 0x1ef4 <disk_initialize+0x184>
5001 1c04: 88 c0 rjmp .+272 ; 0x1d16 <disk_ioctl+0x146> 5468 1dfe: 8c 81 ldd r24, Y+4 ; 0x04
5002 1c06: 6c 30 cpi r22, 0x0C ; 12 5469 1e00: 8a 3a cpi r24, 0xAA ; 170
5003 1c08: 09 f4 brne .+2 ; 0x1c0c <disk_ioctl+0x3c> 5470 1e02: 09 f0 breq .+2 ; 0x1e06 <disk_initialize+0x96>
5004 1c0a: 9f c0 rjmp .+318 ; 0x1d4a <disk_ioctl+0x17a> 5471 1e04: 77 c0 rjmp .+238 ; 0x1ef4 <disk_initialize+0x184>
5005 1c0c: 6a 30 cpi r22, 0x0A ; 10 5472 do {
5006 1c0e: 09 f4 brne .+2 ; 0x1c12 <disk_ioctl+0x42> 5473 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 1UL << 30) == 0) break; /* ACMD41 with HCS bit */
5007 1c10: 78 c0 rjmp .+240 ; 0x1d02 <disk_ioctl+0x132> 5474 1e06: 40 e0 ldi r20, 0x00 ; 0
5008 1c12: 24 e0 ldi r18, 0x04 ; 4 5475 1e08: 50 e0 ldi r21, 0x00 ; 0
5009 1c14: 30 e0 ldi r19, 0x00 ; 0 5476 1e0a: 60 e0 ldi r22, 0x00 ; 0
5010 1c16: b8 c0 rjmp .+368 ; 0x1d88 <disk_ioctl+0x1b8> 5477 1e0c: 70 e0 ldi r23, 0x00 ; 0
5011 case GET_SECTOR_COUNT : /* Get number of sectors on the disk (DWORD) */ 5478 1e0e: 87 e7 ldi r24, 0x77 ; 119
5012 if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) { 5479 1e10: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5013 1c18: 40 e0 ldi r20, 0x00 ; 0 5480 1e14: 82 30 cpi r24, 0x02 ; 2
5014 1c1a: 50 e0 ldi r21, 0x00 ; 0 5481 1e16: 48 f4 brcc .+18 ; 0x1e2a <disk_initialize+0xba>
5015 1c1c: 60 e0 ldi r22, 0x00 ; 0 5482 1e18: 40 e0 ldi r20, 0x00 ; 0
5016 1c1e: 70 e0 ldi r23, 0x00 ; 0 5483 1e1a: 50 e0 ldi r21, 0x00 ; 0
5017 1c20: 89 e4 ldi r24, 0x49 ; 73 5484 1e1c: 60 e0 ldi r22, 0x00 ; 0
5018 1c22: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5485 1e1e: 70 e4 ldi r23, 0x40 ; 64
5019 1c26: 88 23 and r24, r24 5486 1e20: 89 e6 ldi r24, 0x69 ; 105
5020 1c28: 09 f0 breq .+2 ; 0x1c2c <disk_ioctl+0x5c> 5487 1e22: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5021 1c2a: ac c0 rjmp .+344 ; 0x1d84 <disk_ioctl+0x1b4> 5488 1e26: 88 23 and r24, r24
5022 1c2c: 60 e1 ldi r22, 0x10 ; 16 5489 1e28: 21 f0 breq .+8 ; 0x1e32 <disk_initialize+0xc2>
5023 1c2e: 70 e0 ldi r23, 0x00 ; 0 5490 } while (Timer1);
5024 1c30: ce 01 movw r24, r28 5491 1e2a: 80 91 15 01 lds r24, 0x0115
5025 1c32: 01 96 adiw r24, 0x01 ; 1 5492 1e2e: 88 23 and r24, r24
5026 1c34: 0e 94 ec 0c call 0x19d8 ; 0x19d8 <rcvr_datablock> 5493 1e30: 51 f7 brne .-44 ; 0x1e06 <disk_initialize+0x96>
5027 1c38: 88 23 and r24, r24 5494 if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit */
5028 1c3a: 09 f4 brne .+2 ; 0x1c3e <disk_ioctl+0x6e> 5495 1e32: 80 91 15 01 lds r24, 0x0115
5029 1c3c: a3 c0 rjmp .+326 ; 0x1d84 <disk_ioctl+0x1b4> 5496 1e36: 88 23 and r24, r24
5030 if ((csd[0] >> 6) == 1) { /* SDC ver 2.00 */ 5497 1e38: 09 f4 brne .+2 ; 0x1e3c <disk_initialize+0xcc>
5031 1c3e: 89 81 ldd r24, Y+1 ; 0x01 5498 1e3a: 5c c0 rjmp .+184 ; 0x1ef4 <disk_initialize+0x184>
5032 1c40: 82 95 swap r24 5499 1e3c: 40 e0 ldi r20, 0x00 ; 0
5033 1c42: 86 95 lsr r24 5500 1e3e: 50 e0 ldi r21, 0x00 ; 0
5034 1c44: 86 95 lsr r24 5501 1e40: 60 e0 ldi r22, 0x00 ; 0
5035 1c46: 83 70 andi r24, 0x03 ; 3 5502 1e42: 70 e0 ldi r23, 0x00 ; 0
5036 1c48: 7a 85 ldd r23, Y+10 ; 0x0a 5503 1e44: 8a e7 ldi r24, 0x7A ; 122
5037 1c4a: 49 85 ldd r20, Y+9 ; 0x09 5504 1e46: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5038 1c4c: 81 30 cpi r24, 0x01 ; 1 5505 1e4a: 88 23 and r24, r24
5039 1c4e: c1 f4 brne .+48 ; 0x1c80 <disk_ioctl+0xb0> 5506 1e4c: 09 f0 breq .+2 ; 0x1e50 <disk_initialize+0xe0>
5040 csize = csd[9] + ((WORD)csd[8] << 8) + 1; 5507 1e4e: 52 c0 rjmp .+164 ; 0x1ef4 <disk_initialize+0x184>
5041 *(DWORD*)buff = (DWORD)csize << 10; -  
5042 1c50: 87 2f mov r24, r23 -  
5043 1c52: 99 27 eor r25, r25 -  
5044 1c54: 01 96 adiw r24, 0x01 ; 1 -  
5045 1c56: 24 2f mov r18, r20 -  
5046 1c58: 33 27 eor r19, r19 -  
5047 1c5a: 32 2f mov r19, r18 -  
5048 1c5c: 22 27 eor r18, r18 -  
5049 1c5e: 82 0f add r24, r18 -  
5050 1c60: 93 1f adc r25, r19 -  
5051 1c62: aa 27 eor r26, r26 -  
5052 1c64: bb 27 eor r27, r27 -  
5053 1c66: 6a e0 ldi r22, 0x0A ; 10 -  
5054 1c68: 88 0f add r24, r24 -  
5055 1c6a: 99 1f adc r25, r25 -  
5056 1c6c: aa 1f adc r26, r26 -  
5057 1c6e: bb 1f adc r27, r27 -  
5058 1c70: 6a 95 dec r22 -  
5059 1c72: d1 f7 brne .-12 ; 0x1c68 <disk_ioctl+0x98> -  
5060 1c74: f8 01 movw r30, r16 -  
5061 1c76: 80 83 st Z, r24 -  
5062 1c78: 91 83 std Z+1, r25 ; 0x01 -  
5063 1c7a: a2 83 std Z+2, r26 ; 0x02 -  
5064 1c7c: b3 83 std Z+3, r27 ; 0x03 -  
5065 1c7e: 38 c0 rjmp .+112 ; 0x1cf0 <disk_ioctl+0x120> -  
5066 } else { /* MMC or SDC ver 1.XX */ -  
5067 n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2; -  
5068 csize = (csd[8] >> 6) + ((WORD)csd[7] << 2) + ((WORD)(csd[6] & 3) << 10) + 1; -  
5069 *(DWORD*)buff = (DWORD)csize << (n - 9); -  
5070 1c80: 42 95 swap r20 -  
5071 1c82: 46 95 lsr r20 -  
5072 1c84: 46 95 lsr r20 -  
5073 1c86: 43 70 andi r20, 0x03 ; 3 -  
5074 1c88: 28 85 ldd r18, Y+8 ; 0x08 -  
5075 1c8a: 33 27 eor r19, r19 -  
5076 1c8c: 22 0f add r18, r18 -  
5077 1c8e: 33 1f adc r19, r19 -  
5078 1c90: 22 0f add r18, r18 -  
5079 1c92: 33 1f adc r19, r19 -  
5080 1c94: 24 0f add r18, r20 -  
5081 1c96: 31 1d adc r19, r1 -  
5082 1c98: 2f 5f subi r18, 0xFF ; 255 -  
5083 1c9a: 3f 4f sbci r19, 0xFF ; 255 -  
5084 1c9c: 8f 81 ldd r24, Y+7 ; 0x07 -  
5085 1c9e: 99 27 eor r25, r25 -  
5086 1ca0: 83 70 andi r24, 0x03 ; 3 -  
5087 1ca2: 90 70 andi r25, 0x00 ; 0 -  
5088 1ca4: 98 2f mov r25, r24 -  
5089 1ca6: 88 27 eor r24, r24 -  
5090 1ca8: 99 0f add r25, r25 -  
5091 1caa: 99 0f add r25, r25 -  
5092 1cac: 28 0f add r18, r24 -  
5093 1cae: 39 1f adc r19, r25 -  
5094 1cb0: 44 27 eor r20, r20 -  
5095 1cb2: 55 27 eor r21, r21 -  
5096 1cb4: 6e 81 ldd r22, Y+6 ; 0x06 -  
5097 1cb6: 6f 70 andi r22, 0x0F ; 15 -  
5098 1cb8: 6e 5f subi r22, 0xFE ; 254 -  
5099 1cba: 73 70 andi r23, 0x03 ; 3 -  
5100 1cbc: 77 0f add r23, r23 -  
5101 1cbe: 67 0f add r22, r23 -  
5102 1cc0: 8b 85 ldd r24, Y+11 ; 0x0b -  
5103 1cc2: 88 1f adc r24, r24 -  
5104 1cc4: 88 27 eor r24, r24 -  
5105 1cc6: 88 1f adc r24, r24 -  
5106 1cc8: 86 0f add r24, r22 -  
5107 1cca: 99 27 eor r25, r25 -  
5108 1ccc: 09 97 sbiw r24, 0x09 ; 9 -  
5109 1cce: 04 c0 rjmp .+8 ; 0x1cd8 <disk_ioctl+0x108> -  
5110 1cd0: 22 0f add r18, r18 -  
5111 1cd2: 33 1f adc r19, r19 -  
5112 1cd4: 44 1f adc r20, r20 -  
5113 1cd6: 55 1f adc r21, r21 -  
5114 1cd8: 8a 95 dec r24 -  
5115 1cda: d2 f7 brpl .-12 ; 0x1cd0 <disk_ioctl+0x100> -  
5116 1cdc: f8 01 movw r30, r16 -  
5117 1cde: 20 83 st Z, r18 -  
5118 1ce0: 31 83 std Z+1, r19 ; 0x01 -  
5119 1ce2: 42 83 std Z+2, r20 ; 0x02 -  
5120 1ce4: 53 83 std Z+3, r21 ; 0x03 -  
5121 1ce6: 04 c0 rjmp .+8 ; 0x1cf0 <disk_ioctl+0x120> -  
5122 res = RES_OK; -  
5123 } -  
5124 break; -  
5125   -  
5126 case GET_SECTOR_SIZE : /* Get sectors on the disk (WORD) */ -  
5127 *(WORD*)buff = 512; -  
5128 1ce8: 80 e0 ldi r24, 0x00 ; 0 -  
5129 1cea: 92 e0 ldi r25, 0x02 ; 2 -  
5130 1cec: 91 83 std Z+1, r25 ; 0x01 -  
5131 1cee: 80 83 st Z, r24 -  
5132 1cf0: 20 e0 ldi r18, 0x00 ; 0 -  
5133 1cf2: 30 e0 ldi r19, 0x00 ; 0 -  
5134 1cf4: 49 c0 rjmp .+146 ; 0x1d88 <disk_ioctl+0x1b8> -  
5135 res = RES_OK; -  
5136 break; -  
5137   -  
5138 case CTRL_SYNC : /* Make sure that data has been written */ -  
5139 if (wait_ready() == 0xFF) -  
5140 1cf6: 0e 94 d3 0c call 0x19a6 ; 0x19a6 <wait_ready> -  
5141 1cfa: 90 e0 ldi r25, 0x00 ; 0 -  
5142 1cfc: 8f 3f cpi r24, 0xFF ; 255 -  
5143 1cfe: 01 f5 brne .+64 ; 0x1d40 <disk_ioctl+0x170> -  
5144 1d00: 1e c0 rjmp .+60 ; 0x1d3e <disk_ioctl+0x16e> -  
5145 res = RES_OK; -  
5146 break; -  
5147   -  
5148 case MMC_GET_CSD : /* Receive CSD as a data block (16 bytes) */ -  
5149 if (Stat & STA_NOINIT) return RES_NOTRDY; -  
5150 1d02: 80 91 04 01 lds r24, 0x0104 -  
5151 1d06: 80 fd sbrc r24, 0 -  
5152 1d08: 47 c0 rjmp .+142 ; 0x1d98 <disk_ioctl+0x1c8> -  
5153 if ((send_cmd(CMD9, 0) == 0) /* READ_CSD */ -  
5154 1d0a: 40 e0 ldi r20, 0x00 ; 0 -  
5155 1d0c: 50 e0 ldi r21, 0x00 ; 0 -  
5156 1d0e: 60 e0 ldi r22, 0x00 ; 0 -  
5157 1d10: 70 e0 ldi r23, 0x00 ; 0 -  
5158 1d12: 89 e4 ldi r24, 0x49 ; 73 -  
5159 1d14: 09 c0 rjmp .+18 ; 0x1d28 <disk_ioctl+0x158> -  
5160 && rcvr_datablock(ptr, 16)) -  
5161 res = RES_OK; -  
5162 break; -  
5163   -  
5164 case MMC_GET_CID : /* Receive CID as a data block (16 bytes) */ -  
5165 if (Stat & STA_NOINIT) return RES_NOTRDY; -  
5166 1d16: 80 91 04 01 lds r24, 0x0104 -  
5167 1d1a: 80 fd sbrc r24, 0 -  
5168 1d1c: 3d c0 rjmp .+122 ; 0x1d98 <disk_ioctl+0x1c8> -  
5169 if ((send_cmd(CMD10, 0) == 0) /* READ_CID */ -  
5170 1d1e: 40 e0 ldi r20, 0x00 ; 0 -  
5171 1d20: 50 e0 ldi r21, 0x00 ; 0 -  
5172 1d22: 60 e0 ldi r22, 0x00 ; 0 -  
5173 1d24: 70 e0 ldi r23, 0x00 ; 0 -  
5174 1d26: 8a e4 ldi r24, 0x4A ; 74 -  
5175 1d28: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5176 1d2c: 88 23 and r24, r24 -  
5177 1d2e: 51 f5 brne .+84 ; 0x1d84 <disk_ioctl+0x1b4> -  
5178 1d30: 60 e1 ldi r22, 0x10 ; 16 -  
5179 1d32: 70 e0 ldi r23, 0x00 ; 0 -  
5180 1d34: c8 01 movw r24, r16 -  
5181 1d36: 0e 94 ec 0c call 0x19d8 ; 0x19d8 <rcvr_datablock> -  
5182 1d3a: 90 e0 ldi r25, 0x00 ; 0 -  
5183 1d3c: 81 11 cpse r24, r1 -  
5184 1d3e: 91 e0 ldi r25, 0x01 ; 1 -  
5185 1d40: 81 e0 ldi r24, 0x01 ; 1 -  
5186 1d42: 98 27 eor r25, r24 -  
5187 1d44: 29 2f mov r18, r25 -  
5188 1d46: 33 27 eor r19, r19 -  
5189 1d48: 1f c0 rjmp .+62 ; 0x1d88 <disk_ioctl+0x1b8> -  
5190 && rcvr_datablock(ptr, 16)) -  
5191 res = RES_OK; -  
5192 break; -  
5193   -  
5194 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */ -  
5195 if (Stat & STA_NOINIT) return RES_NOTRDY; -  
5196 1d4a: 80 91 04 01 lds r24, 0x0104 -  
5197 1d4e: 80 fd sbrc r24, 0 -  
5198 1d50: 23 c0 rjmp .+70 ; 0x1d98 <disk_ioctl+0x1c8> -  
5199 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */ -  
5200 1d52: 40 e0 ldi r20, 0x00 ; 0 -  
5201 1d54: 50 e0 ldi r21, 0x00 ; 0 -  
5202 1d56: 60 e0 ldi r22, 0x00 ; 0 -  
5203 1d58: 70 e0 ldi r23, 0x00 ; 0 -  
5204 1d5a: 8a e7 ldi r24, 0x7A ; 122 -  
5205 1d5c: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5206 1d60: 88 23 and r24, r24 -  
5207 1d62: 81 f4 brne .+32 ; 0x1d84 <disk_ioctl+0x1b4> -  
5208 1d64: 90 e0 ldi r25, 0x00 ; 0 -  
5209 /*-----------------------------------------------------------------------*/ 5508 /*-----------------------------------------------------------------------*/
5210   5509  
5211 static 5510 static
5212 BYTE rcvr_spi (void) 5511 BYTE rcvr_spi (void)
5213 { 5512 {
5214 SPDR = 0xFF; 5513 SPDR = 0xFF;
5215 1d66: 8f ef ldi r24, 0xFF ; 255 5514 1e50: 9f ef ldi r25, 0xFF ; 255
5216 1d68: 8e bd out 0x2e, r24 ; 46 5515 1e52: 9e bd out 0x2e, r25 ; 46
5217 loop_until_bit_is_set(SPSR, SPIF); 5516 loop_until_bit_is_set(SPSR, SPIF);
5218 1d6a: 0d b4 in r0, 0x2d ; 45 5517 1e54: 0d b4 in r0, 0x2d ; 45
5219 1d6c: 07 fe sbrs r0, 7 5518 1e56: 07 fe sbrs r0, 7
5220 1d6e: fd cf rjmp .-6 ; 0x1d6a <disk_ioctl+0x19a> 5519 1e58: fd cf rjmp .-6 ; 0x1e54 <disk_initialize+0xe4>
5221 return SPDR; 5520 return SPDR;
5222 1d70: 8e b5 in r24, 0x2e ; 46 5521 1e5a: 8e b5 in r24, 0x2e ; 46
-   5522 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */
5223   5523 do {
5224 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */ 5524 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 1UL << 30) == 0) break; /* ACMD41 with HCS bit */
5225 if (Stat & STA_NOINIT) return RES_NOTRDY; 5525 } while (Timer1);
5226 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */ 5526 if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit */
5227 for (n = 0; n < 4; n++) 5527 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi();
5228 *ptr++ = rcvr_spi(); 5528 1e5c: f7 01 movw r30, r14
-   5529 1e5e: 81 93 st Z+, r24
5229 1d72: f8 01 movw r30, r16 5530 1e60: 7f 01 movw r14, r30
5230 1d74: 80 83 st Z, r24 5531 1e62: e0 17 cp r30, r16
-   5532 1e64: f1 07 cpc r31, r17
-   5533 1e66: a9 f7 brne .-22 ; 0x1e52 <disk_initialize+0xe2>
-   5534 ty = (ocr[0] & 0x40) ? 6 : 2;
-   5535 1e68: 89 81 ldd r24, Y+1 ; 0x01
-   5536 1e6a: 86 fd sbrc r24, 6
-   5537 1e6c: 02 c0 rjmp .+4 ; 0x1e72 <disk_initialize+0x102>
-   5538 1e6e: 12 e0 ldi r17, 0x02 ; 2
-   5539 1e70: 42 c0 rjmp .+132 ; 0x1ef6 <disk_initialize+0x186>
-   5540 1e72: 16 e0 ldi r17, 0x06 ; 6
-   5541 1e74: 40 c0 rjmp .+128 ; 0x1ef6 <disk_initialize+0x186>
5231 break; 5542 }
5232   5543 }
-   5544 } else { /* SDC Ver1 or MMC */
5233 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */ 5545 ty = (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) <= 1) ? 2 : 1; /* SDC : MMC */
-   5546 1e76: 40 e0 ldi r20, 0x00 ; 0
-   5547 1e78: 50 e0 ldi r21, 0x00 ; 0
5234 if (Stat & STA_NOINIT) return RES_NOTRDY; 5548 1e7a: 60 e0 ldi r22, 0x00 ; 0
5235 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */ 5549 1e7c: 70 e0 ldi r23, 0x00 ; 0
-   5550 1e7e: 87 e7 ldi r24, 0x77 ; 119
-   5551 1e80: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5236 for (n = 0; n < 4; n++) 5552 1e84: 82 30 cpi r24, 0x02 ; 2
-   5553 1e86: 58 f4 brcc .+22 ; 0x1e9e <disk_initialize+0x12e>
-   5554 1e88: 40 e0 ldi r20, 0x00 ; 0
-   5555 1e8a: 50 e0 ldi r21, 0x00 ; 0
-   5556 1e8c: 60 e0 ldi r22, 0x00 ; 0
-   5557 1e8e: 70 e0 ldi r23, 0x00 ; 0
5237 1d76: 9f 5f subi r25, 0xFF ; 255 5558 1e90: 89 e6 ldi r24, 0x69 ; 105
-   5559 1e92: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5238 1d78: 94 30 cpi r25, 0x04 ; 4 5560 1e96: 82 30 cpi r24, 0x02 ; 2
5239 1d7a: 09 f4 brne .+2 ; 0x1d7e <disk_ioctl+0x1ae> 5561 1e98: 10 f4 brcc .+4 ; 0x1e9e <disk_initialize+0x12e>
-   5562 1e9a: 12 e0 ldi r17, 0x02 ; 2
5240 1d7c: b9 cf rjmp .-142 ; 0x1cf0 <disk_ioctl+0x120> 5563 1e9c: 01 c0 rjmp .+2 ; 0x1ea0 <disk_initialize+0x130>
-   5564 1e9e: 11 e0 ldi r17, 0x01 ; 1
-   5565 do {
5241 *ptr++ = rcvr_spi(); 5566 if (ty == 2) {
5242 1d7e: 0f 5f subi r16, 0xFF ; 255 5567 1ea0: 12 30 cpi r17, 0x02 ; 2
-   5568 1ea2: 79 f4 brne .+30 ; 0x1ec2 <disk_initialize+0x152>
-   5569 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) == 0) break; /* ACMD41 */
-   5570 1ea4: 40 e0 ldi r20, 0x00 ; 0
-   5571 1ea6: 50 e0 ldi r21, 0x00 ; 0
-   5572 1ea8: 60 e0 ldi r22, 0x00 ; 0
-   5573 1eaa: 70 e0 ldi r23, 0x00 ; 0
-   5574 1eac: 87 e7 ldi r24, 0x77 ; 119
-   5575 1eae: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5576 1eb2: 82 30 cpi r24, 0x02 ; 2
-   5577 1eb4: 78 f4 brcc .+30 ; 0x1ed4 <disk_initialize+0x164>
-   5578 1eb6: 40 e0 ldi r20, 0x00 ; 0
-   5579 1eb8: 50 e0 ldi r21, 0x00 ; 0
-   5580 1eba: 60 e0 ldi r22, 0x00 ; 0
-   5581 1ebc: 70 e0 ldi r23, 0x00 ; 0
5243 1d80: 1f 4f sbci r17, 0xFF ; 255 5582 1ebe: 89 e6 ldi r24, 0x69 ; 105
5244 1d82: f1 cf rjmp .-30 ; 0x1d66 <disk_ioctl+0x196> 5583 1ec0: 05 c0 rjmp .+10 ; 0x1ecc <disk_initialize+0x15c>
-   5584 } else {
-   5585 if (send_cmd(CMD1, 0) == 0) break; /* CMD1 */
-   5586 1ec2: 40 e0 ldi r20, 0x00 ; 0
5245 1d84: 21 e0 ldi r18, 0x01 ; 1 5587 1ec4: 50 e0 ldi r21, 0x00 ; 0
5246 1d86: 30 e0 ldi r19, 0x00 ; 0 5588 1ec6: 60 e0 ldi r22, 0x00 ; 0
-   5589 1ec8: 70 e0 ldi r23, 0x00 ; 0
-   5590 1eca: 81 e4 ldi r24, 0x41 ; 65
-   5591 1ecc: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5592 1ed0: 88 23 and r24, r24
-   5593 1ed2: 21 f0 breq .+8 ; 0x1edc <disk_initialize+0x16c>
5247   5594 }
5248 default: 5595 } while (Timer1);
-   5596 1ed4: 80 91 15 01 lds r24, 0x0115
-   5597 1ed8: 88 23 and r24, r24
-   5598 1eda: 11 f7 brne .-60 ; 0x1ea0 <disk_initialize+0x130>
-   5599 if (!Timer1 || send_cmd(CMD16, 512) != 0) /* Select R/W block length */
-   5600 1edc: 80 91 15 01 lds r24, 0x0115
-   5601 1ee0: 88 23 and r24, r24
-   5602 1ee2: 41 f0 breq .+16 ; 0x1ef4 <disk_initialize+0x184>
-   5603 1ee4: 40 e0 ldi r20, 0x00 ; 0
-   5604 1ee6: 52 e0 ldi r21, 0x02 ; 2
-   5605 1ee8: 60 e0 ldi r22, 0x00 ; 0
-   5606 1eea: 70 e0 ldi r23, 0x00 ; 0
-   5607 1eec: 80 e5 ldi r24, 0x50 ; 80
-   5608 1eee: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5609 1ef2: 81 11 cpse r24, r1
-   5610 1ef4: 10 e0 ldi r17, 0x00 ; 0
5249 res = RES_PARERR; 5611 ty = 0;
-   5612 }
5250 } 5613 }
5251   5614 CardType = ty;
-   5615 1ef6: 10 93 17 01 sts 0x0117, r17
5252 DESELECT(); /* CS = H */ 5616 DESELECT(); /* CS = H */
5253 1d88: 2a 9a sbi 0x05, 2 ; 5 5617 1efa: 2a 9a sbi 0x05, 2 ; 5
5254 /*-----------------------------------------------------------------------*/ 5618 /*-----------------------------------------------------------------------*/
5255   5619  
5256 static 5620 static
5257 BYTE rcvr_spi (void) 5621 BYTE rcvr_spi (void)
5258 { 5622 {
5259 SPDR = 0xFF; 5623 SPDR = 0xFF;
5260 1d8a: 8f ef ldi r24, 0xFF ; 255 5624 1efc: 8f ef ldi r24, 0xFF ; 255
5261 1d8c: 8e bd out 0x2e, r24 ; 46 5625 1efe: 8e bd out 0x2e, r24 ; 46
5262 loop_until_bit_is_set(SPSR, SPIF); 5626 loop_until_bit_is_set(SPSR, SPIF);
5263 1d8e: 0d b4 in r0, 0x2d ; 45 5627 1f00: 0d b4 in r0, 0x2d ; 45
5264 1d90: 07 fe sbrs r0, 7 5628 1f02: 07 fe sbrs r0, 7
5265 1d92: fd cf rjmp .-6 ; 0x1d8e <disk_ioctl+0x1be> 5629 1f04: fd cf rjmp .-6 ; 0x1f00 <disk_initialize+0x190>
5266 return SPDR; 5630 return SPDR;
5267 1d94: 8e b5 in r24, 0x2e ; 46 5631 1f06: 8e b5 in r24, 0x2e ; 46
5268 1d96: 02 c0 rjmp .+4 ; 0x1d9c <disk_ioctl+0x1cc> -  
5269 } 5632 }
5270   5633 CardType = ty;
5271 DESELECT(); /* CS = H */ 5634 DESELECT(); /* CS = H */
5272 rcvr_spi(); /* Idle (Release DO) */ 5635 rcvr_spi(); /* Idle (Release DO) */
5273   5636  
-   5637 if (ty) { /* Initialization succeded */
-   5638 1f08: 11 23 and r17, r17
-   5639 1f0a: 21 f0 breq .+8 ; 0x1f14 <disk_initialize+0x1a4>
-   5640 Stat &= ~STA_NOINIT; /* Clear STA_NOINIT */
-   5641 1f0c: 80 91 0b 01 lds r24, 0x010B
-   5642 1f10: 8e 7f andi r24, 0xFE ; 254
-   5643 1f12: 03 c0 rjmp .+6 ; 0x1f1a <disk_initialize+0x1aa>
5274 return res; 5644 } else { /* Initialization failed */
-   5645 Stat |= STA_NOINIT; /* Set STA_NOINIT */
-   5646 1f14: 80 91 0b 01 lds r24, 0x010B
5275 1d98: 23 e0 ldi r18, 0x03 ; 3 5647 1f18: 81 60 ori r24, 0x01 ; 1
-   5648 1f1a: 80 93 0b 01 sts 0x010B, r24
-   5649 }
-   5650  
-   5651 return Stat;
5276 1d9a: 30 e0 ldi r19, 0x00 ; 0 5652 1f1e: 80 91 0b 01 lds r24, 0x010B
5277 } 5653 }
5278 1d9c: c9 01 movw r24, r18 -  
5279 1d9e: e4 e0 ldi r30, 0x04 ; 4 5654 1f22: 24 96 adiw r28, 0x04 ; 4
5280 1da0: 60 96 adiw r28, 0x10 ; 16 5655 1f24: e6 e0 ldi r30, 0x06 ; 6
5281 1da2: 0c 94 54 11 jmp 0x22a8 ; 0x22a8 <__epilogue_restores__+0x1c> 5656 1f26: 0c 94 ef 14 jmp 0x29de ; 0x29de <__epilogue_restores__+0x18>
5282   5657  
-   5658 00001f2a <disk_status>:
-   5659 /*-----------------------------------------------------------------------*/
-   5660  
-   5661 DSTATUS disk_status (
-   5662 BYTE drv /* Physical drive nmuber (0) */
-   5663 )
-   5664 {
-   5665 1f2a: 88 23 and r24, r24
-   5666 1f2c: 11 f0 breq .+4 ; 0x1f32 <disk_status+0x8>
-   5667 1f2e: 81 e0 ldi r24, 0x01 ; 1
-   5668 1f30: 08 95 ret
-   5669 if (drv) return STA_NOINIT; /* Supports only single drive */
-   5670 return Stat;
-   5671 1f32: 80 91 0b 01 lds r24, 0x010B
-   5672 }
-   5673 1f36: 08 95 ret
-   5674  
5283 00001da6 <disk_write>: 5675 00001f38 <disk_read>:
5284 BYTE drv, /* Physical drive nmuber (0) */ 5676 BYTE drv, /* Physical drive nmuber (0) */
5285 const BYTE *buff, /* Pointer to the data to be written */ 5677 BYTE *buff, /* Pointer to the data buffer to store read data */
5286 DWORD sector, /* Start sector number (LBA) */ 5678 DWORD sector, /* Start sector number (LBA) */
5287 BYTE count /* Sector count (1..255) */ 5679 BYTE count /* Sector count (1..255) */
5288 ) 5680 )
5289 { 5681 {
5290 1da6: cf 92 push r12 -  
5291 1da8: df 92 push r13 -  
5292 1daa: ef 92 push r14 -  
5293 1dac: ff 92 push r15 -  
5294 1dae: 0f 93 push r16 5682 1f38: 0f 93 push r16
5295 1db0: cf 93 push r28 5683 1f3a: cf 93 push r28
5296 1db2: df 93 push r29 5684 1f3c: df 93 push r29
5297 1db4: eb 01 movw r28, r22 5685 1f3e: eb 01 movw r28, r22
5298 1db6: 69 01 movw r12, r18 -  
5299 1db8: 7a 01 movw r14, r20 -  
5300 if (drv || !count) return RES_PARERR; 5686 if (drv || !count) return RES_PARERR;
5301 1dba: 88 23 and r24, r24 5687 1f40: 88 23 and r24, r24
5302 1dbc: 09 f0 breq .+2 ; 0x1dc0 <disk_write+0x1a> 5688 1f42: 09 f0 breq .+2 ; 0x1f46 <disk_read+0xe>
5303 1dbe: 67 c0 rjmp .+206 ; 0x1e8e <disk_write+0xe8> 5689 1f44: 51 c0 rjmp .+162 ; 0x1fe8 <disk_read+0xb0>
5304 1dc0: 00 23 and r16, r16 5690 1f46: 00 23 and r16, r16
5305 1dc2: 09 f4 brne .+2 ; 0x1dc6 <disk_write+0x20> 5691 1f48: 09 f4 brne .+2 ; 0x1f4c <disk_read+0x14>
5306 1dc4: 64 c0 rjmp .+200 ; 0x1e8e <disk_write+0xe8> 5692 1f4a: 4e c0 rjmp .+156 ; 0x1fe8 <disk_read+0xb0>
5307 if (Stat & STA_NOINIT) return RES_NOTRDY; 5693 if (Stat & STA_NOINIT) return RES_NOTRDY;
5308 1dc6: 80 91 04 01 lds r24, 0x0104 5694 1f4c: 80 91 0b 01 lds r24, 0x010B
5309 1dca: 80 ff sbrs r24, 0 5695 1f50: 80 ff sbrs r24, 0
5310 1dcc: 03 c0 rjmp .+6 ; 0x1dd4 <disk_write+0x2e> 5696 1f52: 03 c0 rjmp .+6 ; 0x1f5a <disk_read+0x22>
5311 1dce: 83 e0 ldi r24, 0x03 ; 3 5697 1f54: 23 e0 ldi r18, 0x03 ; 3
5312 1dd0: 90 e0 ldi r25, 0x00 ; 0 -  
5313 1dd2: 5f c0 rjmp .+190 ; 0x1e92 <disk_write+0xec> -  
5314 if (Stat & STA_PROTECT) return RES_WRPRT; -  
5315 1dd4: 80 91 04 01 lds r24, 0x0104 -  
5316 1dd8: 82 ff sbrs r24, 2 -  
5317 1dda: 03 c0 rjmp .+6 ; 0x1de2 <disk_write+0x3c> -  
5318 1ddc: 82 e0 ldi r24, 0x02 ; 2 -  
5319 1dde: 90 e0 ldi r25, 0x00 ; 0 5698 1f56: 30 e0 ldi r19, 0x00 ; 0
5320 1de0: 58 c0 rjmp .+176 ; 0x1e92 <disk_write+0xec> 5699 1f58: 49 c0 rjmp .+146 ; 0x1fec <disk_read+0xb4>
5321   5700  
5322 if (!(CardType & 4)) sector *= 512; /* Convert to byte address if needed */ 5701 if (!(CardType & 4)) sector *= 512; /* Convert to byte address if needed */
5323 1de2: 80 91 11 01 lds r24, 0x0111 5702 1f5a: 80 91 17 01 lds r24, 0x0117
5324 1de6: 99 27 eor r25, r25 -  
5325 1de8: 82 fd sbrc r24, 2 5703 1f5e: 82 fd sbrc r24, 2
5326 1dea: 07 c0 rjmp .+14 ; 0x1dfa <disk_write+0x54> 5704 1f60: 07 c0 rjmp .+14 ; 0x1f70 <disk_read+0x38>
5327 1dec: e9 e0 ldi r30, 0x09 ; 9 5705 1f62: 69 e0 ldi r22, 0x09 ; 9
5328 1dee: cc 0c add r12, r12 5706 1f64: 22 0f add r18, r18
5329 1df0: dd 1c adc r13, r13 5707 1f66: 33 1f adc r19, r19
5330 1df2: ee 1c adc r14, r14 5708 1f68: 44 1f adc r20, r20
5331 1df4: ff 1c adc r15, r15 5709 1f6a: 55 1f adc r21, r21
5332 1df6: ea 95 dec r30 5710 1f6c: 6a 95 dec r22
5333 1df8: d1 f7 brne .-12 ; 0x1dee <disk_write+0x48> 5711 1f6e: d1 f7 brne .-12 ; 0x1f64 <disk_read+0x2c>
5334   5712  
5335 SELECT(); /* CS = L */ 5713 SELECT(); /* CS = L */
5336 1dfa: 2a 98 cbi 0x05, 2 ; 5 5714 1f70: 2a 98 cbi 0x05, 2 ; 5
5337   5715  
5338 if (count == 1) { /* Single block write */ 5716 if (count == 1) { /* Single block read */
5339 1dfc: 01 30 cpi r16, 0x01 ; 1 5717 1f72: 01 30 cpi r16, 0x01 ; 1
5340 1dfe: 79 f4 brne .+30 ; 0x1e1e <disk_write+0x78> 5718 1f74: 89 f4 brne .+34 ; 0x1f98 <disk_read+0x60>
5341 if ((send_cmd(CMD24, sector) == 0) /* WRITE_BLOCK */ 5719 if ((send_cmd(CMD17, sector) == 0) /* READ_SINGLE_BLOCK */
5342 1e00: b7 01 movw r22, r14 5720 1f76: ba 01 movw r22, r20
5343 1e02: a6 01 movw r20, r12 5721 1f78: a9 01 movw r20, r18
5344 1e04: 88 e5 ldi r24, 0x58 ; 88 5722 1f7a: 81 e5 ldi r24, 0x51 ; 81
5345 1e06: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5723 1f7c: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5346 1e0a: 88 23 and r24, r24 5724 1f80: 88 23 and r24, r24
5347 1e0c: 91 f5 brne .+100 ; 0x1e72 <disk_write+0xcc> 5725 1f82: 21 f5 brne .+72 ; 0x1fcc <disk_read+0x94>
5348 1e0e: 6e ef ldi r22, 0xFE ; 254 5726 1f84: 60 e0 ldi r22, 0x00 ; 0
-   5727 1f86: 72 e0 ldi r23, 0x02 ; 2
5349 1e10: ce 01 movw r24, r28 5728 1f88: ce 01 movw r24, r28
5350 1e12: 0e 94 24 0d call 0x1a48 ; 0x1a48 <xmit_datablock> 5729 1f8a: 0e 94 e3 0d call 0x1bc6 ; 0x1bc6 <rcvr_datablock>
5351 1e16: 81 11 cpse r24, r1 5730 1f8e: 00 e0 ldi r16, 0x00 ; 0
5352 1e18: 81 e0 ldi r24, 0x01 ; 1 5731 1f90: 88 23 and r24, r24
-   5732 1f92: e1 f4 brne .+56 ; 0x1fcc <disk_read+0x94>
5353 1e1a: 08 27 eor r16, r24 5733 1f94: 01 e0 ldi r16, 0x01 ; 1
5354 1e1c: 2a c0 rjmp .+84 ; 0x1e72 <disk_write+0xcc> 5734 1f96: 1a c0 rjmp .+52 ; 0x1fcc <disk_read+0x94>
5355 && xmit_datablock(buff, 0xFE)) 5735 && rcvr_datablock(buff, 512))
5356 count = 0; 5736 count = 0;
5357 } 5737 }
5358 else { /* Multiple block write */ 5738 else { /* Multiple block read */
5359 if (CardType & 2) { -  
5360 1e1e: 81 ff sbrs r24, 1 -  
5361 1e20: 0e c0 rjmp .+28 ; 0x1e3e <disk_write+0x98> -  
5362 send_cmd(CMD55, 0); send_cmd(CMD23, count); /* ACMD23 */ -  
5363 1e22: 40 e0 ldi r20, 0x00 ; 0 -  
5364 1e24: 50 e0 ldi r21, 0x00 ; 0 -  
5365 1e26: 60 e0 ldi r22, 0x00 ; 0 -  
5366 1e28: 70 e0 ldi r23, 0x00 ; 0 -  
5367 1e2a: 87 e7 ldi r24, 0x77 ; 119 -  
5368 1e2c: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5369 1e30: 40 2f mov r20, r16 -  
5370 1e32: 55 27 eor r21, r21 -  
5371 1e34: 66 27 eor r22, r22 -  
5372 1e36: 77 27 eor r23, r23 -  
5373 1e38: 87 e5 ldi r24, 0x57 ; 87 -  
5374 1e3a: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5375 } -  
5376 if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */ 5739 if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
5377 1e3e: b7 01 movw r22, r14 5740 1f98: ba 01 movw r22, r20
5378 1e40: a6 01 movw r20, r12 5741 1f9a: a9 01 movw r20, r18
5379 1e42: 89 e5 ldi r24, 0x59 ; 89 5742 1f9c: 82 e5 ldi r24, 0x52 ; 82
5380 1e44: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5743 1f9e: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5381 1e48: 88 23 and r24, r24 5744 1fa2: 88 23 and r24, r24
5382 1e4a: 99 f4 brne .+38 ; 0x1e72 <disk_write+0xcc> 5745 1fa4: 99 f4 brne .+38 ; 0x1fcc <disk_read+0x94>
5383 do { 5746 do {
5384 if (!xmit_datablock(buff, 0xFC)) break; 5747 if (!rcvr_datablock(buff, 512)) break;
5385 1e4c: 6c ef ldi r22, 0xFC ; 252 5748 1fa6: 60 e0 ldi r22, 0x00 ; 0
-   5749 1fa8: 72 e0 ldi r23, 0x02 ; 2
5386 1e4e: ce 01 movw r24, r28 5750 1faa: ce 01 movw r24, r28
5387 1e50: 0e 94 24 0d call 0x1a48 ; 0x1a48 <xmit_datablock> 5751 1fac: 0e 94 e3 0d call 0x1bc6 ; 0x1bc6 <rcvr_datablock>
5388 1e54: 88 23 and r24, r24 5752 1fb0: 88 23 and r24, r24
5389 1e56: 29 f0 breq .+10 ; 0x1e62 <disk_write+0xbc> 5753 1fb2: 29 f0 breq .+10 ; 0x1fbe <disk_read+0x86>
5390 buff += 512; 5754 buff += 512;
5391 } while (--count); 5755 } while (--count);
5392 1e58: 01 50 subi r16, 0x01 ; 1 5756 1fb4: 01 50 subi r16, 0x01 ; 1
5393 1e5a: 19 f0 breq .+6 ; 0x1e62 <disk_write+0xbc> 5757 1fb6: 19 f0 breq .+6 ; 0x1fbe <disk_read+0x86>
5394 send_cmd(CMD55, 0); send_cmd(CMD23, count); /* ACMD23 */ -  
5395 } 5758 }
-   5759 else { /* Multiple block read */
5396 if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */ 5760 if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
5397 do { 5761 do {
5398 if (!xmit_datablock(buff, 0xFC)) break; 5762 if (!rcvr_datablock(buff, 512)) break;
5399 buff += 512; 5763 buff += 512;
5400 1e5c: c0 50 subi r28, 0x00 ; 0 5764 1fb8: c0 50 subi r28, 0x00 ; 0
5401 1e5e: de 4f sbci r29, 0xFE ; 254 5765 1fba: de 4f sbci r29, 0xFE ; 254
5402 1e60: f5 cf rjmp .-22 ; 0x1e4c <disk_write+0xa6> 5766 1fbc: f4 cf rjmp .-24 ; 0x1fa6 <disk_read+0x6e>
5403 } while (--count); 5767 } while (--count);
5404 if (!xmit_datablock(0, 0xFD)) /* STOP_TRAN token */ 5768 send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
5405 1e62: 6d ef ldi r22, 0xFD ; 253 5769 1fbe: 40 e0 ldi r20, 0x00 ; 0
5406 1e64: 80 e0 ldi r24, 0x00 ; 0 5770 1fc0: 50 e0 ldi r21, 0x00 ; 0
5407 1e66: 90 e0 ldi r25, 0x00 ; 0 5771 1fc2: 60 e0 ldi r22, 0x00 ; 0
5408 1e68: 0e 94 24 0d call 0x1a48 ; 0x1a48 <xmit_datablock> 5772 1fc4: 70 e0 ldi r23, 0x00 ; 0
5409 1e6c: 88 23 and r24, r24 5773 1fc6: 8c e4 ldi r24, 0x4C ; 76
5410 1e6e: 09 f4 brne .+2 ; 0x1e72 <disk_write+0xcc> 5774 1fc8: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5411 1e70: 01 e0 ldi r16, 0x01 ; 1 -  
5412 count = 1; -  
5413 } 5775 }
5414 } 5776 }
5415   5777  
5416 DESELECT(); /* CS = H */ 5778 DESELECT(); /* CS = H */
5417 1e72: 2a 9a sbi 0x05, 2 ; 5 5779 1fcc: 2a 9a sbi 0x05, 2 ; 5
5418 /*-----------------------------------------------------------------------*/ 5780 /*-----------------------------------------------------------------------*/
5419   5781  
5420 static 5782 static
5421 BYTE rcvr_spi (void) 5783 BYTE rcvr_spi (void)
5422 { 5784 {
5423 SPDR = 0xFF; 5785 SPDR = 0xFF;
5424 1e74: 8f ef ldi r24, 0xFF ; 255 5786 1fce: 8f ef ldi r24, 0xFF ; 255
5425 1e76: 8e bd out 0x2e, r24 ; 46 5787 1fd0: 8e bd out 0x2e, r24 ; 46
5426 loop_until_bit_is_set(SPSR, SPIF); 5788 loop_until_bit_is_set(SPSR, SPIF);
5427 1e78: 0d b4 in r0, 0x2d ; 45 5789 1fd2: 0d b4 in r0, 0x2d ; 45
5428 1e7a: 07 fe sbrs r0, 7 5790 1fd4: 07 fe sbrs r0, 7
5429 1e7c: fd cf rjmp .-6 ; 0x1e78 <disk_write+0xd2> 5791 1fd6: fd cf rjmp .-6 ; 0x1fd2 <disk_read+0x9a>
5430 return SPDR; 5792 return SPDR;
5431 1e7e: 8e b5 in r24, 0x2e ; 46 5793 1fd8: 8e b5 in r24, 0x2e ; 46
5432 } 5794 }
5433   5795  
5434 DESELECT(); /* CS = H */ 5796 DESELECT(); /* CS = H */
5435 rcvr_spi(); /* Idle (Release DO) */ 5797 rcvr_spi(); /* Idle (Release DO) */
5436   5798  
5437 return count ? RES_ERROR : RES_OK; 5799 return count ? RES_ERROR : RES_OK;
5438 1e80: 80 e0 ldi r24, 0x00 ; 0 5800 1fda: 20 e0 ldi r18, 0x00 ; 0
5439 1e82: 90 e0 ldi r25, 0x00 ; 0 5801 1fdc: 30 e0 ldi r19, 0x00 ; 0
5440 1e84: 00 23 and r16, r16 5802 1fde: 00 23 and r16, r16
5441 1e86: 29 f0 breq .+10 ; 0x1e92 <disk_write+0xec> 5803 1fe0: 29 f0 breq .+10 ; 0x1fec <disk_read+0xb4>
5442 1e88: 81 e0 ldi r24, 0x01 ; 1 5804 1fe2: 21 e0 ldi r18, 0x01 ; 1
5443 1e8a: 90 e0 ldi r25, 0x00 ; 0 5805 1fe4: 30 e0 ldi r19, 0x00 ; 0
5444 1e8c: 02 c0 rjmp .+4 ; 0x1e92 <disk_write+0xec> 5806 1fe6: 02 c0 rjmp .+4 ; 0x1fec <disk_read+0xb4>
5445 1e8e: 84 e0 ldi r24, 0x04 ; 4 5807 1fe8: 24 e0 ldi r18, 0x04 ; 4
5446 1e90: 90 e0 ldi r25, 0x00 ; 0 5808 1fea: 30 e0 ldi r19, 0x00 ; 0
-   5809 }
5447 1e92: df 91 pop r29 5810 1fec: c9 01 movw r24, r18
5448 1e94: cf 91 pop r28 5811 1fee: df 91 pop r29
5449 1e96: 0f 91 pop r16 5812 1ff0: cf 91 pop r28
5450 1e98: ff 90 pop r15 -  
5451 1e9a: ef 90 pop r14 -  
5452 1e9c: df 90 pop r13 -  
5453 1e9e: cf 90 pop r12 5813 1ff2: 0f 91 pop r16
5454 1ea0: 08 95 ret 5814 1ff4: 08 95 ret
5455   5815  
5456 00001ea2 <disk_read>: 5816 00001ff6 <disk_write>:
5457 BYTE drv, /* Physical drive nmuber (0) */ 5817 BYTE drv, /* Physical drive nmuber (0) */
5458 BYTE *buff, /* Pointer to the data buffer to store read data */ 5818 const BYTE *buff, /* Pointer to the data to be written */
5459 DWORD sector, /* Start sector number (LBA) */ 5819 DWORD sector, /* Start sector number (LBA) */
5460 BYTE count /* Sector count (1..255) */ 5820 BYTE count /* Sector count (1..255) */
5461 ) 5821 )
5462 { 5822 {
-   5823 1ff6: cf 92 push r12
-   5824 1ff8: df 92 push r13
-   5825 1ffa: ef 92 push r14
-   5826 1ffc: ff 92 push r15
5463 1ea2: 0f 93 push r16 5827 1ffe: 0f 93 push r16
5464 1ea4: cf 93 push r28 5828 2000: cf 93 push r28
5465 1ea6: df 93 push r29 5829 2002: df 93 push r29
5466 1ea8: eb 01 movw r28, r22 5830 2004: eb 01 movw r28, r22
-   5831 2006: 69 01 movw r12, r18
-   5832 2008: 7a 01 movw r14, r20
5467 if (drv || !count) return RES_PARERR; 5833 if (drv || !count) return RES_PARERR;
5468 1eaa: 88 23 and r24, r24 5834 200a: 88 23 and r24, r24
5469 1eac: 09 f0 breq .+2 ; 0x1eb0 <disk_read+0xe> 5835 200c: 09 f0 breq .+2 ; 0x2010 <disk_write+0x1a>
5470 1eae: 50 c0 rjmp .+160 ; 0x1f50 <disk_read+0xae> 5836 200e: 64 c0 rjmp .+200 ; 0x20d8 <disk_write+0xe2>
5471 1eb0: 00 23 and r16, r16 5837 2010: 00 23 and r16, r16
5472 1eb2: 09 f4 brne .+2 ; 0x1eb6 <disk_read+0x14> 5838 2012: 09 f4 brne .+2 ; 0x2016 <disk_write+0x20>
5473 1eb4: 4d c0 rjmp .+154 ; 0x1f50 <disk_read+0xae> 5839 2014: 61 c0 rjmp .+194 ; 0x20d8 <disk_write+0xe2>
5474 if (Stat & STA_NOINIT) return RES_NOTRDY; 5840 if (Stat & STA_NOINIT) return RES_NOTRDY;
5475 1eb6: 80 91 04 01 lds r24, 0x0104 5841 2016: 80 91 0b 01 lds r24, 0x010B
5476 1eba: 80 ff sbrs r24, 0 5842 201a: 80 ff sbrs r24, 0
5477 1ebc: 03 c0 rjmp .+6 ; 0x1ec4 <disk_read+0x22> 5843 201c: 03 c0 rjmp .+6 ; 0x2024 <disk_write+0x2e>
5478 1ebe: 83 e0 ldi r24, 0x03 ; 3 5844 201e: 23 e0 ldi r18, 0x03 ; 3
5479 1ec0: 90 e0 ldi r25, 0x00 ; 0 5845 2020: 30 e0 ldi r19, 0x00 ; 0
5480 1ec2: 48 c0 rjmp .+144 ; 0x1f54 <disk_read+0xb2> 5846 2022: 5c c0 rjmp .+184 ; 0x20dc <disk_write+0xe6>
-   5847 if (Stat & STA_PROTECT) return RES_WRPRT;
-   5848 2024: 80 91 0b 01 lds r24, 0x010B
-   5849 2028: 82 ff sbrs r24, 2
-   5850 202a: 03 c0 rjmp .+6 ; 0x2032 <disk_write+0x3c>
-   5851 202c: 22 e0 ldi r18, 0x02 ; 2
-   5852 202e: 30 e0 ldi r19, 0x00 ; 0
-   5853 2030: 55 c0 rjmp .+170 ; 0x20dc <disk_write+0xe6>
5481   5854  
5482 if (!(CardType & 4)) sector *= 512; /* Convert to byte address if needed */ 5855 if (!(CardType & 4)) sector *= 512; /* Convert to byte address if needed */
5483 1ec4: 80 91 11 01 lds r24, 0x0111 5856 2032: 80 91 17 01 lds r24, 0x0117
5484 1ec8: 82 fd sbrc r24, 2 5857 2036: 82 fd sbrc r24, 2
5485 1eca: 07 c0 rjmp .+14 ; 0x1eda <disk_read+0x38> 5858 2038: 07 c0 rjmp .+14 ; 0x2048 <disk_write+0x52>
5486 1ecc: f9 e0 ldi r31, 0x09 ; 9 5859 203a: 79 e0 ldi r23, 0x09 ; 9
5487 1ece: 22 0f add r18, r18 5860 203c: cc 0c add r12, r12
5488 1ed0: 33 1f adc r19, r19 5861 203e: dd 1c adc r13, r13
5489 1ed2: 44 1f adc r20, r20 5862 2040: ee 1c adc r14, r14
5490 1ed4: 55 1f adc r21, r21 5863 2042: ff 1c adc r15, r15
5491 1ed6: fa 95 dec r31 5864 2044: 7a 95 dec r23
5492 1ed8: d1 f7 brne .-12 ; 0x1ece <disk_read+0x2c> 5865 2046: d1 f7 brne .-12 ; 0x203c <disk_write+0x46>
5493   5866  
5494 SELECT(); /* CS = L */ 5867 SELECT(); /* CS = L */
5495 1eda: 2a 98 cbi 0x05, 2 ; 5 5868 2048: 2a 98 cbi 0x05, 2 ; 5
5496   5869  
5497 if (count == 1) { /* Single block read */ 5870 if (count == 1) { /* Single block write */
5498 1edc: 01 30 cpi r16, 0x01 ; 1 5871 204a: 01 30 cpi r16, 0x01 ; 1
5499 1ede: 81 f4 brne .+32 ; 0x1f00 <disk_read+0x5e> 5872 204c: 69 f4 brne .+26 ; 0x2068 <disk_write+0x72>
5500 if ((send_cmd(CMD17, sector) == 0) /* READ_SINGLE_BLOCK */ 5873 if ((send_cmd(CMD24, sector) == 0) /* WRITE_BLOCK */
5501 1ee0: ba 01 movw r22, r20 5874 204e: b7 01 movw r22, r14
5502 1ee2: a9 01 movw r20, r18 5875 2050: a6 01 movw r20, r12
5503 1ee4: 81 e5 ldi r24, 0x51 ; 81 5876 2052: 88 e5 ldi r24, 0x58 ; 88
5504 1ee6: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5877 2054: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5505 1eea: 88 23 and r24, r24 5878 2058: 88 23 and r24, r24
5506 1eec: 19 f5 brne .+70 ; 0x1f34 <disk_read+0x92> 5879 205a: 81 f5 brne .+96 ; 0x20bc <disk_write+0xc6>
5507 1eee: 60 e0 ldi r22, 0x00 ; 0 5880 205c: 6e ef ldi r22, 0xFE ; 254
5508 1ef0: 72 e0 ldi r23, 0x02 ; 2 -  
5509 1ef2: ce 01 movw r24, r28 5881 205e: ce 01 movw r24, r28
5510 1ef4: 0e 94 ec 0c call 0x19d8 ; 0x19d8 <rcvr_datablock> 5882 2060: 0e 94 18 0e call 0x1c30 ; 0x1c30 <xmit_datablock>
5511 1ef8: 81 11 cpse r24, r1 -  
5512 1efa: 81 e0 ldi r24, 0x01 ; 1 5883 2064: 00 e0 ldi r16, 0x00 ; 0
5513 1efc: 08 27 eor r16, r24 -  
5514 1efe: 1a c0 rjmp .+52 ; 0x1f34 <disk_read+0x92> 5884 2066: 27 c0 rjmp .+78 ; 0x20b6 <disk_write+0xc0>
5515 && rcvr_datablock(buff, 512)) 5885 && xmit_datablock(buff, 0xFE))
5516 count = 0; 5886 count = 0;
5517 } 5887 }
5518 else { /* Multiple block read */ 5888 else { /* Multiple block write */
-   5889 if (CardType & 2) {
-   5890 2068: 81 ff sbrs r24, 1
-   5891 206a: 0e c0 rjmp .+28 ; 0x2088 <disk_write+0x92>
-   5892 send_cmd(CMD55, 0); send_cmd(CMD23, count); /* ACMD23 */
-   5893 206c: 40 e0 ldi r20, 0x00 ; 0
-   5894 206e: 50 e0 ldi r21, 0x00 ; 0
-   5895 2070: 60 e0 ldi r22, 0x00 ; 0
-   5896 2072: 70 e0 ldi r23, 0x00 ; 0
-   5897 2074: 87 e7 ldi r24, 0x77 ; 119
-   5898 2076: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5899 207a: 40 2f mov r20, r16
-   5900 207c: 50 e0 ldi r21, 0x00 ; 0
-   5901 207e: 60 e0 ldi r22, 0x00 ; 0
-   5902 2080: 70 e0 ldi r23, 0x00 ; 0
-   5903 2082: 87 e5 ldi r24, 0x57 ; 87
-   5904 2084: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
-   5905 }
5519 if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */ 5906 if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
5520 1f00: ba 01 movw r22, r20 5907 2088: b7 01 movw r22, r14
5521 1f02: a9 01 movw r20, r18 5908 208a: a6 01 movw r20, r12
5522 1f04: 82 e5 ldi r24, 0x52 ; 82 5909 208c: 89 e5 ldi r24, 0x59 ; 89
5523 1f06: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5910 208e: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5524 1f0a: 88 23 and r24, r24 5911 2092: 88 23 and r24, r24
5525 1f0c: 99 f4 brne .+38 ; 0x1f34 <disk_read+0x92> 5912 2094: 99 f4 brne .+38 ; 0x20bc <disk_write+0xc6>
5526 do { 5913 do {
5527 if (!rcvr_datablock(buff, 512)) break; 5914 if (!xmit_datablock(buff, 0xFC)) break;
5528 1f0e: 60 e0 ldi r22, 0x00 ; 0 5915 2096: 6c ef ldi r22, 0xFC ; 252
5529 1f10: 72 e0 ldi r23, 0x02 ; 2 -  
5530 1f12: ce 01 movw r24, r28 5916 2098: ce 01 movw r24, r28
5531 1f14: 0e 94 ec 0c call 0x19d8 ; 0x19d8 <rcvr_datablock> 5917 209a: 0e 94 18 0e call 0x1c30 ; 0x1c30 <xmit_datablock>
5532 1f18: 88 23 and r24, r24 5918 209e: 88 23 and r24, r24
5533 1f1a: 29 f0 breq .+10 ; 0x1f26 <disk_read+0x84> 5919 20a0: 29 f0 breq .+10 ; 0x20ac <disk_write+0xb6>
5534 buff += 512; 5920 buff += 512;
5535 } while (--count); 5921 } while (--count);
5536 1f1c: 01 50 subi r16, 0x01 ; 1 5922 20a2: 01 50 subi r16, 0x01 ; 1
5537 1f1e: 19 f0 breq .+6 ; 0x1f26 <disk_read+0x84> 5923 20a4: 19 f0 breq .+6 ; 0x20ac <disk_write+0xb6>
-   5924 send_cmd(CMD55, 0); send_cmd(CMD23, count); /* ACMD23 */
5538 } 5925 }
5539 else { /* Multiple block read */ -  
5540 if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */ 5926 if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
5541 do { 5927 do {
5542 if (!rcvr_datablock(buff, 512)) break; 5928 if (!xmit_datablock(buff, 0xFC)) break;
5543 buff += 512; 5929 buff += 512;
5544 1f20: c0 50 subi r28, 0x00 ; 0 5930 20a6: c0 50 subi r28, 0x00 ; 0
5545 1f22: de 4f sbci r29, 0xFE ; 254 5931 20a8: de 4f sbci r29, 0xFE ; 254
5546 1f24: f4 cf rjmp .-24 ; 0x1f0e <disk_read+0x6c> 5932 20aa: f5 cf rjmp .-22 ; 0x2096 <disk_write+0xa0>
5547 } while (--count); 5933 } while (--count);
5548 send_cmd(CMD12, 0); /* STOP_TRANSMISSION */ 5934 if (!xmit_datablock(0, 0xFD)) /* STOP_TRAN token */
5549 1f26: 40 e0 ldi r20, 0x00 ; 0 5935 20ac: 6d ef ldi r22, 0xFD ; 253
5550 1f28: 50 e0 ldi r21, 0x00 ; 0 5936 20ae: 80 e0 ldi r24, 0x00 ; 0
5551 1f2a: 60 e0 ldi r22, 0x00 ; 0 5937 20b0: 90 e0 ldi r25, 0x00 ; 0
5552 1f2c: 70 e0 ldi r23, 0x00 ; 0 5938 20b2: 0e 94 18 0e call 0x1c30 ; 0x1c30 <xmit_datablock>
5553 1f2e: 8c e4 ldi r24, 0x4C ; 76 5939 20b6: 88 23 and r24, r24
5554 1f30: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 5940 20b8: 09 f4 brne .+2 ; 0x20bc <disk_write+0xc6>
-   5941 20ba: 01 e0 ldi r16, 0x01 ; 1
-   5942 count = 1;
5555 } 5943 }
5556 } 5944 }
5557   5945  
5558 DESELECT(); /* CS = H */ 5946 DESELECT(); /* CS = H */
5559 1f34: 2a 9a sbi 0x05, 2 ; 5 5947 20bc: 2a 9a sbi 0x05, 2 ; 5
5560 /*-----------------------------------------------------------------------*/ 5948 /*-----------------------------------------------------------------------*/
5561   5949  
5562 static 5950 static
5563 BYTE rcvr_spi (void) 5951 BYTE rcvr_spi (void)
5564 { 5952 {
5565 SPDR = 0xFF; 5953 SPDR = 0xFF;
5566 1f36: 8f ef ldi r24, 0xFF ; 255 5954 20be: 8f ef ldi r24, 0xFF ; 255
5567 1f38: 8e bd out 0x2e, r24 ; 46 5955 20c0: 8e bd out 0x2e, r24 ; 46
5568 loop_until_bit_is_set(SPSR, SPIF); 5956 loop_until_bit_is_set(SPSR, SPIF);
5569 1f3a: 0d b4 in r0, 0x2d ; 45 5957 20c2: 0d b4 in r0, 0x2d ; 45
5570 1f3c: 07 fe sbrs r0, 7 5958 20c4: 07 fe sbrs r0, 7
5571 1f3e: fd cf rjmp .-6 ; 0x1f3a <disk_read+0x98> 5959 20c6: fd cf rjmp .-6 ; 0x20c2 <disk_write+0xcc>
5572 return SPDR; 5960 return SPDR;
5573 1f40: 8e b5 in r24, 0x2e ; 46 5961 20c8: 8e b5 in r24, 0x2e ; 46
5574 } 5962 }
5575   5963  
5576 DESELECT(); /* CS = H */ 5964 DESELECT(); /* CS = H */
5577 rcvr_spi(); /* Idle (Release DO) */ 5965 rcvr_spi(); /* Idle (Release DO) */
5578   5966  
5579 return count ? RES_ERROR : RES_OK; 5967 return count ? RES_ERROR : RES_OK;
5580 1f42: 80 e0 ldi r24, 0x00 ; 0 5968 20ca: 20 e0 ldi r18, 0x00 ; 0
5581 1f44: 90 e0 ldi r25, 0x00 ; 0 5969 20cc: 30 e0 ldi r19, 0x00 ; 0
5582 1f46: 00 23 and r16, r16 5970 20ce: 00 23 and r16, r16
5583 1f48: 29 f0 breq .+10 ; 0x1f54 <disk_read+0xb2> 5971 20d0: 29 f0 breq .+10 ; 0x20dc <disk_write+0xe6>
5584 1f4a: 81 e0 ldi r24, 0x01 ; 1 5972 20d2: 21 e0 ldi r18, 0x01 ; 1
5585 1f4c: 90 e0 ldi r25, 0x00 ; 0 5973 20d4: 30 e0 ldi r19, 0x00 ; 0
5586 1f4e: 02 c0 rjmp .+4 ; 0x1f54 <disk_read+0xb2> 5974 20d6: 02 c0 rjmp .+4 ; 0x20dc <disk_write+0xe6>
5587 1f50: 84 e0 ldi r24, 0x04 ; 4 5975 20d8: 24 e0 ldi r18, 0x04 ; 4
5588 1f52: 90 e0 ldi r25, 0x00 ; 0 5976 20da: 30 e0 ldi r19, 0x00 ; 0
-   5977 }
-   5978 20dc: c9 01 movw r24, r18
5589 1f54: df 91 pop r29 5979 20de: df 91 pop r29
5590 1f56: cf 91 pop r28 5980 20e0: cf 91 pop r28
5591 1f58: 0f 91 pop r16 5981 20e2: 0f 91 pop r16
5592 1f5a: 08 95 ret 5982 20e4: ff 90 pop r15
5593   -  
-   5983 20e6: ef 90 pop r14
5594 00001f5c <disk_initialize>: 5984 20e8: df 90 pop r13
5595 /*-----------------------------------------------------------------------*/ 5985 20ea: cf 90 pop r12
-   5986 20ec: 08 95 ret
5596   5987  
-   5988 000020ee <disk_ioctl>:
5597 DSTATUS disk_initialize ( 5989 DRESULT disk_ioctl (
5598 BYTE drv /* Physical drive nmuber (0) */ 5990 BYTE drv, /* Physical drive nmuber (0) */
-   5991 BYTE ctrl, /* Control code */
-   5992 void *buff /* Buffer to send/receive data block */
5599 ) 5993 )
5600 { 5994 {
5601 1f5c: a4 e0 ldi r26, 0x04 ; 4 5995 20ee: a0 e1 ldi r26, 0x10 ; 16
5602 1f5e: b0 e0 ldi r27, 0x00 ; 0 5996 20f0: b0 e0 ldi r27, 0x00 ; 0
5603 1f60: e4 eb ldi r30, 0xB4 ; 180 5997 20f2: ed e7 ldi r30, 0x7D ; 125
5604 1f62: ff e0 ldi r31, 0x0F ; 15 5998 20f4: f0 e1 ldi r31, 0x10 ; 16
5605 1f64: 0c 94 36 11 jmp 0x226c ; 0x226c <__prologue_saves__+0x18> 5999 20f6: 0c 94 d5 14 jmp 0x29aa ; 0x29aa <__prologue_saves__+0x1c>
-   6000 20fa: 8a 01 movw r16, r20
-   6001 DRESULT res;
5606 BYTE n, ty, ocr[4]; 6002 BYTE n, csd[16], *ptr = buff;
-   6003 WORD csize;
5607   6004  
5608   6005  
-   6006 if (drv) return RES_PARERR;
-   6007 20fc: 88 23 and r24, r24
-   6008 20fe: 19 f0 breq .+6 ; 0x2106 <disk_ioctl+0x18>
-   6009 2100: 24 e0 ldi r18, 0x04 ; 4
-   6010 2102: 30 e0 ldi r19, 0x00 ; 0
-   6011 2104: e7 c0 rjmp .+462 ; 0x22d4 <disk_ioctl+0x1e6>
-   6012  
-   6013 SELECT(); /* CS = L */
-   6014 2106: 2a 98 cbi 0x05, 2 ; 5
-   6015  
-   6016 res = RES_ERROR;
-   6017 switch (ctrl) {
-   6018 2108: 63 30 cpi r22, 0x03 ; 3
-   6019 210a: 09 f4 brne .+2 ; 0x210e <disk_ioctl+0x20>
-   6020 210c: 7f c0 rjmp .+254 ; 0x220c <disk_ioctl+0x11e>
-   6021 210e: 64 30 cpi r22, 0x04 ; 4
-   6022 2110: 28 f4 brcc .+10 ; 0x211c <disk_ioctl+0x2e>
-   6023 2112: 61 30 cpi r22, 0x01 ; 1
-   6024 2114: 79 f0 breq .+30 ; 0x2134 <disk_ioctl+0x46>
-   6025 2116: 62 30 cpi r22, 0x02 ; 2
-   6026 2118: 51 f4 brne .+20 ; 0x212e <disk_ioctl+0x40>
-   6027 211a: 72 c0 rjmp .+228 ; 0x2200 <disk_ioctl+0x112>
-   6028 211c: 6b 30 cpi r22, 0x0B ; 11
-   6029 211e: 09 f4 brne .+2 ; 0x2122 <disk_ioctl+0x34>
-   6030 2120: 96 c0 rjmp .+300 ; 0x224e <disk_ioctl+0x160>
-   6031 2122: 6c 30 cpi r22, 0x0C ; 12
-   6032 2124: 09 f4 brne .+2 ; 0x2128 <disk_ioctl+0x3a>
-   6033 2126: aa c0 rjmp .+340 ; 0x227c <disk_ioctl+0x18e>
-   6034 2128: 6a 30 cpi r22, 0x0A ; 10
-   6035 212a: 09 f4 brne .+2 ; 0x212e <disk_ioctl+0x40>
-   6036 212c: 86 c0 rjmp .+268 ; 0x223a <disk_ioctl+0x14c>
-   6037 212e: 24 e0 ldi r18, 0x04 ; 4
-   6038 2130: 30 e0 ldi r19, 0x00 ; 0
-   6039 2132: c6 c0 rjmp .+396 ; 0x22c0 <disk_ioctl+0x1d2>
5609 if (drv) return STA_NOINIT; /* Supports only single drive */ 6040 case GET_SECTOR_COUNT : /* Get number of sectors on the disk (DWORD) */
-   6041 if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) {
-   6042 2134: 40 e0 ldi r20, 0x00 ; 0
-   6043 2136: 50 e0 ldi r21, 0x00 ; 0
-   6044 2138: 60 e0 ldi r22, 0x00 ; 0
-   6045 213a: 70 e0 ldi r23, 0x00 ; 0
-   6046 213c: 89 e4 ldi r24, 0x49 ; 73
-   6047 213e: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5610 1f68: 88 23 and r24, r24 6048 2142: 88 23 and r24, r24
5611 1f6a: 19 f0 breq .+6 ; 0x1f72 <disk_initialize+0x16> 6049 2144: 09 f0 breq .+2 ; 0x2148 <disk_ioctl+0x5a>
-   6050 2146: b7 c0 rjmp .+366 ; 0x22b6 <disk_ioctl+0x1c8>
-   6051 2148: 60 e1 ldi r22, 0x10 ; 16
-   6052 214a: 70 e0 ldi r23, 0x00 ; 0
-   6053 214c: ce 01 movw r24, r28
-   6054 214e: 01 96 adiw r24, 0x01 ; 1
-   6055 2150: 0e 94 e3 0d call 0x1bc6 ; 0x1bc6 <rcvr_datablock>
-   6056 2154: 88 23 and r24, r24
-   6057 2156: 09 f4 brne .+2 ; 0x215a <disk_ioctl+0x6c>
-   6058 2158: ae c0 rjmp .+348 ; 0x22b6 <disk_ioctl+0x1c8>
-   6059 if ((csd[0] >> 6) == 1) { /* SDC ver 2.00 */
-   6060 215a: 89 81 ldd r24, Y+1 ; 0x01
-   6061 215c: 82 95 swap r24
-   6062 215e: 86 95 lsr r24
-   6063 2160: 86 95 lsr r24
-   6064 2162: 83 70 andi r24, 0x03 ; 3
-   6065 2164: 7a 85 ldd r23, Y+10 ; 0x0a
-   6066 2166: 49 85 ldd r20, Y+9 ; 0x09
5612 1f6c: 81 e0 ldi r24, 0x01 ; 1 6067 2168: 81 30 cpi r24, 0x01 ; 1
-   6068 216a: b1 f4 brne .+44 ; 0x2198 <disk_ioctl+0xaa>
-   6069 csize = csd[9] + ((WORD)csd[8] << 8) + 1;
-   6070 *(DWORD*)buff = (DWORD)csize << 10;
-   6071 216c: 87 2f mov r24, r23
5613 1f6e: 90 e0 ldi r25, 0x00 ; 0 6072 216e: 90 e0 ldi r25, 0x00 ; 0
-   6073 2170: 01 96 adiw r24, 0x01 ; 1
-   6074 2172: 34 2f mov r19, r20
-   6075 2174: 20 e0 ldi r18, 0x00 ; 0
-   6076 2176: 82 0f add r24, r18
-   6077 2178: 93 1f adc r25, r19
-   6078 217a: a0 e0 ldi r26, 0x00 ; 0
-   6079 217c: b0 e0 ldi r27, 0x00 ; 0
-   6080 217e: 2a e0 ldi r18, 0x0A ; 10
-   6081 2180: 88 0f add r24, r24
-   6082 2182: 99 1f adc r25, r25
-   6083 2184: aa 1f adc r26, r26
-   6084 2186: bb 1f adc r27, r27
-   6085 2188: 2a 95 dec r18
-   6086 218a: d1 f7 brne .-12 ; 0x2180 <disk_ioctl+0x92>
-   6087 218c: f8 01 movw r30, r16
-   6088 218e: 80 83 st Z, r24
-   6089 2190: 91 83 std Z+1, r25 ; 0x01
-   6090 2192: a2 83 std Z+2, r26 ; 0x02
-   6091 2194: b3 83 std Z+3, r27 ; 0x03
5614 1f70: d0 c0 rjmp .+416 ; 0x2112 <disk_initialize+0x1b6> 6092 2196: 92 c0 rjmp .+292 ; 0x22bc <disk_ioctl+0x1ce>
-   6093 } else { /* MMC or SDC ver 1.XX */
5615 if (Stat & STA_NODISK) return Stat; /* No card in the socket */ 6094 n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2;
-   6095 csize = (csd[8] >> 6) + ((WORD)csd[7] << 2) + ((WORD)(csd[6] & 3) << 10) + 1;
-   6096 *(DWORD*)buff = (DWORD)csize << (n - 9);
-   6097 2198: 42 95 swap r20
-   6098 219a: 46 95 lsr r20
-   6099 219c: 46 95 lsr r20
-   6100 219e: 43 70 andi r20, 0x03 ; 3
-   6101 21a0: 28 85 ldd r18, Y+8 ; 0x08
-   6102 21a2: 30 e0 ldi r19, 0x00 ; 0
-   6103 21a4: 22 0f add r18, r18
-   6104 21a6: 33 1f adc r19, r19
-   6105 21a8: 22 0f add r18, r18
-   6106 21aa: 33 1f adc r19, r19
-   6107 21ac: 24 0f add r18, r20
-   6108 21ae: 31 1d adc r19, r1
-   6109 21b0: 2f 5f subi r18, 0xFF ; 255
-   6110 21b2: 3f 4f sbci r19, 0xFF ; 255
-   6111 21b4: 8f 81 ldd r24, Y+7 ; 0x07
-   6112 21b6: 90 e0 ldi r25, 0x00 ; 0
-   6113 21b8: 83 70 andi r24, 0x03 ; 3
-   6114 21ba: 90 70 andi r25, 0x00 ; 0
-   6115 21bc: 98 2f mov r25, r24
-   6116 21be: 88 27 eor r24, r24
-   6117 21c0: 99 0f add r25, r25
-   6118 21c2: 99 0f add r25, r25
-   6119 21c4: 28 0f add r18, r24
-   6120 21c6: 39 1f adc r19, r25
-   6121 21c8: 40 e0 ldi r20, 0x00 ; 0
-   6122 21ca: 50 e0 ldi r21, 0x00 ; 0
-   6123 21cc: 8e 81 ldd r24, Y+6 ; 0x06
-   6124 21ce: 8f 70 andi r24, 0x0F ; 15
-   6125 21d0: 6b 85 ldd r22, Y+11 ; 0x0b
-   6126 21d2: 66 1f adc r22, r22
-   6127 21d4: 66 27 eor r22, r22
-   6128 21d6: 66 1f adc r22, r22
-   6129 21d8: 86 0f add r24, r22
-   6130 21da: 8e 5f subi r24, 0xFE ; 254
-   6131 21dc: 73 70 andi r23, 0x03 ; 3
-   6132 21de: 77 0f add r23, r23
-   6133 21e0: 87 0f add r24, r23
5616 1f72: 80 91 04 01 lds r24, 0x0104 6134 21e2: 90 e0 ldi r25, 0x00 ; 0
-   6135 21e4: 09 97 sbiw r24, 0x09 ; 9
-   6136 21e6: 04 c0 rjmp .+8 ; 0x21f0 <disk_ioctl+0x102>
-   6137 21e8: 22 0f add r18, r18
-   6138 21ea: 33 1f adc r19, r19
-   6139 21ec: 44 1f adc r20, r20
-   6140 21ee: 55 1f adc r21, r21
5617 1f76: 81 fd sbrc r24, 1 6141 21f0: 8a 95 dec r24
-   6142 21f2: d2 f7 brpl .-12 ; 0x21e8 <disk_ioctl+0xfa>
-   6143 21f4: f8 01 movw r30, r16
-   6144 21f6: 20 83 st Z, r18
-   6145 21f8: 31 83 std Z+1, r19 ; 0x01
-   6146 21fa: 42 83 std Z+2, r20 ; 0x02
-   6147 21fc: 53 83 std Z+3, r21 ; 0x03
5618 1f78: c9 c0 rjmp .+402 ; 0x210c <disk_initialize+0x1b0> 6148 21fe: 5e c0 rjmp .+188 ; 0x22bc <disk_ioctl+0x1ce>
-   6149 res = RES_OK;
-   6150 }
-   6151 break;
-   6152  
-   6153 case GET_SECTOR_SIZE : /* Get sectors on the disk (WORD) */
-   6154 *(WORD*)buff = 512;
-   6155 2200: 80 e0 ldi r24, 0x00 ; 0
5619 1f7a: 9a e0 ldi r25, 0x0A ; 10 6156 2202: 92 e0 ldi r25, 0x02 ; 2
-   6157 2204: fa 01 movw r30, r20
-   6158 2206: 91 83 std Z+1, r25 ; 0x01
-   6159 2208: 80 83 st Z, r24
-   6160 220a: 58 c0 rjmp .+176 ; 0x22bc <disk_ioctl+0x1ce>
-   6161 BYTE wait_ready (void)
-   6162 {
-   6163 BYTE res;
-   6164  
-   6165  
-   6166 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   6167 220c: 82 e3 ldi r24, 0x32 ; 50
-   6168 220e: 80 93 16 01 sts 0x0116, r24
5620 /*-----------------------------------------------------------------------*/ 6169 /*-----------------------------------------------------------------------*/
5621   6170  
5622 static 6171 static
5623 BYTE rcvr_spi (void) 6172 BYTE rcvr_spi (void)
5624 { 6173 {
5625 SPDR = 0xFF; 6174 SPDR = 0xFF;
5626 1f7c: 8f ef ldi r24, 0xFF ; 255 6175 2212: 8f ef ldi r24, 0xFF ; 255
5627 1f7e: 8e bd out 0x2e, r24 ; 46 6176 2214: 8e bd out 0x2e, r24 ; 46
5628 loop_until_bit_is_set(SPSR, SPIF); 6177 loop_until_bit_is_set(SPSR, SPIF);
5629 1f80: 0d b4 in r0, 0x2d ; 45 6178 2216: 0d b4 in r0, 0x2d ; 45
5630 1f82: 07 fe sbrs r0, 7 6179 2218: 07 fe sbrs r0, 7
5631 1f84: fd cf rjmp .-6 ; 0x1f80 <disk_initialize+0x24> 6180 221a: fd cf rjmp .-6 ; 0x2216 <disk_ioctl+0x128>
5632 return SPDR; 6181 return SPDR;
5633 1f86: 8e b5 in r24, 0x2e ; 46 6182 221c: 8e b5 in r24, 0x2e ; 46
-   6183 /*-----------------------------------------------------------------------*/
5634   6184  
-   6185 static
-   6186 BYTE rcvr_spi (void)
-   6187 {
-   6188 SPDR = 0xFF;
-   6189 221e: 9f ef ldi r25, 0xFF ; 255
-   6190 2220: 9e bd out 0x2e, r25 ; 46
-   6191 loop_until_bit_is_set(SPSR, SPIF);
-   6192 2222: 0d b4 in r0, 0x2d ; 45
-   6193 2224: 07 fe sbrs r0, 7
-   6194 2226: fd cf rjmp .-6 ; 0x2222 <disk_ioctl+0x134>
-   6195 return SPDR;
-   6196 2228: 8e b5 in r24, 0x2e ; 46
5635   6197  
5636 if (drv) return STA_NOINIT; /* Supports only single drive */ 6198 Timer2 = 50; /* Wait for ready in timeout of 500ms */
-   6199 rcvr_spi();
-   6200 do
-   6201 res = rcvr_spi();
-   6202 while ((res != 0xFF) && Timer2);
-   6203 222a: 8f 3f cpi r24, 0xFF ; 255
5637 if (Stat & STA_NODISK) return Stat; /* No card in the socket */ 6204 222c: 09 f4 brne .+2 ; 0x2230 <disk_ioctl+0x142>
-   6205 222e: 46 c0 rjmp .+140 ; 0x22bc <disk_ioctl+0x1ce>
-   6206 2230: 80 91 16 01 lds r24, 0x0116
-   6207 2234: 88 23 and r24, r24
-   6208 2236: a1 f7 brne .-24 ; 0x2220 <disk_ioctl+0x132>
-   6209 2238: 3e c0 rjmp .+124 ; 0x22b6 <disk_ioctl+0x1c8>
-   6210 if (wait_ready() == 0xFF)
-   6211 res = RES_OK;
-   6212 break;
5638   6213  
5639 for (n = 10; n; n--) rcvr_spi(); /* 80 dummy clocks */ 6214 case MMC_GET_CSD : /* Receive CSD as a data block (16 bytes) */
-   6215 if (Stat & STA_NOINIT) return RES_NOTRDY;
-   6216 223a: 80 91 0b 01 lds r24, 0x010B
-   6217 223e: 80 fd sbrc r24, 0
-   6218 2240: 47 c0 rjmp .+142 ; 0x22d0 <disk_ioctl+0x1e2>
-   6219 if ((send_cmd(CMD9, 0) == 0) /* READ_CSD */
-   6220 2242: 40 e0 ldi r20, 0x00 ; 0
-   6221 2244: 50 e0 ldi r21, 0x00 ; 0
-   6222 2246: 60 e0 ldi r22, 0x00 ; 0
5640 1f88: 91 50 subi r25, 0x01 ; 1 6223 2248: 70 e0 ldi r23, 0x00 ; 0
-   6224 224a: 89 e4 ldi r24, 0x49 ; 73
5641 1f8a: c1 f7 brne .-16 ; 0x1f7c <disk_initialize+0x20> 6225 224c: 09 c0 rjmp .+18 ; 0x2260 <disk_ioctl+0x172>
-   6226 && rcvr_datablock(ptr, 16))
-   6227 res = RES_OK;
-   6228 break;
5642   6229  
-   6230 case MMC_GET_CID : /* Receive CID as a data block (16 bytes) */
5643 SELECT(); /* CS = L */ 6231 if (Stat & STA_NOINIT) return RES_NOTRDY;
5644 1f8c: 2a 98 cbi 0x05, 2 ; 5 6232 224e: 80 91 0b 01 lds r24, 0x010B
5645 ty = 0; 6233 2252: 80 fd sbrc r24, 0
-   6234 2254: 3d c0 rjmp .+122 ; 0x22d0 <disk_ioctl+0x1e2>
5646 if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */ 6235 if ((send_cmd(CMD10, 0) == 0) /* READ_CID */
5647 1f8e: 40 e0 ldi r20, 0x00 ; 0 6236 2256: 40 e0 ldi r20, 0x00 ; 0
5648 1f90: 50 e0 ldi r21, 0x00 ; 0 6237 2258: 50 e0 ldi r21, 0x00 ; 0
5649 1f92: 60 e0 ldi r22, 0x00 ; 0 6238 225a: 60 e0 ldi r22, 0x00 ; 0
5650 1f94: 70 e0 ldi r23, 0x00 ; 0 6239 225c: 70 e0 ldi r23, 0x00 ; 0
5651 1f96: 80 e4 ldi r24, 0x40 ; 64 6240 225e: 8a e4 ldi r24, 0x4A ; 74
5652 1f98: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 6241 2260: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5653 1f9c: 81 30 cpi r24, 0x01 ; 1 6242 2264: 88 23 and r24, r24
5654 1f9e: 09 f0 breq .+2 ; 0x1fa2 <disk_initialize+0x46> 6243 2266: 39 f5 brne .+78 ; 0x22b6 <disk_ioctl+0x1c8>
5655 1fa0: a0 c0 rjmp .+320 ; 0x20e2 <disk_initialize+0x186> 6244 2268: 60 e1 ldi r22, 0x10 ; 16
5656 Timer1 = 100; /* Initialization timeout of 1000 msec */ -  
5657 1fa2: 84 e6 ldi r24, 0x64 ; 100 6245 226a: 70 e0 ldi r23, 0x00 ; 0
5658 1fa4: 80 93 0f 01 sts 0x010F, r24 6246 226c: c8 01 movw r24, r16
5659 if (send_cmd(CMD8, 0x1AA) == 1) { /* SDC Ver2+ */ 6247 226e: 0e 94 e3 0d call 0x1bc6 ; 0x1bc6 <rcvr_datablock>
5660 1fa8: 4a ea ldi r20, 0xAA ; 170 6248 2272: 20 e0 ldi r18, 0x00 ; 0
5661 1faa: 51 e0 ldi r21, 0x01 ; 1 6249 2274: 30 e0 ldi r19, 0x00 ; 0
5662 1fac: 60 e0 ldi r22, 0x00 ; 0 6250 2276: 88 23 and r24, r24
5663 1fae: 70 e0 ldi r23, 0x00 ; 0 6251 2278: 19 f5 brne .+70 ; 0x22c0 <disk_ioctl+0x1d2>
5664 1fb0: 88 e4 ldi r24, 0x48 ; 72 6252 227a: 1d c0 rjmp .+58 ; 0x22b6 <disk_ioctl+0x1c8>
-   6253 && rcvr_datablock(ptr, 16))
-   6254 res = RES_OK;
-   6255 break;
-   6256  
5665 1fb2: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> 6257 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */
-   6258 if (Stat & STA_NOINIT) return RES_NOTRDY;
5666 1fb6: 81 30 cpi r24, 0x01 ; 1 6259 227c: 80 91 0b 01 lds r24, 0x010B
5667 1fb8: 09 f0 breq .+2 ; 0x1fbc <disk_initialize+0x60> 6260 2280: 80 fd sbrc r24, 0
5668 1fba: 54 c0 rjmp .+168 ; 0x2064 <disk_initialize+0x108> 6261 2282: 26 c0 rjmp .+76 ; 0x22d0 <disk_ioctl+0x1e2>
-   6262 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */
5669 1fbc: 7e 01 movw r14, r28 6263 2284: 40 e0 ldi r20, 0x00 ; 0
5670 1fbe: 08 94 sec 6264 2286: 50 e0 ldi r21, 0x00 ; 0
5671 1fc0: e1 1c adc r14, r1 6265 2288: 60 e0 ldi r22, 0x00 ; 0
5672 1fc2: f1 1c adc r15, r1 6266 228a: 70 e0 ldi r23, 0x00 ; 0
5673 1fc4: 87 01 movw r16, r14 6267 228c: 8a e7 ldi r24, 0x7A ; 122
5674 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi(); 6268 228e: 0e 94 60 0e call 0x1cc0 ; 0x1cc0 <send_cmd>
5675 1fc6: 9e 01 movw r18, r28 6269 2292: 88 23 and r24, r24
5676 1fc8: 2b 5f subi r18, 0xFB ; 251 6270 2294: 81 f4 brne .+32 ; 0x22b6 <disk_ioctl+0x1c8>
5677 1fca: 3f 4f sbci r19, 0xFF ; 255 6271 2296: f8 01 movw r30, r16
5678 /*-----------------------------------------------------------------------*/ 6272 /*-----------------------------------------------------------------------*/
5679   6273  
5680 static 6274 static
5681 BYTE rcvr_spi (void) 6275 BYTE rcvr_spi (void)
5682 { 6276 {
5683 SPDR = 0xFF; 6277 SPDR = 0xFF;
5684 1fcc: 8f ef ldi r24, 0xFF ; 255 6278 2298: 9f ef ldi r25, 0xFF ; 255
5685 1fce: 8e bd out 0x2e, r24 ; 46 -  
5686 loop_until_bit_is_set(SPSR, SPIF); -  
5687 1fd0: 0d b4 in r0, 0x2d ; 45 -  
5688 1fd2: 07 fe sbrs r0, 7 -  
5689 1fd4: fd cf rjmp .-6 ; 0x1fd0 <disk_initialize+0x74> -  
5690 return SPDR; 6279 break;
5691 1fd6: 8e b5 in r24, 0x2e ; 46 -  
5692 SELECT(); /* CS = L */ -  
5693 ty = 0; 6280  
5694 if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */ 6281 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */
5695 Timer1 = 100; /* Initialization timeout of 1000 msec */ 6282 if (Stat & STA_NOINIT) return RES_NOTRDY;
5696 if (send_cmd(CMD8, 0x1AA) == 1) { /* SDC Ver2+ */ 6283 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */
5697 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi(); 6284 for (n = 0; n < 4; n++)
5698 1fd8: f8 01 movw r30, r16 6285 229a: 98 01 movw r18, r16
5699 1fda: 81 93 st Z+, r24 -  
5700 1fdc: 8f 01 movw r16, r30 -  
5701 1fde: e2 17 cp r30, r18 -  
5702 1fe0: f3 07 cpc r31, r19 -  
5703 1fe2: a1 f7 brne .-24 ; 0x1fcc <disk_initialize+0x70> -  
5704 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */ -  
5705 1fe4: 8b 81 ldd r24, Y+3 ; 0x03 -  
5706 1fe6: 81 30 cpi r24, 0x01 ; 1 -  
5707 1fe8: 09 f0 breq .+2 ; 0x1fec <disk_initialize+0x90> -  
5708 1fea: 7b c0 rjmp .+246 ; 0x20e2 <disk_initialize+0x186> -  
5709 1fec: 8c 81 ldd r24, Y+4 ; 0x04 -  
5710 1fee: 8a 3a cpi r24, 0xAA ; 170 -  
5711 1ff0: 09 f0 breq .+2 ; 0x1ff4 <disk_initialize+0x98> -  
5712 1ff2: 77 c0 rjmp .+238 ; 0x20e2 <disk_initialize+0x186> -  
5713 do { -  
5714 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 1UL << 30) == 0) break; /* ACMD41 with HCS bit */ -  
5715 1ff4: 40 e0 ldi r20, 0x00 ; 0 -  
5716 1ff6: 50 e0 ldi r21, 0x00 ; 0 -  
5717 1ff8: 60 e0 ldi r22, 0x00 ; 0 -  
5718 1ffa: 70 e0 ldi r23, 0x00 ; 0 -  
5719 1ffc: 87 e7 ldi r24, 0x77 ; 119 -  
5720 1ffe: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5721 2002: 82 30 cpi r24, 0x02 ; 2 -  
5722 2004: 48 f4 brcc .+18 ; 0x2018 <disk_initialize+0xbc> -  
5723 2006: 40 e0 ldi r20, 0x00 ; 0 -  
5724 2008: 50 e0 ldi r21, 0x00 ; 0 -  
5725 200a: 60 e0 ldi r22, 0x00 ; 0 -  
5726 200c: 70 e4 ldi r23, 0x40 ; 64 6286 229c: 2d 5f subi r18, 0xFD ; 253
5727 200e: 89 e6 ldi r24, 0x69 ; 105 6287 229e: 3f 4f sbci r19, 0xFF ; 255
5728 2010: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5729 2014: 88 23 and r24, r24 -  
5730 2016: 21 f0 breq .+8 ; 0x2020 <disk_initialize+0xc4> -  
5731 } while (Timer1); -  
5732 2018: 80 91 0f 01 lds r24, 0x010F -  
5733 201c: 88 23 and r24, r24 -  
5734 201e: 51 f7 brne .-44 ; 0x1ff4 <disk_initialize+0x98> -  
5735 if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit */ -  
5736 2020: 80 91 0f 01 lds r24, 0x010F -  
5737 2024: 88 23 and r24, r24 -  
5738 2026: 09 f4 brne .+2 ; 0x202a <disk_initialize+0xce> -  
5739 2028: 5c c0 rjmp .+184 ; 0x20e2 <disk_initialize+0x186> -  
5740 202a: 40 e0 ldi r20, 0x00 ; 0 -  
5741 202c: 50 e0 ldi r21, 0x00 ; 0 -  
5742 202e: 60 e0 ldi r22, 0x00 ; 0 -  
5743 2030: 70 e0 ldi r23, 0x00 ; 0 -  
5744 2032: 8a e7 ldi r24, 0x7A ; 122 -  
5745 2034: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5746 2038: 88 23 and r24, r24 -  
5747 203a: 09 f0 breq .+2 ; 0x203e <disk_initialize+0xe2> -  
5748 203c: 52 c0 rjmp .+164 ; 0x20e2 <disk_initialize+0x186> -  
5749 /*-----------------------------------------------------------------------*/ 6288 /*-----------------------------------------------------------------------*/
5750   6289  
5751 static 6290 static
5752 BYTE rcvr_spi (void) 6291 BYTE rcvr_spi (void)
5753 { 6292 {
5754 SPDR = 0xFF; 6293 SPDR = 0xFF;
5755 203e: 8f ef ldi r24, 0xFF ; 255 -  
5756 2040: 8e bd out 0x2e, r24 ; 46 6294 22a0: 9e bd out 0x2e, r25 ; 46
5757 loop_until_bit_is_set(SPSR, SPIF); 6295 loop_until_bit_is_set(SPSR, SPIF);
5758 2042: 0d b4 in r0, 0x2d ; 45 6296 22a2: 0d b4 in r0, 0x2d ; 45
5759 2044: 07 fe sbrs r0, 7 6297 22a4: 07 fe sbrs r0, 7
5760 2046: fd cf rjmp .-6 ; 0x2042 <disk_initialize+0xe6> 6298 22a6: fd cf rjmp .-6 ; 0x22a2 <disk_ioctl+0x1b4>
5761 return SPDR; 6299 return SPDR;
5762 2048: 8e b5 in r24, 0x2e ; 46 6300 22a8: 8e b5 in r24, 0x2e ; 46
5763 if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */ -  
5764 do { 6301  
5765 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 1UL << 30) == 0) break; /* ACMD41 with HCS bit */ 6302 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */
5766 } while (Timer1); 6303 if (Stat & STA_NOINIT) return RES_NOTRDY;
5767 if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit */ 6304 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */
5768 for (n = 0; n < 4; n++) ocr[n] = rcvr_spi(); 6305 for (n = 0; n < 4; n++)
5769 204a: f7 01 movw r30, r14 6306 *ptr++ = rcvr_spi();
5770 204c: 81 93 st Z+, r24 6307 22aa: 80 83 st Z, r24
5771 204e: 7f 01 movw r14, r30 -  
5772 2050: e0 17 cp r30, r16 -  
5773 2052: f1 07 cpc r31, r17 -  
5774 2054: a1 f7 brne .-24 ; 0x203e <disk_initialize+0xe2> -  
5775 ty = (ocr[0] & 0x40) ? 6 : 2; -  
5776 2056: 89 81 ldd r24, Y+1 ; 0x01 -  
5777 2058: 86 ff sbrs r24, 6 -  
5778 205a: 02 c0 rjmp .+4 ; 0x2060 <disk_initialize+0x104> -  
5779 205c: 16 e0 ldi r17, 0x06 ; 6 -  
5780 205e: 42 c0 rjmp .+132 ; 0x20e4 <disk_initialize+0x188> -  
5781 2060: 12 e0 ldi r17, 0x02 ; 2 -  
5782 2062: 40 c0 rjmp .+128 ; 0x20e4 <disk_initialize+0x188> -  
5783 } 6308 break;
5784 } 6309  
5785 } else { /* SDC Ver1 or MMC */ -  
5786 ty = (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) <= 1) ? 2 : 1; /* SDC : MMC */ 6310 case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */
5787 2064: 40 e0 ldi r20, 0x00 ; 0 -  
5788 2066: 50 e0 ldi r21, 0x00 ; 0 -  
5789 2068: 60 e0 ldi r22, 0x00 ; 0 -  
5790 206a: 70 e0 ldi r23, 0x00 ; 0 6311 if (Stat & STA_NOINIT) return RES_NOTRDY;
5791 206c: 87 e7 ldi r24, 0x77 ; 119 6312 if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */
5792 206e: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5793 2072: 82 30 cpi r24, 0x02 ; 2 6313 for (n = 0; n < 4; n++)
5794 2074: 58 f4 brcc .+22 ; 0x208c <disk_initialize+0x130> -  
5795 2076: 40 e0 ldi r20, 0x00 ; 0 6314 22ac: e2 17 cp r30, r18
5796 2078: 50 e0 ldi r21, 0x00 ; 0 -  
5797 207a: 60 e0 ldi r22, 0x00 ; 0 -  
5798 207c: 70 e0 ldi r23, 0x00 ; 0 -  
5799 207e: 89 e6 ldi r24, 0x69 ; 105 -  
5800 2080: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5801 2084: 82 30 cpi r24, 0x02 ; 2 6315 22ae: f3 07 cpc r31, r19
5802 2086: 10 f4 brcc .+4 ; 0x208c <disk_initialize+0x130> 6316 22b0: 29 f0 breq .+10 ; 0x22bc <disk_ioctl+0x1ce>
5803 2088: 12 e0 ldi r17, 0x02 ; 2 -  
5804 208a: 01 c0 rjmp .+2 ; 0x208e <disk_initialize+0x132> -  
5805 208c: 11 e0 ldi r17, 0x01 ; 1 -  
5806 do { -  
5807 if (ty == 2) { 6317 *ptr++ = rcvr_spi();
5808 208e: 12 30 cpi r17, 0x02 ; 2 -  
5809 2090: 79 f4 brne .+30 ; 0x20b0 <disk_initialize+0x154> -  
5810 if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) == 0) break; /* ACMD41 */ -  
5811 2092: 40 e0 ldi r20, 0x00 ; 0 6318 22b2: 31 96 adiw r30, 0x01 ; 1
5812 2094: 50 e0 ldi r21, 0x00 ; 0 -  
5813 2096: 60 e0 ldi r22, 0x00 ; 0 -  
5814 2098: 70 e0 ldi r23, 0x00 ; 0 -  
5815 209a: 87 e7 ldi r24, 0x77 ; 119 -  
5816 209c: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5817 20a0: 82 30 cpi r24, 0x02 ; 2 -  
5818 20a2: 78 f4 brcc .+30 ; 0x20c2 <disk_initialize+0x166> 6319 22b4: f5 cf rjmp .-22 ; 0x22a0 <disk_ioctl+0x1b2>
5819 20a4: 40 e0 ldi r20, 0x00 ; 0 -  
5820 20a6: 50 e0 ldi r21, 0x00 ; 0 6320 22b6: 21 e0 ldi r18, 0x01 ; 1
5821 20a8: 60 e0 ldi r22, 0x00 ; 0 6321 22b8: 30 e0 ldi r19, 0x00 ; 0
5822 20aa: 70 e0 ldi r23, 0x00 ; 0 -  
5823 20ac: 89 e6 ldi r24, 0x69 ; 105 -  
5824 20ae: 05 c0 rjmp .+10 ; 0x20ba <disk_initialize+0x15e> 6322 22ba: 02 c0 rjmp .+4 ; 0x22c0 <disk_ioctl+0x1d2>
5825 } else { -  
5826 if (send_cmd(CMD1, 0) == 0) break; /* CMD1 */ -  
5827 20b0: 40 e0 ldi r20, 0x00 ; 0 -  
5828 20b2: 50 e0 ldi r21, 0x00 ; 0 -  
5829 20b4: 60 e0 ldi r22, 0x00 ; 0 6323 22bc: 20 e0 ldi r18, 0x00 ; 0
5830 20b6: 70 e0 ldi r23, 0x00 ; 0 6324 22be: 30 e0 ldi r19, 0x00 ; 0
5831 20b8: 81 e4 ldi r24, 0x41 ; 65 -  
5832 20ba: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5833 20be: 88 23 and r24, r24 -  
5834 20c0: 21 f0 breq .+8 ; 0x20ca <disk_initialize+0x16e> -  
5835 } 6325  
5836 } while (Timer1); 6326 default:
5837 20c2: 80 91 0f 01 lds r24, 0x010F -  
5838 20c6: 88 23 and r24, r24 -  
5839 20c8: 11 f7 brne .-60 ; 0x208e <disk_initialize+0x132> -  
5840 if (!Timer1 || send_cmd(CMD16, 512) != 0) /* Select R/W block length */ -  
5841 20ca: 80 91 0f 01 lds r24, 0x010F -  
5842 20ce: 88 23 and r24, r24 -  
5843 20d0: 41 f0 breq .+16 ; 0x20e2 <disk_initialize+0x186> -  
5844 20d2: 40 e0 ldi r20, 0x00 ; 0 -  
5845 20d4: 52 e0 ldi r21, 0x02 ; 2 -  
5846 20d6: 60 e0 ldi r22, 0x00 ; 0 -  
5847 20d8: 70 e0 ldi r23, 0x00 ; 0 -  
5848 20da: 80 e5 ldi r24, 0x50 ; 80 -  
5849 20dc: 0e 94 65 0d call 0x1aca ; 0x1aca <send_cmd> -  
5850 20e0: 81 11 cpse r24, r1 -  
5851 20e2: 10 e0 ldi r17, 0x00 ; 0 -  
5852 ty = 0; 6327 res = RES_PARERR;
5853 } -  
5854 } 6328 }
5855 CardType = ty; 6329  
5856 20e4: 10 93 11 01 sts 0x0111, r17 -  
5857 DESELECT(); /* CS = H */ 6330 DESELECT(); /* CS = H */
5858 20e8: 2a 9a sbi 0x05, 2 ; 5 6331 22c0: 2a 9a sbi 0x05, 2 ; 5
5859 /*-----------------------------------------------------------------------*/ 6332 /*-----------------------------------------------------------------------*/
5860   6333  
5861 static 6334 static
5862 BYTE rcvr_spi (void) 6335 BYTE rcvr_spi (void)
5863 { 6336 {
5864 SPDR = 0xFF; 6337 SPDR = 0xFF;
5865 20ea: 8f ef ldi r24, 0xFF ; 255 6338 22c2: 8f ef ldi r24, 0xFF ; 255
5866 20ec: 8e bd out 0x2e, r24 ; 46 6339 22c4: 8e bd out 0x2e, r24 ; 46
5867 loop_until_bit_is_set(SPSR, SPIF); 6340 loop_until_bit_is_set(SPSR, SPIF);
5868 20ee: 0d b4 in r0, 0x2d ; 45 6341 22c6: 0d b4 in r0, 0x2d ; 45
5869 20f0: 07 fe sbrs r0, 7 6342 22c8: 07 fe sbrs r0, 7
5870 20f2: fd cf rjmp .-6 ; 0x20ee <disk_initialize+0x192> 6343 22ca: fd cf rjmp .-6 ; 0x22c6 <disk_ioctl+0x1d8>
5871 return SPDR; 6344 return SPDR;
5872 20f4: 8e b5 in r24, 0x2e ; 46 6345 22cc: 8e b5 in r24, 0x2e ; 46
-   6346 22ce: 02 c0 rjmp .+4 ; 0x22d4 <disk_ioctl+0x1e6>
5873 } 6347 }
5874 CardType = ty; 6348  
5875 DESELECT(); /* CS = H */ 6349 DESELECT(); /* CS = H */
5876 rcvr_spi(); /* Idle (Release DO) */ 6350 rcvr_spi(); /* Idle (Release DO) */
5877   6351  
5878 if (ty) { /* Initialization succeded */ 6352 return res;
5879 20f6: 11 23 and r17, r17 6353 22d0: 23 e0 ldi r18, 0x03 ; 3
5880 20f8: 21 f0 breq .+8 ; 0x2102 <disk_initialize+0x1a6> -  
5881 Stat &= ~STA_NOINIT; /* Clear STA_NOINIT */ -  
5882 20fa: 80 91 04 01 lds r24, 0x0104 6354 22d2: 30 e0 ldi r19, 0x00 ; 0
-   6355 }
5883 20fe: 8e 7f andi r24, 0xFE ; 254 6356 22d4: c9 01 movw r24, r18
5884 2100: 03 c0 rjmp .+6 ; 0x2108 <disk_initialize+0x1ac> -  
5885 } else { /* Initialization failed */ -  
5886 Stat |= STA_NOINIT; /* Set STA_NOINIT */ -  
5887 2102: 80 91 04 01 lds r24, 0x0104 6357 22d6: 60 96 adiw r28, 0x10 ; 16
5888 2106: 81 60 ori r24, 0x01 ; 1 6358 22d8: e4 e0 ldi r30, 0x04 ; 4
5889 2108: 80 93 04 01 sts 0x0104, r24 6359 22da: 0c 94 f1 14 jmp 0x29e2 ; 0x29e2 <__epilogue_restores__+0x1c>
5890 } -  
5891   6360  
5892 return Stat; 6361 000022de <disk_timerproc>:
5893 210c: 80 91 04 01 lds r24, 0x0104 6362 /* Device timer interrupt procedure */
5894 2110: 99 27 eor r25, r25 6363 /* This must be called in period of 10ms */
5895 2112: e6 e0 ldi r30, 0x06 ; 6 6364 /* (Platform dependent) */
5896 2114: 24 96 adiw r28, 0x04 ; 4 6365  
5897 2116: 0c 94 52 11 jmp 0x22a4 ; 0x22a4 <__epilogue_restores__+0x18> 6366 void disk_timerproc (void)
5898   6367 {
5899 0000211a <strcpy_P>: 6368 22de: 80 91 15 01 lds r24, 0x0115
5900 211a: fb 01 movw r30, r22 6369 static BYTE pv;
5901 211c: dc 01 movw r26, r24 6370 BYTE n, s;
5902 211e: 05 90 lpm r0, Z+ 6371  
5903 2120: 0d 92 st X+, r0 6372  
5904 2122: 00 20 and r0, r0 6373 n = Timer1; /* 100Hz decrement timer */
5905 2124: e1 f7 brne .-8 ; 0x211e <strcpy_P+0x4> 6374 if (n) Timer1 = --n;
5906 2126: 08 95 ret 6375 22e2: 88 23 and r24, r24
5907   6376 22e4: 19 f0 breq .+6 ; 0x22ec <disk_timerproc+0xe>
5908 00002128 <memcmp>: 6377 22e6: 81 50 subi r24, 0x01 ; 1
5909 2128: fb 01 movw r30, r22 6378 22e8: 80 93 15 01 sts 0x0115, r24
5910 212a: dc 01 movw r26, r24 6379 n = Timer2;
5911 212c: 04 c0 rjmp .+8 ; 0x2136 <memcmp+0xe> 6380 22ec: 80 91 16 01 lds r24, 0x0116
5912 212e: 8d 91 ld r24, X+ 6381 if (n) Timer2 = --n;
5913 2130: 01 90 ld r0, Z+ 6382 22f0: 88 23 and r24, r24
5914 2132: 80 19 sub r24, r0 6383 22f2: 19 f0 breq .+6 ; 0x22fa <disk_timerproc+0x1c>
5915 2134: 21 f4 brne .+8 ; 0x213e <memcmp+0x16> 6384 22f4: 81 50 subi r24, 0x01 ; 1
5916 2136: 41 50 subi r20, 0x01 ; 1 6385 22f6: 80 93 16 01 sts 0x0116, r24
5917 2138: 50 40 sbci r21, 0x00 ; 0 6386  
5918 213a: c8 f7 brcc .-14 ; 0x212e <memcmp+0x6> 6387 n = pv;
5919 213c: 88 1b sub r24, r24 6388 22fa: 90 91 14 01 lds r25, 0x0114
5920 213e: 99 0b sbc r25, r25 6389 pv = SOCKPORT & (SOCKINS); /* Sample socket switch */
5921 2140: 08 95 ret 6390 22fe: 83 b1 in r24, 0x03 ; 3
5922   6391 2300: 81 70 andi r24, 0x01 ; 1
5923 00002142 <memcpy>: 6392 2302: 80 93 14 01 sts 0x0114, r24
5924 2142: fb 01 movw r30, r22 6393  
5925 2144: dc 01 movw r26, r24 6394 if (n == pv) { /* Have contacts stabled? */
5926 2146: 02 c0 rjmp .+4 ; 0x214c <memcpy+0xa> 6395 2306: 98 17 cp r25, r24
5927 2148: 01 90 ld r0, Z+ 6396 2308: 49 f4 brne .+18 ; 0x231c <disk_timerproc+0x3e>
5928 214a: 0d 92 st X+, r0 6397 s = Stat;
5929 214c: 41 50 subi r20, 0x01 ; 1 6398 230a: 80 91 0b 01 lds r24, 0x010B
5930 214e: 50 40 sbci r21, 0x00 ; 0 6399 if (pv & SOCKINS) /* INS = H (Socket empty) */
5931 2150: d8 f7 brcc .-10 ; 0x2148 <memcpy+0x6> 6400 230e: 90 ff sbrs r25, 0
5932 2152: 08 95 ret 6401 2310: 02 c0 rjmp .+4 ; 0x2316 <disk_timerproc+0x38>
5933   6402 s |= (STA_NODISK | STA_NOINIT);
5934 00002154 <memset>: 6403 2312: 83 60 ori r24, 0x03 ; 3
5935 2154: dc 01 movw r26, r24 6404 2314: 01 c0 rjmp .+2 ; 0x2318 <disk_timerproc+0x3a>
5936 2156: 01 c0 rjmp .+2 ; 0x215a <memset+0x6> 6405 else /* INS = L (Card inserted) */
5937 2158: 6d 93 st X+, r22 6406 s &= ~STA_NODISK;
5938 215a: 41 50 subi r20, 0x01 ; 1 6407 2316: 8d 7f andi r24, 0xFD ; 253
5939 215c: 50 40 sbci r21, 0x00 ; 0 6408  
5940 215e: e0 f7 brcc .-8 ; 0x2158 <memset+0x4> 6409 Stat = s;
5941 2160: 08 95 ret 6410 2318: 80 93 0b 01 sts 0x010B, r24
5942   6411 231c: 08 95 ret
5943 00002162 <strcpy>: 6412  
5944 2162: fb 01 movw r30, r22 6413 0000231e <strcpy_P>:
5945 2164: dc 01 movw r26, r24 6414 231e: fb 01 movw r30, r22
5946 2166: 01 90 ld r0, Z+ 6415 2320: dc 01 movw r26, r24
5947 2168: 0d 92 st X+, r0 6416 2322: 05 90 lpm r0, Z+
5948 216a: 00 20 and r0, r0 6417 2324: 0d 92 st X+, r0
5949 216c: e1 f7 brne .-8 ; 0x2166 <strcpy+0x4> 6418 2326: 00 20 and r0, r0
5950 216e: 08 95 ret 6419 2328: e1 f7 brne .-8 ; 0x2322 <strcpy_P+0x4>
5951   6420 232a: 08 95 ret
5952 00002170 <itoa>: 6421  
5953 2170: fb 01 movw r30, r22 6422 0000232c <memcmp>:
5954 2172: 9f 01 movw r18, r30 6423 232c: fb 01 movw r30, r22
5955 2174: e8 94 clt 6424 232e: dc 01 movw r26, r24
5956 2176: 42 30 cpi r20, 0x02 ; 2 6425 2330: 04 c0 rjmp .+8 ; 0x233a <memcmp+0xe>
5957 2178: c4 f0 brlt .+48 ; 0x21aa <itoa+0x3a> 6426 2332: 8d 91 ld r24, X+
5958 217a: 45 32 cpi r20, 0x25 ; 37 6427 2334: 01 90 ld r0, Z+
5959 217c: b4 f4 brge .+44 ; 0x21aa <itoa+0x3a> 6428 2336: 80 19 sub r24, r0
5960 217e: 4a 30 cpi r20, 0x0A ; 10 6429 2338: 21 f4 brne .+8 ; 0x2342 <memcmp+0x16>
5961 2180: 29 f4 brne .+10 ; 0x218c <itoa+0x1c> 6430 233a: 41 50 subi r20, 0x01 ; 1
5962 2182: 97 fb bst r25, 7 6431 233c: 50 40 sbci r21, 0x00 ; 0
5963 2184: 1e f4 brtc .+6 ; 0x218c <itoa+0x1c> 6432 233e: c8 f7 brcc .-14 ; 0x2332 <memcmp+0x6>
5964 2186: 90 95 com r25 6433 2340: 88 1b sub r24, r24
5965 2188: 81 95 neg r24 6434 2342: 99 0b sbc r25, r25
5966 218a: 9f 4f sbci r25, 0xFF ; 255 6435 2344: 08 95 ret
5967 218c: 64 2f mov r22, r20 6436  
5968 218e: 77 27 eor r23, r23 6437 00002346 <memcpy>:
5969 2190: 0e 94 61 11 call 0x22c2 ; 0x22c2 <__udivmodhi4> 6438 2346: fb 01 movw r30, r22
5970 2194: 80 5d subi r24, 0xD0 ; 208 6439 2348: dc 01 movw r26, r24
5971 2196: 8a 33 cpi r24, 0x3A ; 58 6440 234a: 02 c0 rjmp .+4 ; 0x2350 <memcpy+0xa>
5972 2198: 0c f0 brlt .+2 ; 0x219c <itoa+0x2c> 6441 234c: 01 90 ld r0, Z+
5973 219a: 89 5d subi r24, 0xD9 ; 217 6442 234e: 0d 92 st X+, r0
5974 219c: 81 93 st Z+, r24 6443 2350: 41 50 subi r20, 0x01 ; 1
5975 219e: cb 01 movw r24, r22 6444 2352: 50 40 sbci r21, 0x00 ; 0
5976 21a0: 00 97 sbiw r24, 0x00 ; 0 6445 2354: d8 f7 brcc .-10 ; 0x234c <memcpy+0x6>
5977 21a2: a1 f7 brne .-24 ; 0x218c <itoa+0x1c> 6446 2356: 08 95 ret
5978 21a4: 16 f4 brtc .+4 ; 0x21aa <itoa+0x3a> 6447  
5979 21a6: 5d e2 ldi r21, 0x2D ; 45 6448 00002358 <memset>:
5980 21a8: 51 93 st Z+, r21 6449 2358: dc 01 movw r26, r24
5981 21aa: 10 82 st Z, r1 6450 235a: 01 c0 rjmp .+2 ; 0x235e <memset+0x6>
5982 21ac: c9 01 movw r24, r18 6451 235c: 6d 93 st X+, r22
5983 21ae: 0c 94 d9 10 jmp 0x21b2 ; 0x21b2 <strrev> 6452 235e: 41 50 subi r20, 0x01 ; 1
5984   6453 2360: 50 40 sbci r21, 0x00 ; 0
5985 000021b2 <strrev>: 6454 2362: e0 f7 brcc .-8 ; 0x235c <memset+0x4>
5986 21b2: dc 01 movw r26, r24 6455 2364: 08 95 ret
5987 21b4: fc 01 movw r30, r24 6456  
5988 21b6: 67 2f mov r22, r23 6457 00002366 <itoa>:
5989 21b8: 71 91 ld r23, Z+ 6458 2366: fb 01 movw r30, r22
5990 21ba: 77 23 and r23, r23 6459 2368: 9f 01 movw r18, r30
5991 21bc: e1 f7 brne .-8 ; 0x21b6 <strrev+0x4> 6460 236a: e8 94 clt
5992 21be: 32 97 sbiw r30, 0x02 ; 2 6461 236c: 42 30 cpi r20, 0x02 ; 2
5993 21c0: 04 c0 rjmp .+8 ; 0x21ca <strrev+0x18> 6462 236e: c4 f0 brlt .+48 ; 0x23a0 <itoa+0x3a>
5994 21c2: 7c 91 ld r23, X 6463 2370: 45 32 cpi r20, 0x25 ; 37
5995 21c4: 6d 93 st X+, r22 6464 2372: b4 f4 brge .+44 ; 0x23a0 <itoa+0x3a>
5996 21c6: 70 83 st Z, r23 6465 2374: 4a 30 cpi r20, 0x0A ; 10
5997 21c8: 62 91 ld r22, -Z 6466 2376: 29 f4 brne .+10 ; 0x2382 <itoa+0x1c>
5998 21ca: ae 17 cp r26, r30 6467 2378: 97 fb bst r25, 7
5999 21cc: bf 07 cpc r27, r31 6468 237a: 1e f4 brtc .+6 ; 0x2382 <itoa+0x1c>
6000 21ce: c8 f3 brcs .-14 ; 0x21c2 <strrev+0x10> 6469 237c: 90 95 com r25
6001 21d0: 08 95 ret 6470 237e: 81 95 neg r24
6002   6471 2380: 9f 4f sbci r25, 0xFF ; 255
6003 000021d2 <__mulsi3>: 6472 2382: 64 2f mov r22, r20
6004 21d2: 62 9f mul r22, r18 6473 2384: 77 27 eor r23, r23
6005 21d4: d0 01 movw r26, r0 6474 2386: 0e 94 fe 14 call 0x29fc ; 0x29fc <__udivmodhi4>
6006 21d6: 73 9f mul r23, r19 6475 238a: 80 5d subi r24, 0xD0 ; 208
6007 21d8: f0 01 movw r30, r0 6476 238c: 8a 33 cpi r24, 0x3A ; 58
6008 21da: 82 9f mul r24, r18 6477 238e: 0c f0 brlt .+2 ; 0x2392 <itoa+0x2c>
6009 21dc: e0 0d add r30, r0 6478 2390: 89 5d subi r24, 0xD9 ; 217
6010 21de: f1 1d adc r31, r1 6479 2392: 81 93 st Z+, r24
6011 21e0: 64 9f mul r22, r20 6480 2394: cb 01 movw r24, r22
6012 21e2: e0 0d add r30, r0 6481 2396: 00 97 sbiw r24, 0x00 ; 0
6013 21e4: f1 1d adc r31, r1 6482 2398: a1 f7 brne .-24 ; 0x2382 <itoa+0x1c>
6014 21e6: 92 9f mul r25, r18 6483 239a: 16 f4 brtc .+4 ; 0x23a0 <itoa+0x3a>
6015 21e8: f0 0d add r31, r0 6484 239c: 5d e2 ldi r21, 0x2D ; 45
6016 21ea: 83 9f mul r24, r19 6485 239e: 51 93 st Z+, r21
6017 21ec: f0 0d add r31, r0 6486 23a0: 10 82 st Z, r1
6018 21ee: 74 9f mul r23, r20 6487 23a2: c9 01 movw r24, r18
6019 21f0: f0 0d add r31, r0 6488 23a4: 0c 94 ec 13 jmp 0x27d8 ; 0x27d8 <strrev>
6020 21f2: 65 9f mul r22, r21 6489  
6021 21f4: f0 0d add r31, r0 6490 000023a8 <sprintf>:
6022 21f6: 99 27 eor r25, r25 6491 23a8: ae e0 ldi r26, 0x0E ; 14
6023 21f8: 72 9f mul r23, r18 6492 23aa: b0 e0 ldi r27, 0x00 ; 0
6024 21fa: b0 0d add r27, r0 6493 23ac: ea ed ldi r30, 0xDA ; 218
6025 21fc: e1 1d adc r30, r1 6494 23ae: f1 e1 ldi r31, 0x11 ; 17
6026 21fe: f9 1f adc r31, r25 6495 23b0: 0c 94 d5 14 jmp 0x29aa ; 0x29aa <__prologue_saves__+0x1c>
6027 2200: 63 9f mul r22, r19 6496 23b4: 0d 89 ldd r16, Y+21 ; 0x15
6028 2202: b0 0d add r27, r0 6497 23b6: 1e 89 ldd r17, Y+22 ; 0x16
6029 2204: e1 1d adc r30, r1 6498 23b8: 86 e0 ldi r24, 0x06 ; 6
6030 2206: f9 1f adc r31, r25 6499 23ba: 8c 83 std Y+4, r24 ; 0x04
6031 2208: bd 01 movw r22, r26 6500 23bc: 1a 83 std Y+2, r17 ; 0x02
6032 220a: cf 01 movw r24, r30 6501 23be: 09 83 std Y+1, r16 ; 0x01
6033 220c: 11 24 eor r1, r1 6502 23c0: 8f ef ldi r24, 0xFF ; 255
6034 220e: 08 95 ret 6503 23c2: 9f e7 ldi r25, 0x7F ; 127
6035   6504 23c4: 9e 83 std Y+6, r25 ; 0x06
6036 00002210 <__udivmodsi4>: 6505 23c6: 8d 83 std Y+5, r24 ; 0x05
6037 2210: a1 e2 ldi r26, 0x21 ; 33 6506 23c8: ce 01 movw r24, r28
6038 2212: 1a 2e mov r1, r26 6507 23ca: 49 96 adiw r24, 0x19 ; 25
6039 2214: aa 1b sub r26, r26 6508 23cc: ac 01 movw r20, r24
6040 2216: bb 1b sub r27, r27 6509 23ce: 6f 89 ldd r22, Y+23 ; 0x17
6041 2218: fd 01 movw r30, r26 6510 23d0: 78 8d ldd r23, Y+24 ; 0x18
6042 221a: 0d c0 rjmp .+26 ; 0x2236 <__udivmodsi4_ep> 6511 23d2: ce 01 movw r24, r28
6043   6512 23d4: 01 96 adiw r24, 0x01 ; 1
6044 0000221c <__udivmodsi4_loop>: 6513 23d6: 0e 94 f7 11 call 0x23ee ; 0x23ee <vfprintf>
6045 221c: aa 1f adc r26, r26 6514 23da: 2f 81 ldd r18, Y+7 ; 0x07
6046 221e: bb 1f adc r27, r27 6515 23dc: 38 85 ldd r19, Y+8 ; 0x08
6047 2220: ee 1f adc r30, r30 6516 23de: 02 0f add r16, r18
6048 2222: ff 1f adc r31, r31 6517 23e0: 13 1f adc r17, r19
6049 2224: a2 17 cp r26, r18 6518 23e2: f8 01 movw r30, r16
6050 2226: b3 07 cpc r27, r19 6519 23e4: 10 82 st Z, r1
6051 2228: e4 07 cpc r30, r20 6520 23e6: 2e 96 adiw r28, 0x0e ; 14
6052 222a: f5 07 cpc r31, r21 6521 23e8: e4 e0 ldi r30, 0x04 ; 4
6053 222c: 20 f0 brcs .+8 ; 0x2236 <__udivmodsi4_ep> 6522 23ea: 0c 94 f1 14 jmp 0x29e2 ; 0x29e2 <__epilogue_restores__+0x1c>
6054 222e: a2 1b sub r26, r18 6523  
6055 2230: b3 0b sbc r27, r19 6524 000023ee <vfprintf>:
6056 2232: e4 0b sbc r30, r20 6525 23ee: ab e0 ldi r26, 0x0B ; 11
6057 2234: f5 0b sbc r31, r21 6526 23f0: b0 e0 ldi r27, 0x00 ; 0
6058   6527 23f2: ed ef ldi r30, 0xFD ; 253
6059 00002236 <__udivmodsi4_ep>: 6528 23f4: f1 e1 ldi r31, 0x11 ; 17
6060 2236: 66 1f adc r22, r22 6529 23f6: 0c 94 c7 14 jmp 0x298e ; 0x298e <__prologue_saves__>
6061 2238: 77 1f adc r23, r23 6530 23fa: 3c 01 movw r6, r24
6062 223a: 88 1f adc r24, r24 6531 23fc: 2b 01 movw r4, r22
6063 223c: 99 1f adc r25, r25 6532 23fe: 5a 01 movw r10, r20
6064 223e: 1a 94 dec r1 6533 2400: fc 01 movw r30, r24
6065 2240: 69 f7 brne .-38 ; 0x221c <__udivmodsi4_loop> 6534 2402: 17 82 std Z+7, r1 ; 0x07
6066 2242: 60 95 com r22 6535 2404: 16 82 std Z+6, r1 ; 0x06
6067 2244: 70 95 com r23 6536 2406: 83 81 ldd r24, Z+3 ; 0x03
6068 2246: 80 95 com r24 6537 2408: 81 fd sbrc r24, 1
6069 2248: 90 95 com r25 6538 240a: 03 c0 rjmp .+6 ; 0x2412 <vfprintf+0x24>
6070 224a: 9b 01 movw r18, r22 6539 240c: 6f ef ldi r22, 0xFF ; 255
6071 224c: ac 01 movw r20, r24 6540 240e: 7f ef ldi r23, 0xFF ; 255
6072 224e: bd 01 movw r22, r26 6541 2410: c8 c1 rjmp .+912 ; 0x27a2 <vfprintf+0x3b4>
6073 2250: cf 01 movw r24, r30 6542 2412: 9a e0 ldi r25, 0x0A ; 10
6074 2252: 08 95 ret 6543 2414: 89 2e mov r8, r25
6075   6544 2416: 1e 01 movw r2, r28
6076 00002254 <__prologue_saves__>: 6545 2418: 08 94 sec
6077 2254: 2f 92 push r2 6546 241a: 21 1c adc r2, r1
6078 2256: 3f 92 push r3 6547 241c: 31 1c adc r3, r1
6079 2258: 4f 92 push r4 6548 241e: f3 01 movw r30, r6
6080 225a: 5f 92 push r5 6549 2420: 23 81 ldd r18, Z+3 ; 0x03
6081 225c: 6f 92 push r6 6550 2422: f2 01 movw r30, r4
6082 225e: 7f 92 push r7 6551 2424: 23 fd sbrc r18, 3
6083 2260: 8f 92 push r8 6552 2426: 85 91 lpm r24, Z+
6084 2262: 9f 92 push r9 6553 2428: 23 ff sbrs r18, 3
6085 2264: af 92 push r10 6554 242a: 81 91 ld r24, Z+
6086 2266: bf 92 push r11 6555 242c: 2f 01 movw r4, r30
6087 2268: cf 92 push r12 6556 242e: 88 23 and r24, r24
6088 226a: df 92 push r13 6557 2430: 09 f4 brne .+2 ; 0x2434 <vfprintf+0x46>
6089 226c: ef 92 push r14 6558 2432: b4 c1 rjmp .+872 ; 0x279c <vfprintf+0x3ae>
6090 226e: ff 92 push r15 6559 2434: 85 32 cpi r24, 0x25 ; 37
6091 2270: 0f 93 push r16 6560 2436: 39 f4 brne .+14 ; 0x2446 <vfprintf+0x58>
6092 2272: 1f 93 push r17 6561 2438: 23 fd sbrc r18, 3
6093 2274: cf 93 push r28 6562 243a: 85 91 lpm r24, Z+
6094 2276: df 93 push r29 6563 243c: 23 ff sbrs r18, 3
6095 2278: cd b7 in r28, 0x3d ; 61 6564 243e: 81 91 ld r24, Z+
6096 227a: de b7 in r29, 0x3e ; 62 6565 2440: 2f 01 movw r4, r30
6097 227c: ca 1b sub r28, r26 6566 2442: 85 32 cpi r24, 0x25 ; 37
6098 227e: db 0b sbc r29, r27 6567 2444: 29 f4 brne .+10 ; 0x2450 <vfprintf+0x62>
6099 2280: 0f b6 in r0, 0x3f ; 63 6568 2446: b3 01 movw r22, r6
6100 2282: f8 94 cli 6569 2448: 90 e0 ldi r25, 0x00 ; 0
6101 2284: de bf out 0x3e, r29 ; 62 6570 244a: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
6102 2286: 0f be out 0x3f, r0 ; 63 6571 244e: e7 cf rjmp .-50 ; 0x241e <vfprintf+0x30>
6103 2288: cd bf out 0x3d, r28 ; 61 6572 2450: 98 2f mov r25, r24
6104 228a: 09 94 ijmp 6573 2452: dd 24 eor r13, r13
6105   6574 2454: cc 24 eor r12, r12
6106 0000228c <__epilogue_restores__>: 6575 2456: 99 24 eor r9, r9
6107 228c: 2a 88 ldd r2, Y+18 ; 0x12 6576 2458: ff e1 ldi r31, 0x1F ; 31
6108 228e: 39 88 ldd r3, Y+17 ; 0x11 6577 245a: fd 15 cp r31, r13
6109 2290: 48 88 ldd r4, Y+16 ; 0x10 6578 245c: d0 f0 brcs .+52 ; 0x2492 <vfprintf+0xa4>
6110 2292: 5f 84 ldd r5, Y+15 ; 0x0f 6579 245e: 9b 32 cpi r25, 0x2B ; 43
6111 2294: 6e 84 ldd r6, Y+14 ; 0x0e 6580 2460: 69 f0 breq .+26 ; 0x247c <vfprintf+0x8e>
6112 2296: 7d 84 ldd r7, Y+13 ; 0x0d 6581 2462: 9c 32 cpi r25, 0x2C ; 44
6113 2298: 8c 84 ldd r8, Y+12 ; 0x0c 6582 2464: 28 f4 brcc .+10 ; 0x2470 <vfprintf+0x82>
6114 229a: 9b 84 ldd r9, Y+11 ; 0x0b 6583 2466: 90 32 cpi r25, 0x20 ; 32
6115 229c: aa 84 ldd r10, Y+10 ; 0x0a 6584 2468: 59 f0 breq .+22 ; 0x2480 <vfprintf+0x92>
6116 229e: b9 84 ldd r11, Y+9 ; 0x09 6585 246a: 93 32 cpi r25, 0x23 ; 35
6117 22a0: c8 84 ldd r12, Y+8 ; 0x08 6586 246c: 91 f4 brne .+36 ; 0x2492 <vfprintf+0xa4>
6118 22a2: df 80 ldd r13, Y+7 ; 0x07 6587 246e: 0e c0 rjmp .+28 ; 0x248c <vfprintf+0x9e>
6119 22a4: ee 80 ldd r14, Y+6 ; 0x06 6588 2470: 9d 32 cpi r25, 0x2D ; 45
6120 22a6: fd 80 ldd r15, Y+5 ; 0x05 6589 2472: 49 f0 breq .+18 ; 0x2486 <vfprintf+0x98>
6121 22a8: 0c 81 ldd r16, Y+4 ; 0x04 6590 2474: 90 33 cpi r25, 0x30 ; 48
6122 22aa: 1b 81 ldd r17, Y+3 ; 0x03 6591 2476: 69 f4 brne .+26 ; 0x2492 <vfprintf+0xa4>
6123 22ac: aa 81 ldd r26, Y+2 ; 0x02 6592 2478: 41 e0 ldi r20, 0x01 ; 1
6124 22ae: b9 81 ldd r27, Y+1 ; 0x01 6593 247a: 24 c0 rjmp .+72 ; 0x24c4 <vfprintf+0xd6>
6125 22b0: ce 0f add r28, r30 6594 247c: 52 e0 ldi r21, 0x02 ; 2
6126 22b2: d1 1d adc r29, r1 6595 247e: d5 2a or r13, r21
6127 22b4: 0f b6 in r0, 0x3f ; 63 6596 2480: 84 e0 ldi r24, 0x04 ; 4
6128 22b6: f8 94 cli 6597 2482: d8 2a or r13, r24
6129 22b8: de bf out 0x3e, r29 ; 62 6598 2484: 28 c0 rjmp .+80 ; 0x24d6 <vfprintf+0xe8>
6130 22ba: 0f be out 0x3f, r0 ; 63 6599 2486: 98 e0 ldi r25, 0x08 ; 8
6131 22bc: cd bf out 0x3d, r28 ; 61 6600 2488: d9 2a or r13, r25
6132 22be: ed 01 movw r28, r26 6601 248a: 25 c0 rjmp .+74 ; 0x24d6 <vfprintf+0xe8>
6133 22c0: 08 95 ret 6602 248c: e0 e1 ldi r30, 0x10 ; 16
6134   6603 248e: de 2a or r13, r30
6135 000022c2 <__udivmodhi4>: 6604 2490: 22 c0 rjmp .+68 ; 0x24d6 <vfprintf+0xe8>
6136 22c2: aa 1b sub r26, r26 6605 2492: d7 fc sbrc r13, 7
6137 22c4: bb 1b sub r27, r27 6606 2494: 29 c0 rjmp .+82 ; 0x24e8 <vfprintf+0xfa>
6138 22c6: 51 e1 ldi r21, 0x11 ; 17 6607 2496: 89 2f mov r24, r25
6139 22c8: 07 c0 rjmp .+14 ; 0x22d8 <__udivmodhi4_ep> 6608 2498: 80 53 subi r24, 0x30 ; 48
6140   6609 249a: 8a 30 cpi r24, 0x0A ; 10
6141 000022ca <__udivmodhi4_loop>: 6610 249c: 70 f4 brcc .+28 ; 0x24ba <vfprintf+0xcc>
6142 22ca: aa 1f adc r26, r26 6611 249e: d6 fe sbrs r13, 6
6143 22cc: bb 1f adc r27, r27 6612 24a0: 05 c0 rjmp .+10 ; 0x24ac <vfprintf+0xbe>
6144 22ce: a6 17 cp r26, r22 6613 24a2: 98 9c mul r9, r8
6145 22d0: b7 07 cpc r27, r23 6614 24a4: 90 2c mov r9, r0
6146 22d2: 10 f0 brcs .+4 ; 0x22d8 <__udivmodhi4_ep> 6615 24a6: 11 24 eor r1, r1
6147 22d4: a6 1b sub r26, r22 6616 24a8: 98 0e add r9, r24
6148 22d6: b7 0b sbc r27, r23 6617 24aa: 15 c0 rjmp .+42 ; 0x24d6 <vfprintf+0xe8>
6149   6618 24ac: c8 9c mul r12, r8
6150 000022d8 <__udivmodhi4_ep>: 6619 24ae: c0 2c mov r12, r0
6151 22d8: 88 1f adc r24, r24 6620 24b0: 11 24 eor r1, r1
6152 22da: 99 1f adc r25, r25 6621 24b2: c8 0e add r12, r24
6153 22dc: 5a 95 dec r21 6622 24b4: f0 e2 ldi r31, 0x20 ; 32
6154 22de: a9 f7 brne .-22 ; 0x22ca <__udivmodhi4_loop> 6623 24b6: df 2a or r13, r31
6155 22e0: 80 95 com r24 6624 24b8: 0e c0 rjmp .+28 ; 0x24d6 <vfprintf+0xe8>
6156 22e2: 90 95 com r25 6625 24ba: 9e 32 cpi r25, 0x2E ; 46
6157 22e4: bc 01 movw r22, r24 6626 24bc: 29 f4 brne .+10 ; 0x24c8 <vfprintf+0xda>
6158 22e6: cd 01 movw r24, r26 6627 24be: d6 fc sbrc r13, 6
6159 22e8: 08 95 ret 6628 24c0: 6d c1 rjmp .+730 ; 0x279c <vfprintf+0x3ae>
-   6629 24c2: 40 e4 ldi r20, 0x40 ; 64
-   6630 24c4: d4 2a or r13, r20
-   6631 24c6: 07 c0 rjmp .+14 ; 0x24d6 <vfprintf+0xe8>
-   6632 24c8: 9c 36 cpi r25, 0x6C ; 108
-   6633 24ca: 19 f4 brne .+6 ; 0x24d2 <vfprintf+0xe4>
-   6634 24cc: 50 e8 ldi r21, 0x80 ; 128
-   6635 24ce: d5 2a or r13, r21
-   6636 24d0: 02 c0 rjmp .+4 ; 0x24d6 <vfprintf+0xe8>
-   6637 24d2: 98 36 cpi r25, 0x68 ; 104
-   6638 24d4: 49 f4 brne .+18 ; 0x24e8 <vfprintf+0xfa>
-   6639 24d6: f2 01 movw r30, r4
-   6640 24d8: 23 fd sbrc r18, 3
-   6641 24da: 95 91 lpm r25, Z+
-   6642 24dc: 23 ff sbrs r18, 3
-   6643 24de: 91 91 ld r25, Z+
-   6644 24e0: 2f 01 movw r4, r30
-   6645 24e2: 99 23 and r25, r25
-   6646 24e4: 09 f0 breq .+2 ; 0x24e8 <vfprintf+0xfa>
-   6647 24e6: b8 cf rjmp .-144 ; 0x2458 <vfprintf+0x6a>
-   6648 24e8: 89 2f mov r24, r25
-   6649 24ea: 85 54 subi r24, 0x45 ; 69
-   6650 24ec: 83 30 cpi r24, 0x03 ; 3
-   6651 24ee: 18 f0 brcs .+6 ; 0x24f6 <vfprintf+0x108>
-   6652 24f0: 80 52 subi r24, 0x20 ; 32
-   6653 24f2: 83 30 cpi r24, 0x03 ; 3
-   6654 24f4: 38 f4 brcc .+14 ; 0x2504 <vfprintf+0x116>
-   6655 24f6: 44 e0 ldi r20, 0x04 ; 4
-   6656 24f8: 50 e0 ldi r21, 0x00 ; 0
-   6657 24fa: a4 0e add r10, r20
-   6658 24fc: b5 1e adc r11, r21
-   6659 24fe: 5f e3 ldi r21, 0x3F ; 63
-   6660 2500: 59 83 std Y+1, r21 ; 0x01
-   6661 2502: 0f c0 rjmp .+30 ; 0x2522 <vfprintf+0x134>
-   6662 2504: 93 36 cpi r25, 0x63 ; 99
-   6663 2506: 31 f0 breq .+12 ; 0x2514 <vfprintf+0x126>
-   6664 2508: 93 37 cpi r25, 0x73 ; 115
-   6665 250a: 79 f0 breq .+30 ; 0x252a <vfprintf+0x13c>
-   6666 250c: 93 35 cpi r25, 0x53 ; 83
-   6667 250e: 09 f0 breq .+2 ; 0x2512 <vfprintf+0x124>
-   6668 2510: 56 c0 rjmp .+172 ; 0x25be <vfprintf+0x1d0>
-   6669 2512: 20 c0 rjmp .+64 ; 0x2554 <vfprintf+0x166>
-   6670 2514: f5 01 movw r30, r10
-   6671 2516: 80 81 ld r24, Z
-   6672 2518: 89 83 std Y+1, r24 ; 0x01
-   6673 251a: 42 e0 ldi r20, 0x02 ; 2
-   6674 251c: 50 e0 ldi r21, 0x00 ; 0
-   6675 251e: a4 0e add r10, r20
-   6676 2520: b5 1e adc r11, r21
-   6677 2522: 71 01 movw r14, r2
-   6678 2524: 01 e0 ldi r16, 0x01 ; 1
-   6679 2526: 10 e0 ldi r17, 0x00 ; 0
-   6680 2528: 12 c0 rjmp .+36 ; 0x254e <vfprintf+0x160>
-   6681 252a: f5 01 movw r30, r10
-   6682 252c: e0 80 ld r14, Z
-   6683 252e: f1 80 ldd r15, Z+1 ; 0x01
-   6684 2530: d6 fc sbrc r13, 6
-   6685 2532: 03 c0 rjmp .+6 ; 0x253a <vfprintf+0x14c>
-   6686 2534: 6f ef ldi r22, 0xFF ; 255
-   6687 2536: 7f ef ldi r23, 0xFF ; 255
-   6688 2538: 02 c0 rjmp .+4 ; 0x253e <vfprintf+0x150>
-   6689 253a: 69 2d mov r22, r9
-   6690 253c: 70 e0 ldi r23, 0x00 ; 0
-   6691 253e: 42 e0 ldi r20, 0x02 ; 2
-   6692 2540: 50 e0 ldi r21, 0x00 ; 0
-   6693 2542: a4 0e add r10, r20
-   6694 2544: b5 1e adc r11, r21
-   6695 2546: c7 01 movw r24, r14
-   6696 2548: 0e 94 e1 13 call 0x27c2 ; 0x27c2 <strnlen>
-   6697 254c: 8c 01 movw r16, r24
-   6698 254e: 5f e7 ldi r21, 0x7F ; 127
-   6699 2550: d5 22 and r13, r21
-   6700 2552: 14 c0 rjmp .+40 ; 0x257c <vfprintf+0x18e>
-   6701 2554: f5 01 movw r30, r10
-   6702 2556: e0 80 ld r14, Z
-   6703 2558: f1 80 ldd r15, Z+1 ; 0x01
-   6704 255a: d6 fc sbrc r13, 6
-   6705 255c: 03 c0 rjmp .+6 ; 0x2564 <vfprintf+0x176>
-   6706 255e: 6f ef ldi r22, 0xFF ; 255
-   6707 2560: 7f ef ldi r23, 0xFF ; 255
-   6708 2562: 02 c0 rjmp .+4 ; 0x2568 <vfprintf+0x17a>
-   6709 2564: 69 2d mov r22, r9
-   6710 2566: 70 e0 ldi r23, 0x00 ; 0
-   6711 2568: 42 e0 ldi r20, 0x02 ; 2
-   6712 256a: 50 e0 ldi r21, 0x00 ; 0
-   6713 256c: a4 0e add r10, r20
-   6714 256e: b5 1e adc r11, r21
-   6715 2570: c7 01 movw r24, r14
-   6716 2572: 0e 94 d6 13 call 0x27ac ; 0x27ac <strnlen_P>
-   6717 2576: 8c 01 movw r16, r24
-   6718 2578: 50 e8 ldi r21, 0x80 ; 128
-   6719 257a: d5 2a or r13, r21
-   6720 257c: d3 fe sbrs r13, 3
-   6721 257e: 07 c0 rjmp .+14 ; 0x258e <vfprintf+0x1a0>
-   6722 2580: 1a c0 rjmp .+52 ; 0x25b6 <vfprintf+0x1c8>
-   6723 2582: b3 01 movw r22, r6
-   6724 2584: 80 e2 ldi r24, 0x20 ; 32
-   6725 2586: 90 e0 ldi r25, 0x00 ; 0
-   6726 2588: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6727 258c: ca 94 dec r12
-   6728 258e: 8c 2d mov r24, r12
-   6729 2590: 90 e0 ldi r25, 0x00 ; 0
-   6730 2592: 08 17 cp r16, r24
-   6731 2594: 19 07 cpc r17, r25
-   6732 2596: a8 f3 brcs .-22 ; 0x2582 <vfprintf+0x194>
-   6733 2598: 0e c0 rjmp .+28 ; 0x25b6 <vfprintf+0x1c8>
-   6734 259a: f7 01 movw r30, r14
-   6735 259c: d7 fc sbrc r13, 7
-   6736 259e: 85 91 lpm r24, Z+
-   6737 25a0: d7 fe sbrs r13, 7
-   6738 25a2: 81 91 ld r24, Z+
-   6739 25a4: 7f 01 movw r14, r30
-   6740 25a6: b3 01 movw r22, r6
-   6741 25a8: 90 e0 ldi r25, 0x00 ; 0
-   6742 25aa: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6743 25ae: c1 10 cpse r12, r1
-   6744 25b0: ca 94 dec r12
-   6745 25b2: 01 50 subi r16, 0x01 ; 1
-   6746 25b4: 10 40 sbci r17, 0x00 ; 0
-   6747 25b6: 01 15 cp r16, r1
-   6748 25b8: 11 05 cpc r17, r1
-   6749 25ba: 79 f7 brne .-34 ; 0x259a <vfprintf+0x1ac>
-   6750 25bc: ec c0 rjmp .+472 ; 0x2796 <vfprintf+0x3a8>
-   6751 25be: 94 36 cpi r25, 0x64 ; 100
-   6752 25c0: 11 f0 breq .+4 ; 0x25c6 <vfprintf+0x1d8>
-   6753 25c2: 99 36 cpi r25, 0x69 ; 105
-   6754 25c4: 71 f5 brne .+92 ; 0x2622 <vfprintf+0x234>
-   6755 25c6: d7 fe sbrs r13, 7
-   6756 25c8: 08 c0 rjmp .+16 ; 0x25da <vfprintf+0x1ec>
-   6757 25ca: f5 01 movw r30, r10
-   6758 25cc: e0 80 ld r14, Z
-   6759 25ce: f1 80 ldd r15, Z+1 ; 0x01
-   6760 25d0: 02 81 ldd r16, Z+2 ; 0x02
-   6761 25d2: 13 81 ldd r17, Z+3 ; 0x03
-   6762 25d4: 44 e0 ldi r20, 0x04 ; 4
-   6763 25d6: 50 e0 ldi r21, 0x00 ; 0
-   6764 25d8: 0a c0 rjmp .+20 ; 0x25ee <vfprintf+0x200>
-   6765 25da: f5 01 movw r30, r10
-   6766 25dc: 80 81 ld r24, Z
-   6767 25de: 91 81 ldd r25, Z+1 ; 0x01
-   6768 25e0: 7c 01 movw r14, r24
-   6769 25e2: 00 27 eor r16, r16
-   6770 25e4: f7 fc sbrc r15, 7
-   6771 25e6: 00 95 com r16
-   6772 25e8: 10 2f mov r17, r16
-   6773 25ea: 42 e0 ldi r20, 0x02 ; 2
-   6774 25ec: 50 e0 ldi r21, 0x00 ; 0
-   6775 25ee: a4 0e add r10, r20
-   6776 25f0: b5 1e adc r11, r21
-   6777 25f2: 5f e6 ldi r21, 0x6F ; 111
-   6778 25f4: d5 22 and r13, r21
-   6779 25f6: 17 ff sbrs r17, 7
-   6780 25f8: 0a c0 rjmp .+20 ; 0x260e <vfprintf+0x220>
-   6781 25fa: 10 95 com r17
-   6782 25fc: 00 95 com r16
-   6783 25fe: f0 94 com r15
-   6784 2600: e0 94 com r14
-   6785 2602: e1 1c adc r14, r1
-   6786 2604: f1 1c adc r15, r1
-   6787 2606: 01 1d adc r16, r1
-   6788 2608: 11 1d adc r17, r1
-   6789 260a: 80 e8 ldi r24, 0x80 ; 128
-   6790 260c: d8 2a or r13, r24
-   6791 260e: 2a e0 ldi r18, 0x0A ; 10
-   6792 2610: 30 e0 ldi r19, 0x00 ; 0
-   6793 2612: a1 01 movw r20, r2
-   6794 2614: c8 01 movw r24, r16
-   6795 2616: b7 01 movw r22, r14
-   6796 2618: 0e 94 28 14 call 0x2850 ; 0x2850 <__ultoa_invert>
-   6797 261c: f8 2e mov r15, r24
-   6798 261e: f2 18 sub r15, r2
-   6799 2620: 40 c0 rjmp .+128 ; 0x26a2 <vfprintf+0x2b4>
-   6800 2622: 95 37 cpi r25, 0x75 ; 117
-   6801 2624: 29 f4 brne .+10 ; 0x2630 <vfprintf+0x242>
-   6802 2626: 1d 2d mov r17, r13
-   6803 2628: 1f 7e andi r17, 0xEF ; 239
-   6804 262a: 2a e0 ldi r18, 0x0A ; 10
-   6805 262c: 30 e0 ldi r19, 0x00 ; 0
-   6806 262e: 1d c0 rjmp .+58 ; 0x266a <vfprintf+0x27c>
-   6807 2630: 1d 2d mov r17, r13
-   6808 2632: 19 7f andi r17, 0xF9 ; 249
-   6809 2634: 9f 36 cpi r25, 0x6F ; 111
-   6810 2636: 61 f0 breq .+24 ; 0x2650 <vfprintf+0x262>
-   6811 2638: 90 37 cpi r25, 0x70 ; 112
-   6812 263a: 20 f4 brcc .+8 ; 0x2644 <vfprintf+0x256>
-   6813 263c: 98 35 cpi r25, 0x58 ; 88
-   6814 263e: 09 f0 breq .+2 ; 0x2642 <vfprintf+0x254>
-   6815 2640: ad c0 rjmp .+346 ; 0x279c <vfprintf+0x3ae>
-   6816 2642: 0f c0 rjmp .+30 ; 0x2662 <vfprintf+0x274>
-   6817 2644: 90 37 cpi r25, 0x70 ; 112
-   6818 2646: 39 f0 breq .+14 ; 0x2656 <vfprintf+0x268>
-   6819 2648: 98 37 cpi r25, 0x78 ; 120
-   6820 264a: 09 f0 breq .+2 ; 0x264e <vfprintf+0x260>
-   6821 264c: a7 c0 rjmp .+334 ; 0x279c <vfprintf+0x3ae>
-   6822 264e: 04 c0 rjmp .+8 ; 0x2658 <vfprintf+0x26a>
-   6823 2650: 28 e0 ldi r18, 0x08 ; 8
-   6824 2652: 30 e0 ldi r19, 0x00 ; 0
-   6825 2654: 0a c0 rjmp .+20 ; 0x266a <vfprintf+0x27c>
-   6826 2656: 10 61 ori r17, 0x10 ; 16
-   6827 2658: 14 fd sbrc r17, 4
-   6828 265a: 14 60 ori r17, 0x04 ; 4
-   6829 265c: 20 e1 ldi r18, 0x10 ; 16
-   6830 265e: 30 e0 ldi r19, 0x00 ; 0
-   6831 2660: 04 c0 rjmp .+8 ; 0x266a <vfprintf+0x27c>
-   6832 2662: 14 fd sbrc r17, 4
-   6833 2664: 16 60 ori r17, 0x06 ; 6
-   6834 2666: 20 e1 ldi r18, 0x10 ; 16
-   6835 2668: 32 e0 ldi r19, 0x02 ; 2
-   6836 266a: 17 ff sbrs r17, 7
-   6837 266c: 08 c0 rjmp .+16 ; 0x267e <vfprintf+0x290>
-   6838 266e: f5 01 movw r30, r10
-   6839 2670: 60 81 ld r22, Z
-   6840 2672: 71 81 ldd r23, Z+1 ; 0x01
-   6841 2674: 82 81 ldd r24, Z+2 ; 0x02
-   6842 2676: 93 81 ldd r25, Z+3 ; 0x03
-   6843 2678: 44 e0 ldi r20, 0x04 ; 4
-   6844 267a: 50 e0 ldi r21, 0x00 ; 0
-   6845 267c: 08 c0 rjmp .+16 ; 0x268e <vfprintf+0x2a0>
-   6846 267e: f5 01 movw r30, r10
-   6847 2680: 80 81 ld r24, Z
-   6848 2682: 91 81 ldd r25, Z+1 ; 0x01
-   6849 2684: bc 01 movw r22, r24
-   6850 2686: 80 e0 ldi r24, 0x00 ; 0
-   6851 2688: 90 e0 ldi r25, 0x00 ; 0
-   6852 268a: 42 e0 ldi r20, 0x02 ; 2
-   6853 268c: 50 e0 ldi r21, 0x00 ; 0
-   6854 268e: a4 0e add r10, r20
-   6855 2690: b5 1e adc r11, r21
-   6856 2692: a1 01 movw r20, r2
-   6857 2694: 0e 94 28 14 call 0x2850 ; 0x2850 <__ultoa_invert>
-   6858 2698: f8 2e mov r15, r24
-   6859 269a: f2 18 sub r15, r2
-   6860 269c: 8f e7 ldi r24, 0x7F ; 127
-   6861 269e: d8 2e mov r13, r24
-   6862 26a0: d1 22 and r13, r17
-   6863 26a2: d6 fe sbrs r13, 6
-   6864 26a4: 0b c0 rjmp .+22 ; 0x26bc <vfprintf+0x2ce>
-   6865 26a6: 5e ef ldi r21, 0xFE ; 254
-   6866 26a8: d5 22 and r13, r21
-   6867 26aa: f9 14 cp r15, r9
-   6868 26ac: 38 f4 brcc .+14 ; 0x26bc <vfprintf+0x2ce>
-   6869 26ae: d4 fe sbrs r13, 4
-   6870 26b0: 07 c0 rjmp .+14 ; 0x26c0 <vfprintf+0x2d2>
-   6871 26b2: d2 fc sbrc r13, 2
-   6872 26b4: 05 c0 rjmp .+10 ; 0x26c0 <vfprintf+0x2d2>
-   6873 26b6: 8f ee ldi r24, 0xEF ; 239
-   6874 26b8: d8 22 and r13, r24
-   6875 26ba: 02 c0 rjmp .+4 ; 0x26c0 <vfprintf+0x2d2>
-   6876 26bc: 1f 2d mov r17, r15
-   6877 26be: 01 c0 rjmp .+2 ; 0x26c2 <vfprintf+0x2d4>
-   6878 26c0: 19 2d mov r17, r9
-   6879 26c2: d4 fe sbrs r13, 4
-   6880 26c4: 0d c0 rjmp .+26 ; 0x26e0 <vfprintf+0x2f2>
-   6881 26c6: fe 01 movw r30, r28
-   6882 26c8: ef 0d add r30, r15
-   6883 26ca: f1 1d adc r31, r1
-   6884 26cc: 80 81 ld r24, Z
-   6885 26ce: 80 33 cpi r24, 0x30 ; 48
-   6886 26d0: 19 f4 brne .+6 ; 0x26d8 <vfprintf+0x2ea>
-   6887 26d2: 99 ee ldi r25, 0xE9 ; 233
-   6888 26d4: d9 22 and r13, r25
-   6889 26d6: 08 c0 rjmp .+16 ; 0x26e8 <vfprintf+0x2fa>
-   6890 26d8: 1f 5f subi r17, 0xFF ; 255
-   6891 26da: d2 fe sbrs r13, 2
-   6892 26dc: 05 c0 rjmp .+10 ; 0x26e8 <vfprintf+0x2fa>
-   6893 26de: 03 c0 rjmp .+6 ; 0x26e6 <vfprintf+0x2f8>
-   6894 26e0: 8d 2d mov r24, r13
-   6895 26e2: 86 78 andi r24, 0x86 ; 134
-   6896 26e4: 09 f0 breq .+2 ; 0x26e8 <vfprintf+0x2fa>
-   6897 26e6: 1f 5f subi r17, 0xFF ; 255
-   6898 26e8: 0d 2d mov r16, r13
-   6899 26ea: d3 fc sbrc r13, 3
-   6900 26ec: 14 c0 rjmp .+40 ; 0x2716 <vfprintf+0x328>
-   6901 26ee: d0 fe sbrs r13, 0
-   6902 26f0: 0f c0 rjmp .+30 ; 0x2710 <vfprintf+0x322>
-   6903 26f2: 1c 15 cp r17, r12
-   6904 26f4: 10 f0 brcs .+4 ; 0x26fa <vfprintf+0x30c>
-   6905 26f6: 9f 2c mov r9, r15
-   6906 26f8: 0b c0 rjmp .+22 ; 0x2710 <vfprintf+0x322>
-   6907 26fa: 9f 2c mov r9, r15
-   6908 26fc: 9c 0c add r9, r12
-   6909 26fe: 91 1a sub r9, r17
-   6910 2700: 1c 2d mov r17, r12
-   6911 2702: 06 c0 rjmp .+12 ; 0x2710 <vfprintf+0x322>
-   6912 2704: b3 01 movw r22, r6
-   6913 2706: 80 e2 ldi r24, 0x20 ; 32
-   6914 2708: 90 e0 ldi r25, 0x00 ; 0
-   6915 270a: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6916 270e: 1f 5f subi r17, 0xFF ; 255
-   6917 2710: 1c 15 cp r17, r12
-   6918 2712: c0 f3 brcs .-16 ; 0x2704 <vfprintf+0x316>
-   6919 2714: 04 c0 rjmp .+8 ; 0x271e <vfprintf+0x330>
-   6920 2716: 1c 15 cp r17, r12
-   6921 2718: 10 f4 brcc .+4 ; 0x271e <vfprintf+0x330>
-   6922 271a: c1 1a sub r12, r17
-   6923 271c: 01 c0 rjmp .+2 ; 0x2720 <vfprintf+0x332>
-   6924 271e: cc 24 eor r12, r12
-   6925 2720: 04 ff sbrs r16, 4
-   6926 2722: 10 c0 rjmp .+32 ; 0x2744 <vfprintf+0x356>
-   6927 2724: b3 01 movw r22, r6
-   6928 2726: 80 e3 ldi r24, 0x30 ; 48
-   6929 2728: 90 e0 ldi r25, 0x00 ; 0
-   6930 272a: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6931 272e: 02 ff sbrs r16, 2
-   6932 2730: 1e c0 rjmp .+60 ; 0x276e <vfprintf+0x380>
-   6933 2732: 01 fd sbrc r16, 1
-   6934 2734: 03 c0 rjmp .+6 ; 0x273c <vfprintf+0x34e>
-   6935 2736: 88 e7 ldi r24, 0x78 ; 120
-   6936 2738: 90 e0 ldi r25, 0x00 ; 0
-   6937 273a: 02 c0 rjmp .+4 ; 0x2740 <vfprintf+0x352>
-   6938 273c: 88 e5 ldi r24, 0x58 ; 88
-   6939 273e: 90 e0 ldi r25, 0x00 ; 0
-   6940 2740: b3 01 movw r22, r6
-   6941 2742: 0c c0 rjmp .+24 ; 0x275c <vfprintf+0x36e>
-   6942 2744: 80 2f mov r24, r16
-   6943 2746: 86 78 andi r24, 0x86 ; 134
-   6944 2748: 91 f0 breq .+36 ; 0x276e <vfprintf+0x380>
-   6945 274a: 01 ff sbrs r16, 1
-   6946 274c: 02 c0 rjmp .+4 ; 0x2752 <vfprintf+0x364>
-   6947 274e: 8b e2 ldi r24, 0x2B ; 43
-   6948 2750: 01 c0 rjmp .+2 ; 0x2754 <vfprintf+0x366>
-   6949 2752: 80 e2 ldi r24, 0x20 ; 32
-   6950 2754: d7 fc sbrc r13, 7
-   6951 2756: 8d e2 ldi r24, 0x2D ; 45
-   6952 2758: b3 01 movw r22, r6
-   6953 275a: 90 e0 ldi r25, 0x00 ; 0
-   6954 275c: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6955 2760: 06 c0 rjmp .+12 ; 0x276e <vfprintf+0x380>
-   6956 2762: b3 01 movw r22, r6
-   6957 2764: 80 e3 ldi r24, 0x30 ; 48
-   6958 2766: 90 e0 ldi r25, 0x00 ; 0
-   6959 2768: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6960 276c: 9a 94 dec r9
-   6961 276e: f9 14 cp r15, r9
-   6962 2770: c0 f3 brcs .-16 ; 0x2762 <vfprintf+0x374>
-   6963 2772: fa 94 dec r15
-   6964 2774: f1 01 movw r30, r2
-   6965 2776: ef 0d add r30, r15
-   6966 2778: f1 1d adc r31, r1
-   6967 277a: b3 01 movw r22, r6
-   6968 277c: 80 81 ld r24, Z
-   6969 277e: 90 e0 ldi r25, 0x00 ; 0
-   6970 2780: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6971 2784: ff 20 and r15, r15
-   6972 2786: a9 f7 brne .-22 ; 0x2772 <vfprintf+0x384>
-   6973 2788: 06 c0 rjmp .+12 ; 0x2796 <vfprintf+0x3a8>
-   6974 278a: b3 01 movw r22, r6
-   6975 278c: 80 e2 ldi r24, 0x20 ; 32
-   6976 278e: 90 e0 ldi r25, 0x00 ; 0
-   6977 2790: 0e 94 fc 13 call 0x27f8 ; 0x27f8 <fputc>
-   6978 2794: ca 94 dec r12
-   6979 2796: cc 20 and r12, r12
-   6980 2798: c1 f7 brne .-16 ; 0x278a <vfprintf+0x39c>
-   6981 279a: 41 ce rjmp .-894 ; 0x241e <vfprintf+0x30>
-   6982 279c: f3 01 movw r30, r6
-   6983 279e: 66 81 ldd r22, Z+6 ; 0x06
-   6984 27a0: 77 81 ldd r23, Z+7 ; 0x07
-   6985 27a2: cb 01 movw r24, r22
-   6986 27a4: 2b 96 adiw r28, 0x0b ; 11
-   6987 27a6: e2 e1 ldi r30, 0x12 ; 18
-   6988 27a8: 0c 94 e3 14 jmp 0x29c6 ; 0x29c6 <__epilogue_restores__>
-   6989  
-   6990 000027ac <strnlen_P>:
-   6991 27ac: fc 01 movw r30, r24
-   6992 27ae: 05 90 lpm r0, Z+
-   6993 27b0: 61 50 subi r22, 0x01 ; 1
-   6994 27b2: 70 40 sbci r23, 0x00 ; 0
-   6995 27b4: 01 10 cpse r0, r1
-   6996 27b6: d8 f7 brcc .-10 ; 0x27ae <strnlen_P+0x2>
-   6997 27b8: 80 95 com r24
-   6998 27ba: 90 95 com r25
-   6999 27bc: 8e 0f add r24, r30
-   7000 27be: 9f 1f adc r25, r31
-   7001 27c0: 08 95 ret
-   7002  
-   7003 000027c2 <strnlen>:
-   7004 27c2: fc 01 movw r30, r24
-   7005 27c4: 61 50 subi r22, 0x01 ; 1
-   7006 27c6: 70 40 sbci r23, 0x00 ; 0
-   7007 27c8: 01 90 ld r0, Z+
-   7008 27ca: 01 10 cpse r0, r1
-   7009 27cc: d8 f7 brcc .-10 ; 0x27c4 <strnlen+0x2>
-   7010 27ce: 80 95 com r24
-   7011 27d0: 90 95 com r25
-   7012 27d2: 8e 0f add r24, r30
-   7013 27d4: 9f 1f adc r25, r31
-   7014 27d6: 08 95 ret
-   7015  
-   7016 000027d8 <strrev>:
-   7017 27d8: dc 01 movw r26, r24
-   7018 27da: fc 01 movw r30, r24
-   7019 27dc: 67 2f mov r22, r23
-   7020 27de: 71 91 ld r23, Z+
-   7021 27e0: 77 23 and r23, r23
-   7022 27e2: e1 f7 brne .-8 ; 0x27dc <strrev+0x4>
-   7023 27e4: 32 97 sbiw r30, 0x02 ; 2
-   7024 27e6: 04 c0 rjmp .+8 ; 0x27f0 <strrev+0x18>
-   7025 27e8: 7c 91 ld r23, X
-   7026 27ea: 6d 93 st X+, r22
-   7027 27ec: 70 83 st Z, r23
-   7028 27ee: 62 91 ld r22, -Z
-   7029 27f0: ae 17 cp r26, r30
-   7030 27f2: bf 07 cpc r27, r31
-   7031 27f4: c8 f3 brcs .-14 ; 0x27e8 <strrev+0x10>
-   7032 27f6: 08 95 ret
-   7033  
-   7034 000027f8 <fputc>:
-   7035 27f8: 0f 93 push r16
-   7036 27fa: 1f 93 push r17
-   7037 27fc: cf 93 push r28
-   7038 27fe: df 93 push r29
-   7039 2800: 8c 01 movw r16, r24
-   7040 2802: eb 01 movw r28, r22
-   7041 2804: 8b 81 ldd r24, Y+3 ; 0x03
-   7042 2806: 81 ff sbrs r24, 1
-   7043 2808: 1b c0 rjmp .+54 ; 0x2840 <fputc+0x48>
-   7044 280a: 82 ff sbrs r24, 2
-   7045 280c: 0d c0 rjmp .+26 ; 0x2828 <fputc+0x30>
-   7046 280e: 2e 81 ldd r18, Y+6 ; 0x06
-   7047 2810: 3f 81 ldd r19, Y+7 ; 0x07
-   7048 2812: 8c 81 ldd r24, Y+4 ; 0x04
-   7049 2814: 9d 81 ldd r25, Y+5 ; 0x05
-   7050 2816: 28 17 cp r18, r24
-   7051 2818: 39 07 cpc r19, r25
-   7052 281a: 64 f4 brge .+24 ; 0x2834 <fputc+0x3c>
-   7053 281c: e8 81 ld r30, Y
-   7054 281e: f9 81 ldd r31, Y+1 ; 0x01
-   7055 2820: 01 93 st Z+, r16
-   7056 2822: f9 83 std Y+1, r31 ; 0x01
-   7057 2824: e8 83 st Y, r30
-   7058 2826: 06 c0 rjmp .+12 ; 0x2834 <fputc+0x3c>
-   7059 2828: e8 85 ldd r30, Y+8 ; 0x08
-   7060 282a: f9 85 ldd r31, Y+9 ; 0x09
-   7061 282c: 80 2f mov r24, r16
-   7062 282e: 09 95 icall
-   7063 2830: 89 2b or r24, r25
-   7064 2832: 31 f4 brne .+12 ; 0x2840 <fputc+0x48>
-   7065 2834: 8e 81 ldd r24, Y+6 ; 0x06
-   7066 2836: 9f 81 ldd r25, Y+7 ; 0x07
-   7067 2838: 01 96 adiw r24, 0x01 ; 1
-   7068 283a: 9f 83 std Y+7, r25 ; 0x07
-   7069 283c: 8e 83 std Y+6, r24 ; 0x06
-   7070 283e: 02 c0 rjmp .+4 ; 0x2844 <fputc+0x4c>
-   7071 2840: 0f ef ldi r16, 0xFF ; 255
-   7072 2842: 1f ef ldi r17, 0xFF ; 255
-   7073 2844: c8 01 movw r24, r16
-   7074 2846: df 91 pop r29
-   7075 2848: cf 91 pop r28
-   7076 284a: 1f 91 pop r17
-   7077 284c: 0f 91 pop r16
-   7078 284e: 08 95 ret
-   7079  
-   7080 00002850 <__ultoa_invert>:
-   7081 2850: fa 01 movw r30, r20
-   7082 2852: aa 27 eor r26, r26
-   7083 2854: 28 30 cpi r18, 0x08 ; 8
-   7084 2856: 51 f1 breq .+84 ; 0x28ac <__ultoa_invert+0x5c>
-   7085 2858: 20 31 cpi r18, 0x10 ; 16
-   7086 285a: 81 f1 breq .+96 ; 0x28bc <__ultoa_invert+0x6c>
-   7087 285c: e8 94 clt
-   7088 285e: 6f 93 push r22
-   7089 2860: 6e 7f andi r22, 0xFE ; 254
-   7090 2862: 6e 5f subi r22, 0xFE ; 254
-   7091 2864: 7f 4f sbci r23, 0xFF ; 255
-   7092 2866: 8f 4f sbci r24, 0xFF ; 255
-   7093 2868: 9f 4f sbci r25, 0xFF ; 255
-   7094 286a: af 4f sbci r26, 0xFF ; 255
-   7095 286c: b1 e0 ldi r27, 0x01 ; 1
-   7096 286e: 3e d0 rcall .+124 ; 0x28ec <__ultoa_invert+0x9c>
-   7097 2870: b4 e0 ldi r27, 0x04 ; 4
-   7098 2872: 3c d0 rcall .+120 ; 0x28ec <__ultoa_invert+0x9c>
-   7099 2874: 67 0f add r22, r23
-   7100 2876: 78 1f adc r23, r24
-   7101 2878: 89 1f adc r24, r25
-   7102 287a: 9a 1f adc r25, r26
-   7103 287c: a1 1d adc r26, r1
-   7104 287e: 68 0f add r22, r24
-   7105 2880: 79 1f adc r23, r25
-   7106 2882: 8a 1f adc r24, r26
-   7107 2884: 91 1d adc r25, r1
-   7108 2886: a1 1d adc r26, r1
-   7109 2888: 6a 0f add r22, r26
-   7110 288a: 71 1d adc r23, r1
-   7111 288c: 81 1d adc r24, r1
-   7112 288e: 91 1d adc r25, r1
-   7113 2890: a1 1d adc r26, r1
-   7114 2892: 20 d0 rcall .+64 ; 0x28d4 <__ultoa_invert+0x84>
-   7115 2894: 09 f4 brne .+2 ; 0x2898 <__ultoa_invert+0x48>
-   7116 2896: 68 94 set
-   7117 2898: 3f 91 pop r19
-   7118 289a: 2a e0 ldi r18, 0x0A ; 10
-   7119 289c: 26 9f mul r18, r22
-   7120 289e: 11 24 eor r1, r1
-   7121 28a0: 30 19 sub r19, r0
-   7122 28a2: 30 5d subi r19, 0xD0 ; 208
-   7123 28a4: 31 93 st Z+, r19
-   7124 28a6: de f6 brtc .-74 ; 0x285e <__ultoa_invert+0xe>
-   7125 28a8: cf 01 movw r24, r30
-   7126 28aa: 08 95 ret
-   7127 28ac: 46 2f mov r20, r22
-   7128 28ae: 47 70 andi r20, 0x07 ; 7
-   7129 28b0: 40 5d subi r20, 0xD0 ; 208
-   7130 28b2: 41 93 st Z+, r20
-   7131 28b4: b3 e0 ldi r27, 0x03 ; 3
-   7132 28b6: 0f d0 rcall .+30 ; 0x28d6 <__ultoa_invert+0x86>
-   7133 28b8: c9 f7 brne .-14 ; 0x28ac <__ultoa_invert+0x5c>
-   7134 28ba: f6 cf rjmp .-20 ; 0x28a8 <__ultoa_invert+0x58>
-   7135 28bc: 46 2f mov r20, r22
-   7136 28be: 4f 70 andi r20, 0x0F ; 15
-   7137 28c0: 40 5d subi r20, 0xD0 ; 208
-   7138 28c2: 4a 33 cpi r20, 0x3A ; 58
-   7139 28c4: 18 f0 brcs .+6 ; 0x28cc <__ultoa_invert+0x7c>
-   7140 28c6: 49 5d subi r20, 0xD9 ; 217
-   7141 28c8: 31 fd sbrc r19, 1
-   7142 28ca: 40 52 subi r20, 0x20 ; 32
-   7143 28cc: 41 93 st Z+, r20
-   7144 28ce: 02 d0 rcall .+4 ; 0x28d4 <__ultoa_invert+0x84>
-   7145 28d0: a9 f7 brne .-22 ; 0x28bc <__ultoa_invert+0x6c>
-   7146 28d2: ea cf rjmp .-44 ; 0x28a8 <__ultoa_invert+0x58>
-   7147 28d4: b4 e0 ldi r27, 0x04 ; 4
-   7148 28d6: a6 95 lsr r26
-   7149 28d8: 97 95 ror r25
-   7150 28da: 87 95 ror r24
-   7151 28dc: 77 95 ror r23
-   7152 28de: 67 95 ror r22
-   7153 28e0: ba 95 dec r27
-   7154 28e2: c9 f7 brne .-14 ; 0x28d6 <__ultoa_invert+0x86>
-   7155 28e4: 00 97 sbiw r24, 0x00 ; 0
-   7156 28e6: 61 05 cpc r22, r1
-   7157 28e8: 71 05 cpc r23, r1
-   7158 28ea: 08 95 ret
-   7159 28ec: 9b 01 movw r18, r22
-   7160 28ee: ac 01 movw r20, r24
-   7161 28f0: 0a 2e mov r0, r26
-   7162 28f2: 06 94 lsr r0
-   7163 28f4: 57 95 ror r21
-   7164 28f6: 47 95 ror r20
-   7165 28f8: 37 95 ror r19
-   7166 28fa: 27 95 ror r18
-   7167 28fc: ba 95 dec r27
-   7168 28fe: c9 f7 brne .-14 ; 0x28f2 <__ultoa_invert+0xa2>
-   7169 2900: 62 0f add r22, r18
-   7170 2902: 73 1f adc r23, r19
-   7171 2904: 84 1f adc r24, r20
-   7172 2906: 95 1f adc r25, r21
-   7173 2908: a0 1d adc r26, r0
-   7174 290a: 08 95 ret
-   7175  
-   7176 0000290c <__mulsi3>:
-   7177 290c: 62 9f mul r22, r18
-   7178 290e: d0 01 movw r26, r0
-   7179 2910: 73 9f mul r23, r19
-   7180 2912: f0 01 movw r30, r0
-   7181 2914: 82 9f mul r24, r18
-   7182 2916: e0 0d add r30, r0
-   7183 2918: f1 1d adc r31, r1
-   7184 291a: 64 9f mul r22, r20
-   7185 291c: e0 0d add r30, r0
-   7186 291e: f1 1d adc r31, r1
-   7187 2920: 92 9f mul r25, r18
-   7188 2922: f0 0d add r31, r0
-   7189 2924: 83 9f mul r24, r19
-   7190 2926: f0 0d add r31, r0
-   7191 2928: 74 9f mul r23, r20
-   7192 292a: f0 0d add r31, r0
-   7193 292c: 65 9f mul r22, r21
-   7194 292e: f0 0d add r31, r0
-   7195 2930: 99 27 eor r25, r25
-   7196 2932: 72 9f mul r23, r18
-   7197 2934: b0 0d add r27, r0
-   7198 2936: e1 1d adc r30, r1
-   7199 2938: f9 1f adc r31, r25
-   7200 293a: 63 9f mul r22, r19
-   7201 293c: b0 0d add r27, r0
-   7202 293e: e1 1d adc r30, r1
-   7203 2940: f9 1f adc r31, r25
-   7204 2942: bd 01 movw r22, r26
-   7205 2944: cf 01 movw r24, r30
-   7206 2946: 11 24 eor r1, r1
-   7207 2948: 08 95 ret
-   7208  
-   7209 0000294a <__udivmodsi4>:
-   7210 294a: a1 e2 ldi r26, 0x21 ; 33
-   7211 294c: 1a 2e mov r1, r26
-   7212 294e: aa 1b sub r26, r26
-   7213 2950: bb 1b sub r27, r27
-   7214 2952: fd 01 movw r30, r26
-   7215 2954: 0d c0 rjmp .+26 ; 0x2970 <__udivmodsi4_ep>
-   7216  
-   7217 00002956 <__udivmodsi4_loop>:
-   7218 2956: aa 1f adc r26, r26
-   7219 2958: bb 1f adc r27, r27
-   7220 295a: ee 1f adc r30, r30
-   7221 295c: ff 1f adc r31, r31
-   7222 295e: a2 17 cp r26, r18
-   7223 2960: b3 07 cpc r27, r19
-   7224 2962: e4 07 cpc r30, r20
-   7225 2964: f5 07 cpc r31, r21
-   7226 2966: 20 f0 brcs .+8 ; 0x2970 <__udivmodsi4_ep>
-   7227 2968: a2 1b sub r26, r18
-   7228 296a: b3 0b sbc r27, r19
-   7229 296c: e4 0b sbc r30, r20
-   7230 296e: f5 0b sbc r31, r21
-   7231  
-   7232 00002970 <__udivmodsi4_ep>:
-   7233 2970: 66 1f adc r22, r22
-   7234 2972: 77 1f adc r23, r23
-   7235 2974: 88 1f adc r24, r24
-   7236 2976: 99 1f adc r25, r25
-   7237 2978: 1a 94 dec r1
-   7238 297a: 69 f7 brne .-38 ; 0x2956 <__udivmodsi4_loop>
-   7239 297c: 60 95 com r22
-   7240 297e: 70 95 com r23
-   7241 2980: 80 95 com r24
-   7242 2982: 90 95 com r25
-   7243 2984: 9b 01 movw r18, r22
-   7244 2986: ac 01 movw r20, r24
-   7245 2988: bd 01 movw r22, r26
-   7246 298a: cf 01 movw r24, r30
-   7247 298c: 08 95 ret
-   7248  
-   7249 0000298e <__prologue_saves__>:
-   7250 298e: 2f 92 push r2
-   7251 2990: 3f 92 push r3
-   7252 2992: 4f 92 push r4
-   7253 2994: 5f 92 push r5
-   7254 2996: 6f 92 push r6
-   7255 2998: 7f 92 push r7
-   7256 299a: 8f 92 push r8
-   7257 299c: 9f 92 push r9
-   7258 299e: af 92 push r10
-   7259 29a0: bf 92 push r11
-   7260 29a2: cf 92 push r12
-   7261 29a4: df 92 push r13
-   7262 29a6: ef 92 push r14
-   7263 29a8: ff 92 push r15
-   7264 29aa: 0f 93 push r16
-   7265 29ac: 1f 93 push r17
-   7266 29ae: cf 93 push r28
-   7267 29b0: df 93 push r29
-   7268 29b2: cd b7 in r28, 0x3d ; 61
-   7269 29b4: de b7 in r29, 0x3e ; 62
-   7270 29b6: ca 1b sub r28, r26
-   7271 29b8: db 0b sbc r29, r27
-   7272 29ba: 0f b6 in r0, 0x3f ; 63
-   7273 29bc: f8 94 cli
-   7274 29be: de bf out 0x3e, r29 ; 62
-   7275 29c0: 0f be out 0x3f, r0 ; 63
-   7276 29c2: cd bf out 0x3d, r28 ; 61
-   7277 29c4: 09 94 ijmp
-   7278  
-   7279 000029c6 <__epilogue_restores__>:
-   7280 29c6: 2a 88 ldd r2, Y+18 ; 0x12
-   7281 29c8: 39 88 ldd r3, Y+17 ; 0x11
-   7282 29ca: 48 88 ldd r4, Y+16 ; 0x10
-   7283 29cc: 5f 84 ldd r5, Y+15 ; 0x0f
-   7284 29ce: 6e 84 ldd r6, Y+14 ; 0x0e
-   7285 29d0: 7d 84 ldd r7, Y+13 ; 0x0d
-   7286 29d2: 8c 84 ldd r8, Y+12 ; 0x0c
-   7287 29d4: 9b 84 ldd r9, Y+11 ; 0x0b
-   7288 29d6: aa 84 ldd r10, Y+10 ; 0x0a
-   7289 29d8: b9 84 ldd r11, Y+9 ; 0x09
-   7290 29da: c8 84 ldd r12, Y+8 ; 0x08
-   7291 29dc: df 80 ldd r13, Y+7 ; 0x07
-   7292 29de: ee 80 ldd r14, Y+6 ; 0x06
-   7293 29e0: fd 80 ldd r15, Y+5 ; 0x05
-   7294 29e2: 0c 81 ldd r16, Y+4 ; 0x04
-   7295 29e4: 1b 81 ldd r17, Y+3 ; 0x03
-   7296 29e6: aa 81 ldd r26, Y+2 ; 0x02
-   7297 29e8: b9 81 ldd r27, Y+1 ; 0x01
-   7298 29ea: ce 0f add r28, r30
-   7299 29ec: d1 1d adc r29, r1
-   7300 29ee: 0f b6 in r0, 0x3f ; 63
-   7301 29f0: f8 94 cli
-   7302 29f2: de bf out 0x3e, r29 ; 62
-   7303 29f4: 0f be out 0x3f, r0 ; 63
-   7304 29f6: cd bf out 0x3d, r28 ; 61
-   7305 29f8: ed 01 movw r28, r26
-   7306 29fa: 08 95 ret
-   7307  
-   7308 000029fc <__udivmodhi4>:
-   7309 29fc: aa 1b sub r26, r26
-   7310 29fe: bb 1b sub r27, r27
-   7311 2a00: 51 e1 ldi r21, 0x11 ; 17
-   7312 2a02: 07 c0 rjmp .+14 ; 0x2a12 <__udivmodhi4_ep>
-   7313  
-   7314 00002a04 <__udivmodhi4_loop>:
-   7315 2a04: aa 1f adc r26, r26
-   7316 2a06: bb 1f adc r27, r27
-   7317 2a08: a6 17 cp r26, r22
-   7318 2a0a: b7 07 cpc r27, r23
-   7319 2a0c: 10 f0 brcs .+4 ; 0x2a12 <__udivmodhi4_ep>
-   7320 2a0e: a6 1b sub r26, r22
-   7321 2a10: b7 0b sbc r27, r23
-   7322  
-   7323 00002a12 <__udivmodhi4_ep>:
-   7324 2a12: 88 1f adc r24, r24
-   7325 2a14: 99 1f adc r25, r25
-   7326 2a16: 5a 95 dec r21
-   7327 2a18: a9 f7 brne .-22 ; 0x2a04 <__udivmodhi4_loop>
-   7328 2a1a: 80 95 com r24
-   7329 2a1c: 90 95 com r25
-   7330 2a1e: bc 01 movw r22, r24
-   7331 2a20: cd 01 movw r24, r26
-   7332 2a22: 08 95 ret
-   7333  
-   7334 00002a24 <_exit>:
-   7335 2a24: f8 94 cli
6160   7336  
6161 000022ea <_exit>: 7337 00002a26 <__stop_program>:
6162 22ea: ff cf rjmp .-2 ; 0x22ea <_exit> 7338 2a26: ff cf rjmp .-2 ; 0x2a26 <__stop_program>