// File: jkingan[P]ladyheather/heather.cpp
// Function: do_gps()
void do_gps()
{
int i;

   while(1) {    // the main processing loop...  repeat until exit requested
      x11_resize_check();     // see if screen has been re-sized

      fake_second_check(2);   // see if we should fake a missing time stamp second
      fine_tick_check();      // doing synchonized audible tick clock

      if(first_key) ;         // dont redraw screen while keyboard menu active
      else if(need_redraw) {
//sprintf(plot_title, "need redraw:%d", need_redraw);
         redraw_screen();
      }

      if(force_dump && unit_file_name) {   // forced screen dump
         dump_screen(invert_dump, 0, unit_file_name);
      }
      force_dump = 0;

      if(!serve_gps(0)) {  // time to exit the progaam
         break;
      }
      got_timing_msg = 0;  // used to prevent keyboard lockout if data comming in at high nav rates

      if(f11_flag) {  //// !!!! debug
         f11_flag = 0;
      }

      if(script_file && (script_pause == 0)) {  // reading chars from script file
         system_busy = 3;
         while(script_file) {  // process a full line of commands
            i = process_script_file();
            if((i == 0) || (i == 0x0D)) break;
            update_pwm();
         }
      }
      else if(force_si_cmd) {
         system_busy = 4;
         do_kbd('a');
      }
      else if(tide_kbd_cmd) {
         system_busy = 5;
         do_kbd('a');
      }
      else if(KBHIT()) {   // key pressed
         system_busy = 6;
         i = get_kbd();    // get the keyboard character
         i = do_kbd(i);    // process the character
         if(i) break;      // it's time to stop this madness
      }
      else if(sim_file && (sim_eof == 0)) {  // allow fast simulation file processing... use /sw if throttling or sleep needed
      }
      else if(idle_sleep && (set_system_time == 0)) {  // sleep a while when we are not busy to keep cpu usage down
         Sleep(idle_sleep);
      }

      process_extra_ports(6);  // handle data from extra serial ports

      // screen saver keyboard idle time check
      idle_time = (jd_utc - last_kbd_jd) * (24.0 * 60.0);
// sprintf(debug_text, "idle_timeout:%d  idle_time:%g  screen:%c  fk:%d", idle_timeout, idle_time*60.0, idle_screen, first_key);
      if(idle_timeout && idle_screen  && (zoom_screen == 0) && (first_key == 0)) {
         if((int) idle_time >= idle_timeout) {  // zoom to digital clock display
            add_kbd('Z');
            add_kbd(idle_screen);
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x2cf70
movl $0x2, %edi
callq 0xc61e0
callq 0x2bcd0
cmpl $0x0, 0x270e95(%rip)    # 0x29e138
je 0x2d2a7
jmp 0x2d2b7
cmpl $0x0, 0x24a776(%rip)    # 0x277a24
je 0x2d2b5
callq 0x12ae0
jmp 0x2d2b7
cmpl $0x0, 0x24a75a(%rip)    # 0x277a18
je 0x2d2de
cmpq $0x0, 0x1a2ba0(%rip)    # 0x1cfe68
je 0x2d2de
movl 0x24a744(%rip), %edi    # 0x277a14
movq 0x1a2b91(%rip), %rdx    # 0x1cfe68
xorl %esi, %esi
callq 0x12810
movl $0x0, 0x24a730(%rip)    # 0x277a18
xorl %edi, %edi
callq 0x27360
cmpl $0x0, %eax
jne 0x2d2f9
jmp 0x2d48d
movl $0x0, 0x33f319(%rip)    # 0x36c61c
cmpl $0x0, 0x371dd6(%rip)    # 0x39f0e0
je 0x2d316
movl $0x0, 0x371dca(%rip)    # 0x39f0e0
cmpq $0x0, 0x270d7a(%rip)    # 0x29e098
je 0x2d35f
movzbl 0x270d89(%rip), %eax    # 0x29e0b0
cmpl $0x0, %eax
jne 0x2d35f
movb $0x3, 0x368ed5(%rip)    # 0x396208
cmpq $0x0, 0x270d5d(%rip)    # 0x29e098
je 0x2d35a
callq 0x29850
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x2d351
cmpl $0xd, -0x4(%rbp)
jne 0x2d353
jmp 0x2d35a
callq 0x11ee60
jmp 0x2d333
jmp 0x2d40b
cmpl $0x0, 0x24d0a6(%rip)    # 0x27a40c
je 0x2d37e
movb $0x4, 0x368e99(%rip)    # 0x396208
movl $0x61, %edi
callq 0x62a60
jmp 0x2d409
cmpb $0x0, 0x24d08b(%rip)    # 0x27a410
je 0x2d39a
movb $0x5, 0x368e7a(%rip)    # 0x396208
movl $0x61, %edi
callq 0x62a60
jmp 0x2d407
callq 0xf3d0
cmpl $0x0, %eax
je 0x2d3cb
movb $0x6, 0x368e5d(%rip)    # 0x396208
callq 0xf3f0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
callq 0x62a60
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x2d3c9
jmp 0x2d48d
jmp 0x2d405
cmpq $0x0, 0x2701cd(%rip)    # 0x29d5a0
je 0x2d3e0
cmpl $0x0, 0x2701dc(%rip)    # 0x29d5b8
jne 0x2d3e0
jmp 0x2d403
cmpq $0x0, 0x2553f0(%rip)    # 0x2827d8
je 0x2d401
cmpl $0x0, 0x33fca7(%rip)    # 0x36d098
jne 0x2d401
movq 0x2553de(%rip), %rax    # 0x2827d8
movl %eax, %edi
callq 0xb8b0
jmp 0x2d403
jmp 0x2d405
jmp 0x2d407
jmp 0x2d409
jmp 0x2d40b
movl $0x6, %edi
callq 0x2b510
movsd 0x33f2f3(%rip), %xmm0   # 0x36c710
subsd 0x33f34b(%rip), %xmm0   # 0x36c770
movsd 0x141e4b(%rip), %xmm1   # 0x16f278
mulsd %xmm1, %xmm0
movsd %xmm0, 0x33f347(%rip)   # 0x36c780
cmpl $0x0, 0x33f348(%rip)    # 0x36c788
je 0x2d488
cmpb $0x0, 0x33f343(%rip)    # 0x36c78c
je 0x2d488
movzbl 0x33e536(%rip), %eax    # 0x36b988
cmpl $0x0, %eax
jne 0x2d488
cmpl $0x0, 0x270cda(%rip)    # 0x29e138
jne 0x2d488
cvttsd2si 0x33f318(%rip), %eax # 0x36c780
cmpl 0x33f31a(%rip), %eax    # 0x36c788
jl 0x2d486
movl $0x5a, %edi
callq 0xf320
movzbl 0x33f30b(%rip), %edi    # 0x36c78c
callq 0xf320
jmp 0x2d488
jmp 0x2d288
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)