// File: jkingan[P]ladyheather/heathgps.cpp
// Function: get_io_options()
void get_io_options()
{
u08 posn;
u08 vel;
u08 timing;
u08 aux;

   log_packet_id("Packet 0x55 (I/O options)");

   posn = tsip_byte();
   vel = tsip_byte();
   timing = tsip_byte();
   aux = tsip_byte();
//sprintf(debug_text, "posn:%02X  vel:%02X  timing:%02X  aux:%02X", posn,vel,timing,aux);

   if(ACU_GG || ACU_360) {  // aux not supported on these devices
      aux = amu_flag;
   }
   else if(SV6_FAMILY || ACUTIME | PALISADE) {
      aux ^= amu_flag;  // set polarity to match what a tbolt does

      if(timing & 0x01) {  // UTC time
         time_flags |= (TFLAGS_UTC);
         timing_mode = TMODE_UTC;
         have_timing_mode = 1;
      }
      else {  // GPS time
         time_flags &= (~TFLAGS_UTC);
         timing_mode = TMODE_GPS;
         have_timing_mode = 1;
      }
//sprintf(debug_text2, "tflags:%04X  tmode:%02X", time_flags, timing_mode);
      have_rcvr_tmode = 1;
   }

   if(aux & 0x08) {  // dbc mode
      level_type = "dBc";
      amu_mode = 0;
   }
   else { // amu mode
      level_type = "AMU";
      amu_mode = 1;
   }
   check_tsip_end(1);
   if(tsip_error) return;

   have_io_options = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xe7491(%rip), %rdi     # 0x184f50
callq 0x7add0
callq 0x7a510
movb %al, -0x1(%rbp)
callq 0x7a510
movb %al, -0x2(%rbp)
callq 0x7a510
movb %al, -0x3(%rbp)
callq 0x7a510
movb %al, -0x4(%rbp)
leaq 0x1d9fc5(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9db09
leaq 0x1dc6bc(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9db09
leaq 0x1d9fd4(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0x9db3a
leaq 0x1d9fa0(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9db4b
leaq 0x1dc697(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9db4b
leaq 0x1d9faf(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0x9db3a
leaq 0x1d9fa3(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0x9db4b
leaq 0x200593(%rip), %rax    # 0x29e0d4
movl (%rax), %eax
movb %al, -0x4(%rbp)
jmp 0x9dc79
leaq 0x1d9f5e(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9db8c
leaq 0x1dc655(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0x9dbf2
leaq 0x1dc645(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0x9dbf2
leaq 0x1dc639(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0x9dbf2
leaq 0x1dc62d(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
je 0x9dbf2
xorl %eax, %eax
leaq 0x1d9f1b(%rip), %rcx    # 0x277ab0
cmpq $0x1, (%rcx)
movb %al, -0x5(%rbp)
jne 0x9dbae
leaq 0x1dc60f(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
sete %al
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xc(%rbp)
xorl %eax, %eax
leaq 0x1d9eee(%rip), %rcx    # 0x277ab0
cmpq $0x1, (%rcx)
movb %al, -0x6(%rbp)
jne 0x9dbdb
leaq 0x1dc5e2(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
sete %al
movb %al, -0x6(%rbp)
movl -0xc(%rbp), %eax
movb -0x6(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
cmpl $0x0, %eax
je 0x9dc77
leaq 0x2004db(%rip), %rax    # 0x29e0d4
movl (%rax), %ecx
movzbl -0x4(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x4(%rbp)
movzbl -0x3(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x9dc3e
leaq 0x2cea6d(%rip), %rax    # 0x36c684
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2cea61(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
leaq 0x2cea71(%rip), %rax    # 0x36c69d
movb $0x3, (%rax)
leaq 0x2ce976(%rip), %rax    # 0x36c5ac
movl $0x1, (%rax)
jmp 0x9dc6a
leaq 0x2cea3f(%rip), %rax    # 0x36c684
movl (%rax), %ecx
andl $-0x2, %ecx
leaq 0x2cea33(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
leaq 0x2cea43(%rip), %rax    # 0x36c69d
movb $0x0, (%rax)
leaq 0x2ce948(%rip), %rax    # 0x36c5ac
movl $0x1, (%rax)
leaq 0x2ce93f(%rip), %rax    # 0x36c5b0
movl $0x1, (%rax)
jmp 0x9dc79
movzbl -0x4(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x9dca2
leaq 0x20044c(%rip), %rax    # 0x29e0d8
leaq 0xe72d7(%rip), %rcx     # 0x184f6a
movq %rcx, (%rax)
leaq 0x200433(%rip), %rax    # 0x29e0d0
movb $0x0, (%rax)
jmp 0x9dcbd
leaq 0x20042f(%rip), %rax    # 0x29e0d8
leaq 0xe72be(%rip), %rcx     # 0x184f6e
movq %rcx, (%rax)
leaq 0x200416(%rip), %rax    # 0x29e0d0
movb $0x1, (%rax)
movl $0x1, %edi
callq 0x7aee0
leaq 0x200482(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0x9dcd5
jmp 0x9dce2
leaq 0x2ce948(%rip), %rax    # 0x36c624
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)