Subversion Repositories Projects

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed


C-OSD.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         00000012  00800100  00003a28  00003adc  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00003a28  00000000  00000000  000000b4  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .bss          0000018f  00800112  00800112  00003aee  2**0
                  ALLOC
  3 .eeprom       00000005  00810000  00810000  00003aee  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  4 .debug_aranges 00000180  00000000  00000000  00003af3  2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_pubnames 0000245b  00000000  00000000  00003c73  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_info   000070a3  00000000  00000000  000060ce  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_abbrev 0000113c  00000000  00000000  0000d171  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_line   00002b13  00000000  00000000  0000e2ad  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_frame  00000430  00000000  00000000  00010dc0  2**2
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_str    00000c43  00000000  00000000  000111f0  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_loc    00001c20  00000000  00000000  00011e33  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_ranges 00000138  00000000  00000000  00013a53  2**0
                  CONTENTS, READONLY, DEBUGGING

Disassembly of section .text:

00000000 <__vectors>:
       0:       0c 94 c6 01     jmp     0x38c   ; 0x38c <__ctors_end>
       4:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
       8:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
       c:       0c 94 a3 0e     jmp     0x1d46  ; 0x1d46 <__vector_3>
      10:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      14:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      18:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      1c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      20:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      24:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      28:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      2c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      30:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      34:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      38:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      3c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      40:       0c 94 d9 02     jmp     0x5b2   ; 0x5b2 <__vector_16>
      44:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      48:       0c 94 07 0e     jmp     0x1c0e  ; 0x1c0e <__vector_18>
      4c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      50:       0c 94 64 03     jmp     0x6c8   ; 0x6c8 <__vector_20>
      54:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      58:       0c 94 5a 03     jmp     0x6b4   ; 0x6b4 <__vector_22>
      5c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      60:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      64:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      68:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>
      6c:       0c 94 e3 01     jmp     0x3c6   ; 0x3c6 <__bad_interrupt>

00000070 <stats_item_0>:
      70:       6d 61 78 20 41 6c 74 69 74 75 64 65 3a 00           max Altitude:.

0000007e <stats_item_1>:
      7e:       6d 61 78 20 53 70 65 65 64 20 20 20 3a 00           max Speed   :.

0000008c <stats_item_2>:
      8c:       6d 61 78 20 44 69 73 74 61 6e 63 65 3a 00           max Distance:.

0000009a <stats_item_3>:
      9a:       6d 69 6e 20 56 6f 6c 74 61 67 65 20 3a 00           min Voltage :.

000000a8 <stats_item_4>:
      a8:       6d 61 78 20 54 69 6d 65 20 20 20 20 3a 00           max Time    :.

000000b6 <stats_item_5>:
      b6:       6c 6f 6e 67 69 74 75 64 65 20 20 20 3a 00           longitude   :.

000000c4 <stats_item_6>:
      c4:       6c 61 74 69 74 75 64 65 20 20 20 20 3a 00           latitude    :.

000000d2 <stats_item_7>:
      d2:       6d 61 78 20 63 75 72 72 65 6e 74 20 3a 00           max current :.

000000e0 <stats_item_pointers>:
      e0:       70 00 7e 00 8c 00 9a 00 a8 00 b6 00 c4 00 d2 00     p.~.............

000000f0 <str_NE>:
      f0:       4e 45 00                                            NE.

000000f3 <str_E>:
      f3:       45 20 00                                            E .

000000f6 <str_SE>:
      f6:       53 45 00                                            SE.

000000f9 <str_S>:
      f9:       53 20 00                                            S .

000000fc <str_SW>:
      fc:       53 57 00                                            SW.

000000ff <str_W>:
      ff:       57 20 00                                            W .

00000102 <str_NW>:
     102:       4e 57 00                                            NW.

00000105 <str_N>:
     105:       4e 20 00                                            N .

00000108 <directions>:
     108:       f0 00 f3 00 f6 00 f9 00 fc 00 ff 00 02 01 05 01     ................

00000118 <str_1>:
     118:       64 65 66 61 75 6c 74 00                             default.

00000120 <str_2>:
     120:       6d 69 6e 69 6d 61 6c 00                             minimal.

00000128 <str_3>:
     128:       20 20 20 6a 6f 70 6c 00                                jopl.

00000130 <ncdisplaymodes>:
     130:       0c 0f 18 01 02 15 20 01                             ...... .

00000138 <fcdisplaymodes>:
     138:       8a 18 18 01 33 1a 28 01                             ....3.(.

00000140 <__c.1706>:
     140:       23 62 6f 3f 5d 3d 3d 45 47 0d 00                    #bo?]==EG..

0000014b <vario_00>:
     14b:       00 00 c2 ff ff                                      .....

00000150 <vario_01>:
     150:       00 00 c2 ff c0                                      .....

00000155 <vario_02>:
     155:       00 00 c2 ff c1                                      .....

0000015a <vario_03>:
     15a:       00 00 c2 ff 00                                      .....

0000015f <vario_04>:
     15f:       00 00 c2 c0 00                                      .....

00000164 <vario_05>:
     164:       00 00 c2 c1 00                                      .....

00000169 <vario_06>:
     169:       00 00 c2 00 00                                      .....

0000016e <vario_07>:
     16e:       00 00 bb 00 00                                      .....

00000173 <vario_08>:
     173:       00 00 c3 00 00                                      .....

00000178 <vario_09>:
     178:       00 c4 c3 00 00                                      .....

0000017d <vario_10>:
     17d:       00 c5 c3 00 00                                      .....

00000182 <vario_11>:
     182:       00 ff c3 00 00                                      .....

00000187 <vario_12>:
     187:       c4 ff c3 00 00                                      .....

0000018c <vario_13>:
     18c:       c5 ff c3 00 00                                      .....

00000191 <vario_14>:
     191:       ff ff c3 00 00                                      .....

00000196 <vario_pnt>:
     196:       4b 01 50 01 55 01 5a 01 5f 01 64 01 69 01 6e 01     K.P.U.Z._.d.i.n.
     1a6:       73 01 78 01 7d 01 82 01 87 01 8c 01 91 01           s.x.}.........

000001b4 <rose.1545>:
     1b4:       d8 d7 d8 d3 d8 d7 d8 d5 d8 d7 d8 d4 d8 d7 d8 d6     ................
     1c4:       d8 d7 d8 d3 d8 d7 d8 d5 d8 d7 d8 d4 d8 d7 d8 d6     ................
     1d4:       d8 d7 d8 d3 d8 d7 d8 d5 d8 d7 d8 d4 d8 d7 d8 d6     ................

000001e4 <VM_PAL>:
     1e4:       50 41 4c 20 00                                      PAL .

000001e9 <VM_NTSC>:
     1e9:       4e 54 53 43 00                                      NTSC.

000001ee <ee_message0>:
     1ee:       4c 6f 61 64 69 6e 67 20 44 61 74 61 20 66 72 6f     Loading Data fro
     1fe:       6d 20 45 45 50 52 4f 4d 00                          m EEPROM.

00000207 <ee_message1>:
     207:       4e 6f 20 73 61 76 65 64 20 44 61 74 61 20 69 6e     No saved Data in
     217:       20 45 45 50 52 4f 4d 00                              EEPROM.

0000021f <ee_msg>:
     21f:       ee 01 07 02                                         ....

00000223 <__c.1787>:
     223:       43 2d 4f 53 44 20 43 6f 6e 66 69 67 20 4d 65 6e     C-OSD Config Men
     233:       75 00                                               u.

00000235 <__c.1779>:
     235:       44 4f 4e 45 20 20 20 20 20 20 20 20 20 20 20 20     DONE            
     245:       20 20 00                                              .

00000248 <__c.1753>:
     248:       45 58 49 54 00                                      EXIT.

0000024d <__c.1751>:
     24d:       53 61 76 65 20 63 6f 6e 66 69 67 00                 Save config.

00000259 <__c.1749>:
     259:       42 41 52 4f 00                                      BARO.

0000025e <__c.1747>:
     25e:       20 47 50 53 00                                       GPS.

00000263 <__c.1745>:
     263:       48 65 69 67 68 74 20 62 79 00                       Height by.

0000026d <__c.1740>:
     26d:       44 69 73 70 6c 61 79 20 4d 6f 64 65 00              Display Mode.

0000027a <__c.1738>:
     27a:       52 65 73 65 74 20 75 70 74 69 6d 65 00              Reset uptime.

00000287 <__c.1736>:
     287:       56 6f 6c 74 61 67 65 20 62 79 20 43 2d 53 74 72     Voltage by C-Str
     297:       6f 6d 00                                            om.

0000029a <__c.1734>:
     29a:       43 75 72 72 65 6e 74 20 62 79 20 46 43 00           Current by FC.

000002a8 <__c.1732>:
     2a8:       53 74 61 74 69 73 74 69 63 73 00                    Statistics.

000002b3 <__c.1730>:
     2b3:       42 69 67 20 56 61 72 69 6f 20 62 61 72 00           Big Vario bar.

000002c1 <__c.1728>:
     2c1:       41 72 74 20 48 6f 72 69 7a 6f 6e 20 69 6e 20 48     Art Horizon in H
     2d1:       55 44 00                                            UD.

000002d4 <__c.1726>:
     2d4:       46 75 6c 6c 20 48 55 44 00                          Full HUD.

000002dd <__c.1724>:
     2dd:       56 69 64 65 6f 20 4d 6f 64 65 00                    Video Mode.

000002e8 <__c.1714>:
     2e8:       4f 46 46 00                                         OFF.

000002ec <__c.1712>:
     2ec:       4f 4e 20 00                                         ON .

000002f0 <__c.1663>:
     2f0:       4e 43 20 56 45 52 53 49 4f 4e 3a 20 2e 2e 2e 2e     NC VERSION: ....
     300:       2e 2e 2e 2e 00                                      .....

00000305 <__c.1661>:
     305:       23 62 76 3d 3d 3d 3d 44 6c 0d 00                    #bv====Dl..

00000310 <__c.1659>:
     310:       4d 61 78 20 56 6f 6c 74 61 67 65 20 20 20 20 3a     Max Voltage    :
        ...

00000321 <__c.1657>:
     321:       57 61 72 6e 20 56 6f 6c 74 61 67 65 20 20 20 3a     Warn Voltage   :
        ...

00000332 <__c.1655>:
     332:       4e 75 6d 62 65 72 20 6f 66 20 43 65 6c 6c 73 3a     Number of Cells:
        ...

00000343 <__c.1651>:
     343:       47 75 65 73 73 69 6e 67 20 4e 75 6d 62 65 72 20     Guessing Number 
     353:       6f 66 20 43 65 6c 6c 73 00                          of Cells.

0000035c <__c.1648>:
     35c:       44 45 56 45 4c 2d 42 55 49 4c 44 00                 DEVEL-BUILD.

00000368 <__c.1646>:
     368:       4e 61 76 69 43 74 72 6c 20 4d 6f 64 65 00           NaviCtrl Mode.

00000376 <__c.1644>:
     376:       43 2d 4f 53 44 20 49 6e 69 74 69 61 6c 69 73 61     C-OSD Initialisa
     386:       74 69 6f 6e 00 00                                   tion..

0000038c <__ctors_end>:
     38c:       11 24           eor     r1, r1
     38e:       1f be           out     0x3f, r1        ; 63
     390:       cf ef           ldi     r28, 0xFF       ; 255
     392:       d4 e0           ldi     r29, 0x04       ; 4
     394:       de bf           out     0x3e, r29       ; 62
     396:       cd bf           out     0x3d, r28       ; 61

00000398 <__do_copy_data>:
     398:       11 e0           ldi     r17, 0x01       ; 1
     39a:       a0 e0           ldi     r26, 0x00       ; 0
     39c:       b1 e0           ldi     r27, 0x01       ; 1
     39e:       e8 e2           ldi     r30, 0x28       ; 40
     3a0:       fa e3           ldi     r31, 0x3A       ; 58
     3a2:       02 c0           rjmp    .+4             ; 0x3a8 <.do_copy_data_start>

000003a4 <.do_copy_data_loop>:
     3a4:       05 90           lpm     r0, Z+
     3a6:       0d 92           st      X+, r0

000003a8 <.do_copy_data_start>:
     3a8:       a2 31           cpi     r26, 0x12       ; 18
     3aa:       b1 07           cpc     r27, r17
     3ac:       d9 f7           brne    .-10            ; 0x3a4 <.do_copy_data_loop>

000003ae <__do_clear_bss>:
     3ae:       12 e0           ldi     r17, 0x02       ; 2
     3b0:       a2 e1           ldi     r26, 0x12       ; 18
     3b2:       b1 e0           ldi     r27, 0x01       ; 1
     3b4:       01 c0           rjmp    .+2             ; 0x3b8 <.do_clear_bss_start>

000003b6 <.do_clear_bss_loop>:
     3b6:       1d 92           st      X+, r1

000003b8 <.do_clear_bss_start>:
     3b8:       a1 3a           cpi     r26, 0xA1       ; 161
     3ba:       b1 07           cpc     r27, r17
     3bc:       e1 f7           brne    .-8             ; 0x3b6 <.do_clear_bss_loop>
     3be:       0e 94 f0 01     call    0x3e0   ; 0x3e0 <main>
     3c2:       0c 94 12 1d     jmp     0x3a24  ; 0x3a24 <_exit>

000003c6 <__bad_interrupt>:
     3c6:       0c 94 e5 01     jmp     0x3ca   ; 0x3ca <__vector_default>

000003ca <__vector_default>:

/**
 * handler for undefined Interrupts
 * if not defined AVR will reset in case any unhandled interrupts occur
 */
ISR(__vector_default) {
     3ca:       1f 92           push    r1
     3cc:       0f 92           push    r0
     3ce:       0f b6           in      r0, 0x3f        ; 63
     3d0:       0f 92           push    r0
     3d2:       11 24           eor     r1, r1
    asm("nop");
     3d4:       00 00           nop
}
     3d6:       0f 90           pop     r0
     3d8:       0f be           out     0x3f, r0        ; 63
     3da:       0f 90           pop     r0
     3dc:       1f 90           pop     r1
     3de:       18 95           reti

000003e0 <main>:
/* ##########################################################################
 * MAIN
 * ##########################################################################*/
int main(void) {
        // set up FLAGS
        COSD_FLAGS_MODES = 0, COSD_FLAGS_CONFIG = 0, COSD_FLAGS_RUNTIME = 0;
     3e0:       10 92 1c 01     sts     0x011C, r1
     3e4:       10 92 1d 01     sts     0x011D, r1
        #endif
        #if STATS
        COSD_FLAGS_MODES |= COSD_FLAG_STATS;
        #endif
        #if WARNINGS
        COSD_FLAGS_MODES |= COSD_FLAG_WARNINGS;
     3e8:       89 e1           ldi     r24, 0x19       ; 25
     3ea:       80 93 1b 01     sts     0x011B, r24
        COSD_FLAGS_CONFIG |= COSD_FLAG_FCMODE;
        #endif


    // set up Atmega162 Ports
    DDRA |= (1 << PA1); // PA1 output (/CS)
     3ee:       d1 9a           sbi     0x1a, 1 ; 26
    MAX_CS_HIGH
     3f0:       d9 9a           sbi     0x1b, 1 ; 27
    DDRA |= (1 << PA2); // PA2 output (SDIN)
     3f2:       d2 9a           sbi     0x1a, 2 ; 26
    MAX_SDIN_LOW
     3f4:       da 98           cbi     0x1b, 2 ; 27
    DDRA |= (1 << PA3); // PA3 output (SCLK)
     3f6:       d3 9a           sbi     0x1a, 3 ; 26
    MAX_SCLK_LOW
     3f8:       db 98           cbi     0x1b, 3 ; 27
    DDRA |= (1 << PA5); // PA5 output (RESET)
     3fa:       d5 9a           sbi     0x1a, 5 ; 26
    MAX_RESET_HIGH
     3fc:       dd 9a           sbi     0x1b, 5 ; 27

    DDRC |= (1 << PC0); // PC0 output (LED1 gn)
     3fe:       a0 9a           sbi     0x14, 0 ; 20
    LED1_OFF
     400:       a8 98           cbi     0x15, 0 ; 21
    DDRC |= (1 << PC1); // PC1 output (LED2 rt)
     402:       a1 9a           sbi     0x14, 1 ; 20
    LED2_OFF
     404:       a9 98           cbi     0x15, 1 ; 21
    DDRC |= (1 << PC2); // PC2 output (LED3 gn)
     406:       a2 9a           sbi     0x14, 2 ; 20
    LED3_OFF
     408:       aa 98           cbi     0x15, 2 ; 21
    DDRC |= (1 << PC3); // PC3 output (LED4 rt)
     40a:       a3 9a           sbi     0x14, 3 ; 20
    LED4_OFF
     40c:       ab 98           cbi     0x15, 3 ; 21

    DDRC &= ~(1 << PC4); // PC4 input  (MODE)
     40e:       a4 98           cbi     0x14, 4 ; 20
    PORTC |= (1 << PC4); // pullup
     410:       ac 9a           sbi     0x15, 4 ; 21
    DDRC &= ~(1 << PC5); // PC5 input  (SET)
     412:       a5 98           cbi     0x14, 5 ; 20
    PORTC |= (1 << PC5); // pullup
     414:       ad 9a           sbi     0x15, 5 ; 21

    // reset the MAX7456 to be sure any undefined states do no harm
    MAX_RESET_LOW
     416:       dd 98           cbi     0x1b, 5 ; 27
    MAX_RESET_HIGH
     418:       dd 9a           sbi     0x1b, 5 ; 27

    // give the FC/NC and the maxim time to come up
    LED4_ON
     41a:       ab 9a           sbi     0x15, 3 ; 21
     41c:       80 e1           ldi     r24, 0x10       ; 16
     41e:       97 e2           ldi     r25, 0x27       ; 39
    milliseconds can be achieved.
 */
void
_delay_loop_2(uint16_t __count)
{
        __asm__ volatile (
     420:       20 e9           ldi     r18, 0x90       ; 144
     422:       31 e0           ldi     r19, 0x01       ; 1
     424:       f9 01           movw    r30, r18
     426:       31 97           sbiw    r30, 0x01       ; 1
     428:       f1 f7           brne    .-4             ; 0x426 <main+0x46>
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
     42a:       01 97           sbiw    r24, 0x01       ; 1
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
     42c:       d9 f7           brne    .-10            ; 0x424 <main+0x44>
    _delay_ms(1000);
    LED4_OFF
     42e:       ab 98           cbi     0x15, 3 ; 21
        // DISABLE display (VM0)
        spi_send_byte(0x00, 0b00000000);
        learn_all_chars_pgm();
#else
        // read out config for NTSC/PAL distinguishing
        get_eeprom(0);
     430:       80 e0           ldi     r24, 0x00       ; 0
     432:       0e 94 bd 0c     call    0x197a  ; 0x197a <get_eeprom>
#endif

        // Setup Video Mode
        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
     436:       80 91 1c 01     lds     r24, 0x011C
     43a:       80 ff           sbrs    r24, 0
     43c:       b2 c0           rjmp    .+356           ; 0x5a2 <__stack+0xa3>
            // NTSC + enable display immediately (VM0)
            spi_send_byte(0x00, 0b00001000);
     43e:       80 e0           ldi     r24, 0x00       ; 0
     440:       68 e0           ldi     r22, 0x08       ; 8
     442:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>

                bottom_line = 12;
     446:       8c e0           ldi     r24, 0x0C       ; 12
     448:       80 93 03 01     sts     0x0103, r24

    // 8bit mode
    spi_send_byte(0x04, 0b01000000);*/

    // clear display memory and set to 8bit mode
    clear();
     44c:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>

#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
    // init usart
    usart1_init();
     450:       0e 94 31 03     call    0x662   ; 0x662 <usart1_init>

    // keep serial port clean
    usart1_DisableTXD();
     454:       0e 94 39 03     call    0x672   ; 0x672 <usart1_DisableTXD>

    // set up timer
        // CTC, Prescaler /64
        TCCR0 = (1 << WGM01) | (0 << WGM00) | (0 << CS02) | (1 << CS01) | (1 << CS00);
     458:       8b e0           ldi     r24, 0x0B       ; 11
     45a:       83 bf           out     0x33, r24       ; 51

        TCNT0 = 0;
     45c:       12 be           out     0x32, r1        ; 50
        OCR0 = 250;
     45e:       8a ef           ldi     r24, 0xFA       ; 250
     460:       81 bf           out     0x31, r24       ; 49

        // enable timer output compare interrupt
        TIMSK &= ~(1 << TOIE0);
     462:       89 b7           in      r24, 0x39       ; 57
     464:       8d 7f           andi    r24, 0xFD       ; 253
     466:       89 bf           out     0x39, r24       ; 57
        TIMSK |= (1 << OCIE0);
     468:       89 b7           in      r24, 0x39       ; 57
     46a:       81 60           ori     r24, 0x01       ; 1
     46c:       89 bf           out     0x39, r24       ; 57

        // SPI setup
    DDRD |= (1 << PD2); // PD2 output (INT0)
     46e:       8a 9a           sbi     0x11, 2 ; 17
    SpiMasterInit();
     470:       0e 94 f5 0d     call    0x1bea  ; 0x1bea <SpiMasterInit>

        // PPM detection setup
        ppm_init();
     474:       0e 94 98 0e     call    0x1d30  ; 0x1d30 <ppm_init>

    // enable interrupts
    sei();
     478:       78 94           sei
    //write_ascii_string(2,  7, "         CaScAdE          ");
    //write_ascii_string(2,  8, "is TESTING his open source");
    //write_ascii_string(2,  9, "    EPi OSD Firmware");

    // we are ready
    LED3_ON
     47a:       aa 9a           sbi     0x15, 2 ; 21
     47c:       04 c0           rjmp    .+8             ; 0x486 <main+0xa6>
        }
        // handle keypress
        if (s1_pressed()) {
            config_menu();
        }
        if (seconds_since_last_data > 0) {
     47e:       80 91 18 01     lds     r24, 0x0118
     482:       88 23           and     r24, r24
     484:       61 f5           brne    .+88            ; 0x4de <main+0xfe>
        //usart1_puts("\x1B[2J\x1B[H");
        //usart1_puts("hello world!123\r\n");

    while (1) {
        // in case SPI is ready and there is nothing to send right now
        if (!icnt && spi_ready) {
     486:       80 91 34 01     lds     r24, 0x0134
     48a:       90 91 35 01     lds     r25, 0x0135
     48e:       89 2b           or      r24, r25
     490:       91 f4           brne    .+36            ; 0x4b6 <main+0xd6>
     492:       80 91 10 01     lds     r24, 0x0110
     496:       88 23           and     r24, r24
     498:       71 f0           breq    .+28            ; 0x4b6 <main+0xd6>
            // correct transfer ends with d (done)
            if (SPI_buffer.buffer.chk == 'd') {
     49a:       80 91 95 01     lds     r24, 0x0195
     49e:       84 36           cpi     r24, 0x64       ; 100
     4a0:       09 f4           brne    .+2             ; 0x4a4 <main+0xc4>
     4a2:       4c c0           rjmp    .+152           ; 0x53c <__stack+0x3d>
                                        // update this flag
                        COSD_FLAGS_RUNTIME |= COSD_FLAG_STROMREC;
                                }
            } else {
                // update flags
                COSD_FLAGS_RUNTIME &= ~COSD_FLAG_STROMREC;
     4a4:       80 91 1d 01     lds     r24, 0x011D
     4a8:       8e 7f           andi    r24, 0xFE       ; 254
     4aa:       80 93 1d 01     sts     0x011D, r24
            }
                        StartTransfer(9);
     4ae:       89 e0           ldi     r24, 0x09       ; 9
     4b0:       90 e0           ldi     r25, 0x00       ; 0
     4b2:       0e 94 48 0e     call    0x1c90  ; 0x1c90 <StartTransfer>
        }
        if (rxd_buffer_locked) {
     4b6:       80 91 29 01     lds     r24, 0x0129
     4ba:       88 23           and     r24, r24
     4bc:       31 f0           breq    .+12            ; 0x4ca <main+0xea>
                                        osd_fcmode();
                                }
                                seconds_since_last_data = 0;
            }
#else
            if (rxd_buffer[2] == 'O') { // NC OSD Data
     4be:       80 91 ee 01     lds     r24, 0x01EE
     4c2:       8f 34           cpi     r24, 0x4F       ; 79
     4c4:       b9 f0           breq    .+46            ; 0x4f4 <main+0x114>
                                        osd_ncmode();
                                }
                                //seconds_since_last_data = 0;
            }
#endif
            rxd_buffer_locked = 0;
     4c6:       10 92 29 01     sts     0x0129, r1
        }
        // handle keypress
        if (s1_pressed()) {
     4ca:       0e 94 58 0e     call    0x1cb0  ; 0x1cb0 <s1_pressed>
     4ce:       89 2b           or      r24, r25
     4d0:       b1 f2           breq    .-84            ; 0x47e <main+0x9e>
            config_menu();
     4d2:       0e 94 9c 0b     call    0x1738  ; 0x1738 <config_menu>
        }
        if (seconds_since_last_data > 0) {
     4d6:       80 91 18 01     lds     r24, 0x0118
     4da:       88 23           and     r24, r24
     4dc:       a1 f2           breq    .-88            ; 0x486 <main+0xa6>
                        usart1_EnableTXD();
     4de:       0e 94 3e 03     call    0x67c   ; 0x67c <usart1_EnableTXD>
            //usart1_request_mk_data(0, 'd', 100);
                        usart1_puts_pgm(PSTR(REQUEST_DBG_DATA));
#else
            // request OSD Data from NC every 100ms
            //usart1_request_mk_data(1, 'o', 100);
                        usart1_puts_pgm(PSTR(REQUEST_OSD_DATA));
     4e2:       80 e4           ldi     r24, 0x40       ; 64
     4e4:       91 e0           ldi     r25, 0x01       ; 1
     4e6:       0e 94 47 03     call    0x68e   ; 0x68e <usart1_puts_pgm>

            // and disable debug...
            //usart1_request_mk_data(0, 'd', 0);                
#endif
                        // reset last time counter
                        seconds_since_last_data = 0;
     4ea:       10 92 18 01     sts     0x0118, r1
                        usart1_DisableTXD();
     4ee:       0e 94 39 03     call    0x672   ; 0x672 <usart1_DisableTXD>
     4f2:       c9 cf           rjmp    .-110           ; 0x486 <main+0xa6>
                                }
                                seconds_since_last_data = 0;
            }
#else
            if (rxd_buffer[2] == 'O') { // NC OSD Data
                Decode64();
     4f4:       0e 94 30 04     call    0x860   ; 0x860 <Decode64>
                naviData = *((NaviData_t*) pRxData);
     4f8:       aa e9           ldi     r26, 0x9A       ; 154
     4fa:       b1 e0           ldi     r27, 0x01       ; 1
     4fc:       80 91 2b 01     lds     r24, 0x012B
     500:       90 91 2c 01     lds     r25, 0x012C
     504:       9c 01           movw    r18, r24
     506:       f9 01           movw    r30, r18
     508:       82 e5           ldi     r24, 0x52       ; 82
     50a:       01 90           ld      r0, Z+
     50c:       0d 92           st      X+, r0
     50e:       81 50           subi    r24, 0x01       ; 1
     510:       e1 f7           brne    .-8             ; 0x50a <__stack+0xb>

                // init on first data retrival, distinguished by last battery :)
                if (last_UBat == 255) {
     512:       80 91 00 01     lds     r24, 0x0100
     516:       8f 3f           cpi     r24, 0xFF       ; 255
     518:       f1 f5           brne    .+124           ; 0x596 <__stack+0x97>
                                        if (naviData.UBat > 40) {
     51a:       80 91 d3 01     lds     r24, 0x01D3
     51e:       89 32           cpi     r24, 0x29       ; 41
     520:       90 f2           brcs    .-92            ; 0x4c6 <main+0xe6>
                        // fix for min_UBat
                        min_UBat = naviData.UBat;
     522:       80 91 d3 01     lds     r24, 0x01D3
     526:       80 93 04 01     sts     0x0104, r24
                                                last_UBat = naviData.UBat;
     52a:       80 91 d3 01     lds     r24, 0x01D3
     52e:       80 93 00 01     sts     0x0100, r24
                        init_cosd(last_UBat);
     532:       80 91 00 01     lds     r24, 0x0100
     536:       0e 94 f1 0c     call    0x19e2  ; 0x19e2 <init_cosd>
     53a:       c5 cf           rjmp    .-118           ; 0x4c6 <main+0xe6>
    while (1) {
        // in case SPI is ready and there is nothing to send right now
        if (!icnt && spi_ready) {
            // correct transfer ends with d (done)
            if (SPI_buffer.buffer.chk == 'd') {
                                ampere = SPI_buffer.data.ampere;
     53c:       80 91 8b 01     lds     r24, 0x018B
     540:       90 91 8c 01     lds     r25, 0x018C
     544:       90 93 38 01     sts     0x0138, r25
     548:       80 93 37 01     sts     0x0137, r24
                                ampere_wasted = SPI_buffer.data.mah;
     54c:       80 91 8d 01     lds     r24, 0x018D
     550:       90 91 8e 01     lds     r25, 0x018E
     554:       a0 91 8f 01     lds     r26, 0x018F
     558:       b0 91 90 01     lds     r27, 0x0190
     55c:       80 93 3b 01     sts     0x013B, r24
     560:       90 93 3c 01     sts     0x013C, r25
     564:       a0 93 3d 01     sts     0x013D, r26
     568:       b0 93 3e 01     sts     0x013E, r27
                                s_volt = SPI_buffer.data.volt;
     56c:       80 91 91 01     lds     r24, 0x0191
     570:       90 91 92 01     lds     r25, 0x0192
     574:       90 93 a0 02     sts     0x02A0, r25
     578:       80 93 9f 02     sts     0x029F, r24

                                // if this is the first receival we should print the small A
                                if (!(COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC)) {
     57c:       80 91 1d 01     lds     r24, 0x011D
     580:       80 fd           sbrc    r24, 0
     582:       95 cf           rjmp    .-214           ; 0x4ae <main+0xce>
                                        clear();
     584:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
                                        COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
     588:       80 91 1d 01     lds     r24, 0x011D
     58c:       8d 7f           andi    r24, 0xFD       ; 253
                                        // update this flag
                        COSD_FLAGS_RUNTIME |= COSD_FLAG_STROMREC;
     58e:       81 60           ori     r24, 0x01       ; 1
     590:       80 93 1d 01     sts     0x011D, r24
     594:       8c cf           rjmp    .-232           ; 0x4ae <main+0xce>
                        min_UBat = naviData.UBat;
                                                last_UBat = naviData.UBat;
                        init_cosd(last_UBat);
                                        }
                } else {
                                        osd_ncmode();
     596:       e0 91 05 01     lds     r30, 0x0105
     59a:       f0 91 06 01     lds     r31, 0x0106
     59e:       09 95           icall
     5a0:       92 cf           rjmp    .-220           ; 0x4c6 <main+0xe6>
            spi_send_byte(0x00, 0b00001000);

                bottom_line = 12;
        } else {
            // PAL + enable display immediately (VM0)
            spi_send_byte(0x00, 0b01001000);
     5a2:       80 e0           ldi     r24, 0x00       ; 0
     5a4:       68 e4           ldi     r22, 0x48       ; 72
     5a6:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>

                bottom_line = 14;
     5aa:       8e e0           ldi     r24, 0x0E       ; 14
     5ac:       80 93 03 01     sts     0x0103, r24
     5b0:       4d cf           rjmp    .-358           ; 0x44c <main+0x6c>

000005b2 <__vector_16>:
static uint8_t delay_spi = 0;

/**
 * timer kicks in every 1000uS ^= 1ms
 */
ISR(TIMER0_COMP_vect) {
     5b2:       1f 92           push    r1
     5b4:       0f 92           push    r0
     5b6:       0f b6           in      r0, 0x3f        ; 63
     5b8:       0f 92           push    r0
     5ba:       11 24           eor     r1, r1
     5bc:       2f 93           push    r18
     5be:       3f 93           push    r19
     5c0:       4f 93           push    r20
     5c2:       5f 93           push    r21
     5c4:       6f 93           push    r22
     5c6:       7f 93           push    r23
     5c8:       8f 93           push    r24
     5ca:       9f 93           push    r25
     5cc:       af 93           push    r26
     5ce:       bf 93           push    r27
     5d0:       ef 93           push    r30
     5d2:       ff 93           push    r31
    if (!timer--) {
     5d4:       80 91 14 01     lds     r24, 0x0114
     5d8:       90 91 15 01     lds     r25, 0x0115
     5dc:       01 97           sbiw    r24, 0x01       ; 1
     5de:       90 93 15 01     sts     0x0115, r25
     5e2:       80 93 14 01     sts     0x0114, r24
     5e6:       01 96           adiw    r24, 0x01       ; 1
     5e8:       a1 f4           brne    .+40            ; 0x612 <__vector_16+0x60>
        uptime++;
     5ea:       80 91 12 01     lds     r24, 0x0112
     5ee:       90 91 13 01     lds     r25, 0x0113
     5f2:       01 96           adiw    r24, 0x01       ; 1
     5f4:       90 93 13 01     sts     0x0113, r25
     5f8:       80 93 12 01     sts     0x0112, r24
                if (debugData.Analog[12]>10) {
                        flytime_fc++;
                }
                #endif

        timer = 999;
     5fc:       87 ee           ldi     r24, 0xE7       ; 231
     5fe:       93 e0           ldi     r25, 0x03       ; 3
     600:       90 93 15 01     sts     0x0115, r25
     604:       80 93 14 01     sts     0x0114, r24
        seconds_since_last_data++;
     608:       80 91 18 01     lds     r24, 0x0118
     60c:       8f 5f           subi    r24, 0xFF       ; 255
     60e:       80 93 18 01     sts     0x0118, r24
    }
    // in case there is still some spi data to send do it now
        // delay to give the slave some time to compute values
    if (spi_ready && icnt) {
     612:       80 91 10 01     lds     r24, 0x0110
     616:       88 23           and     r24, r24
     618:       69 f0           breq    .+26            ; 0x634 <__vector_16+0x82>
     61a:       80 91 34 01     lds     r24, 0x0134
     61e:       90 91 35 01     lds     r25, 0x0135
     622:       89 2b           or      r24, r25
     624:       39 f0           breq    .+14            ; 0x634 <__vector_16+0x82>
                if (!delay_spi--) {
     626:       80 91 28 01     lds     r24, 0x0128
     62a:       81 50           subi    r24, 0x01       ; 1
     62c:       80 93 28 01     sts     0x0128, r24
     630:       8f 5f           subi    r24, 0xFF       ; 255
     632:       89 f0           breq    .+34            ; 0x656 <__vector_16+0xa4>
                        delay_spi = 8;
                        spi_send_next();
                }
    }
}
     634:       ff 91           pop     r31
     636:       ef 91           pop     r30
     638:       bf 91           pop     r27
     63a:       af 91           pop     r26
     63c:       9f 91           pop     r25
     63e:       8f 91           pop     r24
     640:       7f 91           pop     r23
     642:       6f 91           pop     r22
     644:       5f 91           pop     r21
     646:       4f 91           pop     r20
     648:       3f 91           pop     r19
     64a:       2f 91           pop     r18
     64c:       0f 90           pop     r0
     64e:       0f be           out     0x3f, r0        ; 63
     650:       0f 90           pop     r0
     652:       1f 90           pop     r1
     654:       18 95           reti
    }
    // in case there is still some spi data to send do it now
        // delay to give the slave some time to compute values
    if (spi_ready && icnt) {
                if (!delay_spi--) {
                        delay_spi = 8;
     656:       88 e0           ldi     r24, 0x08       ; 8
     658:       80 93 28 01     sts     0x0128, r24
                        spi_send_next();
     65c:       0e 94 53 0e     call    0x1ca6  ; 0x1ca6 <spi_send_next>
     660:       e9 cf           rjmp    .-46            ; 0x634 <__vector_16+0x82>

00000662 <usart1_init>:

/**
 * init usart1
 */
void usart1_init() {
    UBRR1H = ((F_CPU / (16UL * baud)) - 1) >> 8;
     662:       1c be           out     0x3c, r1        ; 60
    UBRR1L = (F_CPU / (16UL * baud)) - 1;
     664:       80 e1           ldi     r24, 0x10       ; 16
     666:       80 b9           out     0x00, r24       ; 0

    // Enable receiver and transmitter; enable RX interrupt
    UCSR1B = (1 << RXEN1) | (1 << TXEN1) | (1 << RXCIE1);
     668:       88 e9           ldi     r24, 0x98       ; 152
     66a:       81 b9           out     0x01, r24       ; 1

    //asynchronous 8N1
    UCSR1C = (1 << URSEL1) | (3 << UCSZ10);
     66c:       86 e8           ldi     r24, 0x86       ; 134
     66e:       8c bf           out     0x3c, r24       ; 60
}
     670:       08 95           ret

00000672 <usart1_DisableTXD>:

/**
 * disable the txd pin of usart1
 */
void usart1_DisableTXD(void) {
    UCSR1B &= ~(1 << TXCIE1); // disable TX-Interrupt
     672:       0e 98           cbi     0x01, 6 ; 1
    UCSR1B &= ~(1 << TXEN1); // disable TX in USART
     674:       0b 98           cbi     0x01, 3 ; 1
    DDRB &= ~(1 << DDB3); // set TXD pin as input
     676:       bb 98           cbi     0x17, 3 ; 23
    PORTB &= ~(1 << PORTB3); // disable pullup on TXD pin
     678:       c3 98           cbi     0x18, 3 ; 24
}
     67a:       08 95           ret

0000067c <usart1_EnableTXD>:

/**
 * enable the txd pin of usart1
 */
void usart1_EnableTXD(void) {
    DDRB |= (1 << DDB3); // set TXD pin as output
     67c:       bb 9a           sbi     0x17, 3 ; 23
    PORTB &= ~(1 << PORTB3); // disable pullup on TXD pin
     67e:       c3 98           cbi     0x18, 3 ; 24
    UCSR1B |= (1 << TXEN1); // enable TX in USART
     680:       0b 9a           sbi     0x01, 3 ; 1
    UCSR1B |= (1 << TXCIE1); // enable TX-Interrupt
     682:       0e 9a           sbi     0x01, 6 ; 1
}
     684:       08 95           ret

00000686 <usart1_putc>:
/**
 * send a single <character> through usart1
 */
void usart1_putc(unsigned char character) {
    // wait until UDR ready
    while (!(UCSR1A & (1 << UDRE1)));
     686:       15 9b           sbis    0x02, 5 ; 2
     688:       fe cf           rjmp    .-4             ; 0x686 <usart1_putc>
    UDR1 = character;
     68a:       83 b9           out     0x03, r24       ; 3
}
     68c:       08 95           ret

0000068e <usart1_puts_pgm>:


/**
 * send a PGM<string> throught usart1
 */
void usart1_puts_pgm(const char* string) {
     68e:       ac 01           movw    r20, r24
        while (pgm_read_byte(string) != 0x00) 
     690:       9a 01           movw    r18, r20
     692:       fa 01           movw    r30, r20
     694:       84 91           lpm     r24, Z+
     696:       88 23           and     r24, r24
     698:       61 f0           breq    .+24            ; 0x6b2 <usart1_puts_pgm+0x24>
                usart1_putc(pgm_read_byte(string++));
     69a:       4f 5f           subi    r20, 0xFF       ; 255
     69c:       5f 4f           sbci    r21, 0xFF       ; 255
     69e:       f9 01           movw    r30, r18
     6a0:       84 91           lpm     r24, Z+
/**
 * send a single <character> through usart1
 */
void usart1_putc(unsigned char character) {
    // wait until UDR ready
    while (!(UCSR1A & (1 << UDRE1)));
     6a2:       15 9b           sbis    0x02, 5 ; 2
     6a4:       fe cf           rjmp    .-4             ; 0x6a2 <usart1_puts_pgm+0x14>
    UDR1 = character;
     6a6:       83 b9           out     0x03, r24       ; 3

/**
 * send a PGM<string> throught usart1
 */
void usart1_puts_pgm(const char* string) {
        while (pgm_read_byte(string) != 0x00) 
     6a8:       9a 01           movw    r18, r20
     6aa:       fa 01           movw    r30, r20
     6ac:       84 91           lpm     r24, Z+
     6ae:       88 23           and     r24, r24
     6b0:       a1 f7           brne    .-24            ; 0x69a <usart1_puts_pgm+0xc>
     6b2:       08 95           ret

000006b4 <__vector_22>:

/**
 * transmit interrupt handler
 * unused
 */
ISR(SIG_USART1_DATA) {
     6b4:       1f 92           push    r1
     6b6:       0f 92           push    r0
     6b8:       0f b6           in      r0, 0x3f        ; 63
     6ba:       0f 92           push    r0
     6bc:       11 24           eor     r1, r1
}
     6be:       0f 90           pop     r0
     6c0:       0f be           out     0x3f, r0        ; 63
     6c2:       0f 90           pop     r0
     6c4:       1f 90           pop     r1
     6c6:       18 95           reti

000006c8 <__vector_20>:
/*
 * receive data through usart1
 * portions taken and adapted from
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c
 */
ISR(SIG_USART1_RECV) {
     6c8:       1f 92           push    r1
     6ca:       0f 92           push    r0
     6cc:       0f b6           in      r0, 0x3f        ; 63
     6ce:       0f 92           push    r0
     6d0:       11 24           eor     r1, r1
     6d2:       2f 93           push    r18
     6d4:       3f 93           push    r19
     6d6:       4f 93           push    r20
     6d8:       5f 93           push    r21
     6da:       6f 93           push    r22
     6dc:       8f 93           push    r24
     6de:       9f 93           push    r25
     6e0:       af 93           push    r26
     6e2:       bf 93           push    r27
     6e4:       cf 93           push    r28
     6e6:       df 93           push    r29
     6e8:       ef 93           push    r30
     6ea:       ff 93           push    r31
    uint8_t c;
    // catch the received byte
    c = UDR1;
     6ec:       63 b1           in      r22, 0x03       ; 3
    if (rxd_buffer_locked) return; // if rxd buffer is locked immediately return
     6ee:       80 91 29 01     lds     r24, 0x0129
     6f2:       88 23           and     r24, r24
     6f4:       71 f4           brne    .+28            ; 0x712 <__vector_20+0x4a>
    static uint8_t c1 = 0;
    static uint8_t c2 = 0;
    static uint8_t usart_rx_ok = 0;
    uint8_t crc1, crc2;
    // the rxd buffer is unlocked
    if (usart_rx_ok == 0) {
     6f6:       80 91 2e 01     lds     r24, 0x012E
     6fa:       88 23           and     r24, r24
     6fc:       e1 f4           brne    .+56            ; 0x736 <__vector_20+0x6e>
                // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) {
        if ((c2 == '#') && (c1 == 'b' || c1 == 'c') &&
     6fe:       80 91 2f 01     lds     r24, 0x012F
     702:       83 32           cpi     r24, 0x23       ; 35
     704:       d1 f1           breq    .+116           ; 0x77a <__vector_20+0xb2>
     706:       20 91 30 01     lds     r18, 0x0130
            c2 = 0;
            c1 = 0;
            LED1_ON
            LED2_OFF
        } else {
            c2 = c1;
     70a:       20 93 2f 01     sts     0x012F, r18
            c1 = c;
     70e:       60 93 30 01     sts     0x0130, r22
        ptr_rxd_buffer = 0; // reset rxd buffer
        rxd_buffer_locked = 0; // unlock rxd buffer
        usart_rx_ok = 0;
        LED2_ON
    }
}
     712:       ff 91           pop     r31
     714:       ef 91           pop     r30
     716:       df 91           pop     r29
     718:       cf 91           pop     r28
     71a:       bf 91           pop     r27
     71c:       af 91           pop     r26
     71e:       9f 91           pop     r25
     720:       8f 91           pop     r24
     722:       6f 91           pop     r22
     724:       5f 91           pop     r21
     726:       4f 91           pop     r20
     728:       3f 91           pop     r19
     72a:       2f 91           pop     r18
     72c:       0f 90           pop     r0
     72e:       0f be           out     0x3f, r0        ; 63
     730:       0f 90           pop     r0
     732:       1f 90           pop     r1
     734:       18 95           reti
            LED2_OFF
        } else {
            c2 = c1;
            c1 = c;
        }
    } else if (ptr_rxd_buffer < RXD_BUFFER_LEN) { // collect incomming bytes
     736:       30 91 31 01     lds     r19, 0x0131
     73a:       36 39           cpi     r19, 0x96       ; 150
     73c:       b0 f4           brcc    .+44            ; 0x76a <__vector_20+0xa2>
        if (c != '\r') { // no termination character
     73e:       6d 30           cpi     r22, 0x0D       ; 13
     740:       09 f4           brne    .+2             ; 0x744 <__vector_20+0x7c>
     742:       50 c0           rjmp    .+160           ; 0x7e4 <__vector_20+0x11c>
            rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer
     744:       e3 2f           mov     r30, r19
     746:       f0 e0           ldi     r31, 0x00       ; 0
     748:       e4 51           subi    r30, 0x14       ; 20
     74a:       fe 4f           sbci    r31, 0xFE       ; 254
     74c:       60 83           st      Z, r22
     74e:       3f 5f           subi    r19, 0xFF       ; 255
     750:       30 93 31 01     sts     0x0131, r19
            crc += c; // update crc
     754:       80 91 32 01     lds     r24, 0x0132
     758:       90 91 33 01     lds     r25, 0x0133
     75c:       86 0f           add     r24, r22
     75e:       91 1d           adc     r25, r1
     760:       90 93 33 01     sts     0x0133, r25
     764:       80 93 32 01     sts     0x0132, r24
     768:       d4 cf           rjmp    .-88            ; 0x712 <__vector_20+0x4a>
            }
            ptr_rxd_buffer = 0; // reset rxd buffer pointer
            usart_rx_ok = 0;
        }
    } else { // rxd buffer overrun
        ptr_rxd_buffer = 0; // reset rxd buffer
     76a:       10 92 31 01     sts     0x0131, r1
        rxd_buffer_locked = 0; // unlock rxd buffer
     76e:       10 92 29 01     sts     0x0129, r1
        usart_rx_ok = 0;
     772:       10 92 2e 01     sts     0x012E, r1
        LED2_ON
     776:       a9 9a           sbi     0x15, 1 ; 21
     778:       cc cf           rjmp    .-104           ; 0x712 <__vector_20+0x4a>
    static uint8_t usart_rx_ok = 0;
    uint8_t crc1, crc2;
    // the rxd buffer is unlocked
    if (usart_rx_ok == 0) {
                // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) {
        if ((c2 == '#') && (c1 == 'b' || c1 == 'c') &&
     77a:       20 91 30 01     lds     r18, 0x0130
     77e:       82 2f           mov     r24, r18
     780:       82 56           subi    r24, 0x62       ; 98
     782:       82 30           cpi     r24, 0x02       ; 2
     784:       10 f6           brcc    .-124           ; 0x70a <__vector_20+0x42>
     786:       66 35           cpi     r22, 0x56       ; 86
     788:       19 f0           breq    .+6             ; 0x790 <__vector_20+0xc8>
     78a:       6f 34           cpi     r22, 0x4F       ; 79
     78c:       09 f0           breq    .+2             ; 0x790 <__vector_20+0xc8>
     78e:       bd cf           rjmp    .-134           ; 0x70a <__vector_20+0x42>
                        #if FCONLY
                                (c == 'V' || c == 'D')) { // version and debug
                        #else
                                (c == 'V' || c == 'O')) { // version and OSD
                        #endif
            usart_rx_ok = 1;
     790:       81 e0           ldi     r24, 0x01       ; 1
     792:       80 93 2e 01     sts     0x012E, r24
            rxd_buffer[ptr_rxd_buffer++] = c2;
     796:       80 91 31 01     lds     r24, 0x0131
     79a:       e8 2f           mov     r30, r24
     79c:       f0 e0           ldi     r31, 0x00       ; 0
     79e:       e4 51           subi    r30, 0x14       ; 20
     7a0:       fe 4f           sbci    r31, 0xFE       ; 254
     7a2:       93 e2           ldi     r25, 0x23       ; 35
     7a4:       90 83           st      Z, r25
     7a6:       8f 5f           subi    r24, 0xFF       ; 255
            crc = c2;
            rxd_buffer[ptr_rxd_buffer++] = c1;
     7a8:       e8 2f           mov     r30, r24
     7aa:       f0 e0           ldi     r31, 0x00       ; 0
     7ac:       e4 51           subi    r30, 0x14       ; 20
     7ae:       fe 4f           sbci    r31, 0xFE       ; 254
     7b0:       20 83           st      Z, r18
     7b2:       8f 5f           subi    r24, 0xFF       ; 255
            crc += c1;
            rxd_buffer[ptr_rxd_buffer++] = c;
     7b4:       e8 2f           mov     r30, r24
     7b6:       f0 e0           ldi     r31, 0x00       ; 0
     7b8:       e4 51           subi    r30, 0x14       ; 20
     7ba:       fe 4f           sbci    r31, 0xFE       ; 254
     7bc:       60 83           st      Z, r22
     7be:       8f 5f           subi    r24, 0xFF       ; 255
     7c0:       80 93 31 01     sts     0x0131, r24
            crc += c;
     7c4:       86 2f           mov     r24, r22
     7c6:       90 e0           ldi     r25, 0x00       ; 0
     7c8:       82 0f           add     r24, r18
     7ca:       91 1d           adc     r25, r1
     7cc:       83 96           adiw    r24, 0x23       ; 35
     7ce:       90 93 33 01     sts     0x0133, r25
     7d2:       80 93 32 01     sts     0x0132, r24
            c2 = 0;
     7d6:       10 92 2f 01     sts     0x012F, r1
            c1 = 0;
     7da:       10 92 30 01     sts     0x0130, r1
            LED1_ON
     7de:       a8 9a           sbi     0x15, 0 ; 21
            LED2_OFF
     7e0:       a9 98           cbi     0x15, 1 ; 21
     7e2:       97 cf           rjmp    .-210           ; 0x712 <__vector_20+0x4a>
            rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer
            crc += c; // update crc
        } else { // termination character was received
            // the last 2 bytes are no subject for checksum calculation
            // they are the checksum itself
            crc -= rxd_buffer[ptr_rxd_buffer - 2];
     7e4:       a3 2f           mov     r26, r19
     7e6:       b0 e0           ldi     r27, 0x00       ; 0
     7e8:       fd 01           movw    r30, r26
     7ea:       e6 51           subi    r30, 0x16       ; 22
     7ec:       fe 4f           sbci    r31, 0xFE       ; 254
     7ee:       90 81           ld      r25, Z
            crc -= rxd_buffer[ptr_rxd_buffer - 1];
     7f0:       ed 01           movw    r28, r26
     7f2:       c5 51           subi    r28, 0x15       ; 21
     7f4:       de 4f           sbci    r29, 0xFE       ; 254
     7f6:       88 81           ld      r24, Y
            // calculate checksum from transmitted data
            crc %= 4096;
     7f8:       40 91 32 01     lds     r20, 0x0132
     7fc:       50 91 33 01     lds     r21, 0x0133
     800:       49 1b           sub     r20, r25
     802:       51 09           sbc     r21, r1
     804:       48 1b           sub     r20, r24
     806:       51 09           sbc     r21, r1
     808:       5f 70           andi    r21, 0x0F       ; 15
     80a:       50 93 33 01     sts     0x0133, r21
     80e:       40 93 32 01     sts     0x0132, r20
            crc1 = '=' + crc / 64;
            crc2 = '=' + crc % 64;
            // compare checksum to transmitted checksum bytes
            if ((crc1 == rxd_buffer[ptr_rxd_buffer - 2]) && (crc2 == rxd_buffer[ptr_rxd_buffer - 1])) { // checksum valid
     812:       20 81           ld      r18, Z
     814:       ca 01           movw    r24, r20
     816:       00 24           eor     r0, r0
     818:       88 0f           add     r24, r24
     81a:       99 1f           adc     r25, r25
     81c:       00 1c           adc     r0, r0
     81e:       88 0f           add     r24, r24
     820:       99 1f           adc     r25, r25
     822:       00 1c           adc     r0, r0
     824:       89 2f           mov     r24, r25
     826:       90 2d           mov     r25, r0
     828:       83 5c           subi    r24, 0xC3       ; 195
     82a:       28 17           cp      r18, r24
     82c:       41 f0           breq    .+16            ; 0x83e <__vector_20+0x176>
                rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character
                ReceivedBytes = ptr_rxd_buffer + 1; // store number of received bytes
                rxd_buffer_locked = 1; // lock the rxd buffer
                LED1_OFF
            } else { // checksum invalid
                rxd_buffer_locked = 0; // unlock rxd buffer
     82e:       10 92 29 01     sts     0x0129, r1
                LED2_ON
     832:       a9 9a           sbi     0x15, 1 ; 21
            }
            ptr_rxd_buffer = 0; // reset rxd buffer pointer
     834:       10 92 31 01     sts     0x0131, r1
            usart_rx_ok = 0;
     838:       10 92 2e 01     sts     0x012E, r1
     83c:       6a cf           rjmp    .-300           ; 0x712 <__vector_20+0x4a>
            // calculate checksum from transmitted data
            crc %= 4096;
            crc1 = '=' + crc / 64;
            crc2 = '=' + crc % 64;
            // compare checksum to transmitted checksum bytes
            if ((crc1 == rxd_buffer[ptr_rxd_buffer - 2]) && (crc2 == rxd_buffer[ptr_rxd_buffer - 1])) { // checksum valid
     83e:       98 81           ld      r25, Y
     840:       84 2f           mov     r24, r20
     842:       8f 73           andi    r24, 0x3F       ; 63
     844:       83 5c           subi    r24, 0xC3       ; 195
     846:       98 17           cp      r25, r24
     848:       91 f7           brne    .-28            ; 0x82e <__vector_20+0x166>
                rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character
     84a:       a4 51           subi    r26, 0x14       ; 20
     84c:       be 4f           sbci    r27, 0xFE       ; 254
     84e:       6c 93           st      X, r22
                ReceivedBytes = ptr_rxd_buffer + 1; // store number of received bytes
     850:       3f 5f           subi    r19, 0xFF       ; 255
     852:       30 93 2a 01     sts     0x012A, r19
                rxd_buffer_locked = 1; // lock the rxd buffer
     856:       81 e0           ldi     r24, 0x01       ; 1
     858:       80 93 29 01     sts     0x0129, r24
                LED1_OFF
     85c:       a8 98           cbi     0x15, 0 ; 21
     85e:       ea cf           rjmp    .-44            ; 0x834 <__vector_20+0x16c>

00000860 <Decode64>:
void Decode64(void) {
    uint8_t a, b, c, d;
    uint8_t x, y, z;
    uint8_t ptrIn = 3;
    uint8_t ptrOut = 3;
    uint8_t len = ReceivedBytes - 6;
     860:       50 91 2a 01     lds     r21, 0x012A
     864:       56 50           subi    r21, 0x06       ; 6

    while (len) {
     866:       09 f4           brne    .+2             ; 0x86a <Decode64+0xa>
     868:       57 c0           rjmp    .+174           ; 0x918 <Decode64+0xb8>
     86a:       33 e0           ldi     r19, 0x03       ; 3
     86c:       43 e0           ldi     r20, 0x03       ; 3
     86e:       1e c0           rjmp    .+60            ; 0x8ac <Decode64+0x4c>
        a = rxd_buffer[ptrIn++] - '=';
        b = rxd_buffer[ptrIn++] - '=';
        c = rxd_buffer[ptrIn++] - '=';
     870:       97 2f           mov     r25, r23
     872:       9d 53           subi    r25, 0x3D       ; 61
        y = ((b & 0x0f) << 4) | (c >> 2);
        z = ((c & 0x03) << 6) | d;

        if (len--) rxd_buffer[ptrOut++] = x;
        else break;
        if (len--) rxd_buffer[ptrOut++] = y;
     874:       f0 e0           ldi     r31, 0x00       ; 0
        b = rxd_buffer[ptrIn++] - '=';
        c = rxd_buffer[ptrIn++] - '=';
        d = rxd_buffer[ptrIn++] - '=';

        x = (a << 2) | (b >> 4);
        y = ((b & 0x0f) << 4) | (c >> 2);
     876:       22 95           swap    r18
     878:       20 7f           andi    r18, 0xF0       ; 240
     87a:       89 2f           mov     r24, r25
     87c:       86 95           lsr     r24
     87e:       86 95           lsr     r24
     880:       28 2b           or      r18, r24
        z = ((c & 0x03) << 6) | d;

        if (len--) rxd_buffer[ptrOut++] = x;
        else break;
        if (len--) rxd_buffer[ptrOut++] = y;
     882:       e4 51           subi    r30, 0x14       ; 20
     884:       fe 4f           sbci    r31, 0xFE       ; 254
     886:       20 83           st      Z, r18
     888:       e4 2f           mov     r30, r20
     88a:       ee 5f           subi    r30, 0xFE       ; 254
        else break;
        if (len--) rxd_buffer[ptrOut++] = z;
     88c:       52 30           cpi     r21, 0x02       ; 2
     88e:       c1 f1           breq    .+112           ; 0x900 <Decode64+0xa0>
     890:       53 50           subi    r21, 0x03       ; 3
     892:       f0 e0           ldi     r31, 0x00       ; 0
        c = rxd_buffer[ptrIn++] - '=';
        d = rxd_buffer[ptrIn++] - '=';

        x = (a << 2) | (b >> 4);
        y = ((b & 0x0f) << 4) | (c >> 2);
        z = ((c & 0x03) << 6) | d;
     894:       92 95           swap    r25
     896:       99 0f           add     r25, r25
     898:       99 0f           add     r25, r25
     89a:       90 7c           andi    r25, 0xC0       ; 192
     89c:       6d 53           subi    r22, 0x3D       ; 61
     89e:       96 2b           or      r25, r22

        if (len--) rxd_buffer[ptrOut++] = x;
        else break;
        if (len--) rxd_buffer[ptrOut++] = y;
        else break;
        if (len--) rxd_buffer[ptrOut++] = z;
     8a0:       e4 51           subi    r30, 0x14       ; 20
     8a2:       fe 4f           sbci    r31, 0xFE       ; 254
     8a4:       90 83           st      Z, r25
     8a6:       4d 5f           subi    r20, 0xFD       ; 253
    uint8_t x, y, z;
    uint8_t ptrIn = 3;
    uint8_t ptrOut = 3;
    uint8_t len = ReceivedBytes - 6;

    while (len) {
     8a8:       55 23           and     r21, r21
     8aa:       a1 f1           breq    .+104           ; 0x914 <Decode64+0xb4>
        a = rxd_buffer[ptrIn++] - '=';
     8ac:       e3 2f           mov     r30, r19
     8ae:       f0 e0           ldi     r31, 0x00       ; 0
     8b0:       e4 51           subi    r30, 0x14       ; 20
     8b2:       fe 4f           sbci    r31, 0xFE       ; 254
     8b4:       80 81           ld      r24, Z
        b = rxd_buffer[ptrIn++] - '=';
     8b6:       3f 5f           subi    r19, 0xFF       ; 255
     8b8:       e3 2f           mov     r30, r19
     8ba:       f0 e0           ldi     r31, 0x00       ; 0
     8bc:       e4 51           subi    r30, 0x14       ; 20
     8be:       fe 4f           sbci    r31, 0xFE       ; 254
     8c0:       20 81           ld      r18, Z
     8c2:       2d 53           subi    r18, 0x3D       ; 61
        c = rxd_buffer[ptrIn++] - '=';
     8c4:       3f 5f           subi    r19, 0xFF       ; 255
     8c6:       e3 2f           mov     r30, r19
     8c8:       f0 e0           ldi     r31, 0x00       ; 0
     8ca:       e4 51           subi    r30, 0x14       ; 20
     8cc:       fe 4f           sbci    r31, 0xFE       ; 254
     8ce:       70 81           ld      r23, Z
        d = rxd_buffer[ptrIn++] - '=';
     8d0:       3f 5f           subi    r19, 0xFF       ; 255
     8d2:       e3 2f           mov     r30, r19
     8d4:       f0 e0           ldi     r31, 0x00       ; 0
     8d6:       e4 51           subi    r30, 0x14       ; 20
     8d8:       fe 4f           sbci    r31, 0xFE       ; 254
     8da:       60 81           ld      r22, Z
     8dc:       3f 5f           subi    r19, 0xFF       ; 255

        x = (a << 2) | (b >> 4);
     8de:       92 2f           mov     r25, r18
     8e0:       92 95           swap    r25
     8e2:       9f 70           andi    r25, 0x0F       ; 15
     8e4:       8d 53           subi    r24, 0x3D       ; 61
     8e6:       88 0f           add     r24, r24
     8e8:       88 0f           add     r24, r24
     8ea:       89 2b           or      r24, r25
        y = ((b & 0x0f) << 4) | (c >> 2);
        z = ((c & 0x03) << 6) | d;

        if (len--) rxd_buffer[ptrOut++] = x;
     8ec:       e4 2f           mov     r30, r20
     8ee:       f0 e0           ldi     r31, 0x00       ; 0
     8f0:       e4 51           subi    r30, 0x14       ; 20
     8f2:       fe 4f           sbci    r31, 0xFE       ; 254
     8f4:       80 83           st      Z, r24
     8f6:       e4 2f           mov     r30, r20
     8f8:       ef 5f           subi    r30, 0xFF       ; 255
        else break;
        if (len--) rxd_buffer[ptrOut++] = y;
     8fa:       51 30           cpi     r21, 0x01       ; 1
     8fc:       09 f0           breq    .+2             ; 0x900 <Decode64+0xa0>
     8fe:       b8 cf           rjmp    .-144           ; 0x870 <Decode64+0x10>
    uint8_t x, y, z;
    uint8_t ptrIn = 3;
    uint8_t ptrOut = 3;
    uint8_t len = ReceivedBytes - 6;

    while (len) {
     900:       e3 50           subi    r30, 0x03       ; 3
        if (len--) rxd_buffer[ptrOut++] = y;
        else break;
        if (len--) rxd_buffer[ptrOut++] = z;
        else break;
    }
    pRxData = &rxd_buffer[3];
     902:       8f ee           ldi     r24, 0xEF       ; 239
     904:       91 e0           ldi     r25, 0x01       ; 1
     906:       90 93 2c 01     sts     0x012C, r25
     90a:       80 93 2b 01     sts     0x012B, r24
    RxDataLen = ptrOut - 3;
     90e:       e0 93 2d 01     sts     0x012D, r30
}
     912:       08 95           ret
    uint8_t x, y, z;
    uint8_t ptrIn = 3;
    uint8_t ptrOut = 3;
    uint8_t len = ReceivedBytes - 6;

    while (len) {
     914:       e4 2f           mov     r30, r20
     916:       f4 cf           rjmp    .-24            ; 0x900 <Decode64+0xa0>
     918:       e0 e0           ldi     r30, 0x00       ; 0
     91a:       f3 cf           rjmp    .-26            ; 0x902 <Decode64+0xa2>

0000091c <spi_send>:
 * Send a byte through SPI
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
     91c:       48 2f           mov     r20, r24
     91e:       50 e0           ldi     r21, 0x00       ; 0
     920:       27 e0           ldi     r18, 0x07       ; 7
     922:       30 e0           ldi     r19, 0x00       ; 0
     924:       09 c0           rjmp    .+18            ; 0x938 <spi_send+0x1c>
    for (int8_t i = 7; i >= 0; i--) {
        if (((byte >> i) & 1)) {
            MAX_SDIN_HIGH
     926:       da 9a           sbi     0x1b, 2 ; 27
        } else {
            MAX_SDIN_LOW
        }
        MAX_SCLK_HIGH
     928:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     92a:       db 98           cbi     0x1b, 3 ; 27
     92c:       21 50           subi    r18, 0x01       ; 1
     92e:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     930:       8f ef           ldi     r24, 0xFF       ; 255
     932:       2f 3f           cpi     r18, 0xFF       ; 255
     934:       38 07           cpc     r19, r24
     936:       91 f0           breq    .+36            ; 0x95c <spi_send+0x40>
        if (((byte >> i) & 1)) {
     938:       ca 01           movw    r24, r20
     93a:       02 2e           mov     r0, r18
     93c:       02 c0           rjmp    .+4             ; 0x942 <spi_send+0x26>
     93e:       95 95           asr     r25
     940:       87 95           ror     r24
     942:       0a 94           dec     r0
     944:       e2 f7           brpl    .-8             ; 0x93e <spi_send+0x22>
     946:       80 fd           sbrc    r24, 0
     948:       ee cf           rjmp    .-36            ; 0x926 <spi_send+0xa>
            MAX_SDIN_HIGH
        } else {
            MAX_SDIN_LOW
     94a:       da 98           cbi     0x1b, 2 ; 27
        }
        MAX_SCLK_HIGH
     94c:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     94e:       db 98           cbi     0x1b, 3 ; 27
     950:       21 50           subi    r18, 0x01       ; 1
     952:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     954:       8f ef           ldi     r24, 0xFF       ; 255
     956:       2f 3f           cpi     r18, 0xFF       ; 255
     958:       38 07           cpc     r19, r24
     95a:       71 f7           brne    .-36            ; 0x938 <spi_send+0x1c>
            MAX_SDIN_LOW
        }
        MAX_SCLK_HIGH
        MAX_SCLK_LOW
    }
}
     95c:       08 95           ret

0000095e <spi_send_byte>:
/**
 *  Send <byte> to <address> of MAX7456
 */
void spi_send_byte(uint8_t address, uint8_t byte) {
    // start sending
    MAX_CS_LOW
     95e:       d9 98           cbi     0x1b, 1 ; 27
     960:       48 2f           mov     r20, r24
     962:       50 e0           ldi     r21, 0x00       ; 0
     964:       27 e0           ldi     r18, 0x07       ; 7
     966:       30 e0           ldi     r19, 0x00       ; 0
     968:       09 c0           rjmp    .+18            ; 0x97c <spi_send_byte+0x1e>
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
        if (((byte >> i) & 1)) {
            MAX_SDIN_HIGH
     96a:       da 9a           sbi     0x1b, 2 ; 27
        } else {
            MAX_SDIN_LOW
        }
        MAX_SCLK_HIGH
     96c:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     96e:       db 98           cbi     0x1b, 3 ; 27
     970:       21 50           subi    r18, 0x01       ; 1
     972:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     974:       8f ef           ldi     r24, 0xFF       ; 255
     976:       2f 3f           cpi     r18, 0xFF       ; 255
     978:       38 07           cpc     r19, r24
     97a:       91 f0           breq    .+36            ; 0x9a0 <spi_send_byte+0x42>
        if (((byte >> i) & 1)) {
     97c:       ca 01           movw    r24, r20
     97e:       02 2e           mov     r0, r18
     980:       02 c0           rjmp    .+4             ; 0x986 <spi_send_byte+0x28>
     982:       95 95           asr     r25
     984:       87 95           ror     r24
     986:       0a 94           dec     r0
     988:       e2 f7           brpl    .-8             ; 0x982 <spi_send_byte+0x24>
     98a:       80 fd           sbrc    r24, 0
     98c:       ee cf           rjmp    .-36            ; 0x96a <spi_send_byte+0xc>
            MAX_SDIN_HIGH
        } else {
            MAX_SDIN_LOW
     98e:       da 98           cbi     0x1b, 2 ; 27
        }
        MAX_SCLK_HIGH
     990:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     992:       db 98           cbi     0x1b, 3 ; 27
     994:       21 50           subi    r18, 0x01       ; 1
     996:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     998:       8f ef           ldi     r24, 0xFF       ; 255
     99a:       2f 3f           cpi     r18, 0xFF       ; 255
     99c:       38 07           cpc     r19, r24
     99e:       71 f7           brne    .-36            ; 0x97c <spi_send_byte+0x1e>
     9a0:       70 e0           ldi     r23, 0x00       ; 0
     9a2:       27 e0           ldi     r18, 0x07       ; 7
     9a4:       30 e0           ldi     r19, 0x00       ; 0
     9a6:       09 c0           rjmp    .+18            ; 0x9ba <spi_send_byte+0x5c>
        if (((byte >> i) & 1)) {
            MAX_SDIN_HIGH
     9a8:       da 9a           sbi     0x1b, 2 ; 27
        } else {
            MAX_SDIN_LOW
        }
        MAX_SCLK_HIGH
     9aa:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     9ac:       db 98           cbi     0x1b, 3 ; 27
     9ae:       21 50           subi    r18, 0x01       ; 1
     9b0:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     9b2:       8f ef           ldi     r24, 0xFF       ; 255
     9b4:       2f 3f           cpi     r18, 0xFF       ; 255
     9b6:       38 07           cpc     r19, r24
     9b8:       91 f0           breq    .+36            ; 0x9de <spi_send_byte+0x80>
        if (((byte >> i) & 1)) {
     9ba:       cb 01           movw    r24, r22
     9bc:       02 2e           mov     r0, r18
     9be:       02 c0           rjmp    .+4             ; 0x9c4 <spi_send_byte+0x66>
     9c0:       95 95           asr     r25
     9c2:       87 95           ror     r24
     9c4:       0a 94           dec     r0
     9c6:       e2 f7           brpl    .-8             ; 0x9c0 <spi_send_byte+0x62>
     9c8:       80 fd           sbrc    r24, 0
     9ca:       ee cf           rjmp    .-36            ; 0x9a8 <spi_send_byte+0x4a>
            MAX_SDIN_HIGH
        } else {
            MAX_SDIN_LOW
     9cc:       da 98           cbi     0x1b, 2 ; 27
        }
        MAX_SCLK_HIGH
     9ce:       db 9a           sbi     0x1b, 3 ; 27
        MAX_SCLK_LOW
     9d0:       db 98           cbi     0x1b, 3 ; 27
     9d2:       21 50           subi    r18, 0x01       ; 1
     9d4:       30 40           sbci    r19, 0x00       ; 0
 * inline because it increases the codesize currenlty 'only' by 110byte but saves
 * the context-change on every char and attribute which is at least done twice
 * (address and data byte), a significant speed-bost we do not want to miss :)
 */
inline void spi_send(uint8_t byte) {
    for (int8_t i = 7; i >= 0; i--) {
     9d6:       8f ef           ldi     r24, 0xFF       ; 255
     9d8:       2f 3f           cpi     r18, 0xFF       ; 255
     9da:       38 07           cpc     r19, r24
     9dc:       71 f7           brne    .-36            ; 0x9ba <spi_send_byte+0x5c>

    spi_send(address);
    spi_send(byte);

    // end sending
    MAX_CS_HIGH
     9de:       d9 9a           sbi     0x1b, 1 ; 27
}
     9e0:       08 95           ret

000009e2 <write_char>:


/**
 *  write a <character> to <address> of MAX7456 display memory
 */
void write_char(uint16_t address, char character) {
     9e2:       0f 93           push    r16
     9e4:       1f 93           push    r17
     9e6:       18 2f           mov     r17, r24
     9e8:       06 2f           mov     r16, r22
    spi_send_byte(0x05, (address & 0xFF00) >> 8); // DMAH
     9ea:       85 e0           ldi     r24, 0x05       ; 5
     9ec:       69 2f           mov     r22, r25
     9ee:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
    spi_send_byte(0x06, (address & 0x00FF)); // DMAL
     9f2:       86 e0           ldi     r24, 0x06       ; 6
     9f4:       61 2f           mov     r22, r17
     9f6:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
    spi_send_byte(0x07, character); // DMDI
     9fa:       87 e0           ldi     r24, 0x07       ; 7
     9fc:       60 2f           mov     r22, r16
     9fe:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
}
     a02:       1f 91           pop     r17
     a04:       0f 91           pop     r16
     a06:       08 95           ret

00000a08 <write_char_xy>:
/**
 *  write a <character> at <x>/<y> to MAX7456 display memory
 */
void write_char_xy(uint8_t x, uint8_t y, char character) {
    uint16_t address = y * 30 + x;
    write_char(address, character);
     a08:       9e e1           ldi     r25, 0x1E       ; 30
     a0a:       69 9f           mul     r22, r25
     a0c:       b0 01           movw    r22, r0
     a0e:       11 24           eor     r1, r1
     a10:       9b 01           movw    r18, r22
     a12:       28 0f           add     r18, r24
     a14:       31 1d           adc     r19, r1
     a16:       c9 01           movw    r24, r18
     a18:       64 2f           mov     r22, r20
     a1a:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
}
     a1e:       08 95           ret

00000a20 <write_ascii_char>:
}

/**
 *  write an ascii <character> to <address> of MAX7456 display memory
 */
void write_ascii_char(uint16_t address, char c) {
     a20:       9c 01           movw    r18, r24
    if (c == 32) c = 0; // remap space
     a22:       60 32           cpi     r22, 0x20       ; 32
     a24:       19 f1           breq    .+70            ; 0xa6c <write_ascii_char+0x4c>
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
     a26:       86 2f           mov     r24, r22
     a28:       81 53           subi    r24, 0x31       ; 49
     a2a:       89 30           cpi     r24, 0x09       ; 9
     a2c:       d0 f0           brcs    .+52            ; 0xa62 <write_ascii_char+0x42>
    else if (c == '0') c = 10; // remap zero
     a2e:       60 33           cpi     r22, 0x30       ; 48
     a30:       39 f1           breq    .+78            ; 0xa80 <write_ascii_char+0x60>
    else if (c >= 65 && c <= 90) c -= 54; // remap big letters
     a32:       86 2f           mov     r24, r22
     a34:       81 54           subi    r24, 0x41       ; 65
     a36:       8a 31           cpi     r24, 0x1A       ; 26
     a38:       f0 f0           brcs    .+60            ; 0xa76 <write_ascii_char+0x56>
    else if (c >= 97 && c <= 122) c -= 60; // remap small letters
     a3a:       86 2f           mov     r24, r22
     a3c:       81 56           subi    r24, 0x61       ; 97
     a3e:       8a 31           cpi     r24, 0x1A       ; 26
     a40:       20 f1           brcs    .+72            ; 0xa8a <write_ascii_char+0x6a>
    else if (c == '(') c = 63; // remap
     a42:       68 32           cpi     r22, 0x28       ; 40
     a44:       31 f1           breq    .+76            ; 0xa92 <write_ascii_char+0x72>
    else if (c == ')') c = 64; // remap
     a46:       69 32           cpi     r22, 0x29       ; 41
     a48:       11 f1           breq    .+68            ; 0xa8e <write_ascii_char+0x6e>
    else if (c == '.') c = 65; // remap
     a4a:       6e 32           cpi     r22, 0x2E       ; 46
     a4c:       21 f1           breq    .+72            ; 0xa96 <write_ascii_char+0x76>
    else if (c == '-') c = 73; // remap minus
     a4e:       6d 32           cpi     r22, 0x2D       ; 45
     a50:       21 f1           breq    .+72            ; 0xa9a <write_ascii_char+0x7a>
    else if (c == ';') c = 67; // remap
     a52:       6b 33           cpi     r22, 0x3B       ; 59
     a54:       21 f1           breq    .+72            ; 0xa9e <write_ascii_char+0x7e>
    else if (c == ':') c = 68; // remap
     a56:       6a 33           cpi     r22, 0x3A       ; 58
     a58:       21 f1           breq    .+72            ; 0xaa2 <write_ascii_char+0x82>
    else if (c == ',') c = 69; // remap
     a5a:       6c 32           cpi     r22, 0x2C       ; 44
     a5c:       19 f4           brne    .+6             ; 0xa64 <write_ascii_char+0x44>
     a5e:       65 e4           ldi     r22, 0x45       ; 69
     a60:       01 c0           rjmp    .+2             ; 0xa64 <write_ascii_char+0x44>
/**
 *  write an ascii <character> to <address> of MAX7456 display memory
 */
void write_ascii_char(uint16_t address, char c) {
    if (c == 32) c = 0; // remap space
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
     a62:       60 53           subi    r22, 0x30       ; 48
//    else if (c == '/') c = 71; // remap
//    else if (c == '"') c = 72; // remap
//    else if (c == '<') c = 74; // remap
//    else if (c == '>') c = 75; // remap
//    else if (c == '@') c = 76; // remap
    write_char(address, c);
     a64:       c9 01           movw    r24, r18
     a66:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
}
     a6a:       08 95           ret

/**
 *  write an ascii <character> to <address> of MAX7456 display memory
 */
void write_ascii_char(uint16_t address, char c) {
    if (c == 32) c = 0; // remap space
     a6c:       60 e0           ldi     r22, 0x00       ; 0
//    else if (c == '/') c = 71; // remap
//    else if (c == '"') c = 72; // remap
//    else if (c == '<') c = 74; // remap
//    else if (c == '>') c = 75; // remap
//    else if (c == '@') c = 76; // remap
    write_char(address, c);
     a6e:       c9 01           movw    r24, r18
     a70:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
}
     a74:       08 95           ret
 */
void write_ascii_char(uint16_t address, char c) {
    if (c == 32) c = 0; // remap space
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
    else if (c == '0') c = 10; // remap zero
    else if (c >= 65 && c <= 90) c -= 54; // remap big letters
     a76:       66 53           subi    r22, 0x36       ; 54
//    else if (c == '/') c = 71; // remap
//    else if (c == '"') c = 72; // remap
//    else if (c == '<') c = 74; // remap
//    else if (c == '>') c = 75; // remap
//    else if (c == '@') c = 76; // remap
    write_char(address, c);
     a78:       c9 01           movw    r24, r18
     a7a:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
}
     a7e:       08 95           ret
 *  write an ascii <character> to <address> of MAX7456 display memory
 */
void write_ascii_char(uint16_t address, char c) {
    if (c == 32) c = 0; // remap space
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
    else if (c == '0') c = 10; // remap zero
     a80:       6a e0           ldi     r22, 0x0A       ; 10
//    else if (c == '/') c = 71; // remap
//    else if (c == '"') c = 72; // remap
//    else if (c == '<') c = 74; // remap
//    else if (c == '>') c = 75; // remap
//    else if (c == '@') c = 76; // remap
    write_char(address, c);
     a82:       c9 01           movw    r24, r18
     a84:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
}
     a88:       08 95           ret
void write_ascii_char(uint16_t address, char c) {
    if (c == 32) c = 0; // remap space
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
    else if (c == '0') c = 10; // remap zero
    else if (c >= 65 && c <= 90) c -= 54; // remap big letters
    else if (c >= 97 && c <= 122) c -= 60; // remap small letters
     a8a:       6c 53           subi    r22, 0x3C       ; 60
     a8c:       eb cf           rjmp    .-42            ; 0xa64 <write_ascii_char+0x44>
    else if (c == '(') c = 63; // remap
    else if (c == ')') c = 64; // remap
     a8e:       60 e4           ldi     r22, 0x40       ; 64
     a90:       e9 cf           rjmp    .-46            ; 0xa64 <write_ascii_char+0x44>
    if (c == 32) c = 0; // remap space
    else if (c > 48 && c <= 57) c -= 48; // remap numbers
    else if (c == '0') c = 10; // remap zero
    else if (c >= 65 && c <= 90) c -= 54; // remap big letters
    else if (c >= 97 && c <= 122) c -= 60; // remap small letters
    else if (c == '(') c = 63; // remap
     a92:       6f e3           ldi     r22, 0x3F       ; 63
     a94:       e7 cf           rjmp    .-50            ; 0xa64 <write_ascii_char+0x44>
    else if (c == ')') c = 64; // remap
    else if (c == '.') c = 65; // remap
     a96:       61 e4           ldi     r22, 0x41       ; 65
     a98:       e5 cf           rjmp    .-54            ; 0xa64 <write_ascii_char+0x44>
    else if (c == '-') c = 73; // remap minus
     a9a:       69 e4           ldi     r22, 0x49       ; 73
     a9c:       e3 cf           rjmp    .-58            ; 0xa64 <write_ascii_char+0x44>
    else if (c == ';') c = 67; // remap
     a9e:       63 e4           ldi     r22, 0x43       ; 67
     aa0:       e1 cf           rjmp    .-62            ; 0xa64 <write_ascii_char+0x44>
    else if (c == ':') c = 68; // remap
     aa2:       64 e4           ldi     r22, 0x44       ; 68
     aa4:       df cf           rjmp    .-66            ; 0xa64 <write_ascii_char+0x44>

00000aa6 <write_ascii_string>:
}

/**
 *  write an ascii <string> at <x>/<y> to MAX7456 display memory
 */
void write_ascii_string(uint8_t x, uint8_t y, char *string) {
     aa6:       ff 92           push    r15
     aa8:       0f 93           push    r16
     aaa:       1f 93           push    r17
     aac:       cf 93           push    r28
     aae:       df 93           push    r29
     ab0:       f8 2e           mov     r15, r24
     ab2:       ea 01           movw    r28, r20
    while (*string) {
     ab4:       48 81           ld      r20, Y
     ab6:       44 23           and     r20, r20
     ab8:       d9 f0           breq    .+54            ; 0xaf0 <write_ascii_string+0x4a>
     aba:       26 2f           mov     r18, r22
     abc:       30 e0           ldi     r19, 0x00       ; 0
     abe:       c9 01           movw    r24, r18
     ac0:       88 0f           add     r24, r24
     ac2:       99 1f           adc     r25, r25
     ac4:       82 0f           add     r24, r18
     ac6:       93 1f           adc     r25, r19
     ac8:       8c 01           movw    r16, r24
     aca:       00 0f           add     r16, r16
     acc:       11 1f           adc     r17, r17
     ace:       00 0f           add     r16, r16
     ad0:       11 1f           adc     r17, r17
     ad2:       08 0f           add     r16, r24
     ad4:       19 1f           adc     r17, r25
     ad6:       00 0f           add     r16, r16
     ad8:       11 1f           adc     r17, r17
        write_ascii_char(((x++)+(y * 30)), *string);
     ada:       c8 01           movw    r24, r16
     adc:       8f 0d           add     r24, r15
     ade:       91 1d           adc     r25, r1
     ae0:       f3 94           inc     r15
     ae2:       64 2f           mov     r22, r20
     ae4:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
        string++;
     ae8:       21 96           adiw    r28, 0x01       ; 1

/**
 *  write an ascii <string> at <x>/<y> to MAX7456 display memory
 */
void write_ascii_string(uint8_t x, uint8_t y, char *string) {
    while (*string) {
     aea:       48 81           ld      r20, Y
     aec:       44 23           and     r20, r20
     aee:       a9 f7           brne    .-22            ; 0xada <write_ascii_string+0x34>
        write_ascii_char(((x++)+(y * 30)), *string);
        string++;
    }
}
     af0:       df 91           pop     r29
     af2:       cf 91           pop     r28
     af4:       1f 91           pop     r17
     af6:       0f 91           pop     r16
     af8:       ff 90           pop     r15
     afa:       08 95           ret

00000afc <write_ascii_string_pgm>:

/**
 *  write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory
 */
void write_ascii_string_pgm(uint8_t x, uint8_t y, const char *string) {
     afc:       ff 92           push    r15
     afe:       0f 93           push    r16
     b00:       1f 93           push    r17
     b02:       cf 93           push    r28
     b04:       df 93           push    r29
     b06:       f8 2e           mov     r15, r24
     b08:       ea 01           movw    r28, r20
        while (pgm_read_byte(string) != 0x00) 
     b0a:       fe 01           movw    r30, r28
     b0c:       84 91           lpm     r24, Z+
     b0e:       88 23           and     r24, r24
     b10:       f1 f0           breq    .+60            ; 0xb4e <write_ascii_string_pgm+0x52>
     b12:       26 2f           mov     r18, r22
     b14:       30 e0           ldi     r19, 0x00       ; 0
     b16:       c9 01           movw    r24, r18
     b18:       88 0f           add     r24, r24
     b1a:       99 1f           adc     r25, r25
     b1c:       82 0f           add     r24, r18
     b1e:       93 1f           adc     r25, r19
     b20:       8c 01           movw    r16, r24
     b22:       00 0f           add     r16, r16
     b24:       11 1f           adc     r17, r17
     b26:       00 0f           add     r16, r16
     b28:       11 1f           adc     r17, r17
     b2a:       08 0f           add     r16, r24
     b2c:       19 1f           adc     r17, r25
     b2e:       00 0f           add     r16, r16
     b30:       11 1f           adc     r17, r17
                write_ascii_char(((x++)+(y * 30)), pgm_read_byte(string++));
     b32:       c8 01           movw    r24, r16
     b34:       8f 0d           add     r24, r15
     b36:       91 1d           adc     r25, r1
     b38:       f3 94           inc     r15
     b3a:       21 96           adiw    r28, 0x01       ; 1
     b3c:       fa 01           movw    r30, r20
     b3e:       64 91           lpm     r22, Z+
     b40:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
     b44:       ae 01           movw    r20, r28

/**
 *  write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory
 */
void write_ascii_string_pgm(uint8_t x, uint8_t y, const char *string) {
        while (pgm_read_byte(string) != 0x00) 
     b46:       fe 01           movw    r30, r28
     b48:       84 91           lpm     r24, Z+
     b4a:       88 23           and     r24, r24
     b4c:       91 f7           brne    .-28            ; 0xb32 <write_ascii_string_pgm+0x36>
                write_ascii_char(((x++)+(y * 30)), pgm_read_byte(string++));
}
     b4e:       df 91           pop     r29
     b50:       cf 91           pop     r28
     b52:       1f 91           pop     r17
     b54:       0f 91           pop     r16
     b56:       ff 90           pop     r15
     b58:       08 95           ret

00000b5a <write_string_pgm_down>:

/**
 *  write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory
 */
void write_string_pgm_down(uint8_t x, uint8_t y, const char *string, uint8_t length) {
     b5a:       df 92           push    r13
     b5c:       ef 92           push    r14
     b5e:       ff 92           push    r15
     b60:       0f 93           push    r16
     b62:       1f 93           push    r17
     b64:       cf 93           push    r28
     b66:       df 93           push    r29
     b68:       06 2f           mov     r16, r22
     b6a:       ea 01           movw    r28, r20
     b6c:       12 2f           mov     r17, r18
        while (length--) 
     b6e:       22 23           and     r18, r18
     b70:       91 f0           breq    .+36            ; 0xb96 <write_string_pgm_down+0x3c>
     b72:       e8 2e           mov     r14, r24
     b74:       ff 24           eor     r15, r15
                write_char((x+(y++ * 30)), pgm_read_byte(string++));
     b76:       fe e1           ldi     r31, 0x1E       ; 30
     b78:       df 2e           mov     r13, r31
     b7a:       0d 9d           mul     r16, r13
     b7c:       c0 01           movw    r24, r0
     b7e:       11 24           eor     r1, r1
     b80:       0f 5f           subi    r16, 0xFF       ; 255
     b82:       fe 01           movw    r30, r28
     b84:       21 96           adiw    r28, 0x01       ; 1
     b86:       e4 91           lpm     r30, Z+
     b88:       8e 0d           add     r24, r14
     b8a:       9f 1d           adc     r25, r15
     b8c:       6e 2f           mov     r22, r30
     b8e:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
     b92:       11 50           subi    r17, 0x01       ; 1

/**
 *  write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory
 */
void write_string_pgm_down(uint8_t x, uint8_t y, const char *string, uint8_t length) {
        while (length--) 
     b94:       91 f7           brne    .-28            ; 0xb7a <write_string_pgm_down+0x20>
                write_char((x+(y++ * 30)), pgm_read_byte(string++));
}
     b96:       df 91           pop     r29
     b98:       cf 91           pop     r28
     b9a:       1f 91           pop     r17
     b9c:       0f 91           pop     r16
     b9e:       ff 90           pop     r15
     ba0:       ef 90           pop     r14
     ba2:       df 90           pop     r13
     ba4:       08 95           ret

00000ba6 <write_ndigit_number_s_10th>:
/**
 * Write a signed <number> at <x>/<y> to MAX7456 display memory as /10th of value
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
     ba6:       8f 92           push    r8
     ba8:       9f 92           push    r9
     baa:       af 92           push    r10
     bac:       bf 92           push    r11
     bae:       cf 92           push    r12
     bb0:       df 92           push    r13
     bb2:       ef 92           push    r14
     bb4:       ff 92           push    r15
     bb6:       0f 93           push    r16
     bb8:       1f 93           push    r17
     bba:       cf 93           push    r28
     bbc:       df 93           push    r29
     bbe:       d8 2e           mov     r13, r24
     bc0:       86 2e           mov     r8, r22
     bc2:       ca 01           movw    r24, r20
     bc4:       e9 01           movw    r28, r18
     bc6:       c0 2e           mov     r12, r16
        itoa(number, conv_array, 10 );
     bc8:       06 e9           ldi     r16, 0x96       ; 150
     bca:       12 e0           ldi     r17, 0x02       ; 2
     bcc:       b8 01           movw    r22, r16
     bce:       4a e0           ldi     r20, 0x0A       ; 10
     bd0:       50 e0           ldi     r21, 0x00       ; 0
     bd2:       0e 94 cc 1c     call    0x3998  ; 0x3998 <itoa>
        uint8_t len = strlen(conv_array);
     bd6:       f8 01           movw    r30, r16
     bd8:       01 90           ld      r0, Z+
     bda:       00 20           and     r0, r0
     bdc:       e9 f7           brne    .-6             ; 0xbd8 <write_ndigit_number_s_10th+0x32>
     bde:       8f 01           movw    r16, r30
     be0:       01 50           subi    r16, 0x01       ; 1
     be2:       10 40           sbci    r17, 0x00       ; 0
     be4:       06 59           subi    r16, 0x96       ; 150
     be6:       12 40           sbci    r17, 0x02       ; 2
     be8:       90 2e           mov     r9, r16
        for (uint8_t i = 0; i < length - len; i++) {
     bea:       a0 2e           mov     r10, r16
     bec:       bb 24           eor     r11, r11
     bee:       ca 19           sub     r28, r10
     bf0:       db 09           sbc     r29, r11
     bf2:       1c 16           cp      r1, r28
     bf4:       1d 06           cpc     r1, r29
     bf6:       0c f0           brlt    .+2             ; 0xbfa <write_ndigit_number_s_10th+0x54>
     bf8:       74 c0           rjmp    .+232           ; 0xce2 <write_ndigit_number_s_10th+0x13c>
     bfa:       8e e1           ldi     r24, 0x1E       ; 30
     bfc:       88 9e           mul     r8, r24
     bfe:       70 01           movw    r14, r0
     c00:       11 24           eor     r1, r1
     c02:       d3 94           inc     r13
     c04:       10 e0           ldi     r17, 0x00       ; 0
     c06:       10 c0           rjmp    .+32            ; 0xc28 <write_ndigit_number_s_10th+0x82>
                if (pad) write_char((x++)+(y * 30), 10); //  zero
     c08:       97 01           movw    r18, r14
     c0a:       28 0f           add     r18, r24
     c0c:       31 1d           adc     r19, r1
     c0e:       c9 01           movw    r24, r18
     c10:       6a e0           ldi     r22, 0x0A       ; 10
     c12:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     c16:       1f 5f           subi    r17, 0xFF       ; 255
     c18:       2d 2d           mov     r18, r13
     c1a:       2f 5f           subi    r18, 0xFF       ; 255
     c1c:       81 2f           mov     r24, r17
     c1e:       90 e0           ldi     r25, 0x00       ; 0
     c20:       8c 17           cp      r24, r28
     c22:       9d 07           cpc     r25, r29
     c24:       a4 f4           brge    .+40            ; 0xc4e <write_ndigit_number_s_10th+0xa8>
     c26:       d2 2e           mov     r13, r18
     c28:       8d 2d           mov     r24, r13
     c2a:       81 50           subi    r24, 0x01       ; 1
                if (pad) write_char((x++)+(y * 30), 10); //  zero
     c2c:       cc 20           and     r12, r12
     c2e:       61 f7           brne    .-40            ; 0xc08 <write_ndigit_number_s_10th+0x62>
                else write_char((x++)+(y * 30), 0); // blank
     c30:       f7 01           movw    r30, r14
     c32:       e8 0f           add     r30, r24
     c34:       f1 1d           adc     r31, r1
     c36:       cf 01           movw    r24, r30
     c38:       60 e0           ldi     r22, 0x00       ; 0
     c3a:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     c3e:       1f 5f           subi    r17, 0xFF       ; 255
     c40:       2d 2d           mov     r18, r13
     c42:       2f 5f           subi    r18, 0xFF       ; 255
     c44:       81 2f           mov     r24, r17
     c46:       90 e0           ldi     r25, 0x00       ; 0
     c48:       8c 17           cp      r24, r28
     c4a:       9d 07           cpc     r25, r29
     c4c:       64 f3           brlt    .-40            ; 0xc26 <write_ndigit_number_s_10th+0x80>
                if (pad) write_char((x++)+(y * 30), 10); //  zero
                else write_char((x++)+(y * 30), 0); // blank
        }
        char rest = conv_array[len - 1];
     c4e:       f5 01           movw    r30, r10
     c50:       eb 56           subi    r30, 0x6B       ; 107
     c52:       fd 4f           sbci    r31, 0xFD       ; 253
     c54:       c0 80           ld      r12, Z
        conv_array[len - 1] = 0;
     c56:       10 82           st      Z, r1
        if (len == 1) {
     c58:       f1 e0           ldi     r31, 0x01       ; 1
     c5a:       9f 16           cp      r9, r31
     c5c:       d1 f1           breq    .+116           ; 0xcd2 <write_ndigit_number_s_10th+0x12c>
                write_char((x-1)+(y * 30), 10); // zero
        } else if (len == 2 && conv_array[0] == '-') {
     c5e:       22 e0           ldi     r18, 0x02       ; 2
     c60:       92 16           cp      r9, r18
     c62:       19 f1           breq    .+70            ; 0xcaa <write_ndigit_number_s_10th+0x104>
                write_char((x-1)+(y * 30), 0x49); // minus
                write_char((x)+(y * 30), 10); // zero
        } else {
                write_ascii_string(x,  y, conv_array);
     c64:       8d 2d           mov     r24, r13
     c66:       68 2d           mov     r22, r8
     c68:       46 e9           ldi     r20, 0x96       ; 150
     c6a:       52 e0           ldi     r21, 0x02       ; 2
     c6c:       0e 94 53 05     call    0xaa6   ; 0xaa6 <write_ascii_string>
        }
        x += len - 1;
     c70:       19 2d           mov     r17, r9
     c72:       11 50           subi    r17, 0x01       ; 1
     c74:       1d 0d           add     r17, r13
        write_char((x++)+(y * 30), 65); // decimal point
     c76:       c7 01           movw    r24, r14
     c78:       81 0f           add     r24, r17
     c7a:       91 1d           adc     r25, r1
     c7c:       61 e4           ldi     r22, 0x41       ; 65
     c7e:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
        write_ascii_char((x++)+(y * 30), rest); // after dot
     c82:       1f 5f           subi    r17, 0xFF       ; 255
     c84:       c7 01           movw    r24, r14
     c86:       81 0f           add     r24, r17
     c88:       91 1d           adc     r25, r1
     c8a:       6c 2d           mov     r22, r12
     c8c:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
}
     c90:       df 91           pop     r29
     c92:       cf 91           pop     r28
     c94:       1f 91           pop     r17
     c96:       0f 91           pop     r16
     c98:       ff 90           pop     r15
     c9a:       ef 90           pop     r14
     c9c:       df 90           pop     r13
     c9e:       cf 90           pop     r12
     ca0:       bf 90           pop     r11
     ca2:       af 90           pop     r10
     ca4:       9f 90           pop     r9
     ca6:       8f 90           pop     r8
     ca8:       08 95           ret
        }
        char rest = conv_array[len - 1];
        conv_array[len - 1] = 0;
        if (len == 1) {
                write_char((x-1)+(y * 30), 10); // zero
        } else if (len == 2 && conv_array[0] == '-') {
     caa:       80 91 96 02     lds     r24, 0x0296
     cae:       8d 32           cpi     r24, 0x2D       ; 45
     cb0:       c9 f6           brne    .-78            ; 0xc64 <write_ndigit_number_s_10th+0xbe>
                write_char((x-1)+(y * 30), 0x49); // minus
     cb2:       0d 2d           mov     r16, r13
     cb4:       10 e0           ldi     r17, 0x00       ; 0
     cb6:       c7 01           movw    r24, r14
     cb8:       01 97           sbiw    r24, 0x01       ; 1
     cba:       80 0f           add     r24, r16
     cbc:       91 1f           adc     r25, r17
     cbe:       69 e4           ldi     r22, 0x49       ; 73
     cc0:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
                write_char((x)+(y * 30), 10); // zero
     cc4:       c8 01           movw    r24, r16
     cc6:       8e 0d           add     r24, r14
     cc8:       9f 1d           adc     r25, r15
     cca:       6a e0           ldi     r22, 0x0A       ; 10
     ccc:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
     cd0:       cf cf           rjmp    .-98            ; 0xc70 <write_ndigit_number_s_10th+0xca>
                else write_char((x++)+(y * 30), 0); // blank
        }
        char rest = conv_array[len - 1];
        conv_array[len - 1] = 0;
        if (len == 1) {
                write_char((x-1)+(y * 30), 10); // zero
     cd2:       c7 01           movw    r24, r14
     cd4:       01 97           sbiw    r24, 0x01       ; 1
     cd6:       8d 0d           add     r24, r13
     cd8:       91 1d           adc     r25, r1
     cda:       6a e0           ldi     r22, 0x0A       ; 10
     cdc:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
     ce0:       c7 cf           rjmp    .-114           ; 0xc70 <write_ndigit_number_s_10th+0xca>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     ce2:       8e e1           ldi     r24, 0x1E       ; 30
     ce4:       88 9e           mul     r8, r24
     ce6:       70 01           movw    r14, r0
     ce8:       11 24           eor     r1, r1
     cea:       b1 cf           rjmp    .-158           ; 0xc4e <write_ndigit_number_s_10th+0xa8>

00000cec <write_ndigit_number_u_10th>:
/**
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory as /10th of value
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
     cec:       8f 92           push    r8
     cee:       9f 92           push    r9
     cf0:       af 92           push    r10
     cf2:       bf 92           push    r11
     cf4:       cf 92           push    r12
     cf6:       df 92           push    r13
     cf8:       ef 92           push    r14
     cfa:       ff 92           push    r15
     cfc:       0f 93           push    r16
     cfe:       1f 93           push    r17
     d00:       cf 93           push    r28
     d02:       df 93           push    r29
     d04:       d8 2e           mov     r13, r24
     d06:       86 2e           mov     r8, r22
     d08:       ca 01           movw    r24, r20
     d0a:       e9 01           movw    r28, r18
     d0c:       c0 2e           mov     r12, r16
        itoa(number, conv_array, 10 );
     d0e:       06 e9           ldi     r16, 0x96       ; 150
     d10:       12 e0           ldi     r17, 0x02       ; 2
     d12:       b8 01           movw    r22, r16
     d14:       4a e0           ldi     r20, 0x0A       ; 10
     d16:       50 e0           ldi     r21, 0x00       ; 0
     d18:       0e 94 cc 1c     call    0x3998  ; 0x3998 <itoa>
        uint8_t len = strlen(conv_array);
     d1c:       f8 01           movw    r30, r16
     d1e:       01 90           ld      r0, Z+
     d20:       00 20           and     r0, r0
     d22:       e9 f7           brne    .-6             ; 0xd1e <write_ndigit_number_u_10th+0x32>
     d24:       8f 01           movw    r16, r30
     d26:       01 50           subi    r16, 0x01       ; 1
     d28:       10 40           sbci    r17, 0x00       ; 0
     d2a:       06 59           subi    r16, 0x96       ; 150
     d2c:       12 40           sbci    r17, 0x02       ; 2
     d2e:       90 2e           mov     r9, r16
        for (uint8_t i = 0; i < length - len; i++) {
     d30:       a0 2e           mov     r10, r16
     d32:       bb 24           eor     r11, r11
     d34:       ca 19           sub     r28, r10
     d36:       db 09           sbc     r29, r11
     d38:       1c 16           cp      r1, r28
     d3a:       1d 06           cpc     r1, r29
     d3c:       0c f0           brlt    .+2             ; 0xd40 <write_ndigit_number_u_10th+0x54>
     d3e:       74 c0           rjmp    .+232           ; 0xe28 <write_ndigit_number_u_10th+0x13c>
     d40:       8e e1           ldi     r24, 0x1E       ; 30
     d42:       88 9e           mul     r8, r24
     d44:       70 01           movw    r14, r0
     d46:       11 24           eor     r1, r1
     d48:       d3 94           inc     r13
     d4a:       10 e0           ldi     r17, 0x00       ; 0
     d4c:       10 c0           rjmp    .+32            ; 0xd6e <write_ndigit_number_u_10th+0x82>
                if (pad) write_char((x++)+(y * 30), 10); //  zero
     d4e:       97 01           movw    r18, r14
     d50:       28 0f           add     r18, r24
     d52:       31 1d           adc     r19, r1
     d54:       c9 01           movw    r24, r18
     d56:       6a e0           ldi     r22, 0x0A       ; 10
     d58:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     d5c:       1f 5f           subi    r17, 0xFF       ; 255
     d5e:       2d 2d           mov     r18, r13
     d60:       2f 5f           subi    r18, 0xFF       ; 255
     d62:       81 2f           mov     r24, r17
     d64:       90 e0           ldi     r25, 0x00       ; 0
     d66:       8c 17           cp      r24, r28
     d68:       9d 07           cpc     r25, r29
     d6a:       a4 f4           brge    .+40            ; 0xd94 <write_ndigit_number_u_10th+0xa8>
     d6c:       d2 2e           mov     r13, r18
     d6e:       8d 2d           mov     r24, r13
     d70:       81 50           subi    r24, 0x01       ; 1
                if (pad) write_char((x++)+(y * 30), 10); //  zero
     d72:       cc 20           and     r12, r12
     d74:       61 f7           brne    .-40            ; 0xd4e <write_ndigit_number_u_10th+0x62>
                else write_char((x++)+(y * 30), 0); // blank
     d76:       f7 01           movw    r30, r14
     d78:       e8 0f           add     r30, r24
     d7a:       f1 1d           adc     r31, r1
     d7c:       cf 01           movw    r24, r30
     d7e:       60 e0           ldi     r22, 0x00       ; 0
     d80:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     d84:       1f 5f           subi    r17, 0xFF       ; 255
     d86:       2d 2d           mov     r18, r13
     d88:       2f 5f           subi    r18, 0xFF       ; 255
     d8a:       81 2f           mov     r24, r17
     d8c:       90 e0           ldi     r25, 0x00       ; 0
     d8e:       8c 17           cp      r24, r28
     d90:       9d 07           cpc     r25, r29
     d92:       64 f3           brlt    .-40            ; 0xd6c <write_ndigit_number_u_10th+0x80>
                if (pad) write_char((x++)+(y * 30), 10); //  zero
                else write_char((x++)+(y * 30), 0); // blank
        }
        char rest = conv_array[len - 1];
     d94:       f5 01           movw    r30, r10
     d96:       eb 56           subi    r30, 0x6B       ; 107
     d98:       fd 4f           sbci    r31, 0xFD       ; 253
     d9a:       c0 80           ld      r12, Z
        conv_array[len - 1] = 0;
     d9c:       10 82           st      Z, r1
        if (len == 1) {
     d9e:       f1 e0           ldi     r31, 0x01       ; 1
     da0:       9f 16           cp      r9, r31
     da2:       d1 f1           breq    .+116           ; 0xe18 <write_ndigit_number_u_10th+0x12c>
                write_char((x-1)+(y * 30), 10); // zero
        } else if (len == 2 && conv_array[0] == '-') {
     da4:       22 e0           ldi     r18, 0x02       ; 2
     da6:       92 16           cp      r9, r18
     da8:       19 f1           breq    .+70            ; 0xdf0 <write_ndigit_number_u_10th+0x104>
                write_char((x-1)+(y * 30), 0x49); // minus
                write_char((x)+(y * 30), 10); // zero
        } else {
                write_ascii_string(x,  y, conv_array);
     daa:       8d 2d           mov     r24, r13
     dac:       68 2d           mov     r22, r8
     dae:       46 e9           ldi     r20, 0x96       ; 150
     db0:       52 e0           ldi     r21, 0x02       ; 2
     db2:       0e 94 53 05     call    0xaa6   ; 0xaa6 <write_ascii_string>
        }
        x += len - 1;
     db6:       19 2d           mov     r17, r9
     db8:       11 50           subi    r17, 0x01       ; 1
     dba:       1d 0d           add     r17, r13
        write_char((x++)+(y * 30), 65); // decimal point
     dbc:       c7 01           movw    r24, r14
     dbe:       81 0f           add     r24, r17
     dc0:       91 1d           adc     r25, r1
     dc2:       61 e4           ldi     r22, 0x41       ; 65
     dc4:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
        write_ascii_char((x++)+(y * 30), rest); // after dot
     dc8:       1f 5f           subi    r17, 0xFF       ; 255
     dca:       c7 01           movw    r24, r14
     dcc:       81 0f           add     r24, r17
     dce:       91 1d           adc     r25, r1
     dd0:       6c 2d           mov     r22, r12
     dd2:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
}
     dd6:       df 91           pop     r29
     dd8:       cf 91           pop     r28
     dda:       1f 91           pop     r17
     ddc:       0f 91           pop     r16
     dde:       ff 90           pop     r15
     de0:       ef 90           pop     r14
     de2:       df 90           pop     r13
     de4:       cf 90           pop     r12
     de6:       bf 90           pop     r11
     de8:       af 90           pop     r10
     dea:       9f 90           pop     r9
     dec:       8f 90           pop     r8
     dee:       08 95           ret
        }
        char rest = conv_array[len - 1];
        conv_array[len - 1] = 0;
        if (len == 1) {
                write_char((x-1)+(y * 30), 10); // zero
        } else if (len == 2 && conv_array[0] == '-') {
     df0:       80 91 96 02     lds     r24, 0x0296
     df4:       8d 32           cpi     r24, 0x2D       ; 45
     df6:       c9 f6           brne    .-78            ; 0xdaa <write_ndigit_number_u_10th+0xbe>
                write_char((x-1)+(y * 30), 0x49); // minus
     df8:       0d 2d           mov     r16, r13
     dfa:       10 e0           ldi     r17, 0x00       ; 0
     dfc:       c7 01           movw    r24, r14
     dfe:       01 97           sbiw    r24, 0x01       ; 1
     e00:       80 0f           add     r24, r16
     e02:       91 1f           adc     r25, r17
     e04:       69 e4           ldi     r22, 0x49       ; 73
     e06:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
                write_char((x)+(y * 30), 10); // zero
     e0a:       c8 01           movw    r24, r16
     e0c:       8e 0d           add     r24, r14
     e0e:       9f 1d           adc     r25, r15
     e10:       6a e0           ldi     r22, 0x0A       ; 10
     e12:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
     e16:       cf cf           rjmp    .-98            ; 0xdb6 <write_ndigit_number_u_10th+0xca>
                else write_char((x++)+(y * 30), 0); // blank
        }
        char rest = conv_array[len - 1];
        conv_array[len - 1] = 0;
        if (len == 1) {
                write_char((x-1)+(y * 30), 10); // zero
     e18:       c7 01           movw    r24, r14
     e1a:       01 97           sbiw    r24, 0x01       ; 1
     e1c:       8d 0d           add     r24, r13
     e1e:       91 1d           adc     r25, r1
     e20:       6a e0           ldi     r22, 0x0A       ; 10
     e22:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
     e26:       c7 cf           rjmp    .-114           ; 0xdb6 <write_ndigit_number_u_10th+0xca>
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        uint8_t len = strlen(conv_array);
        for (uint8_t i = 0; i < length - len; i++) {
     e28:       8e e1           ldi     r24, 0x1E       ; 30
     e2a:       88 9e           mul     r8, r24
     e2c:       70 01           movw    r14, r0
     e2e:       11 24           eor     r1, r1
     e30:       b1 cf           rjmp    .-158           ; 0xd94 <write_ndigit_number_u_10th+0xa8>

00000e32 <write_ndigit_number_s>:
/**
 * Write a signed <number> at <x>/<y> to MAX7456 display memory
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
     e32:       af 92           push    r10
     e34:       bf 92           push    r11
     e36:       cf 92           push    r12
     e38:       df 92           push    r13
     e3a:       ef 92           push    r14
     e3c:       ff 92           push    r15
     e3e:       0f 93           push    r16
     e40:       1f 93           push    r17
     e42:       cf 93           push    r28
     e44:       df 93           push    r29
     e46:       b8 2e           mov     r11, r24
     e48:       a6 2e           mov     r10, r22
     e4a:       ca 01           movw    r24, r20
     e4c:       12 2f           mov     r17, r18
     e4e:       f3 2e           mov     r15, r19
        itoa(number, conv_array, 10 );
     e50:       a6 e9           ldi     r26, 0x96       ; 150
     e52:       ca 2e           mov     r12, r26
     e54:       a2 e0           ldi     r26, 0x02       ; 2
     e56:       da 2e           mov     r13, r26
     e58:       b6 01           movw    r22, r12
     e5a:       4a e0           ldi     r20, 0x0A       ; 10
     e5c:       50 e0           ldi     r21, 0x00       ; 0
     e5e:       0e 94 cc 1c     call    0x3998  ; 0x3998 <itoa>
     e62:       c1 2f           mov     r28, r17
     e64:       df 2d           mov     r29, r15
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
                if (pad) write_char((x++)+(y * 30), 10);
     e66:       8e e1           ldi     r24, 0x1E       ; 30
     e68:       a8 9e           mul     r10, r24
     e6a:       70 01           movw    r14, r0
     e6c:       11 24           eor     r1, r1
     e6e:       10 e0           ldi     r17, 0x00       ; 0
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     e70:       41 2f           mov     r20, r17
     e72:       4b 0d           add     r20, r11
     e74:       f6 01           movw    r30, r12
     e76:       01 90           ld      r0, Z+
     e78:       00 20           and     r0, r0
     e7a:       e9 f7           brne    .-6             ; 0xe76 <write_ndigit_number_s+0x44>
     e7c:       ce 01           movw    r24, r28
     e7e:       8e 1b           sub     r24, r30
     e80:       9f 0b           sbc     r25, r31
     e82:       21 2f           mov     r18, r17
     e84:       30 e0           ldi     r19, 0x00       ; 0
     e86:       89 56           subi    r24, 0x69       ; 105
     e88:       9d 4f           sbci    r25, 0xFD       ; 253
     e8a:       28 17           cp      r18, r24
     e8c:       39 07           cpc     r19, r25
     e8e:       90 f4           brcc    .+36            ; 0xeb4 <write_ndigit_number_s+0x82>
                if (pad) write_char((x++)+(y * 30), 10);
     e90:       00 23           and     r16, r16
     e92:       41 f0           breq    .+16            ; 0xea4 <write_ndigit_number_s+0x72>
     e94:       c7 01           movw    r24, r14
     e96:       84 0f           add     r24, r20
     e98:       91 1d           adc     r25, r1
     e9a:       6a e0           ldi     r22, 0x0A       ; 10
     e9c:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     ea0:       1f 5f           subi    r17, 0xFF       ; 255
     ea2:       e6 cf           rjmp    .-52            ; 0xe70 <write_ndigit_number_s+0x3e>
                if (pad) write_char((x++)+(y * 30), 10);
                else write_ascii_char((x++)+(y * 30), 0);
     ea4:       c7 01           movw    r24, r14
     ea6:       84 0f           add     r24, r20
     ea8:       91 1d           adc     r25, r1
     eaa:       60 e0           ldi     r22, 0x00       ; 0
     eac:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_s(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     eb0:       1f 5f           subi    r17, 0xFF       ; 255
     eb2:       de cf           rjmp    .-68            ; 0xe70 <write_ndigit_number_s+0x3e>
                if (pad) write_char((x++)+(y * 30), 10);
                else write_ascii_char((x++)+(y * 30), 0);
        }
        write_ascii_string(x,  y, conv_array);
     eb4:       84 2f           mov     r24, r20
     eb6:       6a 2d           mov     r22, r10
     eb8:       46 e9           ldi     r20, 0x96       ; 150
     eba:       52 e0           ldi     r21, 0x02       ; 2
     ebc:       0e 94 53 05     call    0xaa6   ; 0xaa6 <write_ascii_string>
}
     ec0:       df 91           pop     r29
     ec2:       cf 91           pop     r28
     ec4:       1f 91           pop     r17
     ec6:       0f 91           pop     r16
     ec8:       ff 90           pop     r15
     eca:       ef 90           pop     r14
     ecc:       df 90           pop     r13
     ece:       cf 90           pop     r12
     ed0:       bf 90           pop     r11
     ed2:       af 90           pop     r10
     ed4:       08 95           ret

00000ed6 <write_ndigit_number_u>:
/**
 * Write a unsigned <number> at <x>/<y> to MAX7456 display memory
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
     ed6:       af 92           push    r10
     ed8:       bf 92           push    r11
     eda:       cf 92           push    r12
     edc:       df 92           push    r13
     ede:       ef 92           push    r14
     ee0:       ff 92           push    r15
     ee2:       0f 93           push    r16
     ee4:       1f 93           push    r17
     ee6:       cf 93           push    r28
     ee8:       df 93           push    r29
     eea:       b8 2e           mov     r11, r24
     eec:       a6 2e           mov     r10, r22
     eee:       ca 01           movw    r24, r20
     ef0:       12 2f           mov     r17, r18
     ef2:       f3 2e           mov     r15, r19
        itoa(number, conv_array, 10 );
     ef4:       b6 e9           ldi     r27, 0x96       ; 150
     ef6:       cb 2e           mov     r12, r27
     ef8:       b2 e0           ldi     r27, 0x02       ; 2
     efa:       db 2e           mov     r13, r27
     efc:       b6 01           movw    r22, r12
     efe:       4a e0           ldi     r20, 0x0A       ; 10
     f00:       50 e0           ldi     r21, 0x00       ; 0
     f02:       0e 94 cc 1c     call    0x3998  ; 0x3998 <itoa>
     f06:       c1 2f           mov     r28, r17
     f08:       df 2d           mov     r29, r15
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
                if (pad) write_char((x++)+(y * 30), 10);
     f0a:       8e e1           ldi     r24, 0x1E       ; 30
     f0c:       a8 9e           mul     r10, r24
     f0e:       70 01           movw    r14, r0
     f10:       11 24           eor     r1, r1
     f12:       10 e0           ldi     r17, 0x00       ; 0
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     f14:       41 2f           mov     r20, r17
     f16:       4b 0d           add     r20, r11
     f18:       f6 01           movw    r30, r12
     f1a:       01 90           ld      r0, Z+
     f1c:       00 20           and     r0, r0
     f1e:       e9 f7           brne    .-6             ; 0xf1a <write_ndigit_number_u+0x44>
     f20:       ce 01           movw    r24, r28
     f22:       8e 1b           sub     r24, r30
     f24:       9f 0b           sbc     r25, r31
     f26:       21 2f           mov     r18, r17
     f28:       30 e0           ldi     r19, 0x00       ; 0
     f2a:       89 56           subi    r24, 0x69       ; 105
     f2c:       9d 4f           sbci    r25, 0xFD       ; 253
     f2e:       28 17           cp      r18, r24
     f30:       39 07           cpc     r19, r25
     f32:       90 f4           brcc    .+36            ; 0xf58 <write_ndigit_number_u+0x82>
                if (pad) write_char((x++)+(y * 30), 10);
     f34:       00 23           and     r16, r16
     f36:       41 f0           breq    .+16            ; 0xf48 <write_ndigit_number_u+0x72>
     f38:       c7 01           movw    r24, r14
     f3a:       84 0f           add     r24, r20
     f3c:       91 1d           adc     r25, r1
     f3e:       6a e0           ldi     r22, 0x0A       ; 10
     f40:       0e 94 f1 04     call    0x9e2   ; 0x9e2 <write_char>
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     f44:       1f 5f           subi    r17, 0xFF       ; 255
     f46:       e6 cf           rjmp    .-52            ; 0xf14 <write_ndigit_number_u+0x3e>
                if (pad) write_char((x++)+(y * 30), 10);
                else write_ascii_char((x++)+(y * 30), 0);
     f48:       c7 01           movw    r24, r14
     f4a:       84 0f           add     r24, r20
     f4c:       91 1d           adc     r25, r1
     f4e:       60 e0           ldi     r22, 0x00       ; 0
     f50:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
 * <length> represents the length to rightbound the number
 * <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of   7
 */
void write_ndigit_number_u(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) {
        itoa(number, conv_array, 10 );
        for (uint8_t i = 0; i < length - strlen(conv_array); i++) {
     f54:       1f 5f           subi    r17, 0xFF       ; 255
     f56:       de cf           rjmp    .-68            ; 0xf14 <write_ndigit_number_u+0x3e>
                if (pad) write_char((x++)+(y * 30), 10);
                else write_ascii_char((x++)+(y * 30), 0);
        }
        write_ascii_string(x,  y, conv_array);
     f58:       84 2f           mov     r24, r20
     f5a:       6a 2d           mov     r22, r10
     f5c:       46 e9           ldi     r20, 0x96       ; 150
     f5e:       52 e0           ldi     r21, 0x02       ; 2
     f60:       0e 94 53 05     call    0xaa6   ; 0xaa6 <write_ascii_string>
}
     f64:       df 91           pop     r29
     f66:       cf 91           pop     r28
     f68:       1f 91           pop     r17
     f6a:       0f 91           pop     r16
     f6c:       ff 90           pop     r15
     f6e:       ef 90           pop     r14
     f70:       df 90           pop     r13
     f72:       cf 90           pop     r12
     f74:       bf 90           pop     r11
     f76:       af 90           pop     r10
     f78:       08 95           ret

00000f7a <write_gps_pos>:
}

/**
 * wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude
 */
void write_gps_pos(uint8_t x, uint8_t y, int32_t position) {
     f7a:       7f 92           push    r7
     f7c:       8f 92           push    r8
     f7e:       9f 92           push    r9
     f80:       af 92           push    r10
     f82:       bf 92           push    r11
     f84:       cf 92           push    r12
     f86:       df 92           push    r13
     f88:       ef 92           push    r14
     f8a:       ff 92           push    r15
     f8c:       0f 93           push    r16
     f8e:       1f 93           push    r17
     f90:       16 2f           mov     r17, r22
     f92:       69 01           movw    r12, r18
     f94:       7a 01           movw    r14, r20
        if (position < 0) {
     f96:       57 fd           sbrc    r21, 7
     f98:       5e c0           rjmp    .+188           ; 0x1056 <write_gps_pos+0xdc>
                position ^= ~0;
                position++;
                write_char_xy(x++, y, 0x49); // minus
        } else {
                write_char_xy(x++, y, 0); // clear ('+' would be nice, maybe later)
     f9a:       78 2e           mov     r7, r24
     f9c:       73 94           inc     r7
     f9e:       40 e0           ldi     r20, 0x00       ; 0
     fa0:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        }
        write_ndigit_number_u(x, y, (uint16_t) (position / (int32_t) 10000000), 3, 1);
     fa4:       c7 01           movw    r24, r14
     fa6:       b6 01           movw    r22, r12
     fa8:       20 e8           ldi     r18, 0x80       ; 128
     faa:       36 e9           ldi     r19, 0x96       ; 150
     fac:       48 e9           ldi     r20, 0x98       ; 152
     fae:       50 e0           ldi     r21, 0x00       ; 0
     fb0:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
     fb4:       87 2d           mov     r24, r7
     fb6:       61 2f           mov     r22, r17
     fb8:       a9 01           movw    r20, r18
     fba:       23 e0           ldi     r18, 0x03       ; 3
     fbc:       30 e0           ldi     r19, 0x00       ; 0
     fbe:       01 e0           ldi     r16, 0x01       ; 1
     fc0:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_char_xy(x + 3, y, 65); // decimal point
     fc4:       87 2d           mov     r24, r7
     fc6:       8d 5f           subi    r24, 0xFD       ; 253
     fc8:       61 2f           mov     r22, r17
     fca:       41 e4           ldi     r20, 0x41       ; 65
     fcc:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        position = position - ((position / (int32_t) 10000000) * (int32_t) 10000000);
     fd0:       c7 01           movw    r24, r14
     fd2:       b6 01           movw    r22, r12
     fd4:       20 e8           ldi     r18, 0x80       ; 128
     fd6:       36 e9           ldi     r19, 0x96       ; 150
     fd8:       48 e9           ldi     r20, 0x98       ; 152
     fda:       50 e0           ldi     r21, 0x00       ; 0
     fdc:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
     fe0:       6b 01           movw    r12, r22
     fe2:       7c 01           movw    r14, r24
        write_ndigit_number_u(x + 4, y, (uint16_t) (position / (int32_t) 1000), 4, 1);
     fe4:       c7 01           movw    r24, r14
     fe6:       b6 01           movw    r22, r12
     fe8:       28 ee           ldi     r18, 0xE8       ; 232
     fea:       33 e0           ldi     r19, 0x03       ; 3
     fec:       40 e0           ldi     r20, 0x00       ; 0
     fee:       50 e0           ldi     r21, 0x00       ; 0
     ff0:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
     ff4:       49 01           movw    r8, r18
     ff6:       87 2d           mov     r24, r7
     ff8:       8c 5f           subi    r24, 0xFC       ; 252
     ffa:       61 2f           mov     r22, r17
     ffc:       a9 01           movw    r20, r18
     ffe:       24 e0           ldi     r18, 0x04       ; 4
    1000:       30 e0           ldi     r19, 0x00       ; 0
    1002:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        position = position - ((uint16_t) (position / (int32_t) 1000) * (int32_t) 1000);
        write_ndigit_number_u(x + 8, y, (uint16_t) position, 3, 1);
    1006:       aa 24           eor     r10, r10
    1008:       bb 24           eor     r11, r11
    100a:       c5 01           movw    r24, r10
    100c:       b4 01           movw    r22, r8
    100e:       28 e1           ldi     r18, 0x18       ; 24
    1010:       3c ef           ldi     r19, 0xFC       ; 252
    1012:       4f ef           ldi     r20, 0xFF       ; 255
    1014:       5f ef           ldi     r21, 0xFF       ; 255
    1016:       0e 94 49 1c     call    0x3892  ; 0x3892 <__mulsi3>
    101a:       c6 0e           add     r12, r22
    101c:       d7 1e           adc     r13, r23
    101e:       e8 1e           adc     r14, r24
    1020:       f9 1e           adc     r15, r25
    1022:       87 2d           mov     r24, r7
    1024:       88 5f           subi    r24, 0xF8       ; 248
    1026:       61 2f           mov     r22, r17
    1028:       a6 01           movw    r20, r12
    102a:       23 e0           ldi     r18, 0x03       ; 3
    102c:       30 e0           ldi     r19, 0x00       ; 0
    102e:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_char_xy(x + 11, y, 0xD0); // degree symbol
    1032:       87 2d           mov     r24, r7
    1034:       85 5f           subi    r24, 0xF5       ; 245
    1036:       61 2f           mov     r22, r17
    1038:       40 ed           ldi     r20, 0xD0       ; 208
    103a:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
}
    103e:       1f 91           pop     r17
    1040:       0f 91           pop     r16
    1042:       ff 90           pop     r15
    1044:       ef 90           pop     r14
    1046:       df 90           pop     r13
    1048:       cf 90           pop     r12
    104a:       bf 90           pop     r11
    104c:       af 90           pop     r10
    104e:       9f 90           pop     r9
    1050:       8f 90           pop     r8
    1052:       7f 90           pop     r7
    1054:       08 95           ret
/**
 * wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude
 */
void write_gps_pos(uint8_t x, uint8_t y, int32_t position) {
        if (position < 0) {
                position ^= ~0;
    1056:       c0 94           com     r12
    1058:       d0 94           com     r13
    105a:       e0 94           com     r14
    105c:       f0 94           com     r15
                position++;
    105e:       08 94           sec
    1060:       c1 1c           adc     r12, r1
    1062:       d1 1c           adc     r13, r1
    1064:       e1 1c           adc     r14, r1
    1066:       f1 1c           adc     r15, r1
                write_char_xy(x++, y, 0x49); // minus
    1068:       78 2e           mov     r7, r24
    106a:       73 94           inc     r7
    106c:       49 e4           ldi     r20, 0x49       ; 73
    106e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    1072:       98 cf           rjmp    .-208           ; 0xfa4 <write_gps_pos+0x2a>

00001074 <write_time>:
}

/**
 *  write <seconds> as human readable time at <x>/<y> to MAX7456 display mem
 */
void write_time(uint8_t x, uint8_t y, uint16_t seconds) {
    1074:       bf 92           push    r11
    1076:       cf 92           push    r12
    1078:       df 92           push    r13
    107a:       ef 92           push    r14
    107c:       ff 92           push    r15
    107e:       0f 93           push    r16
    1080:       1f 93           push    r17
    1082:       18 2f           mov     r17, r24
    1084:       b6 2e           mov     r11, r22
    1086:       6a 01           movw    r12, r20
    uint16_t min = seconds / 60;
    1088:       ca 01           movw    r24, r20
    108a:       6c e3           ldi     r22, 0x3C       ; 60
    108c:       70 e0           ldi     r23, 0x00       ; 0
    108e:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    1092:       7b 01           movw    r14, r22
    seconds -= min * 60;
    write_ndigit_number_u(x, y, min, 3, 0);
    1094:       81 2f           mov     r24, r17
    1096:       6b 2d           mov     r22, r11
    1098:       a7 01           movw    r20, r14
    109a:       23 e0           ldi     r18, 0x03       ; 3
    109c:       30 e0           ldi     r19, 0x00       ; 0
    109e:       00 e0           ldi     r16, 0x00       ; 0
    10a0:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
    write_char_xy(x + 3, y, 68);
    10a4:       81 2f           mov     r24, r17
    10a6:       8d 5f           subi    r24, 0xFD       ; 253
    10a8:       6b 2d           mov     r22, r11
    10aa:       44 e4           ldi     r20, 0x44       ; 68
    10ac:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    write_ndigit_number_u(x + 4, y, seconds, 2, 1);
    10b0:       8c e3           ldi     r24, 0x3C       ; 60
    10b2:       90 e0           ldi     r25, 0x00       ; 0
    10b4:       9c 01           movw    r18, r24
    10b6:       e2 9e           mul     r14, r18
    10b8:       c0 01           movw    r24, r0
    10ba:       e3 9e           mul     r14, r19
    10bc:       90 0d           add     r25, r0
    10be:       f2 9e           mul     r15, r18
    10c0:       90 0d           add     r25, r0
    10c2:       11 24           eor     r1, r1
    10c4:       c8 1a           sub     r12, r24
    10c6:       d9 0a           sbc     r13, r25
    10c8:       81 2f           mov     r24, r17
    10ca:       8c 5f           subi    r24, 0xFC       ; 252
    10cc:       6b 2d           mov     r22, r11
    10ce:       a6 01           movw    r20, r12
    10d0:       22 e0           ldi     r18, 0x02       ; 2
    10d2:       30 e0           ldi     r19, 0x00       ; 0
    10d4:       01 e0           ldi     r16, 0x01       ; 1
    10d6:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
}
    10da:       1f 91           pop     r17
    10dc:       0f 91           pop     r16
    10de:       ff 90           pop     r15
    10e0:       ef 90           pop     r14
    10e2:       df 90           pop     r13
    10e4:       cf 90           pop     r12
    10e6:       bf 90           pop     r11
    10e8:       08 95           ret

000010ea <clear>:
    /*uint16_t memory_address = 0;
    for (unsigned int a = 0; a < 480; a++) {
        write_char(memory_address++, 0);
    }*/
        // clear all display-mem (DMM)
    spi_send_byte(0x04, 0b01000100);
    10ea:       84 e0           ldi     r24, 0x04       ; 4
    10ec:       64 e4           ldi     r22, 0x44       ; 68
    10ee:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
    can be achieved.
*/
void
_delay_loop_1(uint8_t __count)
{
        __asm__ volatile (
    10f2:       8a e6           ldi     r24, 0x6A       ; 106
    10f4:       8a 95           dec     r24
    10f6:       f1 f7           brne    .-4             ; 0x10f4 <clear+0xa>

    // clearing takes 12uS according to maxim so lets wait longer
    _delay_us(20);
}
    10f8:       08 95           ret

000010fa <write_char_att>:
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))

/**
 *  write a character <attribute> to <address> of MAX7456 display memory
 */
void write_char_att(uint16_t address, char attribute) {
    10fa:       0f 93           push    r16
    10fc:       1f 93           push    r17
    10fe:       18 2f           mov     r17, r24
    1100:       06 2f           mov     r16, r22
    // the only important part is that the DMAH[1] is set
    // so we add 2 which binary is the 2nd lowest byte
    spi_send_byte(0x05, ((address & 0xFF00) >> 8) | 2); // DMAH
    1102:       92 60           ori     r25, 0x02       ; 2
    1104:       85 e0           ldi     r24, 0x05       ; 5
    1106:       69 2f           mov     r22, r25
    1108:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
    spi_send_byte(0x06, (address & 0x00FF)); // DMAL
    110c:       86 e0           ldi     r24, 0x06       ; 6
    110e:       61 2f           mov     r22, r17
    1110:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
    spi_send_byte(0x07, attribute); // DMDI
    1114:       87 e0           ldi     r24, 0x07       ; 7
    1116:       60 2f           mov     r22, r16
    1118:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>
}
    111c:       1f 91           pop     r17
    111e:       0f 91           pop     r16
    1120:       08 95           ret

00001122 <write_char_att_xy>:
/**
 *  write a  character <attribute> at <x>/<y> to MAX7456 display memory
 */
void write_char_att_xy(uint8_t x, uint8_t y, char attribute) {
    uint16_t address = y * 30 + x;
    write_char_att(address, attribute);
    1122:       9e e1           ldi     r25, 0x1E       ; 30
    1124:       69 9f           mul     r22, r25
    1126:       b0 01           movw    r22, r0
    1128:       11 24           eor     r1, r1
    112a:       9b 01           movw    r18, r22
    112c:       28 0f           add     r18, r24
    112e:       31 1d           adc     r19, r1
    1130:       c9 01           movw    r24, r18
    1132:       64 2f           mov     r22, r20
    1134:       0e 94 7d 08     call    0x10fa  ; 0x10fa <write_char_att>
}
    1138:       08 95           ret

0000113a <heading_conv>:
 * ##########################################################################*/

/**
 * convert the <heading> gotton from NC into an index
 */
uint8_t heading_conv(uint16_t heading) {
    113a:       9c 01           movw    r18, r24
    if (heading > 23 && heading < 68) {
    113c:       48 97           sbiw    r24, 0x18       ; 24
    113e:       8c 97           sbiw    r24, 0x2c       ; 44
    1140:       00 f1           brcs    .+64            ; 0x1182 <heading_conv+0x48>
        //direction = "NE";
        return 0;
    } else if (heading > 67 && heading < 113) {
    1142:       c9 01           movw    r24, r18
    1144:       84 54           subi    r24, 0x44       ; 68
    1146:       90 40           sbci    r25, 0x00       ; 0
    1148:       8d 97           sbiw    r24, 0x2d       ; 45
    114a:       e8 f0           brcs    .+58            ; 0x1186 <heading_conv+0x4c>
        //direction = "E ";
        return 1;
    } else if (heading > 112 && heading < 158) {
    114c:       c9 01           movw    r24, r18
    114e:       81 57           subi    r24, 0x71       ; 113
    1150:       90 40           sbci    r25, 0x00       ; 0
    1152:       8d 97           sbiw    r24, 0x2d       ; 45
    1154:       e0 f0           brcs    .+56            ; 0x118e <heading_conv+0x54>
        //direction = "SE";
        return 2;
    } else if (heading > 157 && heading < 203) {
    1156:       c9 01           movw    r24, r18
    1158:       8e 59           subi    r24, 0x9E       ; 158
    115a:       90 40           sbci    r25, 0x00       ; 0
    115c:       8d 97           sbiw    r24, 0x2d       ; 45
    115e:       a8 f0           brcs    .+42            ; 0x118a <heading_conv+0x50>
        //direction = "S ";
        return 3;
    } else if (heading > 202 && heading < 248) {
    1160:       c9 01           movw    r24, r18
    1162:       8b 5c           subi    r24, 0xCB       ; 203
    1164:       90 40           sbci    r25, 0x00       ; 0
    1166:       8d 97           sbiw    r24, 0x2d       ; 45
    1168:       a0 f0           brcs    .+40            ; 0x1192 <heading_conv+0x58>
        //direction = "SW";
        return 4;
    } else if (heading > 247 && heading < 293) {
    116a:       c9 01           movw    r24, r18
    116c:       88 5f           subi    r24, 0xF8       ; 248
    116e:       90 40           sbci    r25, 0x00       ; 0
    1170:       8d 97           sbiw    r24, 0x2d       ; 45
    1172:       98 f0           brcs    .+38            ; 0x119a <heading_conv+0x60>
        //direction = "W ";
        return 5;
    } else if (heading > 292 && heading < 338) {
    1174:       25 52           subi    r18, 0x25       ; 37
    1176:       31 40           sbci    r19, 0x01       ; 1
    1178:       2d 32           cpi     r18, 0x2D       ; 45
    117a:       31 05           cpc     r19, r1
    117c:       60 f0           brcs    .+24            ; 0x1196 <heading_conv+0x5c>
    117e:       87 e0           ldi     r24, 0x07       ; 7
    1180:       08 95           ret

/**
 * convert the <heading> gotton from NC into an index
 */
uint8_t heading_conv(uint16_t heading) {
    if (heading > 23 && heading < 68) {
    1182:       80 e0           ldi     r24, 0x00       ; 0
    1184:       08 95           ret
        //direction = "NE";
        return 0;
    } else if (heading > 67 && heading < 113) {
    1186:       81 e0           ldi     r24, 0x01       ; 1
    1188:       08 95           ret
        //direction = "E ";
        return 1;
    } else if (heading > 112 && heading < 158) {
        //direction = "SE";
        return 2;
    } else if (heading > 157 && heading < 203) {
    118a:       83 e0           ldi     r24, 0x03       ; 3
    118c:       08 95           ret
        //direction = "NE";
        return 0;
    } else if (heading > 67 && heading < 113) {
        //direction = "E ";
        return 1;
    } else if (heading > 112 && heading < 158) {
    118e:       82 e0           ldi     r24, 0x02       ; 2
    1190:       08 95           ret
        //direction = "SE";
        return 2;
    } else if (heading > 157 && heading < 203) {
        //direction = "S ";
        return 3;
    } else if (heading > 202 && heading < 248) {
    1192:       84 e0           ldi     r24, 0x04       ; 4
    1194:       08 95           ret
        //direction = "SW";
        return 4;
    } else if (heading > 247 && heading < 293) {
        //direction = "W ";
        return 5;
    } else if (heading > 292 && heading < 338) {
    1196:       86 e0           ldi     r24, 0x06       ; 6
        //direction = "NW";
        return 6;
    }
    //direction = "N ";
    return 7;
}
    1198:       08 95           ret
        //direction = "S ";
        return 3;
    } else if (heading > 202 && heading < 248) {
        //direction = "SW";
        return 4;
    } else if (heading > 247 && heading < 293) {
    119a:       85 e0           ldi     r24, 0x05       ; 5
    119c:       08 95           ret

0000119e <heading_fine_conv>:
/**
 * convert the <heading> gotton from NC into a more
 * precise index
 */
uint8_t heading_fine_conv(uint16_t heading) {
        heading = ((heading * 10) + 113) % 3600;
    119e:       9c 01           movw    r18, r24
    11a0:       88 0f           add     r24, r24
    11a2:       99 1f           adc     r25, r25
    11a4:       88 0f           add     r24, r24
    11a6:       99 1f           adc     r25, r25
    11a8:       88 0f           add     r24, r24
    11aa:       99 1f           adc     r25, r25
    11ac:       22 0f           add     r18, r18
    11ae:       33 1f           adc     r19, r19
    11b0:       82 0f           add     r24, r18
    11b2:       93 1f           adc     r25, r19
    11b4:       8f 58           subi    r24, 0x8F       ; 143
    11b6:       9f 4f           sbci    r25, 0xFF       ; 255
    11b8:       60 e1           ldi     r22, 0x10       ; 16
    11ba:       7e e0           ldi     r23, 0x0E       ; 14
    11bc:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    11c0:       61 ee           ldi     r22, 0xE1       ; 225
    11c2:       70 e0           ldi     r23, 0x00       ; 0
    11c4:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    11c8:       86 2f           mov     r24, r22
        return (heading / 225);
}
    11ca:       08 95           ret

000011cc <draw_artificial_horizon>:

/**
 * draw roll und nick indicators (could be enhanced to full artificial horizon)
 * from line <firstline> to <listlines> for given <nick> and <roll> values
 */
void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) {
    11cc:       af 92           push    r10
    11ce:       bf 92           push    r11
    11d0:       cf 92           push    r12
    11d2:       df 92           push    r13
    11d4:       ef 92           push    r14
    11d6:       ff 92           push    r15
    11d8:       0f 93           push    r16
    11da:       1f 93           push    r17
    11dc:       df 93           push    r29
    11de:       cf 93           push    r28
    11e0:       00 d0           rcall   .+0             ; 0x11e2 <draw_artificial_horizon+0x16>
    11e2:       00 d0           rcall   .+0             ; 0x11e4 <draw_artificial_horizon+0x18>
    11e4:       0f 92           push    r0
    11e6:       cd b7           in      r28, 0x3d       ; 61
    11e8:       de b7           in      r29, 0x3e       ; 62
    11ea:       a8 2e           mov     r10, r24
    11ec:       c6 2e           mov     r12, r22
    11ee:       8a 01           movw    r16, r20
    11f0:       d2 2e           mov     r13, r18
    11f2:       b3 2e           mov     r11, r19
        char noodle[5] = {225, 225, 226, 227, 227};
    11f4:       7e 01           movw    r14, r28
    11f6:       08 94           sec
    11f8:       e1 1c           adc     r14, r1
    11fa:       f1 1c           adc     r15, r1
    11fc:       d7 01           movw    r26, r14
    11fe:       eb e0           ldi     r30, 0x0B       ; 11
    1200:       f1 e0           ldi     r31, 0x01       ; 1
    1202:       85 e0           ldi     r24, 0x05       ; 5
    1204:       01 90           ld      r0, Z+
    1206:       0d 92           st      X+, r0
    1208:       81 50           subi    r24, 0x01       ; 1
    120a:       e1 f7           brne    .-8             ; 0x1204 <draw_artificial_horizon+0x38>
        uint8_t center_x = 15;
        uint8_t center_y = lastline - firstline;
        center_y = 7;
        write_char_xy(center_x,center_y,228);
    120c:       8f e0           ldi     r24, 0x0F       ; 15
    120e:       67 e0           ldi     r22, 0x07       ; 7
    1210:       44 ee           ldi     r20, 0xE4       ; 228
    1212:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        uint8_t cpos, nicky, rollx;
        
        // which line
        int8_t ypos =  nick / 20;
    1216:       c8 01           movw    r24, r16
    1218:       64 e1           ldi     r22, 0x14       ; 20
    121a:       70 e0           ldi     r23, 0x00       ; 0
    121c:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    1220:       26 2f           mov     r18, r22
        // which character from the array?
        if (nick < 0) {
    1222:       17 fd           sbrc    r17, 7
    1224:       82 c0           rjmp    .+260           ; 0x132a <draw_artificial_horizon+0x15e>
                cpos = -1*((nick - (ypos * 20))/4);
                ypos--;
        } else cpos = 4-((nick - (ypos * 20))/4);
    1226:       8c ee           ldi     r24, 0xEC       ; 236
    1228:       68 02           muls    r22, r24
    122a:       c0 01           movw    r24, r0
    122c:       11 24           eor     r1, r1
    122e:       80 0f           add     r24, r16
    1230:       91 1f           adc     r25, r17
    1232:       97 fd           sbrc    r25, 7
    1234:       a2 c0           rjmp    .+324           ; 0x137a <draw_artificial_horizon+0x1ae>
    1236:       95 95           asr     r25
    1238:       87 95           ror     r24
    123a:       95 95           asr     r25
    123c:       87 95           ror     r24
    123e:       90 95           com     r25
    1240:       81 95           neg     r24
    1242:       9f 4f           sbci    r25, 0xFF       ; 255
    1244:       18 2f           mov     r17, r24
    1246:       1c 5f           subi    r17, 0xFC       ; 252
        if (cpos > 4) cpos = 4;

        nicky = center_y - ypos;
    1248:       67 e0           ldi     r22, 0x07       ; 7
    124a:       62 1b           sub     r22, r18
        if (nicky > lastline) nicky = lastline;
    124c:       c6 16           cp      r12, r22
    124e:       08 f0           brcs    .+2             ; 0x1252 <draw_artificial_horizon+0x86>
    1250:       80 c0           rjmp    .+256           ; 0x1352 <draw_artificial_horizon+0x186>
    1252:       0c 2d           mov     r16, r12
        else if (nicky < firstline) nicky = firstline;

        // ensure roll-borders
        rollx = (roll / 8)+15;
    1254:       8d 2d           mov     r24, r13
    1256:       9b 2d           mov     r25, r11
    1258:       9c 01           movw    r18, r24
    125a:       37 fd           sbrc    r19, 7
    125c:       84 c0           rjmp    .+264           ; 0x1366 <draw_artificial_horizon+0x19a>
    125e:       35 95           asr     r19
    1260:       27 95           ror     r18
    1262:       35 95           asr     r19
    1264:       27 95           ror     r18
    1266:       35 95           asr     r19
    1268:       27 95           ror     r18
    126a:       82 2f           mov     r24, r18
    126c:       81 5f           subi    r24, 0xF1       ; 241
        if (rollx < 2) rollx = 2;
    126e:       82 30           cpi     r24, 0x02       ; 2
    1270:       08 f4           brcc    .+2             ; 0x1274 <draw_artificial_horizon+0xa8>
    1272:       7c c0           rjmp    .+248           ; 0x136c <draw_artificial_horizon+0x1a0>
    1274:       d8 2e           mov     r13, r24
    1276:       8c e1           ldi     r24, 0x1C       ; 28
    1278:       8d 15           cp      r24, r13
    127a:       10 f4           brcc    .+4             ; 0x1280 <draw_artificial_horizon+0xb4>
    127c:       6c e1           ldi     r22, 0x1C       ; 28
    127e:       d6 2e           mov     r13, r22
    1280:       4d 2d           mov     r20, r13
    1282:       50 e0           ldi     r21, 0x00       ; 0
    1284:       bd 2c           mov     r11, r13
        else if (rollx > 28) rollx = 28;


        // clear roll
        if (old_af_x != rollx && old_af_x >= 0) {
    1286:       20 91 09 01     lds     r18, 0x0109
    128a:       82 2f           mov     r24, r18
    128c:       99 27           eor     r25, r25
    128e:       87 fd           sbrc    r24, 7
    1290:       90 95           com     r25
    1292:       84 17           cp      r24, r20
    1294:       95 07           cpc     r25, r21
    1296:       39 f0           breq    .+14            ; 0x12a6 <draw_artificial_horizon+0xda>
    1298:       27 fd           sbrc    r18, 7
    129a:       05 c0           rjmp    .+10            ; 0x12a6 <draw_artificial_horizon+0xda>
                write_char_xy(old_af_x, lastline, 0);
    129c:       82 2f           mov     r24, r18
    129e:       6c 2d           mov     r22, r12
    12a0:       40 e0           ldi     r20, 0x00       ; 0
    12a2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        }

        // clear nick
        if (old_af_y != nicky && old_af_y >= 0) {
    12a6:       60 91 0a 01     lds     r22, 0x010A
    12aa:       26 2f           mov     r18, r22
    12ac:       33 27           eor     r19, r19
    12ae:       27 fd           sbrc    r18, 7
    12b0:       30 95           com     r19
    12b2:       80 2f           mov     r24, r16
    12b4:       90 e0           ldi     r25, 0x00       ; 0
    12b6:       28 17           cp      r18, r24
    12b8:       39 07           cpc     r19, r25
    12ba:       61 f0           breq    .+24            ; 0x12d4 <draw_artificial_horizon+0x108>
    12bc:       67 fd           sbrc    r22, 7
    12be:       0a c0           rjmp    .+20            ; 0x12d4 <draw_artificial_horizon+0x108>
                write_char_xy(center_x-1, old_af_y, 0);
    12c0:       8e e0           ldi     r24, 0x0E       ; 14
    12c2:       40 e0           ldi     r20, 0x00       ; 0
    12c4:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                write_char_xy(center_x+1, old_af_y, 0);
    12c8:       80 e1           ldi     r24, 0x10       ; 16
    12ca:       60 91 0a 01     lds     r22, 0x010A
    12ce:       40 e0           ldi     r20, 0x00       ; 0
    12d0:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        }


        // draw nick
        write_char_xy(center_x-1, nicky, noodle[cpos]);
    12d4:       81 2f           mov     r24, r17
    12d6:       15 30           cpi     r17, 0x05       ; 5
    12d8:       08 f0           brcs    .+2             ; 0x12dc <draw_artificial_horizon+0x110>
    12da:       84 e0           ldi     r24, 0x04       ; 4
    12dc:       e8 0e           add     r14, r24
    12de:       f1 1c           adc     r15, r1
    12e0:       f7 01           movw    r30, r14
    12e2:       10 81           ld      r17, Z
    12e4:       8e e0           ldi     r24, 0x0E       ; 14
    12e6:       60 2f           mov     r22, r16
    12e8:       41 2f           mov     r20, r17
    12ea:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        write_char_xy(center_x+1, nicky, noodle[cpos]);
    12ee:       80 e1           ldi     r24, 0x10       ; 16
    12f0:       60 2f           mov     r22, r16
    12f2:       41 2f           mov     r20, r17
    12f4:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

        // draw roll
        write_char_xy(rollx, lastline, 229);
    12f8:       8d 2d           mov     r24, r13
    12fa:       6c 2d           mov     r22, r12
    12fc:       45 ee           ldi     r20, 0xE5       ; 229
    12fe:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

        // update old vars
        old_af_x = rollx;
    1302:       b0 92 09 01     sts     0x0109, r11
        old_af_y = nicky;
    1306:       00 93 0a 01     sts     0x010A, r16
        // debug numbers
        //write_3digit_number_u(20,6,cpos);
        //write_number_s(20,7,ypos);    
        //write_number_s(0,7,nick);             
        //write_number_s(18,11,roll);   
}
    130a:       0f 90           pop     r0
    130c:       0f 90           pop     r0
    130e:       0f 90           pop     r0
    1310:       0f 90           pop     r0
    1312:       0f 90           pop     r0
    1314:       cf 91           pop     r28
    1316:       df 91           pop     r29
    1318:       1f 91           pop     r17
    131a:       0f 91           pop     r16
    131c:       ff 90           pop     r15
    131e:       ef 90           pop     r14
    1320:       df 90           pop     r13
    1322:       cf 90           pop     r12
    1324:       bf 90           pop     r11
    1326:       af 90           pop     r10
    1328:       08 95           ret
        
        // which line
        int8_t ypos =  nick / 20;
        // which character from the array?
        if (nick < 0) {
                cpos = -1*((nick - (ypos * 20))/4);
    132a:       8c ee           ldi     r24, 0xEC       ; 236
    132c:       68 02           muls    r22, r24
    132e:       c0 01           movw    r24, r0
    1330:       11 24           eor     r1, r1
    1332:       80 0f           add     r24, r16
    1334:       91 1f           adc     r25, r17
    1336:       97 fd           sbrc    r25, 7
    1338:       22 c0           rjmp    .+68            ; 0x137e <draw_artificial_horizon+0x1b2>
    133a:       95 95           asr     r25
    133c:       87 95           ror     r24
    133e:       95 95           asr     r25
    1340:       87 95           ror     r24
    1342:       18 2f           mov     r17, r24
    1344:       11 95           neg     r17
                ypos--;
    1346:       21 50           subi    r18, 0x01       ; 1
        } else cpos = 4-((nick - (ypos * 20))/4);
        if (cpos > 4) cpos = 4;

        nicky = center_y - ypos;
    1348:       67 e0           ldi     r22, 0x07       ; 7
    134a:       62 1b           sub     r22, r18
        if (nicky > lastline) nicky = lastline;
    134c:       c6 16           cp      r12, r22
    134e:       08 f4           brcc    .+2             ; 0x1352 <draw_artificial_horizon+0x186>
    1350:       80 cf           rjmp    .-256           ; 0x1252 <draw_artificial_horizon+0x86>
    1352:       06 2f           mov     r16, r22
    1354:       6a 15           cp      r22, r10
    1356:       08 f0           brcs    .+2             ; 0x135a <draw_artificial_horizon+0x18e>
    1358:       7d cf           rjmp    .-262           ; 0x1254 <draw_artificial_horizon+0x88>
    135a:       0a 2d           mov     r16, r10
        else if (nicky < firstline) nicky = firstline;

        // ensure roll-borders
        rollx = (roll / 8)+15;
    135c:       8d 2d           mov     r24, r13
    135e:       9b 2d           mov     r25, r11
    1360:       9c 01           movw    r18, r24
    1362:       37 ff           sbrs    r19, 7
    1364:       7c cf           rjmp    .-264           ; 0x125e <draw_artificial_horizon+0x92>
    1366:       29 5f           subi    r18, 0xF9       ; 249
    1368:       3f 4f           sbci    r19, 0xFF       ; 255
    136a:       79 cf           rjmp    .-270           ; 0x125e <draw_artificial_horizon+0x92>
        if (rollx < 2) rollx = 2;
    136c:       e2 e0           ldi     r30, 0x02       ; 2
    136e:       de 2e           mov     r13, r30
    1370:       42 e0           ldi     r20, 0x02       ; 2
    1372:       50 e0           ldi     r21, 0x00       ; 0
    1374:       72 e0           ldi     r23, 0x02       ; 2
    1376:       b7 2e           mov     r11, r23
    1378:       86 cf           rjmp    .-244           ; 0x1286 <draw_artificial_horizon+0xba>
        int8_t ypos =  nick / 20;
        // which character from the array?
        if (nick < 0) {
                cpos = -1*((nick - (ypos * 20))/4);
                ypos--;
        } else cpos = 4-((nick - (ypos * 20))/4);
    137a:       03 96           adiw    r24, 0x03       ; 3
    137c:       5c cf           rjmp    .-328           ; 0x1236 <draw_artificial_horizon+0x6a>
        
        // which line
        int8_t ypos =  nick / 20;
        // which character from the array?
        if (nick < 0) {
                cpos = -1*((nick - (ypos * 20))/4);
    137e:       03 96           adiw    r24, 0x03       ; 3
    1380:       dc cf           rjmp    .-72            ; 0x133a <draw_artificial_horizon+0x16e>

00001382 <draw_variometer>:
 * variometer
 * ##########################################################################*/
/**
 * draw variometer arrows at <x>/<y> according to <variometer>
 */
void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) {
    1382:       28 2f           mov     r18, r24
    1384:       36 2f           mov     r19, r22
        if (variometer == 0) {
    1386:       41 15           cp      r20, r1
    1388:       51 05           cpc     r21, r1
    138a:       b1 f0           breq    .+44            ; 0x13b8 <draw_variometer+0x36>
                write_char_xy(x, y, 0xbb); // plain line
        } else if (variometer > 0) { // gain height
    138c:       14 16           cp      r1, r20
    138e:       15 06           cpc     r1, r21
    1390:       bc f4           brge    .+46            ; 0x13c0 <draw_variometer+0x3e>
                switch (variometer / 5){
    1392:       ca 01           movw    r24, r20
    1394:       65 e0           ldi     r22, 0x05       ; 5
    1396:       70 e0           ldi     r23, 0x00       ; 0
    1398:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    139c:       61 30           cpi     r22, 0x01       ; 1
    139e:       71 05           cpc     r23, r1
    13a0:       11 f1           breq    .+68            ; 0x13e6 <draw_variometer+0x64>
    13a2:       62 30           cpi     r22, 0x02       ; 2
    13a4:       71 05           cpc     r23, r1
    13a6:       89 f1           breq    .+98            ; 0x140a <draw_variometer+0x88>
    13a8:       67 2b           or      r22, r23
    13aa:       19 f5           brne    .+70            ; 0x13f2 <draw_variometer+0x70>
                        case 0:
                                //write_char_xy(x, y, 0xba); // smallest arrow up
                                write_char_xy(x, y, 0x70); // one arrow up
    13ac:       82 2f           mov     r24, r18
    13ae:       63 2f           mov     r22, r19
    13b0:       40 e7           ldi     r20, 0x70       ; 112
    13b2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    13b6:       08 95           ret
/**
 * draw variometer arrows at <x>/<y> according to <variometer>
 */
void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) {
        if (variometer == 0) {
                write_char_xy(x, y, 0xbb); // plain line
    13b8:       4b eb           ldi     r20, 0xBB       ; 187
    13ba:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    13be:       08 95           ret
                        default:
                                //write_char_xy(x, y, 0xb7); // largest arrow up
                                write_char_xy(x, y, 0x73); // three black arrows up
                }
        } else { // sink
                switch (variometer / -5){
    13c0:       ca 01           movw    r24, r20
    13c2:       6b ef           ldi     r22, 0xFB       ; 251
    13c4:       7f ef           ldi     r23, 0xFF       ; 255
    13c6:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    13ca:       61 30           cpi     r22, 0x01       ; 1
    13cc:       71 05           cpc     r23, r1
    13ce:       b9 f0           breq    .+46            ; 0x13fe <draw_variometer+0x7c>
    13d0:       62 30           cpi     r22, 0x02       ; 2
    13d2:       71 05           cpc     r23, r1
    13d4:       31 f1           breq    .+76            ; 0x1422 <draw_variometer+0xa0>
    13d6:       67 2b           or      r22, r23
    13d8:       f1 f4           brne    .+60            ; 0x1416 <draw_variometer+0x94>
                        case 0:
                                //write_char_xy(x, y, 0xbc); // smallest arrow down
                                write_char_xy(x, y, 0x77); // one arrow down
    13da:       82 2f           mov     r24, r18
    13dc:       63 2f           mov     r22, r19
    13de:       47 e7           ldi     r20, 0x77       ; 119
    13e0:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    13e4:       08 95           ret
                                //write_char_xy(x, y, 0xba); // smallest arrow up
                                write_char_xy(x, y, 0x70); // one arrow up
                                break;
                        case 1:
                                //write_char_xy(x, y, 0xb9); // small arrow up
                                write_char_xy(x, y, 0x71); // two arrows up
    13e6:       82 2f           mov     r24, r18
    13e8:       63 2f           mov     r22, r19
    13ea:       41 e7           ldi     r20, 0x71       ; 113
    13ec:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    13f0:       08 95           ret
                                //write_char_xy(x, y, 0xb8); // large arrow up
                                write_char_xy(x, y, 0x72); // three arrows up
                                break;
                        default:
                                //write_char_xy(x, y, 0xb7); // largest arrow up
                                write_char_xy(x, y, 0x73); // three black arrows up
    13f2:       82 2f           mov     r24, r18
    13f4:       63 2f           mov     r22, r19
    13f6:       43 e7           ldi     r20, 0x73       ; 115
    13f8:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    13fc:       08 95           ret
                                //write_char_xy(x, y, 0xbc); // smallest arrow down
                                write_char_xy(x, y, 0x77); // one arrow down
                                break;
                        case 1:
                                //write_char_xy(x, y, 0xbd); // small arrow down
                                write_char_xy(x, y, 0x76); // two arrows down
    13fe:       82 2f           mov     r24, r18
    1400:       63 2f           mov     r22, r19
    1402:       46 e7           ldi     r20, 0x76       ; 118
    1404:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    1408:       08 95           ret
                                //write_char_xy(x, y, 0xb9); // small arrow up
                                write_char_xy(x, y, 0x71); // two arrows up
                                break;
                        case 2:
                                //write_char_xy(x, y, 0xb8); // large arrow up
                                write_char_xy(x, y, 0x72); // three arrows up
    140a:       82 2f           mov     r24, r18
    140c:       63 2f           mov     r22, r19
    140e:       42 e7           ldi     r20, 0x72       ; 114
    1410:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    1414:       08 95           ret
                                //write_char_xy(x, y, 0xbe); // large arrow down
                                write_char_xy(x, y, 0x75); // three arrows down
                                break;
                        default:
                                //write_char_xy(x, y, 0xbf); // largest arrow down
                                write_char_xy(x, y, 0x74); // three black arrows down
    1416:       82 2f           mov     r24, r18
    1418:       63 2f           mov     r22, r19
    141a:       44 e7           ldi     r20, 0x74       ; 116
    141c:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    1420:       08 95           ret
                                //write_char_xy(x, y, 0xbd); // small arrow down
                                write_char_xy(x, y, 0x76); // two arrows down
                                break;
                        case 2:
                                //write_char_xy(x, y, 0xbe); // large arrow down
                                write_char_xy(x, y, 0x75); // three arrows down
    1422:       82 2f           mov     r24, r18
    1424:       63 2f           mov     r22, r19
    1426:       45 e7           ldi     r20, 0x75       ; 117
    1428:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    142c:       08 95           ret

0000142e <draw_battery>:
 * battery index
 * ##########################################################################*/
/**
 * draw a battery symbol at <x>/<y> according to <voltage>
 */
void draw_battery(uint8_t x, uint8_t y, uint8_t min_voltage, uint8_t voltage, uint8_t max_voltage) {
    142e:       0f 93           push    r16
    1430:       e8 2f           mov     r30, r24
    1432:       f6 2f           mov     r31, r22
        uint8_t percent = (100* (voltage - min_voltage) / (max_voltage - min_voltage));
        if (percent > 100) percent = 100;
        if (voltage < min_voltage) percent = 0;
    1434:       24 17           cp      r18, r20
    1436:       38 f4           brcc    .+14            ; 0x1446 <draw_battery+0x18>
    1438:       4d e9           ldi     r20, 0x9D       ; 157
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
    143a:       8e 2f           mov     r24, r30
    143c:       6f 2f           mov     r22, r31
    143e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
}
    1442:       0f 91           pop     r16
    1444:       08 95           ret
 * ##########################################################################*/
/**
 * draw a battery symbol at <x>/<y> according to <voltage>
 */
void draw_battery(uint8_t x, uint8_t y, uint8_t min_voltage, uint8_t voltage, uint8_t max_voltage) {
        uint8_t percent = (100* (voltage - min_voltage) / (max_voltage - min_voltage));
    1446:       84 2f           mov     r24, r20
    1448:       90 e0           ldi     r25, 0x00       ; 0
    144a:       30 e0           ldi     r19, 0x00       ; 0
    144c:       28 1b           sub     r18, r24
    144e:       39 0b           sbc     r19, r25
    1450:       60 2f           mov     r22, r16
    1452:       70 e0           ldi     r23, 0x00       ; 0
    1454:       68 1b           sub     r22, r24
    1456:       79 0b           sbc     r23, r25
    1458:       84 e6           ldi     r24, 0x64       ; 100
    145a:       90 e0           ldi     r25, 0x00       ; 0
    145c:       ac 01           movw    r20, r24
    145e:       24 9f           mul     r18, r20
    1460:       c0 01           movw    r24, r0
    1462:       25 9f           mul     r18, r21
    1464:       90 0d           add     r25, r0
    1466:       34 9f           mul     r19, r20
    1468:       90 0d           add     r25, r0
    146a:       11 24           eor     r1, r1
    146c:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    1470:       65 36           cpi     r22, 0x65       ; 101
    1472:       08 f0           brcs    .+2             ; 0x1476 <draw_battery+0x48>
    1474:       64 e6           ldi     r22, 0x64       ; 100
    1476:       86 2f           mov     r24, r22
    1478:       90 e0           ldi     r25, 0x00       ; 0
    147a:       9c 01           movw    r18, r24
    147c:       22 0f           add     r18, r18
    147e:       33 1f           adc     r19, r19
    1480:       28 0f           add     r18, r24
    1482:       39 1f           adc     r19, r25
    1484:       22 0f           add     r18, r18
    1486:       33 1f           adc     r19, r19
    1488:       22 0f           add     r18, r18
    148a:       33 1f           adc     r19, r19
    148c:       28 0f           add     r18, r24
    148e:       39 1f           adc     r19, r25
    1490:       c9 01           movw    r24, r18
    1492:       6c e9           ldi     r22, 0x9C       ; 156
    1494:       7f ef           ldi     r23, 0xFF       ; 255
    1496:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    149a:       46 2f           mov     r20, r22
    149c:       43 56           subi    r20, 0x63       ; 99
        if (percent > 100) percent = 100;
        if (voltage < min_voltage) percent = 0;
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
    149e:       8e 2f           mov     r24, r30
    14a0:       6f 2f           mov     r22, r31
    14a2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
}
    14a6:       0f 91           pop     r16
    14a8:       08 95           ret

000014aa <draw_compass>:
}

/**
 * draw a compass rose at <x>/<y> for <heading>
 */
void draw_compass(uint8_t x, uint8_t y, uint16_t heading) {
    14aa:       ef 92           push    r14
    14ac:       ff 92           push    r15
    14ae:       0f 93           push    r16
    14b0:       1f 93           push    r17
    14b2:       cf 93           push    r28
    14b4:       df 93           push    r29
    14b6:       28 2f           mov     r18, r24
    14b8:       06 2f           mov     r16, r22
    14ba:       ca 01           movw    r24, r20
                    216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211,
                    216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214};
        // the center is char 19 (north), we add the current heading in 8th
        // which would be 22.5 degrees, but float would bloat up the code
        // and *10 / 225 would take ages... so we take the uncorrect way
    uint8_t front = 19 + (heading / 22);
    14bc:       66 e1           ldi     r22, 0x16       ; 22
    14be:       70 e0           ldi     r23, 0x00       ; 0
    14c0:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    14c4:       6d 5e           subi    r22, 0xED       ; 237
    14c6:       70 e0           ldi     r23, 0x00       ; 0
    14c8:       eb 01           movw    r28, r22
    14ca:       c0 55           subi    r28, 0x50       ; 80
    14cc:       de 4f           sbci    r29, 0xFE       ; 254
    for (uint8_t i = 0; i < 9; i++) {
    14ce:       55 e0           ldi     r21, 0x05       ; 5
    14d0:       e5 2e           mov     r14, r21
    14d2:       f1 2c           mov     r15, r1
    14d4:       e6 0e           add     r14, r22
    14d6:       f7 1e           adc     r15, r23
    14d8:       84 eb           ldi     r24, 0xB4       ; 180
    14da:       91 e0           ldi     r25, 0x01       ; 1
    14dc:       e8 0e           add     r14, r24
    14de:       f9 1e           adc     r15, r25
                write_char_xy(x++, y, pgm_read_byte(&rose[front - 4 + i]));
    14e0:       12 2f           mov     r17, r18
    14e2:       1f 5f           subi    r17, 0xFF       ; 255
    14e4:       fe 01           movw    r30, r28
    14e6:       44 91           lpm     r20, Z+
    14e8:       82 2f           mov     r24, r18
    14ea:       60 2f           mov     r22, r16
    14ec:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    14f0:       21 96           adiw    r28, 0x01       ; 1
    14f2:       21 2f           mov     r18, r17
                    216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214};
        // the center is char 19 (north), we add the current heading in 8th
        // which would be 22.5 degrees, but float would bloat up the code
        // and *10 / 225 would take ages... so we take the uncorrect way
    uint8_t front = 19 + (heading / 22);
    for (uint8_t i = 0; i < 9; i++) {
    14f4:       ce 15           cp      r28, r14
    14f6:       df 05           cpc     r29, r15
    14f8:       99 f7           brne    .-26            ; 0x14e0 <draw_compass+0x36>
                write_char_xy(x++, y, pgm_read_byte(&rose[front - 4 + i]));
    }
}
    14fa:       df 91           pop     r29
    14fc:       cf 91           pop     r28
    14fe:       1f 91           pop     r17
    1500:       0f 91           pop     r16
    1502:       ff 90           pop     r15
    1504:       ef 90           pop     r14
    1506:       08 95           ret

00001508 <draw_big_variometer>:

/**
 * draw a bigger vario with middle at <x>/<y> acording to <variometer>
 */
void draw_big_variometer(uint8_t x, uint8_t y, int16_t variometer) {    
        int16_t index = 7 + variometer;
    1508:       49 5f           subi    r20, 0xF9       ; 249
    150a:       5f 4f           sbci    r21, 0xFF       ; 255
    150c:       57 fd           sbrc    r21, 7
    150e:       11 c0           rjmp    .+34            ; 0x1532 <draw_big_variometer+0x2a>
        if (index > 14) index = 14;
        else if (index < 0) index = 0;
        
        write_string_pgm_down(x, y-2, (const char *) (pgm_read_word ( &(vario_pnt[index]))), 5);
    1510:       4f 30           cpi     r20, 0x0F       ; 15
    1512:       51 05           cpc     r21, r1
    1514:       14 f0           brlt    .+4             ; 0x151a <draw_big_variometer+0x12>
    1516:       4e e0           ldi     r20, 0x0E       ; 14
    1518:       50 e0           ldi     r21, 0x00       ; 0
    151a:       fa 01           movw    r30, r20
    151c:       ee 0f           add     r30, r30
    151e:       ff 1f           adc     r31, r31
    1520:       ea 56           subi    r30, 0x6A       ; 106
    1522:       fe 4f           sbci    r31, 0xFE       ; 254
    1524:       45 91           lpm     r20, Z+
    1526:       54 91           lpm     r21, Z+
    1528:       62 50           subi    r22, 0x02       ; 2
    152a:       25 e0           ldi     r18, 0x05       ; 5
    152c:       0e 94 ad 05     call    0xb5a   ; 0xb5a <write_string_pgm_down>
}
    1530:       08 95           ret

/**
 * draw a bigger vario with middle at <x>/<y> acording to <variometer>
 */
void draw_big_variometer(uint8_t x, uint8_t y, int16_t variometer) {    
        int16_t index = 7 + variometer;
    1532:       40 e0           ldi     r20, 0x00       ; 0
    1534:       50 e0           ldi     r21, 0x00       ; 0
    1536:       ec cf           rjmp    .-40            ; 0x1510 <draw_big_variometer+0x8>

00001538 <onoff>:
 * ##########################################################################*/

/**
 * helper function for flag display
 */
void onoff(uint8_t line, uint8_t onoff) {       
    1538:       98 2f           mov     r25, r24
        if (onoff) {              
    153a:       66 23           and     r22, r22
    153c:       39 f4           brne    .+14            ; 0x154c <onoff+0x14>
                write_ascii_string_pgm(23, line, PSTR("ON "));
        } else {
                write_ascii_string_pgm(23, line, PSTR("OFF"));
    153e:       87 e1           ldi     r24, 0x17       ; 23
    1540:       69 2f           mov     r22, r25
    1542:       48 ee           ldi     r20, 0xE8       ; 232
    1544:       52 e0           ldi     r21, 0x02       ; 2
    1546:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    154a:       08 95           ret
/**
 * helper function for flag display
 */
void onoff(uint8_t line, uint8_t onoff) {       
        if (onoff) {              
                write_ascii_string_pgm(23, line, PSTR("ON "));
    154c:       87 e1           ldi     r24, 0x17       ; 23
    154e:       69 2f           mov     r22, r25
    1550:       4c ee           ldi     r20, 0xEC       ; 236
    1552:       52 e0           ldi     r21, 0x02       ; 2
    1554:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    1558:       08 95           ret

0000155a <config_menu_drawings>:
}

/**
 * helper function for menu updating
 */
void config_menu_drawings(uint8_t chosen) {
    155a:       ff 92           push    r15
    155c:       0f 93           push    r16
    155e:       1f 93           push    r17
    1560:       28 2f           mov     r18, r24
    1562:       90 e0           ldi     r25, 0x00       ; 0
    1564:       0b 96           adiw    r24, 0x0b       ; 11
    1566:       6c e0           ldi     r22, 0x0C       ; 12
    1568:       70 e0           ldi     r23, 0x00       ; 0
    156a:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    156e:       92 e0           ldi     r25, 0x02       ; 2
    1570:       f9 2e           mov     r15, r25
    1572:       f8 0e           add     r15, r24
    1574:       02 2f           mov     r16, r18
    1576:       0e 5f           subi    r16, 0xFE       ; 254
    1578:       12 e0           ldi     r17, 0x02       ; 2
        uint8_t line = 2;

    // clear prevoius _cursor_
    //write_char_xy(3, line + ((chosen + 11) % 12), 0x00);
        for (uint8_t x = 2; x < 28; x++) {              
                write_char_att_xy(x, line + ((chosen + 11) % 12), 0);
    157a:       81 2f           mov     r24, r17
    157c:       6f 2d           mov     r22, r15
    157e:       40 e0           ldi     r20, 0x00       ; 0
    1580:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
                write_char_att_xy(x, line + chosen, BLACKBG | INVERT);
    1584:       81 2f           mov     r24, r17
    1586:       60 2f           mov     r22, r16
    1588:       4f ea           ldi     r20, 0xAF       ; 175
    158a:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
void config_menu_drawings(uint8_t chosen) {
        uint8_t line = 2;

    // clear prevoius _cursor_
    //write_char_xy(3, line + ((chosen + 11) % 12), 0x00);
        for (uint8_t x = 2; x < 28; x++) {              
    158e:       1f 5f           subi    r17, 0xFF       ; 255
    1590:       1c 31           cpi     r17, 0x1C       ; 28
    1592:       99 f7           brne    .-26            ; 0x157a <config_menu_drawings+0x20>
        };
        // draw current _cursor_        
        //write_char_xy(3, line + chosen, 0xD9);
                        

        write_ascii_string_pgm(4, line, PSTR("Video Mode"));
    1594:       84 e0           ldi     r24, 0x04       ; 4
    1596:       62 e0           ldi     r22, 0x02       ; 2
    1598:       4d ed           ldi     r20, 0xDD       ; 221
    159a:       52 e0           ldi     r21, 0x02       ; 2
    159c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
    15a0:       80 91 1c 01     lds     r24, 0x011C
    15a4:       80 ff           sbrs    r24, 0
    15a6:       85 c0           rjmp    .+266           ; 0x16b2 <config_menu_drawings+0x158>
                write_ascii_string_pgm(23, line, VM_NTSC);
    15a8:       87 e1           ldi     r24, 0x17       ; 23
    15aa:       62 e0           ldi     r22, 0x02       ; 2
    15ac:       49 ee           ldi     r20, 0xE9       ; 233
    15ae:       51 e0           ldi     r21, 0x01       ; 1
    15b0:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        } else {
                write_ascii_string_pgm(23, line, VM_PAL);
        }
        
        write_ascii_string_pgm(4, ++line, PSTR("Full HUD")); 
    15b4:       84 e0           ldi     r24, 0x04       ; 4
    15b6:       63 e0           ldi     r22, 0x03       ; 3
    15b8:       44 ed           ldi     r20, 0xD4       ; 212
    15ba:       52 e0           ldi     r21, 0x02       ; 2
    15bc:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        onoff(line, COSD_FLAGS_MODES & COSD_FLAG_HUD);
    15c0:       60 91 1b 01     lds     r22, 0x011B
    15c4:       61 70           andi    r22, 0x01       ; 1
    15c6:       83 e0           ldi     r24, 0x03       ; 3
    15c8:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>
    
        write_ascii_string_pgm(4, ++line, PSTR("Art Horizon in HUD"));
    15cc:       84 e0           ldi     r24, 0x04       ; 4
    15ce:       64 e0           ldi     r22, 0x04       ; 4
    15d0:       41 ec           ldi     r20, 0xC1       ; 193
    15d2:       52 e0           ldi     r21, 0x02       ; 2
    15d4:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        onoff(line, COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON);
    15d8:       60 91 1b 01     lds     r22, 0x011B
    15dc:       62 70           andi    r22, 0x02       ; 2
    15de:       84 e0           ldi     r24, 0x04       ; 4
    15e0:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>
    
        write_ascii_string_pgm(4, ++line, PSTR("Big Vario bar"));
    15e4:       84 e0           ldi     r24, 0x04       ; 4
    15e6:       65 e0           ldi     r22, 0x05       ; 5
    15e8:       43 eb           ldi     r20, 0xB3       ; 179
    15ea:       52 e0           ldi     r21, 0x02       ; 2
    15ec:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        onoff(line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO);
    15f0:       60 91 1b 01     lds     r22, 0x011B
    15f4:       64 70           andi    r22, 0x04       ; 4
    15f6:       85 e0           ldi     r24, 0x05       ; 5
    15f8:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>

        write_ascii_string_pgm(4, ++line, PSTR("Statistics"));
    15fc:       84 e0           ldi     r24, 0x04       ; 4
    15fe:       66 e0           ldi     r22, 0x06       ; 6
    1600:       48 ea           ldi     r20, 0xA8       ; 168
    1602:       52 e0           ldi     r21, 0x02       ; 2
    1604:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    onoff(line, COSD_FLAGS_MODES & COSD_FLAG_STATS);
    1608:       60 91 1b 01     lds     r22, 0x011B
    160c:       68 70           andi    r22, 0x08       ; 8
    160e:       86 e0           ldi     r24, 0x06       ; 6
    1610:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>

        write_ascii_string_pgm(4, ++line, PSTR("Current by FC"));
    1614:       84 e0           ldi     r24, 0x04       ; 4
    1616:       67 e0           ldi     r22, 0x07       ; 7
    1618:       4a e9           ldi     r20, 0x9A       ; 154
    161a:       52 e0           ldi     r21, 0x02       ; 2
    161c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        onoff(line, COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT);
    1620:       60 91 1b 01     lds     r22, 0x011B
    1624:       60 74           andi    r22, 0x40       ; 64
    1626:       87 e0           ldi     r24, 0x07       ; 7
    1628:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>

        write_ascii_string_pgm(4, ++line, PSTR("Voltage by C-Strom"));
    162c:       84 e0           ldi     r24, 0x04       ; 4
    162e:       68 e0           ldi     r22, 0x08       ; 8
    1630:       47 e8           ldi     r20, 0x87       ; 135
    1632:       52 e0           ldi     r21, 0x02       ; 2
    1634:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        onoff(line, COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT);
    1638:       60 91 1b 01     lds     r22, 0x011B
    163c:       60 72           andi    r22, 0x20       ; 32
    163e:       88 e0           ldi     r24, 0x08       ; 8
    1640:       0e 94 9c 0a     call    0x1538  ; 0x1538 <onoff>

        write_ascii_string_pgm(4, ++line, PSTR("Reset uptime"));
    1644:       84 e0           ldi     r24, 0x04       ; 4
    1646:       69 e0           ldi     r22, 0x09       ; 9
    1648:       4a e7           ldi     r20, 0x7A       ; 122
    164a:       52 e0           ldi     r21, 0x02       ; 2
    164c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    
        write_ascii_string_pgm(4, ++line, PSTR("Display Mode"));    
    1650:       84 e0           ldi     r24, 0x04       ; 4
    1652:       6a e0           ldi     r22, 0x0A       ; 10
    1654:       4d e6           ldi     r20, 0x6D       ; 109
    1656:       52 e0           ldi     r21, 0x02       ; 2
    1658:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        write_ascii_string_pgm(18, line, (const char *) (pgm_read_word(&(mode->desc))));
    165c:       e0 91 9d 02     lds     r30, 0x029D
    1660:       f0 91 9e 02     lds     r31, 0x029E
    1664:       32 96           adiw    r30, 0x02       ; 2
    1666:       45 91           lpm     r20, Z+
    1668:       54 91           lpm     r21, Z+
    166a:       82 e1           ldi     r24, 0x12       ; 18
    166c:       6a e0           ldi     r22, 0x0A       ; 10
    166e:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        
        write_ascii_string_pgm(4, ++line, PSTR("Height by"));
    1672:       84 e0           ldi     r24, 0x04       ; 4
    1674:       6b e0           ldi     r22, 0x0B       ; 11
    1676:       43 e6           ldi     r20, 0x63       ; 99
    1678:       52 e0           ldi     r21, 0x02       ; 2
    167a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
    167e:       80 91 1c 01     lds     r24, 0x011C
    1682:       81 fd           sbrc    r24, 1
    1684:       1d c0           rjmp    .+58            ; 0x16c0 <config_menu_drawings+0x166>
                write_ascii_string_pgm(20, line, PSTR(" GPS"));
        } else {
                write_ascii_string_pgm(20, line, PSTR("BARO"));
    1686:       84 e1           ldi     r24, 0x14       ; 20
    1688:       6b e0           ldi     r22, 0x0B       ; 11
    168a:       49 e5           ldi     r20, 0x59       ; 89
    168c:       52 e0           ldi     r21, 0x02       ; 2
    168e:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        }

        write_ascii_string_pgm(4, ++line, PSTR("Save config"));
    1692:       84 e0           ldi     r24, 0x04       ; 4
    1694:       6c e0           ldi     r22, 0x0C       ; 12
    1696:       4d e4           ldi     r20, 0x4D       ; 77
    1698:       52 e0           ldi     r21, 0x02       ; 2
    169a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        write_ascii_string_pgm(4, ++line, PSTR("EXIT"));
    169e:       84 e0           ldi     r24, 0x04       ; 4
    16a0:       6d e0           ldi     r22, 0x0D       ; 13
    16a2:       48 e4           ldi     r20, 0x48       ; 72
    16a4:       52 e0           ldi     r21, 0x02       ; 2
    16a6:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
}
    16aa:       1f 91           pop     r17
    16ac:       0f 91           pop     r16
    16ae:       ff 90           pop     r15
    16b0:       08 95           ret

        write_ascii_string_pgm(4, line, PSTR("Video Mode"));
        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
                write_ascii_string_pgm(23, line, VM_NTSC);
        } else {
                write_ascii_string_pgm(23, line, VM_PAL);
    16b2:       87 e1           ldi     r24, 0x17       ; 23
    16b4:       62 e0           ldi     r22, 0x02       ; 2
    16b6:       44 ee           ldi     r20, 0xE4       ; 228
    16b8:       51 e0           ldi     r21, 0x01       ; 1
    16ba:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    16be:       7a cf           rjmp    .-268           ; 0x15b4 <config_menu_drawings+0x5a>
        write_ascii_string_pgm(4, ++line, PSTR("Display Mode"));    
        write_ascii_string_pgm(18, line, (const char *) (pgm_read_word(&(mode->desc))));
        
        write_ascii_string_pgm(4, ++line, PSTR("Height by"));
        if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
                write_ascii_string_pgm(20, line, PSTR(" GPS"));
    16c0:       84 e1           ldi     r24, 0x14       ; 20
    16c2:       6b e0           ldi     r22, 0x0B       ; 11
    16c4:       4e e5           ldi     r20, 0x5E       ; 94
    16c6:       52 e0           ldi     r21, 0x02       ; 2
    16c8:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    16cc:       e2 cf           rjmp    .-60            ; 0x1692 <config_menu_drawings+0x138>

000016ce <config_menu_doclick>:
}

/**
 * some sort of clicking response in the menu
 */
void config_menu_doclick(uint8_t chosen) {
    16ce:       1f 93           push    r17
    16d0:       18 2f           mov     r17, r24
    write_ascii_string_pgm(4, chosen + 2, PSTR("DONE              "));
    16d2:       68 2f           mov     r22, r24
    16d4:       6e 5f           subi    r22, 0xFE       ; 254
    16d6:       84 e0           ldi     r24, 0x04       ; 4
    16d8:       45 e3           ldi     r20, 0x35       ; 53
    16da:       52 e0           ldi     r21, 0x02       ; 2
    16dc:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    16e0:       28 e8           ldi     r18, 0x88       ; 136
    16e2:       33 e1           ldi     r19, 0x13       ; 19
    milliseconds can be achieved.
 */
void
_delay_loop_2(uint16_t __count)
{
        __asm__ volatile (
    16e4:       40 e9           ldi     r20, 0x90       ; 144
    16e6:       51 e0           ldi     r21, 0x01       ; 1
    16e8:       ca 01           movw    r24, r20
    16ea:       01 97           sbiw    r24, 0x01       ; 1
    16ec:       f1 f7           brne    .-4             ; 0x16ea <config_menu_doclick+0x1c>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    16ee:       21 50           subi    r18, 0x01       ; 1
    16f0:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    16f2:       d1 f7           brne    .-12            ; 0x16e8 <config_menu_doclick+0x1a>
    _delay_ms(500);
    config_menu_drawings(chosen);
    16f4:       81 2f           mov     r24, r17
    16f6:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
}
    16fa:       1f 91           pop     r17
    16fc:       08 95           ret

000016fe <save_eeprom>:

/**
 * save data to eeprom
 */
void save_eeprom() {
        eeprom_write_byte(&ee_checkbyte1, CHECKBYTE1);
    16fe:       80 e0           ldi     r24, 0x00       ; 0
    1700:       90 e0           ldi     r25, 0x00       ; 0
    1702:       6e e2           ldi     r22, 0x2E       ; 46
    1704:       0e 94 f5 1c     call    0x39ea  ; 0x39ea <__eewr_byte_m162>
        eeprom_write_byte(&ee_checkbyte2, CHECKBYTE2);
    1708:       81 e0           ldi     r24, 0x01       ; 1
    170a:       90 e0           ldi     r25, 0x00       ; 0
    170c:       67 e1           ldi     r22, 0x17       ; 23
    170e:       0e 94 f5 1c     call    0x39ea  ; 0x39ea <__eewr_byte_m162>
        eeprom_write_byte(&ee_COSD_FLAGS_MODES, COSD_FLAGS_MODES);
    1712:       82 e0           ldi     r24, 0x02       ; 2
    1714:       90 e0           ldi     r25, 0x00       ; 0
    1716:       60 91 1b 01     lds     r22, 0x011B
    171a:       0e 94 f5 1c     call    0x39ea  ; 0x39ea <__eewr_byte_m162>
        eeprom_write_byte(&ee_COSD_FLAGS_CONFIG, COSD_FLAGS_CONFIG);
    171e:       83 e0           ldi     r24, 0x03       ; 3
    1720:       90 e0           ldi     r25, 0x00       ; 0
    1722:       60 91 1c 01     lds     r22, 0x011C
    1726:       0e 94 f5 1c     call    0x39ea  ; 0x39ea <__eewr_byte_m162>
        eeprom_write_byte(&ee_COSD_DISPLAYMODE, COSD_DISPLAYMODE);
    172a:       84 e0           ldi     r24, 0x04       ; 4
    172c:       90 e0           ldi     r25, 0x00       ; 0
    172e:       60 91 1e 01     lds     r22, 0x011E
    1732:       0e 94 f5 1c     call    0x39ea  ; 0x39ea <__eewr_byte_m162>
}
    1736:       08 95           ret

00001738 <config_menu>:
}

/**
 * a simple config menu tryout
 */
void config_menu(void) {
    1738:       af 92           push    r10
    173a:       bf 92           push    r11
    173c:       cf 92           push    r12
    173e:       df 92           push    r13
    1740:       ef 92           push    r14
    1742:       ff 92           push    r15
    1744:       0f 93           push    r16
    1746:       1f 93           push    r17
    1748:       cf 93           push    r28
    174a:       df 93           push    r29
    // disable interrupts (makes the menu more smoothely)
    cli();
    174c:       f8 94           cli

    // clear screen
    clear();
    174e:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>

    uint8_t chosen = 0;
        uint8_t inmenu = 1;
    write_ascii_string_pgm(6, 1, PSTR("C-OSD Config Menu"));
    1752:       86 e0           ldi     r24, 0x06       ; 6
    1754:       61 e0           ldi     r22, 0x01       ; 1
    1756:       43 e2           ldi     r20, 0x23       ; 35
    1758:       52 e0           ldi     r21, 0x02       ; 2
    175a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    175e:       24 ec           ldi     r18, 0xC4       ; 196
    1760:       39 e0           ldi     r19, 0x09       ; 9
    1762:       40 e9           ldi     r20, 0x90       ; 144
    1764:       51 e0           ldi     r21, 0x01       ; 1
    1766:       ca 01           movw    r24, r20
    1768:       01 97           sbiw    r24, 0x01       ; 1
    176a:       f1 f7           brne    .-4             ; 0x1768 <config_menu+0x30>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    176c:       21 50           subi    r18, 0x01       ; 1
    176e:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    1770:       d1 f7           brne    .-12            ; 0x1766 <config_menu+0x2e>

    // wait a bit before doing stuff so user has chance to release button
    _delay_ms(250);

    config_menu_drawings(chosen);
    1772:       80 e0           ldi     r24, 0x00       ; 0
    1774:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    1778:       10 e0           ldi     r17, 0x00       ; 0
    177a:       c0 e9           ldi     r28, 0x90       ; 144
    177c:       d1 e0           ldi     r29, 0x01       ; 1
                /*case 5: // warnings
                    COSD_FLAGS_MODES ^= COSD_FLAG_WARNINGS;
                    config_menu_drawings(chosen);
                    break;*/
                case 5: // current by fc
                    COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
    177e:       00 e4           ldi     r16, 0x40       ; 64
                    config_menu_drawings(chosen);
    1780:       ff 24           eor     r15, r15
    1782:       f3 94           inc     r15
                                        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
                                        #endif
                                        config_menu_drawings(chosen);
                    break;
                case 9: // GPS or BARO height
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
    1784:       72 e0           ldi     r23, 0x02       ; 2
    1786:       e7 2e           mov     r14, r23
                case 5: // current by fc
                    COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
                    config_menu_drawings(chosen);
                    break;
                                case 6: // 2nd voltage by c-strom
                    COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT;
    1788:       60 e2           ldi     r22, 0x20       ; 32
    178a:       d6 2e           mov     r13, r22
                case 2: // art horizon
                    COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON;
                    config_menu_drawings(chosen);
                    break;
                case 3: // big vario
                    COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
    178c:       54 e0           ldi     r21, 0x04       ; 4
    178e:       c5 2e           mov     r12, r21
                                                bottom_line = 12;
                                        } else {
                                            // PAL + enable display immediately (VM0)
                                            spi_send_byte(0x00, 0b01001000);

                                                bottom_line = 14;
    1790:       4e e0           ldi     r20, 0x0E       ; 14
    1792:       b4 2e           mov     r11, r20
                                        // Setup Video Mode
                                        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
                                            // NTSC + enable display immediately (VM0)
                                            spi_send_byte(0x00, 0b00001000);

                                                bottom_line = 12;
    1794:       3c e0           ldi     r19, 0x0C       ; 12
    1796:       a3 2e           mov     r10, r19
    _delay_ms(250);

    config_menu_drawings(chosen);

    while (inmenu) {
        if (s2_pressed()) {
    1798:       0e 94 79 0e     call    0x1cf2  ; 0x1cf2 <s2_pressed>
    179c:       89 2b           or      r24, r25
    179e:       b1 f0           breq    .+44            ; 0x17cc <config_menu+0x94>
                        chosen = (chosen + 1) % 12;
    17a0:       81 2f           mov     r24, r17
    17a2:       90 e0           ldi     r25, 0x00       ; 0
    17a4:       01 96           adiw    r24, 0x01       ; 1
    17a6:       6c e0           ldi     r22, 0x0C       ; 12
    17a8:       70 e0           ldi     r23, 0x00       ; 0
    17aa:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    17ae:       18 2f           mov     r17, r24
                        config_menu_drawings(chosen);
    17b0:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    17b4:       28 e8           ldi     r18, 0x88       ; 136
    17b6:       33 e1           ldi     r19, 0x13       ; 19
    17b8:       ce 01           movw    r24, r28
    17ba:       01 97           sbiw    r24, 0x01       ; 1
    17bc:       f1 f7           brne    .-4             ; 0x17ba <config_menu+0x82>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    17be:       21 50           subi    r18, 0x01       ; 1
    17c0:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    17c2:       d1 f7           brne    .-12            ; 0x17b8 <config_menu+0x80>
    _delay_ms(250);

    config_menu_drawings(chosen);

    while (inmenu) {
        if (s2_pressed()) {
    17c4:       0e 94 79 0e     call    0x1cf2  ; 0x1cf2 <s2_pressed>
    17c8:       89 2b           or      r24, r25
    17ca:       51 f7           brne    .-44            ; 0x17a0 <config_menu+0x68>
                        chosen = (chosen + 1) % 12;
                        config_menu_drawings(chosen);
                        _delay_ms(500);
        } else if (s1_pressed()) {
    17cc:       0e 94 58 0e     call    0x1cb0  ; 0x1cb0 <s1_pressed>
    17d0:       89 2b           or      r24, r25
    17d2:       11 f3           breq    .-60            ; 0x1798 <config_menu+0x60>
            switch (chosen) {
    17d4:       15 30           cpi     r17, 0x05       ; 5
    17d6:       09 f4           brne    .+2             ; 0x17da <config_menu+0xa2>
    17d8:       bf c0           rjmp    .+382           ; 0x1958 <config_menu+0x220>
    17da:       16 30           cpi     r17, 0x06       ; 6
    17dc:       58 f5           brcc    .+86            ; 0x1834 <config_menu+0xfc>
    17de:       12 30           cpi     r17, 0x02       ; 2
    17e0:       09 f4           brne    .+2             ; 0x17e4 <config_menu+0xac>
    17e2:       b0 c0           rjmp    .+352           ; 0x1944 <config_menu+0x20c>
    17e4:       13 30           cpi     r17, 0x03       ; 3
    17e6:       08 f4           brcc    .+2             ; 0x17ea <config_menu+0xb2>
    17e8:       41 c0           rjmp    .+130           ; 0x186c <config_menu+0x134>
    17ea:       13 30           cpi     r17, 0x03       ; 3
    17ec:       09 f4           brne    .+2             ; 0x17f0 <config_menu+0xb8>
    17ee:       62 c0           rjmp    .+196           ; 0x18b4 <config_menu+0x17c>
    17f0:       14 30           cpi     r17, 0x04       ; 4
    17f2:       09 f4           brne    .+2             ; 0x17f6 <config_menu+0xbe>
    17f4:       54 c0           rjmp    .+168           ; 0x189e <config_menu+0x166>
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
                    config_menu_drawings(chosen);
                    break;
                case 10: // save
                    save_eeprom();
                    config_menu_doclick(chosen);
    17f6:       41 e0           ldi     r20, 0x01       ; 1
    17f8:       24 ec           ldi     r18, 0xC4       ; 196
    17fa:       39 e0           ldi     r19, 0x09       ; 9
    17fc:       ce 01           movw    r24, r28
    17fe:       01 97           sbiw    r24, 0x01       ; 1
    1800:       f1 f7           brne    .-4             ; 0x17fe <config_menu+0xc6>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    1802:       21 50           subi    r18, 0x01       ; 1
    1804:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    1806:       d1 f7           brne    .-12            ; 0x17fc <config_menu+0xc4>
    // wait a bit before doing stuff so user has chance to release button
    _delay_ms(250);

    config_menu_drawings(chosen);

    while (inmenu) {
    1808:       44 23           and     r20, r20
    180a:       09 f0           breq    .+2             ; 0x180e <config_menu+0xd6>
    180c:       c5 cf           rjmp    .-118           ; 0x1798 <config_menu+0x60>
            _delay_ms(250);
        }
    }

    // clear screen up again
    clear();
    180e:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>

    // update flags to paint display again if needed
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
    1812:       80 91 1d 01     lds     r24, 0x011D
    1816:       8d 7f           andi    r24, 0xFD       ; 253
    1818:       80 93 1d 01     sts     0x011D, r24

    // enable interrupts again
    sei();
    181c:       78 94           sei
}
    181e:       df 91           pop     r29
    1820:       cf 91           pop     r28
    1822:       1f 91           pop     r17
    1824:       0f 91           pop     r16
    1826:       ff 90           pop     r15
    1828:       ef 90           pop     r14
    182a:       df 90           pop     r13
    182c:       cf 90           pop     r12
    182e:       bf 90           pop     r11
    1830:       af 90           pop     r10
    1832:       08 95           ret
        if (s2_pressed()) {
                        chosen = (chosen + 1) % 12;
                        config_menu_drawings(chosen);
                        _delay_ms(500);
        } else if (s1_pressed()) {
            switch (chosen) {
    1834:       18 30           cpi     r17, 0x08       ; 8
    1836:       09 f4           brne    .+2             ; 0x183a <config_menu+0x102>
    1838:       63 c0           rjmp    .+198           ; 0x1900 <config_menu+0x1c8>
    183a:       19 30           cpi     r17, 0x09       ; 9
    183c:       48 f0           brcs    .+18            ; 0x1850 <config_menu+0x118>
    183e:       1a 30           cpi     r17, 0x0A       ; 10
    1840:       09 f4           brne    .+2             ; 0x1844 <config_menu+0x10c>
    1842:       7a c0           rjmp    .+244           ; 0x1938 <config_menu+0x200>
    1844:       1a 30           cpi     r17, 0x0A       ; 10
    1846:       08 f1           brcs    .+66            ; 0x188a <config_menu+0x152>
    1848:       1b 30           cpi     r17, 0x0B       ; 11
    184a:       a9 f6           brne    .-86            ; 0x17f6 <config_menu+0xbe>
    184c:       40 e0           ldi     r20, 0x00       ; 0
    184e:       d4 cf           rjmp    .-88            ; 0x17f8 <config_menu+0xc0>
    1850:       16 30           cpi     r17, 0x06       ; 6
    1852:       09 f4           brne    .+2             ; 0x1856 <config_menu+0x11e>
    1854:       4b c0           rjmp    .+150           ; 0x18ec <config_menu+0x1b4>
    1856:       17 30           cpi     r17, 0x07       ; 7
    1858:       71 f6           brne    .-100           ; 0x17f6 <config_menu+0xbe>
                                case 6: // 2nd voltage by c-strom
                    COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT;
                    config_menu_drawings(chosen);
                    break;
                case 7: // reset uptime
                    uptime = 0;
    185a:       10 92 13 01     sts     0x0113, r1
    185e:       10 92 12 01     sts     0x0112, r1
                    config_menu_doclick(chosen);
    1862:       87 e0           ldi     r24, 0x07       ; 7
    1864:       0e 94 67 0b     call    0x16ce  ; 0x16ce <config_menu_doclick>
    1868:       41 e0           ldi     r20, 0x01       ; 1
    186a:       c6 cf           rjmp    .-116           ; 0x17f8 <config_menu+0xc0>
        if (s2_pressed()) {
                        chosen = (chosen + 1) % 12;
                        config_menu_drawings(chosen);
                        _delay_ms(500);
        } else if (s1_pressed()) {
            switch (chosen) {
    186c:       11 23           and     r17, r17
    186e:       61 f1           breq    .+88            ; 0x18c8 <config_menu+0x190>
    1870:       11 30           cpi     r17, 0x01       ; 1
    1872:       09 f0           breq    .+2             ; 0x1876 <config_menu+0x13e>
    1874:       c0 cf           rjmp    .-128           ; 0x17f6 <config_menu+0xbe>
                                                bottom_line = 14;
                                        }
                    config_menu_drawings(chosen);
                    break;
                case 1: // full HUD
                    COSD_FLAGS_MODES ^= COSD_FLAG_HUD;
    1876:       80 91 1b 01     lds     r24, 0x011B
    187a:       81 27           eor     r24, r17
    187c:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    1880:       81 e0           ldi     r24, 0x01       ; 1
    1882:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    1886:       41 e0           ldi     r20, 0x01       ; 1
    1888:       b7 cf           rjmp    .-146           ; 0x17f8 <config_menu+0xc0>
                                        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
                                        #endif
                                        config_menu_drawings(chosen);
                    break;
                case 9: // GPS or BARO height
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
    188a:       80 91 1c 01     lds     r24, 0x011C
    188e:       8e 25           eor     r24, r14
    1890:       80 93 1c 01     sts     0x011C, r24
                    config_menu_drawings(chosen);
    1894:       89 e0           ldi     r24, 0x09       ; 9
    1896:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    189a:       41 e0           ldi     r20, 0x01       ; 1
    189c:       ad cf           rjmp    .-166           ; 0x17f8 <config_menu+0xc0>
                case 3: // big vario
                    COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
                    config_menu_drawings(chosen);
                    break;
                case 4: // statistics
                    COSD_FLAGS_MODES ^= COSD_FLAG_STATS;
    189e:       80 91 1b 01     lds     r24, 0x011B
    18a2:       98 e0           ldi     r25, 0x08       ; 8
    18a4:       89 27           eor     r24, r25
    18a6:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    18aa:       84 e0           ldi     r24, 0x04       ; 4
    18ac:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    18b0:       41 e0           ldi     r20, 0x01       ; 1
    18b2:       a2 cf           rjmp    .-188           ; 0x17f8 <config_menu+0xc0>
                case 2: // art horizon
                    COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON;
                    config_menu_drawings(chosen);
                    break;
                case 3: // big vario
                    COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
    18b4:       80 91 1b 01     lds     r24, 0x011B
    18b8:       8c 25           eor     r24, r12
    18ba:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    18be:       83 e0           ldi     r24, 0x03       ; 3
    18c0:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    18c4:       41 e0           ldi     r20, 0x01       ; 1
    18c6:       98 cf           rjmp    .-208           ; 0x17f8 <config_menu+0xc0>
                        config_menu_drawings(chosen);
                        _delay_ms(500);
        } else if (s1_pressed()) {
            switch (chosen) {
                case 0: // NTSC or PAL
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_NTSC;
    18c8:       80 91 1c 01     lds     r24, 0x011C
    18cc:       8f 25           eor     r24, r15
    18ce:       80 93 1c 01     sts     0x011C, r24
                                        // Setup Video Mode
                                        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
    18d2:       80 fd           sbrc    r24, 0
    18d4:       4b c0           rjmp    .+150           ; 0x196c <config_menu+0x234>
                                            spi_send_byte(0x00, 0b00001000);

                                                bottom_line = 12;
                                        } else {
                                            // PAL + enable display immediately (VM0)
                                            spi_send_byte(0x00, 0b01001000);
    18d6:       80 e0           ldi     r24, 0x00       ; 0
    18d8:       68 e4           ldi     r22, 0x48       ; 72
    18da:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>

                                                bottom_line = 14;
    18de:       b0 92 03 01     sts     0x0103, r11
                                        }
                    config_menu_drawings(chosen);
    18e2:       80 e0           ldi     r24, 0x00       ; 0
    18e4:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    18e8:       41 e0           ldi     r20, 0x01       ; 1
    18ea:       86 cf           rjmp    .-244           ; 0x17f8 <config_menu+0xc0>
                case 5: // current by fc
                    COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
                    config_menu_drawings(chosen);
                    break;
                                case 6: // 2nd voltage by c-strom
                    COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT;
    18ec:       80 91 1b 01     lds     r24, 0x011B
    18f0:       8d 25           eor     r24, r13
    18f2:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    18f6:       86 e0           ldi     r24, 0x06       ; 6
    18f8:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    18fc:       41 e0           ldi     r20, 0x01       ; 1
    18fe:       7c cf           rjmp    .-264           ; 0x17f8 <config_menu+0xc0>
                                        COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof(fcdisplaymodes) / sizeof(displaymode_t));
                                        mode = fcdisplaymodes;
                                        mode += COSD_DISPLAYMODE;
                                        osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun);
                                        #else
                                        COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof(ncdisplaymodes) / sizeof(displaymode_t));
    1900:       e0 91 1e 01     lds     r30, 0x011E
    1904:       ef 5f           subi    r30, 0xFF       ; 255
    1906:       e1 70           andi    r30, 0x01       ; 1
    1908:       e0 93 1e 01     sts     0x011E, r30
                                        mode = ncdisplaymodes;
                                        mode += COSD_DISPLAYMODE;
    190c:       f0 e0           ldi     r31, 0x00       ; 0
    190e:       ee 0f           add     r30, r30
    1910:       ff 1f           adc     r31, r31
    1912:       ee 0f           add     r30, r30
    1914:       ff 1f           adc     r31, r31
    1916:       e0 5d           subi    r30, 0xD0       ; 208
    1918:       fe 4f           sbci    r31, 0xFE       ; 254
    191a:       f0 93 9e 02     sts     0x029E, r31
    191e:       e0 93 9d 02     sts     0x029D, r30
                                        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
    1922:       85 91           lpm     r24, Z+
    1924:       94 91           lpm     r25, Z+
    1926:       90 93 06 01     sts     0x0106, r25
    192a:       80 93 05 01     sts     0x0105, r24
                                        #endif
                                        config_menu_drawings(chosen);
    192e:       88 e0           ldi     r24, 0x08       ; 8
    1930:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    1934:       41 e0           ldi     r20, 0x01       ; 1
    1936:       60 cf           rjmp    .-320           ; 0x17f8 <config_menu+0xc0>
                case 9: // GPS or BARO height
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
                    config_menu_drawings(chosen);
                    break;
                case 10: // save
                    save_eeprom();
    1938:       0e 94 7f 0b     call    0x16fe  ; 0x16fe <save_eeprom>
                    config_menu_doclick(chosen);
    193c:       8a e0           ldi     r24, 0x0A       ; 10
    193e:       0e 94 67 0b     call    0x16ce  ; 0x16ce <config_menu_doclick>
    1942:       59 cf           rjmp    .-334           ; 0x17f6 <config_menu+0xbe>
                case 1: // full HUD
                    COSD_FLAGS_MODES ^= COSD_FLAG_HUD;
                    config_menu_drawings(chosen);
                    break;
                case 2: // art horizon
                    COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON;
    1944:       80 91 1b 01     lds     r24, 0x011B
    1948:       81 27           eor     r24, r17
    194a:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    194e:       82 e0           ldi     r24, 0x02       ; 2
    1950:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    1954:       41 e0           ldi     r20, 0x01       ; 1
    1956:       50 cf           rjmp    .-352           ; 0x17f8 <config_menu+0xc0>
                /*case 5: // warnings
                    COSD_FLAGS_MODES ^= COSD_FLAG_WARNINGS;
                    config_menu_drawings(chosen);
                    break;*/
                case 5: // current by fc
                    COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
    1958:       80 91 1b 01     lds     r24, 0x011B
    195c:       80 27           eor     r24, r16
    195e:       80 93 1b 01     sts     0x011B, r24
                    config_menu_drawings(chosen);
    1962:       85 e0           ldi     r24, 0x05       ; 5
    1964:       0e 94 ad 0a     call    0x155a  ; 0x155a <config_menu_drawings>
    1968:       41 e0           ldi     r20, 0x01       ; 1
    196a:       46 cf           rjmp    .-372           ; 0x17f8 <config_menu+0xc0>
                case 0: // NTSC or PAL
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_NTSC;
                                        // Setup Video Mode
                                        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
                                            // NTSC + enable display immediately (VM0)
                                            spi_send_byte(0x00, 0b00001000);
    196c:       80 e0           ldi     r24, 0x00       ; 0
    196e:       68 e0           ldi     r22, 0x08       ; 8
    1970:       0e 94 af 04     call    0x95e   ; 0x95e <spi_send_byte>

                                                bottom_line = 12;
    1974:       a0 92 03 01     sts     0x0103, r10
    1978:       b4 cf           rjmp    .-152           ; 0x18e2 <config_menu+0x1aa>

0000197a <get_eeprom>:
const char* ee_msg[] PROGMEM = {ee_message0, ee_message1};

/**
 * read data saved in eeprom, print out message if <verbose> is set
 */
void get_eeprom(uint8_t verbose) {
    197a:       1f 93           push    r17
    197c:       18 2f           mov     r17, r24
        if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
    197e:       80 e0           ldi     r24, 0x00       ; 0
    1980:       90 e0           ldi     r25, 0x00       ; 0
    1982:       0e 94 ed 1c     call    0x39da  ; 0x39da <__eerd_byte_m162>
    1986:       8e 32           cpi     r24, 0x2E       ; 46
    1988:       51 f0           breq    .+20            ; 0x199e <get_eeprom+0x24>
                COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG);
                COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE);
                //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0);
        } else {
                #if !(ALLCHARSDEBUG|(WRITECHARS != -1))
                if (verbose) write_ascii_string_pgm(2, 9, ee_msg[1]); // Loading data
    198a:       11 23           and     r17, r17
    198c:       31 f0           breq    .+12            ; 0x199a <get_eeprom+0x20>
    198e:       82 e0           ldi     r24, 0x02       ; 2
    1990:       69 e0           ldi     r22, 0x09       ; 9
    1992:       47 e0           ldi     r20, 0x07       ; 7
    1994:       52 e0           ldi     r21, 0x02       ; 2
    1996:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                #endif
        }
}
    199a:       1f 91           pop     r17
    199c:       08 95           ret

/**
 * read data saved in eeprom, print out message if <verbose> is set
 */
void get_eeprom(uint8_t verbose) {
        if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
    199e:       81 e0           ldi     r24, 0x01       ; 1
    19a0:       90 e0           ldi     r25, 0x00       ; 0
    19a2:       0e 94 ed 1c     call    0x39da  ; 0x39da <__eerd_byte_m162>
    19a6:       87 31           cpi     r24, 0x17       ; 23
    19a8:       81 f7           brne    .-32            ; 0x198a <get_eeprom+0x10>
                #if !(ALLCHARSDEBUG|(WRITECHARS != -1))
                if (verbose) write_ascii_string_pgm(2, 9, ee_msg[0]); // Loading data
    19aa:       11 23           and     r17, r17
    19ac:       99 f4           brne    .+38            ; 0x19d4 <get_eeprom+0x5a>
                #endif
                COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES);
    19ae:       82 e0           ldi     r24, 0x02       ; 2
    19b0:       90 e0           ldi     r25, 0x00       ; 0
    19b2:       0e 94 ed 1c     call    0x39da  ; 0x39da <__eerd_byte_m162>
    19b6:       80 93 1b 01     sts     0x011B, r24
                COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG);
    19ba:       83 e0           ldi     r24, 0x03       ; 3
    19bc:       90 e0           ldi     r25, 0x00       ; 0
    19be:       0e 94 ed 1c     call    0x39da  ; 0x39da <__eerd_byte_m162>
    19c2:       80 93 1c 01     sts     0x011C, r24
                COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE);
    19c6:       84 e0           ldi     r24, 0x04       ; 4
    19c8:       90 e0           ldi     r25, 0x00       ; 0
    19ca:       0e 94 ed 1c     call    0x39da  ; 0x39da <__eerd_byte_m162>
    19ce:       80 93 1e 01     sts     0x011E, r24
    19d2:       e3 cf           rjmp    .-58            ; 0x199a <get_eeprom+0x20>
 * read data saved in eeprom, print out message if <verbose> is set
 */
void get_eeprom(uint8_t verbose) {
        if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
                #if !(ALLCHARSDEBUG|(WRITECHARS != -1))
                if (verbose) write_ascii_string_pgm(2, 9, ee_msg[0]); // Loading data
    19d4:       82 e0           ldi     r24, 0x02       ; 2
    19d6:       69 e0           ldi     r22, 0x09       ; 9
    19d8:       4e ee           ldi     r20, 0xEE       ; 238
    19da:       51 e0           ldi     r21, 0x01       ; 1
    19dc:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    19e0:       e6 cf           rjmp    .-52            ; 0x19ae <get_eeprom+0x34>

000019e2 <init_cosd>:

/**
 * auto config some stuff on startup, currently only battery cells
 * TODO: this is testing stuff, strings should go progmem and so on...
 */
void init_cosd(uint8_t UBat) {
    19e2:       ff 92           push    r15
    19e4:       0f 93           push    r16
    19e6:       1f 93           push    r17
    19e8:       df 93           push    r29
    19ea:       cf 93           push    r28
    19ec:       cd b7           in      r28, 0x3d       ; 61
    19ee:       de b7           in      r29, 0x3e       ; 62
    19f0:       2a 97           sbiw    r28, 0x0a       ; 10
    19f2:       0f b6           in      r0, 0x3f        ; 63
    19f4:       f8 94           cli
    19f6:       de bf           out     0x3e, r29       ; 62
    19f8:       0f be           out     0x3f, r0        ; 63
    19fa:       cd bf           out     0x3d, r28       ; 61
    19fc:       18 2f           mov     r17, r24
    clear();
    19fe:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
        write_ascii_string_pgm(2, 1, PSTR("C-OSD Initialisation")); // C-OSD Initialisation
    1a02:       82 e0           ldi     r24, 0x02       ; 2
    1a04:       61 e0           ldi     r22, 0x01       ; 1
    1a06:       46 e7           ldi     r20, 0x76       ; 118
    1a08:       53 e0           ldi     r21, 0x03       ; 3
    1a0a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
#if FCONLY
        write_ascii_string_pgm(2, 2, PSTR("FC only Mode")); // FC only mode
#else
        write_ascii_string_pgm(2, 2, PSTR("NaviCtrl Mode")); // NaviCtrl Mode
    1a0e:       82 e0           ldi     r24, 0x02       ; 2
    1a10:       62 e0           ldi     r22, 0x02       ; 2
    1a12:       48 e6           ldi     r20, 0x68       ; 104
    1a14:       53 e0           ldi     r21, 0x03       ; 3
    1a16:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
#endif
    write_ascii_string_pgm(2, 3, PSTR(BUILDDATE));
    1a1a:       82 e0           ldi     r24, 0x02       ; 2
    1a1c:       63 e0           ldi     r22, 0x03       ; 3
    1a1e:       4c e5           ldi     r20, 0x5C       ; 92
    1a20:       53 e0           ldi     r21, 0x03       ; 3
    1a22:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    uint8_t cellnum = 0;
    if (CELL_NUM == -1) {
                write_ascii_string_pgm(2, 4, PSTR("Guessing Number of Cells")); // Guessing Number of Cells
    1a26:       82 e0           ldi     r24, 0x02       ; 2
    1a28:       64 e0           ldi     r22, 0x04       ; 4
    1a2a:       43 e4           ldi     r20, 0x43       ; 67
    1a2c:       53 e0           ldi     r21, 0x03       ; 3
    1a2e:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    1a32:       61 2f           mov     r22, r17
    1a34:       70 e0           ldi     r23, 0x00       ; 0
    1a36:       00 e0           ldi     r16, 0x00       ; 0
        do {
            cellnum++;
    1a38:       0f 5f           subi    r16, 0xFF       ; 255
        } while (UBat > ((cellnum * CELL_VOLT_MAX) + 23));
    1a3a:       40 2f           mov     r20, r16
    1a3c:       50 e0           ldi     r21, 0x00       ; 0
    1a3e:       ca 01           movw    r24, r20
    1a40:       88 0f           add     r24, r24
    1a42:       99 1f           adc     r25, r25
    1a44:       88 0f           add     r24, r24
    1a46:       99 1f           adc     r25, r25
    1a48:       9c 01           movw    r18, r24
    1a4a:       22 0f           add     r18, r18
    1a4c:       33 1f           adc     r19, r19
    1a4e:       22 0f           add     r18, r18
    1a50:       33 1f           adc     r19, r19
    1a52:       22 0f           add     r18, r18
    1a54:       33 1f           adc     r19, r19
    1a56:       28 0f           add     r18, r24
    1a58:       39 1f           adc     r19, r25
    1a5a:       24 0f           add     r18, r20
    1a5c:       35 1f           adc     r19, r21
    1a5e:       c9 01           movw    r24, r18
    1a60:       47 96           adiw    r24, 0x17       ; 23
    1a62:       86 17           cp      r24, r22
    1a64:       97 07           cpc     r25, r23
    1a66:       44 f3           brlt    .-48            ; 0x1a38 <init_cosd+0x56>
    } else {
        cellnum = CELL_NUM;
    }
    min_voltage = cellnum * CELL_VOLT_MIN;
    1a68:       44 0f           add     r20, r20
    1a6a:       55 1f           adc     r21, r21
    1a6c:       42 95           swap    r20
    1a6e:       52 95           swap    r21
    1a70:       50 7f           andi    r21, 0xF0       ; 240
    1a72:       54 27           eor     r21, r20
    1a74:       40 7f           andi    r20, 0xF0       ; 240
    1a76:       54 27           eor     r21, r20
    1a78:       40 93 19 01     sts     0x0119, r20
    max_voltage = cellnum * CELL_VOLT_MAX;
    1a7c:       20 93 1a 01     sts     0x011A, r18
        write_ascii_string_pgm(2, 5, PSTR("Number of Cells:")); // Number of Cells
    1a80:       82 e0           ldi     r24, 0x02       ; 2
    1a82:       65 e0           ldi     r22, 0x05       ; 5
    1a84:       42 e3           ldi     r20, 0x32       ; 50
    1a86:       53 e0           ldi     r21, 0x03       ; 3
    1a88:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    write_ndigit_number_u(21, 5, cellnum, 1, 0);
    1a8c:       85 e1           ldi     r24, 0x15       ; 21
    1a8e:       65 e0           ldi     r22, 0x05       ; 5
    1a90:       40 2f           mov     r20, r16
    1a92:       50 e0           ldi     r21, 0x00       ; 0
    1a94:       21 e0           ldi     r18, 0x01       ; 1
    1a96:       30 e0           ldi     r19, 0x00       ; 0
    1a98:       00 e0           ldi     r16, 0x00       ; 0
    1a9a:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_ascii_string_pgm(2, 6, PSTR("Warn Voltage   :")); // Warn Voltage
    1a9e:       82 e0           ldi     r24, 0x02       ; 2
    1aa0:       66 e0           ldi     r22, 0x06       ; 6
    1aa2:       41 e2           ldi     r20, 0x21       ; 33
    1aa4:       53 e0           ldi     r21, 0x03       ; 3
    1aa6:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    write_ndigit_number_s_10th(20, 6, min_voltage, 3, 0);
    1aaa:       40 91 19 01     lds     r20, 0x0119
    1aae:       84 e1           ldi     r24, 0x14       ; 20
    1ab0:       66 e0           ldi     r22, 0x06       ; 6
    1ab2:       50 e0           ldi     r21, 0x00       ; 0
    1ab4:       23 e0           ldi     r18, 0x03       ; 3
    1ab6:       30 e0           ldi     r19, 0x00       ; 0
    1ab8:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
        write_ascii_string_pgm(2, 7, PSTR("Max Voltage    :")); // Max Voltage
    1abc:       82 e0           ldi     r24, 0x02       ; 2
    1abe:       67 e0           ldi     r22, 0x07       ; 7
    1ac0:       40 e1           ldi     r20, 0x10       ; 16
    1ac2:       53 e0           ldi     r21, 0x03       ; 3
    1ac4:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    write_ndigit_number_s_10th(20, 7, max_voltage, 3, 0);
    1ac8:       40 91 1a 01     lds     r20, 0x011A
    1acc:       84 e1           ldi     r24, 0x14       ; 20
    1ace:       67 e0           ldi     r22, 0x07       ; 7
    1ad0:       50 e0           ldi     r21, 0x00       ; 0
    1ad2:       23 e0           ldi     r18, 0x03       ; 3
    1ad4:       30 e0           ldi     r19, 0x00       ; 0
    1ad6:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>

        get_eeprom(1);
    1ada:       81 e0           ldi     r24, 0x01       ; 1
    1adc:       0e 94 bd 0c     call    0x197a  ; 0x197a <get_eeprom>

    //write_ascii_string_pgm(23, 2, vm[COSD_FLAGS & COSD_FLAG_NTSC]);
        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
    1ae0:       80 91 1c 01     lds     r24, 0x011C
    1ae4:       80 ff           sbrs    r24, 0
    1ae6:       7a c0           rjmp    .+244           ; 0x1bdc <init_cosd+0x1fa>
                write_ascii_string_pgm(23, 2, VM_NTSC);
    1ae8:       87 e1           ldi     r24, 0x17       ; 23
    1aea:       62 e0           ldi     r22, 0x02       ; 2
    1aec:       49 ee           ldi     r20, 0xE9       ; 233
    1aee:       51 e0           ldi     r21, 0x01       ; 1
    1af0:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        } else {
                write_ascii_string_pgm(23, 2, VM_PAL);
        }

        // request version from board
        rxd_buffer_locked = 0;
    1af4:       10 92 29 01     sts     0x0129, r1
        usart1_EnableTXD();
    1af8:       0e 94 3e 03     call    0x67c   ; 0x67c <usart1_EnableTXD>
                //usart1_request_mk_data(0, 'v', 0);
                write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........"));
                usart1_puts_pgm(PSTR(REQUEST_FC_VERSION));
        #else
                //usart1_request_mk_data(1, 'v', 0);    
                usart1_puts_pgm(PSTR(REQUEST_NC_VERSION));
    1afc:       85 e0           ldi     r24, 0x05       ; 5
    1afe:       93 e0           ldi     r25, 0x03       ; 3
    1b00:       0e 94 47 03     call    0x68e   ; 0x68e <usart1_puts_pgm>
                write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........"));
    1b04:       82 e0           ldi     r24, 0x02       ; 2
    1b06:       6b e0           ldi     r22, 0x0B       ; 11
    1b08:       40 ef           ldi     r20, 0xF0       ; 240
    1b0a:       52 e0           ldi     r21, 0x02       ; 2
    1b0c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        #endif
        usart1_DisableTXD();
    1b10:       0e 94 39 03     call    0x672   ; 0x672 <usart1_DisableTXD>
        // wait for response
        while (rxd_buffer_locked == 0) {
    1b14:       80 91 29 01     lds     r24, 0x0129
    1b18:       88 23           and     r24, r24
    1b1a:       29 f4           brne    .+10            ; 0x1b26 <init_cosd+0x144>
                asm("nop");
    1b1c:       00 00           nop
                usart1_puts_pgm(PSTR(REQUEST_NC_VERSION));
                write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........"));
        #endif
        usart1_DisableTXD();
        // wait for response
        while (rxd_buffer_locked == 0) {
    1b1e:       80 91 29 01     lds     r24, 0x0129
    1b22:       88 23           and     r24, r24
    1b24:       d9 f3           breq    .-10            ; 0x1b1c <init_cosd+0x13a>
                asm("nop");
        }
        Decode64();
    1b26:       0e 94 30 04     call    0x860   ; 0x860 <Decode64>
        str_VersionInfo VersionInfo;
        VersionInfo = *((str_VersionInfo*) pRxData);
    1b2a:       de 01           movw    r26, r28
    1b2c:       11 96           adiw    r26, 0x01       ; 1
    1b2e:       80 91 2b 01     lds     r24, 0x012B
    1b32:       90 91 2c 01     lds     r25, 0x012C
    1b36:       9c 01           movw    r18, r24
    1b38:       f9 01           movw    r30, r18
    1b3a:       8a e0           ldi     r24, 0x0A       ; 10
    1b3c:       01 90           ld      r0, Z+
    1b3e:       0d 92           st      X+, r0
    1b40:       81 50           subi    r24, 0x01       ; 1
    1b42:       e1 f7           brne    .-8             ; 0x1b3c <init_cosd+0x15a>
    1b44:       fa 80           ldd     r15, Y+2        ; 0x02
    1b46:       1d 81           ldd     r17, Y+5        ; 0x05
        
        write_ndigit_number_u(14, 11, VersionInfo.SWMajor, 3, 1);
    1b48:       49 81           ldd     r20, Y+1        ; 0x01
    1b4a:       8e e0           ldi     r24, 0x0E       ; 14
    1b4c:       6b e0           ldi     r22, 0x0B       ; 11
    1b4e:       50 e0           ldi     r21, 0x00       ; 0
    1b50:       23 e0           ldi     r18, 0x03       ; 3
    1b52:       30 e0           ldi     r19, 0x00       ; 0
    1b54:       01 e0           ldi     r16, 0x01       ; 1
    1b56:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_ndigit_number_u(18, 11, VersionInfo.SWMinor, 3, 1);
    1b5a:       82 e1           ldi     r24, 0x12       ; 18
    1b5c:       6b e0           ldi     r22, 0x0B       ; 11
    1b5e:       4f 2d           mov     r20, r15
    1b60:       50 e0           ldi     r21, 0x00       ; 0
    1b62:       23 e0           ldi     r18, 0x03       ; 3
    1b64:       30 e0           ldi     r19, 0x00       ; 0
    1b66:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_ascii_char(22 + 11*30, 'a' + VersionInfo.SWPatch);
    1b6a:       1f 59           subi    r17, 0x9F       ; 159
    1b6c:       80 e6           ldi     r24, 0x60       ; 96
    1b6e:       91 e0           ldi     r25, 0x01       ; 1
    1b70:       61 2f           mov     r22, r17
    1b72:       0e 94 10 05     call    0xa20   ; 0xa20 <write_ascii_char>
        mode += COSD_DISPLAYMODE;
        osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun);
        // re-request data ever 100ms from FC;
        //usart1_request_mk_data(0, 'd', 100);
        #else
        COSD_DISPLAYMODE %= (sizeof(ncdisplaymodes) / sizeof(displaymode_t));
    1b76:       e0 91 1e 01     lds     r30, 0x011E
    1b7a:       e1 70           andi    r30, 0x01       ; 1
    1b7c:       e0 93 1e 01     sts     0x011E, r30
        mode = ncdisplaymodes;
        mode += COSD_DISPLAYMODE;
    1b80:       f0 e0           ldi     r31, 0x00       ; 0
    1b82:       ee 0f           add     r30, r30
    1b84:       ff 1f           adc     r31, r31
    1b86:       ee 0f           add     r30, r30
    1b88:       ff 1f           adc     r31, r31
    1b8a:       e0 5d           subi    r30, 0xD0       ; 208
    1b8c:       fe 4f           sbci    r31, 0xFE       ; 254
    1b8e:       f0 93 9e 02     sts     0x029E, r31
    1b92:       e0 93 9d 02     sts     0x029D, r30
        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
    1b96:       85 91           lpm     r24, Z+
    1b98:       94 91           lpm     r25, Z+
    1b9a:       90 93 06 01     sts     0x0106, r25
    1b9e:       80 93 05 01     sts     0x0105, r24
    1ba2:       20 e3           ldi     r18, 0x30       ; 48
    1ba4:       35 e7           ldi     r19, 0x75       ; 117
    1ba6:       40 e9           ldi     r20, 0x90       ; 144
    1ba8:       51 e0           ldi     r21, 0x01       ; 1
    1baa:       ca 01           movw    r24, r20
    1bac:       01 97           sbiw    r24, 0x01       ; 1
    1bae:       f1 f7           brne    .-4             ; 0x1bac <init_cosd+0x1ca>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    1bb0:       21 50           subi    r18, 0x01       ; 1
    1bb2:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    1bb4:       d1 f7           brne    .-12            ; 0x1baa <init_cosd+0x1c8>
        // re-request OSD Data from NC every 100ms
        //usart1_request_mk_data(1, 'o', 100);
        #endif

    _delay_ms(3000);
    clear();
    1bb6:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
    // update flags to paint display again because of clear
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
    1bba:       80 91 1d 01     lds     r24, 0x011D
    1bbe:       8d 7f           andi    r24, 0xFD       ; 253
    1bc0:       80 93 1d 01     sts     0x011D, r24
}
    1bc4:       2a 96           adiw    r28, 0x0a       ; 10
    1bc6:       0f b6           in      r0, 0x3f        ; 63
    1bc8:       f8 94           cli
    1bca:       de bf           out     0x3e, r29       ; 62
    1bcc:       0f be           out     0x3f, r0        ; 63
    1bce:       cd bf           out     0x3d, r28       ; 61
    1bd0:       cf 91           pop     r28
    1bd2:       df 91           pop     r29
    1bd4:       1f 91           pop     r17
    1bd6:       0f 91           pop     r16
    1bd8:       ff 90           pop     r15
    1bda:       08 95           ret

    //write_ascii_string_pgm(23, 2, vm[COSD_FLAGS & COSD_FLAG_NTSC]);
        if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
                write_ascii_string_pgm(23, 2, VM_NTSC);
        } else {
                write_ascii_string_pgm(23, 2, VM_PAL);
    1bdc:       87 e1           ldi     r24, 0x17       ; 23
    1bde:       62 e0           ldi     r22, 0x02       ; 2
    1be0:       44 ee           ldi     r20, 0xE4       ; 228
    1be2:       51 e0           ldi     r21, 0x01       ; 1
    1be4:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
    1be8:       85 cf           rjmp    .-246           ; 0x1af4 <init_cosd+0x112>

00001bea <SpiMasterInit>:
#define INT0_LOW                        PORTD &= ~(1 << PD2);

/**
 * init the SPI as master
 */
void SpiMasterInit(void) {
    1bea:       df 93           push    r29
    1bec:       cf 93           push    r28
    1bee:       0f 92           push    r0
    1bf0:       cd b7           in      r28, 0x3d       ; 61
    1bf2:       de b7           in      r29, 0x3e       ; 62
    volatile char IOReg;
    // set PB4(/SS), PB5(MOSI), PB7(SCK) as output
    DDRB = (1 << PB4) | (1 << PB5) | (1 << PB7);
    1bf4:       80 eb           ldi     r24, 0xB0       ; 176
    1bf6:       87 bb           out     0x17, r24       ; 23
    PORTB |= (1 << PB4); // pullup SS
    1bf8:       c4 9a           sbi     0x18, 4 ; 24
    // enable SPI Interrupt and SPI in Master Mode with SCK = CK/128
    SPCR = (1 << SPIE) | (1 << SPE) | (1 << MSTR) | (1 << SPR0) | (1 << SPR1);
    1bfa:       83 ed           ldi     r24, 0xD3       ; 211
    1bfc:       8d b9           out     0x0d, r24       ; 13
    IOReg = SPSR; // clear SPIF bit in SPSR
    1bfe:       8e b1           in      r24, 0x0e       ; 14
    1c00:       89 83           std     Y+1, r24        ; 0x01
    IOReg = SPDR;
    1c02:       8f b1           in      r24, 0x0f       ; 15
    1c04:       89 83           std     Y+1, r24        ; 0x01
    //sei(); // we do it later
}
    1c06:       0f 90           pop     r0
    1c08:       cf 91           pop     r28
    1c0a:       df 91           pop     r29
    1c0c:       08 95           ret

00001c0e <__vector_18>:


/**
 * SPI interrupt handler
 */
ISR(SPI_STC_vect) {
    1c0e:       1f 92           push    r1
    1c10:       0f 92           push    r0
    1c12:       0f b6           in      r0, 0x3f        ; 63
    1c14:       0f 92           push    r0
    1c16:       11 24           eor     r1, r1
    1c18:       8f 93           push    r24
    1c1a:       9f 93           push    r25
    1c1c:       ef 93           push    r30
    1c1e:       ff 93           push    r31
        if (request_count == 0) {
    1c20:       80 91 36 01     lds     r24, 0x0136
    1c24:       88 23           and     r24, r24
    1c26:       11 f5           brne    .+68            ; 0x1c6c <__vector_18+0x5e>
                SPI_buffer.buffer.chk = SPDR; // firs char received is check byte from last transfer
    1c28:       8f b1           in      r24, 0x0f       ; 15
    1c2a:       80 93 95 01     sts     0x0195, r24
        } else {
                SPI_buffer.buffer.c[request_count - 1] = SPDR; // safe received byte to buffer
        }
        request_count++;
    1c2e:       80 91 36 01     lds     r24, 0x0136
    1c32:       8f 5f           subi    r24, 0xFF       ; 255
    1c34:       80 93 36 01     sts     0x0136, r24
    if (--icnt) {
    1c38:       80 91 34 01     lds     r24, 0x0134
    1c3c:       90 91 35 01     lds     r25, 0x0135
    1c40:       01 97           sbiw    r24, 0x01       ; 1
    1c42:       90 93 35 01     sts     0x0135, r25
    1c46:       80 93 34 01     sts     0x0134, r24
    1c4a:       80 91 34 01     lds     r24, 0x0134
    1c4e:       90 91 35 01     lds     r25, 0x0135
    1c52:       89 2b           or      r24, r25
    1c54:       99 f4           brne    .+38            ; 0x1c7c <__vector_18+0x6e>
        //SPDR = *iptr; // send next byte
        spi_ready = 1; // we _should_ send later because the slave needs more time
    } else {
        SPCR &= ~_BV(SPIE); // deactivate interrupt
    1c56:       6f 98           cbi     0x0d, 7 ; 13
        INT0_HIGH // transfer is done, slave does not need to listen
    1c58:       92 9a           sbi     0x12, 2 ; 18
    }
}
    1c5a:       ff 91           pop     r31
    1c5c:       ef 91           pop     r30
    1c5e:       9f 91           pop     r25
    1c60:       8f 91           pop     r24
    1c62:       0f 90           pop     r0
    1c64:       0f be           out     0x3f, r0        ; 63
    1c66:       0f 90           pop     r0
    1c68:       1f 90           pop     r1
    1c6a:       18 95           reti
 */
ISR(SPI_STC_vect) {
        if (request_count == 0) {
                SPI_buffer.buffer.chk = SPDR; // firs char received is check byte from last transfer
        } else {
                SPI_buffer.buffer.c[request_count - 1] = SPDR; // safe received byte to buffer
    1c6c:       e0 91 36 01     lds     r30, 0x0136
    1c70:       f0 e0           ldi     r31, 0x00       ; 0
    1c72:       8f b1           in      r24, 0x0f       ; 15
    1c74:       e6 57           subi    r30, 0x76       ; 118
    1c76:       fe 4f           sbci    r31, 0xFE       ; 254
    1c78:       80 83           st      Z, r24
    1c7a:       d9 cf           rjmp    .-78            ; 0x1c2e <__vector_18+0x20>
        }
        request_count++;
    if (--icnt) {
        //SPDR = *iptr; // send next byte
        spi_ready = 1; // we _should_ send later because the slave needs more time
    1c7c:       81 e0           ldi     r24, 0x01       ; 1
    1c7e:       80 93 10 01     sts     0x0110, r24
    1c82:       eb cf           rjmp    .-42            ; 0x1c5a <__vector_18+0x4c>

00001c84 <TransferIsBusy>:

/**
 * check if SPI transfer is still busy
 */
int TransferIsBusy(void) {
    return SPCR & _BV(SPIE);
    1c84:       2d b1           in      r18, 0x0d       ; 13
    1c86:       30 e0           ldi     r19, 0x00       ; 0
    1c88:       20 78           andi    r18, 0x80       ; 128
    1c8a:       30 70           andi    r19, 0x00       ; 0
}
    1c8c:       c9 01           movw    r24, r18
    1c8e:       08 95           ret

00001c90 <StartTransfer>:

/**
 * start a new transfer with length <len>
 */
void StartTransfer(uint16_t len) {
    INT0_LOW // /SS LOW ^= SS HIGH ^= slave should listen
    1c90:       92 98           cbi     0x12, 2 ; 18

        // this is a new request
        request_count = 0;
    1c92:       10 92 36 01     sts     0x0136, r1

    // set up pointer and length for interrupt handler
    icnt = len;
    1c96:       90 93 35 01     sts     0x0135, r25
    1c9a:       80 93 34 01     sts     0x0134, r24

    SPCR |= _BV(SPIE); // enable spi interrupt
    1c9e:       6f 9a           sbi     0x0d, 7 ; 13
        SPDR = 'A'; // start transfer by first command char
    1ca0:       81 e4           ldi     r24, 0x41       ; 65
    1ca2:       8f b9           out     0x0f, r24       ; 15
}
    1ca4:       08 95           ret

00001ca6 <spi_send_next>:

/**
 * send next command through spi
 */
void spi_send_next() {
        SPDR = 'A' + request_count;
    1ca6:       80 91 36 01     lds     r24, 0x0136
    1caa:       8f 5b           subi    r24, 0xBF       ; 191
    1cac:       8f b9           out     0x0f, r24       ; 15
}
    1cae:       08 95           ret

00001cb0 <s1_pressed>:

/* ##########################################################################
 * debounce buttons
 * ##########################################################################*/
int s1_pressed() {
    if (S1_PRESSED) {
    1cb0:       9d 9b           sbis    0x13, 5 ; 19
    1cb2:       04 c0           rjmp    .+8             ; 0x1cbc <s1_pressed+0xc>
    1cb4:       20 e0           ldi     r18, 0x00       ; 0
    1cb6:       30 e0           ldi     r19, 0x00       ; 0
        _delay_ms(25);
        if (S1_PRESSED) return 1;
    }
    return 0;
}
    1cb8:       c9 01           movw    r24, r18
    1cba:       08 95           ret

/* ##########################################################################
 * debounce buttons
 * ##########################################################################*/
int s1_pressed() {
    if (S1_PRESSED) {
    1cbc:       2a ef           ldi     r18, 0xFA       ; 250
    1cbe:       30 e0           ldi     r19, 0x00       ; 0
    1cc0:       40 e9           ldi     r20, 0x90       ; 144
    1cc2:       51 e0           ldi     r21, 0x01       ; 1
    1cc4:       ca 01           movw    r24, r20
    1cc6:       01 97           sbiw    r24, 0x01       ; 1
    1cc8:       f1 f7           brne    .-4             ; 0x1cc6 <s1_pressed+0x16>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    1cca:       21 50           subi    r18, 0x01       ; 1
    1ccc:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    1cce:       d1 f7           brne    .-12            ; 0x1cc4 <s1_pressed+0x14>
        _delay_ms(25);
        if (S1_PRESSED) return 1;
    1cd0:       83 b3           in      r24, 0x13       ; 19
    1cd2:       28 2f           mov     r18, r24
    1cd4:       30 e0           ldi     r19, 0x00       ; 0
    1cd6:       36 95           lsr     r19
    1cd8:       27 95           ror     r18
    1cda:       32 95           swap    r19
    1cdc:       22 95           swap    r18
    1cde:       2f 70           andi    r18, 0x0F       ; 15
    1ce0:       23 27           eor     r18, r19
    1ce2:       3f 70           andi    r19, 0x0F       ; 15
    1ce4:       23 27           eor     r18, r19
    1ce6:       20 95           com     r18
    1ce8:       30 95           com     r19
    1cea:       21 70           andi    r18, 0x01       ; 1
    1cec:       30 70           andi    r19, 0x00       ; 0
    }
    return 0;
}
    1cee:       c9 01           movw    r24, r18
    1cf0:       08 95           ret

00001cf2 <s2_pressed>:

int s2_pressed() {
    if (S2_PRESSED) {
    1cf2:       9c 9b           sbis    0x13, 4 ; 19
    1cf4:       04 c0           rjmp    .+8             ; 0x1cfe <s2_pressed+0xc>
    1cf6:       20 e0           ldi     r18, 0x00       ; 0
    1cf8:       30 e0           ldi     r19, 0x00       ; 0
        _delay_ms(25);
        if (S2_PRESSED) return 1;
    }
    return 0;
}
    1cfa:       c9 01           movw    r24, r18
    1cfc:       08 95           ret
    }
    return 0;
}

int s2_pressed() {
    if (S2_PRESSED) {
    1cfe:       2a ef           ldi     r18, 0xFA       ; 250
    1d00:       30 e0           ldi     r19, 0x00       ; 0
    1d02:       40 e9           ldi     r20, 0x90       ; 144
    1d04:       51 e0           ldi     r21, 0x01       ; 1
    1d06:       ca 01           movw    r24, r20
    1d08:       01 97           sbiw    r24, 0x01       ; 1
    1d0a:       f1 f7           brne    .-4             ; 0x1d08 <s2_pressed+0x16>
                {
                        // wait 1/10 ms
                        _delay_loop_2(((F_CPU) / 4e3) / 10);
                        __ticks --;
    1d0c:       21 50           subi    r18, 0x01       ; 1
    1d0e:       30 40           sbci    r19, 0x00       ; 0
                __ticks = 1;
        else if (__tmp > 65535)
        {
                //      __ticks = requested delay in 1/10 ms
                __ticks = (uint16_t) (__ms * 10.0);
                while(__ticks)
    1d10:       d1 f7           brne    .-12            ; 0x1d06 <s2_pressed+0x14>
        _delay_ms(25);
        if (S2_PRESSED) return 1;
    1d12:       83 b3           in      r24, 0x13       ; 19
    1d14:       28 2f           mov     r18, r24
    1d16:       30 e0           ldi     r19, 0x00       ; 0
    1d18:       32 95           swap    r19
    1d1a:       22 95           swap    r18
    1d1c:       2f 70           andi    r18, 0x0F       ; 15
    1d1e:       23 27           eor     r18, r19
    1d20:       3f 70           andi    r19, 0x0F       ; 15
    1d22:       23 27           eor     r18, r19
    1d24:       20 95           com     r18
    1d26:       30 95           com     r19
    1d28:       21 70           andi    r18, 0x01       ; 1
    1d2a:       30 70           andi    r19, 0x00       ; 0
    }
    return 0;
}
    1d2c:       c9 01           movw    r24, r18
    1d2e:       08 95           ret

00001d30 <ppm_init>:

/**
 * init ppm, including timer1 for measurement
 */
void ppm_init() {
        PORTE |= (1 << PORTE0);         // enable pullup on INT0 pin
    1d30:       38 9a           sbi     0x07, 0 ; 7
        GICR |= (1<<INT2);                      // External Interrupt Request 2 Enable
    1d32:       8b b7           in      r24, 0x3b       ; 59
    1d34:       80 62           ori     r24, 0x20       ; 32
    1d36:       8b bf           out     0x3b, r24       ; 59
        EMCUCR |= (1<<ISC2);            // a rising edge on INT2 activates the interrupt
    1d38:       86 b7           in      r24, 0x36       ; 54
    1d3a:       81 60           ori     r24, 0x01       ; 1
    1d3c:       86 bf           out     0x36, r24       ; 54
        TCCR1B |= (0<<CS12)|(1<<CS10)|(1<<CS11); // timer1 up with prescaler 64
    1d3e:       8e b5           in      r24, 0x2e       ; 46
    1d40:       83 60           ori     r24, 0x03       ; 3
    1d42:       8e bd           out     0x2e, r24       ; 46
}
    1d44:       08 95           ret

00001d46 <__vector_3>:

/**
 * Handle INT2 interrupts that occur on changing edges of ppm signal
 */
ISR(INT2_vect) {
    1d46:       1f 92           push    r1
    1d48:       0f 92           push    r0
    1d4a:       0f b6           in      r0, 0x3f        ; 63
    1d4c:       0f 92           push    r0
    1d4e:       11 24           eor     r1, r1
    1d50:       2f 93           push    r18
    1d52:       3f 93           push    r19
    1d54:       4f 93           push    r20
    1d56:       5f 93           push    r21
    1d58:       6f 93           push    r22
    1d5a:       7f 93           push    r23
    1d5c:       8f 93           push    r24
    1d5e:       9f 93           push    r25
    1d60:       af 93           push    r26
    1d62:       bf 93           push    r27
    1d64:       ef 93           push    r30
    1d66:       ff 93           push    r31
        // since the pin might get bogus reads we wait for 123 signals
        static uint8_t valid_ppm_to_go = 123;
        if (EMCUCR & (1<<ISC2)) { // rising
    1d68:       06 b6           in      r0, 0x36        ; 54
    1d6a:       00 fc           sbrc    r0, 0
    1d6c:       40 c0           rjmp    .+128           ; 0x1dee <__vector_3+0xa8>
                old_timer1 = TCNT1;
                EMCUCR &= ~(1<<ISC2); // next one is falling
        } else {                
                if (valid_ppm_to_go) {
    1d6e:       80 91 11 01     lds     r24, 0x0111
    1d72:       88 23           and     r24, r24
    1d74:       b9 f0           breq    .+46            ; 0x1da4 <__vector_3+0x5e>
                        valid_ppm_to_go--;
    1d76:       81 50           subi    r24, 0x01       ; 1
    1d78:       80 93 11 01     sts     0x0111, r24
                                        clear();
                                }
                                COSD_FLAGS_CONFIG &= ~COSD_FLAG_HUD;
                        }
                }
                EMCUCR |= (1<<ISC2); // next one is rising
    1d7c:       86 b7           in      r24, 0x36       ; 54
    1d7e:       81 60           ori     r24, 0x01       ; 1
    1d80:       86 bf           out     0x36, r24       ; 54
        }
        //write_ndigit_number_u(2, 2, ppm, 1000, 0); // debug 
        //write_ndigit_number_u(2, 3, valid_ppm_to_go, 100, 0); // debug 
        //write_ndigit_number_u(2, 4, COSD_FLAGS, 100, 0); // debug 
}
    1d82:       ff 91           pop     r31
    1d84:       ef 91           pop     r30
    1d86:       bf 91           pop     r27
    1d88:       af 91           pop     r26
    1d8a:       9f 91           pop     r25
    1d8c:       8f 91           pop     r24
    1d8e:       7f 91           pop     r23
    1d90:       6f 91           pop     r22
    1d92:       5f 91           pop     r21
    1d94:       4f 91           pop     r20
    1d96:       3f 91           pop     r19
    1d98:       2f 91           pop     r18
    1d9a:       0f 90           pop     r0
    1d9c:       0f be           out     0x3f, r0        ; 63
    1d9e:       0f 90           pop     r0
    1da0:       1f 90           pop     r1
    1da2:       18 95           reti
                EMCUCR &= ~(1<<ISC2); // next one is falling
        } else {                
                if (valid_ppm_to_go) {
                        valid_ppm_to_go--;
                } else {
                        ppm = TCNT1 - old_timer1;
    1da4:       8c b5           in      r24, 0x2c       ; 44
    1da6:       9d b5           in      r25, 0x2d       ; 45
    1da8:       20 91 3f 01     lds     r18, 0x013F
    1dac:       30 91 40 01     lds     r19, 0x0140
    1db0:       82 1b           sub     r24, r18
    1db2:       93 0b           sbc     r25, r19
    1db4:       90 93 42 01     sts     0x0142, r25
    1db8:       80 93 41 01     sts     0x0141, r24
                        ppm -= 256;
    1dbc:       80 91 41 01     lds     r24, 0x0141
    1dc0:       90 91 42 01     lds     r25, 0x0142
    1dc4:       80 50           subi    r24, 0x00       ; 0
    1dc6:       91 40           sbci    r25, 0x01       ; 1
    1dc8:       90 93 42 01     sts     0x0142, r25
    1dcc:       80 93 41 01     sts     0x0141, r24
                        if (ppm < 128) { // we want HUD
    1dd0:       80 91 41 01     lds     r24, 0x0141
    1dd4:       90 91 42 01     lds     r25, 0x0142
    1dd8:       80 38           cpi     r24, 0x80       ; 128
    1dda:       91 05           cpc     r25, r1
    1ddc:       90 f0           brcs    .+36            ; 0x1e02 <__vector_3+0xbc>
                                COSD_FLAGS_CONFIG |= COSD_FLAG_HUD;
                        } else { // we do not want hud
                                if (COSD_FLAGS_CONFIG & COSD_FLAG_HUD) {
    1dde:       80 91 1c 01     lds     r24, 0x011C
    1de2:       80 fd           sbrc    r24, 0
    1de4:       14 c0           rjmp    .+40            ; 0x1e0e <__vector_3+0xc8>
                                        clear();
                                }
                                COSD_FLAGS_CONFIG &= ~COSD_FLAG_HUD;
    1de6:       8e 7f           andi    r24, 0xFE       ; 254
    1de8:       80 93 1c 01     sts     0x011C, r24
    1dec:       c7 cf           rjmp    .-114           ; 0x1d7c <__vector_3+0x36>
 */
ISR(INT2_vect) {
        // since the pin might get bogus reads we wait for 123 signals
        static uint8_t valid_ppm_to_go = 123;
        if (EMCUCR & (1<<ISC2)) { // rising
                old_timer1 = TCNT1;
    1dee:       8c b5           in      r24, 0x2c       ; 44
    1df0:       9d b5           in      r25, 0x2d       ; 45
    1df2:       90 93 40 01     sts     0x0140, r25
    1df6:       80 93 3f 01     sts     0x013F, r24
                EMCUCR &= ~(1<<ISC2); // next one is falling
    1dfa:       86 b7           in      r24, 0x36       ; 54
    1dfc:       8e 7f           andi    r24, 0xFE       ; 254
    1dfe:       86 bf           out     0x36, r24       ; 54
    1e00:       c0 cf           rjmp    .-128           ; 0x1d82 <__vector_3+0x3c>
                        valid_ppm_to_go--;
                } else {
                        ppm = TCNT1 - old_timer1;
                        ppm -= 256;
                        if (ppm < 128) { // we want HUD
                                COSD_FLAGS_CONFIG |= COSD_FLAG_HUD;
    1e02:       80 91 1c 01     lds     r24, 0x011C
    1e06:       81 60           ori     r24, 0x01       ; 1
    1e08:       80 93 1c 01     sts     0x011C, r24
    1e0c:       b7 cf           rjmp    .-146           ; 0x1d7c <__vector_3+0x36>
                        } else { // we do not want hud
                                if (COSD_FLAGS_CONFIG & COSD_FLAG_HUD) {
                                        clear();
    1e0e:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
    1e12:       80 91 1c 01     lds     r24, 0x011C
    1e16:       e7 cf           rjmp    .-50            ; 0x1de6 <__vector_3+0xa0>

00001e18 <osd_ncmode_default>:
#include "osd_helpers.h"
#include "osd_ncmode_default.h"

#if !(ALLCHARSDEBUG|(WRITECHARS != -1))

int osd_ncmode_default() {
    1e18:       ef 92           push    r14
    1e1a:       ff 92           push    r15
    1e1c:       0f 93           push    r16
    1e1e:       1f 93           push    r17
    1e20:       cf 93           push    r28
    1e22:       df 93           push    r29
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
    1e24:       80 91 1b 01     lds     r24, 0x011B
    1e28:       80 ff           sbrs    r24, 0
    1e2a:       e5 c1           rjmp    .+970           ; 0x21f6 <osd_ncmode_default+0x3de>
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
    1e2c:       80 91 1d 01     lds     r24, 0x011D
    1e30:       81 ff           sbrs    r24, 1
    1e32:       f4 c2           rjmp    .+1512          ; 0x241c <osd_ncmode_default+0x604>
                    write_char_xy(27, bottom_line, 0xC9); // sat2
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
                }

                // first line
                write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
    1e34:       20 91 d4 01     lds     r18, 0x01D4
    1e38:       30 91 d5 01     lds     r19, 0x01D5
    1e3c:       40 e0           ldi     r20, 0x00       ; 0
    1e3e:       50 e0           ldi     r21, 0x00       ; 0
    1e40:       ca 01           movw    r24, r20
    1e42:       b9 01           movw    r22, r18
    1e44:       66 0f           add     r22, r22
    1e46:       77 1f           adc     r23, r23
    1e48:       88 1f           adc     r24, r24
    1e4a:       99 1f           adc     r25, r25
    1e4c:       66 0f           add     r22, r22
    1e4e:       77 1f           adc     r23, r23
    1e50:       88 1f           adc     r24, r24
    1e52:       99 1f           adc     r25, r25
    1e54:       66 0f           add     r22, r22
    1e56:       77 1f           adc     r23, r23
    1e58:       88 1f           adc     r24, r24
    1e5a:       99 1f           adc     r25, r25
    1e5c:       62 0f           add     r22, r18
    1e5e:       73 1f           adc     r23, r19
    1e60:       84 1f           adc     r24, r20
    1e62:       95 1f           adc     r25, r21
    1e64:       2a ef           ldi     r18, 0xFA       ; 250
    1e66:       30 e0           ldi     r19, 0x00       ; 0
    1e68:       40 e0           ldi     r20, 0x00       ; 0
    1e6a:       50 e0           ldi     r21, 0x00       ; 0
    1e6c:       0e 94 8f 1c     call    0x391e  ; 0x391e <__udivmodsi4>
    1e70:       82 e0           ldi     r24, 0x02       ; 2
    1e72:       60 91 02 01     lds     r22, 0x0102
    1e76:       a9 01           movw    r20, r18
    1e78:       23 e0           ldi     r18, 0x03       ; 3
    1e7a:       30 e0           ldi     r19, 0x00       ; 0
    1e7c:       00 e0           ldi     r16, 0x00       ; 0
    1e7e:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
    1e82:       40 91 dc 01     lds     r20, 0x01DC
    1e86:       87 e0           ldi     r24, 0x07       ; 7
    1e88:       60 91 02 01     lds     r22, 0x0102
    1e8c:       50 e0           ldi     r21, 0x00       ; 0
    1e8e:       23 e0           ldi     r18, 0x03       ; 3
    1e90:       30 e0           ldi     r19, 0x00       ; 0
    1e92:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    1e96:       80 91 dc 01     lds     r24, 0x01DC
    1e9a:       85 36           cpi     r24, 0x65       ; 101
    1e9c:       08 f4           brcc    .+2             ; 0x1ea0 <osd_ncmode_default+0x88>
    1e9e:       69 c2           rjmp    .+1234          ; 0x2372 <osd_ncmode_default+0x55a>
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (naviData.RC_Quality > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    1ea0:       80 91 dc 01     lds     r24, 0x01DC
    1ea4:       85 36           cpi     r24, 0x65       ; 101
    1ea6:       08 f0           brcs    .+2             ; 0x1eaa <osd_ncmode_default+0x92>
    1ea8:       a9 c2           rjmp    .+1362          ; 0x23fc <osd_ncmode_default+0x5e4>
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, 0);
                }
        

                if (naviData.NCFlags & NC_FLAG_NOSERIALLINK) {
    1eaa:       80 91 de 01     lds     r24, 0x01DE
    1eae:       84 ff           sbrs    r24, 4
    1eb0:       73 c2           rjmp    .+1254          ; 0x2398 <osd_ncmode_default+0x580>
                    write_char_xy(11, top_line, 0); // clear
    1eb2:       8b e0           ldi     r24, 0x0B       ; 11
    1eb4:       60 91 02 01     lds     r22, 0x0102
    1eb8:       40 e0           ldi     r20, 0x00       ; 0
    1eba:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                } else {
                    write_char_xy(11, top_line, 0xC6); // PC icon
                }

                write_ndigit_number_u(13, top_line, naviData.CompassHeading, 3, 0);
    1ebe:       40 91 d8 01     lds     r20, 0x01D8
    1ec2:       50 91 d9 01     lds     r21, 0x01D9
    1ec6:       8d e0           ldi     r24, 0x0D       ; 13
    1ec8:       60 91 02 01     lds     r22, 0x0102
    1ecc:       23 e0           ldi     r18, 0x03       ; 3
    1ece:       30 e0           ldi     r19, 0x00       ; 0
    1ed0:       00 e0           ldi     r16, 0x00       ; 0
    1ed2:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word ( &(directions[heading_conv(naviData.CompassHeading)]))));
    1ed6:       10 91 02 01     lds     r17, 0x0102
    1eda:       80 91 d8 01     lds     r24, 0x01D8
    1ede:       90 91 d9 01     lds     r25, 0x01D9
    1ee2:       0e 94 9d 08     call    0x113a  ; 0x113a <heading_conv>
    1ee6:       e8 2f           mov     r30, r24
    1ee8:       f0 e0           ldi     r31, 0x00       ; 0
    1eea:       ee 0f           add     r30, r30
    1eec:       ff 1f           adc     r31, r31
    1eee:       e8 5f           subi    r30, 0xF8       ; 248
    1ef0:       fe 4f           sbci    r31, 0xFE       ; 254
    1ef2:       45 91           lpm     r20, Z+
    1ef4:       54 91           lpm     r21, Z+
    1ef6:       81 e1           ldi     r24, 0x11       ; 17
    1ef8:       61 2f           mov     r22, r17
    1efa:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>

                draw_variometer(21, top_line, naviData.Variometer);
    1efe:       40 91 cf 01     lds     r20, 0x01CF
    1f02:       50 91 d0 01     lds     r21, 0x01D0
    1f06:       85 e1           ldi     r24, 0x15       ; 21
    1f08:       60 91 02 01     lds     r22, 0x0102
    1f0c:       0e 94 c1 09     call    0x1382  ; 0x1382 <draw_variometer>

                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
    1f10:       80 91 1c 01     lds     r24, 0x011C
    1f14:       81 ff           sbrs    r24, 1
    1f16:       52 c0           rjmp    .+164           ; 0x1fbc <osd_ncmode_default+0x1a4>
                        if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > 10 || naviData.CurrentPosition.Altitude / 1000 - altimeter_offset < -10) {
    1f18:       60 91 a3 01     lds     r22, 0x01A3
    1f1c:       70 91 a4 01     lds     r23, 0x01A4
    1f20:       80 91 a5 01     lds     r24, 0x01A5
    1f24:       90 91 a6 01     lds     r25, 0x01A6
    1f28:       c0 91 98 01     lds     r28, 0x0198
    1f2c:       d0 91 99 01     lds     r29, 0x0199
    1f30:       7e 01           movw    r14, r28
    1f32:       00 27           eor     r16, r16
    1f34:       f7 fc           sbrc    r15, 7
    1f36:       00 95           com     r16
    1f38:       10 2f           mov     r17, r16
    1f3a:       28 ee           ldi     r18, 0xE8       ; 232
    1f3c:       33 e0           ldi     r19, 0x03       ; 3
    1f3e:       40 e0           ldi     r20, 0x00       ; 0
    1f40:       50 e0           ldi     r21, 0x00       ; 0
    1f42:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    1f46:       2e 19           sub     r18, r14
    1f48:       3f 09           sbc     r19, r15
    1f4a:       40 0b           sbc     r20, r16
    1f4c:       51 0b           sbc     r21, r17
    1f4e:       2b 30           cpi     r18, 0x0B       ; 11
    1f50:       31 05           cpc     r19, r1
    1f52:       41 05           cpc     r20, r1
    1f54:       51 05           cpc     r21, r1
    1f56:       c4 f4           brge    .+48            ; 0x1f88 <osd_ncmode_default+0x170>
    1f58:       60 91 a3 01     lds     r22, 0x01A3
    1f5c:       70 91 a4 01     lds     r23, 0x01A4
    1f60:       80 91 a5 01     lds     r24, 0x01A5
    1f64:       90 91 a6 01     lds     r25, 0x01A6
    1f68:       28 ee           ldi     r18, 0xE8       ; 232
    1f6a:       33 e0           ldi     r19, 0x03       ; 3
    1f6c:       40 e0           ldi     r20, 0x00       ; 0
    1f6e:       50 e0           ldi     r21, 0x00       ; 0
    1f70:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    1f74:       2e 19           sub     r18, r14
    1f76:       3f 09           sbc     r19, r15
    1f78:       40 0b           sbc     r20, r16
    1f7a:       51 0b           sbc     r21, r17
    1f7c:       26 5f           subi    r18, 0xF6       ; 246
    1f7e:       3f 4f           sbci    r19, 0xFF       ; 255
    1f80:       4f 4f           sbci    r20, 0xFF       ; 255
    1f82:       5f 4f           sbci    r21, 0xFF       ; 255
    1f84:       0c f0           brlt    .+2             ; 0x1f88 <osd_ncmode_default+0x170>
    1f86:       83 c4           rjmp    .+2310          ; 0x288e <osd_ncmode_default+0xa76>
                                // above 10m only write full meters
                                write_ndigit_number_s(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset), 4, 0); // GPS
    1f88:       60 91 a3 01     lds     r22, 0x01A3
    1f8c:       70 91 a4 01     lds     r23, 0x01A4
    1f90:       80 91 a5 01     lds     r24, 0x01A5
    1f94:       90 91 a6 01     lds     r25, 0x01A6
    1f98:       28 ee           ldi     r18, 0xE8       ; 232
    1f9a:       33 e0           ldi     r19, 0x03       ; 3
    1f9c:       40 e0           ldi     r20, 0x00       ; 0
    1f9e:       50 e0           ldi     r21, 0x00       ; 0
    1fa0:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    1fa4:       2c 1b           sub     r18, r28
    1fa6:       3d 0b           sbc     r19, r29
    1fa8:       87 e1           ldi     r24, 0x17       ; 23
    1faa:       60 91 02 01     lds     r22, 0x0102
    1fae:       a9 01           movw    r20, r18
    1fb0:       24 e0           ldi     r18, 0x04       ; 4
    1fb2:       30 e0           ldi     r19, 0x00       ; 0
    1fb4:       00 e0           ldi     r16, 0x00       ; 0
    1fb6:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
    1fba:       20 c0           rjmp    .+64            ; 0x1ffc <osd_ncmode_default+0x1e4>
                                // up to 10m write meters.dm
                            write_ndigit_number_s_10th(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 100 - altimeter_offset * 10), 3, 0); // GPS
                        }
                } else {
                        //note:lephisto:according to several sources it's /30
                        if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
    1fbc:       80 91 cd 01     lds     r24, 0x01CD
    1fc0:       90 91 ce 01     lds     r25, 0x01CE
    1fc4:       8d 52           subi    r24, 0x2D       ; 45
    1fc6:       91 40           sbci    r25, 0x01       ; 1
    1fc8:       44 f4           brge    .+16            ; 0x1fda <osd_ncmode_default+0x1c2>
    1fca:       80 91 cd 01     lds     r24, 0x01CD
    1fce:       90 91 ce 01     lds     r25, 0x01CE
    1fd2:       84 5d           subi    r24, 0xD4       ; 212
    1fd4:       9e 4f           sbci    r25, 0xFE       ; 254
    1fd6:       0c f0           brlt    .+2             ; 0x1fda <osd_ncmode_default+0x1c2>
    1fd8:       82 c4           rjmp    .+2308          ; 0x28de <osd_ncmode_default+0xac6>
                                // above 10m only write full meters
                                write_ndigit_number_s(23, top_line, naviData.Altimeter / 30, 4, 0); // BARO
    1fda:       80 91 cd 01     lds     r24, 0x01CD
    1fde:       90 91 ce 01     lds     r25, 0x01CE
    1fe2:       6e e1           ldi     r22, 0x1E       ; 30
    1fe4:       70 e0           ldi     r23, 0x00       ; 0
    1fe6:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    1fea:       ab 01           movw    r20, r22
    1fec:       87 e1           ldi     r24, 0x17       ; 23
    1fee:       60 91 02 01     lds     r22, 0x0102
    1ff2:       24 e0           ldi     r18, 0x04       ; 4
    1ff4:       30 e0           ldi     r19, 0x00       ; 0
    1ff6:       00 e0           ldi     r16, 0x00       ; 0
    1ff8:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                        }
                }


                // seccond line
                draw_compass(11, top_line + 1, naviData.CompassHeading);
    1ffc:       40 91 d8 01     lds     r20, 0x01D8
    2000:       50 91 d9 01     lds     r21, 0x01D9
    2004:       60 91 02 01     lds     r22, 0x0102
    2008:       6f 5f           subi    r22, 0xFF       ; 255
    200a:       8b e0           ldi     r24, 0x0B       ; 11
    200c:       0e 94 55 0a     call    0x14aa  ; 0x14aa <draw_compass>

                // TODO: verify correctness
                uint16_t heading_home = (naviData.HomePositionDeviation.Bearing + 360 - naviData.CompassHeading) % 360;
    2010:       80 91 c8 01     lds     r24, 0x01C8
    2014:       90 91 c9 01     lds     r25, 0x01C9
    2018:       20 91 d8 01     lds     r18, 0x01D8
    201c:       30 91 d9 01     lds     r19, 0x01D9
                //write_char_xy(21, top_line + 1, arrowdir[heading_conv(heading_home)]);
                // finer resolution, 0xa0 is first character and we add the index 0 <= index < 16
                write_char_xy(21, top_line + 1, 0xa0 + heading_fine_conv(heading_home));
    2020:       10 91 02 01     lds     r17, 0x0102
    2024:       1f 5f           subi    r17, 0xFF       ; 255
    2026:       88 59           subi    r24, 0x98       ; 152
    2028:       9e 4f           sbci    r25, 0xFE       ; 254
    202a:       82 1b           sub     r24, r18
    202c:       93 0b           sbc     r25, r19
    202e:       68 e6           ldi     r22, 0x68       ; 104
    2030:       71 e0           ldi     r23, 0x01       ; 1
    2032:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2036:       0e 94 cf 08     call    0x119e  ; 0x119e <heading_fine_conv>
    203a:       48 2f           mov     r20, r24
    203c:       40 56           subi    r20, 0x60       ; 96
    203e:       85 e1           ldi     r24, 0x15       ; 21
    2040:       61 2f           mov     r22, r17
    2042:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

                write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 3, 0);
    2046:       80 91 c6 01     lds     r24, 0x01C6
    204a:       90 91 c7 01     lds     r25, 0x01C7
    204e:       20 91 02 01     lds     r18, 0x0102
    2052:       2f 5f           subi    r18, 0xFF       ; 255
    2054:       6a e0           ldi     r22, 0x0A       ; 10
    2056:       70 e0           ldi     r23, 0x00       ; 0
    2058:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    205c:       ab 01           movw    r20, r22
    205e:       88 e1           ldi     r24, 0x18       ; 24
    2060:       62 2f           mov     r22, r18
    2062:       23 e0           ldi     r18, 0x03       ; 3
    2064:       30 e0           ldi     r19, 0x00       ; 0
    2066:       00 e0           ldi     r16, 0x00       ; 0
    2068:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        
                // center
                if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running
    206c:       80 91 dd 01     lds     r24, 0x01DD
    2070:       80 ff           sbrs    r24, 0
    2072:       84 c2           rjmp    .+1288          ; 0x257c <osd_ncmode_default+0x764>
                    if (!(old_MKFlags & FLAG_MOTOR_RUN)) { // motors just started, clear middle
    2074:       80 91 27 01     lds     r24, 0x0127
    2078:       80 ff           sbrs    r24, 0
    207a:       91 c3           rjmp    .+1826          ; 0x279e <osd_ncmode_default+0x986>
    207c:       10 91 1b 01     lds     r17, 0x011B
    2080:       00 91 1d 01     lds     r16, 0x011D
                                        wasted_ampere_offset = naviData.UsedCapacity;
                                }
                        // update flags to paint display again if needed
                        COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
                    }
                    if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
    2084:       11 ff           sbrs    r17, 1
    2086:       18 c0           rjmp    .+48            ; 0x20b8 <osd_ncmode_default+0x2a0>
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    2088:       00 ff           sbrs    r16, 0
    208a:       f7 c3           rjmp    .+2030          ; 0x287a <osd_ncmode_default+0xa62>
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
    208c:       40 91 da 01     lds     r20, 0x01DA
    2090:       20 91 db 01     lds     r18, 0x01DB
    2094:       80 91 02 01     lds     r24, 0x0102
    2098:       60 91 03 01     lds     r22, 0x0103
    209c:       62 50           subi    r22, 0x02       ; 2
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    209e:       55 27           eor     r21, r21
    20a0:       47 fd           sbrc    r20, 7
    20a2:       50 95           com     r21
    20a4:       33 27           eor     r19, r19
    20a6:       27 fd           sbrc    r18, 7
    20a8:       30 95           com     r19
    20aa:       8e 5f           subi    r24, 0xFE       ; 254
    20ac:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
    20b0:       10 91 1b 01     lds     r17, 0x011B
    20b4:       00 91 1d 01     lds     r16, 0x011D
                                }
                    }
                    // motors are on, assume we were/are flying
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
    20b8:       04 60           ori     r16, 0x04       ; 4
    20ba:       00 93 1d 01     sts     0x011D, r16
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
                                }
                    }
                }
                if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
    20be:       12 fd           sbrc    r17, 2
    20c0:       7f c2           rjmp    .+1278          ; 0x25c0 <osd_ncmode_default+0x7a8>
                    draw_big_variometer(27, 8, naviData.Variometer);
                }

                // pre-bottom line
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    20c2:       80 91 1d 01     lds     r24, 0x011D
    20c6:       80 ff           sbrs    r24, 0
    20c8:       56 c2           rjmp    .+1196          ; 0x2576 <osd_ncmode_default+0x75e>
    20ca:       16 ff           sbrs    r17, 6
    20cc:       9a c3           rjmp    .+1844          ; 0x2802 <osd_ncmode_default+0x9ea>
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
                        if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
                        }       
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
                        write_ndigit_number_u_10th(3, bottom_line - 1, naviData.Current, 3, 0);
    20ce:       40 91 e8 01     lds     r20, 0x01E8
    20d2:       50 91 e9 01     lds     r21, 0x01E9
    20d6:       60 91 03 01     lds     r22, 0x0103
    20da:       61 50           subi    r22, 0x01       ; 1
    20dc:       83 e0           ldi     r24, 0x03       ; 3
    20de:       23 e0           ldi     r18, 0x03       ; 3
    20e0:       30 e0           ldi     r19, 0x00       ; 0
    20e2:       00 e0           ldi     r16, 0x00       ; 0
    20e4:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_ndigit_number_u(10, bottom_line - 1, naviData.UsedCapacity, 4, 0);
    20e8:       40 91 ea 01     lds     r20, 0x01EA
    20ec:       50 91 eb 01     lds     r21, 0x01EB
    20f0:       60 91 03 01     lds     r22, 0x0103
    20f4:       61 50           subi    r22, 0x01       ; 1
    20f6:       8a e0           ldi     r24, 0x0A       ; 10
    20f8:       24 e0           ldi     r18, 0x04       ; 4
    20fa:       30 e0           ldi     r19, 0x00       ; 0
    20fc:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                }

                //DEBUGwrite_ndigit_number_u(1, 5, COSD_FLAGS_MODES, 3, 0);

                // bottom line
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
    2100:       20 91 d3 01     lds     r18, 0x01D3
    2104:       82 e0           ldi     r24, 0x02       ; 2
    2106:       60 91 03 01     lds     r22, 0x0103
    210a:       40 91 19 01     lds     r20, 0x0119
    210e:       00 91 1a 01     lds     r16, 0x011A
    2112:       0e 94 17 0a     call    0x142e  ; 0x142e <draw_battery>
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 3, 0);
    2116:       40 91 d3 01     lds     r20, 0x01D3
    211a:       83 e0           ldi     r24, 0x03       ; 3
    211c:       60 91 03 01     lds     r22, 0x0103
    2120:       50 e0           ldi     r21, 0x00       ; 0
    2122:       23 e0           ldi     r18, 0x03       ; 3
    2124:       30 e0           ldi     r19, 0x00       ; 0
    2126:       00 e0           ldi     r16, 0x00       ; 0
    2128:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
    212c:       80 91 d3 01     lds     r24, 0x01D3
    2130:       90 91 19 01     lds     r25, 0x0119
    2134:       98 17           cp      r25, r24
    2136:       08 f4           brcc    .+2             ; 0x213a <osd_ncmode_default+0x322>
    2138:       ef c1           rjmp    .+990           ; 0x2518 <osd_ncmode_default+0x700>
    213a:       80 91 00 01     lds     r24, 0x0100
    213e:       98 17           cp      r25, r24
    2140:       08 f0           brcs    .+2             ; 0x2144 <osd_ncmode_default+0x32c>
    2142:       ea c1           rjmp    .+980           ; 0x2518 <osd_ncmode_default+0x700>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
    2144:       82 e0           ldi     r24, 0x02       ; 2
    2146:       60 91 03 01     lds     r22, 0x0103
    214a:       4f e4           ldi     r20, 0x4F       ; 79
    214c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2150:       83 e0           ldi     r24, 0x03       ; 3
    2152:       60 91 03 01     lds     r22, 0x0103
    2156:       4f e4           ldi     r20, 0x4F       ; 79
    2158:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    215c:       84 e0           ldi     r24, 0x04       ; 4
    215e:       60 91 03 01     lds     r22, 0x0103
    2162:       4f e4           ldi     r20, 0x4F       ; 79
    2164:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2168:       85 e0           ldi     r24, 0x05       ; 5
    216a:       60 91 03 01     lds     r22, 0x0103
    216e:       4f e4           ldi     r20, 0x4F       ; 79
    2170:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2174:       86 e0           ldi     r24, 0x06       ; 6
    2176:       60 91 03 01     lds     r22, 0x0103
    217a:       4f e4           ldi     r20, 0x4F       ; 79
    217c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2180:       87 e0           ldi     r24, 0x07       ; 7
    2182:       60 91 03 01     lds     r22, 0x0103
    2186:       4f e4           ldi     r20, 0x4F       ; 79
    2188:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
                } else if (naviData.UBat > min_voltage && last_UBat < min_voltage) {
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, 0);
                }

                write_time(8, bottom_line, uptime);
    218c:       40 91 12 01     lds     r20, 0x0112
    2190:       50 91 13 01     lds     r21, 0x0113
    2194:       88 e0           ldi     r24, 0x08       ; 8
    2196:       60 91 03 01     lds     r22, 0x0103
    219a:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>
                write_time(15, bottom_line, naviData.FlyingTime);
    219e:       40 91 d1 01     lds     r20, 0x01D1
    21a2:       50 91 d2 01     lds     r21, 0x01D2
    21a6:       8f e0           ldi     r24, 0x0F       ; 15
    21a8:       60 91 03 01     lds     r22, 0x0103
    21ac:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>

                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 2, 0);
    21b0:       40 91 cc 01     lds     r20, 0x01CC
    21b4:       88 e1           ldi     r24, 0x18       ; 24
    21b6:       60 91 03 01     lds     r22, 0x0103
    21ba:       50 e0           ldi     r21, 0x00       ; 0
    21bc:       22 e0           ldi     r18, 0x02       ; 2
    21be:       30 e0           ldi     r19, 0x00       ; 0
    21c0:       00 e0           ldi     r16, 0x00       ; 0
    21c2:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                if (naviData.NCFlags & NC_FLAG_MANUAL_CONTROL) {
    21c6:       80 91 de 01     lds     r24, 0x01DE
    21ca:       86 ff           sbrs    r24, 6
    21cc:       04 c2           rjmp    .+1032          ; 0x25d6 <osd_ncmode_default+0x7be>
                    write_char_xy(23, bottom_line, 0xB3); // rc transmitter
    21ce:       87 e1           ldi     r24, 0x17       ; 23
    21d0:       60 91 03 01     lds     r22, 0x0103
    21d4:       43 eb           ldi     r20, 0xB3       ; 179
    21d6:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                } else {
                    write_char_xy(23, bottom_line, 0); // clear
                }

                if (naviData.NCFlags & NC_FLAG_CH) {
    21da:       80 91 de 01     lds     r24, 0x01DE
    21de:       82 fd           sbrc    r24, 2
    21e0:       04 c2           rjmp    .+1032          ; 0x25ea <osd_ncmode_default+0x7d2>
                    write_char_xy(27, bottom_line, 231); // gps ch
                } else if (naviData.NCFlags & NC_FLAG_PH) {
    21e2:       80 91 de 01     lds     r24, 0x01DE
    21e6:       81 ff           sbrs    r24, 1
    21e8:       07 c2           rjmp    .+1038          ; 0x25f8 <osd_ncmode_default+0x7e0>
                    write_char_xy(27, bottom_line, 230); // gps ph
    21ea:       8b e1           ldi     r24, 0x1B       ; 27
    21ec:       60 91 03 01     lds     r22, 0x0103
    21f0:       46 ee           ldi     r20, 0xE6       ; 230
    21f2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

        //write_number_s(8, 5, RxDataLen);
        //write_number_s(16, 5, setsReceived++);

        // remember statistics (only when engines running)
        if (naviData.FCFlags & FLAG_MOTOR_RUN) {
    21f6:       80 91 dd 01     lds     r24, 0x01DD
    21fa:       80 ff           sbrs    r24, 0
    21fc:       86 c0           rjmp    .+268           ; 0x230a <osd_ncmode_default+0x4f2>
                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
    21fe:       80 91 1c 01     lds     r24, 0x011C
    2202:       81 ff           sbrs    r24, 1
    2204:       99 c0           rjmp    .+306           ; 0x2338 <osd_ncmode_default+0x520>
                        if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > max_Altimeter) max_Altimeter = naviData.CurrentPosition.Altitude / 1000;
    2206:       60 91 a3 01     lds     r22, 0x01A3
    220a:       70 91 a4 01     lds     r23, 0x01A4
    220e:       80 91 a5 01     lds     r24, 0x01A5
    2212:       90 91 a6 01     lds     r25, 0x01A6
    2216:       28 ee           ldi     r18, 0xE8       ; 232
    2218:       33 e0           ldi     r19, 0x03       ; 3
    221a:       40 e0           ldi     r20, 0x00       ; 0
    221c:       50 e0           ldi     r21, 0x00       ; 0
    221e:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    2222:       80 91 98 01     lds     r24, 0x0198
    2226:       90 91 99 01     lds     r25, 0x0199
    222a:       aa 27           eor     r26, r26
    222c:       97 fd           sbrc    r25, 7
    222e:       a0 95           com     r26
    2230:       ba 2f           mov     r27, r26
    2232:       28 1b           sub     r18, r24
    2234:       39 0b           sbc     r19, r25
    2236:       4a 0b           sbc     r20, r26
    2238:       5b 0b           sbc     r21, r27
    223a:       80 91 1f 01     lds     r24, 0x011F
    223e:       90 91 20 01     lds     r25, 0x0120
    2242:       aa 27           eor     r26, r26
    2244:       97 fd           sbrc    r25, 7
    2246:       a0 95           com     r26
    2248:       ba 2f           mov     r27, r26
    224a:       82 17           cp      r24, r18
    224c:       93 07           cpc     r25, r19
    224e:       a4 07           cpc     r26, r20
    2250:       b5 07           cpc     r27, r21
    2252:       0c f4           brge    .+2             ; 0x2256 <osd_ncmode_default+0x43e>
    2254:       4e c1           rjmp    .+668           ; 0x24f2 <osd_ncmode_default+0x6da>
                } else {
                if (naviData.Altimeter / 30 > max_Altimeter) max_Altimeter = naviData.Altimeter / 30;
                }
            if (naviData.GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData.GroundSpeed;
    2256:       20 91 d4 01     lds     r18, 0x01D4
    225a:       30 91 d5 01     lds     r19, 0x01D5
    225e:       80 91 21 01     lds     r24, 0x0121
    2262:       90 91 22 01     lds     r25, 0x0122
    2266:       82 17           cp      r24, r18
    2268:       93 07           cpc     r25, r19
    226a:       40 f4           brcc    .+16            ; 0x227c <osd_ncmode_default+0x464>
    226c:       80 91 d4 01     lds     r24, 0x01D4
    2270:       90 91 d5 01     lds     r25, 0x01D5
    2274:       90 93 22 01     sts     0x0122, r25
    2278:       80 93 21 01     sts     0x0121, r24
            if (naviData.HomePositionDeviation.Distance > max_Distance) {
    227c:       20 91 c6 01     lds     r18, 0x01C6
    2280:       30 91 c7 01     lds     r19, 0x01C7
    2284:       80 91 23 01     lds     r24, 0x0123
    2288:       90 91 24 01     lds     r25, 0x0124
    228c:       82 17           cp      r24, r18
    228e:       93 07           cpc     r25, r19
    2290:       40 f4           brcc    .+16            ; 0x22a2 <osd_ncmode_default+0x48a>
                max_Distance = naviData.HomePositionDeviation.Distance;
    2292:       80 91 c6 01     lds     r24, 0x01C6
    2296:       90 91 c7 01     lds     r25, 0x01C7
    229a:       90 93 24 01     sts     0x0124, r25
    229e:       80 93 23 01     sts     0x0123, r24
            }
            if (naviData.UBat < min_UBat) min_UBat = naviData.UBat;
    22a2:       90 91 d3 01     lds     r25, 0x01D3
    22a6:       80 91 04 01     lds     r24, 0x0104
    22aa:       98 17           cp      r25, r24
    22ac:       20 f4           brcc    .+8             ; 0x22b6 <osd_ncmode_default+0x49e>
    22ae:       80 91 d3 01     lds     r24, 0x01D3
    22b2:       80 93 04 01     sts     0x0104, r24
            if (naviData.FlyingTime > max_FlyingTime) max_FlyingTime = naviData.FlyingTime;
    22b6:       20 91 d1 01     lds     r18, 0x01D1
    22ba:       30 91 d2 01     lds     r19, 0x01D2
    22be:       80 91 25 01     lds     r24, 0x0125
    22c2:       90 91 26 01     lds     r25, 0x0126
    22c6:       82 17           cp      r24, r18
    22c8:       93 07           cpc     r25, r19
    22ca:       40 f4           brcc    .+16            ; 0x22dc <osd_ncmode_default+0x4c4>
    22cc:       80 91 d1 01     lds     r24, 0x01D1
    22d0:       90 91 d2 01     lds     r25, 0x01D2
    22d4:       90 93 26 01     sts     0x0126, r25
    22d8:       80 93 25 01     sts     0x0125, r24
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    22dc:       80 91 1d 01     lds     r24, 0x011D
    22e0:       80 ff           sbrs    r24, 0
    22e2:       61 c0           rjmp    .+194           ; 0x23a6 <osd_ncmode_default+0x58e>
    22e4:       80 91 1b 01     lds     r24, 0x011B
    22e8:       86 fd           sbrc    r24, 6
    22ea:       61 c0           rjmp    .+194           ; 0x23ae <osd_ncmode_default+0x596>
                        if (ampere > max_ampere) max_ampere = ampere;
    22ec:       20 91 37 01     lds     r18, 0x0137
    22f0:       30 91 38 01     lds     r19, 0x0138
    22f4:       80 91 39 01     lds     r24, 0x0139
    22f8:       90 91 3a 01     lds     r25, 0x013A
    22fc:       82 17           cp      r24, r18
    22fe:       93 07           cpc     r25, r19
    2300:       24 f4           brge    .+8             ; 0x230a <osd_ncmode_default+0x4f2>
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
                        if (naviData.Current * 10 > max_ampere) max_ampere = naviData.Current * 10;
    2302:       30 93 3a 01     sts     0x013A, r19
    2306:       20 93 39 01     sts     0x0139, r18
                }
        }

        // remember last values
        last_RC_Quality = naviData.RC_Quality;
    230a:       80 91 dc 01     lds     r24, 0x01DC
    230e:       80 93 01 01     sts     0x0101, r24
        last_UBat = naviData.UBat;
    2312:       80 91 d3 01     lds     r24, 0x01D3
    2316:       80 93 00 01     sts     0x0100, r24
        old_MKFlags = naviData.FCFlags;
    231a:       80 91 dd 01     lds     r24, 0x01DD
    231e:       80 93 27 01     sts     0x0127, r24
        seconds_since_last_data = 0;
    2322:       10 92 18 01     sts     0x0118, r1

        return 0;
}
    2326:       80 e0           ldi     r24, 0x00       ; 0
    2328:       90 e0           ldi     r25, 0x00       ; 0
    232a:       df 91           pop     r29
    232c:       cf 91           pop     r28
    232e:       1f 91           pop     r17
    2330:       0f 91           pop     r16
    2332:       ff 90           pop     r15
    2334:       ef 90           pop     r14
    2336:       08 95           ret
        // remember statistics (only when engines running)
        if (naviData.FCFlags & FLAG_MOTOR_RUN) {
                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
                        if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > max_Altimeter) max_Altimeter = naviData.CurrentPosition.Altitude / 1000;
                } else {
                if (naviData.Altimeter / 30 > max_Altimeter) max_Altimeter = naviData.Altimeter / 30;
    2338:       80 91 cd 01     lds     r24, 0x01CD
    233c:       90 91 ce 01     lds     r25, 0x01CE
    2340:       6e e1           ldi     r22, 0x1E       ; 30
    2342:       70 e0           ldi     r23, 0x00       ; 0
    2344:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2348:       80 91 1f 01     lds     r24, 0x011F
    234c:       90 91 20 01     lds     r25, 0x0120
    2350:       86 17           cp      r24, r22
    2352:       97 07           cpc     r25, r23
    2354:       0c f0           brlt    .+2             ; 0x2358 <osd_ncmode_default+0x540>
    2356:       7f cf           rjmp    .-258           ; 0x2256 <osd_ncmode_default+0x43e>
    2358:       80 91 cd 01     lds     r24, 0x01CD
    235c:       90 91 ce 01     lds     r25, 0x01CE
    2360:       6e e1           ldi     r22, 0x1E       ; 30
    2362:       70 e0           ldi     r23, 0x00       ; 0
    2364:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2368:       70 93 20 01     sts     0x0120, r23
    236c:       60 93 1f 01     sts     0x011F, r22
    2370:       72 cf           rjmp    .-284           ; 0x2256 <osd_ncmode_default+0x43e>

                // first line
                write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);

                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    2372:       80 91 01 01     lds     r24, 0x0101
    2376:       85 36           cpi     r24, 0x65       ; 101
    2378:       08 f4           brcc    .+2             ; 0x237c <osd_ncmode_default+0x564>
    237a:       92 cd           rjmp    .-1244          ; 0x1ea0 <osd_ncmode_default+0x88>
    237c:       17 e0           ldi     r17, 0x07       ; 7
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
    237e:       81 2f           mov     r24, r17
    2380:       60 91 02 01     lds     r22, 0x0102
    2384:       4f e4           ldi     r20, 0x4F       ; 79
    2386:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    238a:       1f 5f           subi    r17, 0xFF       ; 255
                // first line
                write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);

                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
    238c:       1b 30           cpi     r17, 0x0B       ; 11
    238e:       b9 f7           brne    .-18            ; 0x237e <osd_ncmode_default+0x566>
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, 0);
                }
        

                if (naviData.NCFlags & NC_FLAG_NOSERIALLINK) {
    2390:       80 91 de 01     lds     r24, 0x01DE
    2394:       84 fd           sbrc    r24, 4
    2396:       8d cd           rjmp    .-1254          ; 0x1eb2 <osd_ncmode_default+0x9a>
                    write_char_xy(11, top_line, 0); // clear
                } else {
                    write_char_xy(11, top_line, 0xC6); // PC icon
    2398:       8b e0           ldi     r24, 0x0B       ; 11
    239a:       60 91 02 01     lds     r22, 0x0102
    239e:       46 ec           ldi     r20, 0xC6       ; 198
    23a0:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    23a4:       8c cd           rjmp    .-1256          ; 0x1ebe <osd_ncmode_default+0xa6>
            }
            if (naviData.UBat < min_UBat) min_UBat = naviData.UBat;
            if (naviData.FlyingTime > max_FlyingTime) max_FlyingTime = naviData.FlyingTime;
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                        if (ampere > max_ampere) max_ampere = ampere;
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
    23a6:       80 91 1b 01     lds     r24, 0x011B
    23aa:       86 ff           sbrs    r24, 6
    23ac:       ae cf           rjmp    .-164           ; 0x230a <osd_ncmode_default+0x4f2>
                        if (naviData.Current * 10 > max_ampere) max_ampere = naviData.Current * 10;
    23ae:       80 91 e8 01     lds     r24, 0x01E8
    23b2:       90 91 e9 01     lds     r25, 0x01E9
    23b6:       9c 01           movw    r18, r24
    23b8:       22 0f           add     r18, r18
    23ba:       33 1f           adc     r19, r19
    23bc:       22 0f           add     r18, r18
    23be:       33 1f           adc     r19, r19
    23c0:       22 0f           add     r18, r18
    23c2:       33 1f           adc     r19, r19
    23c4:       88 0f           add     r24, r24
    23c6:       99 1f           adc     r25, r25
    23c8:       28 0f           add     r18, r24
    23ca:       39 1f           adc     r19, r25
    23cc:       80 91 39 01     lds     r24, 0x0139
    23d0:       90 91 3a 01     lds     r25, 0x013A
    23d4:       82 17           cp      r24, r18
    23d6:       93 07           cpc     r25, r19
    23d8:       08 f0           brcs    .+2             ; 0x23dc <osd_ncmode_default+0x5c4>
    23da:       97 cf           rjmp    .-210           ; 0x230a <osd_ncmode_default+0x4f2>
    23dc:       80 91 e8 01     lds     r24, 0x01E8
    23e0:       90 91 e9 01     lds     r25, 0x01E9
    23e4:       9c 01           movw    r18, r24
    23e6:       22 0f           add     r18, r18
    23e8:       33 1f           adc     r19, r19
    23ea:       22 0f           add     r18, r18
    23ec:       33 1f           adc     r19, r19
    23ee:       22 0f           add     r18, r18
    23f0:       33 1f           adc     r19, r19
    23f2:       88 0f           add     r24, r24
    23f4:       99 1f           adc     r25, r25
    23f6:       28 0f           add     r18, r24
    23f8:       39 1f           adc     r19, r25
    23fa:       83 cf           rjmp    .-250           ; 0x2302 <osd_ncmode_default+0x4ea>

                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (naviData.RC_Quality > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    23fc:       80 91 01 01     lds     r24, 0x0101
    2400:       85 36           cpi     r24, 0x65       ; 101
    2402:       08 f0           brcs    .+2             ; 0x2406 <osd_ncmode_default+0x5ee>
    2404:       52 cd           rjmp    .-1372          ; 0x1eaa <osd_ncmode_default+0x92>
    2406:       17 e0           ldi     r17, 0x07       ; 7
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, 0);
    2408:       81 2f           mov     r24, r17
    240a:       60 91 02 01     lds     r22, 0x0102
    240e:       40 e0           ldi     r20, 0x00       ; 0
    2410:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2414:       1f 5f           subi    r17, 0xFF       ; 255
                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (naviData.RC_Quality > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
    2416:       1b 30           cpi     r17, 0x0B       ; 11
    2418:       b9 f7           brne    .-18            ; 0x2408 <osd_ncmode_default+0x5f0>
    241a:       47 cd           rjmp    .-1394          ; 0x1eaa <osd_ncmode_default+0x92>

int osd_ncmode_default() {
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
                    write_char_xy(5, top_line, 0xCB); // km/h
    241c:       85 e0           ldi     r24, 0x05       ; 5
    241e:       60 91 02 01     lds     r22, 0x0102
    2422:       4b ec           ldi     r20, 0xCB       ; 203
    2424:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(10, top_line, 0xCA); // RC-transmitter
    2428:       8a e0           ldi     r24, 0x0A       ; 10
    242a:       60 91 02 01     lds     r22, 0x0102
    242e:       4a ec           ldi     r20, 0xCA       ; 202
    2430:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(16, top_line, 0xD0); // degree symbol
    2434:       80 e1           ldi     r24, 0x10       ; 16
    2436:       60 91 02 01     lds     r22, 0x0102
    243a:       40 ed           ldi     r20, 0xD0       ; 208
    243c:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(27, top_line, 0xCC); // small meters m height
    2440:       8b e1           ldi     r24, 0x1B       ; 27
    2442:       60 91 02 01     lds     r22, 0x0102
    2446:       4c ec           ldi     r20, 0xCC       ; 204
    2448:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(20, top_line + 1, 0xB0); // left circle
    244c:       60 91 02 01     lds     r22, 0x0102
    2450:       6f 5f           subi    r22, 0xFF       ; 255
    2452:       84 e1           ldi     r24, 0x14       ; 20
    2454:       40 eb           ldi     r20, 0xB0       ; 176
    2456:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(22, top_line + 1, 0xB2); // right circle
    245a:       60 91 02 01     lds     r22, 0x0102
    245e:       6f 5f           subi    r22, 0xFF       ; 255
    2460:       86 e1           ldi     r24, 0x16       ; 22
    2462:       42 eb           ldi     r20, 0xB2       ; 178
    2464:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(27, top_line + 1, 0xCC); // small meters m home
    2468:       60 91 02 01     lds     r22, 0x0102
    246c:       6f 5f           subi    r22, 0xFF       ; 255
    246e:       8b e1           ldi     r24, 0x1B       ; 27
    2470:       4c ec           ldi     r20, 0xCC       ; 204
    2472:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(7, bottom_line, 0x9E); // small V
    2476:       87 e0           ldi     r24, 0x07       ; 7
    2478:       60 91 03 01     lds     r22, 0x0103
    247c:       4e e9           ldi     r20, 0x9E       ; 158
    247e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    2482:       80 91 1d 01     lds     r24, 0x011D
    2486:       80 fd           sbrc    r24, 0
    2488:       04 c0           rjmp    .+8             ; 0x2492 <osd_ncmode_default+0x67a>
    248a:       80 91 1b 01     lds     r24, 0x011B
    248e:       86 ff           sbrs    r24, 6
    2490:       12 c0           rjmp    .+36            ; 0x24b6 <osd_ncmode_default+0x69e>
                                write_char_xy(7, bottom_line - 1, 0x9F); // small A
    2492:       60 91 03 01     lds     r22, 0x0103
    2496:       61 50           subi    r22, 0x01       ; 1
    2498:       87 e0           ldi     r24, 0x07       ; 7
    249a:       4f e9           ldi     r20, 0x9F       ; 159
    249c:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                write_char_xy(14, bottom_line - 1, 0xB5); // mah
    24a0:       60 91 03 01     lds     r22, 0x0103
    24a4:       61 50           subi    r22, 0x01       ; 1
    24a6:       8e e0           ldi     r24, 0x0E       ; 14
    24a8:       45 eb           ldi     r20, 0xB5       ; 181
    24aa:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    24ae:       80 91 1b 01     lds     r24, 0x011B
    24b2:       85 fd           sbrc    r24, 5
    24b4:       33 c2           rjmp    .+1126          ; 0x291c <osd_ncmode_default+0xb04>
                                        write_char_xy(21, bottom_line - 1, 0x9E); // small V
                                }
                        }
                    write_char_xy(14, bottom_line, 0xD1); // on clock
    24b6:       8e e0           ldi     r24, 0x0E       ; 14
    24b8:       60 91 03 01     lds     r22, 0x0103
    24bc:       41 ed           ldi     r20, 0xD1       ; 209
    24be:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(21, bottom_line, 0xD2); // fly clock
    24c2:       85 e1           ldi     r24, 0x15       ; 21
    24c4:       60 91 03 01     lds     r22, 0x0103
    24c8:       42 ed           ldi     r20, 0xD2       ; 210
    24ca:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(26, bottom_line, 0xC8); // sat1
    24ce:       8a e1           ldi     r24, 0x1A       ; 26
    24d0:       60 91 03 01     lds     r22, 0x0103
    24d4:       48 ec           ldi     r20, 0xC8       ; 200
    24d6:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(27, bottom_line, 0xC9); // sat2
    24da:       8b e1           ldi     r24, 0x1B       ; 27
    24dc:       60 91 03 01     lds     r22, 0x0103
    24e0:       49 ec           ldi     r20, 0xC9       ; 201
    24e2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
    24e6:       80 91 1d 01     lds     r24, 0x011D
    24ea:       82 60           ori     r24, 0x02       ; 2
    24ec:       80 93 1d 01     sts     0x011D, r24
    24f0:       a1 cc           rjmp    .-1726          ; 0x1e34 <osd_ncmode_default+0x1c>
        //write_number_s(16, 5, setsReceived++);

        // remember statistics (only when engines running)
        if (naviData.FCFlags & FLAG_MOTOR_RUN) {
                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
                        if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > max_Altimeter) max_Altimeter = naviData.CurrentPosition.Altitude / 1000;
    24f2:       60 91 a3 01     lds     r22, 0x01A3
    24f6:       70 91 a4 01     lds     r23, 0x01A4
    24fa:       80 91 a5 01     lds     r24, 0x01A5
    24fe:       90 91 a6 01     lds     r25, 0x01A6
    2502:       28 ee           ldi     r18, 0xE8       ; 232
    2504:       33 e0           ldi     r19, 0x03       ; 3
    2506:       40 e0           ldi     r20, 0x00       ; 0
    2508:       50 e0           ldi     r21, 0x00       ; 0
    250a:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    250e:       30 93 20 01     sts     0x0120, r19
    2512:       20 93 1f 01     sts     0x011F, r18
    2516:       9f ce           rjmp    .-706           ; 0x2256 <osd_ncmode_default+0x43e>
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 3, 0);
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
                } else if (naviData.UBat > min_voltage && last_UBat < min_voltage) {
    2518:       80 91 d3 01     lds     r24, 0x01D3
    251c:       98 17           cp      r25, r24
    251e:       08 f0           brcs    .+2             ; 0x2522 <osd_ncmode_default+0x70a>
    2520:       35 ce           rjmp    .-918           ; 0x218c <osd_ncmode_default+0x374>
    2522:       80 91 00 01     lds     r24, 0x0100
    2526:       89 17           cp      r24, r25
    2528:       08 f0           brcs    .+2             ; 0x252c <osd_ncmode_default+0x714>
    252a:       30 ce           rjmp    .-928           ; 0x218c <osd_ncmode_default+0x374>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, 0);
    252c:       82 e0           ldi     r24, 0x02       ; 2
    252e:       60 91 03 01     lds     r22, 0x0103
    2532:       40 e0           ldi     r20, 0x00       ; 0
    2534:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2538:       83 e0           ldi     r24, 0x03       ; 3
    253a:       60 91 03 01     lds     r22, 0x0103
    253e:       40 e0           ldi     r20, 0x00       ; 0
    2540:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2544:       84 e0           ldi     r24, 0x04       ; 4
    2546:       60 91 03 01     lds     r22, 0x0103
    254a:       40 e0           ldi     r20, 0x00       ; 0
    254c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2550:       85 e0           ldi     r24, 0x05       ; 5
    2552:       60 91 03 01     lds     r22, 0x0103
    2556:       40 e0           ldi     r20, 0x00       ; 0
    2558:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    255c:       86 e0           ldi     r24, 0x06       ; 6
    255e:       60 91 03 01     lds     r22, 0x0103
    2562:       40 e0           ldi     r20, 0x00       ; 0
    2564:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2568:       87 e0           ldi     r24, 0x07       ; 7
    256a:       60 91 03 01     lds     r22, 0x0103
    256e:       40 e0           ldi     r20, 0x00       ; 0
    2570:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2574:       0b ce           rjmp    .-1002          ; 0x218c <osd_ncmode_default+0x374>
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
                        if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
                        }       
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
    2576:       16 ff           sbrs    r17, 6
    2578:       c3 cd           rjmp    .-1146          ; 0x2100 <osd_ncmode_default+0x2e8>
    257a:       a9 cd           rjmp    .-1198          ; 0x20ce <osd_ncmode_default+0x2b6>
                    }
                    // motors are on, assume we were/are flying
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
                } else {
                    // stats
                    if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
    257c:       80 91 1d 01     lds     r24, 0x011D
    2580:       82 fd           sbrc    r24, 2
    2582:       41 c0           rjmp    .+130           ; 0x2606 <osd_ncmode_default+0x7ee>
    2584:       10 91 1b 01     lds     r17, 0x011B
                        write_char_xy(20, line, 210); // fly clock
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[5])))); // longitude
                        write_gps_pos(14, line, naviData.CurrentPosition.Longitude);
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[6])))); // latitude
                        write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
                    } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
    2588:       11 ff           sbrs    r17, 1
    258a:       99 cd           rjmp    .-1230          ; 0x20be <osd_ncmode_default+0x2a6>
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    258c:       80 fd           sbrc    r24, 0
    258e:       02 c0           rjmp    .+4             ; 0x2594 <osd_ncmode_default+0x77c>
    2590:       16 ff           sbrs    r17, 6
    2592:       0c c2           rjmp    .+1048          ; 0x29ac <osd_ncmode_default+0xb94>
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
    2594:       40 91 da 01     lds     r20, 0x01DA
    2598:       20 91 db 01     lds     r18, 0x01DB
    259c:       80 91 02 01     lds     r24, 0x0102
    25a0:       60 91 03 01     lds     r22, 0x0103
    25a4:       62 50           subi    r22, 0x02       ; 2
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    25a6:       55 27           eor     r21, r21
    25a8:       47 fd           sbrc    r20, 7
    25aa:       50 95           com     r21
    25ac:       33 27           eor     r19, r19
    25ae:       27 fd           sbrc    r18, 7
    25b0:       30 95           com     r19
    25b2:       8e 5f           subi    r24, 0xFE       ; 254
    25b4:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
    25b8:       10 91 1b 01     lds     r17, 0x011B
                                }
                    }
                }
                if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
    25bc:       12 ff           sbrs    r17, 2
    25be:       81 cd           rjmp    .-1278          ; 0x20c2 <osd_ncmode_default+0x2aa>
                    draw_big_variometer(27, 8, naviData.Variometer);
    25c0:       40 91 cf 01     lds     r20, 0x01CF
    25c4:       50 91 d0 01     lds     r21, 0x01D0
    25c8:       8b e1           ldi     r24, 0x1B       ; 27
    25ca:       68 e0           ldi     r22, 0x08       ; 8
    25cc:       0e 94 84 0a     call    0x1508  ; 0x1508 <draw_big_variometer>
    25d0:       10 91 1b 01     lds     r17, 0x011B
    25d4:       76 cd           rjmp    .-1300          ; 0x20c2 <osd_ncmode_default+0x2aa>
                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 2, 0);

                if (naviData.NCFlags & NC_FLAG_MANUAL_CONTROL) {
                    write_char_xy(23, bottom_line, 0xB3); // rc transmitter
                } else {
                    write_char_xy(23, bottom_line, 0); // clear
    25d6:       87 e1           ldi     r24, 0x17       ; 23
    25d8:       60 91 03 01     lds     r22, 0x0103
    25dc:       40 e0           ldi     r20, 0x00       ; 0
    25de:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                }

                if (naviData.NCFlags & NC_FLAG_CH) {
    25e2:       80 91 de 01     lds     r24, 0x01DE
    25e6:       82 ff           sbrs    r24, 2
    25e8:       fc cd           rjmp    .-1032          ; 0x21e2 <osd_ncmode_default+0x3ca>
                    write_char_xy(27, bottom_line, 231); // gps ch
    25ea:       8b e1           ldi     r24, 0x1B       ; 27
    25ec:       60 91 03 01     lds     r22, 0x0103
    25f0:       47 ee           ldi     r20, 0xE7       ; 231
    25f2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    25f6:       ff cd           rjmp    .-1026          ; 0x21f6 <osd_ncmode_default+0x3de>
                } else if (naviData.NCFlags & NC_FLAG_PH) {
                    write_char_xy(27, bottom_line, 230); // gps ph
                } else { // (naviData.NCFlags & NC_FLAG_FREE)
                    write_char_xy(27, bottom_line, 201); // sat2 (free)
    25f8:       8b e1           ldi     r24, 0x1B       ; 27
    25fa:       60 91 03 01     lds     r22, 0x0103
    25fe:       49 ec           ldi     r20, 0xC9       ; 201
    2600:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    2604:       f8 cd           rjmp    .-1040          ; 0x21f6 <osd_ncmode_default+0x3de>
                    }
                    // motors are on, assume we were/are flying
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
                } else {
                    // stats
                    if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
    2606:       10 91 1b 01     lds     r17, 0x011B
    260a:       13 ff           sbrs    r17, 3
    260c:       bd cf           rjmp    .-134           ; 0x2588 <osd_ncmode_default+0x770>
                                uint8_t line = 3;
                        write_ascii_string_pgm(1, line, (const char *) (pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
    260e:       e0 ee           ldi     r30, 0xE0       ; 224
    2610:       f0 e0           ldi     r31, 0x00       ; 0
    2612:       45 91           lpm     r20, Z+
    2614:       54 91           lpm     r21, Z+
    2616:       81 e0           ldi     r24, 0x01       ; 1
    2618:       63 e0           ldi     r22, 0x03       ; 3
    261a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_s(16, line, max_Altimeter, 4, 0);
    261e:       40 91 1f 01     lds     r20, 0x011F
    2622:       50 91 20 01     lds     r21, 0x0120
    2626:       80 e1           ldi     r24, 0x10       ; 16
    2628:       63 e0           ldi     r22, 0x03       ; 3
    262a:       24 e0           ldi     r18, 0x04       ; 4
    262c:       30 e0           ldi     r19, 0x00       ; 0
    262e:       00 e0           ldi     r16, 0x00       ; 0
    2630:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                        write_char_xy(20, line, 204); // small meters m
    2634:       84 e1           ldi     r24, 0x14       ; 20
    2636:       63 e0           ldi     r22, 0x03       ; 3
    2638:       4c ec           ldi     r20, 0xCC       ; 204
    263a:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
    263e:       e2 ee           ldi     r30, 0xE2       ; 226
    2640:       f0 e0           ldi     r31, 0x00       ; 0
    2642:       45 91           lpm     r20, Z+
    2644:       54 91           lpm     r21, Z+
    2646:       81 e0           ldi     r24, 0x01       ; 1
    2648:       64 e0           ldi     r22, 0x04       ; 4
    264a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u(17, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
    264e:       20 91 21 01     lds     r18, 0x0121
    2652:       30 91 22 01     lds     r19, 0x0122
    2656:       40 e0           ldi     r20, 0x00       ; 0
    2658:       50 e0           ldi     r21, 0x00       ; 0
    265a:       ca 01           movw    r24, r20
    265c:       b9 01           movw    r22, r18
    265e:       66 0f           add     r22, r22
    2660:       77 1f           adc     r23, r23
    2662:       88 1f           adc     r24, r24
    2664:       99 1f           adc     r25, r25
    2666:       66 0f           add     r22, r22
    2668:       77 1f           adc     r23, r23
    266a:       88 1f           adc     r24, r24
    266c:       99 1f           adc     r25, r25
    266e:       66 0f           add     r22, r22
    2670:       77 1f           adc     r23, r23
    2672:       88 1f           adc     r24, r24
    2674:       99 1f           adc     r25, r25
    2676:       62 0f           add     r22, r18
    2678:       73 1f           adc     r23, r19
    267a:       84 1f           adc     r24, r20
    267c:       95 1f           adc     r25, r21
    267e:       2a ef           ldi     r18, 0xFA       ; 250
    2680:       30 e0           ldi     r19, 0x00       ; 0
    2682:       40 e0           ldi     r20, 0x00       ; 0
    2684:       50 e0           ldi     r21, 0x00       ; 0
    2686:       0e 94 8f 1c     call    0x391e  ; 0x391e <__udivmodsi4>
    268a:       81 e1           ldi     r24, 0x11       ; 17
    268c:       64 e0           ldi     r22, 0x04       ; 4
    268e:       a9 01           movw    r20, r18
    2690:       23 e0           ldi     r18, 0x03       ; 3
    2692:       30 e0           ldi     r19, 0x00       ; 0
    2694:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                        write_char_xy(20, line, 203); // km/h
    2698:       84 e1           ldi     r24, 0x14       ; 20
    269a:       64 e0           ldi     r22, 0x04       ; 4
    269c:       4b ec           ldi     r20, 0xCB       ; 203
    269e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
    26a2:       e4 ee           ldi     r30, 0xE4       ; 228
    26a4:       f0 e0           ldi     r31, 0x00       ; 0
    26a6:       45 91           lpm     r20, Z+
    26a8:       54 91           lpm     r21, Z+
    26aa:       81 e0           ldi     r24, 0x01       ; 1
    26ac:       65 e0           ldi     r22, 0x05       ; 5
    26ae:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u(17, line, max_Distance / 10, 3, 0);
    26b2:       80 91 23 01     lds     r24, 0x0123
    26b6:       90 91 24 01     lds     r25, 0x0124
    26ba:       6a e0           ldi     r22, 0x0A       ; 10
    26bc:       70 e0           ldi     r23, 0x00       ; 0
    26be:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    26c2:       ab 01           movw    r20, r22
    26c4:       81 e1           ldi     r24, 0x11       ; 17
    26c6:       65 e0           ldi     r22, 0x05       ; 5
    26c8:       23 e0           ldi     r18, 0x03       ; 3
    26ca:       30 e0           ldi     r19, 0x00       ; 0
    26cc:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                        write_char_xy(20, line, 204); // small meters m
    26d0:       84 e1           ldi     r24, 0x14       ; 20
    26d2:       65 e0           ldi     r22, 0x05       ; 5
    26d4:       4c ec           ldi     r20, 0xCC       ; 204
    26d6:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
    26da:       e6 ee           ldi     r30, 0xE6       ; 230
    26dc:       f0 e0           ldi     r31, 0x00       ; 0
    26de:       45 91           lpm     r20, Z+
    26e0:       54 91           lpm     r21, Z+
    26e2:       81 e0           ldi     r24, 0x01       ; 1
    26e4:       66 e0           ldi     r22, 0x06       ; 6
    26e6:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
    26ea:       40 91 04 01     lds     r20, 0x0104
    26ee:       80 e1           ldi     r24, 0x10       ; 16
    26f0:       66 e0           ldi     r22, 0x06       ; 6
    26f2:       50 e0           ldi     r21, 0x00       ; 0
    26f4:       23 e0           ldi     r18, 0x03       ; 3
    26f6:       30 e0           ldi     r19, 0x00       ; 0
    26f8:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_char_xy(20, line, 0x9E); // small V
    26fc:       84 e1           ldi     r24, 0x14       ; 20
    26fe:       66 e0           ldi     r22, 0x06       ; 6
    2700:       4e e9           ldi     r20, 0x9E       ; 158
    2702:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    2706:       80 91 1d 01     lds     r24, 0x011D
    270a:       80 fd           sbrc    r24, 0
    270c:       0f c1           rjmp    .+542           ; 0x292c <osd_ncmode_default+0xb14>
    270e:       80 91 1b 01     lds     r24, 0x011B
    2712:       86 fd           sbrc    r24, 6
    2714:       0b c1           rjmp    .+534           ; 0x292c <osd_ncmode_default+0xb14>
    2716:       17 e0           ldi     r17, 0x07       ; 7
    2718:       08 e0           ldi     r16, 0x08       ; 8
    271a:       f9 e0           ldi     r31, 0x09       ; 9
    271c:       ff 2e           mov     r15, r31
                                                write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0);
                                        }
                                        
                                        write_char_xy(26, line, 0xB5); // mah
                                }                               
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[4])))); // max time
    271e:       e8 ee           ldi     r30, 0xE8       ; 232
    2720:       f0 e0           ldi     r31, 0x00       ; 0
    2722:       45 91           lpm     r20, Z+
    2724:       54 91           lpm     r21, Z+
    2726:       81 e0           ldi     r24, 0x01       ; 1
    2728:       61 2f           mov     r22, r17
    272a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_time(14, line, max_FlyingTime);
    272e:       40 91 25 01     lds     r20, 0x0125
    2732:       50 91 26 01     lds     r21, 0x0126
    2736:       8e e0           ldi     r24, 0x0E       ; 14
    2738:       61 2f           mov     r22, r17
    273a:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>
                        write_char_xy(20, line, 210); // fly clock
    273e:       84 e1           ldi     r24, 0x14       ; 20
    2740:       61 2f           mov     r22, r17
    2742:       42 ed           ldi     r20, 0xD2       ; 210
    2744:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[5])))); // longitude
    2748:       ea ee           ldi     r30, 0xEA       ; 234
    274a:       f0 e0           ldi     r31, 0x00       ; 0
    274c:       45 91           lpm     r20, Z+
    274e:       54 91           lpm     r21, Z+
    2750:       81 e0           ldi     r24, 0x01       ; 1
    2752:       60 2f           mov     r22, r16
    2754:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_gps_pos(14, line, naviData.CurrentPosition.Longitude);
    2758:       20 91 9b 01     lds     r18, 0x019B
    275c:       30 91 9c 01     lds     r19, 0x019C
    2760:       40 91 9d 01     lds     r20, 0x019D
    2764:       50 91 9e 01     lds     r21, 0x019E
    2768:       8e e0           ldi     r24, 0x0E       ; 14
    276a:       60 2f           mov     r22, r16
    276c:       0e 94 bd 07     call    0xf7a   ; 0xf7a <write_gps_pos>
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[6])))); // latitude
    2770:       ec ee           ldi     r30, 0xEC       ; 236
    2772:       f0 e0           ldi     r31, 0x00       ; 0
    2774:       45 91           lpm     r20, Z+
    2776:       54 91           lpm     r21, Z+
    2778:       81 e0           ldi     r24, 0x01       ; 1
    277a:       6f 2d           mov     r22, r15
    277c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
    2780:       20 91 9f 01     lds     r18, 0x019F
    2784:       30 91 a0 01     lds     r19, 0x01A0
    2788:       40 91 a1 01     lds     r20, 0x01A1
    278c:       50 91 a2 01     lds     r21, 0x01A2
    2790:       8e e0           ldi     r24, 0x0E       ; 14
    2792:       6f 2d           mov     r22, r15
    2794:       0e 94 bd 07     call    0xf7a   ; 0xf7a <write_gps_pos>
    2798:       10 91 1b 01     lds     r17, 0x011B
    279c:       90 cc           rjmp    .-1760          ; 0x20be <osd_ncmode_default+0x2a6>
                write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 3, 0);
        
                // center
                if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running
                    if (!(old_MKFlags & FLAG_MOTOR_RUN)) { // motors just started, clear middle
                        clear();
    279e:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
                                // remember current heigth for gps offset
                                altimeter_offset = naviData.CurrentPosition.Altitude / 1000;
    27a2:       60 91 a3 01     lds     r22, 0x01A3
    27a6:       70 91 a4 01     lds     r23, 0x01A4
    27aa:       80 91 a5 01     lds     r24, 0x01A5
    27ae:       90 91 a6 01     lds     r25, 0x01A6
    27b2:       28 ee           ldi     r18, 0xE8       ; 232
    27b4:       33 e0           ldi     r19, 0x03       ; 3
    27b6:       40 e0           ldi     r20, 0x00       ; 0
    27b8:       50 e0           ldi     r21, 0x00       ; 0
    27ba:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    27be:       30 93 99 01     sts     0x0199, r19
    27c2:       20 93 98 01     sts     0x0198, r18
                                // set wasted counter to current offset
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
    27c6:       00 91 1d 01     lds     r16, 0x011D
    27ca:       00 ff           sbrs    r16, 0
    27cc:       9a c0           rjmp    .+308           ; 0x2902 <osd_ncmode_default+0xaea>
    27ce:       10 91 1b 01     lds     r17, 0x011B
    27d2:       16 fd           sbrc    r17, 6
    27d4:       9a c0           rjmp    .+308           ; 0x290a <osd_ncmode_default+0xaf2>
                                        wasted_ampere_offset = ampere_wasted / 10;
    27d6:       60 91 3b 01     lds     r22, 0x013B
    27da:       70 91 3c 01     lds     r23, 0x013C
    27de:       80 91 3d 01     lds     r24, 0x013D
    27e2:       90 91 3e 01     lds     r25, 0x013E
    27e6:       2a e0           ldi     r18, 0x0A       ; 10
    27e8:       30 e0           ldi     r19, 0x00       ; 0
    27ea:       40 e0           ldi     r20, 0x00       ; 0
    27ec:       50 e0           ldi     r21, 0x00       ; 0
    27ee:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    27f2:       30 93 48 01     sts     0x0148, r19
    27f6:       20 93 47 01     sts     0x0147, r18
                                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
                                        wasted_ampere_offset = naviData.UsedCapacity;
                                }
                        // update flags to paint display again if needed
                        COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
    27fa:       0d 7f           andi    r16, 0xFD       ; 253
    27fc:       00 93 1d 01     sts     0x011D, r16
    2800:       41 cc           rjmp    .-1918          ; 0x2084 <osd_ncmode_default+0x26c>
                }

                // pre-bottom line
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
    2802:       20 91 03 01     lds     r18, 0x0103
    2806:       21 50           subi    r18, 0x01       ; 1
    2808:       80 91 37 01     lds     r24, 0x0137
    280c:       90 91 38 01     lds     r25, 0x0138
    2810:       6a e0           ldi     r22, 0x0A       ; 10
    2812:       70 e0           ldi     r23, 0x00       ; 0
    2814:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2818:       ab 01           movw    r20, r22
    281a:       83 e0           ldi     r24, 0x03       ; 3
    281c:       62 2f           mov     r22, r18
    281e:       23 e0           ldi     r18, 0x03       ; 3
    2820:       30 e0           ldi     r19, 0x00       ; 0
    2822:       00 e0           ldi     r16, 0x00       ; 0
    2824:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
    2828:       10 91 03 01     lds     r17, 0x0103
    282c:       11 50           subi    r17, 0x01       ; 1
    282e:       60 91 3b 01     lds     r22, 0x013B
    2832:       70 91 3c 01     lds     r23, 0x013C
    2836:       80 91 3d 01     lds     r24, 0x013D
    283a:       90 91 3e 01     lds     r25, 0x013E
    283e:       2a e0           ldi     r18, 0x0A       ; 10
    2840:       30 e0           ldi     r19, 0x00       ; 0
    2842:       40 e0           ldi     r20, 0x00       ; 0
    2844:       50 e0           ldi     r21, 0x00       ; 0
    2846:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    284a:       8a e0           ldi     r24, 0x0A       ; 10
    284c:       61 2f           mov     r22, r17
    284e:       a9 01           movw    r20, r18
    2850:       24 e0           ldi     r18, 0x04       ; 4
    2852:       30 e0           ldi     r19, 0x00       ; 0
    2854:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                        if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    2858:       80 91 1b 01     lds     r24, 0x011B
    285c:       85 ff           sbrs    r24, 5
    285e:       50 cc           rjmp    .-1888          ; 0x2100 <osd_ncmode_default+0x2e8>
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
    2860:       60 91 03 01     lds     r22, 0x0103
    2864:       61 50           subi    r22, 0x01       ; 1
    2866:       40 91 9f 02     lds     r20, 0x029F
    286a:       50 91 a0 02     lds     r21, 0x02A0
    286e:       81 e1           ldi     r24, 0x11       ; 17
    2870:       23 e0           ldi     r18, 0x03       ; 3
    2872:       30 e0           ldi     r19, 0x00       ; 0
    2874:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
    2878:       43 cc           rjmp    .-1914          ; 0x2100 <osd_ncmode_default+0x2e8>
                    }
                    if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    287a:       40 91 da 01     lds     r20, 0x01DA
    287e:       20 91 db 01     lds     r18, 0x01DB
    2882:       80 91 02 01     lds     r24, 0x0102
    2886:       60 91 03 01     lds     r22, 0x0103
    288a:       61 50           subi    r22, 0x01       ; 1
    288c:       08 cc           rjmp    .-2032          ; 0x209e <osd_ncmode_default+0x286>
                        if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > 10 || naviData.CurrentPosition.Altitude / 1000 - altimeter_offset < -10) {
                                // above 10m only write full meters
                                write_ndigit_number_s(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset), 4, 0); // GPS
                        } else {
                                // up to 10m write meters.dm
                            write_ndigit_number_s_10th(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 100 - altimeter_offset * 10), 3, 0); // GPS
    288e:       60 91 a3 01     lds     r22, 0x01A3
    2892:       70 91 a4 01     lds     r23, 0x01A4
    2896:       80 91 a5 01     lds     r24, 0x01A5
    289a:       90 91 a6 01     lds     r25, 0x01A6
    289e:       8e 01           movw    r16, r28
    28a0:       00 0f           add     r16, r16
    28a2:       11 1f           adc     r17, r17
    28a4:       00 0f           add     r16, r16
    28a6:       11 1f           adc     r17, r17
    28a8:       00 0f           add     r16, r16
    28aa:       11 1f           adc     r17, r17
    28ac:       cc 0f           add     r28, r28
    28ae:       dd 1f           adc     r29, r29
    28b0:       0c 0f           add     r16, r28
    28b2:       1d 1f           adc     r17, r29
    28b4:       10 95           com     r17
    28b6:       01 95           neg     r16
    28b8:       1f 4f           sbci    r17, 0xFF       ; 255
    28ba:       24 e6           ldi     r18, 0x64       ; 100
    28bc:       30 e0           ldi     r19, 0x00       ; 0
    28be:       40 e0           ldi     r20, 0x00       ; 0
    28c0:       50 e0           ldi     r21, 0x00       ; 0
    28c2:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    28c6:       02 0f           add     r16, r18
    28c8:       13 1f           adc     r17, r19
    28ca:       87 e1           ldi     r24, 0x17       ; 23
    28cc:       60 91 02 01     lds     r22, 0x0102
    28d0:       a8 01           movw    r20, r16
    28d2:       23 e0           ldi     r18, 0x03       ; 3
    28d4:       30 e0           ldi     r19, 0x00       ; 0
    28d6:       00 e0           ldi     r16, 0x00       ; 0
    28d8:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
    28dc:       8f cb           rjmp    .-2274          ; 0x1ffc <osd_ncmode_default+0x1e4>
                        if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
                                // above 10m only write full meters
                                write_ndigit_number_s(23, top_line, naviData.Altimeter / 30, 4, 0); // BARO
                        } else {
                                // up to 10m write meters.dm
                            write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 3, 3, 0); // BARO
    28de:       80 91 cd 01     lds     r24, 0x01CD
    28e2:       90 91 ce 01     lds     r25, 0x01CE
    28e6:       63 e0           ldi     r22, 0x03       ; 3
    28e8:       70 e0           ldi     r23, 0x00       ; 0
    28ea:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    28ee:       ab 01           movw    r20, r22
    28f0:       87 e1           ldi     r24, 0x17       ; 23
    28f2:       60 91 02 01     lds     r22, 0x0102
    28f6:       23 e0           ldi     r18, 0x03       ; 3
    28f8:       30 e0           ldi     r19, 0x00       ; 0
    28fa:       00 e0           ldi     r16, 0x00       ; 0
    28fc:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
    2900:       7d cb           rjmp    .-2310          ; 0x1ffc <osd_ncmode_default+0x1e4>
                                // remember current heigth for gps offset
                                altimeter_offset = naviData.CurrentPosition.Altitude / 1000;
                                // set wasted counter to current offset
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                                        wasted_ampere_offset = ampere_wasted / 10;
                                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
    2902:       10 91 1b 01     lds     r17, 0x011B
    2906:       16 ff           sbrs    r17, 6
    2908:       78 cf           rjmp    .-272           ; 0x27fa <osd_ncmode_default+0x9e2>
                                        wasted_ampere_offset = naviData.UsedCapacity;
    290a:       80 91 ea 01     lds     r24, 0x01EA
    290e:       90 91 eb 01     lds     r25, 0x01EB
    2912:       90 93 48 01     sts     0x0148, r25
    2916:       80 93 47 01     sts     0x0147, r24
    291a:       6f cf           rjmp    .-290           ; 0x27fa <osd_ncmode_default+0x9e2>
                    write_char_xy(7, bottom_line, 0x9E); // small V
                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                                write_char_xy(7, bottom_line - 1, 0x9F); // small A
                                write_char_xy(14, bottom_line - 1, 0xB5); // mah
                                if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                                        write_char_xy(21, bottom_line - 1, 0x9E); // small V
    291c:       60 91 03 01     lds     r22, 0x0103
    2920:       61 50           subi    r22, 0x01       ; 1
    2922:       85 e1           ldi     r24, 0x15       ; 21
    2924:       4e e9           ldi     r20, 0x9E       ; 158
    2926:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    292a:       c5 cd           rjmp    .-1142          ; 0x24b6 <osd_ncmode_default+0x69e>
                        write_char_xy(20, line, 204); // small meters m
                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
                        write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
                        write_char_xy(20, line, 0x9E); // small V
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                                        write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere
    292c:       ee ee           ldi     r30, 0xEE       ; 238
    292e:       f0 e0           ldi     r31, 0x00       ; 0
    2930:       45 91           lpm     r20, Z+
    2932:       54 91           lpm     r21, Z+
    2934:       81 e0           ldi     r24, 0x01       ; 1
    2936:       67 e0           ldi     r22, 0x07       ; 7
    2938:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                                        write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0);
    293c:       80 91 39 01     lds     r24, 0x0139
    2940:       90 91 3a 01     lds     r25, 0x013A
    2944:       6a e0           ldi     r22, 0x0A       ; 10
    2946:       70 e0           ldi     r23, 0x00       ; 0
    2948:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    294c:       ab 01           movw    r20, r22
    294e:       80 e1           ldi     r24, 0x10       ; 16
    2950:       67 e0           ldi     r22, 0x07       ; 7
    2952:       23 e0           ldi     r18, 0x03       ; 3
    2954:       30 e0           ldi     r19, 0x00       ; 0
    2956:       00 e0           ldi     r16, 0x00       ; 0
    2958:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                                        write_char_xy(20, line, 0x9F); // small A
    295c:       84 e1           ldi     r24, 0x14       ; 20
    295e:       67 e0           ldi     r22, 0x07       ; 7
    2960:       4f e9           ldi     r20, 0x9F       ; 159
    2962:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                        
                                        // wasted mampere in this flight (will count up after landing)
                                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {                                   
    2966:       80 91 1d 01     lds     r24, 0x011D
    296a:       80 ff           sbrs    r24, 0
    296c:       29 c0           rjmp    .+82            ; 0x29c0 <osd_ncmode_default+0xba8>
    296e:       80 91 1b 01     lds     r24, 0x011B
    2972:       86 ff           sbrs    r24, 6
    2974:       2a c0           rjmp    .+84            ; 0x29ca <osd_ncmode_default+0xbb2>
                                                write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
                                        } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
                                                
                                                write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0);
    2976:       40 91 ea 01     lds     r20, 0x01EA
    297a:       50 91 eb 01     lds     r21, 0x01EB
    297e:       80 91 47 01     lds     r24, 0x0147
    2982:       90 91 48 01     lds     r25, 0x0148
    2986:       48 1b           sub     r20, r24
    2988:       59 0b           sbc     r21, r25
    298a:       85 e1           ldi     r24, 0x15       ; 21
    298c:       67 e0           ldi     r22, 0x07       ; 7
    298e:       25 e0           ldi     r18, 0x05       ; 5
    2990:       30 e0           ldi     r19, 0x00       ; 0
    2992:       00 e0           ldi     r16, 0x00       ; 0
    2994:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                                        }
                                        
                                        write_char_xy(26, line, 0xB5); // mah
    2998:       8a e1           ldi     r24, 0x1A       ; 26
    299a:       67 e0           ldi     r22, 0x07       ; 7
    299c:       45 eb           ldi     r20, 0xB5       ; 181
    299e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    29a2:       18 e0           ldi     r17, 0x08       ; 8
    29a4:       09 e0           ldi     r16, 0x09       ; 9
    29a6:       ea e0           ldi     r30, 0x0A       ; 10
    29a8:       fe 2e           mov     r15, r30
    29aa:       b9 ce           rjmp    .-654           ; 0x271e <osd_ncmode_default+0x906>
                        write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
                    } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
                                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    29ac:       40 91 da 01     lds     r20, 0x01DA
    29b0:       20 91 db 01     lds     r18, 0x01DB
    29b4:       80 91 02 01     lds     r24, 0x0102
    29b8:       60 91 03 01     lds     r22, 0x0103
    29bc:       61 50           subi    r22, 0x01       ; 1
    29be:       f3 cd           rjmp    .-1050          ; 0x25a6 <osd_ncmode_default+0x78e>
                                        write_char_xy(20, line, 0x9F); // small A
                                        
                                        // wasted mampere in this flight (will count up after landing)
                                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {                                   
                                                write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
                                        } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
    29c0:       80 91 1b 01     lds     r24, 0x011B
    29c4:       86 ff           sbrs    r24, 6
    29c6:       e8 cf           rjmp    .-48            ; 0x2998 <osd_ncmode_default+0xb80>
    29c8:       d6 cf           rjmp    .-84            ; 0x2976 <osd_ncmode_default+0xb5e>
                                        write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0);
                                        write_char_xy(20, line, 0x9F); // small A
                                        
                                        // wasted mampere in this flight (will count up after landing)
                                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {                                   
                                                write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
    29ca:       00 91 47 01     lds     r16, 0x0147
    29ce:       10 91 48 01     lds     r17, 0x0148
    29d2:       60 91 3b 01     lds     r22, 0x013B
    29d6:       70 91 3c 01     lds     r23, 0x013C
    29da:       80 91 3d 01     lds     r24, 0x013D
    29de:       90 91 3e 01     lds     r25, 0x013E
    29e2:       2a e0           ldi     r18, 0x0A       ; 10
    29e4:       30 e0           ldi     r19, 0x00       ; 0
    29e6:       40 e0           ldi     r20, 0x00       ; 0
    29e8:       50 e0           ldi     r21, 0x00       ; 0
    29ea:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    29ee:       20 1b           sub     r18, r16
    29f0:       31 0b           sbc     r19, r17
    29f2:       85 e1           ldi     r24, 0x15       ; 21
    29f4:       67 e0           ldi     r22, 0x07       ; 7
    29f6:       a9 01           movw    r20, r18
    29f8:       25 e0           ldi     r18, 0x05       ; 5
    29fa:       30 e0           ldi     r19, 0x00       ; 0
    29fc:       00 e0           ldi     r16, 0x00       ; 0
    29fe:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
    2a02:       ca cf           rjmp    .-108           ; 0x2998 <osd_ncmode_default+0xb80>

00002a04 <osd_ncmode_minimal>:
#include "osd_helpers.h"
#include "osd_ncmode_default.h"

#if !(ALLCHARSDEBUG|(WRITECHARS != -1))

int osd_ncmode_minimal() {
    2a04:       ff 92           push    r15
    2a06:       0f 93           push    r16
    2a08:       1f 93           push    r17
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
    2a0a:       80 91 1b 01     lds     r24, 0x011B
    2a0e:       80 ff           sbrs    r24, 0
    2a10:       15 c1           rjmp    .+554           ; 0x2c3c <osd_ncmode_minimal+0x238>
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
    2a12:       80 91 1d 01     lds     r24, 0x011D
    2a16:       81 ff           sbrs    r24, 1
    2a18:       e8 c1           rjmp    .+976           ; 0x2dea <osd_ncmode_minimal+0x3e6>
                        write_char_xy(27, bottom_line, 0xC9); // sat2
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
                }

                // first line
                write_ndigit_number_u(1, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
    2a1a:       20 91 d4 01     lds     r18, 0x01D4
    2a1e:       30 91 d5 01     lds     r19, 0x01D5
    2a22:       40 e0           ldi     r20, 0x00       ; 0
    2a24:       50 e0           ldi     r21, 0x00       ; 0
    2a26:       ca 01           movw    r24, r20
    2a28:       b9 01           movw    r22, r18
    2a2a:       66 0f           add     r22, r22
    2a2c:       77 1f           adc     r23, r23
    2a2e:       88 1f           adc     r24, r24
    2a30:       99 1f           adc     r25, r25
    2a32:       66 0f           add     r22, r22
    2a34:       77 1f           adc     r23, r23
    2a36:       88 1f           adc     r24, r24
    2a38:       99 1f           adc     r25, r25
    2a3a:       66 0f           add     r22, r22
    2a3c:       77 1f           adc     r23, r23
    2a3e:       88 1f           adc     r24, r24
    2a40:       99 1f           adc     r25, r25
    2a42:       62 0f           add     r22, r18
    2a44:       73 1f           adc     r23, r19
    2a46:       84 1f           adc     r24, r20
    2a48:       95 1f           adc     r25, r21
    2a4a:       2a ef           ldi     r18, 0xFA       ; 250
    2a4c:       30 e0           ldi     r19, 0x00       ; 0
    2a4e:       40 e0           ldi     r20, 0x00       ; 0
    2a50:       50 e0           ldi     r21, 0x00       ; 0
    2a52:       0e 94 8f 1c     call    0x391e  ; 0x391e <__udivmodsi4>
    2a56:       81 e0           ldi     r24, 0x01       ; 1
    2a58:       60 91 02 01     lds     r22, 0x0102
    2a5c:       a9 01           movw    r20, r18
    2a5e:       23 e0           ldi     r18, 0x03       ; 3
    2a60:       30 e0           ldi     r19, 0x00       ; 0
    2a62:       00 e0           ldi     r16, 0x00       ; 0
    2a64:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                write_ndigit_number_u(12, top_line, naviData.HomePositionDeviation.Distance / 10, 3, 0);
    2a68:       80 91 c6 01     lds     r24, 0x01C6
    2a6c:       90 91 c7 01     lds     r25, 0x01C7
    2a70:       6a e0           ldi     r22, 0x0A       ; 10
    2a72:       70 e0           ldi     r23, 0x00       ; 0
    2a74:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    2a78:       ab 01           movw    r20, r22
    2a7a:       8c e0           ldi     r24, 0x0C       ; 12
    2a7c:       60 91 02 01     lds     r22, 0x0102
    2a80:       23 e0           ldi     r18, 0x03       ; 3
    2a82:       30 e0           ldi     r19, 0x00       ; 0
    2a84:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                uint16_t heading_home = (naviData.HomePositionDeviation.Bearing + 360 - naviData.CompassHeading) % 360;
    2a88:       80 91 c8 01     lds     r24, 0x01C8
    2a8c:       90 91 c9 01     lds     r25, 0x01C9
    2a90:       20 91 d8 01     lds     r18, 0x01D8
    2a94:       30 91 d9 01     lds     r19, 0x01D9
                write_char_xy(17, top_line, 0xa0 + heading_fine_conv(heading_home));
    2a98:       10 91 02 01     lds     r17, 0x0102
    2a9c:       88 59           subi    r24, 0x98       ; 152
    2a9e:       9e 4f           sbci    r25, 0xFE       ; 254
    2aa0:       82 1b           sub     r24, r18
    2aa2:       93 0b           sbc     r25, r19
    2aa4:       68 e6           ldi     r22, 0x68       ; 104
    2aa6:       71 e0           ldi     r23, 0x01       ; 1
    2aa8:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2aac:       0e 94 cf 08     call    0x119e  ; 0x119e <heading_fine_conv>
    2ab0:       48 2f           mov     r20, r24
    2ab2:       40 56           subi    r20, 0x60       ; 96
    2ab4:       81 e1           ldi     r24, 0x11       ; 17
    2ab6:       61 2f           mov     r22, r17
    2ab8:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

                if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
    2abc:       80 91 cd 01     lds     r24, 0x01CD
    2ac0:       90 91 ce 01     lds     r25, 0x01CE
    2ac4:       8d 52           subi    r24, 0x2D       ; 45
    2ac6:       91 40           sbci    r25, 0x01       ; 1
    2ac8:       44 f4           brge    .+16            ; 0x2ada <osd_ncmode_minimal+0xd6>
    2aca:       80 91 cd 01     lds     r24, 0x01CD
    2ace:       90 91 ce 01     lds     r25, 0x01CE
    2ad2:       84 5d           subi    r24, 0xD4       ; 212
    2ad4:       9e 4f           sbci    r25, 0xFE       ; 254
    2ad6:       0c f0           brlt    .+2             ; 0x2ada <osd_ncmode_minimal+0xd6>
    2ad8:       0c c2           rjmp    .+1048          ; 0x2ef2 <osd_ncmode_minimal+0x4ee>
                        // above 10m only write full meters
                        write_ndigit_number_s(22, top_line, naviData.Altimeter / 30, 4, 0);
    2ada:       80 91 cd 01     lds     r24, 0x01CD
    2ade:       90 91 ce 01     lds     r25, 0x01CE
    2ae2:       6e e1           ldi     r22, 0x1E       ; 30
    2ae4:       70 e0           ldi     r23, 0x00       ; 0
    2ae6:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2aea:       ab 01           movw    r20, r22
    2aec:       86 e1           ldi     r24, 0x16       ; 22
    2aee:       60 91 02 01     lds     r22, 0x0102
    2af2:       24 e0           ldi     r18, 0x04       ; 4
    2af4:       30 e0           ldi     r19, 0x00       ; 0
    2af6:       00 e0           ldi     r16, 0x00       ; 0
    2af8:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                } else {
                        // up to 10m write meters.dm
                        write_ndigit_number_s_10th(22, top_line, naviData.Altimeter / 3, 3, 0);
                }

                draw_variometer(27, top_line, naviData.Variometer);
    2afc:       40 91 cf 01     lds     r20, 0x01CF
    2b00:       50 91 d0 01     lds     r21, 0x01D0
    2b04:       8b e1           ldi     r24, 0x1B       ; 27
    2b06:       60 91 02 01     lds     r22, 0x0102
    2b0a:       0e 94 c1 09     call    0x1382  ; 0x1382 <draw_variometer>


                // center
                if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running
    2b0e:       80 91 dd 01     lds     r24, 0x01DD
    2b12:       80 ff           sbrs    r24, 0
    2b14:       10 c1           rjmp    .+544           ; 0x2d36 <osd_ncmode_minimal+0x332>
                    if (!(old_MKFlags & FLAG_MOTOR_RUN)) { // motors just started, clear middle
    2b16:       80 91 27 01     lds     r24, 0x0127
    2b1a:       80 ff           sbrs    r24, 0
    2b1c:       a5 c1           rjmp    .+842           ; 0x2e68 <osd_ncmode_minimal+0x464>
    2b1e:       80 91 1d 01     lds     r24, 0x011D
                        clear();
                        // update flags to paint display again if needed
                        COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
                    }
                    if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
    2b22:       90 91 1b 01     lds     r25, 0x011B
    2b26:       91 ff           sbrs    r25, 1
    2b28:       18 c0           rjmp    .+48            ; 0x2b5a <osd_ncmode_minimal+0x156>
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    2b2a:       80 ff           sbrs    r24, 0
    2b2c:       f4 c1           rjmp    .+1000          ; 0x2f16 <osd_ncmode_minimal+0x512>
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
    2b2e:       40 91 da 01     lds     r20, 0x01DA
    2b32:       20 91 db 01     lds     r18, 0x01DB
    2b36:       80 91 02 01     lds     r24, 0x0102
    2b3a:       60 91 03 01     lds     r22, 0x0103
    2b3e:       62 50           subi    r22, 0x02       ; 2
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    2b40:       55 27           eor     r21, r21
    2b42:       47 fd           sbrc    r20, 7
    2b44:       50 95           com     r21
    2b46:       33 27           eor     r19, r19
    2b48:       27 fd           sbrc    r18, 7
    2b4a:       30 95           com     r19
    2b4c:       8e 5f           subi    r24, 0xFE       ; 254
    2b4e:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
    2b52:       90 91 1b 01     lds     r25, 0x011B
    2b56:       80 91 1d 01     lds     r24, 0x011D
                                }
                    }
                    // motors are on, assume we were/are flying
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
    2b5a:       84 60           ori     r24, 0x04       ; 4
    2b5c:       80 93 1d 01     sts     0x011D, r24
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
                                }
                    }
                }
                if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
    2b60:       92 fd           sbrc    r25, 2
    2b62:       0b c1           rjmp    .+534           ; 0x2d7a <osd_ncmode_minimal+0x376>
                    draw_big_variometer(27, 8, naviData.Variometer);
                }

                // pre-bottom line
                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    2b64:       80 91 1d 01     lds     r24, 0x011D
    2b68:       80 fd           sbrc    r24, 0
    2b6a:       13 c1           rjmp    .+550           ; 0x2d92 <osd_ncmode_minimal+0x38e>
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
                }

                // bottom line
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
    2b6c:       20 91 d3 01     lds     r18, 0x01D3
    2b70:       82 e0           ldi     r24, 0x02       ; 2
    2b72:       60 91 03 01     lds     r22, 0x0103
    2b76:       40 91 19 01     lds     r20, 0x0119
    2b7a:       00 91 1a 01     lds     r16, 0x011A
    2b7e:       0e 94 17 0a     call    0x142e  ; 0x142e <draw_battery>
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 3, 0);
    2b82:       40 91 d3 01     lds     r20, 0x01D3
    2b86:       83 e0           ldi     r24, 0x03       ; 3
    2b88:       60 91 03 01     lds     r22, 0x0103
    2b8c:       50 e0           ldi     r21, 0x00       ; 0
    2b8e:       23 e0           ldi     r18, 0x03       ; 3
    2b90:       30 e0           ldi     r19, 0x00       ; 0
    2b92:       00 e0           ldi     r16, 0x00       ; 0
    2b94:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
    2b98:       80 91 d3 01     lds     r24, 0x01D3
    2b9c:       90 91 19 01     lds     r25, 0x0119
    2ba0:       98 17           cp      r25, r24
    2ba2:       08 f4           brcc    .+2             ; 0x2ba6 <osd_ncmode_minimal+0x1a2>
    2ba4:       69 c1           rjmp    .+722           ; 0x2e78 <osd_ncmode_minimal+0x474>
    2ba6:       80 91 00 01     lds     r24, 0x0100
    2baa:       98 17           cp      r25, r24
    2bac:       08 f0           brcs    .+2             ; 0x2bb0 <osd_ncmode_minimal+0x1ac>
    2bae:       64 c1           rjmp    .+712           ; 0x2e78 <osd_ncmode_minimal+0x474>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
    2bb0:       82 e0           ldi     r24, 0x02       ; 2
    2bb2:       60 91 03 01     lds     r22, 0x0103
    2bb6:       4f e4           ldi     r20, 0x4F       ; 79
    2bb8:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2bbc:       83 e0           ldi     r24, 0x03       ; 3
    2bbe:       60 91 03 01     lds     r22, 0x0103
    2bc2:       4f e4           ldi     r20, 0x4F       ; 79
    2bc4:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2bc8:       84 e0           ldi     r24, 0x04       ; 4
    2bca:       60 91 03 01     lds     r22, 0x0103
    2bce:       4f e4           ldi     r20, 0x4F       ; 79
    2bd0:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2bd4:       85 e0           ldi     r24, 0x05       ; 5
    2bd6:       60 91 03 01     lds     r22, 0x0103
    2bda:       4f e4           ldi     r20, 0x4F       ; 79
    2bdc:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2be0:       86 e0           ldi     r24, 0x06       ; 6
    2be2:       60 91 03 01     lds     r22, 0x0103
    2be6:       4f e4           ldi     r20, 0x4F       ; 79
    2be8:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2bec:       87 e0           ldi     r24, 0x07       ; 7
    2bee:       60 91 03 01     lds     r22, 0x0103
    2bf2:       4f e4           ldi     r20, 0x4F       ; 79
    2bf4:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
                } else if (naviData.UBat > min_voltage && last_UBat < min_voltage) {
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, 0);
                }

                write_time(11, bottom_line, naviData.FlyingTime);
    2bf8:       40 91 d1 01     lds     r20, 0x01D1
    2bfc:       50 91 d2 01     lds     r21, 0x01D2
    2c00:       8b e0           ldi     r24, 0x0B       ; 11
    2c02:       60 91 03 01     lds     r22, 0x0103
    2c06:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>

                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 2, 0);
    2c0a:       40 91 cc 01     lds     r20, 0x01CC
    2c0e:       88 e1           ldi     r24, 0x18       ; 24
    2c10:       60 91 03 01     lds     r22, 0x0103
    2c14:       50 e0           ldi     r21, 0x00       ; 0
    2c16:       22 e0           ldi     r18, 0x02       ; 2
    2c18:       30 e0           ldi     r19, 0x00       ; 0
    2c1a:       00 e0           ldi     r16, 0x00       ; 0
    2c1c:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>

                if (naviData.NCFlags & NC_FLAG_CH) {
    2c20:       80 91 de 01     lds     r24, 0x01DE
    2c24:       82 fd           sbrc    r24, 2
    2c26:       5e c1           rjmp    .+700           ; 0x2ee4 <osd_ncmode_minimal+0x4e0>
                    write_char_xy(27, bottom_line, 231); // gps ch
                } else if (naviData.NCFlags & NC_FLAG_PH) {
    2c28:       80 91 de 01     lds     r24, 0x01DE
    2c2c:       81 ff           sbrs    r24, 1
    2c2e:       53 c1           rjmp    .+678           ; 0x2ed6 <osd_ncmode_minimal+0x4d2>
                    write_char_xy(27, bottom_line, 230); // gps ph
    2c30:       8b e1           ldi     r24, 0x1B       ; 27
    2c32:       60 91 03 01     lds     r22, 0x0103
    2c36:       46 ee           ldi     r20, 0xE6       ; 230
    2c38:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(27, bottom_line, 201); // sat2 (free)
                }
        }

        // remember statistics (only when engines running)
        if (naviData.FCFlags & FLAG_MOTOR_RUN) {
    2c3c:       80 91 dd 01     lds     r24, 0x01DD
    2c40:       80 ff           sbrs    r24, 0
    2c42:       65 c0           rjmp    .+202           ; 0x2d0e <osd_ncmode_minimal+0x30a>
            if (naviData.Altimeter > max_Altimeter) max_Altimeter = naviData.Altimeter;
    2c44:       20 91 cd 01     lds     r18, 0x01CD
    2c48:       30 91 ce 01     lds     r19, 0x01CE
    2c4c:       80 91 1f 01     lds     r24, 0x011F
    2c50:       90 91 20 01     lds     r25, 0x0120
    2c54:       82 17           cp      r24, r18
    2c56:       93 07           cpc     r25, r19
    2c58:       44 f4           brge    .+16            ; 0x2c6a <osd_ncmode_minimal+0x266>
    2c5a:       80 91 cd 01     lds     r24, 0x01CD
    2c5e:       90 91 ce 01     lds     r25, 0x01CE
    2c62:       90 93 20 01     sts     0x0120, r25
    2c66:       80 93 1f 01     sts     0x011F, r24
            if (naviData.GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData.GroundSpeed;
    2c6a:       20 91 d4 01     lds     r18, 0x01D4
    2c6e:       30 91 d5 01     lds     r19, 0x01D5
    2c72:       80 91 21 01     lds     r24, 0x0121
    2c76:       90 91 22 01     lds     r25, 0x0122
    2c7a:       82 17           cp      r24, r18
    2c7c:       93 07           cpc     r25, r19
    2c7e:       40 f4           brcc    .+16            ; 0x2c90 <osd_ncmode_minimal+0x28c>
    2c80:       80 91 d4 01     lds     r24, 0x01D4
    2c84:       90 91 d5 01     lds     r25, 0x01D5
    2c88:       90 93 22 01     sts     0x0122, r25
    2c8c:       80 93 21 01     sts     0x0121, r24
            if (naviData.HomePositionDeviation.Distance > max_Distance) {
    2c90:       20 91 c6 01     lds     r18, 0x01C6
    2c94:       30 91 c7 01     lds     r19, 0x01C7
    2c98:       80 91 23 01     lds     r24, 0x0123
    2c9c:       90 91 24 01     lds     r25, 0x0124
    2ca0:       82 17           cp      r24, r18
    2ca2:       93 07           cpc     r25, r19
    2ca4:       40 f4           brcc    .+16            ; 0x2cb6 <osd_ncmode_minimal+0x2b2>
                max_Distance = naviData.HomePositionDeviation.Distance;
    2ca6:       80 91 c6 01     lds     r24, 0x01C6
    2caa:       90 91 c7 01     lds     r25, 0x01C7
    2cae:       90 93 24 01     sts     0x0124, r25
    2cb2:       80 93 23 01     sts     0x0123, r24
            }
            if (naviData.UBat < min_UBat) min_UBat = naviData.UBat;
    2cb6:       90 91 d3 01     lds     r25, 0x01D3
    2cba:       80 91 04 01     lds     r24, 0x0104
    2cbe:       98 17           cp      r25, r24
    2cc0:       20 f4           brcc    .+8             ; 0x2cca <osd_ncmode_minimal+0x2c6>
    2cc2:       80 91 d3 01     lds     r24, 0x01D3
    2cc6:       80 93 04 01     sts     0x0104, r24
            if (naviData.FlyingTime > max_FlyingTime) max_FlyingTime = naviData.FlyingTime;
    2cca:       20 91 d1 01     lds     r18, 0x01D1
    2cce:       30 91 d2 01     lds     r19, 0x01D2
    2cd2:       80 91 25 01     lds     r24, 0x0125
    2cd6:       90 91 26 01     lds     r25, 0x0126
    2cda:       82 17           cp      r24, r18
    2cdc:       93 07           cpc     r25, r19
    2cde:       40 f4           brcc    .+16            ; 0x2cf0 <osd_ncmode_minimal+0x2ec>
    2ce0:       80 91 d1 01     lds     r24, 0x01D1
    2ce4:       90 91 d2 01     lds     r25, 0x01D2
    2ce8:       90 93 26 01     sts     0x0126, r25
    2cec:       80 93 25 01     sts     0x0125, r24
                if (ampere > max_ampere) max_ampere = ampere;
    2cf0:       20 91 37 01     lds     r18, 0x0137
    2cf4:       30 91 38 01     lds     r19, 0x0138
    2cf8:       80 91 39 01     lds     r24, 0x0139
    2cfc:       90 91 3a 01     lds     r25, 0x013A
    2d00:       82 17           cp      r24, r18
    2d02:       93 07           cpc     r25, r19
    2d04:       24 f4           brge    .+8             ; 0x2d0e <osd_ncmode_minimal+0x30a>
    2d06:       30 93 3a 01     sts     0x013A, r19
    2d0a:       20 93 39 01     sts     0x0139, r18
        }

        // remember last values
        last_RC_Quality = naviData.RC_Quality;
    2d0e:       80 91 dc 01     lds     r24, 0x01DC
    2d12:       80 93 01 01     sts     0x0101, r24
        last_UBat = naviData.UBat;
    2d16:       80 91 d3 01     lds     r24, 0x01D3
    2d1a:       80 93 00 01     sts     0x0100, r24
        old_MKFlags = naviData.FCFlags;
    2d1e:       80 91 dd 01     lds     r24, 0x01DD
    2d22:       80 93 27 01     sts     0x0127, r24
        seconds_since_last_data = 0;
    2d26:       10 92 18 01     sts     0x0118, r1

        return 0;
}
    2d2a:       80 e0           ldi     r24, 0x00       ; 0
    2d2c:       90 e0           ldi     r25, 0x00       ; 0
    2d2e:       1f 91           pop     r17
    2d30:       0f 91           pop     r16
    2d32:       ff 90           pop     r15
    2d34:       08 95           ret
                    }
                    // motors are on, assume we were/are flying
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
                } else {
                    // stats
                    if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
    2d36:       80 91 1d 01     lds     r24, 0x011D
    2d3a:       82 ff           sbrs    r24, 2
    2d3c:       92 c0           rjmp    .+292           ; 0x2e62 <osd_ncmode_minimal+0x45e>
    2d3e:       90 91 1b 01     lds     r25, 0x011B
    2d42:       93 fd           sbrc    r25, 3
    2d44:       fc c0           rjmp    .+504           ; 0x2f3e <osd_ncmode_minimal+0x53a>
                        write_char_xy(22, line, 210); // fly clock
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[5])))); // longitude
                        write_gps_pos(15, line, naviData.CurrentPosition.Longitude);
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[6])))); // latitude
                        write_gps_pos(15, line, naviData.CurrentPosition.Latitude);
                    } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
    2d46:       91 ff           sbrs    r25, 1
    2d48:       0b cf           rjmp    .-490           ; 0x2b60 <osd_ncmode_minimal+0x15c>
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    2d4a:       80 ff           sbrs    r24, 0
    2d4c:       ee c0           rjmp    .+476           ; 0x2f2a <osd_ncmode_minimal+0x526>
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
    2d4e:       40 91 da 01     lds     r20, 0x01DA
    2d52:       20 91 db 01     lds     r18, 0x01DB
    2d56:       80 91 02 01     lds     r24, 0x0102
    2d5a:       60 91 03 01     lds     r22, 0x0103
    2d5e:       62 50           subi    r22, 0x02       ; 2
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    2d60:       55 27           eor     r21, r21
    2d62:       47 fd           sbrc    r20, 7
    2d64:       50 95           com     r21
    2d66:       33 27           eor     r19, r19
    2d68:       27 fd           sbrc    r18, 7
    2d6a:       30 95           com     r19
    2d6c:       8e 5f           subi    r24, 0xFE       ; 254
    2d6e:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
    2d72:       90 91 1b 01     lds     r25, 0x011B
                                }
                    }
                }
                if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
    2d76:       92 ff           sbrs    r25, 2
    2d78:       f5 ce           rjmp    .-534           ; 0x2b64 <osd_ncmode_minimal+0x160>
                    draw_big_variometer(27, 8, naviData.Variometer);
    2d7a:       40 91 cf 01     lds     r20, 0x01CF
    2d7e:       50 91 d0 01     lds     r21, 0x01D0
    2d82:       8b e1           ldi     r24, 0x1B       ; 27
    2d84:       68 e0           ldi     r22, 0x08       ; 8
    2d86:       0e 94 84 0a     call    0x1508  ; 0x1508 <draw_big_variometer>
                }

                // pre-bottom line
                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    2d8a:       80 91 1d 01     lds     r24, 0x011D
    2d8e:       80 ff           sbrs    r24, 0
    2d90:       ed ce           rjmp    .-550           ; 0x2b6c <osd_ncmode_minimal+0x168>
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
    2d92:       20 91 03 01     lds     r18, 0x0103
    2d96:       21 50           subi    r18, 0x01       ; 1
    2d98:       80 91 37 01     lds     r24, 0x0137
    2d9c:       90 91 38 01     lds     r25, 0x0138
    2da0:       6a e0           ldi     r22, 0x0A       ; 10
    2da2:       70 e0           ldi     r23, 0x00       ; 0
    2da4:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2da8:       ab 01           movw    r20, r22
    2daa:       83 e0           ldi     r24, 0x03       ; 3
    2dac:       62 2f           mov     r22, r18
    2dae:       23 e0           ldi     r18, 0x03       ; 3
    2db0:       30 e0           ldi     r19, 0x00       ; 0
    2db2:       00 e0           ldi     r16, 0x00       ; 0
    2db4:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
    2db8:       10 91 03 01     lds     r17, 0x0103
    2dbc:       11 50           subi    r17, 0x01       ; 1
    2dbe:       60 91 3b 01     lds     r22, 0x013B
    2dc2:       70 91 3c 01     lds     r23, 0x013C
    2dc6:       80 91 3d 01     lds     r24, 0x013D
    2dca:       90 91 3e 01     lds     r25, 0x013E
    2dce:       2a e0           ldi     r18, 0x0A       ; 10
    2dd0:       30 e0           ldi     r19, 0x00       ; 0
    2dd2:       40 e0           ldi     r20, 0x00       ; 0
    2dd4:       50 e0           ldi     r21, 0x00       ; 0
    2dd6:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    2dda:       8a e0           ldi     r24, 0x0A       ; 10
    2ddc:       61 2f           mov     r22, r17
    2dde:       a9 01           movw    r20, r18
    2de0:       24 e0           ldi     r18, 0x04       ; 4
    2de2:       30 e0           ldi     r19, 0x00       ; 0
    2de4:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
    2de8:       c1 ce           rjmp    .-638           ; 0x2b6c <osd_ncmode_minimal+0x168>

int osd_ncmode_minimal() {
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
                        write_char_xy(4, top_line, 0xCB); // km/h
    2dea:       84 e0           ldi     r24, 0x04       ; 4
    2dec:       60 91 02 01     lds     r22, 0x0102
    2df0:       4b ec           ldi     r20, 0xCB       ; 203
    2df2:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(15, top_line, 0xCC); // small meters m height
    2df6:       8f e0           ldi     r24, 0x0F       ; 15
    2df8:       60 91 02 01     lds     r22, 0x0102
    2dfc:       4c ec           ldi     r20, 0xCC       ; 204
    2dfe:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(26, top_line, 0xCC); // small meters m height
    2e02:       8a e1           ldi     r24, 0x1A       ; 26
    2e04:       60 91 02 01     lds     r22, 0x0102
    2e08:       4c ec           ldi     r20, 0xCC       ; 204
    2e0a:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(16, top_line, 0xB0); // left circle
    2e0e:       80 e1           ldi     r24, 0x10       ; 16
    2e10:       60 91 02 01     lds     r22, 0x0102
    2e14:       40 eb           ldi     r20, 0xB0       ; 176
    2e16:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(18, top_line, 0xB2); // right circle
    2e1a:       82 e1           ldi     r24, 0x12       ; 18
    2e1c:       60 91 02 01     lds     r22, 0x0102
    2e20:       42 eb           ldi     r20, 0xB2       ; 178
    2e22:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(7, bottom_line, 0x9E); // small V
    2e26:       87 e0           ldi     r24, 0x07       ; 7
    2e28:       60 91 03 01     lds     r22, 0x0103
    2e2c:       4e e9           ldi     r20, 0x9E       ; 158
    2e2e:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(17, bottom_line, 0xD2); // fly clock
    2e32:       81 e1           ldi     r24, 0x11       ; 17
    2e34:       60 91 03 01     lds     r22, 0x0103
    2e38:       42 ed           ldi     r20, 0xD2       ; 210
    2e3a:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(26, bottom_line, 0xC8); // sat1
    2e3e:       8a e1           ldi     r24, 0x1A       ; 26
    2e40:       60 91 03 01     lds     r22, 0x0103
    2e44:       48 ec           ldi     r20, 0xC8       ; 200
    2e46:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_char_xy(27, bottom_line, 0xC9); // sat2
    2e4a:       8b e1           ldi     r24, 0x1B       ; 27
    2e4c:       60 91 03 01     lds     r22, 0x0103
    2e50:       49 ec           ldi     r20, 0xC9       ; 201
    2e52:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
    2e56:       80 91 1d 01     lds     r24, 0x011D
    2e5a:       82 60           ori     r24, 0x02       ; 2
    2e5c:       80 93 1d 01     sts     0x011D, r24
    2e60:       dc cd           rjmp    .-1096          ; 0x2a1a <osd_ncmode_minimal+0x16>
    2e62:       90 91 1b 01     lds     r25, 0x011B
    2e66:       6f cf           rjmp    .-290           ; 0x2d46 <osd_ncmode_minimal+0x342>


                // center
                if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running
                    if (!(old_MKFlags & FLAG_MOTOR_RUN)) { // motors just started, clear middle
                        clear();
    2e68:       0e 94 75 08     call    0x10ea  ; 0x10ea <clear>
                        // update flags to paint display again if needed
                        COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
    2e6c:       80 91 1d 01     lds     r24, 0x011D
    2e70:       8d 7f           andi    r24, 0xFD       ; 253
    2e72:       80 93 1d 01     sts     0x011D, r24
    2e76:       55 ce           rjmp    .-854           ; 0x2b22 <osd_ncmode_minimal+0x11e>
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 3, 0);
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
                } else if (naviData.UBat > min_voltage && last_UBat < min_voltage) {
    2e78:       80 91 d3 01     lds     r24, 0x01D3
    2e7c:       98 17           cp      r25, r24
    2e7e:       08 f0           brcs    .+2             ; 0x2e82 <osd_ncmode_minimal+0x47e>
    2e80:       bb ce           rjmp    .-650           ; 0x2bf8 <osd_ncmode_minimal+0x1f4>
    2e82:       80 91 00 01     lds     r24, 0x0100
    2e86:       89 17           cp      r24, r25
    2e88:       08 f0           brcs    .+2             ; 0x2e8c <osd_ncmode_minimal+0x488>
    2e8a:       b6 ce           rjmp    .-660           ; 0x2bf8 <osd_ncmode_minimal+0x1f4>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, 0);
    2e8c:       82 e0           ldi     r24, 0x02       ; 2
    2e8e:       60 91 03 01     lds     r22, 0x0103
    2e92:       40 e0           ldi     r20, 0x00       ; 0
    2e94:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2e98:       83 e0           ldi     r24, 0x03       ; 3
    2e9a:       60 91 03 01     lds     r22, 0x0103
    2e9e:       40 e0           ldi     r20, 0x00       ; 0
    2ea0:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2ea4:       84 e0           ldi     r24, 0x04       ; 4
    2ea6:       60 91 03 01     lds     r22, 0x0103
    2eaa:       40 e0           ldi     r20, 0x00       ; 0
    2eac:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2eb0:       85 e0           ldi     r24, 0x05       ; 5
    2eb2:       60 91 03 01     lds     r22, 0x0103
    2eb6:       40 e0           ldi     r20, 0x00       ; 0
    2eb8:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2ebc:       86 e0           ldi     r24, 0x06       ; 6
    2ebe:       60 91 03 01     lds     r22, 0x0103
    2ec2:       40 e0           ldi     r20, 0x00       ; 0
    2ec4:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2ec8:       87 e0           ldi     r24, 0x07       ; 7
    2eca:       60 91 03 01     lds     r22, 0x0103
    2ece:       40 e0           ldi     r20, 0x00       ; 0
    2ed0:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    2ed4:       91 ce           rjmp    .-734           ; 0x2bf8 <osd_ncmode_minimal+0x1f4>
                if (naviData.NCFlags & NC_FLAG_CH) {
                    write_char_xy(27, bottom_line, 231); // gps ch
                } else if (naviData.NCFlags & NC_FLAG_PH) {
                    write_char_xy(27, bottom_line, 230); // gps ph
                } else { // (naviData.NCFlags & NC_FLAG_FREE)
                    write_char_xy(27, bottom_line, 201); // sat2 (free)
    2ed6:       8b e1           ldi     r24, 0x1B       ; 27
    2ed8:       60 91 03 01     lds     r22, 0x0103
    2edc:       49 ec           ldi     r20, 0xC9       ; 201
    2ede:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    2ee2:       ac ce           rjmp    .-680           ; 0x2c3c <osd_ncmode_minimal+0x238>
                write_time(11, bottom_line, naviData.FlyingTime);

                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 2, 0);

                if (naviData.NCFlags & NC_FLAG_CH) {
                    write_char_xy(27, bottom_line, 231); // gps ch
    2ee4:       8b e1           ldi     r24, 0x1B       ; 27
    2ee6:       60 91 03 01     lds     r22, 0x0103
    2eea:       47 ee           ldi     r20, 0xE7       ; 231
    2eec:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    2ef0:       a5 ce           rjmp    .-694           ; 0x2c3c <osd_ncmode_minimal+0x238>
                if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
                        // above 10m only write full meters
                        write_ndigit_number_s(22, top_line, naviData.Altimeter / 30, 4, 0);
                } else {
                        // up to 10m write meters.dm
                        write_ndigit_number_s_10th(22, top_line, naviData.Altimeter / 3, 3, 0);
    2ef2:       80 91 cd 01     lds     r24, 0x01CD
    2ef6:       90 91 ce 01     lds     r25, 0x01CE
    2efa:       63 e0           ldi     r22, 0x03       ; 3
    2efc:       70 e0           ldi     r23, 0x00       ; 0
    2efe:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2f02:       ab 01           movw    r20, r22
    2f04:       86 e1           ldi     r24, 0x16       ; 22
    2f06:       60 91 02 01     lds     r22, 0x0102
    2f0a:       23 e0           ldi     r18, 0x03       ; 3
    2f0c:       30 e0           ldi     r19, 0x00       ; 0
    2f0e:       00 e0           ldi     r16, 0x00       ; 0
    2f10:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
    2f14:       f3 cd           rjmp    .-1050          ; 0x2afc <osd_ncmode_minimal+0xf8>
                    }
                    if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    2f16:       40 91 da 01     lds     r20, 0x01DA
    2f1a:       20 91 db 01     lds     r18, 0x01DB
    2f1e:       80 91 02 01     lds     r24, 0x0102
    2f22:       60 91 03 01     lds     r22, 0x0103
    2f26:       61 50           subi    r22, 0x01       ; 1
    2f28:       0b ce           rjmp    .-1002          ; 0x2b40 <osd_ncmode_minimal+0x13c>
                        write_gps_pos(15, line, naviData.CurrentPosition.Latitude);
                    } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                                draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
                                } else {
                                draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
    2f2a:       40 91 da 01     lds     r20, 0x01DA
    2f2e:       20 91 db 01     lds     r18, 0x01DB
    2f32:       80 91 02 01     lds     r24, 0x0102
    2f36:       60 91 03 01     lds     r22, 0x0103
    2f3a:       61 50           subi    r22, 0x01       ; 1
    2f3c:       11 cf           rjmp    .-478           ; 0x2d60 <osd_ncmode_minimal+0x35c>
                    COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
                } else {
                    // stats
                    if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
                                uint8_t line = 3;
                        write_ascii_string_pgm(2, line, (const char *) (pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
    2f3e:       e0 ee           ldi     r30, 0xE0       ; 224
    2f40:       f0 e0           ldi     r31, 0x00       ; 0
    2f42:       45 91           lpm     r20, Z+
    2f44:       54 91           lpm     r21, Z+
    2f46:       82 e0           ldi     r24, 0x02       ; 2
    2f48:       63 e0           ldi     r22, 0x03       ; 3
    2f4a:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_s(18, line, max_Altimeter / 30, 4, 0);
    2f4e:       80 91 1f 01     lds     r24, 0x011F
    2f52:       90 91 20 01     lds     r25, 0x0120
    2f56:       6e e1           ldi     r22, 0x1E       ; 30
    2f58:       70 e0           ldi     r23, 0x00       ; 0
    2f5a:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2f5e:       ab 01           movw    r20, r22
    2f60:       82 e1           ldi     r24, 0x12       ; 18
    2f62:       63 e0           ldi     r22, 0x03       ; 3
    2f64:       24 e0           ldi     r18, 0x04       ; 4
    2f66:       30 e0           ldi     r19, 0x00       ; 0
    2f68:       00 e0           ldi     r16, 0x00       ; 0
    2f6a:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                        write_char_xy(22, line, 204); // small meters m
    2f6e:       86 e1           ldi     r24, 0x16       ; 22
    2f70:       63 e0           ldi     r22, 0x03       ; 3
    2f72:       4c ec           ldi     r20, 0xCC       ; 204
    2f74:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
    2f78:       e2 ee           ldi     r30, 0xE2       ; 226
    2f7a:       f0 e0           ldi     r31, 0x00       ; 0
    2f7c:       45 91           lpm     r20, Z+
    2f7e:       54 91           lpm     r21, Z+
    2f80:       82 e0           ldi     r24, 0x02       ; 2
    2f82:       64 e0           ldi     r22, 0x04       ; 4
    2f84:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u(19, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
    2f88:       20 91 21 01     lds     r18, 0x0121
    2f8c:       30 91 22 01     lds     r19, 0x0122
    2f90:       40 e0           ldi     r20, 0x00       ; 0
    2f92:       50 e0           ldi     r21, 0x00       ; 0
    2f94:       ca 01           movw    r24, r20
    2f96:       b9 01           movw    r22, r18
    2f98:       66 0f           add     r22, r22
    2f9a:       77 1f           adc     r23, r23
    2f9c:       88 1f           adc     r24, r24
    2f9e:       99 1f           adc     r25, r25
    2fa0:       66 0f           add     r22, r22
    2fa2:       77 1f           adc     r23, r23
    2fa4:       88 1f           adc     r24, r24
    2fa6:       99 1f           adc     r25, r25
    2fa8:       66 0f           add     r22, r22
    2faa:       77 1f           adc     r23, r23
    2fac:       88 1f           adc     r24, r24
    2fae:       99 1f           adc     r25, r25
    2fb0:       62 0f           add     r22, r18
    2fb2:       73 1f           adc     r23, r19
    2fb4:       84 1f           adc     r24, r20
    2fb6:       95 1f           adc     r25, r21
    2fb8:       2a ef           ldi     r18, 0xFA       ; 250
    2fba:       30 e0           ldi     r19, 0x00       ; 0
    2fbc:       40 e0           ldi     r20, 0x00       ; 0
    2fbe:       50 e0           ldi     r21, 0x00       ; 0
    2fc0:       0e 94 8f 1c     call    0x391e  ; 0x391e <__udivmodsi4>
    2fc4:       83 e1           ldi     r24, 0x13       ; 19
    2fc6:       64 e0           ldi     r22, 0x04       ; 4
    2fc8:       a9 01           movw    r20, r18
    2fca:       23 e0           ldi     r18, 0x03       ; 3
    2fcc:       30 e0           ldi     r19, 0x00       ; 0
    2fce:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                        write_char_xy(22, line, 203); // km/h
    2fd2:       86 e1           ldi     r24, 0x16       ; 22
    2fd4:       64 e0           ldi     r22, 0x04       ; 4
    2fd6:       4b ec           ldi     r20, 0xCB       ; 203
    2fd8:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
    2fdc:       e4 ee           ldi     r30, 0xE4       ; 228
    2fde:       f0 e0           ldi     r31, 0x00       ; 0
    2fe0:       45 91           lpm     r20, Z+
    2fe2:       54 91           lpm     r21, Z+
    2fe4:       82 e0           ldi     r24, 0x02       ; 2
    2fe6:       65 e0           ldi     r22, 0x05       ; 5
    2fe8:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u(19, line, max_Distance / 10, 3, 0);
    2fec:       80 91 23 01     lds     r24, 0x0123
    2ff0:       90 91 24 01     lds     r25, 0x0124
    2ff4:       6a e0           ldi     r22, 0x0A       ; 10
    2ff6:       70 e0           ldi     r23, 0x00       ; 0
    2ff8:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    2ffc:       ab 01           movw    r20, r22
    2ffe:       83 e1           ldi     r24, 0x13       ; 19
    3000:       65 e0           ldi     r22, 0x05       ; 5
    3002:       23 e0           ldi     r18, 0x03       ; 3
    3004:       30 e0           ldi     r19, 0x00       ; 0
    3006:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                        write_char_xy(22, line, 204); // small meters m
    300a:       86 e1           ldi     r24, 0x16       ; 22
    300c:       65 e0           ldi     r22, 0x05       ; 5
    300e:       4c ec           ldi     r20, 0xCC       ; 204
    3010:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
    3014:       e6 ee           ldi     r30, 0xE6       ; 230
    3016:       f0 e0           ldi     r31, 0x00       ; 0
    3018:       45 91           lpm     r20, Z+
    301a:       54 91           lpm     r21, Z+
    301c:       82 e0           ldi     r24, 0x02       ; 2
    301e:       66 e0           ldi     r22, 0x06       ; 6
    3020:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_ndigit_number_u_10th(18, line, min_UBat, 3, 0);
    3024:       40 91 04 01     lds     r20, 0x0104
    3028:       82 e1           ldi     r24, 0x12       ; 18
    302a:       66 e0           ldi     r22, 0x06       ; 6
    302c:       50 e0           ldi     r21, 0x00       ; 0
    302e:       23 e0           ldi     r18, 0x03       ; 3
    3030:       30 e0           ldi     r19, 0x00       ; 0
    3032:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_char_xy(22, line, 0x9E); // small V
    3036:       86 e1           ldi     r24, 0x16       ; 22
    3038:       66 e0           ldi     r22, 0x06       ; 6
    303a:       4e e9           ldi     r20, 0x9E       ; 158
    303c:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    3040:       80 91 1d 01     lds     r24, 0x011D
    3044:       80 fd           sbrc    r24, 0
    3046:       44 c0           rjmp    .+136           ; 0x30d0 <osd_ncmode_minimal+0x6cc>
    3048:       17 e0           ldi     r17, 0x07       ; 7
    304a:       08 e0           ldi     r16, 0x08       ; 8
    304c:       99 e0           ldi     r25, 0x09       ; 9
    304e:       f9 2e           mov     r15, r25
                                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere
                                        write_ndigit_number_u_10th(18, line, max_ampere / 10, 3, 0);
                                        write_char_xy(22, line, 0x9F); // small A
                                }
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[4])))); // max time
    3050:       e8 ee           ldi     r30, 0xE8       ; 232
    3052:       f0 e0           ldi     r31, 0x00       ; 0
    3054:       45 91           lpm     r20, Z+
    3056:       54 91           lpm     r21, Z+
    3058:       82 e0           ldi     r24, 0x02       ; 2
    305a:       61 2f           mov     r22, r17
    305c:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_time(16, line, max_FlyingTime);
    3060:       40 91 25 01     lds     r20, 0x0125
    3064:       50 91 26 01     lds     r21, 0x0126
    3068:       80 e1           ldi     r24, 0x10       ; 16
    306a:       61 2f           mov     r22, r17
    306c:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>
                        write_char_xy(22, line, 210); // fly clock
    3070:       86 e1           ldi     r24, 0x16       ; 22
    3072:       61 2f           mov     r22, r17
    3074:       42 ed           ldi     r20, 0xD2       ; 210
    3076:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[5])))); // longitude
    307a:       ea ee           ldi     r30, 0xEA       ; 234
    307c:       f0 e0           ldi     r31, 0x00       ; 0
    307e:       45 91           lpm     r20, Z+
    3080:       54 91           lpm     r21, Z+
    3082:       82 e0           ldi     r24, 0x02       ; 2
    3084:       60 2f           mov     r22, r16
    3086:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_gps_pos(15, line, naviData.CurrentPosition.Longitude);
    308a:       20 91 9b 01     lds     r18, 0x019B
    308e:       30 91 9c 01     lds     r19, 0x019C
    3092:       40 91 9d 01     lds     r20, 0x019D
    3096:       50 91 9e 01     lds     r21, 0x019E
    309a:       8f e0           ldi     r24, 0x0F       ; 15
    309c:       60 2f           mov     r22, r16
    309e:       0e 94 bd 07     call    0xf7a   ; 0xf7a <write_gps_pos>
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[6])))); // latitude
    30a2:       ec ee           ldi     r30, 0xEC       ; 236
    30a4:       f0 e0           ldi     r31, 0x00       ; 0
    30a6:       45 91           lpm     r20, Z+
    30a8:       54 91           lpm     r21, Z+
    30aa:       82 e0           ldi     r24, 0x02       ; 2
    30ac:       6f 2d           mov     r22, r15
    30ae:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                        write_gps_pos(15, line, naviData.CurrentPosition.Latitude);
    30b2:       20 91 9f 01     lds     r18, 0x019F
    30b6:       30 91 a0 01     lds     r19, 0x01A0
    30ba:       40 91 a1 01     lds     r20, 0x01A1
    30be:       50 91 a2 01     lds     r21, 0x01A2
    30c2:       8f e0           ldi     r24, 0x0F       ; 15
    30c4:       6f 2d           mov     r22, r15
    30c6:       0e 94 bd 07     call    0xf7a   ; 0xf7a <write_gps_pos>
    30ca:       90 91 1b 01     lds     r25, 0x011B
    30ce:       48 cd           rjmp    .-1392          ; 0x2b60 <osd_ncmode_minimal+0x15c>
                        write_char_xy(22, line, 204); // small meters m
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
                        write_ndigit_number_u_10th(18, line, min_UBat, 3, 0);
                        write_char_xy(22, line, 0x9E); // small V
                                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere
    30d0:       ee ee           ldi     r30, 0xEE       ; 238
    30d2:       f0 e0           ldi     r31, 0x00       ; 0
    30d4:       45 91           lpm     r20, Z+
    30d6:       54 91           lpm     r21, Z+
    30d8:       82 e0           ldi     r24, 0x02       ; 2
    30da:       67 e0           ldi     r22, 0x07       ; 7
    30dc:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
                                        write_ndigit_number_u_10th(18, line, max_ampere / 10, 3, 0);
    30e0:       80 91 39 01     lds     r24, 0x0139
    30e4:       90 91 3a 01     lds     r25, 0x013A
    30e8:       6a e0           ldi     r22, 0x0A       ; 10
    30ea:       70 e0           ldi     r23, 0x00       ; 0
    30ec:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    30f0:       ab 01           movw    r20, r22
    30f2:       82 e1           ldi     r24, 0x12       ; 18
    30f4:       67 e0           ldi     r22, 0x07       ; 7
    30f6:       23 e0           ldi     r18, 0x03       ; 3
    30f8:       30 e0           ldi     r19, 0x00       ; 0
    30fa:       00 e0           ldi     r16, 0x00       ; 0
    30fc:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                                        write_char_xy(22, line, 0x9F); // small A
    3100:       86 e1           ldi     r24, 0x16       ; 22
    3102:       67 e0           ldi     r22, 0x07       ; 7
    3104:       4f e9           ldi     r20, 0x9F       ; 159
    3106:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    310a:       18 e0           ldi     r17, 0x08       ; 8
    310c:       09 e0           ldi     r16, 0x09       ; 9
    310e:       8a e0           ldi     r24, 0x0A       ; 10
    3110:       f8 2e           mov     r15, r24
    3112:       9e cf           rjmp    .-196           ; 0x3050 <osd_ncmode_minimal+0x64c>

00003114 <osd_fcmode_default>:
#include "osd_helpers.h"
#include "osd_fcmode_default.h"

#if !(ALLCHARSDEBUG|(WRITECHARS != -1))

int osd_fcmode_default() {
    3114:       0f 93           push    r16
    3116:       1f 93           push    r17
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
    3118:       80 91 1b 01     lds     r24, 0x011B
    311c:       80 ff           sbrs    r24, 0
    311e:       b7 c0           rjmp    .+366           ; 0x328e <osd_fcmode_default+0x17a>
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
    3120:       80 91 1d 01     lds     r24, 0x011D
    3124:       81 ff           sbrs    r24, 1
    3126:       d6 c0           rjmp    .+428           ; 0x32d4 <osd_fcmode_default+0x1c0>
                                }
                        }
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
                }

                write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
    3128:       40 91 5f 01     lds     r20, 0x015F
    312c:       50 91 60 01     lds     r21, 0x0160
    3130:       87 e0           ldi     r24, 0x07       ; 7
    3132:       60 91 02 01     lds     r22, 0x0102
    3136:       23 e0           ldi     r18, 0x03       ; 3
    3138:       30 e0           ldi     r19, 0x00       ; 0
    313a:       00 e0           ldi     r16, 0x00       ; 0
    313c:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    3140:       80 91 5f 01     lds     r24, 0x015F
    3144:       90 91 60 01     lds     r25, 0x0160
    3148:       85 36           cpi     r24, 0x65       ; 101
    314a:       91 05           cpc     r25, r1
    314c:       08 f4           brcc    .+2             ; 0x3150 <osd_fcmode_default+0x3c>
    314e:       b2 c0           rjmp    .+356           ; 0x32b4 <osd_fcmode_default+0x1a0>
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    3150:       80 91 5f 01     lds     r24, 0x015F
    3154:       90 91 60 01     lds     r25, 0x0160
    3158:       85 36           cpi     r24, 0x65       ; 101
    315a:       91 05           cpc     r25, r1
    315c:       28 f0           brcs    .+10            ; 0x3168 <osd_fcmode_default+0x54>
    315e:       80 91 01 01     lds     r24, 0x0101
    3162:       85 36           cpi     r24, 0x65       ; 101
    3164:       08 f4           brcc    .+2             ; 0x3168 <osd_fcmode_default+0x54>
    3166:       f5 c0           rjmp    .+490           ; 0x3352 <osd_fcmode_default+0x23e>
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, 0);
                }
        
                if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
    3168:       80 91 55 01     lds     r24, 0x0155
    316c:       90 91 56 01     lds     r25, 0x0156
    3170:       8d 52           subi    r24, 0x2D       ; 45
    3172:       91 40           sbci    r25, 0x01       ; 1
    3174:       40 f4           brcc    .+16            ; 0x3186 <osd_fcmode_default+0x72>
    3176:       80 91 55 01     lds     r24, 0x0155
    317a:       90 91 56 01     lds     r25, 0x0156
    317e:       84 5d           subi    r24, 0xD4       ; 212
    3180:       9e 4f           sbci    r25, 0xFE       ; 254
    3182:       08 f0           brcs    .+2             ; 0x3186 <osd_fcmode_default+0x72>
    3184:       41 c1           rjmp    .+642           ; 0x3408 <osd_fcmode_default+0x2f4>
                    // above 10m only write full meters
                    write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 4, 0);
    3186:       80 91 55 01     lds     r24, 0x0155
    318a:       90 91 56 01     lds     r25, 0x0156
    318e:       6e e1           ldi     r22, 0x1E       ; 30
    3190:       70 e0           ldi     r23, 0x00       ; 0
    3192:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    3196:       ab 01           movw    r20, r22
    3198:       87 e1           ldi     r24, 0x17       ; 23
    319a:       60 91 02 01     lds     r22, 0x0102
    319e:       24 e0           ldi     r18, 0x04       ; 4
    31a0:       30 e0           ldi     r19, 0x00       ; 0
    31a2:       00 e0           ldi     r16, 0x00       ; 0
    31a4:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                } else {
                    // up to 10m write meters.dm
                    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 3, 0);
                }
                if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
    31a8:       20 91 55 01     lds     r18, 0x0155
    31ac:       30 91 56 01     lds     r19, 0x0156
    31b0:       80 91 1f 01     lds     r24, 0x011F
    31b4:       90 91 20 01     lds     r25, 0x0120
    31b8:       82 17           cp      r24, r18
    31ba:       93 07           cpc     r25, r19
    31bc:       40 f4           brcc    .+16            ; 0x31ce <osd_fcmode_default+0xba>
    31be:       80 91 55 01     lds     r24, 0x0155
    31c2:       90 91 56 01     lds     r25, 0x0156
    31c6:       90 93 20 01     sts     0x0120, r25
    31ca:       80 93 1f 01     sts     0x011F, r24

                if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
    31ce:       80 91 1b 01     lds     r24, 0x011B
    31d2:       81 fd           sbrc    r24, 1
    31d4:       c9 c0           rjmp    .+402           ; 0x3368 <osd_fcmode_default+0x254>
                        draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
                }

                // pre-bottom line
                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    31d6:       80 91 1d 01     lds     r24, 0x011D
    31da:       80 fd           sbrc    r24, 0
    31dc:       d9 c0           rjmp    .+434           ; 0x3390 <osd_fcmode_default+0x27c>
                        if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
                        }
                }

                draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
    31de:       20 91 5d 01     lds     r18, 0x015D
    31e2:       30 91 5e 01     lds     r19, 0x015E
    31e6:       82 e0           ldi     r24, 0x02       ; 2
    31e8:       60 91 03 01     lds     r22, 0x0103
    31ec:       40 91 19 01     lds     r20, 0x0119
    31f0:       00 91 1a 01     lds     r16, 0x011A
    31f4:       0e 94 17 0a     call    0x142e  ; 0x142e <draw_battery>
                write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 3, 0);
    31f8:       40 91 5d 01     lds     r20, 0x015D
    31fc:       50 91 5e 01     lds     r21, 0x015E
    3200:       83 e0           ldi     r24, 0x03       ; 3
    3202:       60 91 03 01     lds     r22, 0x0103
    3206:       23 e0           ldi     r18, 0x03       ; 3
    3208:       30 e0           ldi     r19, 0x00       ; 0
    320a:       00 e0           ldi     r16, 0x00       ; 0
    320c:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
    3210:       80 91 5d 01     lds     r24, 0x015D
    3214:       90 91 5e 01     lds     r25, 0x015E
    3218:       40 91 19 01     lds     r20, 0x0119
    321c:       24 2f           mov     r18, r20
    321e:       30 e0           ldi     r19, 0x00       ; 0
    3220:       28 17           cp      r18, r24
    3222:       39 07           cpc     r19, r25
    3224:       28 f0           brcs    .+10            ; 0x3230 <osd_fcmode_default+0x11c>
    3226:       80 91 00 01     lds     r24, 0x0100
    322a:       48 17           cp      r20, r24
    322c:       08 f4           brcc    .+2             ; 0x3230 <osd_fcmode_default+0x11c>
    322e:       6c c0           rjmp    .+216           ; 0x3308 <osd_fcmode_default+0x1f4>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
                } else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
    3230:       80 91 5d 01     lds     r24, 0x015D
    3234:       90 91 5e 01     lds     r25, 0x015E
    3238:       28 17           cp      r18, r24
    323a:       39 07           cpc     r19, r25
    323c:       40 f5           brcc    .+80            ; 0x328e <osd_fcmode_default+0x17a>
    323e:       80 91 00 01     lds     r24, 0x0100
    3242:       84 17           cp      r24, r20
    3244:       20 f5           brcc    .+72            ; 0x328e <osd_fcmode_default+0x17a>
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, 0);
    3246:       82 e0           ldi     r24, 0x02       ; 2
    3248:       60 91 03 01     lds     r22, 0x0103
    324c:       40 e0           ldi     r20, 0x00       ; 0
    324e:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3252:       83 e0           ldi     r24, 0x03       ; 3
    3254:       60 91 03 01     lds     r22, 0x0103
    3258:       40 e0           ldi     r20, 0x00       ; 0
    325a:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    325e:       84 e0           ldi     r24, 0x04       ; 4
    3260:       60 91 03 01     lds     r22, 0x0103
    3264:       40 e0           ldi     r20, 0x00       ; 0
    3266:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    326a:       85 e0           ldi     r24, 0x05       ; 5
    326c:       60 91 03 01     lds     r22, 0x0103
    3270:       40 e0           ldi     r20, 0x00       ; 0
    3272:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3276:       86 e0           ldi     r24, 0x06       ; 6
    3278:       60 91 03 01     lds     r22, 0x0103
    327c:       40 e0           ldi     r20, 0x00       ; 0
    327e:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3282:       87 e0           ldi     r24, 0x07       ; 7
    3284:       60 91 03 01     lds     r22, 0x0103
    3288:       40 e0           ldi     r20, 0x00       ; 0
    328a:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
                }
        }
        // remember last values
        last_UBat = debugData.Analog[9];
    328e:       80 91 5d 01     lds     r24, 0x015D
    3292:       90 91 5e 01     lds     r25, 0x015E
    3296:       80 93 00 01     sts     0x0100, r24
        last_RC_Quality = debugData.Analog[10];
    329a:       80 91 5f 01     lds     r24, 0x015F
    329e:       90 91 60 01     lds     r25, 0x0160
    32a2:       80 93 01 01     sts     0x0101, r24
        debugData.Analog[5]); // Height
        debugData.Analog[9]); // Voltage
        debugData.Analog[10]);// RC Signal
        debugData.Analog[11]);// Gyro compass
         */
        seconds_since_last_data = 0;
    32a6:       10 92 18 01     sts     0x0118, r1

        return 0;
}
    32aa:       80 e0           ldi     r24, 0x00       ; 0
    32ac:       90 e0           ldi     r25, 0x00       ; 0
    32ae:       1f 91           pop     r17
    32b0:       0f 91           pop     r16
    32b2:       08 95           ret
                        }
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
                }

                write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    32b4:       80 91 01 01     lds     r24, 0x0101
    32b8:       85 36           cpi     r24, 0x65       ; 101
    32ba:       08 f4           brcc    .+2             ; 0x32be <osd_fcmode_default+0x1aa>
    32bc:       49 cf           rjmp    .-366           ; 0x3150 <osd_fcmode_default+0x3c>
    32be:       17 e0           ldi     r17, 0x07       ; 7
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
    32c0:       81 2f           mov     r24, r17
    32c2:       60 91 02 01     lds     r22, 0x0102
    32c6:       4f e4           ldi     r20, 0x4F       ; 79
    32c8:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    32cc:       1f 5f           subi    r17, 0xFF       ; 255
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
                }

                write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
    32ce:       1b 30           cpi     r17, 0x0B       ; 11
    32d0:       b9 f7           brne    .-18            ; 0x32c0 <osd_fcmode_default+0x1ac>
    32d2:       4a cf           rjmp    .-364           ; 0x3168 <osd_fcmode_default+0x54>

int osd_fcmode_default() {
        if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
                // write icons at init or after menu/mode-switch
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
                    write_char_xy(10, top_line, 0xCA); // RC-transmitter
    32d4:       8a e0           ldi     r24, 0x0A       ; 10
    32d6:       60 91 02 01     lds     r22, 0x0102
    32da:       4a ec           ldi     r20, 0xCA       ; 202
    32dc:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(27, top_line, 0xCC); // small meters m height
    32e0:       8b e1           ldi     r24, 0x1B       ; 27
    32e2:       60 91 02 01     lds     r22, 0x0102
    32e6:       4c ec           ldi     r20, 0xCC       ; 204
    32e8:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                    write_char_xy(7, bottom_line, 0x9E); // small v
    32ec:       87 e0           ldi     r24, 0x07       ; 7
    32ee:       60 91 03 01     lds     r22, 0x0103
    32f2:       4e e9           ldi     r20, 0x9E       ; 158
    32f4:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                        if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    32f8:       80 91 1d 01     lds     r24, 0x011D
    32fc:       80 fd           sbrc    r24, 0
    32fe:       96 c0           rjmp    .+300           ; 0x342c <osd_fcmode_default+0x318>
                                write_char_xy(14, bottom_line - 1, 0xB5); // mah
                                if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                                        write_char_xy(21, bottom_line - 1, 0x9E); // small V
                                }
                        }
                        COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
    3300:       82 60           ori     r24, 0x02       ; 2
    3302:       80 93 1d 01     sts     0x011D, r24
    3306:       10 cf           rjmp    .-480           ; 0x3128 <osd_fcmode_default+0x14>

                draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
                write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 3, 0);
                if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
                    for (uint8_t x = 2; x < 8; x++)
                        write_char_att_xy(x, bottom_line, BLINK);
    3308:       82 e0           ldi     r24, 0x02       ; 2
    330a:       60 91 03 01     lds     r22, 0x0103
    330e:       4f e4           ldi     r20, 0x4F       ; 79
    3310:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3314:       83 e0           ldi     r24, 0x03       ; 3
    3316:       60 91 03 01     lds     r22, 0x0103
    331a:       4f e4           ldi     r20, 0x4F       ; 79
    331c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3320:       84 e0           ldi     r24, 0x04       ; 4
    3322:       60 91 03 01     lds     r22, 0x0103
    3326:       4f e4           ldi     r20, 0x4F       ; 79
    3328:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    332c:       85 e0           ldi     r24, 0x05       ; 5
    332e:       60 91 03 01     lds     r22, 0x0103
    3332:       4f e4           ldi     r20, 0x4F       ; 79
    3334:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3338:       86 e0           ldi     r24, 0x06       ; 6
    333a:       60 91 03 01     lds     r22, 0x0103
    333e:       4f e4           ldi     r20, 0x4F       ; 79
    3340:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3344:       87 e0           ldi     r24, 0x07       ; 7
    3346:       60 91 03 01     lds     r22, 0x0103
    334a:       4f e4           ldi     r20, 0x4F       ; 79
    334c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3350:       9e cf           rjmp    .-196           ; 0x328e <osd_fcmode_default+0x17a>

                write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    3352:       17 e0           ldi     r17, 0x07       ; 7
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, 0);
    3354:       81 2f           mov     r24, r17
    3356:       60 91 02 01     lds     r22, 0x0102
    335a:       40 e0           ldi     r20, 0x00       ; 0
    335c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3360:       1f 5f           subi    r17, 0xFF       ; 255
                write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
                        write_char_att_xy(7 + x, top_line, BLINK);
                } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
                    for (uint8_t x = 0; x < 4; x++)
    3362:       1b 30           cpi     r17, 0x0B       ; 11
    3364:       b9 f7           brne    .-18            ; 0x3354 <osd_fcmode_default+0x240>
    3366:       00 cf           rjmp    .-512           ; 0x3168 <osd_fcmode_default+0x54>
                    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 3, 0);
                }
                if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];

                if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
                        draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
    3368:       40 91 4b 01     lds     r20, 0x014B
    336c:       50 91 4c 01     lds     r21, 0x014C
    3370:       20 91 4d 01     lds     r18, 0x014D
    3374:       30 91 4e 01     lds     r19, 0x014E
    3378:       80 91 02 01     lds     r24, 0x0102
    337c:       60 91 03 01     lds     r22, 0x0103
    3380:       61 50           subi    r22, 0x01       ; 1
    3382:       8e 5f           subi    r24, 0xFE       ; 254
    3384:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
                }

                // pre-bottom line
                if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    3388:       80 91 1d 01     lds     r24, 0x011D
    338c:       80 ff           sbrs    r24, 0
    338e:       27 cf           rjmp    .-434           ; 0x31de <osd_fcmode_default+0xca>
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
    3390:       20 91 03 01     lds     r18, 0x0103
    3394:       21 50           subi    r18, 0x01       ; 1
    3396:       80 91 37 01     lds     r24, 0x0137
    339a:       90 91 38 01     lds     r25, 0x0138
    339e:       6a e0           ldi     r22, 0x0A       ; 10
    33a0:       70 e0           ldi     r23, 0x00       ; 0
    33a2:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    33a6:       ab 01           movw    r20, r22
    33a8:       83 e0           ldi     r24, 0x03       ; 3
    33aa:       62 2f           mov     r22, r18
    33ac:       23 e0           ldi     r18, 0x03       ; 3
    33ae:       30 e0           ldi     r19, 0x00       ; 0
    33b0:       00 e0           ldi     r16, 0x00       ; 0
    33b2:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
    33b6:       10 91 03 01     lds     r17, 0x0103
    33ba:       11 50           subi    r17, 0x01       ; 1
    33bc:       60 91 3b 01     lds     r22, 0x013B
    33c0:       70 91 3c 01     lds     r23, 0x013C
    33c4:       80 91 3d 01     lds     r24, 0x013D
    33c8:       90 91 3e 01     lds     r25, 0x013E
    33cc:       2a e0           ldi     r18, 0x0A       ; 10
    33ce:       30 e0           ldi     r19, 0x00       ; 0
    33d0:       40 e0           ldi     r20, 0x00       ; 0
    33d2:       50 e0           ldi     r21, 0x00       ; 0
    33d4:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    33d8:       8a e0           ldi     r24, 0x0A       ; 10
    33da:       61 2f           mov     r22, r17
    33dc:       a9 01           movw    r20, r18
    33de:       24 e0           ldi     r18, 0x04       ; 4
    33e0:       30 e0           ldi     r19, 0x00       ; 0
    33e2:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
                        if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    33e6:       80 91 1b 01     lds     r24, 0x011B
    33ea:       85 ff           sbrs    r24, 5
    33ec:       f8 ce           rjmp    .-528           ; 0x31de <osd_fcmode_default+0xca>
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
    33ee:       60 91 03 01     lds     r22, 0x0103
    33f2:       61 50           subi    r22, 0x01       ; 1
    33f4:       40 91 9f 02     lds     r20, 0x029F
    33f8:       50 91 a0 02     lds     r21, 0x02A0
    33fc:       81 e1           ldi     r24, 0x11       ; 17
    33fe:       23 e0           ldi     r18, 0x03       ; 3
    3400:       30 e0           ldi     r19, 0x00       ; 0
    3402:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
    3406:       eb ce           rjmp    .-554           ; 0x31de <osd_fcmode_default+0xca>
                if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
                    // above 10m only write full meters
                    write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 4, 0);
                } else {
                    // up to 10m write meters.dm
                    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 3, 0);
    3408:       80 91 55 01     lds     r24, 0x0155
    340c:       90 91 56 01     lds     r25, 0x0156
    3410:       63 e0           ldi     r22, 0x03       ; 3
    3412:       70 e0           ldi     r23, 0x00       ; 0
    3414:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    3418:       ab 01           movw    r20, r22
    341a:       87 e1           ldi     r24, 0x17       ; 23
    341c:       60 91 02 01     lds     r22, 0x0102
    3420:       23 e0           ldi     r18, 0x03       ; 3
    3422:       30 e0           ldi     r19, 0x00       ; 0
    3424:       00 e0           ldi     r16, 0x00       ; 0
    3426:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
    342a:       be ce           rjmp    .-644           ; 0x31a8 <osd_fcmode_default+0x94>
                if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
                    write_char_xy(10, top_line, 0xCA); // RC-transmitter
                    write_char_xy(27, top_line, 0xCC); // small meters m height
                    write_char_xy(7, bottom_line, 0x9E); // small v
                        if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                                write_char_xy(7, bottom_line - 1, 0x9F); // small A
    342c:       60 91 03 01     lds     r22, 0x0103
    3430:       61 50           subi    r22, 0x01       ; 1
    3432:       87 e0           ldi     r24, 0x07       ; 7
    3434:       4f e9           ldi     r20, 0x9F       ; 159
    3436:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                write_char_xy(14, bottom_line - 1, 0xB5); // mah
    343a:       60 91 03 01     lds     r22, 0x0103
    343e:       61 50           subi    r22, 0x01       ; 1
    3440:       8e e0           ldi     r24, 0x0E       ; 14
    3442:       45 eb           ldi     r20, 0xB5       ; 181
    3444:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                                if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    3448:       80 91 1b 01     lds     r24, 0x011B
    344c:       85 fd           sbrc    r24, 5
    344e:       03 c0           rjmp    .+6             ; 0x3456 <osd_fcmode_default+0x342>
    3450:       80 91 1d 01     lds     r24, 0x011D
    3454:       55 cf           rjmp    .-342           ; 0x3300 <osd_fcmode_default+0x1ec>
                                        write_char_xy(21, bottom_line - 1, 0x9E); // small V
    3456:       60 91 03 01     lds     r22, 0x0103
    345a:       61 50           subi    r22, 0x01       ; 1
    345c:       85 e1           ldi     r24, 0x15       ; 21
    345e:       4e e9           ldi     r20, 0x9E       ; 158
    3460:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    3464:       f5 cf           rjmp    .-22            ; 0x3450 <osd_fcmode_default+0x33c>

00003466 <osd_fcmode_jopl>:

// jopl Vario
static int16_t last_Altimeter = 0;
static int16_t Vario = 0;

int osd_fcmode_jopl() {
    3466:       0f 93           push    r16
    3468:       1f 93           push    r17
    if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
    346a:       80 91 1b 01     lds     r24, 0x011B
    346e:       80 ff           sbrs    r24, 0
    3470:       10 c1           rjmp    .+544           ; 0x3692 <osd_fcmode_jopl+0x22c>
        // write icons at init or after menu/mode-switch
        if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
    3472:       80 91 1d 01     lds     r24, 0x011D
    3476:       81 ff           sbrs    r24, 1
    3478:       2f c1           rjmp    .+606           ; 0x36d8 <osd_fcmode_jopl+0x272>
            // end jopl

            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
        }

        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
    347a:       40 91 5f 01     lds     r20, 0x015F
    347e:       50 91 60 01     lds     r21, 0x0160
    3482:       87 e0           ldi     r24, 0x07       ; 7
    3484:       60 91 02 01     lds     r22, 0x0102
    3488:       23 e0           ldi     r18, 0x03       ; 3
    348a:       30 e0           ldi     r19, 0x00       ; 0
    348c:       00 e0           ldi     r16, 0x00       ; 0
    348e:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    3492:       80 91 5f 01     lds     r24, 0x015F
    3496:       90 91 60 01     lds     r25, 0x0160
    349a:       85 36           cpi     r24, 0x65       ; 101
    349c:       91 05           cpc     r25, r1
    349e:       08 f4           brcc    .+2             ; 0x34a2 <osd_fcmode_jopl+0x3c>
    34a0:       0b c1           rjmp    .+534           ; 0x36b8 <osd_fcmode_jopl+0x252>
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, BLINK);
        } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    34a2:       80 91 5f 01     lds     r24, 0x015F
    34a6:       90 91 60 01     lds     r25, 0x0160
    34aa:       85 36           cpi     r24, 0x65       ; 101
    34ac:       91 05           cpc     r25, r1
    34ae:       28 f0           brcs    .+10            ; 0x34ba <osd_fcmode_jopl+0x54>
    34b0:       80 91 01 01     lds     r24, 0x0101
    34b4:       85 36           cpi     r24, 0x65       ; 101
    34b6:       08 f4           brcc    .+2             ; 0x34ba <osd_fcmode_jopl+0x54>
    34b8:       62 c1           rjmp    .+708           ; 0x377e <osd_fcmode_jopl+0x318>
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, 0);
        }

        // jopl ... compass
        write_ndigit_number_u(13, top_line, debugData.Analog[8], 3, 0);
    34ba:       40 91 5b 01     lds     r20, 0x015B
    34be:       50 91 5c 01     lds     r21, 0x015C
    34c2:       8d e0           ldi     r24, 0x0D       ; 13
    34c4:       60 91 02 01     lds     r22, 0x0102
    34c8:       23 e0           ldi     r18, 0x03       ; 3
    34ca:       30 e0           ldi     r19, 0x00       ; 0
    34cc:       00 e0           ldi     r16, 0x00       ; 0
    34ce:       0e 94 6b 07     call    0xed6   ; 0xed6 <write_ndigit_number_u>
        write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word(&(directions[heading_conv(debugData.Analog[8])]))));
    34d2:       10 91 02 01     lds     r17, 0x0102
    34d6:       80 91 5b 01     lds     r24, 0x015B
    34da:       90 91 5c 01     lds     r25, 0x015C
    34de:       0e 94 9d 08     call    0x113a  ; 0x113a <heading_conv>
    34e2:       e8 2f           mov     r30, r24
    34e4:       f0 e0           ldi     r31, 0x00       ; 0
    34e6:       ee 0f           add     r30, r30
    34e8:       ff 1f           adc     r31, r31
    34ea:       e8 5f           subi    r30, 0xF8       ; 248
    34ec:       fe 4f           sbci    r31, 0xFE       ; 254
    34ee:       45 91           lpm     r20, Z+
    34f0:       54 91           lpm     r21, Z+
    34f2:       81 e1           ldi     r24, 0x11       ; 17
    34f4:       61 2f           mov     r22, r17
    34f6:       0e 94 7e 05     call    0xafc   ; 0xafc <write_ascii_string_pgm>
        // end jopl

        // jopl Altimeter modification
        if ((debugData.Analog[5] > 100) || (debugData.Analog[5] < -100)) {
    34fa:       80 91 55 01     lds     r24, 0x0155
    34fe:       90 91 56 01     lds     r25, 0x0156
    3502:       85 36           cpi     r24, 0x65       ; 101
    3504:       91 05           cpc     r25, r1
    3506:       40 f4           brcc    .+16            ; 0x3518 <osd_fcmode_jopl+0xb2>
    3508:       80 91 55 01     lds     r24, 0x0155
    350c:       90 91 56 01     lds     r25, 0x0156
    3510:       8c 59           subi    r24, 0x9C       ; 156
    3512:       9f 4f           sbci    r25, 0xFF       ; 255
    3514:       08 f0           brcs    .+2             ; 0x3518 <osd_fcmode_jopl+0xb2>
    3516:       96 c1           rjmp    .+812           ; 0x3844 <osd_fcmode_jopl+0x3de>
            // above 10m only write full meters
            write_ndigit_number_s(22, top_line, debugData.Analog[5] / 10, 4, 0);
    3518:       80 91 55 01     lds     r24, 0x0155
    351c:       90 91 56 01     lds     r25, 0x0156
    3520:       6a e0           ldi     r22, 0x0A       ; 10
    3522:       70 e0           ldi     r23, 0x00       ; 0
    3524:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    3528:       ab 01           movw    r20, r22
    352a:       86 e1           ldi     r24, 0x16       ; 22
    352c:       60 91 02 01     lds     r22, 0x0102
    3530:       24 e0           ldi     r18, 0x04       ; 4
    3532:       30 e0           ldi     r19, 0x00       ; 0
    3534:       00 e0           ldi     r16, 0x00       ; 0
    3536:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
        } else {
            // up to 10m write meters.dm
            write_ndigit_number_s_10th(22, top_line, debugData.Analog[5], 3, 0);
        }
        Vario = debugData.Analog[5] - last_Altimeter;
    353a:       40 91 55 01     lds     r20, 0x0155
    353e:       50 91 56 01     lds     r21, 0x0156
    3542:       80 91 43 01     lds     r24, 0x0143
    3546:       90 91 44 01     lds     r25, 0x0144
    354a:       48 1b           sub     r20, r24
    354c:       59 0b           sbc     r21, r25
    354e:       50 93 46 01     sts     0x0146, r21
    3552:       40 93 45 01     sts     0x0145, r20
        draw_variometer(27, top_line, Vario);
    3556:       8b e1           ldi     r24, 0x1B       ; 27
    3558:       60 91 02 01     lds     r22, 0x0102
    355c:       0e 94 c1 09     call    0x1382  ; 0x1382 <draw_variometer>
        if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
    3560:       40 91 1b 01     lds     r20, 0x011B
    3564:       42 fd           sbrc    r20, 2
    3566:       63 c1           rjmp    .+710           ; 0x382e <osd_fcmode_jopl+0x3c8>
            draw_big_variometer(27, 8, Vario);
        }
        last_Altimeter = debugData.Analog[5];
    3568:       80 91 55 01     lds     r24, 0x0155
    356c:       90 91 56 01     lds     r25, 0x0156
    3570:       90 93 44 01     sts     0x0144, r25
    3574:       80 93 43 01     sts     0x0143, r24
        // end jopl

        if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
    3578:       20 91 55 01     lds     r18, 0x0155
    357c:       30 91 56 01     lds     r19, 0x0156
    3580:       80 91 1f 01     lds     r24, 0x011F
    3584:       90 91 20 01     lds     r25, 0x0120
    3588:       82 17           cp      r24, r18
    358a:       93 07           cpc     r25, r19
    358c:       40 f4           brcc    .+16            ; 0x359e <osd_fcmode_jopl+0x138>
    358e:       80 91 55 01     lds     r24, 0x0155
    3592:       90 91 56 01     lds     r25, 0x0156
    3596:       90 93 20 01     sts     0x0120, r25
    359a:       80 93 1f 01     sts     0x011F, r24

        if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
    359e:       41 fd           sbrc    r20, 1
    35a0:       35 c1           rjmp    .+618           ; 0x380c <osd_fcmode_jopl+0x3a6>
            draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
        }

        // jopl ... compass heading
        // seccond line
        draw_compass(11, top_line + 1, debugData.Analog[8]);
    35a2:       40 91 5b 01     lds     r20, 0x015B
    35a6:       50 91 5c 01     lds     r21, 0x015C
    35aa:       60 91 02 01     lds     r22, 0x0102
    35ae:       6f 5f           subi    r22, 0xFF       ; 255
    35b0:       8b e0           ldi     r24, 0x0B       ; 11
    35b2:       0e 94 55 0a     call    0x14aa  ; 0x14aa <draw_compass>
        // end jopl

        // pre-bottom line
        if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    35b6:       80 91 1d 01     lds     r24, 0x011D
    35ba:       80 fd           sbrc    r24, 0
    35bc:       eb c0           rjmp    .+470           ; 0x3794 <osd_fcmode_jopl+0x32e>
            if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
            }
        }

        draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
    35be:       20 91 5d 01     lds     r18, 0x015D
    35c2:       30 91 5e 01     lds     r19, 0x015E
    35c6:       82 e0           ldi     r24, 0x02       ; 2
    35c8:       60 91 03 01     lds     r22, 0x0103
    35cc:       40 91 19 01     lds     r20, 0x0119
    35d0:       00 91 1a 01     lds     r16, 0x011A
    35d4:       0e 94 17 0a     call    0x142e  ; 0x142e <draw_battery>
        write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 3, 0);
    35d8:       40 91 5d 01     lds     r20, 0x015D
    35dc:       50 91 5e 01     lds     r21, 0x015E
    35e0:       83 e0           ldi     r24, 0x03       ; 3
    35e2:       60 91 03 01     lds     r22, 0x0103
    35e6:       23 e0           ldi     r18, 0x03       ; 3
    35e8:       30 e0           ldi     r19, 0x00       ; 0
    35ea:       00 e0           ldi     r16, 0x00       ; 0
    35ec:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
        if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
    35f0:       80 91 5d 01     lds     r24, 0x015D
    35f4:       90 91 5e 01     lds     r25, 0x015E
    35f8:       40 91 19 01     lds     r20, 0x0119
    35fc:       24 2f           mov     r18, r20
    35fe:       30 e0           ldi     r19, 0x00       ; 0
    3600:       28 17           cp      r18, r24
    3602:       39 07           cpc     r19, r25
    3604:       28 f0           brcs    .+10            ; 0x3610 <osd_fcmode_jopl+0x1aa>
    3606:       80 91 00 01     lds     r24, 0x0100
    360a:       48 17           cp      r20, r24
    360c:       08 f4           brcc    .+2             ; 0x3610 <osd_fcmode_jopl+0x1aa>
    360e:       92 c0           rjmp    .+292           ; 0x3734 <osd_fcmode_jopl+0x2ce>
            for (uint8_t x = 2; x < 8; x++)
                write_char_att_xy(x, bottom_line, BLINK);
        } else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
    3610:       80 91 5d 01     lds     r24, 0x015D
    3614:       90 91 5e 01     lds     r25, 0x015E
    3618:       28 17           cp      r18, r24
    361a:       39 07           cpc     r19, r25
    361c:       40 f5           brcc    .+80            ; 0x366e <osd_fcmode_jopl+0x208>
    361e:       80 91 00 01     lds     r24, 0x0100
    3622:       84 17           cp      r24, r20
    3624:       20 f5           brcc    .+72            ; 0x366e <osd_fcmode_jopl+0x208>
            for (uint8_t x = 2; x < 8; x++)
                write_char_att_xy(x, bottom_line, 0);
    3626:       82 e0           ldi     r24, 0x02       ; 2
    3628:       60 91 03 01     lds     r22, 0x0103
    362c:       40 e0           ldi     r20, 0x00       ; 0
    362e:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3632:       83 e0           ldi     r24, 0x03       ; 3
    3634:       60 91 03 01     lds     r22, 0x0103
    3638:       40 e0           ldi     r20, 0x00       ; 0
    363a:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    363e:       84 e0           ldi     r24, 0x04       ; 4
    3640:       60 91 03 01     lds     r22, 0x0103
    3644:       40 e0           ldi     r20, 0x00       ; 0
    3646:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    364a:       85 e0           ldi     r24, 0x05       ; 5
    364c:       60 91 03 01     lds     r22, 0x0103
    3650:       40 e0           ldi     r20, 0x00       ; 0
    3652:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3656:       86 e0           ldi     r24, 0x06       ; 6
    3658:       60 91 03 01     lds     r22, 0x0103
    365c:       40 e0           ldi     r20, 0x00       ; 0
    365e:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3662:       87 e0           ldi     r24, 0x07       ; 7
    3664:       60 91 03 01     lds     r22, 0x0103
    3668:       40 e0           ldi     r20, 0x00       ; 0
    366a:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
        }

        // jopl ... Times
        write_time(8, bottom_line, uptime);
    366e:       40 91 12 01     lds     r20, 0x0112
    3672:       50 91 13 01     lds     r21, 0x0113
    3676:       88 e0           ldi     r24, 0x08       ; 8
    3678:       60 91 03 01     lds     r22, 0x0103
    367c:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>
        write_time(15, bottom_line, flytime_fc);
    3680:       40 91 16 01     lds     r20, 0x0116
    3684:       50 91 17 01     lds     r21, 0x0117
    3688:       8f e0           ldi     r24, 0x0F       ; 15
    368a:       60 91 03 01     lds     r22, 0x0103
    368e:       0e 94 3a 08     call    0x1074  ; 0x1074 <write_time>
        // write_ndigit_number_s(22, bottom_line, debugData.Analog[5], 5, 0);
        // end jopl

    }
    // remember last values
    last_UBat = debugData.Analog[9];
    3692:       80 91 5d 01     lds     r24, 0x015D
    3696:       90 91 5e 01     lds     r25, 0x015E
    369a:       80 93 00 01     sts     0x0100, r24
    last_RC_Quality = debugData.Analog[10];
    369e:       80 91 5f 01     lds     r24, 0x015F
    36a2:       90 91 60 01     lds     r25, 0x0160
    36a6:       80 93 01 01     sts     0x0101, r24
    debugData.Analog[28]);//
    debugData.Analog[29]);//
    debugData.Analog[30]);// GPS_Nick
    debugData.Analog[31]);// GPS_Roll
     */
    seconds_since_last_data = 0;
    36aa:       10 92 18 01     sts     0x0118, r1

    return 0;
}
    36ae:       80 e0           ldi     r24, 0x00       ; 0
    36b0:       90 e0           ldi     r25, 0x00       ; 0
    36b2:       1f 91           pop     r17
    36b4:       0f 91           pop     r16
    36b6:       08 95           ret

            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
        }

        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
    36b8:       80 91 01 01     lds     r24, 0x0101
    36bc:       85 36           cpi     r24, 0x65       ; 101
    36be:       08 f4           brcc    .+2             ; 0x36c2 <osd_fcmode_jopl+0x25c>
    36c0:       f0 ce           rjmp    .-544           ; 0x34a2 <osd_fcmode_jopl+0x3c>
    36c2:       17 e0           ldi     r17, 0x07       ; 7
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, BLINK);
    36c4:       81 2f           mov     r24, r17
    36c6:       60 91 02 01     lds     r22, 0x0102
    36ca:       4f e4           ldi     r20, 0x4F       ; 79
    36cc:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    36d0:       1f 5f           subi    r17, 0xFF       ; 255
            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
        }

        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
            for (uint8_t x = 0; x < 4; x++)
    36d2:       1b 30           cpi     r17, 0x0B       ; 11
    36d4:       b9 f7           brne    .-18            ; 0x36c4 <osd_fcmode_jopl+0x25e>
    36d6:       f1 ce           rjmp    .-542           ; 0x34ba <osd_fcmode_jopl+0x54>

int osd_fcmode_jopl() {
    if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
        // write icons at init or after menu/mode-switch
        if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
            write_char_xy(10, top_line, 0xCA); // RC-transmitter
    36d8:       8a e0           ldi     r24, 0x0A       ; 10
    36da:       60 91 02 01     lds     r22, 0x0102
    36de:       4a ec           ldi     r20, 0xCA       ; 202
    36e0:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

            // jopl ... compass
            write_char_xy(16, top_line, 0xD0); // degree symbol
    36e4:       80 e1           ldi     r24, 0x10       ; 16
    36e6:       60 91 02 01     lds     r22, 0x0102
    36ea:       40 ed           ldi     r20, 0xD0       ; 208
    36ec:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
            // end jopl

            write_char_xy(26, top_line, 0xCC); // small meters m height
    36f0:       8a e1           ldi     r24, 0x1A       ; 26
    36f2:       60 91 02 01     lds     r22, 0x0102
    36f6:       4c ec           ldi     r20, 0xCC       ; 204
    36f8:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
            write_char_xy(7, bottom_line, 0x9E); // small v
    36fc:       87 e0           ldi     r24, 0x07       ; 7
    36fe:       60 91 03 01     lds     r22, 0x0103
    3702:       4e e9           ldi     r20, 0x9E       ; 158
    3704:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>

            if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
    3708:       80 91 1d 01     lds     r24, 0x011D
    370c:       80 fd           sbrc    r24, 0
    370e:       a7 c0           rjmp    .+334           ; 0x385e <osd_fcmode_jopl+0x3f8>
                    write_char_xy(21, bottom_line - 1, 0x9E); // small V
                }
            }

            // jopl ... Times
            write_char_xy(14, bottom_line, 0xD1); // on clock
    3710:       8e e0           ldi     r24, 0x0E       ; 14
    3712:       60 91 03 01     lds     r22, 0x0103
    3716:       41 ed           ldi     r20, 0xD1       ; 209
    3718:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
            write_char_xy(21, bottom_line, 0xD2); // fly clock
    371c:       85 e1           ldi     r24, 0x15       ; 21
    371e:       60 91 03 01     lds     r22, 0x0103
    3722:       42 ed           ldi     r20, 0xD2       ; 210
    3724:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
            // end jopl

            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
    3728:       80 91 1d 01     lds     r24, 0x011D
    372c:       82 60           ori     r24, 0x02       ; 2
    372e:       80 93 1d 01     sts     0x011D, r24
    3732:       a3 ce           rjmp    .-698           ; 0x347a <osd_fcmode_jopl+0x14>

        draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
        write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 3, 0);
        if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
            for (uint8_t x = 2; x < 8; x++)
                write_char_att_xy(x, bottom_line, BLINK);
    3734:       82 e0           ldi     r24, 0x02       ; 2
    3736:       60 91 03 01     lds     r22, 0x0103
    373a:       4f e4           ldi     r20, 0x4F       ; 79
    373c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3740:       83 e0           ldi     r24, 0x03       ; 3
    3742:       60 91 03 01     lds     r22, 0x0103
    3746:       4f e4           ldi     r20, 0x4F       ; 79
    3748:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    374c:       84 e0           ldi     r24, 0x04       ; 4
    374e:       60 91 03 01     lds     r22, 0x0103
    3752:       4f e4           ldi     r20, 0x4F       ; 79
    3754:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3758:       85 e0           ldi     r24, 0x05       ; 5
    375a:       60 91 03 01     lds     r22, 0x0103
    375e:       4f e4           ldi     r20, 0x4F       ; 79
    3760:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3764:       86 e0           ldi     r24, 0x06       ; 6
    3766:       60 91 03 01     lds     r22, 0x0103
    376a:       4f e4           ldi     r20, 0x4F       ; 79
    376c:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    3770:       87 e0           ldi     r24, 0x07       ; 7
    3772:       60 91 03 01     lds     r22, 0x0103
    3776:       4f e4           ldi     r20, 0x4F       ; 79
    3778:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    377c:       78 cf           rjmp    .-272           ; 0x366e <osd_fcmode_jopl+0x208>

        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, BLINK);
        } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
    377e:       17 e0           ldi     r17, 0x07       ; 7
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, 0);
    3780:       81 2f           mov     r24, r17
    3782:       60 91 02 01     lds     r22, 0x0102
    3786:       40 e0           ldi     r20, 0x00       ; 0
    3788:       0e 94 91 08     call    0x1122  ; 0x1122 <write_char_att_xy>
    378c:       1f 5f           subi    r17, 0xFF       ; 255
        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
            for (uint8_t x = 0; x < 4; x++)
                write_char_att_xy(7 + x, top_line, BLINK);
        } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
            for (uint8_t x = 0; x < 4; x++)
    378e:       1b 30           cpi     r17, 0x0B       ; 11
    3790:       b9 f7           brne    .-18            ; 0x3780 <osd_fcmode_jopl+0x31a>
    3792:       93 ce           rjmp    .-730           ; 0x34ba <osd_fcmode_jopl+0x54>
        // end jopl

        // pre-bottom line
        if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
            //write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
            write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
    3794:       20 91 03 01     lds     r18, 0x0103
    3798:       21 50           subi    r18, 0x01       ; 1
    379a:       80 91 37 01     lds     r24, 0x0137
    379e:       90 91 38 01     lds     r25, 0x0138
    37a2:       6a e0           ldi     r22, 0x0A       ; 10
    37a4:       70 e0           ldi     r23, 0x00       ; 0
    37a6:       0e 94 7c 1c     call    0x38f8  ; 0x38f8 <__divmodhi4>
    37aa:       ab 01           movw    r20, r22
    37ac:       83 e0           ldi     r24, 0x03       ; 3
    37ae:       62 2f           mov     r22, r18
    37b0:       23 e0           ldi     r18, 0x03       ; 3
    37b2:       30 e0           ldi     r19, 0x00       ; 0
    37b4:       00 e0           ldi     r16, 0x00       ; 0
    37b6:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
            write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
    37ba:       10 91 03 01     lds     r17, 0x0103
    37be:       11 50           subi    r17, 0x01       ; 1
    37c0:       60 91 3b 01     lds     r22, 0x013B
    37c4:       70 91 3c 01     lds     r23, 0x013C
    37c8:       80 91 3d 01     lds     r24, 0x013D
    37cc:       90 91 3e 01     lds     r25, 0x013E
    37d0:       2a e0           ldi     r18, 0x0A       ; 10
    37d2:       30 e0           ldi     r19, 0x00       ; 0
    37d4:       40 e0           ldi     r20, 0x00       ; 0
    37d6:       50 e0           ldi     r21, 0x00       ; 0
    37d8:       0e 94 b1 1c     call    0x3962  ; 0x3962 <__divmodsi4>
    37dc:       8a e0           ldi     r24, 0x0A       ; 10
    37de:       61 2f           mov     r22, r17
    37e0:       a9 01           movw    r20, r18
    37e2:       24 e0           ldi     r18, 0x04       ; 4
    37e4:       30 e0           ldi     r19, 0x00       ; 0
    37e6:       0e 94 19 07     call    0xe32   ; 0xe32 <write_ndigit_number_s>
            if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    37ea:       80 91 1b 01     lds     r24, 0x011B
    37ee:       85 ff           sbrs    r24, 5
    37f0:       e6 ce           rjmp    .-564           ; 0x35be <osd_fcmode_jopl+0x158>
                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
    37f2:       60 91 03 01     lds     r22, 0x0103
    37f6:       61 50           subi    r22, 0x01       ; 1
    37f8:       40 91 9f 02     lds     r20, 0x029F
    37fc:       50 91 a0 02     lds     r21, 0x02A0
    3800:       81 e1           ldi     r24, 0x11       ; 17
    3802:       23 e0           ldi     r18, 0x03       ; 3
    3804:       30 e0           ldi     r19, 0x00       ; 0
    3806:       0e 94 76 06     call    0xcec   ; 0xcec <write_ndigit_number_u_10th>
    380a:       d9 ce           rjmp    .-590           ; 0x35be <osd_fcmode_jopl+0x158>
        // end jopl

        if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];

        if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
            draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
    380c:       40 91 4b 01     lds     r20, 0x014B
    3810:       50 91 4c 01     lds     r21, 0x014C
    3814:       20 91 4d 01     lds     r18, 0x014D
    3818:       30 91 4e 01     lds     r19, 0x014E
    381c:       80 91 02 01     lds     r24, 0x0102
    3820:       60 91 03 01     lds     r22, 0x0103
    3824:       61 50           subi    r22, 0x01       ; 1
    3826:       8e 5f           subi    r24, 0xFE       ; 254
    3828:       0e 94 e6 08     call    0x11cc  ; 0x11cc <draw_artificial_horizon>
    382c:       ba ce           rjmp    .-652           ; 0x35a2 <osd_fcmode_jopl+0x13c>
            write_ndigit_number_s_10th(22, top_line, debugData.Analog[5], 3, 0);
        }
        Vario = debugData.Analog[5] - last_Altimeter;
        draw_variometer(27, top_line, Vario);
        if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
            draw_big_variometer(27, 8, Vario);
    382e:       40 91 45 01     lds     r20, 0x0145
    3832:       50 91 46 01     lds     r21, 0x0146
    3836:       8b e1           ldi     r24, 0x1B       ; 27
    3838:       68 e0           ldi     r22, 0x08       ; 8
    383a:       0e 94 84 0a     call    0x1508  ; 0x1508 <draw_big_variometer>
    383e:       40 91 1b 01     lds     r20, 0x011B
    3842:       92 ce           rjmp    .-732           ; 0x3568 <osd_fcmode_jopl+0x102>
        if ((debugData.Analog[5] > 100) || (debugData.Analog[5] < -100)) {
            // above 10m only write full meters
            write_ndigit_number_s(22, top_line, debugData.Analog[5] / 10, 4, 0);
        } else {
            // up to 10m write meters.dm
            write_ndigit_number_s_10th(22, top_line, debugData.Analog[5], 3, 0);
    3844:       40 91 55 01     lds     r20, 0x0155
    3848:       50 91 56 01     lds     r21, 0x0156
    384c:       86 e1           ldi     r24, 0x16       ; 22
    384e:       60 91 02 01     lds     r22, 0x0102
    3852:       23 e0           ldi     r18, 0x03       ; 3
    3854:       30 e0           ldi     r19, 0x00       ; 0
    3856:       00 e0           ldi     r16, 0x00       ; 0
    3858:       0e 94 d3 05     call    0xba6   ; 0xba6 <write_ndigit_number_s_10th>
    385c:       6e ce           rjmp    .-804           ; 0x353a <osd_fcmode_jopl+0xd4>

            write_char_xy(26, top_line, 0xCC); // small meters m height
            write_char_xy(7, bottom_line, 0x9E); // small v

            if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
                write_char_xy(7, bottom_line - 1, 0x9F); // small A
    385e:       60 91 03 01     lds     r22, 0x0103
    3862:       61 50           subi    r22, 0x01       ; 1
    3864:       87 e0           ldi     r24, 0x07       ; 7
    3866:       4f e9           ldi     r20, 0x9F       ; 159
    3868:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                write_char_xy(14, bottom_line - 1, 0xB5); // mah
    386c:       60 91 03 01     lds     r22, 0x0103
    3870:       61 50           subi    r22, 0x01       ; 1
    3872:       8e e0           ldi     r24, 0x0E       ; 14
    3874:       45 eb           ldi     r20, 0xB5       ; 181
    3876:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
                if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
    387a:       80 91 1b 01     lds     r24, 0x011B
    387e:       85 ff           sbrs    r24, 5
    3880:       47 cf           rjmp    .-370           ; 0x3710 <osd_fcmode_jopl+0x2aa>
                    write_char_xy(21, bottom_line - 1, 0x9E); // small V
    3882:       60 91 03 01     lds     r22, 0x0103
    3886:       61 50           subi    r22, 0x01       ; 1
    3888:       85 e1           ldi     r24, 0x15       ; 21
    388a:       4e e9           ldi     r20, 0x9E       ; 158
    388c:       0e 94 04 05     call    0xa08   ; 0xa08 <write_char_xy>
    3890:       3f cf           rjmp    .-386           ; 0x3710 <osd_fcmode_jopl+0x2aa>

00003892 <__mulsi3>:
    3892:       62 9f           mul     r22, r18
    3894:       d0 01           movw    r26, r0
    3896:       73 9f           mul     r23, r19
    3898:       f0 01           movw    r30, r0
    389a:       82 9f           mul     r24, r18
    389c:       e0 0d           add     r30, r0
    389e:       f1 1d           adc     r31, r1
    38a0:       64 9f           mul     r22, r20
    38a2:       e0 0d           add     r30, r0
    38a4:       f1 1d           adc     r31, r1
    38a6:       92 9f           mul     r25, r18
    38a8:       f0 0d           add     r31, r0
    38aa:       83 9f           mul     r24, r19
    38ac:       f0 0d           add     r31, r0
    38ae:       74 9f           mul     r23, r20
    38b0:       f0 0d           add     r31, r0
    38b2:       65 9f           mul     r22, r21
    38b4:       f0 0d           add     r31, r0
    38b6:       99 27           eor     r25, r25
    38b8:       72 9f           mul     r23, r18
    38ba:       b0 0d           add     r27, r0
    38bc:       e1 1d           adc     r30, r1
    38be:       f9 1f           adc     r31, r25
    38c0:       63 9f           mul     r22, r19
    38c2:       b0 0d           add     r27, r0
    38c4:       e1 1d           adc     r30, r1
    38c6:       f9 1f           adc     r31, r25
    38c8:       bd 01           movw    r22, r26
    38ca:       cf 01           movw    r24, r30
    38cc:       11 24           eor     r1, r1
    38ce:       08 95           ret

000038d0 <__udivmodhi4>:
    38d0:       aa 1b           sub     r26, r26
    38d2:       bb 1b           sub     r27, r27
    38d4:       51 e1           ldi     r21, 0x11       ; 17
    38d6:       07 c0           rjmp    .+14            ; 0x38e6 <__udivmodhi4_ep>

000038d8 <__udivmodhi4_loop>:
    38d8:       aa 1f           adc     r26, r26
    38da:       bb 1f           adc     r27, r27
    38dc:       a6 17           cp      r26, r22
    38de:       b7 07           cpc     r27, r23
    38e0:       10 f0           brcs    .+4             ; 0x38e6 <__udivmodhi4_ep>
    38e2:       a6 1b           sub     r26, r22
    38e4:       b7 0b           sbc     r27, r23

000038e6 <__udivmodhi4_ep>:
    38e6:       88 1f           adc     r24, r24
    38e8:       99 1f           adc     r25, r25
    38ea:       5a 95           dec     r21
    38ec:       a9 f7           brne    .-22            ; 0x38d8 <__udivmodhi4_loop>
    38ee:       80 95           com     r24
    38f0:       90 95           com     r25
    38f2:       bc 01           movw    r22, r24
    38f4:       cd 01           movw    r24, r26
    38f6:       08 95           ret

000038f8 <__divmodhi4>:
    38f8:       97 fb           bst     r25, 7
    38fa:       09 2e           mov     r0, r25
    38fc:       07 26           eor     r0, r23
    38fe:       0a d0           rcall   .+20            ; 0x3914 <__divmodhi4_neg1>
    3900:       77 fd           sbrc    r23, 7
    3902:       04 d0           rcall   .+8             ; 0x390c <__divmodhi4_neg2>
    3904:       e5 df           rcall   .-54            ; 0x38d0 <__udivmodhi4>
    3906:       06 d0           rcall   .+12            ; 0x3914 <__divmodhi4_neg1>
    3908:       00 20           and     r0, r0
    390a:       1a f4           brpl    .+6             ; 0x3912 <__divmodhi4_exit>

0000390c <__divmodhi4_neg2>:
    390c:       70 95           com     r23
    390e:       61 95           neg     r22
    3910:       7f 4f           sbci    r23, 0xFF       ; 255

00003912 <__divmodhi4_exit>:
    3912:       08 95           ret

00003914 <__divmodhi4_neg1>:
    3914:       f6 f7           brtc    .-4             ; 0x3912 <__divmodhi4_exit>
    3916:       90 95           com     r25
    3918:       81 95           neg     r24
    391a:       9f 4f           sbci    r25, 0xFF       ; 255
    391c:       08 95           ret

0000391e <__udivmodsi4>:
    391e:       a1 e2           ldi     r26, 0x21       ; 33
    3920:       1a 2e           mov     r1, r26
    3922:       aa 1b           sub     r26, r26
    3924:       bb 1b           sub     r27, r27
    3926:       fd 01           movw    r30, r26
    3928:       0d c0           rjmp    .+26            ; 0x3944 <__udivmodsi4_ep>

0000392a <__udivmodsi4_loop>:
    392a:       aa 1f           adc     r26, r26
    392c:       bb 1f           adc     r27, r27
    392e:       ee 1f           adc     r30, r30
    3930:       ff 1f           adc     r31, r31
    3932:       a2 17           cp      r26, r18
    3934:       b3 07           cpc     r27, r19
    3936:       e4 07           cpc     r30, r20
    3938:       f5 07           cpc     r31, r21
    393a:       20 f0           brcs    .+8             ; 0x3944 <__udivmodsi4_ep>
    393c:       a2 1b           sub     r26, r18
    393e:       b3 0b           sbc     r27, r19
    3940:       e4 0b           sbc     r30, r20
    3942:       f5 0b           sbc     r31, r21

00003944 <__udivmodsi4_ep>:
    3944:       66 1f           adc     r22, r22
    3946:       77 1f           adc     r23, r23
    3948:       88 1f           adc     r24, r24
    394a:       99 1f           adc     r25, r25
    394c:       1a 94           dec     r1
    394e:       69 f7           brne    .-38            ; 0x392a <__udivmodsi4_loop>
    3950:       60 95           com     r22
    3952:       70 95           com     r23
    3954:       80 95           com     r24
    3956:       90 95           com     r25
    3958:       9b 01           movw    r18, r22
    395a:       ac 01           movw    r20, r24
    395c:       bd 01           movw    r22, r26
    395e:       cf 01           movw    r24, r30
    3960:       08 95           ret

00003962 <__divmodsi4>:
    3962:       97 fb           bst     r25, 7
    3964:       09 2e           mov     r0, r25
    3966:       05 26           eor     r0, r21
    3968:       0e d0           rcall   .+28            ; 0x3986 <__divmodsi4_neg1>
    396a:       57 fd           sbrc    r21, 7
    396c:       04 d0           rcall   .+8             ; 0x3976 <__divmodsi4_neg2>
    396e:       d7 df           rcall   .-82            ; 0x391e <__udivmodsi4>
    3970:       0a d0           rcall   .+20            ; 0x3986 <__divmodsi4_neg1>
    3972:       00 1c           adc     r0, r0
    3974:       38 f4           brcc    .+14            ; 0x3984 <__divmodsi4_exit>

00003976 <__divmodsi4_neg2>:
    3976:       50 95           com     r21
    3978:       40 95           com     r20
    397a:       30 95           com     r19
    397c:       21 95           neg     r18
    397e:       3f 4f           sbci    r19, 0xFF       ; 255
    3980:       4f 4f           sbci    r20, 0xFF       ; 255
    3982:       5f 4f           sbci    r21, 0xFF       ; 255

00003984 <__divmodsi4_exit>:
    3984:       08 95           ret

00003986 <__divmodsi4_neg1>:
    3986:       f6 f7           brtc    .-4             ; 0x3984 <__divmodsi4_exit>
    3988:       90 95           com     r25
    398a:       80 95           com     r24
    398c:       70 95           com     r23
    398e:       61 95           neg     r22
    3990:       7f 4f           sbci    r23, 0xFF       ; 255
    3992:       8f 4f           sbci    r24, 0xFF       ; 255
    3994:       9f 4f           sbci    r25, 0xFF       ; 255
    3996:       08 95           ret

00003998 <itoa>:
    3998:       fb 01           movw    r30, r22
    399a:       9f 01           movw    r18, r30
    399c:       e8 94           clt
    399e:       42 30           cpi     r20, 0x02       ; 2
    39a0:       c4 f0           brlt    .+48            ; 0x39d2 <itoa+0x3a>
    39a2:       45 32           cpi     r20, 0x25       ; 37
    39a4:       b4 f4           brge    .+44            ; 0x39d2 <itoa+0x3a>
    39a6:       4a 30           cpi     r20, 0x0A       ; 10
    39a8:       29 f4           brne    .+10            ; 0x39b4 <itoa+0x1c>
    39aa:       97 fb           bst     r25, 7
    39ac:       1e f4           brtc    .+6             ; 0x39b4 <itoa+0x1c>
    39ae:       90 95           com     r25
    39b0:       81 95           neg     r24
    39b2:       9f 4f           sbci    r25, 0xFF       ; 255
    39b4:       64 2f           mov     r22, r20
    39b6:       77 27           eor     r23, r23
    39b8:       0e 94 68 1c     call    0x38d0  ; 0x38d0 <__udivmodhi4>
    39bc:       80 5d           subi    r24, 0xD0       ; 208
    39be:       8a 33           cpi     r24, 0x3A       ; 58
    39c0:       0c f0           brlt    .+2             ; 0x39c4 <itoa+0x2c>
    39c2:       89 5d           subi    r24, 0xD9       ; 217
    39c4:       81 93           st      Z+, r24
    39c6:       cb 01           movw    r24, r22
    39c8:       00 97           sbiw    r24, 0x00       ; 0
    39ca:       a1 f7           brne    .-24            ; 0x39b4 <itoa+0x1c>
    39cc:       16 f4           brtc    .+4             ; 0x39d2 <itoa+0x3a>
    39ce:       5d e2           ldi     r21, 0x2D       ; 45
    39d0:       51 93           st      Z+, r21
    39d2:       10 82           st      Z, r1
    39d4:       c9 01           movw    r24, r18
    39d6:       0c 94 02 1d     jmp     0x3a04  ; 0x3a04 <strrev>

000039da <__eerd_byte_m162>:
    39da:       e1 99           sbic    0x1c, 1 ; 28
    39dc:       fe cf           rjmp    .-4             ; 0x39da <__eerd_byte_m162>
    39de:       9f bb           out     0x1f, r25       ; 31
    39e0:       8e bb           out     0x1e, r24       ; 30
    39e2:       e0 9a           sbi     0x1c, 0 ; 28
    39e4:       99 27           eor     r25, r25
    39e6:       8d b3           in      r24, 0x1d       ; 29
    39e8:       08 95           ret

000039ea <__eewr_byte_m162>:
    39ea:       26 2f           mov     r18, r22

000039ec <__eewr_r18_m162>:
    39ec:       e1 99           sbic    0x1c, 1 ; 28
    39ee:       fe cf           rjmp    .-4             ; 0x39ec <__eewr_r18_m162>
    39f0:       9f bb           out     0x1f, r25       ; 31
    39f2:       8e bb           out     0x1e, r24       ; 30
    39f4:       2d bb           out     0x1d, r18       ; 29
    39f6:       0f b6           in      r0, 0x3f        ; 63
    39f8:       f8 94           cli
    39fa:       e2 9a           sbi     0x1c, 2 ; 28
    39fc:       e1 9a           sbi     0x1c, 1 ; 28
    39fe:       0f be           out     0x3f, r0        ; 63
    3a00:       01 96           adiw    r24, 0x01       ; 1
    3a02:       08 95           ret

00003a04 <strrev>:
    3a04:       dc 01           movw    r26, r24
    3a06:       fc 01           movw    r30, r24
    3a08:       67 2f           mov     r22, r23
    3a0a:       71 91           ld      r23, Z+
    3a0c:       77 23           and     r23, r23
    3a0e:       e1 f7           brne    .-8             ; 0x3a08 <strrev+0x4>
    3a10:       32 97           sbiw    r30, 0x02       ; 2
    3a12:       04 c0           rjmp    .+8             ; 0x3a1c <strrev+0x18>
    3a14:       7c 91           ld      r23, X
    3a16:       6d 93           st      X+, r22
    3a18:       70 83           st      Z, r23
    3a1a:       62 91           ld      r22, -Z
    3a1c:       ae 17           cp      r26, r30
    3a1e:       bf 07           cpc     r27, r31
    3a20:       c8 f3           brcs    .-14            ; 0x3a14 <strrev+0x10>
    3a22:       08 95           ret

00003a24 <_exit>:
    3a24:       f8 94           cli

00003a26 <__stop_program>:
    3a26:       ff cf           rjmp    .-2             ; 0x3a26 <__stop_program>