// File: jkingan[P]ladyheather/heathgps.cpp
// Function: decode_brandy_msg()
void decode_brandy_msg()
{
char c;
int i;
static int row = 0;

   venus_nmea = 0;
   start_msg_decode(1);

   nmea_msg[0] = 0;
   for(i=0; i<tsip_wptr; i++) {  // copy message from tsip buffer to nmea buffer
      c = tsip_byte();
      nmea_msg[i] = c;
      nmea_msg[i+1] = 0;
      if(i >= ((int)sizeof(nmea_msg)-12)) break;
   }

//if(debug_file) fprintf(debug_file, "decode brandy: %s\n", nmea_msg);
//if(raw_file) fprintf(raw_file, "decode brandy: %s\n", nmea_msg);

   msg_col = 0;     // index of next char to get from nmea buffer
   if(isdigit(nmea_msg[0])) {
      parse_brandy_t();
      last_was_gsv = 0;
   }
   else if(nmea_msg[0] == '?') {  // error code
      last_was_gsv = 0;
   }
   else {
      get_msg_field(); // get the NMEA message type 
      if     (!strcmp(msg_field, "GPGSV")) {
         parse_gpgsv(GPS);
      }
      else if(!strcmp(msg_field, "GPGSA")) parse_gpgsa(GPS);
      else if(!strcmp(msg_field, "GPGGA")) parse_gpgga(GPS);
      else if(!strcmp(msg_field, "GPRMC")) parse_gprmc(GPS);
      else if(!strcmp(msg_field, "PRCCG")) parse_prccg();
      else if(!strcmp(msg_field, "PFEC"))  parse_pfec();
      else last_was_gsv = 0;
   }

   poll_next_brandy();

   if(sim_file && sim_delay) {  // throttle sim file messages
      Sleep(sim_delay);
   }

   saw_rcvr_msg = 1;
   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, 0x30e312(%rip)    # 0x3cbcc4
movl $0x1, %edi
callq 0xae4a0
leaq 0x2dd04d(%rip), %rax    # 0x39aa10
movb $0x0, (%rax)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x2d9a5b(%rip), %rcx    # 0x397432
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xbda23
callq 0x7a510
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %dl
movslq -0x8(%rbp), %rcx
leaq 0x2dd01c(%rip), %rax    # 0x39aa10
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2dd009(%rip), %rax    # 0x39aa10
movb $0x0, (%rax,%rcx)
cmpl $0x1f5, -0x8(%rbp)      # imm = 0x1F5
jl 0xbda16
jmp 0xbda23
jmp 0xbda18
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xbd9cd
leaq 0x2dd3fa(%rip), %rax    # 0x39ae24
movl $0x0, (%rax)
leaq 0x2dcfd9(%rip), %rax    # 0x39aa10
movsbl (%rax), %edi
callq 0x9330
cmpl $0x0, %eax
je 0xbda58
callq 0xbc500
movl $0x0, 0x3135a1(%rip)    # 0x3d0ff4
jmp 0xbdb67
leaq 0x2dcfb1(%rip), %rax    # 0x39aa10
movsbl (%rax), %eax
cmpl $0x3f, %eax
jne 0xbda76
movl $0x0, 0x313583(%rip)    # 0x3d0ff4
jmp 0xbdb65
callq 0xb0bd0
leaq 0x2dd19e(%rip), %rdi    # 0x39ac20
leaq 0xc8a4d(%rip), %rsi     # 0x1864d6
callq 0x9510
cmpl $0x0, %eax
jne 0xbdaa2
movl $0x1, %edi
callq 0xb1220
jmp 0xbdb63
leaq 0x2dd177(%rip), %rdi    # 0x39ac20
leaq 0xc8a4a(%rip), %rsi     # 0x1864fa
callq 0x9510
cmpl $0x0, %eax
jne 0xbdac9
movl $0x1, %edi
callq 0xb0f40
jmp 0xbdb61
leaq 0x2dd150(%rip), %rdi    # 0x39ac20
leaq 0xc8a47(%rip), %rsi     # 0x18651e
callq 0x9510
cmpl $0x0, %eax
jne 0xbdaed
movl $0x1, %edi
callq 0xb21e0
jmp 0xbdb5f
leaq 0x2dd12c(%rip), %rdi    # 0x39ac20
leaq 0xc8a47(%rip), %rsi     # 0x186542
callq 0x9510
cmpl $0x0, %eax
jne 0xbdb11
movl $0x1, %edi
callq 0xb20a0
jmp 0xbdb5d
leaq 0x2dd108(%rip), %rdi    # 0x39ac20
leaq 0xc8f8c(%rip), %rsi     # 0x186aab
callq 0x9510
cmpl $0x0, %eax
jne 0xbdb30
callq 0xbd4c0
jmp 0xbdb5b
leaq 0x2dd0e9(%rip), %rdi    # 0x39ac20
leaq 0xd036f(%rip), %rsi     # 0x18dead
callq 0x9510
cmpl $0x0, %eax
jne 0xbdb4f
callq 0xb4780
jmp 0xbdb59
movl $0x0, 0x31349b(%rip)    # 0x3d0ff4
jmp 0xbdb5b
jmp 0xbdb5d
jmp 0xbdb5f
jmp 0xbdb61
jmp 0xbdb63
jmp 0xbdb65
jmp 0xbdb67
callq 0xbd570
leaq 0x1dfa2d(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0xbdb97
leaq 0x1c4c60(%rip), %rax    # 0x2827e0
cmpq $0x0, (%rax)
je 0xbdb97
leaq 0x1c4c53(%rip), %rax    # 0x2827e0
movq (%rax), %rax
movl %eax, %edi
callq 0xb8b0
leaq 0x1e05e2(%rip), %rax    # 0x29e180
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)