// File: /workspace/github_cpp_makefile_star2_O1/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 0xb9c3
movl $0xa, %edi
testl %eax, %eax
je 0x8de24
callq 0x1ea2c
callq 0x584d5
cmpl $0x11, %eax
je 0x8df3f
movl %eax, %ebx
cmpl $0x13, %eax
jne 0x8de2d
movl $0xc8, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xaff7
popq %rbx
popq %r14
popq %rbp
jmp 0x1e6a0
leaq 0x2804ac(%rip), %rax    # 0x30e2e0
cmpb $0x0, 0x17a12(%rax)
je 0x8de44
movb $0x0, 0x17a12(%rax)
leaq 0x2aa40b(%rip), %r14    # 0x338256
movzwl (%r14), %eax
cmpw $0x1, %ax
je 0x8de7d
movzwl %ax, %eax
testl %eax, %eax
jne 0x8de87
movw $0x1, (%r14)
callq 0x58682
leaq 0x2aa3e4(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x2aa3da(%rip), %rax    # 0x338254
movw %cx, (%rax)
cmpl $0xa, %ebx
je 0x8de87
cmpl $0xd, %ebx
jne 0x8dec4
leaq 0x18aa42(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x8df02
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0x8deee
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
jne 0x8df16
leaq 0x2aa39b(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df1b
callq 0x8c50d
jmp 0x8df1b
leaq 0x2aa387(%rip), %rcx    # 0x338252
movzwl (%rcx), %eax
cmpq $0xffe, %rax            # imm = 0xFFE
ja 0x8df25
leaq 0x1(%rax), %rdx
movw %dx, (%rcx)
leaq 0x2a936c(%rip), %rcx    # 0x337250
movb %bl, (%rcx,%rax)
movb $0x0, 0x1(%rcx,%rax)
jmp 0x8df3f
leaq 0x2aa35d(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df1b
callq 0x8ca16
jmp 0x8df1b
leaq 0x2aa349(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0x8df1b
callq 0x8bef7
jmp 0x8df1b
callq 0x8d9ca
movl $0x1, 0x2ddd6f(%rip)    # 0x36bc94
xorl %eax, %eax
movw %ax, (%r14)
leaq 0x2aa320(%rip), %rcx    # 0x338252
movw %ax, (%rcx)
leaq 0x2aa318(%rip), %rcx    # 0x338254
movw %ax, (%rcx)
popq %rbx
popq %r14
popq %rbp
retq