Add lss file for cpp_obj program
[avr_serial_lcd.git] / gcc_cpp_obj / serial_lcd_obj.lss
1
2 serial_lcd_obj.elf:     file format elf32-avr
3
4 Sections:
5 Idx Name          Size      VMA       LMA       File off  Algn
6   0 .text         00000636  00000000  00000000  00000094  2**1
7                   CONTENTS, ALLOC, LOAD, READONLY, CODE
8   1 .data         0000000c  00800060  00000636  000006ca  2**0
9                   CONTENTS, ALLOC, LOAD, DATA
10   2 .bss          00000048  0080006c  0080006c  000006d6  2**0
11                   ALLOC
12   3 .stab         0000069c  00000000  00000000  000006d8  2**2
13                   CONTENTS, READONLY, DEBUGGING
14   4 .stabstr      00000082  00000000  00000000  00000d74  2**0
15                   CONTENTS, READONLY, DEBUGGING
16   5 .debug_aranges 00000020  00000000  00000000  00000df6  2**0
17                   CONTENTS, READONLY, DEBUGGING
18   6 .debug_pubnames 000000bb  00000000  00000000  00000e16  2**0
19                   CONTENTS, READONLY, DEBUGGING
20   7 .debug_info   00001272  00000000  00000000  00000ed1  2**0
21                   CONTENTS, READONLY, DEBUGGING
22   8 .debug_abbrev 000003db  00000000  00000000  00002143  2**0
23                   CONTENTS, READONLY, DEBUGGING
24   9 .debug_line   00000767  00000000  00000000  0000251e  2**0
25                   CONTENTS, READONLY, DEBUGGING
26  10 .debug_frame  00000080  00000000  00000000  00002c88  2**2
27                   CONTENTS, READONLY, DEBUGGING
28  11 .debug_str    00000940  00000000  00000000  00002d08  2**0
29                   CONTENTS, READONLY, DEBUGGING
30  12 .debug_loc    000001fd  00000000  00000000  00003648  2**0
31                   CONTENTS, READONLY, DEBUGGING
32  13 .debug_ranges 00000078  00000000  00000000  00003845  2**0
33                   CONTENTS, READONLY, DEBUGGING
34
35 Disassembly of section .text:
36
37 00000000 <__vectors>:
38    0:   12 c0           rjmp    .+36            ; 0x26 <__ctors_end>
39    2:   2a c0           rjmp    .+84            ; 0x58 <__bad_interrupt>
40    4:   29 c0           rjmp    .+82            ; 0x58 <__bad_interrupt>
41    6:   28 c0           rjmp    .+80            ; 0x58 <__bad_interrupt>
42    8:   27 c0           rjmp    .+78            ; 0x58 <__bad_interrupt>
43    a:   26 c0           rjmp    .+76            ; 0x58 <__bad_interrupt>
44    c:   25 c0           rjmp    .+74            ; 0x58 <__bad_interrupt>
45    e:   8b c2           rjmp    .+1302          ; 0x526 <__vector_7>
46   10:   23 c0           rjmp    .+70            ; 0x58 <__bad_interrupt>
47   12:   22 c0           rjmp    .+68            ; 0x58 <__bad_interrupt>
48   14:   21 c0           rjmp    .+66            ; 0x58 <__bad_interrupt>
49   16:   20 c0           rjmp    .+64            ; 0x58 <__bad_interrupt>
50   18:   1f c0           rjmp    .+62            ; 0x58 <__bad_interrupt>
51   1a:   a9 c2           rjmp    .+1362          ; 0x56e <__vector_13>
52   1c:   1d c0           rjmp    .+58            ; 0x58 <__bad_interrupt>
53   1e:   1c c0           rjmp    .+56            ; 0x58 <__bad_interrupt>
54   20:   1b c0           rjmp    .+54            ; 0x58 <__bad_interrupt>
55   22:   1a c0           rjmp    .+52            ; 0x58 <__bad_interrupt>
56   24:   19 c0           rjmp    .+50            ; 0x58 <__bad_interrupt>
57
58 00000026 <__ctors_end>:
59   26:   11 24           eor     r1, r1
60   28:   1f be           out     0x3f, r1        ; 63
61   2a:   cf ed           ldi     r28, 0xDF       ; 223
62   2c:   cd bf           out     0x3d, r28       ; 61
63
64 0000002e <__do_copy_data>:
65   2e:   10 e0           ldi     r17, 0x00       ; 0
66   30:   a0 e6           ldi     r26, 0x60       ; 96
67   32:   b0 e0           ldi     r27, 0x00       ; 0
68   34:   e6 e3           ldi     r30, 0x36       ; 54
69   36:   f6 e0           ldi     r31, 0x06       ; 6
70   38:   02 c0           rjmp    .+4             ; 0x3e <.do_copy_data_start>
71
72 0000003a <.do_copy_data_loop>:
73   3a:   05 90           lpm     r0, Z+
74   3c:   0d 92           st      X+, r0
75
76 0000003e <.do_copy_data_start>:
77   3e:   ac 36           cpi     r26, 0x6C       ; 108
78   40:   b1 07           cpc     r27, r17
79   42:   d9 f7           brne    .-10            ; 0x3a <.do_copy_data_loop>
80
81 00000044 <__do_clear_bss>:
82   44:   10 e0           ldi     r17, 0x00       ; 0
83   46:   ac e6           ldi     r26, 0x6C       ; 108
84   48:   b0 e0           ldi     r27, 0x00       ; 0
85   4a:   01 c0           rjmp    .+2             ; 0x4e <.do_clear_bss_start>
86
87 0000004c <.do_clear_bss_loop>:
88   4c:   1d 92           st      X+, r1
89
90 0000004e <.do_clear_bss_start>:
91   4e:   a4 3b           cpi     r26, 0xB4       ; 180
92   50:   b1 07           cpc     r27, r17
93   52:   e1 f7           brne    .-8             ; 0x4c <.do_clear_bss_loop>
94   54:   1e d1           rcall   .+572           ; 0x292 <main>
95   56:   ed c2           rjmp    .+1498          ; 0x632 <_exit>
96
97 00000058 <__bad_interrupt>:
98   58:   d3 cf           rjmp    .-90            ; 0x0 <__vectors>
99
100 0000005a <_ZN3Lcd8busyWaitEv>:
101   *m_ctrlPort |= (1<<m_ePin);
102   ENABLE_WAIT();
103   *m_ctrlPort &= ~(1<<m_ePin);
104 }
105
106 unsigned char Lcd::busyWait (void) {
107   5a:   dc 01           movw    r26, r24
108   unsigned char LCDStatus; 
109   *m_dataDir = 0x00; // Set LCD data port to inputs
110   5c:   16 96           adiw    r26, 0x06       ; 6
111   5e:   ed 91           ld      r30, X+
112   60:   fc 91           ld      r31, X
113   62:   17 97           sbiw    r26, 0x07       ; 7
114   64:   10 82           st      Z, r1
115   *m_ctrlPort |= (1<<m_rwPin);
116   66:   ed 91           ld      r30, X+
117   68:   fc 91           ld      r31, X
118   6a:   11 97           sbiw    r26, 0x01       ; 1
119   6c:   20 81           ld      r18, Z
120   6e:   81 e0           ldi     r24, 0x01       ; 1
121   70:   90 e0           ldi     r25, 0x00       ; 0
122   72:   1b 96           adiw    r26, 0x0b       ; 11
123   74:   0c 90           ld      r0, X
124   76:   1b 97           sbiw    r26, 0x0b       ; 11
125   78:   02 c0           rjmp    .+4             ; 0x7e <_ZN3Lcd8busyWaitEv+0x24>
126   7a:   88 0f           add     r24, r24
127   7c:   99 1f           adc     r25, r25
128   7e:   0a 94           dec     r0
129   80:   e2 f7           brpl    .-8             ; 0x7a <_ZN3Lcd8busyWaitEv+0x20>
130   82:   28 2b           or      r18, r24
131   84:   20 83           st      Z, r18
132   NOP();
133   86:   00 00           nop
134   do {
135     Watchdog::reset();
136     *m_ctrlPort |= (1<<m_ePin); 
137   88:   61 e0           ldi     r22, 0x01       ; 1
138   8a:   70 e0           ldi     r23, 0x00       ; 0
139     WDTCSR &= ~(1<<WDCE);
140     sei();
141   }
142   
143   INLINE_FUNC_DECLARE(static void reset(void)) { 
144     wdt_reset(); 
145   8c:   a8 95           wdr
146   *m_dataDir = 0x00; // Set LCD data port to inputs
147   *m_ctrlPort |= (1<<m_rwPin);
148   NOP();
149   do {
150     Watchdog::reset();
151     *m_ctrlPort |= (1<<m_ePin); 
152   8e:   ed 91           ld      r30, X+
153   90:   fc 91           ld      r31, X
154   92:   11 97           sbiw    r26, 0x01       ; 1
155   94:   20 81           ld      r18, Z
156   96:   41 e0           ldi     r20, 0x01       ; 1
157   98:   50 e0           ldi     r21, 0x00       ; 0
158   9a:   cb 01           movw    r24, r22
159   9c:   1c 96           adiw    r26, 0x0c       ; 12
160   9e:   0c 90           ld      r0, X
161   a0:   1c 97           sbiw    r26, 0x0c       ; 12
162   a2:   02 c0           rjmp    .+4             ; 0xa8 <_ZN3Lcd8busyWaitEv+0x4e>
163   a4:   88 0f           add     r24, r24
164   a6:   99 1f           adc     r25, r25
165   a8:   0a 94           dec     r0
166   aa:   e2 f7           brpl    .-8             ; 0xa4 <_ZN3Lcd8busyWaitEv+0x4a>
167   ac:   28 2b           or      r18, r24
168   ae:   20 83           st      Z, r18
169   #else
170     #define ENABLE_WAIT() __delay_cycles(4);
171   #endif
172 #elif defined(__GNUC__)
173   static __inline__ void _NOP1 (void) { __asm__ volatile ( "nop    " "\n\t" ); }
174   static __inline__ void _NOP2 (void) { __asm__ volatile ( "rjmp 1f" "\n\t"  "1:" "\n\t" ); }
175   b0:   00 c0           rjmp    .+0             ; 0xb2 <_ZN3Lcd8busyWaitEv+0x58>
176     ENABLE_WAIT();
177     LCDStatus = *m_dataPinReg;
178   b2:   00 c0           rjmp    .+0             ; 0xb4 <_ZN3Lcd8busyWaitEv+0x5a>
179   b4:   18 96           adiw    r26, 0x08       ; 8
180   b6:   ed 91           ld      r30, X+
181   b8:   fc 91           ld      r31, X
182   ba:   19 97           sbiw    r26, 0x09       ; 9
183   bc:   30 81           ld      r19, Z
184     *m_ctrlPort &= ~(1<<m_ePin);
185   be:   ed 91           ld      r30, X+
186   c0:   fc 91           ld      r31, X
187   c2:   11 97           sbiw    r26, 0x01       ; 1
188   c4:   20 81           ld      r18, Z
189   c6:   cb 01           movw    r24, r22
190   c8:   1c 96           adiw    r26, 0x0c       ; 12
191   ca:   0c 90           ld      r0, X
192   cc:   1c 97           sbiw    r26, 0x0c       ; 12
193   ce:   02 c0           rjmp    .+4             ; 0xd4 <_ZN3Lcd8busyWaitEv+0x7a>
194   d0:   88 0f           add     r24, r24
195   d2:   99 1f           adc     r25, r25
196   d4:   0a 94           dec     r0
197   d6:   e2 f7           brpl    .-8             ; 0xd0 <_ZN3Lcd8busyWaitEv+0x76>
198   d8:   80 95           com     r24
199   da:   82 23           and     r24, r18
200   dc:   80 83           st      Z, r24
201 unsigned char Lcd::busyWait (void) {
202   unsigned char LCDStatus; 
203   *m_dataDir = 0x00; // Set LCD data port to inputs
204   *m_ctrlPort |= (1<<m_rwPin);
205   NOP();
206   do {
207   de:   37 fd           sbrc    r19, 7
208   e0:   d5 cf           rjmp    .-86            ; 0x8c <_ZN3Lcd8busyWaitEv+0x32>
209     *m_ctrlPort |= (1<<m_ePin); 
210     ENABLE_WAIT();
211     LCDStatus = *m_dataPinReg;
212     *m_ctrlPort &= ~(1<<m_ePin);
213   } while (LCDStatus & (1<<LCD_BUSY));
214   *m_ctrlPort &= ~(1<<m_rwPin); 
215   e2:   ed 91           ld      r30, X+
216   e4:   fc 91           ld      r31, X
217   e6:   11 97           sbiw    r26, 0x01       ; 1
218   e8:   90 81           ld      r25, Z
219   ea:   1b 96           adiw    r26, 0x0b       ; 11
220   ec:   0c 90           ld      r0, X
221   ee:   1b 97           sbiw    r26, 0x0b       ; 11
222   f0:   02 c0           rjmp    .+4             ; 0xf6 <__stack+0x17>
223   f2:   44 0f           add     r20, r20
224   f4:   55 1f           adc     r21, r21
225   f6:   0a 94           dec     r0
226   f8:   e2 f7           brpl    .-8             ; 0xf2 <__stack+0x13>
227   fa:   84 2f           mov     r24, r20
228   fc:   80 95           com     r24
229   fe:   89 23           and     r24, r25
230  100:   80 83           st      Z, r24
231   *m_dataDir = 0xFF; // Set LCD data port to default output state
232  102:   16 96           adiw    r26, 0x06       ; 6
233  104:   ed 91           ld      r30, X+
234  106:   fc 91           ld      r31, X
235  108:   17 97           sbiw    r26, 0x07       ; 7
236  10a:   8f ef           ldi     r24, 0xFF       ; 255
237  10c:   80 83           st      Z, r24
238   return (LCDStatus);
239 }                
240  10e:   83 2f           mov     r24, r19
241  110:   08 95           ret
242
243 00000112 <_ZN3Lcd7putCharEh>:
244   *m_ctrlPort &= ~(1<<m_ePin);
245   NOP();
246   *m_ctrlPort |= (1<<m_rsPin);
247 }
248
249 void Lcd::putChar (unsigned char c) {
250  112:   df 92           push    r13
251  114:   ef 92           push    r14
252  116:   ff 92           push    r15
253  118:   0f 93           push    r16
254  11a:   1f 93           push    r17
255  11c:   7c 01           movw    r14, r24
256  11e:   d6 2e           mov     r13, r22
257   *m_ctrlPort &= ~(1<<m_rsPin);
258  120:   dc 01           movw    r26, r24
259  122:   ed 91           ld      r30, X+
260  124:   fc 91           ld      r31, X
261  126:   11 97           sbiw    r26, 0x01       ; 1
262  128:   20 81           ld      r18, Z
263  12a:   01 e0           ldi     r16, 0x01       ; 1
264  12c:   10 e0           ldi     r17, 0x00       ; 0
265  12e:   c8 01           movw    r24, r16
266  130:   1a 96           adiw    r26, 0x0a       ; 10
267  132:   0c 90           ld      r0, X
268  134:   02 c0           rjmp    .+4             ; 0x13a <_ZN3Lcd7putCharEh+0x28>
269  136:   88 0f           add     r24, r24
270  138:   99 1f           adc     r25, r25
271  13a:   0a 94           dec     r0
272  13c:   e2 f7           brpl    .-8             ; 0x136 <_ZN3Lcd7putCharEh+0x24>
273  13e:   80 95           com     r24
274  140:   82 23           and     r24, r18
275  142:   80 83           st      Z, r24
276   busyWait();
277  144:   c7 01           movw    r24, r14
278  146:   89 df           rcall   .-238           ; 0x5a <_ZN3Lcd8busyWaitEv>
279   *m_ctrlPort |= (1<<m_rsPin);
280  148:   d7 01           movw    r26, r14
281  14a:   ed 91           ld      r30, X+
282  14c:   fc 91           ld      r31, X
283  14e:   11 97           sbiw    r26, 0x01       ; 1
284  150:   20 81           ld      r18, Z
285  152:   c8 01           movw    r24, r16
286  154:   1a 96           adiw    r26, 0x0a       ; 10
287  156:   0c 90           ld      r0, X
288  158:   1a 97           sbiw    r26, 0x0a       ; 10
289  15a:   02 c0           rjmp    .+4             ; 0x160 <_ZN3Lcd7putCharEh+0x4e>
290  15c:   88 0f           add     r24, r24
291  15e:   99 1f           adc     r25, r25
292  160:   0a 94           dec     r0
293  162:   e2 f7           brpl    .-8             ; 0x15c <_ZN3Lcd7putCharEh+0x4a>
294  164:   28 2b           or      r18, r24
295  166:   20 83           st      Z, r18
296   *m_dataPort = c;
297  168:   14 96           adiw    r26, 0x04       ; 4
298  16a:   ed 91           ld      r30, X+
299  16c:   fc 91           ld      r31, X
300  16e:   15 97           sbiw    r26, 0x05       ; 5
301  170:   d0 82           st      Z, r13
302   NOP();
303  172:   00 00           nop
304   *m_ctrlPort |= (1<<m_ePin);
305  174:   ed 91           ld      r30, X+
306  176:   fc 91           ld      r31, X
307  178:   11 97           sbiw    r26, 0x01       ; 1
308  17a:   20 81           ld      r18, Z
309  17c:   c8 01           movw    r24, r16
310  17e:   1c 96           adiw    r26, 0x0c       ; 12
311  180:   0c 90           ld      r0, X
312  182:   1c 97           sbiw    r26, 0x0c       ; 12
313  184:   02 c0           rjmp    .+4             ; 0x18a <_ZN3Lcd7putCharEh+0x78>
314  186:   88 0f           add     r24, r24
315  188:   99 1f           adc     r25, r25
316  18a:   0a 94           dec     r0
317  18c:   e2 f7           brpl    .-8             ; 0x186 <_ZN3Lcd7putCharEh+0x74>
318  18e:   28 2b           or      r18, r24
319  190:   20 83           st      Z, r18
320  192:   00 c0           rjmp    .+0             ; 0x194 <_ZN3Lcd7putCharEh+0x82>
321   ENABLE_WAIT();
322   *m_ctrlPort &= ~(1<<m_ePin);
323  194:   00 c0           rjmp    .+0             ; 0x196 <_ZN3Lcd7putCharEh+0x84>
324  196:   ed 91           ld      r30, X+
325  198:   fc 91           ld      r31, X
326  19a:   11 97           sbiw    r26, 0x01       ; 1
327  19c:   80 81           ld      r24, Z
328  19e:   1c 96           adiw    r26, 0x0c       ; 12
329  1a0:   0c 90           ld      r0, X
330  1a2:   02 c0           rjmp    .+4             ; 0x1a8 <_ZN3Lcd7putCharEh+0x96>
331  1a4:   00 0f           add     r16, r16
332  1a6:   11 1f           adc     r17, r17
333  1a8:   0a 94           dec     r0
334  1aa:   e2 f7           brpl    .-8             ; 0x1a4 <_ZN3Lcd7putCharEh+0x92>
335  1ac:   00 95           com     r16
336  1ae:   08 23           and     r16, r24
337  1b0:   00 83           st      Z, r16
338 }
339  1b2:   1f 91           pop     r17
340  1b4:   0f 91           pop     r16
341  1b6:   ff 90           pop     r15
342  1b8:   ef 90           pop     r14
343  1ba:   df 90           pop     r13
344  1bc:   08 95           ret
345
346 000001be <_ZN3Lcd6putCmdEh>:
347   void putChar(unsigned char ch);
348   void putCmd(unsigned char ch);
349
350 };
351
352 void Lcd::putCmd (unsigned char Cmd) {
353  1be:   df 92           push    r13
354  1c0:   ef 92           push    r14
355  1c2:   ff 92           push    r15
356  1c4:   0f 93           push    r16
357  1c6:   1f 93           push    r17
358  1c8:   8c 01           movw    r16, r24
359  1ca:   d6 2e           mov     r13, r22
360   *m_ctrlPort &= ~(1<<m_rsPin);
361  1cc:   dc 01           movw    r26, r24
362  1ce:   ed 91           ld      r30, X+
363  1d0:   fc 91           ld      r31, X
364  1d2:   11 97           sbiw    r26, 0x01       ; 1
365  1d4:   20 81           ld      r18, Z
366  1d6:   81 e0           ldi     r24, 0x01       ; 1
367  1d8:   e8 2e           mov     r14, r24
368  1da:   f1 2c           mov     r15, r1
369  1dc:   c7 01           movw    r24, r14
370  1de:   1a 96           adiw    r26, 0x0a       ; 10
371  1e0:   0c 90           ld      r0, X
372  1e2:   02 c0           rjmp    .+4             ; 0x1e8 <_ZN3Lcd6putCmdEh+0x2a>
373  1e4:   88 0f           add     r24, r24
374  1e6:   99 1f           adc     r25, r25
375  1e8:   0a 94           dec     r0
376  1ea:   e2 f7           brpl    .-8             ; 0x1e4 <_ZN3Lcd6putCmdEh+0x26>
377  1ec:   80 95           com     r24
378  1ee:   82 23           and     r24, r18
379  1f0:   80 83           st      Z, r24
380   busyWait();
381  1f2:   c8 01           movw    r24, r16
382  1f4:   32 df           rcall   .-412           ; 0x5a <_ZN3Lcd8busyWaitEv>
383   *m_dataPort = Cmd;    
384  1f6:   d8 01           movw    r26, r16
385  1f8:   14 96           adiw    r26, 0x04       ; 4
386  1fa:   ed 91           ld      r30, X+
387  1fc:   fc 91           ld      r31, X
388  1fe:   15 97           sbiw    r26, 0x05       ; 5
389  200:   d0 82           st      Z, r13
390   NOP();
391  202:   00 00           nop
392   *m_ctrlPort |= (1<<m_ePin);
393  204:   ed 91           ld      r30, X+
394  206:   fc 91           ld      r31, X
395  208:   11 97           sbiw    r26, 0x01       ; 1
396  20a:   20 81           ld      r18, Z
397  20c:   c7 01           movw    r24, r14
398  20e:   1c 96           adiw    r26, 0x0c       ; 12
399  210:   0c 90           ld      r0, X
400  212:   1c 97           sbiw    r26, 0x0c       ; 12
401  214:   02 c0           rjmp    .+4             ; 0x21a <_ZN3Lcd6putCmdEh+0x5c>
402  216:   88 0f           add     r24, r24
403  218:   99 1f           adc     r25, r25
404  21a:   0a 94           dec     r0
405  21c:   e2 f7           brpl    .-8             ; 0x216 <_ZN3Lcd6putCmdEh+0x58>
406  21e:   28 2b           or      r18, r24
407  220:   20 83           st      Z, r18
408  222:   00 c0           rjmp    .+0             ; 0x224 <_ZN3Lcd6putCmdEh+0x66>
409   ENABLE_WAIT();
410   *m_ctrlPort &= ~(1<<m_ePin);
411  224:   00 c0           rjmp    .+0             ; 0x226 <_ZN3Lcd6putCmdEh+0x68>
412  226:   ed 91           ld      r30, X+
413  228:   fc 91           ld      r31, X
414  22a:   11 97           sbiw    r26, 0x01       ; 1
415  22c:   20 81           ld      r18, Z
416  22e:   c7 01           movw    r24, r14
417  230:   1c 96           adiw    r26, 0x0c       ; 12
418  232:   0c 90           ld      r0, X
419  234:   1c 97           sbiw    r26, 0x0c       ; 12
420  236:   02 c0           rjmp    .+4             ; 0x23c <_ZN3Lcd6putCmdEh+0x7e>
421  238:   88 0f           add     r24, r24
422  23a:   99 1f           adc     r25, r25
423  23c:   0a 94           dec     r0
424  23e:   e2 f7           brpl    .-8             ; 0x238 <_ZN3Lcd6putCmdEh+0x7a>
425  240:   80 95           com     r24
426  242:   82 23           and     r24, r18
427  244:   80 83           st      Z, r24
428   NOP();
429  246:   00 00           nop
430   *m_ctrlPort |= (1<<m_rsPin);
431  248:   ed 91           ld      r30, X+
432  24a:   fc 91           ld      r31, X
433  24c:   11 97           sbiw    r26, 0x01       ; 1
434  24e:   80 81           ld      r24, Z
435  250:   1a 96           adiw    r26, 0x0a       ; 10
436  252:   0c 90           ld      r0, X
437  254:   02 c0           rjmp    .+4             ; 0x25a <_ZN3Lcd6putCmdEh+0x9c>
438  256:   ee 0c           add     r14, r14
439  258:   ff 1c           adc     r15, r15
440  25a:   0a 94           dec     r0
441  25c:   e2 f7           brpl    .-8             ; 0x256 <_ZN3Lcd6putCmdEh+0x98>
442  25e:   8e 29           or      r24, r14
443  260:   80 83           st      Z, r24
444 }
445  262:   1f 91           pop     r17
446  264:   0f 91           pop     r16
447  266:   ff 90           pop     r15
448  268:   ef 90           pop     r14
449  26a:   df 90           pop     r13
450  26c:   08 95           ret
451
452 0000026e <_ZN4Uart10waitRxCharEv>:
453   }
454
455   unsigned char waitRxChar (void);
456 };
457   
458 unsigned char Uart::waitRxChar (void) {
459  26e:   fc 01           movw    r30, r24
460   // waits for next RX character, then return it
461   unsigned char tail;
462   do {
463     tail = m_UartRxTail; // explicitly set order of volatile variable access
464  270:   91 a9           ldd     r25, Z+49       ; 0x31
465     WDTCSR &= ~(1<<WDCE);
466     sei();
467   }
468   
469   INLINE_FUNC_DECLARE(static void reset(void)) { 
470     wdt_reset(); 
471  272:   a8 95           wdr
472 };
473   
474 unsigned char Uart::waitRxChar (void) {
475   // waits for next RX character, then return it
476   unsigned char tail;
477   do {
478  274:   80 a9           ldd     r24, Z+48       ; 0x30
479  276:   89 17           cp      r24, r25
480  278:   d9 f3           breq    .-10            ; 0x270 <_ZN4Uart10waitRxCharEv+0x2>
481   //  CTS inactive if byte fills buffer after we remove current byte
482   cli();
483 #endif
484
485   // increment tail position 
486   if (tail == UART_RX_BUFFER_SIZE-1)
487  27a:   9f 32           cpi     r25, 0x2F       ; 47
488  27c:   11 f4           brne    .+4             ; 0x282 <_ZN4Uart10waitRxCharEv+0x14>
489     m_UartRxTail = 0;
490  27e:   11 aa           std     Z+49, r1        ; 0x31
491  280:   03 c0           rjmp    .+6             ; 0x288 <_ZN4Uart10waitRxCharEv+0x1a>
492   else
493     m_UartRxTail++;
494  282:   81 a9           ldd     r24, Z+49       ; 0x31
495  284:   8f 5f           subi    r24, 0xFF       ; 255
496  286:   81 ab           std     Z+49, r24       ; 0x31
497 #if USE_CTS
498   CTS_PORT |= (1<<CTS_PIN); // Ensure CTS is active since just removed a byte
499   sei();   // Allow UART ISR to read character and change potentially change CTS
500 #endif
501
502   return m_UartRxBuf[m_UartRxTail];
503  288:   81 a9           ldd     r24, Z+49       ; 0x31
504  28a:   e8 0f           add     r30, r24
505  28c:   f1 1d           adc     r31, r1
506  28e:   80 81           ld      r24, Z
507 }
508  290:   08 95           ret
509
510 00000292 <main>:
511   }
512 };
513
514
515 MAIN_FUNC() {
516   MCUSR = 0; // clear all reset flags
517  292:   14 be           out     0x34, r1        ; 52
518     WDTCSR &= ~(1<<WDCE);
519     sei();
520   }
521   
522   INLINE_FUNC_DECLARE(static void reset(void)) { 
523     wdt_reset(); 
524  294:   a8 95           wdr
525
526 class Watchdog {
527 public:
528   INLINE_FUNC_DECLARE(static void init(void)) {
529     reset();
530     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
531  296:   81 b5           in      r24, 0x21       ; 33
532  298:   88 61           ori     r24, 0x18       ; 24
533  29a:   81 bd           out     0x21, r24       ; 33
534     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
535  29c:   89 e2           ldi     r24, 0x29       ; 41
536  29e:   81 bd           out     0x21, r24       ; 33
537
538
539 class SleepMode {
540 public:
541   INLINE_FUNC_DECLARE(static void initIdleMode(void)) {
542     MCUCR &= ~((1<<SM1)|(1<<SM0)); // use idle sleep mode
543  2a0:   85 b7           in      r24, 0x35       ; 53
544  2a2:   8f 7a           andi    r24, 0xAF       ; 175
545  2a4:   85 bf           out     0x35, r24       ; 53
546   static const unsigned char UART_PARITY_EVEN = 1;
547   static const unsigned char UART_PARITY_ODD = 2;
548   
549   INLINE_FUNC_DECLARE(void init(void)) {
550     // Default initialization is 8-bit, parity none
551     UCSRB = 0;
552  2a6:   1a b8           out     0x0a, r1        ; 10
553     UCSRA = 0;
554  2a8:   1b b8           out     0x0b, r1        ; 11
555     UCSRC = (1<<UCSZ1) | (1<<UCSZ0); // 8 bit data
556  2aa:   76 e0           ldi     r23, 0x06       ; 6
557  2ac:   73 b9           out     0x03, r23       ; 3
558
559     // Init circular buffer pointers
560     m_UartRxHead = 0;
561  2ae:   10 92 b2 00     sts     0x00B2, r1
562     m_UartRxTail = 0;
563  2b2:   10 92 b3 00     sts     0x00B3, r1
564
565
566 INLINE_FUNC_DECLARE(static unsigned char GetBaudDivisor());
567 static inline unsigned char GetBaudDivisor() {
568   // Set LCD_control BAUD_J2:BAUD_J1 to inputs  
569   BAUD_DIR &= ~((1<<BAUD_J2) | (1<<BAUD_J1));
570  2b6:   87 b3           in      r24, 0x17       ; 23
571  2b8:   83 7f           andi    r24, 0xF3       ; 243
572  2ba:   87 bb           out     0x17, r24       ; 23
573   // Set BAUD_J2:BAUD_J1 PULL-UPS active
574   BAUD_PORT |= (1<<BAUD_J2) | (1<<BAUD_J1);
575  2bc:   42 e3           ldi     r20, 0x32       ; 50
576  2be:   50 e0           ldi     r21, 0x00       ; 0
577  2c0:   82 b3           in      r24, 0x12       ; 18
578  2c2:   8c 60           ori     r24, 0x0C       ; 12
579  2c4:   82 bb           out     0x12, r24       ; 18
580
581   // Get BAUD rate jumper settings         
582   unsigned char BaudSelectJumpersValue  = BAUD_PIN_REG;
583  2c6:   e0 b3           in      r30, 0x10       ; 16
584   BaudSelectJumpersValue &= (1<<BAUD_J2) | (1<<BAUD_J1);
585   // BAUD_J2 = PD.3, BAUD_J1 = PD.2
586   // This is two bits too far to the left and the array index will
587   // increment by 4, instead of 1.
588   // Shift BAUD_J2 & BAUD_J1 right by two bit positions for proper array indexing
589   BaudSelectJumpersValue = (BaudSelectJumpersValue >> BAUD_J1);
590  2c8:   ec 70           andi    r30, 0x0C       ; 12
591   
592   return PGM_READ_BYTE (&BaudLookupTable[BaudSelectJumpersValue]);
593  2ca:   e6 95           lsr     r30
594  2cc:   e6 95           lsr     r30
595  2ce:   f0 e0           ldi     r31, 0x00       ; 0
596  2d0:   e8 59           subi    r30, 0x98       ; 152
597  2d2:   ff 4f           sbci    r31, 0xFF       ; 255
598  2d4:   e4 91           lpm     r30, Z+
599   CTS_DIR |= (1<<CTS_PIN);   // CTS is active low
600 #endif
601   }
602
603   INLINE_FUNC_DECLARE(void setBaudDivisor(unsigned int baud_divisor)) {
604     UBRRL = baud_divisor & 0xFF;
605  2d6:   e9 b9           out     0x09, r30       ; 9
606     UBRRH = baud_divisor >> 8;
607  2d8:   12 b8           out     0x02, r1        ; 2
608   }
609
610   INLINE_FUNC_DECLARE(void rxEnable(void)) {
611     UCSRB |= (1<<RXEN);
612  2da:   54 9a           sbi     0x0a, 4 ; 10
613   }
614
615   INLINE_FUNC_DECLARE(void rxInterruptEnable(void)) {
616     UCSRB |= (1<<RXCIE);
617  2dc:   57 9a           sbi     0x0a, 7 ; 10
618
619 public:
620   INLINE_FUNC_DECLARE(void init(volatile unsigned char* port, 
621                                 volatile unsigned char* dir, 
622                                 unsigned char pin)) {
623     m_LedPort = port;
624  2de:   50 93 7e 00     sts     0x007E, r21
625  2e2:   40 93 7d 00     sts     0x007D, r20
626     m_LedDir = dir;
627  2e6:   21 e3           ldi     r18, 0x31       ; 49
628  2e8:   30 e0           ldi     r19, 0x00       ; 0
629  2ea:   30 93 80 00     sts     0x0080, r19
630  2ee:   20 93 7f 00     sts     0x007F, r18
631     m_LedPin = pin;
632  2f2:   91 e0           ldi     r25, 0x01       ; 1
633  2f4:   90 93 81 00     sts     0x0081, r25
634
635     // setup PWM to run at 1.25ms per interrupt. 
636     // This allows 8 levels of brightness at minimum of 100Hz flicker rate.
637     TCCR0A = (1<<WGM01); // CTC mode
638  2f8:   82 e0           ldi     r24, 0x02       ; 2
639  2fa:   80 bf           out     0x30, r24       ; 48
640     TCCR0B = 0; // timer off
641  2fc:   13 be           out     0x33, r1        ; 51
642     OCR0A = 72; // 1.25ms with CLK/256 prescaler @ 14.7456MHz
643  2fe:   88 e4           ldi     r24, 0x48       ; 72
644  300:   86 bf           out     0x36, r24       ; 54
645     TIMSK = (1<<OCIE0A); // Turn on timer0 COMPA intr (all other timer intr off)
646  302:   99 bf           out     0x39, r25       ; 57
647     *m_LedPort &= ~(1<<m_LedPin); // Ensure LED is off during initialization
648  304:   91 98           cbi     0x12, 1 ; 18
649     *m_LedDir |= (1<<m_LedPin); // Ensure LED is output port
650  306:   89 9a           sbi     0x11, 1 ; 17
651     m_BIT_led_on = 0;  // note that LED is off
652  308:   10 92 7c 00     sts     0x007C, r1
653     m_ledPwmPattern = 0xFF;  // maximum brightness
654  30c:   6f ef           ldi     r22, 0xFF       ; 255
655  30e:   60 93 7b 00     sts     0x007B, r22
656                                 volatile unsigned char* dataDir,
657                                 volatile unsigned char* dataPinReg,
658                                 unsigned char rsPin,
659                                 unsigned char rwPin,
660                                 unsigned char ePin)) {
661     m_ctrlPort = ctrlPort;
662  312:   50 93 6d 00     sts     0x006D, r21
663  316:   40 93 6c 00     sts     0x006C, r20
664     m_ctrlDir = ctrlDir;
665  31a:   30 93 6f 00     sts     0x006F, r19
666  31e:   20 93 6e 00     sts     0x006E, r18
667     m_dataPort = dataPort;
668  322:   88 e3           ldi     r24, 0x38       ; 56
669  324:   90 e0           ldi     r25, 0x00       ; 0
670  326:   90 93 71 00     sts     0x0071, r25
671  32a:   80 93 70 00     sts     0x0070, r24
672     m_dataDir = dataDir;
673  32e:   87 e3           ldi     r24, 0x37       ; 55
674  330:   90 e0           ldi     r25, 0x00       ; 0
675  332:   90 93 73 00     sts     0x0073, r25
676  336:   80 93 72 00     sts     0x0072, r24
677     m_dataPinReg = dataPinReg;
678  33a:   86 e3           ldi     r24, 0x36       ; 54
679  33c:   90 e0           ldi     r25, 0x00       ; 0
680  33e:   90 93 75 00     sts     0x0075, r25
681  342:   80 93 74 00     sts     0x0074, r24
682     m_rsPin = rsPin;
683  346:   85 e0           ldi     r24, 0x05       ; 5
684  348:   80 93 76 00     sts     0x0076, r24
685     m_rwPin = rwPin;
686  34c:   84 e0           ldi     r24, 0x04       ; 4
687  34e:   80 93 77 00     sts     0x0077, r24
688     m_ePin = ePin;
689  352:   70 93 78 00     sts     0x0078, r23
690
691     *m_ctrlPort &= ~((1<<m_rsPin)|(1<<m_rwPin)|(1<<m_ePin)); // set low
692  356:   82 b3           in      r24, 0x12       ; 18
693  358:   8f 78           andi    r24, 0x8F       ; 143
694  35a:   82 bb           out     0x12, r24       ; 18
695     *m_ctrlDir |= ((1<<m_rsPin)|(1<<m_rwPin)|(1<<m_ePin)); // set as output
696  35c:   81 b3           in      r24, 0x11       ; 17
697  35e:   80 67           ori     r24, 0x70       ; 112
698  360:   81 bb           out     0x11, r24       ; 17
699         __asm__ volatile (
700                 "1: sbiw %0,1" "\n\t"
701                 "brne 1b"
702                 : "=w" (__count)
703                 : "0" (__count)
704         );
705  362:   80 e0           ldi     r24, 0x00       ; 0
706  364:   98 ed           ldi     r25, 0xD8       ; 216
707  366:   01 97           sbiw    r24, 0x01       ; 1
708  368:   f1 f7           brne    .-4             ; 0x366 <main+0xd4>
709                    
710     Delay::millisec(15);
711     
712     *m_ctrlPort |= (1<<LCD_RS); // Set LCD_RS HIGH
713  36a:   95 9a           sbi     0x12, 5 ; 18
714     
715     // Initialize the AVR controller I/O
716     *m_dataDir = 0xFF; // Set LCD_DATA_OUT as all outputs
717  36c:   67 bb           out     0x17, r22       ; 23
718     *m_dataPort = 0x00; // Set LCD_DATA_OUT to logic low
719  36e:   18 ba           out     0x18, r1        ; 24
720     
721     // Initialize the LCD controller
722     *m_ctrlPort &= ~(1<<LCD_RS);
723  370:   95 98           cbi     0x12, 5 ; 18
724     
725     putChar (m_DATA_8); 
726  372:   8c e6           ldi     r24, 0x6C       ; 108
727  374:   90 e0           ldi     r25, 0x00       ; 0
728  376:   60 e3           ldi     r22, 0x30       ; 48
729  378:   cc de           rcall   .-616           ; 0x112 <_ZN3Lcd7putCharEh>
730  37a:   8a e0           ldi     r24, 0x0A       ; 10
731  37c:   9b e3           ldi     r25, 0x3B       ; 59
732  37e:   01 97           sbiw    r24, 0x01       ; 1
733  380:   f1 f7           brne    .-4             ; 0x37e <main+0xec>
734     Delay::millisec(4.1);
735     
736     putChar (m_DATA_8);
737  382:   8c e6           ldi     r24, 0x6C       ; 108
738  384:   90 e0           ldi     r25, 0x00       ; 0
739  386:   60 e3           ldi     r22, 0x30       ; 48
740  388:   c4 de           rcall   .-632           ; 0x112 <_ZN3Lcd7putCharEh>
741  38a:   80 e7           ldi     r24, 0x70       ; 112
742  38c:   91 e0           ldi     r25, 0x01       ; 1
743  38e:   01 97           sbiw    r24, 0x01       ; 1
744  390:   f1 f7           brne    .-4             ; 0x38e <main+0xfc>
745     Delay::microsec(100);
746     
747     putChar (m_DATA_8);
748  392:   8c e6           ldi     r24, 0x6C       ; 108
749  394:   90 e0           ldi     r25, 0x00       ; 0
750  396:   60 e3           ldi     r22, 0x30       ; 48
751  398:   bc de           rcall   .-648           ; 0x112 <_ZN3Lcd7putCharEh>
752     *m_ctrlPort |= (1<<LCD_RS);
753  39a:   e0 91 6c 00     lds     r30, 0x006C
754  39e:   f0 91 6d 00     lds     r31, 0x006D
755  3a2:   80 81           ld      r24, Z
756  3a4:   80 62           ori     r24, 0x20       ; 32
757  3a6:   80 83           st      Z, r24
758     
759     // The display will be out into 8 bit data mode here
760     putCmd (m_LINE_8x4); // Set 8 bit data, 4 display lines
761  3a8:   8c e6           ldi     r24, 0x6C       ; 108
762  3aa:   90 e0           ldi     r25, 0x00       ; 0
763  3ac:   68 e3           ldi     r22, 0x38       ; 56
764  3ae:   07 df           rcall   .-498           ; 0x1be <_ZN3Lcd6putCmdEh>
765     putCmd (m_PWR_ON); // Power up the display
766  3b0:   8c e6           ldi     r24, 0x6C       ; 108
767  3b2:   90 e0           ldi     r25, 0x00       ; 0
768  3b4:   6c e0           ldi     r22, 0x0C       ; 12
769  3b6:   03 df           rcall   .-506           ; 0x1be <_ZN3Lcd6putCmdEh>
770     putCmd (m_CLR_DSP); // Power up the display
771  3b8:   8c e6           ldi     r24, 0x6C       ; 108
772  3ba:   90 e0           ldi     r25, 0x00       ; 0
773  3bc:   61 e0           ldi     r22, 0x01       ; 1
774  3be:   ff de           rcall   .-514           ; 0x1be <_ZN3Lcd6putCmdEh>
775   gUart.rxInterruptEnable();
776   gLed.init(&LED_PORT, &LED_DIR, LED_PIN);
777   gLcd.init(&LCD_CONTROL_PORT, &LCD_CONTROL_DIR, &LCD_DATA_PORT,
778             &LCD_DATA_DIR, &LCD_DATA_PIN_REG, LCD_RS, LCD_RW, LCD_E);
779
780   sei();
781  3c0:   78 94           sei
782
783   INLINE_FUNC_DECLARE(void stop(void)) {
784     TCCR0B = 0;
785   }
786   INLINE_FUNC_DECLARE(void start(void)) {
787     TCCR0B = (1<<CS02);
788  3c2:   14 e0           ldi     r17, 0x04       ; 4
789       m_ledPwmCycling >>= 1;
790     }
791   }
792
793   INLINE_FUNC_DECLARE(void lampOn(void)) {
794     *m_LedPort |= (1<<m_LedPin);
795  3c4:   c1 e0           ldi     r28, 0x01       ; 1
796  3c6:   d0 e0           ldi     r29, 0x00       ; 0
797     m_BIT_led_on = 0;
798     stop();
799   }
800
801   INLINE_FUNC_DECLARE(void switchOn(void)) {
802     m_BIT_led_on = 1;
803  3c8:   01 e0           ldi     r16, 0x01       ; 1
804 #endif 
805     return 1;
806   }
807
808   INLINE_FUNC_DECLARE(unsigned char charAvail(void)) {
809     unsigned char tail = m_UartRxTail; // explicitly set order of volatile access
810  3ca:   90 91 b3 00     lds     r25, 0x00B3
811     return (tail != m_UartRxHead) ? 1 : 0;
812  3ce:   80 91 b2 00     lds     r24, 0x00B2
813  3d2:   98 17           cp      r25, r24
814  3d4:   09 f4           brne    .+2             ; 0x3d8 <main+0x146>
815  3d6:   8a c0           rjmp    .+276           ; 0x4ec <main+0x25a>
816             &LCD_DATA_DIR, &LCD_DATA_PIN_REG, LCD_RS, LCD_RW, LCD_E);
817
818   sei();
819   while (1) {
820     if (gUart.charAvail()) {
821       SerialCommandProcessor::processChar (gUart.waitRxChar());
822  3d8:   82 e8           ldi     r24, 0x82       ; 130
823  3da:   90 e0           ldi     r25, 0x00       ; 0
824  3dc:   48 df           rcall   .-368           ; 0x26e <_ZN4Uart10waitRxCharEv>
825  3de:   68 2f           mov     r22, r24
826
827 public:
828   INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) {
829     // avoid use of switch statement as ImageCraft and GCC produce signifcantly
830     // more code for a switch statement than a sequence of if/else if
831     if (ch == m_LED_SW_OFF) {
832  3e0:   8d 3f           cpi     r24, 0xFD       ; 253
833  3e2:   a1 f4           brne    .+40            ; 0x40c <main+0x17a>
834   INLINE_FUNC_DECLARE(void lampOn(void)) {
835     *m_LedPort |= (1<<m_LedPin);
836   };
837
838   INLINE_FUNC_DECLARE(void lampOff(void)) {
839     *m_LedPort &= ~(1<<m_LedPin);;
840  3e4:   e0 91 7d 00     lds     r30, 0x007D
841  3e8:   f0 91 7e 00     lds     r31, 0x007E
842  3ec:   20 81           ld      r18, Z
843  3ee:   ce 01           movw    r24, r28
844  3f0:   00 90 81 00     lds     r0, 0x0081
845  3f4:   02 c0           rjmp    .+4             ; 0x3fa <main+0x168>
846  3f6:   88 0f           add     r24, r24
847  3f8:   99 1f           adc     r25, r25
848  3fa:   0a 94           dec     r0
849  3fc:   e2 f7           brpl    .-8             ; 0x3f6 <main+0x164>
850  3fe:   80 95           com     r24
851  400:   82 23           and     r24, r18
852  402:   80 83           st      Z, r24
853     TCCR0B = (1<<CS02);
854   }
855
856   INLINE_FUNC_DECLARE(void switchOff(void)) {
857     lampOff();
858     m_BIT_led_on = 0;
859  404:   10 92 7c 00     sts     0x007C, r1
860     m_BIT_led_on = 0;  // note that LED is off
861     m_ledPwmPattern = 0xFF;  // maximum brightness
862   }
863
864   INLINE_FUNC_DECLARE(void stop(void)) {
865     TCCR0B = 0;
866  408:   13 be           out     0x33, r1        ; 51
867  40a:   df cf           rjmp    .-66            ; 0x3ca <main+0x138>
868   INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) {
869     // avoid use of switch statement as ImageCraft and GCC produce signifcantly
870     // more code for a switch statement than a sequence of if/else if
871     if (ch == m_LED_SW_OFF) {
872       gLed.switchOff();
873     } else if (ch == m_LED_SW_ON) {
874  40c:   8c 3f           cpi     r24, 0xFC       ; 252
875  40e:   41 f4           brne    .+16            ; 0x420 <main+0x18e>
876     m_BIT_led_on = 0;
877     stop();
878   }
879
880   INLINE_FUNC_DECLARE(void switchOn(void)) {
881     m_BIT_led_on = 1;
882  410:   00 93 7c 00     sts     0x007C, r16
883     if (m_ledPwmPattern == 0xFF) { // maximum brightness, no need for PWM
884  414:   80 91 7b 00     lds     r24, 0x007B
885  418:   8f 3f           cpi     r24, 0xFF       ; 255
886  41a:   09 f0           breq    .+2             ; 0x41e <main+0x18c>
887  41c:   57 c0           rjmp    .+174           ; 0x4cc <main+0x23a>
888  41e:   40 c0           rjmp    .+128           ; 0x4a0 <main+0x20e>
889     // more code for a switch statement than a sequence of if/else if
890     if (ch == m_LED_SW_OFF) {
891       gLed.switchOff();
892     } else if (ch == m_LED_SW_ON) {
893       gLed.switchOn();
894     } else if (ch == m_LED_SET_BRIGHTNESS) {
895  420:   8b 3f           cpi     r24, 0xFB       ; 251
896  422:   09 f0           breq    .+2             ; 0x426 <main+0x194>
897  424:   55 c0           rjmp    .+170           ; 0x4d0 <main+0x23e>
898       // read next byte which will be brightness
899       gLed.setBrightness(gUart.waitRxChar());
900  426:   82 e8           ldi     r24, 0x82       ; 130
901  428:   90 e0           ldi     r25, 0x00       ; 0
902  42a:   21 df           rcall   .-446           ; 0x26e <_ZN4Uart10waitRxCharEv>
903       start();
904     }
905   }
906
907   INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) {
908     if (brightness == 0) { // turn backlight off for 0 brightness
909  42c:   88 23           and     r24, r24
910  42e:   d1 f4           brne    .+52            ; 0x464 <main+0x1d2>
911       if (m_BIT_led_on) {
912  430:   80 91 7c 00     lds     r24, 0x007C
913  434:   88 23           and     r24, r24
914  436:   49 f2           breq    .-110           ; 0x3ca <main+0x138>
915     m_BIT_led_on = 0;  // note that LED is off
916     m_ledPwmPattern = 0xFF;  // maximum brightness
917   }
918
919   INLINE_FUNC_DECLARE(void stop(void)) {
920     TCCR0B = 0;
921  438:   13 be           out     0x33, r1        ; 51
922
923   INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) {
924     if (brightness == 0) { // turn backlight off for 0 brightness
925       if (m_BIT_led_on) {
926         stop();
927         m_ledPwmPattern = 0;
928  43a:   10 92 7b 00     sts     0x007B, r1
929         m_ledPwmCycling = 0;
930  43e:   10 92 7a 00     sts     0x007A, r1
931   INLINE_FUNC_DECLARE(void lampOn(void)) {
932     *m_LedPort |= (1<<m_LedPin);
933   };
934
935   INLINE_FUNC_DECLARE(void lampOff(void)) {
936     *m_LedPort &= ~(1<<m_LedPin);;
937  442:   e0 91 7d 00     lds     r30, 0x007D
938  446:   f0 91 7e 00     lds     r31, 0x007E
939  44a:   20 81           ld      r18, Z
940  44c:   ce 01           movw    r24, r28
941  44e:   00 90 81 00     lds     r0, 0x0081
942  452:   02 c0           rjmp    .+4             ; 0x458 <main+0x1c6>
943  454:   88 0f           add     r24, r24
944  456:   99 1f           adc     r25, r25
945  458:   0a 94           dec     r0
946  45a:   e2 f7           brpl    .-8             ; 0x454 <main+0x1c2>
947  45c:   80 95           com     r24
948  45e:   82 23           and     r24, r18
949  460:   80 83           st      Z, r24
950  462:   b3 cf           rjmp    .-154           ; 0x3ca <main+0x138>
951         lampOff();
952       }
953       return;
954     }
955
956     unsigned char ledPwmPos = (brightness * (m_LED_BRIGHTNESS_LEVELS-1) + 127) >> 8; 
957  464:   90 e0           ldi     r25, 0x00       ; 0
958  466:   67 e0           ldi     r22, 0x07       ; 7
959  468:   70 e0           ldi     r23, 0x00       ; 0
960  46a:   d1 d0           rcall   .+418           ; 0x60e <__mulhi3>
961  46c:   81 58           subi    r24, 0x81       ; 129
962  46e:   9f 4f           sbci    r25, 0xFF       ; 255
963  470:   89 2f           mov     r24, r25
964  472:   99 0f           add     r25, r25
965  474:   99 0b           sbc     r25, r25
966  476:   88 30           cpi     r24, 0x08       ; 8
967  478:   08 f0           brcs    .+2             ; 0x47c <main+0x1ea>
968  47a:   87 e0           ldi     r24, 0x07       ; 7
969   INLINE_FUNC_DECLARE(void lampOff(void)) {
970     *m_LedPort &= ~(1<<m_LedPin);;
971   }
972
973   INLINE_FUNC_DECLARE(unsigned char pwmPattern(unsigned char pos)) {
974     return PGM_READ_BYTE (&m_ledPwmPatterns[pos]);
975  47c:   e8 2f           mov     r30, r24
976  47e:   f0 e0           ldi     r31, 0x00       ; 0
977  480:   e0 5a           subi    r30, 0xA0       ; 160
978  482:   ff 4f           sbci    r31, 0xFF       ; 255
979  484:   e4 91           lpm     r30, Z+
980
981     unsigned char ledPwmPos = (brightness * (m_LED_BRIGHTNESS_LEVELS-1) + 127) >> 8; 
982     // Below is probably not required, but ensures we don't exceed array
983     if (ledPwmPos > m_LED_BRIGHTNESS_LEVELS - 1)
984       ledPwmPos = m_LED_BRIGHTNESS_LEVELS - 1;
985     m_ledPwmPattern = pwmPattern(ledPwmPos);
986  486:   e0 93 7b 00     sts     0x007B, r30
987     m_ledPwmCount = 0;
988  48a:   10 92 79 00     sts     0x0079, r1
989     m_ledPwmCycling = m_ledPwmPattern;
990  48e:   e0 93 7a 00     sts     0x007A, r30
991     if (ledPwmPos >= m_LED_BRIGHTNESS_LEVELS-1) { // maximum brightness
992  492:   87 30           cpi     r24, 0x07       ; 7
993  494:   b1 f4           brne    .+44            ; 0x4c2 <main+0x230>
994       // don't need PWM to continuously on
995       if (m_BIT_led_on) {
996  496:   80 91 7c 00     lds     r24, 0x007C
997  49a:   88 23           and     r24, r24
998  49c:   09 f4           brne    .+2             ; 0x4a0 <main+0x20e>
999  49e:   95 cf           rjmp    .-214           ; 0x3ca <main+0x138>
1000     m_BIT_led_on = 0;  // note that LED is off
1001     m_ledPwmPattern = 0xFF;  // maximum brightness
1002   }
1003
1004   INLINE_FUNC_DECLARE(void stop(void)) {
1005     TCCR0B = 0;
1006  4a0:   13 be           out     0x33, r1        ; 51
1007       m_ledPwmCycling >>= 1;
1008     }
1009   }
1010
1011   INLINE_FUNC_DECLARE(void lampOn(void)) {
1012     *m_LedPort |= (1<<m_LedPin);
1013  4a2:   e0 91 7d 00     lds     r30, 0x007D
1014  4a6:   f0 91 7e 00     lds     r31, 0x007E
1015  4aa:   20 81           ld      r18, Z
1016  4ac:   ce 01           movw    r24, r28
1017  4ae:   00 90 81 00     lds     r0, 0x0081
1018  4b2:   02 c0           rjmp    .+4             ; 0x4b8 <main+0x226>
1019  4b4:   88 0f           add     r24, r24
1020  4b6:   99 1f           adc     r25, r25
1021  4b8:   0a 94           dec     r0
1022  4ba:   e2 f7           brpl    .-8             ; 0x4b4 <main+0x222>
1023  4bc:   28 2b           or      r18, r24
1024  4be:   20 83           st      Z, r18
1025  4c0:   84 cf           rjmp    .-248           ; 0x3ca <main+0x138>
1026       if (m_BIT_led_on) {
1027         stop();
1028         lampOn();
1029       }
1030     } else {
1031       if (m_BIT_led_on) {
1032  4c2:   80 91 7c 00     lds     r24, 0x007C
1033  4c6:   88 23           and     r24, r24
1034  4c8:   09 f4           brne    .+2             ; 0x4cc <main+0x23a>
1035  4ca:   7f cf           rjmp    .-258           ; 0x3ca <main+0x138>
1036
1037   INLINE_FUNC_DECLARE(void stop(void)) {
1038     TCCR0B = 0;
1039   }
1040   INLINE_FUNC_DECLARE(void start(void)) {
1041     TCCR0B = (1<<CS02);
1042  4cc:   13 bf           out     0x33, r17       ; 51
1043  4ce:   7d cf           rjmp    .-262           ; 0x3ca <main+0x138>
1044     } else if (ch == m_LED_SW_ON) {
1045       gLed.switchOn();
1046     } else if (ch == m_LED_SET_BRIGHTNESS) {
1047       // read next byte which will be brightness
1048       gLed.setBrightness(gUart.waitRxChar());
1049     } else if (ch == m_REG_MODE) {
1050  4d0:   8e 3f           cpi     r24, 0xFE       ; 254
1051  4d2:   41 f4           brne    .+16            ; 0x4e4 <main+0x252>
1052       gLcd.putCmd (gUart.waitRxChar()); // Send LCD command character
1053  4d4:   82 e8           ldi     r24, 0x82       ; 130
1054  4d6:   90 e0           ldi     r25, 0x00       ; 0
1055  4d8:   ca de           rcall   .-620           ; 0x26e <_ZN4Uart10waitRxCharEv>
1056  4da:   68 2f           mov     r22, r24
1057  4dc:   8c e6           ldi     r24, 0x6C       ; 108
1058  4de:   90 e0           ldi     r25, 0x00       ; 0
1059  4e0:   6e de           rcall   .-804           ; 0x1be <_ZN3Lcd6putCmdEh>
1060  4e2:   73 cf           rjmp    .-282           ; 0x3ca <main+0x138>
1061     } else {
1062       gLcd.putChar (ch); // Send LCD data character
1063  4e4:   8c e6           ldi     r24, 0x6C       ; 108
1064  4e6:   90 e0           ldi     r25, 0x00       ; 0
1065  4e8:   14 de           rcall   .-984           ; 0x112 <_ZN3Lcd7putCharEh>
1066  4ea:   6f cf           rjmp    .-290           ; 0x3ca <main+0x138>
1067     reset();
1068     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
1069     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
1070   }
1071   INLINE_FUNC_DECLARE(static void off(void)) {
1072     cli();
1073  4ec:   f8 94           cli
1074     WDTCSR &= ~(1<<WDCE);
1075     sei();
1076   }
1077   
1078   INLINE_FUNC_DECLARE(static void reset(void)) { 
1079     wdt_reset(); 
1080  4ee:   a8 95           wdr
1081     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
1082   }
1083   INLINE_FUNC_DECLARE(static void off(void)) {
1084     cli();
1085     reset();
1086     MCUSR &= ~(1<<WDRF); // clear any watchdog interrupt flags
1087  4f0:   84 b7           in      r24, 0x34       ; 52
1088  4f2:   87 7f           andi    r24, 0xF7       ; 247
1089  4f4:   84 bf           out     0x34, r24       ; 52
1090     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
1091  4f6:   81 b5           in      r24, 0x21       ; 33
1092  4f8:   88 61           ori     r24, 0x18       ; 24
1093  4fa:   81 bd           out     0x21, r24       ; 33
1094     WDTCSR &= ~(1<<WDE); // watchdog timer off
1095  4fc:   81 b5           in      r24, 0x21       ; 33
1096  4fe:   87 7f           andi    r24, 0xF7       ; 247
1097  500:   81 bd           out     0x21, r24       ; 33
1098     sei();
1099  502:   78 94           sei
1100 public:
1101   INLINE_FUNC_DECLARE(static void initIdleMode(void)) {
1102     MCUCR &= ~((1<<SM1)|(1<<SM0)); // use idle sleep mode
1103   }
1104   INLINE_FUNC_DECLARE(static void enterSleep()) {
1105     sleep_enable();
1106  504:   85 b7           in      r24, 0x35       ; 53
1107  506:   80 62           ori     r24, 0x20       ; 32
1108  508:   85 bf           out     0x35, r24       ; 53
1109     sleep_cpu();
1110  50a:   88 95           sleep
1111     sleep_disable();
1112  50c:   85 b7           in      r24, 0x35       ; 53
1113  50e:   8f 7d           andi    r24, 0xDF       ; 223
1114  510:   85 bf           out     0x35, r24       ; 53
1115     WDTCSR &= ~(1<<WDE); // watchdog timer off
1116     sei();
1117   }
1118   
1119   INLINE_FUNC_DECLARE(static void on(void)) {
1120     cli();
1121  512:   f8 94           cli
1122     WDTCSR &= ~(1<<WDCE);
1123     sei();
1124   }
1125   
1126   INLINE_FUNC_DECLARE(static void reset(void)) { 
1127     wdt_reset(); 
1128  514:   a8 95           wdr
1129   }
1130   
1131   INLINE_FUNC_DECLARE(static void on(void)) {
1132     cli();
1133     reset();
1134     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
1135  516:   81 b5           in      r24, 0x21       ; 33
1136  518:   88 61           ori     r24, 0x18       ; 24
1137  51a:   81 bd           out     0x21, r24       ; 33
1138     WDTCSR &= ~(1<<WDCE);
1139  51c:   81 b5           in      r24, 0x21       ; 33
1140  51e:   8f 7e           andi    r24, 0xEF       ; 239
1141  520:   81 bd           out     0x21, r24       ; 33
1142     sei();
1143  522:   78 94           sei
1144  524:   52 cf           rjmp    .-348           ; 0x3ca <main+0x138>
1145
1146 00000526 <__vector_7>:
1147   }
1148   MAIN_FUNC_LAST();
1149 }
1150
1151
1152 ISR(USART_RX_vect) {
1153  526:   1f 92           push    r1
1154  528:   0f 92           push    r0
1155  52a:   0f b6           in      r0, 0x3f        ; 63
1156  52c:   0f 92           push    r0
1157  52e:   11 24           eor     r1, r1
1158  530:   8f 93           push    r24
1159  532:   9f 93           push    r25
1160  534:   ef 93           push    r30
1161  536:   ff 93           push    r31
1162   gUart.storeChar(UDR);
1163  538:   9c b1           in      r25, 0x0c       ; 12
1164     UCSRC = reg;
1165   }
1166
1167   INLINE_FUNC_DECLARE(unsigned char storeChar(unsigned char rx)) {
1168     // Calculate next buffer position.
1169     unsigned char tmphead = m_UartRxHead;
1170  53a:   e0 91 b2 00     lds     r30, 0x00B2
1171     if (tmphead == UART_RX_BUFFER_SIZE-1)
1172  53e:   ef 32           cpi     r30, 0x2F       ; 47
1173  540:   11 f4           brne    .+4             ; 0x546 <__vector_7+0x20>
1174  542:   e0 e0           ldi     r30, 0x00       ; 0
1175  544:   01 c0           rjmp    .+2             ; 0x548 <__vector_7+0x22>
1176       tmphead = 0;
1177     else
1178       tmphead++;
1179  546:   ef 5f           subi    r30, 0xFF       ; 255
1180     
1181     // store in buffer if there is room
1182     if (tmphead != m_UartRxTail) {
1183  548:   80 91 b3 00     lds     r24, 0x00B3
1184  54c:   e8 17           cp      r30, r24
1185  54e:   31 f0           breq    .+12            ; 0x55c <__vector_7+0x36>
1186       m_UartRxHead = tmphead;         // Store new index.
1187  550:   e0 93 b2 00     sts     0x00B2, r30
1188       m_UartRxBuf[tmphead] = rx;
1189  554:   f0 e0           ldi     r31, 0x00       ; 0
1190  556:   ee 57           subi    r30, 0x7E       ; 126
1191  558:   ff 4f           sbci    r31, 0xFF       ; 255
1192  55a:   90 83           st      Z, r25
1193 }
1194
1195
1196 ISR(USART_RX_vect) {
1197   gUart.storeChar(UDR);
1198 }
1199  55c:   ff 91           pop     r31
1200  55e:   ef 91           pop     r30
1201  560:   9f 91           pop     r25
1202  562:   8f 91           pop     r24
1203  564:   0f 90           pop     r0
1204  566:   0f be           out     0x3f, r0        ; 63
1205  568:   0f 90           pop     r0
1206  56a:   1f 90           pop     r1
1207  56c:   18 95           reti
1208
1209 0000056e <__vector_13>:
1210
1211 ISR(TIMER0_COMPA_vect) {
1212  56e:   1f 92           push    r1
1213  570:   0f 92           push    r0
1214  572:   0f b6           in      r0, 0x3f        ; 63
1215  574:   0f 92           push    r0
1216  576:   11 24           eor     r1, r1
1217  578:   2f 93           push    r18
1218  57a:   8f 93           push    r24
1219  57c:   9f 93           push    r25
1220  57e:   ef 93           push    r30
1221  580:   ff 93           push    r31
1222   sei(); // Okay to allow USART interrupts while controlling LED PWM
1223  582:   78 94           sei
1224       }
1225     }
1226   }
1227
1228   INLINE_FUNC_DECLARE(void cyclePwm(void)) {
1229     if (m_ledPwmCycling & 0x01) {   // Set current LED state based on cycling variable
1230  584:   80 91 7a 00     lds     r24, 0x007A
1231  588:   80 ff           sbrs    r24, 0
1232  58a:   11 c0           rjmp    .+34            ; 0x5ae <__vector_13+0x40>
1233       m_ledPwmCycling >>= 1;
1234     }
1235   }
1236
1237   INLINE_FUNC_DECLARE(void lampOn(void)) {
1238     *m_LedPort |= (1<<m_LedPin);
1239  58c:   e0 91 7d 00     lds     r30, 0x007D
1240  590:   f0 91 7e 00     lds     r31, 0x007E
1241  594:   20 81           ld      r18, Z
1242  596:   81 e0           ldi     r24, 0x01       ; 1
1243  598:   90 e0           ldi     r25, 0x00       ; 0
1244  59a:   00 90 81 00     lds     r0, 0x0081
1245  59e:   02 c0           rjmp    .+4             ; 0x5a4 <__vector_13+0x36>
1246  5a0:   88 0f           add     r24, r24
1247  5a2:   99 1f           adc     r25, r25
1248  5a4:   0a 94           dec     r0
1249  5a6:   e2 f7           brpl    .-8             ; 0x5a0 <__vector_13+0x32>
1250  5a8:   28 2b           or      r18, r24
1251  5aa:   20 83           st      Z, r18
1252  5ac:   11 c0           rjmp    .+34            ; 0x5d0 <__vector_13+0x62>
1253   };
1254
1255   INLINE_FUNC_DECLARE(void lampOff(void)) {
1256     *m_LedPort &= ~(1<<m_LedPin);;
1257  5ae:   e0 91 7d 00     lds     r30, 0x007D
1258  5b2:   f0 91 7e 00     lds     r31, 0x007E
1259  5b6:   20 81           ld      r18, Z
1260  5b8:   81 e0           ldi     r24, 0x01       ; 1
1261  5ba:   90 e0           ldi     r25, 0x00       ; 0
1262  5bc:   00 90 81 00     lds     r0, 0x0081
1263  5c0:   02 c0           rjmp    .+4             ; 0x5c6 <__vector_13+0x58>
1264  5c2:   88 0f           add     r24, r24
1265  5c4:   99 1f           adc     r25, r25
1266  5c6:   0a 94           dec     r0
1267  5c8:   e2 f7           brpl    .-8             ; 0x5c2 <__vector_13+0x54>
1268  5ca:   80 95           com     r24
1269  5cc:   82 23           and     r24, r18
1270  5ce:   80 83           st      Z, r24
1271     } else {
1272       lampOff();
1273     }
1274
1275     // Update cycling variable for next interrupt
1276     if (m_ledPwmCount >= m_LED_BRIGHTNESS_LEVELS-1) {
1277  5d0:   80 91 79 00     lds     r24, 0x0079
1278  5d4:   87 30           cpi     r24, 0x07       ; 7
1279  5d6:   28 f0           brcs    .+10            ; 0x5e2 <__vector_13+0x74>
1280       m_ledPwmCount = 0;
1281  5d8:   10 92 79 00     sts     0x0079, r1
1282       m_ledPwmCycling = m_ledPwmPattern;
1283  5dc:   80 91 7b 00     lds     r24, 0x007B
1284  5e0:   0a c0           rjmp    .+20            ; 0x5f6 <__vector_13+0x88>
1285     } else {
1286       m_ledPwmCount++;
1287  5e2:   80 91 79 00     lds     r24, 0x0079
1288  5e6:   8f 5f           subi    r24, 0xFF       ; 255
1289  5e8:   80 93 79 00     sts     0x0079, r24
1290       m_ledPwmCycling >>= 1;
1291  5ec:   80 91 7a 00     lds     r24, 0x007A
1292  5f0:   90 e0           ldi     r25, 0x00       ; 0
1293  5f2:   95 95           asr     r25
1294  5f4:   87 95           ror     r24
1295  5f6:   80 93 7a 00     sts     0x007A, r24
1296 }
1297
1298 ISR(TIMER0_COMPA_vect) {
1299   sei(); // Okay to allow USART interrupts while controlling LED PWM
1300   gLed.cyclePwm();
1301 }
1302  5fa:   ff 91           pop     r31
1303  5fc:   ef 91           pop     r30
1304  5fe:   9f 91           pop     r25
1305  600:   8f 91           pop     r24
1306  602:   2f 91           pop     r18
1307  604:   0f 90           pop     r0
1308  606:   0f be           out     0x3f, r0        ; 63
1309  608:   0f 90           pop     r0
1310  60a:   1f 90           pop     r1
1311  60c:   18 95           reti
1312
1313 0000060e <__mulhi3>:
1314  60e:   55 27           eor     r21, r21
1315  610:   00 24           eor     r0, r0
1316
1317 00000612 <__mulhi3_loop>:
1318  612:   80 ff           sbrs    r24, 0
1319  614:   02 c0           rjmp    .+4             ; 0x61a <__mulhi3_skip1>
1320  616:   06 0e           add     r0, r22
1321  618:   57 1f           adc     r21, r23
1322
1323 0000061a <__mulhi3_skip1>:
1324  61a:   66 0f           add     r22, r22
1325  61c:   77 1f           adc     r23, r23
1326  61e:   61 15           cp      r22, r1
1327  620:   71 05           cpc     r23, r1
1328  622:   21 f0           breq    .+8             ; 0x62c <__mulhi3_exit>
1329  624:   96 95           lsr     r25
1330  626:   87 95           ror     r24
1331  628:   00 97           sbiw    r24, 0x00       ; 0
1332  62a:   99 f7           brne    .-26            ; 0x612 <__mulhi3_loop>
1333
1334 0000062c <__mulhi3_exit>:
1335  62c:   95 2f           mov     r25, r21
1336  62e:   80 2d           mov     r24, r0
1337  630:   08 95           ret
1338
1339 00000632 <_exit>:
1340  632:   f8 94           cli
1341
1342 00000634 <__stop_program>:
1343  634:   ff cf           rjmp    .-2             ; 0x634 <__stop_program>