Add .lss files for GCC for current Mac CrossPack
[avr_serial_lcd.git] / gcc_cpp / serial_lcd_cpp.lss
1
2 serial_lcd_cpp.elf:     file format elf32-avr
3
4 Sections:
5 Idx Name          Size      VMA       LMA       File off  Algn
6   0 .text         000002f2  00000000  00000000  00000094  2**1
7                   CONTENTS, ALLOC, LOAD, READONLY, CODE
8   1 .data         0000000c  00800060  000002f2  00000386  2**0
9                   CONTENTS, ALLOC, LOAD, DATA
10   2 .bss          00000032  0080006c  0080006c  00000392  2**0
11                   ALLOC
12   3 .stab         0000069c  00000000  00000000  00000394  2**2
13                   CONTENTS, READONLY, DEBUGGING
14   4 .stabstr      00000082  00000000  00000000  00000a30  2**0
15                   CONTENTS, READONLY, DEBUGGING
16   5 .debug_aranges 00000020  00000000  00000000  00000ab2  2**0
17                   CONTENTS, READONLY, DEBUGGING
18   6 .debug_pubnames 00000115  00000000  00000000  00000ad2  2**0
19                   CONTENTS, READONLY, DEBUGGING
20   7 .debug_info   00000fd4  00000000  00000000  00000be7  2**0
21                   CONTENTS, READONLY, DEBUGGING
22   8 .debug_abbrev 0000040f  00000000  00000000  00001bbb  2**0
23                   CONTENTS, READONLY, DEBUGGING
24   9 .debug_line   000006dc  00000000  00000000  00001fca  2**0
25                   CONTENTS, READONLY, DEBUGGING
26  10 .debug_frame  00000080  00000000  00000000  000026a8  2**2
27                   CONTENTS, READONLY, DEBUGGING
28  11 .debug_str    00000772  00000000  00000000  00002728  2**0
29                   CONTENTS, READONLY, DEBUGGING
30  12 .debug_loc    000001e8  00000000  00000000  00002e9a  2**0
31                   CONTENTS, READONLY, DEBUGGING
32  13 .debug_ranges 00000048  00000000  00000000  00003082  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:   24 c1           rjmp    .+584           ; 0x258 <__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:   3c c1           rjmp    .+632           ; 0x294 <__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:   e2 ef           ldi     r30, 0xF2       ; 242
69   36:   f2 e0           ldi     r31, 0x02       ; 2
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:   ae 39           cpi     r26, 0x9E       ; 158
92   50:   b1 07           cpc     r27, r17
93   52:   e1 f7           brne    .-8             ; 0x4c <.do_clear_bss_loop>
94   54:   3c d0           rcall   .+120           ; 0xce <main>
95   56:   4b c1           rjmp    .+662           ; 0x2ee <_exit>
96
97 00000058 <__bad_interrupt>:
98   58:   d3 cf           rjmp    .-90            ; 0x0 <__vectors>
99
100 0000005a <_ZN4Uart10waitRxCharEv>:
101   
102 #define UART_UBRR(baud) ((F_CPU+(8*(unsigned long) (baud)))/ (16*((unsigned long) (baud))) - 1)
103 const prog_uint8_t Uart::BaudLookupTable[] =
104   {UART_UBRR(115200), UART_UBRR(38400), UART_UBRR(19200), UART_UBRR(9600)};
105
106 unsigned char Uart::waitRxChar (void) {
107   5a:   fc 01           movw    r30, r24
108   // waits for next RX character, then return it
109   unsigned char tail;
110   do {
111     tail = sUartRxTail; // explicitly set order of volatile variable access
112   5c:   86 2d           mov     r24, r6
113   {UART_UBRR(115200), UART_UBRR(38400), UART_UBRR(19200), UART_UBRR(9600)};
114
115 unsigned char Uart::waitRxChar (void) {
116   // waits for next RX character, then return it
117   unsigned char tail;
118   do {
119   5e:   95 2d           mov     r25, r5
120     WDTCSR &= ~(1<<WDCE);
121     sei();
122   }
123   
124   INLINE_FUNC_DECLARE(static void reset(void)) { 
125     wdt_reset(); 
126   60:   a8 95           wdr
127   {UART_UBRR(115200), UART_UBRR(38400), UART_UBRR(19200), UART_UBRR(9600)};
128
129 unsigned char Uart::waitRxChar (void) {
130   // waits for next RX character, then return it
131   unsigned char tail;
132   do {
133   62:   98 17           cp      r25, r24
134   64:   e9 f3           breq    .-6             ; 0x60 <_ZN4Uart10waitRxCharEv+0x6>
135   //  CTS inactive if byte fills buffer after we remove current byte
136   cli();
137 #endif
138
139   // increment tail position 
140   if (tail == UART_RX_BUFFER_SIZE-1)
141   66:   8f 32           cpi     r24, 0x2F       ; 47
142   68:   11 f4           brne    .+4             ; 0x6e <_ZN4Uart10waitRxCharEv+0x14>
143     sUartRxTail = 0;
144   6a:   66 24           eor     r6, r6
145   6c:   01 c0           rjmp    .+2             ; 0x70 <_ZN4Uart10waitRxCharEv+0x16>
146   else
147     sUartRxTail++;
148   6e:   63 94           inc     r6
149 #if USE_CTS
150   CTS_PORT |= (1<<CTS_PIN); // Ensure CTS is active since just removed a byte
151   sei();   // Allow UART ISR to read character and change potentially change CTS
152 #endif
153
154   return m_UartRxBuf[sUartRxTail];
155   70:   e6 0d           add     r30, r6
156   72:   f1 1d           adc     r31, r1
157   74:   80 81           ld      r24, Z
158 }
159   76:   08 95           ret
160
161 00000078 <_ZN3Lcd8busyWaitEv>:
162   LCD_CONTROL_PORT &= ~(1<<LCD_E);
163 }
164
165 unsigned char Lcd::busyWait (void) {
166   unsigned char LCDStatus; 
167   LCD_DATA_DIR = 0x00; // Set LCD data port to inputs
168   78:   17 ba           out     0x17, r1        ; 23
169   LCD_CONTROL_PORT |= (1<<LCD_RW);
170   7a:   94 9a           sbi     0x12, 4 ; 18
171   NOP();
172   7c:   00 00           nop
173     WDTCSR &= ~(1<<WDCE);
174     sei();
175   }
176   
177   INLINE_FUNC_DECLARE(static void reset(void)) { 
178     wdt_reset(); 
179   7e:   a8 95           wdr
180   LCD_DATA_DIR = 0x00; // Set LCD data port to inputs
181   LCD_CONTROL_PORT |= (1<<LCD_RW);
182   NOP();
183   do {
184     Watchdog::reset();
185     LCD_CONTROL_PORT |= (1<<LCD_E);     
186   80:   96 9a           sbi     0x12, 6 ; 18
187   #else
188     #define ENABLE_WAIT() __delay_cycles(4);
189   #endif
190 #elif defined(__GNUC__)
191   static __inline__ void _NOP1 (void) { __asm__ volatile ( "nop    " "\n\t" ); }
192   static __inline__ void _NOP2 (void) { __asm__ volatile ( "rjmp 1f" "\n\t"  "1:" "\n\t" ); }
193   82:   00 c0           rjmp    .+0             ; 0x84 <_ZN3Lcd8busyWaitEv+0xc>
194     ENABLE_WAIT();
195     LCDStatus = LCD_DATA_PIN_REG;
196   84:   00 c0           rjmp    .+0             ; 0x86 <_ZN3Lcd8busyWaitEv+0xe>
197   86:   96 b3           in      r25, 0x16       ; 22
198     LCD_CONTROL_PORT &= ~(1<<LCD_E);
199   88:   96 98           cbi     0x12, 6 ; 18
200 unsigned char Lcd::busyWait (void) {
201   unsigned char LCDStatus; 
202   LCD_DATA_DIR = 0x00; // Set LCD data port to inputs
203   LCD_CONTROL_PORT |= (1<<LCD_RW);
204   NOP();
205   do {
206   8a:   97 fd           sbrc    r25, 7
207   8c:   f8 cf           rjmp    .-16            ; 0x7e <_ZN3Lcd8busyWaitEv+0x6>
208     LCD_CONTROL_PORT |= (1<<LCD_E);     
209     ENABLE_WAIT();
210     LCDStatus = LCD_DATA_PIN_REG;
211     LCD_CONTROL_PORT &= ~(1<<LCD_E);
212   } while (LCDStatus & (1<<LCD_BUSY));
213   LCD_CONTROL_PORT &= ~(1<<LCD_RW);     
214   8e:   94 98           cbi     0x12, 4 ; 18
215   LCD_DATA_DIR = 0xFF; // Set LCD data port to default output state
216   90:   8f ef           ldi     r24, 0xFF       ; 255
217   92:   87 bb           out     0x17, r24       ; 23
218   return (LCDStatus);
219 }                
220   94:   89 2f           mov     r24, r25
221   96:   08 95           ret
222
223 00000098 <_ZN3Lcd7putCharEh>:
224   LCD_CONTROL_PORT &= ~(1<<LCD_E);
225   NOP();
226   LCD_CONTROL_PORT |= (1<<LCD_RS);
227 }
228
229 void Lcd::putChar (unsigned char c) {
230   98:   1f 93           push    r17
231   9a:   16 2f           mov     r17, r22
232   LCD_CONTROL_PORT &= ~(1<<LCD_RS);
233   9c:   95 98           cbi     0x12, 5 ; 18
234   busyWait();
235   9e:   ec df           rcall   .-40            ; 0x78 <_ZN3Lcd8busyWaitEv>
236   LCD_CONTROL_PORT |= (1<<LCD_RS);
237   a0:   95 9a           sbi     0x12, 5 ; 18
238   LCD_DATA_PORT = c;
239   a2:   18 bb           out     0x18, r17       ; 24
240   NOP();
241   a4:   00 00           nop
242   LCD_CONTROL_PORT |= (1<<LCD_E);
243   a6:   96 9a           sbi     0x12, 6 ; 18
244   a8:   00 c0           rjmp    .+0             ; 0xaa <_ZN3Lcd7putCharEh+0x12>
245   ENABLE_WAIT();
246   LCD_CONTROL_PORT &= ~(1<<LCD_E);
247   aa:   00 c0           rjmp    .+0             ; 0xac <_ZN3Lcd7putCharEh+0x14>
248   ac:   96 98           cbi     0x12, 6 ; 18
249 }
250   ae:   1f 91           pop     r17
251   b0:   08 95           ret
252
253 000000b2 <_ZN3Lcd6putCmdEh>:
254     }
255   }
256   MAIN_FUNC_LAST();
257 }
258
259 void Lcd::putCmd (unsigned char Cmd) {
260   b2:   1f 93           push    r17
261   b4:   16 2f           mov     r17, r22
262   LCD_CONTROL_PORT &= ~(1<<LCD_RS);
263   b6:   95 98           cbi     0x12, 5 ; 18
264   busyWait();
265   b8:   df df           rcall   .-66            ; 0x78 <_ZN3Lcd8busyWaitEv>
266   LCD_DATA_PORT = Cmd;  
267   ba:   18 bb           out     0x18, r17       ; 24
268   NOP();
269   bc:   00 00           nop
270   LCD_CONTROL_PORT |= (1<<LCD_E);
271   be:   96 9a           sbi     0x12, 6 ; 18
272   c0:   00 c0           rjmp    .+0             ; 0xc2 <_ZN3Lcd6putCmdEh+0x10>
273   ENABLE_WAIT();
274   LCD_CONTROL_PORT &= ~(1<<LCD_E);
275   c2:   00 c0           rjmp    .+0             ; 0xc4 <_ZN3Lcd6putCmdEh+0x12>
276   c4:   96 98           cbi     0x12, 6 ; 18
277   NOP();
278   c6:   00 00           nop
279   LCD_CONTROL_PORT |= (1<<LCD_RS);
280   c8:   95 9a           sbi     0x12, 5 ; 18
281 }
282   ca:   1f 91           pop     r17
283   cc:   08 95           ret
284
285 000000ce <main>:
286   }
287 };
288
289
290 MAIN_FUNC() {
291   MCUSR = 0; // clear all reset flags
292   ce:   14 be           out     0x34, r1        ; 52
293     WDTCSR &= ~(1<<WDCE);
294     sei();
295   }
296   
297   INLINE_FUNC_DECLARE(static void reset(void)) { 
298     wdt_reset(); 
299   d0:   a8 95           wdr
300
301 class Watchdog {
302 public:
303   INLINE_FUNC_DECLARE(static void init(void)) {
304     reset();
305     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
306   d2:   81 b5           in      r24, 0x21       ; 33
307   d4:   88 61           ori     r24, 0x18       ; 24
308   d6:   81 bd           out     0x21, r24       ; 33
309     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
310   d8:   89 e2           ldi     r24, 0x29       ; 41
311   da:   81 bd           out     0x21, r24       ; 33
312 };
313   
314 class SleepMode {
315 public:
316   INLINE_FUNC_DECLARE(static void initIdleMode(void)) {
317     MCUCR &= ~((1<<SM1)|(1<<SM0)); // use idle sleep mode
318   dc:   85 b7           in      r24, 0x35       ; 53
319   de:   8f 7a           andi    r24, 0xAF       ; 175
320   e0:   85 bf           out     0x35, r24       ; 53
321
322 public:
323   INLINE_FUNC_DECLARE(void init(void)) {
324     // setup PWM to run at 1.25ms per interrupt. 
325     // This allows 8 levels of brightness at minimum of 100Hz flicker rate.
326     TCCR0A = (1<<WGM01); // CTC mode
327   e2:   82 e0           ldi     r24, 0x02       ; 2
328   e4:   80 bf           out     0x30, r24       ; 48
329     TCCR0B = 0; // timer off
330   e6:   13 be           out     0x33, r1        ; 51
331     OCR0A = 72; // 1.25ms with CLK/256 prescaler @ 14.7456MHz
332   e8:   88 e4           ldi     r24, 0x48       ; 72
333   ea:   86 bf           out     0x36, r24       ; 54
334     TIMSK = (1<<OCIE0A); // Turn on timer0 COMPA intr (all other timer intr off)
335   ec:   81 e0           ldi     r24, 0x01       ; 1
336   ee:   89 bf           out     0x39, r24       ; 57
337 #if USE_LED_PWM_IO_MEMBERS
338     *m_LedPortPtr &= ~(1<<m_LedPin); // Ensure LED is off during initialization
339     *m_LedDirPtr |= (1<<m_LedPin); // Ensure LED is output port
340 #else
341     LED_PORT &= ~(1<<LED_PIN); // Ensure LED is off during initialization
342   f0:   91 98           cbi     0x12, 1 ; 18
343     LED_DIR |= (1<<LED_PIN); // Ensure LED is output port
344   f2:   89 9a           sbi     0x11, 1 ; 17
345 #endif
346     BIT_led_on = 0;  // note that LED is off
347   f4:   a0 98           cbi     0x14, 0 ; 20
348     ledPwmPattern = 0xFF;  // maximum brightness
349   f6:   9f ef           ldi     r25, 0xFF       ; 255
350   f8:   93 bb           out     0x13, r25       ; 19
351   static const unsigned char m_DATA_8 = 0x30;
352
353 public:
354   INLINE_FUNC_DECLARE(void init(void)) {
355     // Set BAUD_J2:BAUD_J1 PULL-UPS active
356     LCD_CONTROL_PORT = (1<<BAUD_J2) | (1<<BAUD_J1);
357   fa:   8c e0           ldi     r24, 0x0C       ; 12
358   fc:   82 bb           out     0x12, r24       ; 18
359     // Set LCD_control BAUD_J2:BAUD_J1 to inputs        
360     LCD_CONTROL_DIR = 0xF2;
361   fe:   82 ef           ldi     r24, 0xF2       ; 242
362  100:   81 bb           out     0x11, r24       ; 17
363         __asm__ volatile (
364                 "1: sbiw %0,1" "\n\t"
365                 "brne 1b"
366                 : "=w" (__count)
367                 : "0" (__count)
368         );
369  102:   e0 e0           ldi     r30, 0x00       ; 0
370  104:   f8 ed           ldi     r31, 0xD8       ; 216
371  106:   31 97           sbiw    r30, 0x01       ; 1
372  108:   f1 f7           brne    .-4             ; 0x106 <__stack+0x27>
373     
374     Delay::millisec(15);
375     
376     LCD_CONTROL_PORT |= (1<<LCD_RS); // Set LCD_RS HIGH
377  10a:   95 9a           sbi     0x12, 5 ; 18
378     
379     // Initialize the AVR controller I/O
380     LCD_DATA_DIR = 0xFF; // Set LCD_DATA_PORT as all outputs
381  10c:   97 bb           out     0x17, r25       ; 23
382     LCD_DATA_PORT = 0x00; // Set LCD_DATA_PORT to logic low
383  10e:   18 ba           out     0x18, r1        ; 24
384     
385     // Initialize the LCD controller
386     LCD_CONTROL_PORT &= ~(1<<LCD_RS);
387  110:   95 98           cbi     0x12, 5 ; 18
388     
389     putChar (m_DATA_8); 
390  112:   8d e6           ldi     r24, 0x6D       ; 109
391  114:   90 e0           ldi     r25, 0x00       ; 0
392  116:   60 e3           ldi     r22, 0x30       ; 48
393  118:   bf df           rcall   .-130           ; 0x98 <_ZN3Lcd7putCharEh>
394  11a:   8a e0           ldi     r24, 0x0A       ; 10
395  11c:   9b e3           ldi     r25, 0x3B       ; 59
396  11e:   01 97           sbiw    r24, 0x01       ; 1
397  120:   f1 f7           brne    .-4             ; 0x11e <__stack+0x3f>
398     Delay::millisec(4.1);
399     
400     putChar (m_DATA_8);
401  122:   8d e6           ldi     r24, 0x6D       ; 109
402  124:   90 e0           ldi     r25, 0x00       ; 0
403  126:   60 e3           ldi     r22, 0x30       ; 48
404  128:   b7 df           rcall   .-146           ; 0x98 <_ZN3Lcd7putCharEh>
405  12a:   80 e7           ldi     r24, 0x70       ; 112
406  12c:   91 e0           ldi     r25, 0x01       ; 1
407  12e:   01 97           sbiw    r24, 0x01       ; 1
408  130:   f1 f7           brne    .-4             ; 0x12e <__stack+0x4f>
409     Delay::microsec(100);
410     
411     putChar (m_DATA_8);
412  132:   8d e6           ldi     r24, 0x6D       ; 109
413  134:   90 e0           ldi     r25, 0x00       ; 0
414  136:   60 e3           ldi     r22, 0x30       ; 48
415  138:   af df           rcall   .-162           ; 0x98 <_ZN3Lcd7putCharEh>
416     LCD_CONTROL_PORT |= (1<<LCD_RS);
417  13a:   95 9a           sbi     0x12, 5 ; 18
418     
419     // The display will be out into 8 bit data mode here
420     putCmd (m_LINE_8x4); // Set 8 bit data, 4 display lines
421  13c:   8d e6           ldi     r24, 0x6D       ; 109
422  13e:   90 e0           ldi     r25, 0x00       ; 0
423  140:   68 e3           ldi     r22, 0x38       ; 56
424  142:   b7 df           rcall   .-146           ; 0xb2 <_ZN3Lcd6putCmdEh>
425     putCmd (m_PWR_ON); // Power up the display
426  144:   8d e6           ldi     r24, 0x6D       ; 109
427  146:   90 e0           ldi     r25, 0x00       ; 0
428  148:   6c e0           ldi     r22, 0x0C       ; 12
429  14a:   b3 df           rcall   .-154           ; 0xb2 <_ZN3Lcd6putCmdEh>
430     putCmd (m_CLR_DSP); // Power up the display
431  14c:   8d e6           ldi     r24, 0x6D       ; 109
432  14e:   90 e0           ldi     r25, 0x00       ; 0
433  150:   61 e0           ldi     r22, 0x01       ; 1
434  152:   af df           rcall   .-162           ; 0xb2 <_ZN3Lcd6putCmdEh>
435   }
436
437 public:
438   INLINE_FUNC_DECLARE(void init(void)) {
439     // Initialize UART0 
440     UCSRB = 0; // Disable while setting baud rate
441  154:   1a b8           out     0x0a, r1        ; 10
442     UCSRA = 0;
443  156:   1b b8           out     0x0b, r1        ; 11
444     UCSRC = (1<<UCSZ1) | (1<<UCSZ0); // 8 bit data
445  158:   86 e0           ldi     r24, 0x06       ; 6
446  15a:   83 b9           out     0x03, r24       ; 3
447
448   INLINE_FUNC_DECLARE(static unsigned char baud()) {
449     unsigned char BaudSelectJumpersValue;
450   
451     // Get BAUD rate jumper settings       
452     BaudSelectJumpersValue  = BAUD_PIN_REG;
453  15c:   e0 b3           in      r30, 0x10       ; 16
454     BaudSelectJumpersValue &= (1<<BAUD_J2) | (1<<BAUD_J1);
455     // BAUD_J2 = PD.3, BAUD_J1 = PD.2
456     // This is two bits too far to the left and the array index will
457     // increment by 4, instead of 1.
458     // Shift BAUD_J2 & BAUD_J1 right by two bit positions for proper array indexing
459     BaudSelectJumpersValue = (BaudSelectJumpersValue >> BAUD_J1);
460  15e:   ec 70           andi    r30, 0x0C       ; 12
461     
462     return PGM_READ_BYTE (&BaudLookupTable[BaudSelectJumpersValue]);
463  160:   e6 95           lsr     r30
464  162:   e6 95           lsr     r30
465  164:   f0 e0           ldi     r31, 0x00       ; 0
466  166:   e8 59           subi    r30, 0x98       ; 152
467  168:   ff 4f           sbci    r31, 0xFF       ; 255
468  16a:   e4 91           lpm     r30, Z+
469   INLINE_FUNC_DECLARE(void init(void)) {
470     // Initialize UART0 
471     UCSRB = 0; // Disable while setting baud rate
472     UCSRA = 0;
473     UCSRC = (1<<UCSZ1) | (1<<UCSZ0); // 8 bit data
474     UBRRL = baud();
475  16c:   e9 b9           out     0x09, r30       ; 9
476     UBRRH = 0; // Set baud rate hi
477  16e:   12 b8           out     0x02, r1        ; 2
478     UCSRB = (1<<RXEN)|(1<<RXCIE); // RXEN = Enable
479  170:   80 e9           ldi     r24, 0x90       ; 144
480  172:   8a b9           out     0x0a, r24       ; 10
481
482     // Init circular buffer pointers
483     sUartRxHead = 0;
484  174:   55 24           eor     r5, r5
485     sUartRxTail = 0;
486  176:   66 24           eor     r6, r6
487
488   gLed.init();
489   gLcd.init();
490   gUart.init();   // Initialize the AVR USART   
491
492   sei();
493  178:   78 94           sei
494
495   INLINE_FUNC_DECLARE(void stop(void)) {
496     TCCR0B = 0;
497   }
498   INLINE_FUNC_DECLARE(void start(void)) {
499     TCCR0B = (1<<CS02);
500  17a:   14 e0           ldi     r17, 0x04       ; 4
501     return 1;
502   }
503
504   INLINE_FUNC_DECLARE(unsigned char charAvail(void)) {
505     unsigned char tail = sUartRxTail; // explicitly set order of volatile access
506     return (tail != sUartRxHead) ? 1 : 0;
507  17c:   65 14           cp      r6, r5
508  17e:   09 f4           brne    .+2             ; 0x182 <__stack+0xa3>
509  180:   4e c0           rjmp    .+156           ; 0x21e <__stack+0x13f>
510   gUart.init();   // Initialize the AVR USART   
511
512   sei();
513   while (1) {
514     if (gUart.charAvail()) {
515       SerialCommandProcessor::processChar (gUart.waitRxChar());
516  182:   8e e6           ldi     r24, 0x6E       ; 110
517  184:   90 e0           ldi     r25, 0x00       ; 0
518  186:   69 df           rcall   .-302           ; 0x5a <_ZN4Uart10waitRxCharEv>
519  188:   68 2f           mov     r22, r24
520
521 public:
522   INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) {
523     // avoid use of switch statement as ImageCraft and GCC produce signifcantly
524     // more code for a switch statement than a sequence of if/else if
525     if (ch == m_LED_SW_OFF) {
526  18a:   8d 3f           cpi     r24, 0xFD       ; 253
527  18c:   21 f4           brne    .+8             ; 0x196 <__stack+0xb7>
528
529   INLINE_FUNC_DECLARE(void lampOff(void)) {
530 #if USE_LED_PWM_IO_MEMBERS
531     *m_LedPortPtr &= ~(1<<m_LedPin);;
532 #else
533     LED_PORT &= ~(1<<LED_PIN);;
534  18e:   91 98           cbi     0x12, 1 ; 18
535     TCCR0B = (1<<CS02);
536   }
537
538   INLINE_FUNC_DECLARE(void switchOff(void)) {
539     lampOff();
540     BIT_led_on = 0;
541  190:   a0 98           cbi     0x14, 0 ; 20
542     BIT_led_on = 0;  // note that LED is off
543     ledPwmPattern = 0xFF;  // maximum brightness
544   }
545
546   INLINE_FUNC_DECLARE(void stop(void)) {
547     TCCR0B = 0;
548  192:   13 be           out     0x33, r1        ; 51
549  194:   f3 cf           rjmp    .-26            ; 0x17c <__stack+0x9d>
550   INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) {
551     // avoid use of switch statement as ImageCraft and GCC produce signifcantly
552     // more code for a switch statement than a sequence of if/else if
553     if (ch == m_LED_SW_OFF) {
554       gLed.switchOff();
555     } else if (ch == m_LED_SW_ON) {
556  196:   8c 3f           cpi     r24, 0xFC       ; 252
557  198:   29 f4           brne    .+10            ; 0x1a4 <__stack+0xc5>
558     BIT_led_on = 0;
559     stop();
560   }
561
562   INLINE_FUNC_DECLARE(void switchOn(void)) {
563     BIT_led_on = 1;
564  19a:   a0 9a           sbi     0x14, 0 ; 20
565     if (ledPwmPattern == 0xFF) { // maximum brightness, no need for PWM
566  19c:   83 b3           in      r24, 0x13       ; 19
567  19e:   8f 3f           cpi     r24, 0xFF       ; 255
568  1a0:   71 f5           brne    .+92            ; 0x1fe <__stack+0x11f>
569  1a2:   28 c0           rjmp    .+80            ; 0x1f4 <__stack+0x115>
570     // more code for a switch statement than a sequence of if/else if
571     if (ch == m_LED_SW_OFF) {
572       gLed.switchOff();
573     } else if (ch == m_LED_SW_ON) {
574       gLed.switchOn();
575     } else if (ch == m_LED_SET_BRIGHTNESS) {
576  1a4:   8b 3f           cpi     r24, 0xFB       ; 251
577  1a6:   69 f5           brne    .+90            ; 0x202 <__stack+0x123>
578       // read next byte which will be brightness
579       gLed.setBrightness(gUart.waitRxChar());
580  1a8:   8e e6           ldi     r24, 0x6E       ; 110
581  1aa:   90 e0           ldi     r25, 0x00       ; 0
582  1ac:   56 df           rcall   .-340           ; 0x5a <_ZN4Uart10waitRxCharEv>
583       start();
584     }
585   }
586
587   INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) {
588     if (brightness == 0) { // turn backlight off for 0 brightness
589  1ae:   88 23           and     r24, r24
590  1b0:   39 f4           brne    .+14            ; 0x1c0 <__stack+0xe1>
591       if (BIT_led_on) {
592  1b2:   a0 9b           sbis    0x14, 0 ; 20
593  1b4:   e3 cf           rjmp    .-58            ; 0x17c <__stack+0x9d>
594     BIT_led_on = 0;  // note that LED is off
595     ledPwmPattern = 0xFF;  // maximum brightness
596   }
597
598   INLINE_FUNC_DECLARE(void stop(void)) {
599     TCCR0B = 0;
600  1b6:   13 be           out     0x33, r1        ; 51
601
602   INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) {
603     if (brightness == 0) { // turn backlight off for 0 brightness
604       if (BIT_led_on) {
605         stop();
606         ledPwmPattern = 0;
607  1b8:   13 ba           out     0x13, r1        ; 19
608         ledPwmCycling = 0;
609  1ba:   77 24           eor     r7, r7
610
611   INLINE_FUNC_DECLARE(void lampOff(void)) {
612 #if USE_LED_PWM_IO_MEMBERS
613     *m_LedPortPtr &= ~(1<<m_LedPin);;
614 #else
615     LED_PORT &= ~(1<<LED_PIN);;
616  1bc:   91 98           cbi     0x12, 1 ; 18
617  1be:   de cf           rjmp    .-68            ; 0x17c <__stack+0x9d>
618         lampOff();
619       }
620       return;
621     }
622
623     unsigned char ledPwmPos = (brightness * (LED_BRIGHTNESS_LEVELS-1) + 127) >> 8; 
624  1c0:   90 e0           ldi     r25, 0x00       ; 0
625  1c2:   67 e0           ldi     r22, 0x07       ; 7
626  1c4:   70 e0           ldi     r23, 0x00       ; 0
627  1c6:   81 d0           rcall   .+258           ; 0x2ca <__mulhi3>
628  1c8:   81 58           subi    r24, 0x81       ; 129
629  1ca:   9f 4f           sbci    r25, 0xFF       ; 255
630  1cc:   89 2f           mov     r24, r25
631  1ce:   99 0f           add     r25, r25
632  1d0:   99 0b           sbc     r25, r25
633  1d2:   98 2f           mov     r25, r24
634  1d4:   88 30           cpi     r24, 0x08       ; 8
635  1d6:   08 f0           brcs    .+2             ; 0x1da <__stack+0xfb>
636  1d8:   97 e0           ldi     r25, 0x07       ; 7
637     LED_PORT &= ~(1<<LED_PIN);;
638 #endif
639   }
640
641   INLINE_FUNC_DECLARE(unsigned char pwmPattern(unsigned char pos)) {
642     return PGM_READ_BYTE (&ledPwmPatterns[pos]);
643  1da:   e9 2f           mov     r30, r25
644  1dc:   f0 e0           ldi     r31, 0x00       ; 0
645  1de:   e0 5a           subi    r30, 0xA0       ; 160
646  1e0:   ff 4f           sbci    r31, 0xFF       ; 255
647  1e2:   e4 91           lpm     r30, Z+
648
649     unsigned char ledPwmPos = (brightness * (LED_BRIGHTNESS_LEVELS-1) + 127) >> 8; 
650     // Below is probably not required, but ensures we don't exceed array
651     if (ledPwmPos > LED_BRIGHTNESS_LEVELS - 1)
652       ledPwmPos = LED_BRIGHTNESS_LEVELS - 1;
653     ledPwmPattern = pwmPattern(ledPwmPos);
654  1e4:   e3 bb           out     0x13, r30       ; 19
655     ledPwmCount = 0;
656  1e6:   44 24           eor     r4, r4
657     ledPwmCycling = ledPwmPattern;
658  1e8:   83 b3           in      r24, 0x13       ; 19
659  1ea:   78 2e           mov     r7, r24
660     if (ledPwmPos >= LED_BRIGHTNESS_LEVELS-1) { // maximum brightness
661  1ec:   97 30           cpi     r25, 0x07       ; 7
662  1ee:   29 f4           brne    .+10            ; 0x1fa <__stack+0x11b>
663       // don't need PWM to continuously on
664       if (BIT_led_on) {
665  1f0:   a0 9b           sbis    0x14, 0 ; 20
666  1f2:   c4 cf           rjmp    .-120           ; 0x17c <__stack+0x9d>
667     BIT_led_on = 0;  // note that LED is off
668     ledPwmPattern = 0xFF;  // maximum brightness
669   }
670
671   INLINE_FUNC_DECLARE(void stop(void)) {
672     TCCR0B = 0;
673  1f4:   13 be           out     0x33, r1        ; 51
674
675   INLINE_FUNC_DECLARE(void lampOn(void)) {
676 #if USE_LED_PWM_IO_MEMBERS
677     *m_LedPortPtr |= (1<<m_LedPin);
678 #else
679     LED_PORT |= (1<<LED_PIN);
680  1f6:   91 9a           sbi     0x12, 1 ; 18
681  1f8:   c1 cf           rjmp    .-126           ; 0x17c <__stack+0x9d>
682       if (BIT_led_on) {
683         stop();
684         lampOn();
685       }
686     } else {
687       if (BIT_led_on) {
688  1fa:   a0 9b           sbis    0x14, 0 ; 20
689  1fc:   bf cf           rjmp    .-130           ; 0x17c <__stack+0x9d>
690
691   INLINE_FUNC_DECLARE(void stop(void)) {
692     TCCR0B = 0;
693   }
694   INLINE_FUNC_DECLARE(void start(void)) {
695     TCCR0B = (1<<CS02);
696  1fe:   13 bf           out     0x33, r17       ; 51
697  200:   bd cf           rjmp    .-134           ; 0x17c <__stack+0x9d>
698     } else if (ch == m_LED_SW_ON) {
699       gLed.switchOn();
700     } else if (ch == m_LED_SET_BRIGHTNESS) {
701       // read next byte which will be brightness
702       gLed.setBrightness(gUart.waitRxChar());
703     } else if (ch == m_REG_MODE) {
704  202:   8e 3f           cpi     r24, 0xFE       ; 254
705  204:   41 f4           brne    .+16            ; 0x216 <__stack+0x137>
706       gLcd.putCmd (gUart.waitRxChar()); // Send LCD command character
707  206:   8e e6           ldi     r24, 0x6E       ; 110
708  208:   90 e0           ldi     r25, 0x00       ; 0
709  20a:   27 df           rcall   .-434           ; 0x5a <_ZN4Uart10waitRxCharEv>
710  20c:   68 2f           mov     r22, r24
711  20e:   8d e6           ldi     r24, 0x6D       ; 109
712  210:   90 e0           ldi     r25, 0x00       ; 0
713  212:   4f df           rcall   .-354           ; 0xb2 <_ZN3Lcd6putCmdEh>
714  214:   b3 cf           rjmp    .-154           ; 0x17c <__stack+0x9d>
715     } else {
716       gLcd.putChar (ch); // Send LCD data character
717  216:   8d e6           ldi     r24, 0x6D       ; 109
718  218:   90 e0           ldi     r25, 0x00       ; 0
719  21a:   3e df           rcall   .-388           ; 0x98 <_ZN3Lcd7putCharEh>
720  21c:   af cf           rjmp    .-162           ; 0x17c <__stack+0x9d>
721     reset();
722     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
723     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
724   }
725   INLINE_FUNC_DECLARE(static void off(void)) {
726     cli();
727  21e:   f8 94           cli
728     WDTCSR &= ~(1<<WDCE);
729     sei();
730   }
731   
732   INLINE_FUNC_DECLARE(static void reset(void)) { 
733     wdt_reset(); 
734  220:   a8 95           wdr
735     WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0); // 1024K cycles, 8.0sec
736   }
737   INLINE_FUNC_DECLARE(static void off(void)) {
738     cli();
739     reset();
740     MCUSR &= ~(1<<WDRF); // clear any watchdog interrupt flags
741  222:   84 b7           in      r24, 0x34       ; 52
742  224:   87 7f           andi    r24, 0xF7       ; 247
743  226:   84 bf           out     0x34, r24       ; 52
744     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
745  228:   81 b5           in      r24, 0x21       ; 33
746  22a:   88 61           ori     r24, 0x18       ; 24
747  22c:   81 bd           out     0x21, r24       ; 33
748     WDTCSR &= ~(1<<WDE); // watchdog timer off
749  22e:   81 b5           in      r24, 0x21       ; 33
750  230:   87 7f           andi    r24, 0xF7       ; 247
751  232:   81 bd           out     0x21, r24       ; 33
752     sei();
753  234:   78 94           sei
754 public:
755   INLINE_FUNC_DECLARE(static void initIdleMode(void)) {
756     MCUCR &= ~((1<<SM1)|(1<<SM0)); // use idle sleep mode
757   }
758   INLINE_FUNC_DECLARE(static void enterSleep()) {
759     sleep_enable();
760  236:   85 b7           in      r24, 0x35       ; 53
761  238:   80 62           ori     r24, 0x20       ; 32
762  23a:   85 bf           out     0x35, r24       ; 53
763     sleep_cpu();
764  23c:   88 95           sleep
765     sleep_disable();
766  23e:   85 b7           in      r24, 0x35       ; 53
767  240:   8f 7d           andi    r24, 0xDF       ; 223
768  242:   85 bf           out     0x35, r24       ; 53
769     WDTCSR &= ~(1<<WDE); // watchdog timer off
770     sei();
771   }
772   
773   INLINE_FUNC_DECLARE(static void on(void)) {
774     cli();
775  244:   f8 94           cli
776     WDTCSR &= ~(1<<WDCE);
777     sei();
778   }
779   
780   INLINE_FUNC_DECLARE(static void reset(void)) { 
781     wdt_reset(); 
782  246:   a8 95           wdr
783   }
784   
785   INLINE_FUNC_DECLARE(static void on(void)) {
786     cli();
787     reset();
788     WDTCSR |= (1<<WDCE)|(1<<WDE); // start timed sequence (keep old prescaler)
789  248:   81 b5           in      r24, 0x21       ; 33
790  24a:   88 61           ori     r24, 0x18       ; 24
791  24c:   81 bd           out     0x21, r24       ; 33
792     WDTCSR &= ~(1<<WDCE);
793  24e:   81 b5           in      r24, 0x21       ; 33
794  250:   8f 7e           andi    r24, 0xEF       ; 239
795  252:   81 bd           out     0x21, r24       ; 33
796     sei();
797  254:   78 94           sei
798  256:   92 cf           rjmp    .-220           ; 0x17c <__stack+0x9d>
799
800 00000258 <__vector_7>:
801   LCD_DATA_DIR = 0xFF; // Set LCD data port to default output state
802   return (LCDStatus);
803 }                
804
805
806 ISR(USART_RX_vect)
807  258:   1f 92           push    r1
808  25a:   0f 92           push    r0
809  25c:   0f b6           in      r0, 0x3f        ; 63
810  25e:   0f 92           push    r0
811  260:   11 24           eor     r1, r1
812  262:   8f 93           push    r24
813  264:   ef 93           push    r30
814  266:   ff 93           push    r31
815 {
816   gUart.storeChar(UDR);
817  268:   8c b1           in      r24, 0x0c       ; 12
818 #endif
819   }
820
821   INLINE_FUNC_DECLARE(unsigned char storeChar(unsigned char rx)) {
822     // Calculate next buffer position.
823     unsigned char tmphead = sUartRxHead;
824  26a:   e5 2d           mov     r30, r5
825     if (tmphead == UART_RX_BUFFER_SIZE-1)
826  26c:   ef 32           cpi     r30, 0x2F       ; 47
827  26e:   11 f4           brne    .+4             ; 0x274 <__vector_7+0x1c>
828  270:   e0 e0           ldi     r30, 0x00       ; 0
829  272:   01 c0           rjmp    .+2             ; 0x276 <__vector_7+0x1e>
830       tmphead = 0;
831     else
832       tmphead++;
833  274:   ef 5f           subi    r30, 0xFF       ; 255
834     
835     // store in buffer if there is room
836     if (tmphead != sUartRxTail) {
837  276:   e6 15           cp      r30, r6
838  278:   29 f0           breq    .+10            ; 0x284 <__vector_7+0x2c>
839       sUartRxHead = tmphead;         // Store new index.
840  27a:   5e 2e           mov     r5, r30
841       m_UartRxBuf[tmphead] = rx;
842  27c:   f0 e0           ldi     r31, 0x00       ; 0
843  27e:   e2 59           subi    r30, 0x92       ; 146
844  280:   ff 4f           sbci    r31, 0xFF       ; 255
845  282:   80 83           st      Z, r24
846
847
848 ISR(USART_RX_vect)
849 {
850   gUart.storeChar(UDR);
851 }
852  284:   ff 91           pop     r31
853  286:   ef 91           pop     r30
854  288:   8f 91           pop     r24
855  28a:   0f 90           pop     r0
856  28c:   0f be           out     0x3f, r0        ; 63
857  28e:   0f 90           pop     r0
858  290:   1f 90           pop     r1
859  292:   18 95           reti
860
861 00000294 <__vector_13>:
862
863 ISR(TIMER0_COMPA_vect)
864  294:   1f 92           push    r1
865  296:   0f 92           push    r0
866  298:   0f b6           in      r0, 0x3f        ; 63
867  29a:   0f 92           push    r0
868  29c:   11 24           eor     r1, r1
869  29e:   8f 93           push    r24
870 {  
871   sei(); // Okay to allow USART interrupts while controlling LED PWM
872  2a0:   78 94           sei
873       }
874     }
875   }
876
877   INLINE_FUNC_DECLARE(void cyclePwm(void)) {
878     if (ledPwmCycling & 0x01) {   // Set current LED state based on cycling variable
879  2a2:   70 fe           sbrs    r7, 0
880  2a4:   02 c0           rjmp    .+4             ; 0x2aa <__vector_13+0x16>
881
882   INLINE_FUNC_DECLARE(void lampOn(void)) {
883 #if USE_LED_PWM_IO_MEMBERS
884     *m_LedPortPtr |= (1<<m_LedPin);
885 #else
886     LED_PORT |= (1<<LED_PIN);
887  2a6:   91 9a           sbi     0x12, 1 ; 18
888  2a8:   01 c0           rjmp    .+2             ; 0x2ac <__vector_13+0x18>
889
890   INLINE_FUNC_DECLARE(void lampOff(void)) {
891 #if USE_LED_PWM_IO_MEMBERS
892     *m_LedPortPtr &= ~(1<<m_LedPin);;
893 #else
894     LED_PORT &= ~(1<<LED_PIN);;
895  2aa:   91 98           cbi     0x12, 1 ; 18
896     } else {
897       lampOff();
898     }
899
900     // Update cycling variable for next interrupt
901     if (ledPwmCount >= LED_BRIGHTNESS_LEVELS-1) {
902  2ac:   86 e0           ldi     r24, 0x06       ; 6
903  2ae:   84 15           cp      r24, r4
904  2b0:   20 f4           brcc    .+8             ; 0x2ba <__vector_13+0x26>
905       ledPwmCount = 0;
906  2b2:   44 24           eor     r4, r4
907       ledPwmCycling = ledPwmPattern;
908  2b4:   83 b3           in      r24, 0x13       ; 19
909  2b6:   78 2e           mov     r7, r24
910  2b8:   02 c0           rjmp    .+4             ; 0x2be <__vector_13+0x2a>
911     } else {
912       ledPwmCount++;
913  2ba:   43 94           inc     r4
914       ledPwmCycling >>= 1;
915  2bc:   76 94           lsr     r7
916 ISR(TIMER0_COMPA_vect)
917 {  
918   sei(); // Okay to allow USART interrupts while controlling LED PWM
919
920   gLed.cyclePwm();
921 }
922  2be:   8f 91           pop     r24
923  2c0:   0f 90           pop     r0
924  2c2:   0f be           out     0x3f, r0        ; 63
925  2c4:   0f 90           pop     r0
926  2c6:   1f 90           pop     r1
927  2c8:   18 95           reti
928
929 000002ca <__mulhi3>:
930  2ca:   55 27           eor     r21, r21
931  2cc:   00 24           eor     r0, r0
932
933 000002ce <__mulhi3_loop>:
934  2ce:   80 ff           sbrs    r24, 0
935  2d0:   02 c0           rjmp    .+4             ; 0x2d6 <__mulhi3_skip1>
936  2d2:   06 0e           add     r0, r22
937  2d4:   57 1f           adc     r21, r23
938
939 000002d6 <__mulhi3_skip1>:
940  2d6:   66 0f           add     r22, r22
941  2d8:   77 1f           adc     r23, r23
942  2da:   61 15           cp      r22, r1
943  2dc:   71 05           cpc     r23, r1
944  2de:   21 f0           breq    .+8             ; 0x2e8 <__mulhi3_exit>
945  2e0:   96 95           lsr     r25
946  2e2:   87 95           ror     r24
947  2e4:   00 97           sbiw    r24, 0x00       ; 0
948  2e6:   99 f7           brne    .-26            ; 0x2ce <__mulhi3_loop>
949
950 000002e8 <__mulhi3_exit>:
951  2e8:   95 2f           mov     r25, r21
952  2ea:   80 2d           mov     r24, r0
953  2ec:   08 95           ret
954
955 000002ee <_exit>:
956  2ee:   f8 94           cli
957
958 000002f0 <__stop_program>:
959  2f0:   ff cf           rjmp    .-2             ; 0x2f0 <__stop_program>