// File: jkingan[P]ladyheather/heathgps.cpp
// Function: decode_tm4_msg()
void decode_tm4_msg()
{
int i;
u08 c;

   start_msg_decode(1);

   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
   get_msg_field();  // get the TM4 message type 

   if     (strstr(msg_field, "50")) parse_tm4_ack();           // ack
   else if(strstr(msg_field, "51")) parse_tm4_time();          // date and time
   else if(strstr(msg_field, "52")) parse_tm4_lla(0);          // position
   else if(strstr(msg_field, "53")) parse_tm4_alt();           // altitude
   else if(strstr(msg_field, "55")) parse_tm4_elmask();        // mask angle and datum
   else if(strstr(msg_field, "56")) parse_tm4_cable();         // cable delay
   else if(strstr(msg_field, "57")) parse_tm4_tmode();         // timing mode
   else if(strstr(msg_field, "59")) parse_tm4_dop();           // DOP and almanac status
   else if(strstr(msg_field, "60")) parse_tm4_mux1();          // mux1 status
   else if(strstr(msg_field, "61")) parse_tm4_validity();      // time validity
   else if(strstr(msg_field, "62")) parse_tm4_ett();           // event time tag
   else if(strstr(msg_field, "63")) parse_tm4_pop(63);         // POP/ETT status
   else if(strstr(msg_field, "64")) parse_tm4_dmode();         // discipline mode
   else if(strstr(msg_field, "65")) parse_tm4_alarm();         // alarm status
   else if(strstr(msg_field, "66")) parse_tm4_id();            // * id info
   else if(strstr(msg_field, "68")) parse_tm4_mux2();          // mux2 status
   else if(strstr(msg_field, "69")) parse_tm4_sats();          // sat status
   else if(strstr(msg_field, "70")) parse_tm4_time_format();   // serial time format
   else if(strstr(msg_field, "71")) parse_tm4_code_format();   // time code format
   else if(strstr(msg_field, "73")) parse_tm4_ett_enable();    // ETT params
   else if(strstr(msg_field, "74")) parse_tm4_pop(74);         // POP params
   else if(strstr(msg_field, "75")) parse_tm4_speed();         // speed/heading
   else if(strstr(msg_field, "76")) parse_tm4_lla(1);          // enhanced NMEA info
   else if(strstr(msg_field, "77")) parse_tm4_lock(77);        // phase loc status (early units)
   else if(strstr(msg_field, "78")) parse_tm4_options();       // option values
   else if(strstr(msg_field, "79")) parse_tm4_coast();         // coast time
   else if(strstr(msg_field, "80")) parse_tm4_lock(80);        // phase lock status
   else if(strstr(msg_field, "81")) parse_tm4_utc();           // UTC info
   else if(strstr(msg_field, "82")) parse_tm4_unkn(msg_field); // * unknown message (6 vals)
   else                             parse_tm4_unkn(msg_field); // unknown message

   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
movl $0x1, %edi
callq 0xae4a0
leaq 0x2ba167(%rip), %rax    # 0x39aa10
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
leaq 0x2b6b75(%rip), %rcx    # 0x397432
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xe0909
callq 0x7a510
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %dl
movslq -0x4(%rbp), %rcx
leaq 0x2ba136(%rip), %rax    # 0x39aa10
movb %dl, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2ba123(%rip), %rax    # 0x39aa10
movb $0x0, (%rax,%rcx)
cmpl $0x1f5, -0x4(%rbp)      # imm = 0x1F5
jl 0xe08fc
jmp 0xe0909
jmp 0xe08fe
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xe08b3
leaq 0x2ba514(%rip), %rax    # 0x39ae24
movl $0x0, (%rax)
callq 0xb0bd0
leaq 0x2ba2fe(%rip), %rdi    # 0x39ac20
leaq 0x9975a(%rip), %rsi     # 0x17a083
callq 0x9090
cmpq $0x0, %rax
je 0xe093e
callq 0xdf230
jmp 0xe0d6c
leaq 0x2ba2db(%rip), %rdi    # 0x39ac20
leaq 0xa85f9(%rip), %rsi     # 0x188f45
callq 0x9090
cmpq $0x0, %rax
je 0xe0961
callq 0xdf250
jmp 0xe0d6a
leaq 0x2ba2b8(%rip), %rdi    # 0x39ac20
leaq 0xa85d9(%rip), %rsi     # 0x188f48
callq 0x9090
cmpq $0x0, %rax
je 0xe0986
xorl %edi, %edi
callq 0xdf300
jmp 0xe0d68
leaq 0x2ba293(%rip), %rdi    # 0x39ac20
leaq 0xa85b7(%rip), %rsi     # 0x188f4b
callq 0x9090
cmpq $0x0, %rax
je 0xe09a9
callq 0xdf720
jmp 0xe0d66
leaq 0x2ba270(%rip), %rdi    # 0x39ac20
leaq 0x8f524(%rip), %rsi     # 0x16fedb
callq 0x9090
cmpq $0x0, %rax
je 0xe09cc
callq 0xdf770
jmp 0xe0d64
leaq 0x2ba24d(%rip), %rdi    # 0x39ac20
leaq 0xa3689(%rip), %rsi     # 0x184063
callq 0x9090
cmpq $0x0, %rax
je 0xe09ef
callq 0xdf830
jmp 0xe0d62
leaq 0x2ba22a(%rip), %rdi    # 0x39ac20
leaq 0xa3669(%rip), %rsi     # 0x184066
callq 0x9090
cmpq $0x0, %rax
je 0xe0a12
callq 0xdf8a0
jmp 0xe0d60
leaq 0x2ba207(%rip), %rdi    # 0x39ac20
leaq 0xa78e6(%rip), %rsi     # 0x188306
callq 0x9090
cmpq $0x0, %rax
je 0xe0a35
callq 0xdf960
jmp 0xe0d5e
leaq 0x2ba1e4(%rip), %rdi    # 0x39ac20
leaq 0xb0e31(%rip), %rsi     # 0x191874
callq 0x9090
cmpq $0x0, %rax
je 0xe0a58
callq 0xdfb40
jmp 0xe0d5c
leaq 0x2ba1c1(%rip), %rdi    # 0x39ac20
leaq 0x99c7e(%rip), %rsi     # 0x17a6e4
callq 0x9090
cmpq $0x0, %rax
je 0xe0a7b
callq 0xdfbe0
jmp 0xe0d5a
leaq 0x2ba19e(%rip), %rdi    # 0x39ac20
leaq 0xa84c5(%rip), %rsi     # 0x188f4e
callq 0x9090
cmpq $0x0, %rax
je 0xe0a9e
callq 0xdfc50
jmp 0xe0d58
leaq 0x2ba17b(%rip), %rdi    # 0x39ac20
leaq 0xa84a5(%rip), %rsi     # 0x188f51
callq 0x9090
cmpq $0x0, %rax
je 0xe0ac6
movl $0x3f, %edi
callq 0xe0410
jmp 0xe0d56
leaq 0x2ba153(%rip), %rdi    # 0x39ac20
leaq 0xa8480(%rip), %rsi     # 0x188f54
callq 0x9090
cmpq $0x0, %rax
je 0xe0ae9
callq 0xdfd30
jmp 0xe0d54
leaq 0x2ba130(%rip), %rdi    # 0x39ac20
leaq 0xa8460(%rip), %rsi     # 0x188f57
callq 0x9090
cmpq $0x0, %rax
je 0xe0b0c
callq 0xdfde0
jmp 0xe0d52
leaq 0x2ba10d(%rip), %rdi    # 0x39ac20
leaq 0xa8440(%rip), %rsi     # 0x188f5a
callq 0x9090
cmpq $0x0, %rax
je 0xe0b2f
callq 0xdfed0
jmp 0xe0d50
leaq 0x2ba0ea(%rip), %rdi    # 0x39ac20
leaq 0x995d1(%rip), %rsi     # 0x17a10e
callq 0x9090
cmpq $0x0, %rax
je 0xe0b52
callq 0xdffa0
jmp 0xe0d4e
leaq 0x2ba0c7(%rip), %rdi    # 0x39ac20
leaq 0xa83fd(%rip), %rsi     # 0x188f5d
callq 0x9090
cmpq $0x0, %rax
je 0xe0b75
callq 0xdfff0
jmp 0xe0d4c
leaq 0x2ba0a4(%rip), %rdi    # 0x39ac20
leaq 0xa83dd(%rip), %rsi     # 0x188f60
callq 0x9090
cmpq $0x0, %rax
je 0xe0b98
callq 0xe02a0
jmp 0xe0d4a
leaq 0x2ba081(%rip), %rdi    # 0x39ac20
leaq 0xa775a(%rip), %rsi     # 0x188300
callq 0x9090
cmpq $0x0, %rax
je 0xe0bbb
callq 0xe02e0
jmp 0xe0d48
leaq 0x2ba05e(%rip), %rdi    # 0x39ac20
leaq 0xa839a(%rip), %rsi     # 0x188f63
callq 0x9090
cmpq $0x0, %rax
je 0xe0bde
callq 0xe0320
jmp 0xe0d46
leaq 0x2ba03b(%rip), %rdi    # 0x39ac20
leaq 0xa837a(%rip), %rsi     # 0x188f66
callq 0x9090
cmpq $0x0, %rax
je 0xe0c06
movl $0x4a, %edi
callq 0xe0410
jmp 0xe0d44
leaq 0x2ba013(%rip), %rdi    # 0x39ac20
leaq 0xa8a81(%rip), %rsi     # 0x189695
callq 0x9090
cmpq $0x0, %rax
je 0xe0c29
callq 0xe0390
jmp 0xe0d42
leaq 0x2b9ff0(%rip), %rdi    # 0x39ac20
leaq 0xa8332(%rip), %rsi     # 0x188f69
callq 0x9090
cmpq $0x0, %rax
je 0xe0c51
movl $0x1, %edi
callq 0xdf300
jmp 0xe0d40
leaq 0x2b9fc8(%rip), %rdi    # 0x39ac20
leaq 0xa830d(%rip), %rsi     # 0x188f6c
callq 0x9090
cmpq $0x0, %rax
je 0xe0c79
movl $0x4d, %edi
callq 0xe0700
jmp 0xe0d3e
leaq 0x2b9fa0(%rip), %rdi    # 0x39ac20
leaq 0xa82e8(%rip), %rsi     # 0x188f6f
callq 0x9090
cmpq $0x0, %rax
je 0xe0c9c
callq 0xe0790
jmp 0xe0d3c
leaq 0x2b9f7d(%rip), %rdi    # 0x39ac20
leaq 0xa82c8(%rip), %rsi     # 0x188f72
callq 0x9090
cmpq $0x0, %rax
je 0xe0cbc
callq 0xe0650
jmp 0xe0d3a
leaq 0x2b9f5d(%rip), %rdi    # 0x39ac20
leaq 0x993cd(%rip), %rsi     # 0x17a097
callq 0x9090
cmpq $0x0, %rax
je 0xe0ce1
movl $0x50, %edi
callq 0xe0700
jmp 0xe0d38
leaq 0x2b9f38(%rip), %rdi    # 0x39ac20
leaq 0xa8286(%rip), %rsi     # 0x188f75
callq 0x9090
cmpq $0x0, %rax
je 0xe0d01
callq 0xe05b0
jmp 0xe0d36
leaq 0x2b9f18(%rip), %rdi    # 0x39ac20
leaq 0xa8269(%rip), %rsi     # 0x188f78
callq 0x9090
cmpq $0x0, %rax
je 0xe0d28
leaq 0x2b9eff(%rip), %rdi    # 0x39ac20
callq 0xe0830
jmp 0xe0d34
leaq 0x2b9ef1(%rip), %rdi    # 0x39ac20
callq 0xe0830
jmp 0xe0d36
jmp 0xe0d38
jmp 0xe0d3a
jmp 0xe0d3c
jmp 0xe0d3e
jmp 0xe0d40
jmp 0xe0d42
jmp 0xe0d44
jmp 0xe0d46
jmp 0xe0d48
jmp 0xe0d4a
jmp 0xe0d4c
jmp 0xe0d4e
jmp 0xe0d50
jmp 0xe0d52
jmp 0xe0d54
jmp 0xe0d56
jmp 0xe0d58
jmp 0xe0d5a
jmp 0xe0d5c
jmp 0xe0d5e
jmp 0xe0d60
jmp 0xe0d62
jmp 0xe0d64
jmp 0xe0d66
jmp 0xe0d68
jmp 0xe0d6a
jmp 0xe0d6c
leaq 0x1bc82d(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0xe0d97
leaq 0x1a1a60(%rip), %rax    # 0x2827e0
cmpq $0x0, (%rax)
je 0xe0d97
leaq 0x1a1a53(%rip), %rax    # 0x2827e0
movq (%rax), %rax
movl %eax, %edi
callq 0xb8b0
leaq 0x1bd3e2(%rip), %rax    # 0x29e180
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)