// File: jkingan[P]ladyheather/heathgps.cpp
// Function: request_misc_msg()
void request_misc_msg()
{
   // This routine requests various minor status messages
   // It requests a different message each time it is called.

   if(first_request) {
////  request_rcvr_info(200);
      first_request = 0;
      saw_version = 0;
      req_num = 0;
   }

   if(POLLED_RCVR) { // these receivers have their own message polling routines
      return;
   }

   ++req_num;
   if     (req_num ==  1) request_version();
   else if(req_num ==  2) request_rcvr_config(2); 
   else if(req_num ==  3) request_timing_mode();
   else if(req_num ==  4) request_pps_mode();
   else if(req_num ==  5) request_pps_info();
   else if(req_num ==  6) request_survey_params();
   else if(req_num ==  7) request_sat_list();
   else if(req_num ==  8) {
      if(log_db == 0) request_sig_levels();
   }
   else if(req_num ==  9) request_sat_health(); 
   else if(req_num == 10) request_datum(); 
   else if(req_num == 11) request_utc_info();  // this message can hose up some res_t receivers
   else if(req_num == 12) request_filter_config();    // tsip only
else if(SV6_FAMILY && !ACU_GG && !ACU_360 && !ACUTIME && !PALISADE) req_num = 0;
else if(ACE3) req_num = 0;
else if(PALISADE) req_num = 0;
//   else if((rcvr_type == TSIP_RCVR) && !SV6 && !ACE3 && !PALISADE) {
   else if(rcvr_type == TSIP_RCVR) {
      if     (req_num == 13) request_all_dis_params();   // tsip only
      else if(req_num == 14) request_eeprom_status();    // tsip only
      else if(req_num == 15) request_dac_voltage();      // tsip only
      else if(req_num == 16) request_sat_status(0x00);   // tsip only
      else if(req_num == 17) request_alm_health();       // tsip only
      else if(req_num == 18) request_io_options();       // tsip only
      else if(req_num == 19) request_packet_mask();      // tsip only
      else if(req_num == 20) request_last_posn();        // tsip only
//    else if(saw_version == 0) {   // no response to version message requests
//    else if((com[RCVR_PORT].user_set_baud == 0) && ((have_info & VERSION_INFO) == 0) || ((have_info & PRODN_PARAMS) == 0) && ((have_info & MANUF_PARAMS) == 0)) {   // no response to version message requests
      else if(detect_rcvr_type && (com[RCVR_PORT].user_set_baud == 0) && ((saw_version == 0) || (saw_version == 0x0C))) {   // no response to version message requests
//sprintf(plot_title, "rnum:%d  saw_v:%d  new parity:%d", req_num, saw_version, com[RCVR_PORT].parity);
BEEP(503);
         com[RCVR_PORT].parity = (com[RCVR_PORT].parity+1) % 3;   // try different parity
         init_com(RCVR_PORT, 106);
         need_redraw = 2013; // ggggg
         req_num = 0;
      }
      else req_num = 0;
   }
   else req_num = 0;

   #ifdef SAT_TRAILS
      // here we try to get position info for untracked sats,  but tbolts
      // don't seem to want to give up the goods on untracked sats... but
      // we ask anyway
      if(++status_prn > 32) status_prn = 1; // !!!! max_sat_check
      request_sat_status(status_prn);
   #endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2c9625(%rip), %rax    # 0x36c600
cmpl $0x0, (%rax)
je 0xa3007
leaq 0x2c9619(%rip), %rax    # 0x36c600
movl $0x0, (%rax)
leaq 0x2c95f4(%rip), %rax    # 0x36c5e8
movl $0x0, (%rax)
leaq 0x1fb0c7(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
leaq 0x1d4aa2(%rip), %rcx    # 0x277ab0
movabsq $0x101b0e5018, %rax     # imm = 0x101B0E5018
andq (%rcx), %rax
cmpq $0x0, %rax
je 0xa3026
jmp 0xa3460
leaq 0x1fb09b(%rip), %rax    # 0x29e0c8
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1fb08f(%rip), %rax    # 0x29e0c8
movl %ecx, (%rax)
leaq 0x1fb086(%rip), %rax    # 0x29e0c8
cmpl $0x1, (%rax)
jne 0xa3051
callq 0x8b430
jmp 0xa342b
leaq 0x1fb070(%rip), %rax    # 0x29e0c8
cmpl $0x2, (%rax)
jne 0xa306c
movl $0x2, %edi
callq 0x8c270
jmp 0xa3429
leaq 0x1fb055(%rip), %rax    # 0x29e0c8
cmpl $0x3, (%rax)
jne 0xa3082
callq 0x94c50
jmp 0xa3427
leaq 0x1fb03f(%rip), %rax    # 0x29e0c8
cmpl $0x4, (%rax)
jne 0xa3098
callq 0x93230
jmp 0xa3425
leaq 0x1fb029(%rip), %rax    # 0x29e0c8
cmpl $0x5, (%rax)
jne 0xa30ae
callq 0x91720
jmp 0xa3423
leaq 0x1fb013(%rip), %rax    # 0x29e0c8
cmpl $0x6, (%rax)
jne 0xa30c4
callq 0x9a9e0
jmp 0xa3421
leaq 0x1faffd(%rip), %rax    # 0x29e0c8
cmpl $0x7, (%rax)
jne 0xa30da
callq 0x8bdd0
jmp 0xa341f
leaq 0x1fafe7(%rip), %rax    # 0x29e0c8
cmpl $0x8, (%rax)
jne 0xa30ff
leaq 0x1fa508(%rip), %rax    # 0x29d5f5
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xa30fa
callq 0x8bfa0
jmp 0xa341d
leaq 0x1fafc2(%rip), %rax    # 0x29e0c8
cmpl $0x9, (%rax)
jne 0xa3115
callq 0x8ea20
jmp 0xa341b
leaq 0x1fafac(%rip), %rax    # 0x29e0c8
cmpl $0xa, (%rax)
jne 0xa312b
callq 0x91420
jmp 0xa3419
leaq 0x1faf96(%rip), %rax    # 0x29e0c8
cmpl $0xb, (%rax)
jne 0xa3141
callq 0x85b00
jmp 0xa3417
leaq 0x1faf80(%rip), %rax    # 0x29e0c8
cmpl $0xc, (%rax)
jne 0xa3157
callq 0x902f0
jmp 0xa3415
leaq 0x1d4952(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa3236
leaq 0x1d7045(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0xa319c
leaq 0x1d7039(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0xa319c
leaq 0x1d702d(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0xa319c
leaq 0x1d7021(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa3236
leaq 0x1d490d(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa31c1
leaq 0x1d7004(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa31c1
leaq 0x1d491c(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa3236
leaq 0x1d48e8(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa31f2
leaq 0x1d6fdf(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa31f2
leaq 0x1d48f7(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0xa3236
leaq 0x1d48eb(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa3236
leaq 0x1d48b7(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa320b
leaq 0x1d6fae(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
je 0xa3236
leaq 0x1d489e(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa3224
leaq 0x1d6f95(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0xa3236
leaq 0x1fae9d(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa3413
leaq 0x1d4873(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa3261
leaq 0x1d6f6a(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
jne 0xa3261
leaq 0x1fae72(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa3411
leaq 0x1d4848(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa328c
leaq 0x1d6f3f(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
jne 0xa328c
leaq 0x1fae47(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa340f
leaq 0x1d481d(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa3400
leaq 0x1fae24(%rip), %rax    # 0x29e0c8
cmpl $0xd, (%rax)
jne 0xa32b3
callq 0x99cb0
jmp 0xa33fe
leaq 0x1fae0e(%rip), %rax    # 0x29e0c8
cmpl $0xe, (%rax)
jne 0xa32c9
callq 0x8ffb0
jmp 0xa33fc
leaq 0x1fadf8(%rip), %rax    # 0x29e0c8
cmpl $0xf, (%rax)
jne 0xa32df
callq 0x94500
jmp 0xa33fa
leaq 0x1fade2(%rip), %rax    # 0x29e0c8
cmpl $0x10, (%rax)
jne 0xa32f7
xorl %edi, %edi
callq 0x8ff50
jmp 0xa33f8
leaq 0x1fadca(%rip), %rax    # 0x29e0c8
cmpl $0x11, (%rax)
jne 0xa330d
callq 0x8c020
jmp 0xa33f6
leaq 0x1fadb4(%rip), %rax    # 0x29e0c8
cmpl $0x12, (%rax)
jne 0xa3323
callq 0x8e670
jmp 0xa33f4
leaq 0x1fad9e(%rip), %rax    # 0x29e0c8
cmpl $0x13, (%rax)
jne 0xa3339
callq 0x95b20
jmp 0xa33f2
leaq 0x1fad88(%rip), %rax    # 0x29e0c8
cmpl $0x14, (%rax)
jne 0xa334f
callq 0x8e740
jmp 0xa33f0
leaq 0x1d6e52(%rip), %rax    # 0x27a1a8
cmpl $0x0, (%rax)
je 0xa33e1
leaq 0x2ca15a(%rip), %rax    # 0x36d4c0
cmpl $0x0, 0x17a18(%rax)
jne 0xa33e1
leaq 0x2c9272(%rip), %rax    # 0x36c5e8
cmpl $0x0, (%rax)
je 0xa3387
leaq 0x2c9266(%rip), %rax    # 0x36c5e8
cmpl $0xc, (%rax)
jne 0xa33e1
movl $0x1f7, %edi            # imm = 0x1F7
callq 0x9ec0
leaq 0x2ca128(%rip), %rax    # 0x36d4c0
movl 0x159dc(%rax), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
leaq 0x2ca110(%rip), %rax    # 0x36d4c0
movl %edx, 0x159dc(%rax)
movl $0xa, %edi
movl $0x6a, %esi
callq 0xc0e0
leaq 0x1d4658(%rip), %rax    # 0x277a24
movl $0x7dd, (%rax)          # imm = 0x7DD
leaq 0x1facef(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa33ee
leaq 0x1face0(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa33f0
jmp 0xa33f2
jmp 0xa33f4
jmp 0xa33f6
jmp 0xa33f8
jmp 0xa33fa
jmp 0xa33fc
jmp 0xa33fe
jmp 0xa340d
leaq 0x1facc1(%rip), %rax    # 0x29e0c8
movl $0x0, (%rax)
jmp 0xa340f
jmp 0xa3411
jmp 0xa3413
jmp 0xa3415
jmp 0xa3417
jmp 0xa3419
jmp 0xa341b
jmp 0xa341d
jmp 0xa341f
jmp 0xa3421
jmp 0xa3423
jmp 0xa3425
jmp 0xa3427
jmp 0xa3429
jmp 0xa342b
leaq 0x1fac9a(%rip), %rax    # 0x29e0cc
movl (%rax), %eax
addl $0x1, %eax
leaq 0x1fac8e(%rip), %rcx    # 0x29e0cc
movl %eax, (%rcx)
cmpl $0x20, %eax
jle 0xa3452
leaq 0x1fac80(%rip), %rax    # 0x29e0cc
movl $0x1, (%rax)
leaq 0x1fac73(%rip), %rax    # 0x29e0cc
movl (%rax), %edi
callq 0x8ff50
popq %rbp
retq
nopw %cs:(%rax,%rax)