// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_venus_status()
void parse_venus_status()
{
u08 sub_code;
int def_ofs;
int cur_ofs;
int flags;
u08 jam_status;
u32 tow;
u08 flash_status;
u08 flash_type;

   // message type 0x64 responses

   sub_code = tsip_byte();
   if(sub_code == 0x80) {  // boot status
      log_packet_id("venus boot status");
      flash_status = tsip_byte();
      flash_type = tsip_byte();
      if(flash_status != 0) {
         critical_alarms |= CRIT_ROM;
      }
      else { 
         critical_alarms &= (~CRIT_ROM);
      }
      if(!have_critical_alarms) need_redraw = 7702;
      have_critical_alarms = 2;
   }
   else if(sub_code == 0x83) {  // jamming mode
      log_packet_id("venus jamming mode");
      foliage_mode = tsip_byte();
      jam_status = tsip_byte();
   }
   else if(sub_code == 0x8C) {  // GNSS system selection mask
      log_packet_id("venus gnss selection");
      gnss_mask = tsip_word();
      have_gnss_mask = 1;
//sprintf(plot_title, "gnss mask:%04X", gnss_mask); // ggggg
   }
   else if(sub_code == 0x8E) {  // utc offset
      log_packet_id("venus utc offset status");
      tow = tsip_dword(); // tow in msecs
      tsip_dword();       // tow fraction
      tsip_word();        // week
      def_ofs = (int) (s08) tsip_byte();  // gps offset default
      cur_ofs = (int) (s08) tsip_byte();  // gps offset current
      flags = tsip_byte();

      if(!user_set_utc_ofs && (flags & 0x04)) {
         utc_offset = cur_ofs;
         check_utc_ofs(6);
      }
   }
   else {
      log_packet_id("unsupported status subcode");
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
callq 0x7a510
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
cmpl $0x80, %eax
jne 0xce387
leaq 0xb99b9(%rip), %rdi     # 0x187ccb
callq 0x7add0
callq 0x7a510
movb %al, -0x19(%rbp)
callq 0x7a510
movb %al, -0x1a(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
je 0xce347
leaq 0x29e079(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x29e06d(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xce35c
leaq 0x29e062(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x2, %ecx
leaq 0x29e056(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x29e125(%rip), %rax    # 0x36c488
cmpl $0x0, (%rax)
jne 0xce375
leaq 0x1a96b5(%rip), %rax    # 0x277a24
movl $0x1e16, (%rax)         # imm = 0x1E16
leaq 0x29e10c(%rip), %rax    # 0x36c488
movl $0x2, (%rax)
jmp 0xce480
movzbl -0x1(%rbp), %eax
cmpl $0x83, %eax
jne 0xce3bb
leaq 0xb9944(%rip), %rdi     # 0x187cdd
callq 0x7add0
callq 0x7a510
movb %al, %cl
leaq 0x29def8(%rip), %rax    # 0x36c2a4
movb %cl, (%rax)
callq 0x7a510
movb %al, -0x11(%rbp)
jmp 0xce47e
movzbl -0x1(%rbp), %eax
cmpl $0x8c, %eax
jne 0xce3f5
leaq 0xb9923(%rip), %rdi     # 0x187cf0
callq 0x7add0
callq 0x7a560
movzwl %ax, %ecx
leaq 0x101a73(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
leaq 0x101a6e(%rip), %rax    # 0x1cfe58
movl $0x1, (%rax)
jmp 0xce47c
movzbl -0x1(%rbp), %eax
cmpl $0x8e, %eax
jne 0xce46e
leaq 0xb98fe(%rip), %rdi     # 0x187d05
callq 0x7add0
callq 0x7a680
movl %eax, -0x18(%rbp)
callq 0x7a680
callq 0x7a560
callq 0x7a510
movsbl %al, %eax
movl %eax, -0x8(%rbp)
callq 0x7a510
movsbl %al, %eax
movl %eax, -0xc(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
leaq 0x29e4ce(%rip), %rax    # 0x36c914
cmpl $0x0, (%rax)
jne 0xce46c
movl -0x10(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xce46c
movl -0xc(%rbp), %ecx
leaq 0x29e4a8(%rip), %rax    # 0x36c908
movl %ecx, (%rax)
movl $0x6, %edi
callq 0x7a270
jmp 0xce47a
leaq 0xb98a8(%rip), %rdi     # 0x187d1d
callq 0x7add0
jmp 0xce47c
jmp 0xce47e
jmp 0xce480
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)