// File: jkingan[P]ladyheather/heathgps.cpp
// Function: set_filter_config(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, int)
void set_filter_config(u08 pv, u08 stat, u08 alt, u08 kalman, u08 marine, int save)
{
u08 val;

   if(read_only) return;
   if(luxor) return;

   if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) return;
      if(ACU_360) return;
      if(ACUTIME) return;
      if(PALISADE) return;

      if(SV6_FAMILY) {
         set_alt_filter(alt);
         set_posn_filter(stat, pv);
      }
      else {
         send_tsip_start(0x70);
         send_byte(pv);
         send_byte(stat);
         send_byte(alt);
         send_byte(kalman); // rsvd on ThunderBolt,  kalman on ThunderBolt-E
         send_tsip_end();
         if(0 && save) save_segment(255, 20);
      }
   }
   else if(1 && (rcvr_type == MOTO_RCVR)) { // marine velocity filter - !!!! code in heathui.cpp will need to be changed to do this
      if((marine >= 10) && (marine <= 100)) {
         send_moto_start("AN");
         send_byte(marine);
         send_moto_end();
      }

      send_moto_start("AQ");
      send_byte(pv);
      send_moto_end();

      val = 0x00;
      if(stat) val |= 0x01;
      if(alt) val |= 0x02;
      send_moto_start("Aq");
      send_byte(val);
      send_moto_end();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %r8b, %al
movb %dil, -0x1(%rbp)
movb %sil, -0x2(%rbp)
movb %dl, -0x3(%rbp)
movb %cl, -0x4(%rbp)
movb %al, -0x5(%rbp)
movl %r9d, -0xc(%rbp)
leaq 0x305be3(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x90621
jmp 0x90805
leaq 0x20daf6(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x90632
jmp 0x90805
leaq 0x1e7477(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9076e
leaq 0x1e7466(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9066d
leaq 0x1e9b5d(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9066d
leaq 0x1e7475(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0x9066d
jmp 0x90805
leaq 0x1e743c(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x906a3
leaq 0x1e9b33(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x906a3
leaq 0x1e744b(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0x9069e
leaq 0x1e743f(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0x906a3
jmp 0x90805
leaq 0x1e7406(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x906c1
leaq 0x1e9afd(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x906c1
jmp 0x90805
leaq 0x1e73e8(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x906df
leaq 0x1e9adf(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
jne 0x906df
jmp 0x90805
leaq 0x1e73ca(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x90736
leaq 0x1e9ac1(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0x9071c
leaq 0x1e9ab5(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0x9071c
leaq 0x1e9aa9(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0x9071c
leaq 0x1e9a9d(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x90736
movzbl -0x3(%rbp), %edi
callq 0x90810
movb -0x2(%rbp), %al
movzbl %al, %edi
movzbl -0x1(%rbp), %esi
callq 0x904d0
jmp 0x90769
movl $0x70, %edi
callq 0x824f0
movzbl -0x1(%rbp), %edi
callq 0x7b210
movzbl -0x2(%rbp), %edi
callq 0x7b210
movzbl -0x3(%rbp), %edi
callq 0x7b210
movzbl -0x4(%rbp), %edi
callq 0x7b210
callq 0x82590
jmp 0x90805
leaq 0x1e733b(%rip), %rax    # 0x277ab0
cmpq $0x20, (%rax)
jne 0x90803
movzbl -0x5(%rbp), %eax
cmpl $0xa, %eax
jl 0x907ab
movzbl -0x5(%rbp), %eax
cmpl $0x64, %eax
jg 0x907ab
leaq 0xf6e02(%rip), %rdi     # 0x18759a
callq 0x86190
movzbl -0x5(%rbp), %edi
callq 0x7b210
callq 0x86230
leaq 0xf3854(%rip), %rdi     # 0x184006
callq 0x86190
movzbl -0x1(%rbp), %edi
callq 0x7b210
callq 0x86230
movb $0x0, -0xd(%rbp)
cmpb $0x0, -0x2(%rbp)
je 0x907d9
movzbl -0xd(%rbp), %eax
orl $0x1, %eax
movb %al, -0xd(%rbp)
cmpb $0x0, -0x3(%rbp)
je 0x907e9
movzbl -0xd(%rbp), %eax
orl $0x2, %eax
movb %al, -0xd(%rbp)
leaq 0xf3819(%rip), %rdi     # 0x184009
callq 0x86190
movzbl -0xd(%rbp), %edi
callq 0x7b210
callq 0x86230
jmp 0x90805
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)