// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_perdapi()
void parse_perdapi()
{
int i;
int gnss;
float val;
u32 mask;

   gnss = 0;
   get_msg_field();
   if(strstr(msg_field, "FIXMASK")) {  // snr and elevation mask
      get_msg_field(); // eat the "USER"


      if(get_msg_field()) {  // el mask
         val = (float) atof(msg_field);
         el_mask = val;
         have_el_mask = 87;
      }
      get_msg_field();

      if(get_msg_field()) {  // snr mask
         val = (float) atof(msg_field);
         amu_mask = val;
         have_amu = 87;
      }
      get_msg_field();

      for(i=1; i<256; i++) {
         sat[i].disabled = 0;
      }

      if(get_msg_field()) {  // excluded GPS sats
         mask = atohex(msg_field);
         esip_deleted_gps = mask;
         esip_disable(1, 32, mask);
      }
      if(get_msg_field()) {  // excluded Glonass
         mask = atohex(msg_field);
         esip_deleted_glonass = mask;
         esip_disable(65, 28, mask);
      }
      if(get_msg_field()) {  // excluded Galileo
         mask = atohex(msg_field);
         esip_deleted_galileo = mask;
//       esip_disable(211, 20, mask);  // !!!!!! what starting PRN to use?  Ublox uses 211..246
      }
      if(get_msg_field()) {  // excluded QZSS
         mask = atohex(msg_field);
         esip_deleted_qzss = mask;
         esip_disable(93, 7, mask);
      }
      if(get_msg_field()) {  // excluded SBAS
         mask = atohex(msg_field);
         esip_deleted_sbas = mask;
         esip_disable(33, 19, mask);
      }
      have_esip_fixmask = 87;
   }
   else if(strstr(msg_field, "FREQ")) {  // GCLK settings
      if(get_msg_field()) {    // GCLK enabled
         i = atoi(msg_field);
      }

      if(get_msg_field()) {  // GCLK freq
         pps2_freq = atof(msg_field);
         have_pps_freq |= 0x02;
      }

      if(get_msg_field()) {  // GCLK duty
         pps2_duty = atof(msg_field) / 100.0;
         have_pps_duty |= 0x02;
      }
//sprintf(debug_text, "GCLK enbl:%d  freq:%g  duty:%g", i, pps2_freq,pps2_duty);

      if(get_msg_field()) {  // offset in ns
         i = atoi(msg_field);
      }
   }
   else if(strstr(msg_field, "GNSS")) {  // GNSS systems in use
      get_msg_field(); // eat the talker id

      if(get_msg_field()) {  // gps
         i = atoi(msg_field);
         if(i) gnss |= GPS;
      }

      if(get_msg_field()) {  // glonass
         i = atoi(msg_field);
         if(i) gnss |= GLONASS;
      }

      if(get_msg_field()) {  // galileo
         i = atoi(msg_field);
         if(i) gnss |= GALILEO;
      }

      if(get_msg_field()) {  // QZSS
         i = atoi(msg_field);
         if(i) gnss |= QZSS;
      }

      if(get_msg_field()) {  // SBAS
         i = atoi(msg_field);
         if(i) gnss |= SBAS;
      }

      gnss_mask = gnss;
      have_gnss_mask = 87;
   }
   else if(strstr(msg_field, "RESTART")) {  // receiver restart command
   }
   else if(strstr(msg_field, "TIMEZONE")) {  // receiver timezone setting
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x8(%rbp)
callq 0xb0bd0
leaq 0x2e5335(%rip), %rdi    # 0x39ac20
leaq 0xd08a1(%rip), %rsi     # 0x186193
callq 0x9090
cmpq $0x0, %rax
je 0xb5acf
callq 0xb0bd0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5942
leaq 0x2e5309(%rip), %rdi    # 0x39ac20
callq 0x9480
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
movss -0xc(%rbp), %xmm0
leaq 0x2b6963(%rip), %rax    # 0x36c294
movss %xmm0, (%rax)
leaq 0x2b6ca0(%rip), %rax    # 0x36c5dc
movl $0x57, (%rax)
callq 0xb0bd0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5983
leaq 0x2e52c8(%rip), %rdi    # 0x39ac20
callq 0x9480
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
movss -0xc(%rbp), %xmm0
leaq 0x2b6926(%rip), %rax    # 0x36c298
movss %xmm0, (%rax)
leaq 0x2b6c5b(%rip), %rax    # 0x36c5d8
movl $0x57, (%rax)
callq 0xb0bd0
movl $0x1, -0x4(%rbp)
cmpl $0x100, -0x4(%rbp)      # imm = 0x100
jge 0xb59bc
movslq -0x4(%rbp), %rcx
leaq 0x1e87ed(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movb $0x0, 0x1(%rax)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xb598f
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb59f3
leaq 0x2e5253(%rip), %rdi    # 0x39ac20
callq 0x98d0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2b7589(%rip), %rax    # 0x36cf68
movl %ecx, (%rax)
movl -0x10(%rbp), %edx
movl $0x1, %edi
movl $0x20, %esi
callq 0xb5850
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5a2a
leaq 0x2e521c(%rip), %rdi    # 0x39ac20
callq 0x98d0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2b7556(%rip), %rax    # 0x36cf6c
movl %ecx, (%rax)
movl -0x10(%rbp), %edx
movl $0x41, %edi
movl $0x1c, %esi
callq 0xb5850
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5a4f
leaq 0x2e51e5(%rip), %rdi    # 0x39ac20
callq 0x98d0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2b7523(%rip), %rax    # 0x36cf70
movl %ecx, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5a86
leaq 0x2e51c0(%rip), %rdi    # 0x39ac20
callq 0x98d0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2b7502(%rip), %rax    # 0x36cf74
movl %ecx, (%rax)
movl -0x10(%rbp), %edx
movl $0x5d, %edi
movl $0x7, %esi
callq 0xb5850
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5abd
leaq 0x2e5189(%rip), %rdi    # 0x39ac20
callq 0x98d0
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2b74cf(%rip), %rax    # 0x36cf78
movl %ecx, (%rax)
movl -0x10(%rbp), %edx
movl $0x21, %edi
movl $0x13, %esi
callq 0xb5850
leaq 0x2b74b8(%rip), %rax    # 0x36cf7c
movl $0x57, (%rax)
jmp 0xb5cec
leaq 0x2e514a(%rip), %rdi    # 0x39ac20
leaq 0xd54db(%rip), %rsi     # 0x18afb8
callq 0x9090
cmpq $0x0, %rax
je 0xb5b9b
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5b05
leaq 0x2e5123(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5b3b
leaq 0x2e510a(%rip), %rdi    # 0x39ac20
callq 0x9480
leaq 0x2b73fe(%rip), %rax    # 0x36cf20
movsd %xmm0, (%rax)
leaq 0x2b7413(%rip), %rax    # 0x36cf40
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2b7407(%rip), %rax    # 0x36cf40
movl %ecx, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5b7d
leaq 0x2e50d4(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd 0xb94f7(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
leaq 0x2b73c4(%rip), %rax    # 0x36cf28
movsd %xmm0, (%rax)
leaq 0x2b73d5(%rip), %rax    # 0x36cf44
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2b73c9(%rip), %rax    # 0x36cf44
movl %ecx, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5b96
leaq 0x2e5092(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
jmp 0xb5cea
leaq 0x2e507e(%rip), %rdi    # 0x39ac20
leaq 0xd1f41(%rip), %rsi     # 0x187aea
callq 0x9090
cmpq $0x0, %rax
je 0xb5cae
callq 0xb0bd0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5be7
leaq 0x2e5052(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xb5be5
movl -0x8(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xb5be7
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5c11
leaq 0x2e5028(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xb5c0f
movl -0x8(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x8(%rbp)
jmp 0xb5c11
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5c3b
leaq 0x2e4ffe(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xb5c39
movl -0x8(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x8(%rbp)
jmp 0xb5c3b
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5c67
leaq 0x2e4fd4(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xb5c65
movl -0x8(%rbp), %eax
orl $0x4000, %eax           # imm = 0x4000
movl %eax, -0x8(%rbp)
jmp 0xb5c67
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5c93
leaq 0x2e4fa8(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xb5c91
movl -0x8(%rbp), %eax
orl $0x8000, %eax           # imm = 0x8000
movl %eax, -0x8(%rbp)
jmp 0xb5c93
movl -0x8(%rbp), %ecx
leaq 0x11a1b7(%rip), %rax    # 0x1cfe54
movl %ecx, (%rax)
leaq 0x11a1b2(%rip), %rax    # 0x1cfe58
movl $0x57, (%rax)
jmp 0xb5ce8
leaq 0x2e4f6b(%rip), %rdi    # 0x39ac20
leaq 0xd04df(%rip), %rsi     # 0x18619b
callq 0x9090
cmpq $0x0, %rax
je 0xb5cc9
jmp 0xb5ce6
leaq 0x2e4f50(%rip), %rdi    # 0x39ac20
leaq 0xd04cc(%rip), %rsi     # 0x1861a3
callq 0x9090
cmpq $0x0, %rax
je 0xb5ce4
jmp 0xb5ce4
jmp 0xb5ce6
jmp 0xb5ce8
jmp 0xb5cea
jmp 0xb5cec
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)