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

   // This routine buffers up an incoming PRS-10 message.  It is also used
   // for the SA35 and Spectratime SRO100 and LPFRS devices.  When the end of
   // the message is seen, the message is parsed and decoded with 
   // decode_prs_msg(), etc.

   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 == 0x11) {    // we pretty much ignore XON/XOFF
      return;  // XON
   }
   else if(c == 0x13) {
      Sleep(200);
      return;  // XOFF
   }

   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 messaage
      tsip_sync = 1;
      get_sync_time();
      tsip_wptr = 0;
      tsip_rptr = 0;
      goto build_msg;
   }
   else if(tsip_sync == 1) { // build the message
      build_msg:
      if(c == 0x0D) goto prs_end; 
      else if(c == 0x0A) goto prs_end; 

      if(tsip_wptr < (MAX_TSIP-1)) {  // so add it to the message buffer
         tsip_buf[tsip_wptr++] = c;
         tsip_buf[tsip_wptr] = 0;
      }
      else {
         goto rst_msg;
      }
   }
   else {
      prs_end:
      if(rcvr_type == SA35_RCVR) {
         if(tsip_wptr) decode_sa35_msg();
      }
      else if(rcvr_type == SRO_RCVR) {
         if(tsip_wptr) decode_sro_msg();
      }
      else if(rcvr_type == LPFRS_RCVR) {
         if(tsip_wptr) decode_lpfrs_msg();
      }
      else decode_prs_msg();
      packet_end = 1;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl $0xa, %edi
callq 0xb9ad
movl $0xa, %edi
testl %eax, %eax
je 0x8de26
callq 0x1ea0b
callq 0x584bd
cmpl $0x11, %eax
je 0x8df30
movl %eax, %ebx
cmpl $0x13, %eax
jne 0x8de2f
movl $0xc8, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xafe8
popq %rbx
popq %r14
popq %rbp
jmp 0x1e66a
leaq 0x2804aa(%rip), %rax    # 0x30e2e0
cmpb $0x0, 0x17a12(%rax)
je 0x8de46
movb $0x0, 0x17a12(%rax)
leaq 0x2aa409(%rip), %r14    # 0x338256
movzwl (%r14), %eax
cmpw $0x1, %ax
je 0x8de91
movzwl %ax, %eax
testl %eax, %eax
jne 0x8dea2
movw $0x1, (%r14)
callq 0x58672
leaq 0x2aa3e2(%rip), %rcx    # 0x338252
xorl %eax, %eax
movw %ax, (%rcx)
leaq 0x2aa3d8(%rip), %rcx    # 0x338254
movw %ax, (%rcx)
cmpb $0xa, %bl
je 0x8dea2
movzbl %bl, %ecx
cmpl $0xd, %ecx
je 0x8dea2
jmp 0x8df46
cmpb $0xa, %bl
je 0x8dea2
movzbl %bl, %eax
cmpl $0xd, %eax
jne 0x8df35
leaq 0x18aa27(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x8def3
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0x8dedf
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
jne 0x8df07
leaq 0x2aa380(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df0c
callq 0x8c50f
jmp 0x8df0c
leaq 0x2aa36c(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df0c
callq 0x8ca18
jmp 0x8df0c
leaq 0x2aa358(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df0c
callq 0x8bef9
jmp 0x8df0c
callq 0x8d9cc
movl $0x1, 0x2ddd7e(%rip)    # 0x36bc94
xorl %eax, %eax
movw %ax, (%r14)
leaq 0x2aa32f(%rip), %rcx    # 0x338252
movw %ax, (%rcx)
leaq 0x2aa327(%rip), %rcx    # 0x338254
movw %ax, (%rcx)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2aa316(%rip), %rax    # 0x338252
movzwl (%rax), %eax
cmpl $0xffe, %eax            # imm = 0xFFE
ja 0x8df16
movzwl %ax, %eax
leaq 0x1(%rax), %rcx
leaq 0x2aa2fe(%rip), %rdx    # 0x338252
movw %cx, (%rdx)
leaq 0x2a92f2(%rip), %rcx    # 0x337250
movb %bl, (%rcx,%rax)
movb $0x0, 0x1(%rcx,%rax)
jmp 0x8df30