// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: get_rcvr_ticc_message(unsigned int)
void get_rcvr_ticc_message(unsigned port)
{
u08 c;
static u08 last_c = 0;

   // This routine buffers up an incoming tsip message.  When the end of the
   // message is seen, the message is parsed and decoded with decode_tsip_msg()
   // Messages can end with 0x0D, 0x0A, or both.

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

   if(port == RCVR_PORT) {  // TICC on the main input decice (/rxi)
      c = get_com_char();
      if(com[RCVR_PORT].rcv_error) {      // parity/framing/overrun errors
         com[RCVR_PORT].rcv_error = 0;
         //!!!!!qqqq    goto rst_msg;
      }
   }
   else {  // TICC on the auxiliary input device (/ei=)
      c = get_ticc_char();  // aaattt
      if(com[port].rcv_error) {      // parity/framing/overrun errors
         com[port].rcv_error = 0;
         //!!!!!qqqq    goto rst_msg;
      }
   }


   last_c = c;

   if(tsip_sync == 0) {    // syncing to start of message, search for a line feed
      if((c == 0x0D) || (c == 0x0A)) {
         tsip_sync = 1;
         get_sync_time();
      }
      tsip_wptr = 0;
      tsip_rptr = 0;
      return;
   }
   else if(tsip_sync == 1) { // 0x0A has been seen, now build the message
      if((c == 0x0D) || (c == 0x0A)) {
         if(tsip_wptr == 0) return; // end-of-line with no data in the message buffer
         goto tsip_end;  // end of message
      }

      if(tsip_wptr < MAX_TSIP) {   // add char to the message buffer
         tsip_buf[tsip_wptr++] = c;
      }
      else {  // buffer overflow, ignore the message
         tsip_error |= OVFL_ERROR;
         goto rst_msg;
      }
   }
   else {  // end of message
      tsip_end:
      if(tsip_wptr) {           // we have a message
         if((ticc_mode == 'I') && plm_freq && (++plm_cycles % plm_freq)) ;   // decimate ticc input
         else decode_ticc_msg(port); // process the message
         packet_end = 1;
      }

      rst_msg:
      tsip_wptr = 0;     // prepare for next message
      tsip_rptr = 0;
      if((c == 0x0D) || (c == 0x0A)) tsip_sync = 1;
      else tsip_sync = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %r14d
callq 0xb9c3
testl %eax, %eax
je 0xadb68
movl %r14d, %edi
callq 0x1ea2c
cmpl $0xa, %r14d
jne 0xadb7a
callq 0x584d5
movl %eax, %ebx
leaq 0x260789(%rip), %rax    # 0x30e2e0
cmpb $0x0, 0x17a12(%rax)
je 0xadba8
addq $0x17a12, %rax          # imm = 0x17A12
jmp 0xadba5
movl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e6a0
callq 0x5853c
movl %eax, %ebx
movl %r14d, %eax
imulq $0x2260, %rax, %rax     # imm = 0x2260
leaq 0x26074e(%rip), %rcx    # 0x30e2e0
cmpb $0x0, 0x2252(%rcx,%rax)
je 0xadba8
addq %rcx, %rax
addq $0x2252, %rax           # imm = 0x2252
movb $0x0, (%rax)
leaq 0x28a6a7(%rip), %r15    # 0x338256
movzwl (%r15), %eax
cmpl $0x1, %eax
je 0xadbec
testl %eax, %eax
jne 0xadc0b
cmpl $0xd, %ebx
je 0xadbc6
cmpl $0xa, %ebx
jne 0xadbd1
movw $0x1, (%r15)
callq 0x58682
leaq 0x28a67a(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x28a670(%rip), %rax    # 0x338254
movw %cx, (%rax)
jmp 0xadcb2
cmpl $0xd, %ebx
je 0xadbfa
cmpl $0xa, %ebx
jne 0xadc90
leaq 0x28a651(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0xadcb2
leaq 0x28a640(%rip), %rax    # 0x338252
cmpw $0x0, (%rax)
je 0xadc60
leaq 0x25f0ed(%rip), %rax    # 0x30cd0c
cmpl $0x49, (%rax)
sete %al
leaq 0x16d488(%rip), %rcx    # 0x21b0b4
movl (%rcx), %ecx
testl %ecx, %ecx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0xadc4e
leaq 0x16d477(%rip), %rdx    # 0x21b0b8
movl (%rdx), %eax
incl %eax
movl %eax, (%rdx)
cltd
idivl %ecx
testl %edx, %edx
jne 0xadc56
movl %r14d, %edi
callq 0x78b23
movl $0x1, 0x2be034(%rip)    # 0x36bc94
leaq 0x28a5eb(%rip), %rax    # 0x338252
xorl %ecx, %ecx
movw %cx, (%rax)
leaq 0x28a5e1(%rip), %rax    # 0x338254
movw %cx, (%rax)
cmpl $0xd, %ebx
je 0xadc80
cmpl $0xa, %ebx
jne 0xadc88
movw $0x1, (%r15)
jmp 0xadcb2
movw $0x0, (%r15)
jmp 0xadcb2
leaq 0x28a5bb(%rip), %rcx    # 0x338252
movzwl (%rcx), %eax
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0xadcbd
leal 0x1(%rax), %edx
movw %dx, (%rcx)
leaq 0x2895a1(%rip), %rcx    # 0x337250
movb %bl, (%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1912ac(%rip), %rax    # 0x23ef70
orb $-0x80, 0x1(%rax)
jmp 0xadc60