// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_pvt()
void parse_nvs_pvt()
{
u08 status;
double msecs;
int week;
double lat_speed;
double lon_speed;
double alt_speed;
double gen_dev;
double jd;

   // 0x88 packet
   log_packet_id("nvs_pvt");

   lat = tsip_double();
   lon = tsip_double();
   alt = tsip_double();

   tsip_single(); // RMS posn err
   msecs = tsip_fp80();       // time stamp msecs
   week = tsip_word();        // gps week
   lat_speed = tsip_double(); // lat speed
   lon_speed = tsip_double(); // lon speed
   alt_speed = tsip_double(); // alt speed
   gen_dev = (double) tsip_single(); // ref gen deviation (msecs/sec)
   status = tsip_byte();  // !!!! has 2D flag qqqqqq

   pps_offset = gen_dev * 1.0E6; 
   have_pps_offset = 2;
   have_rcvr_pps = 2;
   faked_tow = 0;
//adadad   if(jitter_adev == 0) do_pps_adev(pps_offset);

   if(week >= 0) {
      gps_week = fix_nvs_week(week);
      if(have_week == 0) need_redraw = 2007;
      have_week = 222;
   }

   pri_tow = tow = this_tow = (int) (msecs / 1000.0);
   if(have_tow == 0) need_redraw = 2008;
   have_tow = 222;
   survey_tow = tow;


   jd = msecs / 1000.0;
   
   jd /= (24.0*60.0*60.0);
   jd += jdate(1999,8,22);
   jd += (week * 7.0);

   set_gregorian_time(jd);

   if(timing_mode == TMODE_GPS) {  // we want UTC time - convert gps time to utc
      utc_to_gps();
   }

   update_gps_screen(1222); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0xa46d2(%rip), %rdi     # 0x189341
callq 0x7add0
callq 0x7a9d0
leaq 0x287530(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
callq 0x7a9d0
leaq 0x287528(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
callq 0x7a9d0
leaq 0x287520(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
callq 0x7a860
callq 0x7aa80
movsd %xmm0, -0x10(%rbp)
callq 0x7a560
movzwl %ax, %eax
movl %eax, -0x14(%rbp)
callq 0x7a9d0
movsd %xmm0, -0x20(%rbp)
callq 0x7a9d0
movsd %xmm0, -0x28(%rbp)
callq 0x7a9d0
movsd %xmm0, -0x30(%rbp)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x7a510
movb %al, -0x1(%rbp)
movsd 0x8a346(%rip), %xmm0    # 0x16f040
mulsd -0x38(%rbp), %xmm0
leaq 0x286c92(%rip), %rax    # 0x36b998
movsd %xmm0, (%rax)
leaq 0x287707(%rip), %rax    # 0x36c418
movl $0x2, (%rax)
leaq 0x287706(%rip), %rax    # 0x36c424
movl $0x2, (%rax)
leaq 0x287bfd(%rip), %rax    # 0x36c928
movl $0x0, (%rax)
cmpl $0x0, -0x14(%rbp)
jl 0xe4d72
movl -0x14(%rbp), %edi
callq 0xe4bd0
movw %ax, %cx
leaq 0x287bcf(%rip), %rax    # 0x36c918
movw %cx, (%rax)
leaq 0x2877b9(%rip), %rax    # 0x36c50c
cmpl $0x0, (%rax)
jne 0xe4d65
leaq 0x192cc5(%rip), %rax    # 0x277a24
movl $0x7d7, (%rax)          # imm = 0x7D7
leaq 0x2877a0(%rip), %rax    # 0x36c50c
movl $0xde, (%rax)
movsd -0x10(%rbp), %xmm0
movsd 0x8a2b1(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
leaq 0x287b92(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x287b85(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x287b84(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
leaq 0x28775f(%rip), %rax    # 0x36c508
cmpl $0x0, (%rax)
jne 0xe4dbb
leaq 0x192c6f(%rip), %rax    # 0x277a24
movl $0x7d8, (%rax)          # imm = 0x7D8
leaq 0x287746(%rip), %rax    # 0x36c508
movl $0xde, (%rax)
leaq 0x287b4d(%rip), %rax    # 0x36c91c
movl (%rax), %eax
movl %eax, %ecx
leaq 0x287b56(%rip), %rax    # 0x36c930
movq %rcx, (%rax)
movsd -0x10(%rbp), %xmm0
movsd 0x8a246(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
movsd 0x8a208(%rip), %xmm1    # 0x16f008
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x7cf, %edi            # imm = 0x7CF
movl $0x8, %esi
movl $0x16, %edx
callq 0x122140
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movsd 0x8c84f(%rip), %xmm2    # 0x171688
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x7fb00
leaq 0x287846(%rip), %rax    # 0x36c69d
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xe4e64
callq 0x7fc70
movl $0x4c6, %edi            # imm = 0x4C6
callq 0x9d790
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)