// File: jkingan[P]ladyheather/heathgps.cpp
// Function: send_byte(unsigned char)
void send_byte(u08 val)
{
   // send a byte to the receiver and update the message checksum
   // NEW_RCVR
   if(log_file && (log_stream & LOG_PACKET_START)) {
      if(superpacket) fprintf(log_file, "Superpacket:    %02X\n", val);
   }
   if(log_file && (log_stream & LOG_SENT_DATA) && sts) fprintf(log_file, "{%02X} ", val);

   superpacket = 0;

   sendout(RCVR_PORT, val, eom_flag);  
   ++tsip_send_count;

   nmea_tx_cksum ^= val;  // we always update these since we may need to send
   moto_tx_cksum ^= val;  // ... messaages in these formats to wake up other receivers
   venus_tx_cksum ^= val;
   sirf_tx_cksum += val;
   ss_tx_cksum += val;
   rt17_tx_cksum += val;

   if(rcvr_type == TSIP_RCVR) {
      if(val == DLE) {  // we are sending a TSIP message
         sendout(RCVR_PORT, DLE, eom_flag);  // DLE character must be sent twice
         ++tsip_send_count;
      }
   }
   else if(rcvr_type == NVS_RCVR) {
      nvs_tx_crc = calc_nvs_crc(nvs_tx_crc, val);
      if(val == DLE) {  // we are sending a TSIP message
         nvs_tx_crc = calc_nvs_crc(nvs_tx_crc, DLE);
         sendout(RCVR_PORT, DLE, eom_flag);  // DLE character must be sent twice
         ++tsip_send_count;
      }
   }
   else if(rcvr_type == UBX_RCVR) { // sending ublox ubx message
      ubx_txa += val;    // add byte to message checksums
      ubx_txb += ubx_txa;
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      if(zodiac_tx_cnt & 1) zodiac_tx_cksum += ( (((u16) val) * 256) + zodiac_low_byte );
      else zodiac_low_byte = (u16) val;
      ++zodiac_tx_cnt;
   }

   eom_flag = ADD_CHAR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
leaq 0x22231b(%rip), %rax    # 0x29d540
cmpq $0x0, (%rax)
je 0x7b263
leaq 0x2223be(%rip), %rax    # 0x29d5f0
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x7b263
cmpb $0x0, 0x353f9d(%rip)    # 0x3cf1e0
je 0x7b261
leaq 0x2222f4(%rip), %rax    # 0x29d540
movq (%rax), %rdi
movzbl -0x1(%rbp), %edx
leaq 0x10826a(%rip), %rsi    # 0x1834c4
movb $0x0, %al
callq 0x9550
jmp 0x7b263
leaq 0x2222d6(%rip), %rax    # 0x29d540
cmpq $0x0, (%rax)
je 0x7b2a6
leaq 0x222379(%rip), %rax    # 0x29d5f0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x7b2a6
cmpl $0x0, 0x353f5c(%rip)    # 0x3cf1e4
je 0x7b2a6
leaq 0x2222af(%rip), %rax    # 0x29d540
movq (%rax), %rdi
movzbl -0x1(%rbp), %edx
leaq 0x10823b(%rip), %rsi    # 0x1834da
movb $0x0, %al
callq 0x9550
movb $0x0, 0x353f33(%rip)    # 0x3cf1e0
movb -0x1(%rbp), %al
movl 0x34fd3a(%rip), %edx    # 0x3caff0
movl $0xa, %edi
movzbl %al, %esi
callq 0xd160
movl 0x34fd2f(%rip), %eax    # 0x3caff8
addl $0x1, %eax
movl %eax, 0x34fd26(%rip)    # 0x3caff8
movzbl -0x1(%rbp), %ecx
movzbl 0x3509b9(%rip), %eax    # 0x3cbc96
xorl %ecx, %eax
movb %al, 0x3509b1(%rip)     # 0x3cbc96
movzbl -0x1(%rbp), %ecx
movzbl 0x3509b3(%rip), %eax    # 0x3cbca3
xorl %ecx, %eax
movb %al, 0x3509ab(%rip)     # 0x3cbca3
movzbl -0x1(%rbp), %ecx
movzbl 0x3509b0(%rip), %eax    # 0x3cbcb3
xorl %ecx, %eax
movb %al, 0x3509a8(%rip)     # 0x3cbcb3
movzbl -0x1(%rbp), %ecx
movzwl 0x3509be(%rip), %eax    # 0x3cbcd4
addl %ecx, %eax
movw %ax, 0x3509b5(%rip)     # 0x3cbcd4
movzbl -0x1(%rbp), %ecx
movswl 0x350972(%rip), %eax    # 0x3cbc9c
addl %ecx, %eax
movw %ax, 0x350969(%rip)     # 0x3cbc9c
movzbl -0x1(%rbp), %ecx
movzbl 0x350962(%rip), %eax    # 0x3cbca0
addl %ecx, %eax
movb %al, 0x35095a(%rip)     # 0x3cbca0
leaq 0x1fc763(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x7b385
movzbl -0x1(%rbp), %eax
cmpl $0x10, %eax
jne 0x7b380
movl 0x34fc8e(%rip), %edx    # 0x3caff0
movl $0xa, %edi
movl $0x10, %esi
callq 0xd160
movl 0x34fc81(%rip), %eax    # 0x3caff8
addl $0x1, %eax
movl %eax, 0x34fc78(%rip)    # 0x3caff8
jmp 0x7b498
leaq 0x1fc724(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x7b3f9
movw 0x350948(%rip), %ax     # 0x3cbce4
movzwl %ax, %edi
movzbl -0x1(%rbp), %esi
callq 0x7b1c0
movw %ax, 0x350935(%rip)     # 0x3cbce4
movzbl -0x1(%rbp), %eax
cmpl $0x10, %eax
jne 0x7b3f4
movl $0x10, %esi
movzwl 0x350920(%rip), %edi    # 0x3cbce4
callq 0x7b1c0
movw %ax, 0x350914(%rip)     # 0x3cbce4
movl 0x34fc1a(%rip), %edx    # 0x3caff0
movl $0xa, %edi
movl $0x10, %esi
callq 0xd160
movl 0x34fc0d(%rip), %eax    # 0x3caff8
addl $0x1, %eax
movl %eax, 0x34fc04(%rip)    # 0x3caff8
jmp 0x7b496
leaq 0x1fc6b0(%rip), %rax    # 0x277ab0
cmpq $0x4, (%rax)
jne 0x7b431
movzbl -0x1(%rbp), %ecx
movzbl 0x350847(%rip), %eax    # 0x3cbc58
addl %ecx, %eax
movb %al, 0x35083f(%rip)     # 0x3cbc58
movzbl 0x350838(%rip), %ecx    # 0x3cbc58
movzbl 0x350832(%rip), %eax    # 0x3cbc59
addl %ecx, %eax
movb %al, 0x35082a(%rip)     # 0x3cbc59
jmp 0x7b494
leaq 0x1fc678(%rip), %rax    # 0x277ab0
cmpq $0x100, (%rax)          # imm = 0x100
jne 0x7b492
movzwl 0x3508b0(%rip), %eax    # 0x3cbcf8
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7b475
movzbl -0x1(%rbp), %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl 0x3508ad(%rip), %eax    # 0x3cbd0e
addl %eax, %ecx
movzwl 0x350890(%rip), %eax    # 0x3cbcfa
addl %ecx, %eax
movw %ax, 0x350887(%rip)     # 0x3cbcfa
jmp 0x7b480
movzbl -0x1(%rbp), %eax
movw %ax, 0x35088e(%rip)     # 0x3cbd0e
movw 0x350871(%rip), %ax     # 0x3cbcf8
addw $0x1, %ax
movw %ax, 0x350866(%rip)     # 0x3cbcf8
jmp 0x7b494
jmp 0x7b496
jmp 0x7b498
movl $0x0, 0x34fb4e(%rip)    # 0x3caff0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)