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

   // This routine buffers up an incoming X72 message.  When the end of the
   // message is seen, the message is parsed and decoded with decode_x72_msg()

   if(SERIAL_DATA_AVAILABLE(RCVR_PORT) == 0) {
      check_com_timer(RCVR_PORT);
      return;
   }
   else {
      reset_com_timer(RCVR_PORT);
   }

   c = get_com_char();
   if(c == 0x0D) return;  // ignore CR,  we end if LF char

   if(x72_response) {     // we are reading multi-line response query results
      get_x72_response(c);
      return;
   }

   if(com[RCVR_PORT].rcv_error) {      // parity/framing/overrun errors
      com[RCVR_PORT].rcv_error = 0;
//!!!!!qqqq    goto rst_msg;
   }

   if(tsip_sync == 0) {    // syncing to start of message
      tsip_sync = 1;
      get_sync_time();

      tsip_wptr = 0;
      tsip_rptr = 0;
      goto get_msg;
   }
   else if(tsip_sync == 1) { // message start has been seen, now build the message
      get_msg:
      if(c == 0x0A) goto x72_end; 
      else if(c == 0x0D) goto x72_end; 

      if(tsip_wptr < (MAX_TSIP-2)) {  // add char to the message buffer
         tsip_buf[tsip_wptr++] = c;
         tsip_buf[tsip_wptr] = 0;
         if((tsip_buf[0] == 'r') && (tsip_buf[1] == '>')) {  // command prompt
            goto x72_end;
         }
      }
      else {  // buffer overlow
         goto rst_msg;
      }
   }
   else {
      x72_end:
      if(tsip_wptr > 0) {
         decode_x72_msg(2);
         packet_end = 1;
      }

      rst_msg:
      tsip_sync = 0;
      tsip_rptr = 0;
      tsip_wptr = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0xa, %edi
callq 0xcad0
cmpl $0x0, %eax
jne 0xc4af6
movl $0xa, %edi
callq 0x2b610
jmp 0xc4c81
movl $0xa, %edi
callq 0x2bd30
callq 0x79fc0
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
cmpl $0xd, %eax
jne 0xc4b16
jmp 0xc4c81
cmpl $0x0, 0x30727f(%rip)    # 0x3cbd9c
je 0xc4b2d
movsbl -0x1(%rbp), %edi
callq 0xc48e0
jmp 0xc4c81
leaq 0x2a898c(%rip), %rax    # 0x36d4c0
cmpb $0x0, 0x17a12(%rax)
je 0xc4b4b
leaq 0x2a897c(%rip), %rax    # 0x36d4c0
movb $0x0, 0x17a12(%rax)
leaq 0x2d28e4(%rip), %rax    # 0x397436
movzwl (%rax), %eax
cmpl $0x0, %eax
jne 0xc4b85
leaq 0x2d28d5(%rip), %rax    # 0x397436
movw $0x1, (%rax)
callq 0x7a1d0
leaq 0x2d28c0(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x2d28b6(%rip), %rax    # 0x397434
movw $0x0, (%rax)
jmp 0xc4b9a
leaq 0x2d28aa(%rip), %rax    # 0x397436
movzwl (%rax), %eax
cmpl $0x1, %eax
jne 0xc4c34
jmp 0xc4b9a
movzbl -0x1(%rbp), %eax
cmpl $0xa, %eax
jne 0xc4ba8
jmp 0xc4c36
movzbl -0x1(%rbp), %eax
cmpl $0xd, %eax
jne 0xc4bb6
jmp 0xc4c36
jmp 0xc4bb8
leaq 0x2d2873(%rip), %rax    # 0x397432
movzwl (%rax), %eax
cmpl $0xffe, %eax            # imm = 0xFFE
jge 0xc4c30
movb -0x1(%rbp), %dl
leaq 0x2d285f(%rip), %rax    # 0x397432
movw (%rax), %ax
movw %ax, %si
addw $0x1, %si
leaq 0x2d284e(%rip), %rcx    # 0x397432
movw %si, (%rcx)
movzwl %ax, %eax
movl %eax, %ecx
leaq 0x2d183d(%rip), %rax    # 0x396430
movb %dl, (%rax,%rcx)
leaq 0x2d2835(%rip), %rax    # 0x397432
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0x2d1827(%rip), %rax    # 0x396430
movb $0x0, (%rax,%rcx)
leaq 0x2d181c(%rip), %rax    # 0x396430
movzbl (%rax), %eax
cmpl $0x72, %eax
jne 0xc4c2e
leaq 0x2d180d(%rip), %rax    # 0x396430
movzbl 0x1(%rax), %eax
cmpl $0x3e, %eax
jne 0xc4c2e
jmp 0xc4c36
jmp 0xc4c32
jmp 0xc4c5b
jmp 0xc4c7f
jmp 0xc4c36
leaq 0x2d27f5(%rip), %rax    # 0x397432
movzwl (%rax), %eax
cmpl $0x0, %eax
jle 0xc4c59
movl $0x2, %edi
callq 0xc39b0
movl $0x1, 0x30621b(%rip)    # 0x3cae74
jmp 0xc4c5b
leaq 0x2d27d4(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x2d27c6(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x2d27b8(%rip), %rax    # 0x397432
movw $0x0, (%rax)
jmp 0xc4c81
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)