// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0xa
popq %rdi
callq 0xb771
pushq $0xa
popq %rdi
testl %eax, %eax
je 0x811c9
callq 0x1d93f
callq 0x51891
cmpl $0x11, %eax
je 0x812d6
movl %eax, %ebx
cmpl $0x13, %eax
jne 0x811d2
movl $0xc8, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xae83
popq %rbx
popq %r14
popq %rbp
jmp 0x1d61b
leaq 0x277107(%rip), %rax    # 0x2f82e0
cmpb $0x0, 0x17a12(%rax)
je 0x811e9
movb $0x0, 0x17a12(%rax)
leaq 0x2a1066(%rip), %r14    # 0x322256
movzwl (%r14), %eax
cmpw $0x1, %ax
je 0x81236
movzwl %ax, %eax
testl %eax, %eax
jne 0x81247
movw $0x1, (%r14)
callq 0x51a2f
leaq 0x2a103f(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x2a1036(%rip), %rax    # 0x322254
andw $0x0, (%rax)
cmpb $0xa, %bl
je 0x81247
movzbl %bl, %eax
cmpl $0xd, %eax
je 0x81247
xorl %eax, %eax
jmp 0x812eb
cmpb $0xa, %bl
je 0x81247
movzbl %bl, %eax
cmpl $0xd, %eax
jne 0x812db
leaq 0x181682(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x81298
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0x81284
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
jne 0x812ac
leaq 0x2a0fdb(%rip), %rax    # 0x322252
cmpw $0x0, (%rax)
je 0x812b1
callq 0x7f970
jmp 0x812b1
leaq 0x2a0fc7(%rip), %rax    # 0x322252
cmpw $0x0, (%rax)
je 0x812b1
callq 0x7fe48
jmp 0x812b1
leaq 0x2a0fb3(%rip), %rax    # 0x322252
cmpw $0x0, (%rax)
je 0x812b1
callq 0x7f377
jmp 0x812b1
callq 0x80dde
movl $0x1, 0x2d49d9(%rip)    # 0x355c94
andw $0x0, (%r14)
leaq 0x2a0f8b(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x2a0f82(%rip), %rax    # 0x322254
andw $0x0, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2a0f70(%rip), %rax    # 0x322252
movzwl (%rax), %eax
cmpw $0xffe, %ax             # imm = 0xFFE
ja 0x812bb
movzwl %ax, %eax
leaq 0x1(%rax), %rcx
leaq 0x2a0f59(%rip), %rdx    # 0x322252
movw %cx, (%rdx)
leaq 0x29ff4d(%rip), %rcx    # 0x321250
movb %bl, (%rcx,%rax)
movb $0x0, 0x1(%rcx,%rax)
jmp 0x812d6