// File: jkingan[P]ladyheather/heathgps.cpp
// Function: get_sat_list(int)
void get_sat_list(int flag)
{
u08 dimension;
u08 count;
int i;
int prn;

   if(flag) log_packet_id("Packet 0x6C (GNSS satellite list)");  // also 6C
   else     log_packet_id("Packet 0x6D (Satellite list)");  // also 6C

   dimension = count = tsip_byte();
   dimension &= 0x0F;
   count >>= 4;

   if(ACU_GG || ACU_360 || ACUTIME) {
      if(0) {  // we get this from the 0x8F-AC secondary timeing message
         if     (dimension == 0x0B) rcvr_mode = RCVR_MODE_2D;      // manual 2D
         else if(dimension == 0x0C) rcvr_mode = RCVR_MODE_3D;      // manual 3D
         else if(dimension == 0)    rcvr_mode = RCVR_MODE_2D_3D;
         else if(dimension == 1)    rcvr_mode = RCVR_MODE_SINGLE;
         else if(dimension == 2)    rcvr_mode = RCVR_MODE_NO_SATS; // 2D clock hold
         else if(dimension == 3)    rcvr_mode = RCVR_MODE_2D;
         else if(dimension == 4)    rcvr_mode = RCVR_MODE_3D;
         else if(dimension == 5)    rcvr_mode = RCVR_MODE_HOLD;
         else if(dimension == 6)    rcvr_mode = RCVR_MODE_DGPS;
         else                       rcvr_mode = RCVR_MODE_2D_3D;
      }
   }
   else if(SV6_FAMILY) {
      if     (dimension == 0x0B) rcvr_mode = RCVR_MODE_2D;   // manual 2D
      else if(dimension == 0x0C) rcvr_mode = RCVR_MODE_3D;   // manual 3D
      else if(dimension == 0x03) rcvr_mode = RCVR_MODE_HOLD; // auto 2d
      else if(dimension == 0x04) rcvr_mode = RCVR_MODE_HOLD; // auto 2d/3d
      else rcvr_mode = RCVR_MODE_UNKNOWN;
//sprintf(debug_text3, "dim:%02X  rmode:%d", dimension, rcvr_mode);
   }

   have_dops = 0;
   pdop = tsip_single();
   hdop = tsip_single();
   vdop = tsip_single();
   tdop = tsip_single();

   if(pdop > 20.0) pdop = 20.0;
   if(hdop > 20.0) hdop = 20.0;
   if(vdop > 20.0) vdop = 20.0;
   if(tdop > 20.0) tdop = 20.0;

   have_dops |= (PDOP | HDOP | VDOP | TDOP);

   for(i=1; i<=MAX_PRN; i++) {  // reset current tracking flags
      if(ACU_360 || ACU_GG) ;     //rnx
      else sat[i].tracking = 0;
   }

   if(flag) {
      count = tsip_byte();
   }

   for(i=0; i<count; i++) {
      prn = tsip_byte();
      if(ACU_360) ;
      else if(prn & 0x80) {  // prn tracked,  but not used
         prn |= (~0xFF);
      }

      if(prn > MAX_PRN) prn = 0;  // put any bogus data in unused entry in array
      else if(prn < (-MAX_PRN)) prn = 0;

      if(prn < 0) {
         sat[0-prn].tracking = (-1); // prn;
      }
      else {  // prn is used in solution
         sat[prn].tracking = (1); // prn;
      }
if(0 && log_file) fprintf(log_file, "track prn %d:%d\n", prn,sat[prn].tracking);
   }
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xa001f
leaq 0xe5071(%rip), %rdi     # 0x185089
callq 0x7add0
jmp 0xa002b
leaq 0xe5085(%rip), %rdi     # 0x1850ab
callq 0x7add0
callq 0x7a510
movb %al, -0x6(%rbp)
movb %al, -0x5(%rbp)
movzbl -0x5(%rbp), %eax
andl $0xf, %eax
movb %al, -0x5(%rbp)
movzbl -0x6(%rbp), %eax
sarl $0x4, %eax
movb %al, -0x6(%rbp)
leaq 0x1d7a5f(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa006f
leaq 0x1da156(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa006f
leaq 0x1d7a6e(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa00b9
leaq 0x1d7a3a(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa00a0
leaq 0x1da131(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa00a0
leaq 0x1d7a49(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0xa00b9
leaq 0x1d7a3d(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa00b9
leaq 0x1d7a09(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa00be
leaq 0x1da100(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa00be
jmp 0xa0167
leaq 0x1d79eb(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa0165
leaq 0x1da0de(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0xa00ff
leaq 0x1da0d2(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0xa00ff
leaq 0x1da0c6(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0xa00ff
leaq 0x1da0ba(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa0165
movzbl -0x5(%rbp), %eax
cmpl $0xb, %eax
jne 0xa0114
leaq 0x2cc1a1(%rip), %rax    # 0x36c2b0
movb $0x3, (%rax)
jmp 0xa0163
movzbl -0x5(%rbp), %eax
cmpl $0xc, %eax
jne 0xa0129
leaq 0x2cc18c(%rip), %rax    # 0x36c2b0
movb $0x4, (%rax)
jmp 0xa0161
movzbl -0x5(%rbp), %eax
cmpl $0x3, %eax
jne 0xa013e
leaq 0x2cc177(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
jmp 0xa015f
movzbl -0x5(%rbp), %eax
cmpl $0x4, %eax
jne 0xa0153
leaq 0x2cc162(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
jmp 0xa015d
leaq 0x2cc156(%rip), %rax    # 0x36c2b0
movb $0x63, (%rax)
jmp 0xa015f
jmp 0xa0161
jmp 0xa0163
jmp 0xa0165
jmp 0xa0167
leaq 0x1e2556(%rip), %rax    # 0x2826c4
movl $0x0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1e2544(%rip), %rax    # 0x2826c8
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1e2538(%rip), %rax    # 0x2826d0
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1e252c(%rip), %rax    # 0x2826d8
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1e2528(%rip), %rax    # 0x2826e8
movsd %xmm0, (%rax)
leaq 0x1e24fd(%rip), %rax    # 0x2826c8
movsd (%rax), %xmm0
movsd 0xceef1(%rip), %xmm1    # 0x16f0c8
ucomisd %xmm1, %xmm0
jbe 0xa01f0
leaq 0x1e24e4(%rip), %rax    # 0x2826c8
movsd 0xceedc(%rip), %xmm0    # 0x16f0c8
movsd %xmm0, (%rax)
leaq 0x1e24d9(%rip), %rax    # 0x2826d0
movsd (%rax), %xmm0
movsd 0xceec5(%rip), %xmm1    # 0x16f0c8
ucomisd %xmm1, %xmm0
jbe 0xa021c
leaq 0x1e24c0(%rip), %rax    # 0x2826d0
movsd 0xceeb0(%rip), %xmm0    # 0x16f0c8
movsd %xmm0, (%rax)
leaq 0x1e24b5(%rip), %rax    # 0x2826d8
movsd (%rax), %xmm0
movsd 0xcee99(%rip), %xmm1    # 0x16f0c8
ucomisd %xmm1, %xmm0
jbe 0xa0248
leaq 0x1e249c(%rip), %rax    # 0x2826d8
movsd 0xcee84(%rip), %xmm0    # 0x16f0c8
movsd %xmm0, (%rax)
leaq 0x1e2499(%rip), %rax    # 0x2826e8
movsd (%rax), %xmm0
movsd 0xcee6d(%rip), %xmm1    # 0x16f0c8
ucomisd %xmm1, %xmm0
jbe 0xa0274
leaq 0x1e2480(%rip), %rax    # 0x2826e8
movsd 0xcee58(%rip), %xmm0    # 0x16f0c8
movsd %xmm0, (%rax)
leaq 0x1e2449(%rip), %rax    # 0x2826c4
movl (%rax), %ecx
orl $0x17, %ecx
leaq 0x1e243d(%rip), %rax    # 0x2826c4
movl %ecx, (%rax)
movl $0x1, -0xc(%rbp)
cmpl $0x3e7, -0xc(%rbp)      # imm = 0x3E7
jg 0xa0324
leaq 0x1d780c(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa02ce
leaq 0x1d9f03(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa02ce
leaq 0x1d781b(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0xa02f3
leaq 0x1d780f(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa02f3
leaq 0x1d77db(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa02f5
leaq 0x1d9ed2(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa02f5
leaq 0x1d77ea(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0xa02f5
jmp 0xa0314
movslq -0xc(%rbp), %rcx
leaq 0x1fde90(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0x218(%rax)
jmp 0xa0316
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa0290
cmpl $0x0, -0x4(%rbp)
je 0xa0332
callq 0x7a510
movb %al, -0x6(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl -0x6(%rbp), %ecx
cmpl %ecx, %eax
jge 0xa041e
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
leaq 0x1d7756(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa0386
leaq 0x1d9e4d(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa0386
leaq 0x1d7765(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0xa0384
leaq 0x1d7759(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0xa0386
jmp 0xa03a0
movl -0x10(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0xa039e
movl -0x10(%rbp), %eax
orl $0xffffff00, %eax       # imm = 0xFFFFFF00
movl %eax, -0x10(%rbp)
jmp 0xa03a0
cmpl $0x3e7, -0x10(%rbp)     # imm = 0x3E7
jle 0xa03b2
movl $0x0, -0x10(%rbp)
jmp 0xa03c4
cmpl $0xfffffc19, -0x10(%rbp) # imm = 0xFFFFFC19
jge 0xa03c2
movl $0x0, -0x10(%rbp)
jmp 0xa03c4
cmpl $0x0, -0x10(%rbp)
jge 0xa03ef
xorl %eax, %eax
subl -0x10(%rbp), %eax
movslq %eax, %rcx
leaq 0x1fddb7(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
jmp 0xa040e
movslq -0x10(%rbp), %rcx
leaq 0x1fdd96(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x218(%rax)
jmp 0xa0410
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa0339
movl $0x1, %edi
callq 0x7aee0
leaq 0x1fdd21(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0xa0436
jmp 0xa0436
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)