// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_perdsys()
void parse_perdsys()
{
   get_msg_field();
   if(strstr(msg_field, "VERSION")) {  
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_device, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_version, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_query, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_model, msg_field);
         if(strstr(esip_model, "GT8736")) furuno_type = 8736;
         else if(strstr(esip_model, "GT87")) furuno_type = 87;
         else furuno_type = 0;
      }
      have_info |= ALL_ID_INFO;
   }
   else if(strstr(msg_field, "GPIO")) {  // gpio0 .. gpio8
      if(get_msg_field()) { 
         minor_alarms &= (~MINOR_ANT_NO_PWR);
         // !!!!!! this decode does NOT match the G87 docs !!!!!
         if(furuno_type == 8736) {  // GT8736
            if     ((msg_field[0] == 'H') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_SHORT;  // short
            else if((msg_field[0] == 'H') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_OPEN;   // open
            else if((msg_field[0] == 'L') && (msg_field[2] == 'H')) ;  // normal
            else if((msg_field[0] == 'L') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_NO_PWR; // unkn
         }
         else {  // GT87
            if     ((msg_field[0] == 'L') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_SHORT;  // short
            else if((msg_field[0] == 'H') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_OPEN;   // open
            else if((msg_field[0] == 'H') && (msg_field[2] == 'L')) ;  // normal
            else if((msg_field[0] == 'L') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_NO_PWR; // unkn
         }
         have_antenna = 87;
//sprintf(debug_text, "GPIO:%s", msg_field);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0xb0bd0
leaq 0x2e4f10(%rip), %rdi    # 0x39ac20
leaq 0xd134e(%rip), %rsi     # 0x187065
callq 0x9090
cmpq $0x0, %rax
je 0xb5e41
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5d4e
leaq 0x2e4ee9(%rip), %rax    # 0x39ac20
movb $0x0, 0x20(%rax)
leaq 0x2e674e(%rip), %rdi    # 0x39c490
leaq 0x2e4ed7(%rip), %rsi    # 0x39ac20
callq 0x9350
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5d76
leaq 0x2e4ec1(%rip), %rax    # 0x39ac20
movb $0x0, 0x20(%rax)
leaq 0x2e6756(%rip), %rdi    # 0x39c4c0
leaq 0x2e4eaf(%rip), %rsi    # 0x39ac20
callq 0x9350
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5d9e
leaq 0x2e4e99(%rip), %rax    # 0x39ac20
movb $0x0, 0x20(%rax)
leaq 0x2e675e(%rip), %rdi    # 0x39c4f0
leaq 0x2e4e87(%rip), %rsi    # 0x39ac20
callq 0x9350
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5e27
leaq 0x2e4e71(%rip), %rax    # 0x39ac20
movb $0x0, 0x20(%rax)
leaq 0x2e6766(%rip), %rdi    # 0x39c520
leaq 0x2e4e5f(%rip), %rsi    # 0x39ac20
callq 0x9350
leaq 0x2e6753(%rip), %rdi    # 0x39c520
leaq 0xd03d8(%rip), %rsi     # 0x1861ac
callq 0x9090
cmpq $0x0, %rax
je 0xb5dee
leaq 0x2b719a(%rip), %rax    # 0x36cf80
movl $0x2220, (%rax)         # imm = 0x2220
jmp 0xb5e25
leaq 0x2e672b(%rip), %rdi    # 0x39c520
leaq 0xd03b7(%rip), %rsi     # 0x1861b3
callq 0x9090
cmpq $0x0, %rax
je 0xb5e16
leaq 0x2b7172(%rip), %rax    # 0x36cf80
movl $0x57, (%rax)
jmp 0xb5e23
leaq 0x2b7163(%rip), %rax    # 0x36cf80
movl $0x0, (%rax)
jmp 0xb5e25
jmp 0xb5e27
leaq 0x2b6d26(%rip), %rax    # 0x36cb54
movl (%rax), %ecx
orl $0xf, %ecx
leaq 0x2b6d1a(%rip), %rax    # 0x36cb54
movl %ecx, (%rax)
jmp 0xb6040
leaq 0x2e4dd8(%rip), %rdi    # 0x39ac20
leaq 0xcdcd7(%rip), %rsi     # 0x183b26
callq 0x9090
cmpq $0x0, %rax
je 0xb603e
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb603c
leaq 0x2b6545(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x7, %ecx
leaq 0x2b6539(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2b70f8(%rip), %rax    # 0x36cf80
cmpl $0x2220, (%rax)         # imm = 0x2220
jne 0xb5f63
leaq 0x2e4d85(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0xb5ecd
leaq 0x2e4d76(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x4c, %eax
jne 0xb5ecd
leaq 0x2b64fe(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x4, %ecx
leaq 0x2b64f2(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb5f5e
leaq 0x2e4d4c(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0xb5f03
leaq 0x2e4d3d(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x48, %eax
jne 0xb5f03
leaq 0x2b64c5(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2b64b9(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb5f5c
leaq 0x2e4d16(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x4c, %eax
jne 0xb5f24
leaq 0x2e4d07(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x48, %eax
jne 0xb5f24
jmp 0xb5f5a
leaq 0x2e4cf5(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x4c, %eax
jne 0xb5f58
leaq 0x2e4ce6(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x4c, %eax
jne 0xb5f58
leaq 0x2b646e(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x6, %ecx
leaq 0x2b6462(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb5f5a
jmp 0xb5f5c
jmp 0xb5f5e
jmp 0xb602f
leaq 0x2e4cb6(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x4c, %eax
jne 0xb5f9c
leaq 0x2e4ca7(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x48, %eax
jne 0xb5f9c
leaq 0x2b642f(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x4, %ecx
leaq 0x2b6423(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb602d
leaq 0x2e4c7d(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0xb5fd2
leaq 0x2e4c6e(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x48, %eax
jne 0xb5fd2
leaq 0x2b63f6(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2b63ea(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb602b
leaq 0x2e4c47(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0xb5ff3
leaq 0x2e4c38(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x4c, %eax
jne 0xb5ff3
jmp 0xb6029
leaq 0x2e4c26(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x4c, %eax
jne 0xb6027
leaq 0x2e4c17(%rip), %rax    # 0x39ac20
movsbl 0x2(%rax), %eax
cmpl $0x4c, %eax
jne 0xb6027
leaq 0x2b639f(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x6, %ecx
leaq 0x2b6393(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb6029
jmp 0xb602b
jmp 0xb602d
jmp 0xb602f
leaq 0x2b63d6(%rip), %rax    # 0x36c40c
movl $0x57, (%rax)
jmp 0xb603e
jmp 0xb6040
popq %rbp
retq
nopw %cs:(%rax,%rax)