// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_prs_msg()
void decode_prs_msg()
{
char c;
int i;

   start_msg_decode(0);

   nmea_msg[0] = 0;
   for(i=0; i<tsip_wptr; i++) {  // copy message from tsip buffer to nmea buffer
      c = tsip_byte();
      nmea_msg[i] = c;
      nmea_msg[i+1] = 0;
      if(i >= ((int)sizeof(nmea_msg)-12)) break;
   }
   msg_col = 0;     // index of next char to get from nmea buffer

   tsip_wptr = tsip_rptr = 0;
   tsip_sync = 0;

   // get the response from the reciver and pass it to (HOPEFULLY) the routine
   // that expects it...

   strupr(nmea_msg);

if(debug_file) fprintf(debug_file, "Decode msg %d:[%s]\n", polled_msg_id, nmea_msg);
//sprintf(debug_text, "Decode msg %d:[%s]", polled_msg_id, nmea_msg);


   prs_msg_id = polled_msg_id;
   if     (strstr(nmea_msg,  "OK")) ;
   else if(strstr(nmea_msg,  "BAD")) ;
   else if(strstr(nmea_msg,  "ERROR")) ;
   else if(!strcmp(nmea_msg, "PRS_10")) {  // response message to a reset
      if(debug_file) fprintf(debug_file, "Device reset!");
      BEEP(506);

      restart_prs_polling();

      queue_prs_cmd("VB1", PRS_VB_MSG);  // turn on verbose mode
      queue_prs_cmd("ST?", PRS_ST_MSG);  // get unit stats
   }
   else if(prs_msg_id == PRS_RC_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_RS_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_SN_MSG)   parse_prs_xx();
   else if(prs_msg_id == PRS_VB_MSG)   parse_prs_vb();
   else if(prs_msg_id == PRS_ID_MSG)   parse_prs_id();
   else if(prs_msg_id == PRS_ST_MSG)   parse_prs_st();
   else if(prs_msg_id == PRS_LM_MSG)   parse_prs_lm();
   else if(prs_msg_id == PRS_LO_MSG)   parse_prs_lo();
   else if(prs_msg_id == PRS_EP_MSG)   parse_prs_ep();
   else if(prs_msg_id == PRS_FC_MSG)   parse_prs_fc();
   else if(prs_msg_id == PRS_FC2_MSG)  parse_prs_fc2();
   else if(prs_msg_id == PRS_DS_MSG)   parse_prs_ds();
   else if(prs_msg_id == PRS_SF_MSG)   parse_prs_sf();
   else if(prs_msg_id == PRS_SS_MSG)   parse_prs_ss();
   else if(prs_msg_id == PRS_GA_MSG)   parse_prs_ga();
   else if(prs_msg_id == PRS_PH_MSG)   parse_prs_ph();
   else if(prs_msg_id == PRS_SP_MSG)   parse_prs_sp();
   else if(prs_msg_id == PRS_MS_MSG)   parse_prs_ms();
   else if(prs_msg_id == PRS_MO_MSG)   parse_prs_mo();
   else if(prs_msg_id == PRS_MR_MSG)   parse_prs_mr();
   else if(prs_msg_id == PRS_TT_MSG)   parse_prs_tt();
   else if(prs_msg_id == PRS_TS_MSG)   parse_prs_ts();
   else if(prs_msg_id == PRS_TO_MSG)   parse_prs_to();
   else if(prs_msg_id == PRS_PP_MSG)   parse_prs_xx();  // message can't be generated
   else if(prs_msg_id == PRS_PS_MSG)   parse_prs_ps();
   else if(prs_msg_id == PRS_PL_MSG)   parse_prs_pl();
   else if(prs_msg_id == PRS_PT_MSG)   parse_prs_pt();
   else if(prs_msg_id == PRS_PF_MSG)   parse_prs_pf();
   else if(prs_msg_id == PRS_PI_MSG)   parse_prs_pi();

   else if(prs_msg_id == PRS_SD0_MSG)  parse_prs_sd(0);
   else if(prs_msg_id == PRS_SD1_MSG)  parse_prs_sd(1);
   else if(prs_msg_id == PRS_SD2_MSG)  parse_prs_sd(2);
   else if(prs_msg_id == PRS_SD3_MSG)  parse_prs_sd(3);
   else if(prs_msg_id == PRS_SD4_MSG)  parse_prs_sd(4);
   else if(prs_msg_id == PRS_SD5_MSG)  parse_prs_sd(5);
   else if(prs_msg_id == PRS_SD6_MSG)  parse_prs_sd(6);
   else if(prs_msg_id == PRS_SD7_MSG)  parse_prs_sd(7);

   else if(prs_msg_id == PRS_AD0_MSG)  parse_prs_ad(0);
   else if(prs_msg_id == PRS_AD1_MSG)  parse_prs_ad(1);
   else if(prs_msg_id == PRS_AD2_MSG)  parse_prs_ad(2);
   else if(prs_msg_id == PRS_AD3_MSG)  parse_prs_ad(3);
   else if(prs_msg_id == PRS_AD4_MSG)  parse_prs_ad(4);
   else if(prs_msg_id == PRS_AD5_MSG)  parse_prs_ad(5);
   else if(prs_msg_id == PRS_AD6_MSG)  parse_prs_ad(6);
   else if(prs_msg_id == PRS_AD7_MSG)  parse_prs_ad(7);
   else if(prs_msg_id == PRS_AD8_MSG)  parse_prs_ad(8);
   else if(prs_msg_id == PRS_AD9_MSG)  parse_prs_ad(9);
   else if(prs_msg_id == PRS_AD10_MSG) parse_prs_ad(10);
   else if(prs_msg_id == PRS_AD11_MSG) parse_prs_ad(11);
   else if(prs_msg_id == PRS_AD12_MSG) parse_prs_ad(12);
   else if(prs_msg_id == PRS_AD13_MSG) parse_prs_ad(13);
   else if(prs_msg_id == PRS_AD14_MSG) parse_prs_ad(14);
   else if(prs_msg_id == PRS_AD15_MSG) parse_prs_ad(15);
   else if(prs_msg_id == PRS_AD16_MSG) parse_prs_ad(16);
   else if(prs_msg_id == PRS_AD17_MSG) parse_prs_ad(17);
   else if(prs_msg_id == PRS_AD18_MSG) parse_prs_ad(18);
   else if(prs_msg_id == PRS_AD19_MSG) parse_prs_ad(19);
   else if(prs_msg_id == SCPI_USER_MSG)     parse_scpi_user();
   else if(prs_msg_id == (0-SCPI_USER_MSG)) parse_scpi_user();

   i = get_norcvr_message();   // returns true if seconds just ticked
   if(SLOW_PRS_POLL && (seconds & 0x01));  // enable this to trigger high priority message polls every seoncd
                                           // ... but this slows polling loop cycle to around 1 minute
   else if(i && (prs_poll_tick == 0)) prs_poll_tick = 1;  // trigger high priority message polls
   poll_next_prs();

   prs_msg_id = 0;

   if(sim_file && sim_delay) {  // throttle sim file messages
      Sleep(sim_delay);
   }

   saw_rcvr_msg = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x73dcb
leaq 0x2a4a38(%rip), %r15    # 0x325830
movb $0x0, (%r15)
leaq 0x2a144f(%rip), %r14    # 0x322252
movzwl (%r14), %eax
cmpq %rax, %rbx
jae 0x80e27
callq 0x51c47
movb %al, (%rbx,%r15)
movb $0x0, 0x1(%rbx,%r15)
incq %rbx
cmpq $0x1f6, %rbx            # imm = 0x1F6
jne 0x80e03
leaq 0x2a4e16(%rip), %rax    # 0x325c44
andl $0x0, (%rax)
leaq 0x2a141c(%rip), %rax    # 0x322254
andw $0x0, (%rax)
andw $0x0, (%r14)
leaq 0x2a140e(%rip), %rax    # 0x322256
andw $0x0, (%rax)
leaq 0x2a49dd(%rip), %rdi    # 0x325830
callq 0x988f
leaq 0x1a7531(%rip), %rbx    # 0x228390
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x80e82
movl 0x2d5d93(%rip), %edx    # 0x356c00
leaq 0x8cada(%rip), %rsi     # 0x10d94e
leaq 0x2a49b5(%rip), %rcx    # 0x325830
xorl %eax, %eax
callq 0x9560
movl 0x2d5d77(%rip), %r14d   # 0x356c00
movl %r14d, 0x2d5d78(%rip)   # 0x356c08
leaq 0x2a4999(%rip), %rdi    # 0x325830
leaq 0x906c0(%rip), %rsi     # 0x11155e
callq 0x9090
testq %rax, %rax
jne 0x80ed8
leaq 0x2a4981(%rip), %rdi    # 0x325830
leaq 0x9069c(%rip), %rsi     # 0x111552
callq 0x9090
testq %rax, %rax
jne 0x80ed8
leaq 0x2a4969(%rip), %rdi    # 0x325830
leaq 0x8e6f9(%rip), %rsi     # 0x10f5c7
callq 0x9090
testq %rax, %rax
je 0x80f4e
callq 0x76a3e
leaq 0x2765e4(%rip), %rcx    # 0x2f74c8
testb $0x1, (%rcx)
jne 0x80f00
testl %eax, %eax
je 0x80f00
cmpl $0x0, 0x2d5d04(%rip)    # 0x356bf8
jne 0x80f00
movl $0x1, 0x2d5cf8(%rip)    # 0x356bf8
callq 0x65b05
andl $0x0, 0x2d5cfc(%rip)    # 0x356c08
leaq 0x1a74ad(%rip), %rax    # 0x2283c0
cmpq $0x0, (%rax)
setne %al
leaq 0x18c6df(%rip), %rcx    # 0x20d600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x80f36
callq 0xae83
leaq 0x1a8063(%rip), %rax    # 0x228fa0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2a48db(%rip), %rdi    # 0x325830
leaq 0x8ccd5(%rip), %rsi     # 0x10dc31
pushq $0x7
popq %rdx
callq 0x9380
testl %eax, %eax
je 0x80f8e
leal -0x1f6(%r14), %eax
cmpl $0x75, %eax
ja 0x80fde
leaq 0x88421(%rip), %rcx     # 0x10939c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8000a
jmp 0x80ed8
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x80fa8
leaq 0x8cc9b(%rip), %rdi     # 0x10dc38
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x9750
movl $0x1fa, %edi            # imm = 0x1FA
callq 0x9d23
callq 0x7e67f
leaq 0x8a64d(%rip), %rdi     # 0x10b60b
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x576d4
leaq 0x8e8f1(%rip), %rdi     # 0x10f8c0
movl $0x1f9, %esi            # imm = 0x1F9
callq 0x576d4
jmp 0x80ed8
cmpl $-0x25, %r14d
je 0x80fee
cmpl $0x25, %r14d
jne 0x80ed8
callq 0x7f628
jmp 0x80ed8
pushq $0x13
jmp 0x81180
pushq $0x8
jmp 0x81180
pushq $0x6
jmp 0x8115f
pushq $0x7
jmp 0x81180
pushq $0xd
jmp 0x81180
callq 0x80917
jmp 0x80ed8
pushq $0x5
jmp 0x81180
callq 0x808d2
jmp 0x80ed8
callq 0x8064c
jmp 0x80ed8
xorl %edi, %edi
jmp 0x81160
pushq $0x2
jmp 0x81180
callq 0x8095c
jmp 0x80ed8
callq 0x80538
jmp 0x80ed8
callq 0x805c2
jmp 0x80ed8
xorl %edi, %edi
jmp 0x81181
callq 0x801f5
jmp 0x80ed8
callq 0x80607
jmp 0x80ed8
pushq $0x10
jmp 0x81180
callq 0x80803
jmp 0x80ed8
callq 0x80381
jmp 0x80ed8
callq 0x8017e
jmp 0x80ed8
pushq $0x3
jmp 0x8115f
callq 0x80b5d
jmp 0x80ed8
callq 0x8074d
jmp 0x80ed8
callq 0x80848
jmp 0x80ed8
callq 0x8009f
jmp 0x80ed8
callq 0x804c6
jmp 0x80ed8
pushq $0x2
jmp 0x8115f
callq 0x8029b
jmp 0x80ed8
callq 0x8057d
jmp 0x80ed8
callq 0x809a1
jmp 0x80ed8
pushq $0xe
jmp 0x81180
callq 0x806c3
jmp 0x80ed8
pushq $0xc
jmp 0x81180
callq 0x80792
jmp 0x80ed8
callq 0x8088d
jmp 0x80ed8
callq 0x80708
jmp 0x80ed8
pushq $0x3
jmp 0x81180
pushq $0x1
jmp 0x81180
pushq $0x7
jmp 0x8115f
pushq $0x4
jmp 0x8115f
pushq $0x6
jmp 0x81180
pushq $0x1
jmp 0x8115f
callq 0x80256
jmp 0x80ed8
pushq $0x9
jmp 0x81180
pushq $0x5
popq %rdi
callq 0x809e6
jmp 0x80ed8
pushq $0x12
jmp 0x81180
pushq $0x11
jmp 0x81180
pushq $0xf
jmp 0x81180
pushq $0x4
jmp 0x81180
pushq $0xb
jmp 0x81180
pushq $0xa
popq %rdi
callq 0x80a3f
jmp 0x80ed8