// File: 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
subq $0x10, %rsp
xorl %edi, %edi
callq 0xae4a0
leaq 0x2d907a(%rip), %rax    # 0x39aa10
movb $0x0, (%rax)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x2d5a88(%rip), %rcx    # 0x397432
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xc19f6
callq 0x7a510
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %dl
movslq -0x8(%rbp), %rcx
leaq 0x2d9049(%rip), %rax    # 0x39aa10
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2d9036(%rip), %rax    # 0x39aa10
movb $0x0, (%rax,%rcx)
cmpl $0x1f5, -0x8(%rbp)      # imm = 0x1F5
jl 0xc19e9
jmp 0xc19f6
jmp 0xc19eb
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xc19a0
leaq 0x2d9427(%rip), %rax    # 0x39ae24
movl $0x0, (%rax)
leaq 0x2d5a2a(%rip), %rax    # 0x397434
movw $0x0, (%rax)
leaq 0x2d5a1c(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x2d5a14(%rip), %rax    # 0x397436
movw $0x0, (%rax)
leaq 0x2d8fe2(%rip), %rdi    # 0x39aa10
callq 0x9890
leaq 0x1dbb36(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xc1a65
leaq 0x1dbb29(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl 0x30a380(%rip), %edx    # 0x3cbdd0
leaq 0xc5296(%rip), %rsi     # 0x186ced
leaq 0x2d8fb2(%rip), %rcx    # 0x39aa10
movb $0x0, %al
callq 0x9550
movl 0x30a365(%rip), %eax    # 0x3cbdd0
movl %eax, 0x30a367(%rip)    # 0x3cbdd8
leaq 0x2d8f98(%rip), %rdi    # 0x39aa10
leaq 0xc8f54(%rip), %rsi     # 0x18a9d3
callq 0x9090
cmpq $0x0, %rax
je 0xc1a8f
jmp 0xc2138
leaq 0x2d8f7a(%rip), %rdi    # 0x39aa10
leaq 0xc8f2a(%rip), %rsi     # 0x18a9c7
callq 0x9090
cmpq $0x0, %rax
je 0xc1aad
jmp 0xc2136
leaq 0x2d8f5c(%rip), %rdi    # 0x39aa10
leaq 0xc6eb8(%rip), %rsi     # 0x188973
callq 0x9090
cmpq $0x0, %rax
je 0xc1acb
jmp 0xc2134
leaq 0x2d8f3e(%rip), %rdi    # 0x39aa10
leaq 0xc54f7(%rip), %rsi     # 0x186fd0
callq 0x9510
cmpl $0x0, %eax
jne 0xc1b3e
leaq 0x1dba86(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xc1b08
leaq 0x1dba79(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0xc54d6(%rip), %rsi     # 0x186fd7
movb $0x0, %al
callq 0x9550
movl $0x1fa, %edi            # imm = 0x1FA
callq 0x9ec0
callq 0xbe120
leaq 0xc2e35(%rip), %rdi     # 0x184953
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x82fd0
leaq 0xc713d(%rip), %rdi     # 0x188c6c
movl $0x1f9, %esi            # imm = 0x1F9
callq 0x82fd0
jmp 0xc2132
cmpl $0x1f4, 0x30a290(%rip)  # imm = 0x1F4
jne 0xc1b54
callq 0xc04d0
jmp 0xc2130
cmpl $0x1f5, 0x30a27a(%rip)  # imm = 0x1F5
jne 0xc1b6a
callq 0xc04d0
jmp 0xc212e
cmpl $0x1f7, 0x30a264(%rip)  # imm = 0x1F7
jne 0xc1b80
callq 0xc04d0
jmp 0xc212c
cmpl $0x1f8, 0x30a24e(%rip)  # imm = 0x1F8
jne 0xc1b96
callq 0xc1670
jmp 0xc212a
cmpl $0x1f6, 0x30a238(%rip)  # imm = 0x1F6
jne 0xc1bac
callq 0xc04e0
jmp 0xc2128
cmpl $0x1f9, 0x30a222(%rip)  # imm = 0x1F9
jne 0xc1bc2
callq 0xc0590
jmp 0xc2126
cmpl $0x1fa, 0x30a20c(%rip)  # imm = 0x1FA
jne 0xc1bd8
callq 0xc0730
jmp 0xc2124
cmpl $0x1fb, 0x30a1f6(%rip)  # imm = 0x1FB
jne 0xc1bee
callq 0xc07f0
jmp 0xc2122
cmpl $0x210, 0x30a1e0(%rip)  # imm = 0x210
jne 0xc1c04
callq 0xc0880
jmp 0xc2120
cmpl $0x1fc, 0x30a1ca(%rip)  # imm = 0x1FC
jne 0xc1c1a
callq 0xc08e0
jmp 0xc211e
cmpl $0x20f, 0x30a1b4(%rip)  # imm = 0x20F
jne 0xc1c30
callq 0xc0a30
jmp 0xc211c
cmpl $0x1fd, 0x30a19e(%rip)  # imm = 0x1FD
jne 0xc1c46
callq 0xc0c20
jmp 0xc211a
cmpl $0x1fe, 0x30a188(%rip)  # imm = 0x1FE
jne 0xc1c5c
callq 0xc0cc0
jmp 0xc2118
cmpl $0x1ff, 0x30a172(%rip)  # imm = 0x1FF
jne 0xc1c72
callq 0xc0d20
jmp 0xc2116
cmpl $0x200, 0x30a15c(%rip)  # imm = 0x200
jne 0xc1c88
callq 0xc0d80
jmp 0xc2114
cmpl $0x201, 0x30a146(%rip)  # imm = 0x201
jne 0xc1c9e
callq 0xc0de0
jmp 0xc2112
cmpl $0x202, 0x30a130(%rip)  # imm = 0x202
jne 0xc1cb4
callq 0xc0e40
jmp 0xc2110
cmpl $0x203, 0x30a11a(%rip)  # imm = 0x203
jne 0xc1cca
callq 0xc0ed0
jmp 0xc210e
cmpl $0x204, 0x30a104(%rip)  # imm = 0x204
jne 0xc1ce0
callq 0xc0f30
jmp 0xc210c
cmpl $0x205, 0x30a0ee(%rip)  # imm = 0x205
jne 0xc1cf6
callq 0xc0f90
jmp 0xc210a
cmpl $0x206, 0x30a0d8(%rip)  # imm = 0x206
jne 0xc1d0c
callq 0xc0ff0
jmp 0xc2108
cmpl $0x207, 0x30a0c2(%rip)  # imm = 0x207
jne 0xc1d22
callq 0xc10b0
jmp 0xc2106
cmpl $0x208, 0x30a0ac(%rip)  # imm = 0x208
jne 0xc1d38
callq 0xc1110
jmp 0xc2104
cmpl $0x20e, 0x30a096(%rip)  # imm = 0x20E
jne 0xc1d4e
callq 0xc04d0
jmp 0xc2102
cmpl $0x209, 0x30a080(%rip)  # imm = 0x209
jne 0xc1d64
callq 0xc1170
jmp 0xc2100
cmpl $0x20a, 0x30a06a(%rip)  # imm = 0x20A
jne 0xc1d7a
callq 0xc11d0
jmp 0xc20fe
cmpl $0x20b, 0x30a054(%rip)  # imm = 0x20B
jne 0xc1d90
callq 0xc1230
jmp 0xc20fc
cmpl $0x20c, 0x30a03e(%rip)  # imm = 0x20C
jne 0xc1da6
callq 0xc1290
jmp 0xc20fa
cmpl $0x20d, 0x30a028(%rip)  # imm = 0x20D
jne 0xc1dbc
callq 0xc12f0
jmp 0xc20f8
cmpl $0x212, 0x30a012(%rip)  # imm = 0x212
jne 0xc1dd4
xorl %edi, %edi
callq 0xc1350
jmp 0xc20f6
cmpl $0x213, 0x309ffa(%rip)  # imm = 0x213
jne 0xc1def
movl $0x1, %edi
callq 0xc1350
jmp 0xc20f4
cmpl $0x214, 0x309fdf(%rip)  # imm = 0x214
jne 0xc1e0a
movl $0x2, %edi
callq 0xc1350
jmp 0xc20f2
cmpl $0x215, 0x309fc4(%rip)  # imm = 0x215
jne 0xc1e25
movl $0x3, %edi
callq 0xc1350
jmp 0xc20f0
cmpl $0x216, 0x309fa9(%rip)  # imm = 0x216
jne 0xc1e40
movl $0x4, %edi
callq 0xc1350
jmp 0xc20ee
cmpl $0x217, 0x309f8e(%rip)  # imm = 0x217
jne 0xc1e5b
movl $0x5, %edi
callq 0xc1350
jmp 0xc20ec
cmpl $0x218, 0x309f73(%rip)  # imm = 0x218
jne 0xc1e76
movl $0x6, %edi
callq 0xc1350
jmp 0xc20ea
cmpl $0x219, 0x309f58(%rip)  # imm = 0x219
jne 0xc1e91
movl $0x7, %edi
callq 0xc1350
jmp 0xc20e8
cmpl $0x258, 0x309f3d(%rip)  # imm = 0x258
jne 0xc1ea9
xorl %edi, %edi
callq 0xc13e0
jmp 0xc20e6
cmpl $0x259, 0x309f25(%rip)  # imm = 0x259
jne 0xc1ec4
movl $0x1, %edi
callq 0xc13e0
jmp 0xc20e4
cmpl $0x25a, 0x309f0a(%rip)  # imm = 0x25A
jne 0xc1edf
movl $0x2, %edi
callq 0xc13e0
jmp 0xc20e2
cmpl $0x25b, 0x309eef(%rip)  # imm = 0x25B
jne 0xc1efa
movl $0x3, %edi
callq 0xc13e0
jmp 0xc20e0
cmpl $0x25c, 0x309ed4(%rip)  # imm = 0x25C
jne 0xc1f15
movl $0x4, %edi
callq 0xc13e0
jmp 0xc20de
cmpl $0x25d, 0x309eb9(%rip)  # imm = 0x25D
jne 0xc1f30
movl $0x5, %edi
callq 0xc13e0
jmp 0xc20dc
cmpl $0x25e, 0x309e9e(%rip)  # imm = 0x25E
jne 0xc1f4b
movl $0x6, %edi
callq 0xc13e0
jmp 0xc20da
cmpl $0x25f, 0x309e83(%rip)  # imm = 0x25F
jne 0xc1f66
movl $0x7, %edi
callq 0xc13e0
jmp 0xc20d8
cmpl $0x260, 0x309e68(%rip)  # imm = 0x260
jne 0xc1f81
movl $0x8, %edi
callq 0xc13e0
jmp 0xc20d6
cmpl $0x261, 0x309e4d(%rip)  # imm = 0x261
jne 0xc1f9c
movl $0x9, %edi
callq 0xc13e0
jmp 0xc20d4
cmpl $0x262, 0x309e32(%rip)  # imm = 0x262
jne 0xc1fb7
movl $0xa, %edi
callq 0xc13e0
jmp 0xc20d2
cmpl $0x263, 0x309e17(%rip)  # imm = 0x263
jne 0xc1fd2
movl $0xb, %edi
callq 0xc13e0
jmp 0xc20d0
cmpl $0x264, 0x309dfc(%rip)  # imm = 0x264
jne 0xc1fed
movl $0xc, %edi
callq 0xc13e0
jmp 0xc20ce
cmpl $0x265, 0x309de1(%rip)  # imm = 0x265
jne 0xc2008
movl $0xd, %edi
callq 0xc13e0
jmp 0xc20cc
cmpl $0x266, 0x309dc6(%rip)  # imm = 0x266
jne 0xc2023
movl $0xe, %edi
callq 0xc13e0
jmp 0xc20ca
cmpl $0x267, 0x309dab(%rip)  # imm = 0x267
jne 0xc203e
movl $0xf, %edi
callq 0xc13e0
jmp 0xc20c8
cmpl $0x268, 0x309d90(%rip)  # imm = 0x268
jne 0xc2056
movl $0x10, %edi
callq 0xc13e0
jmp 0xc20c6
cmpl $0x269, 0x309d78(%rip)  # imm = 0x269
jne 0xc206e
movl $0x11, %edi
callq 0xc13e0
jmp 0xc20c4
cmpl $0x26a, 0x309d60(%rip)  # imm = 0x26A
jne 0xc2086
movl $0x12, %edi
callq 0xc13e0
jmp 0xc20c2
cmpl $0x26b, 0x309d48(%rip)  # imm = 0x26B
jne 0xc209e
movl $0x13, %edi
callq 0xc13e0
jmp 0xc20c0
cmpl $0x25, 0x309d33(%rip)   # 0x3cbdd8
jne 0xc20ae
callq 0xbf6d0
jmp 0xc20be
cmpl $-0x25, 0x309d23(%rip)  # 0x3cbdd8
jne 0xc20bc
callq 0xbf6d0
jmp 0xc20be
jmp 0xc20c0
jmp 0xc20c2
jmp 0xc20c4
jmp 0xc20c6
jmp 0xc20c8
jmp 0xc20ca
jmp 0xc20cc
jmp 0xc20ce
jmp 0xc20d0
jmp 0xc20d2
jmp 0xc20d4
jmp 0xc20d6
jmp 0xc20d8
jmp 0xc20da
jmp 0xc20dc
jmp 0xc20de
jmp 0xc20e0
jmp 0xc20e2
jmp 0xc20e4
jmp 0xc20e6
jmp 0xc20e8
jmp 0xc20ea
jmp 0xc20ec
jmp 0xc20ee
jmp 0xc20f0
jmp 0xc20f2
jmp 0xc20f4
jmp 0xc20f6
jmp 0xc20f8
jmp 0xc20fa
jmp 0xc20fc
jmp 0xc20fe
jmp 0xc2100
jmp 0xc2102
jmp 0xc2104
jmp 0xc2106
jmp 0xc2108
jmp 0xc210a
jmp 0xc210c
jmp 0xc210e
jmp 0xc2110
jmp 0xc2112
jmp 0xc2114
jmp 0xc2116
jmp 0xc2118
jmp 0xc211a
jmp 0xc211c
jmp 0xc211e
jmp 0xc2120
jmp 0xc2122
jmp 0xc2124
jmp 0xc2126
jmp 0xc2128
jmp 0xc212a
jmp 0xc212c
jmp 0xc212e
jmp 0xc2130
jmp 0xc2132
jmp 0xc2134
jmp 0xc2136
jmp 0xc2138
callq 0xb2630
movl %eax, -0x8(%rbp)
leaq 0x2aa561(%rip), %rax    # 0x36c6a8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xc2153
jmp 0xc216e
cmpl $0x0, -0x8(%rbp)
je 0xc216c
cmpl $0x0, 0x309c68(%rip)    # 0x3cbdc8
jne 0xc216c
movl $0x1, 0x309c5c(%rip)    # 0x3cbdc8
jmp 0xc216e
callq 0x974f0
movl $0x0, 0x309c5b(%rip)    # 0x3cbdd8
leaq 0x1db41c(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0xc21a8
leaq 0x1c064f(%rip), %rax    # 0x2827e0
cmpq $0x0, (%rax)
je 0xc21a8
leaq 0x1c0642(%rip), %rax    # 0x2827e0
movq (%rax), %rax
movl %eax, %edi
callq 0xb8b0
leaq 0x1dbfd1(%rip), %rax    # 0x29e180
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)