// File: jkingan[P]ladyheather/heathgps.cpp
// Function: get_msg_field()
int get_msg_field()
{
char c;
unsigned i;
int quote;

   // extract the next comma (or other separator char) separated field from a
   // message (this routine is also used by several different receiver types 
   // besides NMEA)

   msg_field[0] = 0;
   if(nmea_msg[msg_col] == 0) return 0;  // at end-of-message

   i = 0;
   quote = 0;
   while(msg_col < (int)sizeof(nmea_msg)) {   // get next field from the nmea message
      c = nmea_msg[msg_col];
      if((c == '"') && (rcvr_type == CS_RCVR)) {  // quoted strings allowed
         ++msg_col;
         if(quote) quote = 0;
         else      quote = 1;
      }
      else if((c == '"') && (rcvr_type == SA35_RCVR)) {  // quoted strings allowed
         ++msg_col;
         if(quote) quote = 0;
         else      quote = 1;
      }
      else if(c == 0) {  // reached end-of-message
         break;
      }
      else if(quote) {  // quoted string
         goto add_char;
      }
      else if((c == ',') && (rcvr_type != TICC_RCVR)) { // end of comma delimted field
         ++msg_col;   // HP interval counters have commas in their numbers
         break;
      }
      else if((rpn_mode > 0) && (c == ' ')) {
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == BRANDY_RCVR) && (c == ' ')) {    // skip leading spaces, end field on a space 
         ++msg_col;
         if(i) break;
         break;
      }
      else if((rcvr_type == STAR_RCVR) && (c == '=')) {
         ++msg_col;
         break;
      }
      else if((rcvr_type == TICC_RCVR) && (c == ' ')) {  // skip leading spaces, end field on a space
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == TICC_RCVR) && (c == '\t')) {  // skip leading spaces, end field on a space
         ++msg_col;
         if(i) break;
      }
      else if((rcvr_type == TRUE_RCVR) && (c == ' ')) {    // skip leading spaces, end field on a space 
         ++msg_col;
         if(i) break;
         break;
      }
      else if((rcvr_type == TSERVE_RCVR) && (c == ':')) {    // skip leading spaces, end field on a ':'
         ++msg_col;
         if(i) break;
         break;
      }
      else if(0 && (rcvr_type == Z12_RCVR) && (c == ':')) {    // skip leading spaces, end field on a ':'
         ++msg_col;
         if(i) break;
         break;
      }
      else {        // add char to extracted field
         add_char:
         if(i < (sizeof(msg_field) - 1)) {
            msg_field[i++] = c;
            msg_field[i] = 0;
            ++msg_col;
         }
      }
   }

   return msg_field[0];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2ea045(%rip), %rax    # 0x39ac20
movb $0x0, (%rax)
leaq 0x2ea23f(%rip), %rax    # 0x39ae24
movslq (%rax), %rcx
leaq 0x2e9e21(%rip), %rax    # 0x39aa10
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xb0c04
movl $0x0, -0x4(%rbp)
jmp 0xb0f35
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
leaq 0x2ea20b(%rip), %rax    # 0x39ae24
cmpl $0x201, (%rax)          # imm = 0x201
jge 0xb0f28
leaq 0x2ea1f8(%rip), %rax    # 0x39ae24
movslq (%rax), %rcx
leaq 0x2e9dda(%rip), %rax    # 0x39aa10
movb (%rax,%rcx), %al
movb %al, -0x5(%rbp)
movsbl -0x5(%rbp), %eax
cmpl $0x22, %eax
jne 0xb0c85
leaq 0x1c6e64(%rip), %rax    # 0x277ab0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0xb0c85
leaq 0x2ea1c8(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea1bc(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0x10(%rbp)
je 0xb0c79
movl $0x0, -0x10(%rbp)
jmp 0xb0c80
movl $0x1, -0x10(%rbp)
jmp 0xb0f23
movsbl -0x5(%rbp), %eax
cmpl $0x22, %eax
jne 0xb0cd4
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
leaq 0x1c6e11(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0xb0cd4
leaq 0x2ea179(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea16d(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0x10(%rbp)
je 0xb0cc8
movl $0x0, -0x10(%rbp)
jmp 0xb0ccf
movl $0x1, -0x10(%rbp)
jmp 0xb0f21
movsbl -0x5(%rbp), %eax
cmpl $0x0, %eax
jne 0xb0ce2
jmp 0xb0f28
cmpl $0x0, -0x10(%rbp)
je 0xb0ced
jmp 0xb0ebf
movsbl -0x5(%rbp), %eax
cmpl $0x2c, %eax
jne 0xb0d20
leaq 0x1c6db3(%rip), %rax    # 0x277ab0
cmpq $0x10000, (%rax)        # imm = 0x10000
je 0xb0d20
leaq 0x2ea117(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea10b(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
jmp 0xb0f28
leaq 0x2e9ce1(%rip), %rax    # 0x39aa08
cmpl $0x0, (%rax)
jle 0xb0d5a
movsbl -0x5(%rbp), %eax
cmpl $0x20, %eax
jne 0xb0d5a
leaq 0x2ea0e8(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea0dc(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0d55
jmp 0xb0f28
jmp 0xb0f19
leaq 0x1c6d4f(%rip), %rax    # 0x277ab0
cmpq $0x40000, (%rax)        # imm = 0x40000
jne 0xb0d98
movsbl -0x5(%rbp), %eax
cmpl $0x20, %eax
jne 0xb0d98
leaq 0x2ea0aa(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea09e(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0d93
jmp 0xb0f28
jmp 0xb0f28
leaq 0x1c6d11(%rip), %rax    # 0x277ab0
cmpq $0x1000, (%rax)         # imm = 0x1000
jne 0xb0dcb
movsbl -0x5(%rbp), %eax
cmpl $0x3d, %eax
jne 0xb0dcb
leaq 0x2ea06c(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea060(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
jmp 0xb0f28
leaq 0x1c6cde(%rip), %rax    # 0x277ab0
cmpq $0x10000, (%rax)        # imm = 0x10000
jne 0xb0e09
movsbl -0x5(%rbp), %eax
cmpl $0x20, %eax
jne 0xb0e09
leaq 0x2ea039(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ea02d(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0e04
jmp 0xb0f28
jmp 0xb0f13
leaq 0x1c6ca0(%rip), %rax    # 0x277ab0
cmpq $0x10000, (%rax)        # imm = 0x10000
jne 0xb0e47
movsbl -0x5(%rbp), %eax
cmpl $0x9, %eax
jne 0xb0e47
leaq 0x2e9ffb(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2e9fef(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0e42
jmp 0xb0f28
jmp 0xb0f11
leaq 0x1c6c62(%rip), %rax    # 0x277ab0
cmpq $0x200000, (%rax)       # imm = 0x200000
jne 0xb0e85
movsbl -0x5(%rbp), %eax
cmpl $0x20, %eax
jne 0xb0e85
leaq 0x2e9fbd(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2e9fb1(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0e80
jmp 0xb0f28
jmp 0xb0f28
leaq 0x1c6c24(%rip), %rax    # 0x277ab0
cmpq $0x40000000, (%rax)     # imm = 0x40000000
jne 0xb0ebd
movsbl -0x5(%rbp), %eax
cmpl $0x3a, %eax
jne 0xb0ebd
leaq 0x2e9f7f(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2e9f73(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xb0ebb
jmp 0xb0f28
jmp 0xb0f28
jmp 0xb0ebf
movl -0xc(%rbp), %eax
cmpq $0x200, %rax            # imm = 0x200
jae 0xb0f0b
movb -0x5(%rbp), %dl
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x2e9d3d(%rip), %rax    # 0x39ac20
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x2e9d2e(%rip), %rax    # 0x39ac20
movb $0x0, (%rax,%rcx)
leaq 0x2e9f27(%rip), %rax    # 0x39ae24
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2e9f1b(%rip), %rax    # 0x39ae24
movl %ecx, (%rax)
jmp 0xb0f0d
jmp 0xb0f0f
jmp 0xb0f11
jmp 0xb0f13
jmp 0xb0f15
jmp 0xb0f17
jmp 0xb0f19
jmp 0xb0f1b
jmp 0xb0f1d
jmp 0xb0f1f
jmp 0xb0f21
jmp 0xb0f23
jmp 0xb0c12
leaq 0x2e9cf1(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)