// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_maps()
void draw_maps()
{
u08 show_watch;
u08 show_map;
u08 show_sigs;

   // This routine controls the display of the lat/lon/alt map,  sat position
   // map, signal level map,  and analog watch displays.  
//sprintf(debug_text, "plot_lla:%d  fixes:%d  x:%d  row:%d  showing:%d  shared:%02X  aclock:%d,%d %d  WATCH:%d,%d %d", 
//plot_lla, show_fixes, LLA_Y, LLA_ROW, lla_showing, shared_item, aclock_x,aclock_y,ACLOCK_R, WATCH_COL,WATCH_ROW,WATCH_SIZE);
#define XXXX (NARROW_SCREEN)

   if(zoom_screen == '`') {
      zoom_calc();
      return;
   }
   else if(zoom_screen == 'Q') {
      zoom_cal(cal_year, cal_month);
      return;
   }

   azel_erased = 0;
   if(text_mode) plot_areas = 0;
   else if(just_read) plot_areas = 0;
   else if(zoom_screen == 'L') plot_areas = 0;
   else if(zoom_screen) plot_areas = 1;
   else if(SCREEN_WIDTH < XXXX) {
      if(shared_plot) plot_areas = 1;
      else if(rcvr_type == NO_RCVR) plot_areas = 1;
////else if(rcvr_type == TIDE_RCVR) plot_areas = 1;  // ckckck
      else plot_areas = 0;
   }
   else if(shared_plot == 0) plot_areas = 1;
   else if(all_adevs) plot_areas = 1;
   else plot_areas = 2;

   show_watch = plot_watch;
   show_map = plot_azel;
   if(zoom_screen == 'X') show_watch = show_map = 1;
   if(zoom_screen == 'Y') show_map = 1;
   if(zoom_screen == 'I') show_map = 1;
   show_sigs = plot_signals;

   if(first_key && plot_areas) {
      if(SCREEN_WIDTH < XXXX) plot_areas = 0;
      else if(all_adevs) plot_areas = 0;
//ssssssss      else if(shared_plot) plot_areas = 0;
      else plot_areas = 1;
   }

   map_and_watch = 0;
   map_and_sigs = 0; 
   if(show_watch && show_map && ((plot_areas == 1) || show_sigs || plot_lla)) {
      map_and_watch = 1;
      if(zoom_screen && (zoom_screen != 'K')) {
         aclock_x = AZEL_COL + AZEL_SIZE/2 - 2;
         aclock_y = AZEL_ROW + AZEL_SIZE/2 - 2;
      }
   }

   if(zoom_screen == 'S') ;
   else if(zoom_screen == 'X') ;
   else if(zoom_screen == 'Y') ;
   else if(zoom_screen == 'I') ;
   else if(show_map && show_sigs && (show_sigs != 3) && ((plot_areas == 1) || plot_lla)) { 
      map_and_sigs = 1;
   }

   if(plot_areas == 0) return;

   if(plot_lla && (zoom_screen == 0)) {  // we are drawing a LatLonAlt plot
      if(screen_configed) {   // screen re-configured,  so redraw LLA grid
         plot_lla_axes(2);
         screen_configed = 0;
      }
      --plot_areas;
      if(plot_areas <= 0) return;  // LLA plot is updated where packets are read in
   }

   if(zoom_screen == 'B') goto maw;
   else if(zoom_screen == 'D') {  // zoom to receiver data info
      if     (rcvr_type == BRANDY_RCVR) show_brandy_info(1,4);
      else if(rcvr_type == CS_RCVR)     show_cs_info();
      else if(rcvr_type == LPFRS_RCVR)  show_lpfrs_info(1,3, 999);
      else if(rcvr_type == PRS_RCVR)    show_prs_info(1,3, 999);
      else if(rcvr_type == SA35_RCVR)   show_sa35_info(1,3, 999);
      else if(rcvr_type == SRO_RCVR)    show_sro_info(1,3, 999);
      else if(rcvr_type == RFTG_RCVR)   show_rftg_info(1,4);
      else if(rcvr_type == X72_RCVR)    show_x72_info(1,3, 999);
      return;
   }
   else if(zoom_screen == 'F') {  // FFT waterfall
      // image drawn in process_signal()
      return;
   }
   else if(zoom_screen == 'I') {
      zoom_sat_info();
      return;
   }
   else if(zoom_screen == 'U') {
      zoom_all_signals();
      return;
   }
   else if(zoom_screen == 'V') {
      zoom_stuff();
      return;
   }
   else if(zoom_screen == 'W') goto maw;
   else if((zoom_screen == 'X') || (zoom_screen == 'Y')) {
      draw_azel_plot(1);
      return;
   }
   else if(zoom_screen == '`') {
      zoom_calc();
      return;
   }
   else if(zoom_screen) ;
   else if(map_and_watch) {
      maw:
      if(MESS && map_and_sigs && (plot_areas == 1)) {
         draw_signal_map(1);
         show_sigs = 0;
      }

      #ifdef SAT_TRAILS
//       update_sat_trails(); // update az/el position array
      #endif
      if(zoom_screen == 'W') draw_watch(1);
      else {
         if(rotate_screen && (azel_erased == 0) && (AZEL_ROW >= PLOT_ROW)) {
            erase_azel(20);
         }
         draw_azel_plot(2);
      }
      --plot_areas;
      show_watch = 0; 
      show_map = 0;
      map_and_watch = 0;
   }

   if(zoom_screen) ;
   else if(plot_areas <= 0) return;
//sprintf(out, "maw:%d  mas:%d  show_map:%d  show_sigs:%d  areas:%d", map_and_watch,map_and_sigs, show_map,show_sigs, plot_areas);
//DEBUGSTR(out);

   #ifdef SIG_LEVELS
      if((show_sigs && (plot_areas > 0)) || (zoom_screen == 'S')) {
         draw_signal_map(2);      // draw signal level map
         show_sigs = 0;

         if(map_and_sigs) {
            goto do_map;
         }
         --plot_areas;
      }
   #endif

//sprintf(debug_text3, "areas:%d  watch:%d  map:%d sigs:%d lla:%d  azel:%d,%d",
//plot_areas, show_watch,show_map, show_sigs, plot_lla, AZEL_COL,AZEL_ROW);

   #ifdef AZEL_STUFF
      if((zoom_screen == 'M') || (zoom_screen == 'B')) goto do_map;
      else if(zoom_screen) ;
      else if(show_map && (plot_areas > 0)) {
         do_map:
         #ifdef SAT_TRAILS
//          update_sat_trails(); // update az/el position array
         #endif
         draw_azel_plot(3);
         show_map = 0;
         --plot_areas;
      }
   #endif
   map_and_sigs = 0;

   #ifdef ANALOG_CLOCK
      if((zoom_screen == 'W') && (zoom_screen == 'B')) {
         goto anaw;
      }
      else if(zoom_screen) ;
      else if((plot_areas > 0) || (rcvr_type == NO_RCVR) || (rcvr_type == TIDE_RCVR)) {
         if(luxor && luxor_fault()) {
            --plot_areas;
         }
         else if(show_watch) {
            anaw:
small_screen_watch();
            draw_watch(2);      // draw analog watch
            show_watch = 0;
            --plot_areas;
         }
      }
   #endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x21530d(%rip), %rbx    # 0x30c7a8
movzbl (%rbx), %eax
cmpl $0x51, %eax
je 0xf74bb
cmpl $0x60, %eax
jne 0xf74e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2659b
leaq 0x21606a(%rip), %rax    # 0x30d52c
movl (%rax), %edi
leaq 0x21605d(%rip), %rax    # 0x30d528
movl (%rax), %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf38e2
leaq 0x243eb5(%rip), %r8     # 0x33b39c
movl $0x0, (%r8)
leaq 0x1212e3(%rip), %rdx    # 0x2187d8
xorl %ecx, %ecx
cmpl $0x0, (%rdx)
jne 0xf7585
leaq 0x23fb11(%rip), %rdx    # 0x337018
cmpb $0x0, (%rdx)
jne 0xf7585
testl %eax, %eax
je 0xf751c
cmpl $0x4c, %eax
je 0xf7585
movl $0x1, %ecx
jmp 0xf7585
leaq 0x1212dd(%rip), %rcx    # 0x218800
leaq 0x12c01a(%rip), %rdx    # 0x223544
imull $0x31a, (%rdx), %edx    # imm = 0x31A
movslq %edx, %rdx
imulq $0x51eb851f, %rdx, %rsi # imm = 0x51EB851F
movq %rsi, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rsi
addl %edx, %esi
leaq 0x243e9a(%rip), %rdx    # 0x33b3e8
movb (%rdx), %dl
cmpl %esi, (%rcx)
jge 0xf7572
movl $0x1, %ecx
testb %dl, %dl
jne 0xf7585
leaq 0x12136c(%rip), %rdx    # 0x2188d0
xorl %ecx, %ecx
cmpq $0x400, (%rdx)          # imm = 0x400
sete %cl
jmp 0xf7585
testb %dl, %dl
je 0xf7515
leaq 0x1457c1(%rip), %rdx    # 0x23cd3e
xorl %ecx, %ecx
cmpb $0x1, (%rdx)
adcl $0x1, %ecx
leaq 0x123e78(%rip), %r14    # 0x21b404
leaq 0x123e75(%rip), %rdx    # 0x21b408
leaq 0x123e79(%rip), %rsi    # 0x21b413
cmpl $0x58, %eax
movzbl (%rdx), %r15d
movl $0x1, %edx
cmovel %edx, %r15d
movl %eax, %edi
andb $-0x2, %dil
cmpb $0x58, %dil
movzbl (%rsi), %r12d
cmovel %edx, %r12d
movl %ecx, (%r14)
cmpl $0x49, %eax
cmovel %edx, %r12d
leaq 0x123e48(%rip), %rdx    # 0x21b415
leaq 0x147984(%rip), %rsi    # 0x23ef58
cmpl $0x0, (%rsi)
je 0xf7625
testl %ecx, %ecx
je 0xf7625
leaq 0x12121c(%rip), %rcx    # 0x218800
leaq 0x12bf59(%rip), %rsi    # 0x223544
imull $0x31a, (%rsi), %esi    # imm = 0x31A
movslq %esi, %rsi
imulq $0x51eb851f, %rsi, %rsi # imm = 0x51EB851F
movq %rsi, %rdi
shrq $0x3f, %rdi
sarq $0x25, %rsi
addl %edi, %esi
cmpl %esi, (%rcx)
setge %cl
leaq 0x14572a(%rip), %rsi    # 0x23cd3e
cmpb $0x0, (%rsi)
sete %sil
andb %cl, %sil
movzbl %sil, %ecx
movl %ecx, (%r14)
movb (%rdx), %r13b
leaq 0x123de1(%rip), %r9     # 0x21b410
xorl %ecx, %ecx
movb %cl, (%r9)
leaq 0x123dd6(%rip), %rdi    # 0x21b411
movb %cl, (%rdi)
testb %r15b, %r15b
je 0xf76ae
testb %r12b, %r12b
je 0xf76ae
cmpl $0x1, (%r14)
je 0xf765e
testb %r13b, %r13b
jne 0xf765e
leaq 0x243c57(%rip), %rcx    # 0x33b2b0
cmpb $0x0, (%rcx)
je 0xf76ae
movb $0x1, (%r9)
testl %eax, %eax
je 0xf7787
cmpl $0x4b, %eax
je 0xf7787
leaq 0x243d1a(%rip), %rcx    # 0x33b394
leaq 0x243d0b(%rip), %rdx    # 0x33b38c
movl (%rdx), %edx
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
addl $-0x2, %esi
movl (%rcx), %ecx
addl %esi, %ecx
leaq 0x243cda(%rip), %rdx    # 0x33b374
movl %ecx, (%rdx)
leaq 0x243ced(%rip), %rcx    # 0x33b390
addl (%rcx), %esi
leaq 0x243ccc(%rip), %rcx    # 0x33b378
movl %esi, (%rcx)
leal -0x49(%rax), %ecx
cmpl $0x10, %ecx
ja 0xf7787
movl $0x18401, %edx          # imm = 0x18401
btl %ecx, %edx
jae 0xf7787
cmpl $0x0, (%r14)
je 0xf7895
testl %eax, %eax
jne 0xf7723
leaq 0x243bd3(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
je 0xf7723
movq %r14, %rbx
leaq 0x123cec(%rip), %r14    # 0x21b3d8
cmpb $0x0, (%r14)
je 0xf7709
callq 0xdac25
leaq 0x123d12(%rip), %r9     # 0x21b410
leaq 0x243c97(%rip), %r8     # 0x33b39c
movb $0x0, (%r14)
movq %rbx, %r14
movl (%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, (%rbx)
cmpl $0x2, %eax
leaq 0x21508b(%rip), %rbx    # 0x30c7a8
jl 0xf7895
movb (%rbx), %al
movzbl %al, %ecx
cmpl $0x54, %ecx
jg 0xf77c1
addl $-0x42, %ecx
cmpl $0x7, %ecx
ja 0xf7930
leaq 0x33aac(%rip), %rdx     # 0x12b1f0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %r9, %r15
leaq 0x1210d1(%rip), %rax    # 0x218828
cmpl $0x0, (%rax)
je 0xf7780
cmpl $0x0, (%r8)
jne 0xf7780
leaq 0x243c27(%rip), %rax    # 0x33b390
movl (%rax), %eax
leaq 0x12110a(%rip), %rcx    # 0x21887c
cmpl (%rcx), %eax
jl 0xf7780
movl $0x14, %edi
callq 0xee11
callq 0xf7f67
jmp 0xf77e4
testb %r12b, %r12b
je 0xf76c8
testb %r13b, %r13b
je 0xf76c8
cmpb $0x3, %r13b
je 0xf76c8
cmpl $0x1, (%r14)
je 0xf77b9
leaq 0x243b00(%rip), %rcx    # 0x33b2b0
cmpb $0x0, (%rcx)
je 0xf76c8
movb $0x1, (%rdi)
jmp 0xf76c8
cmpl $0x55, %ecx
je 0xf790a
cmpl $0x56, %ecx
je 0xf791d
cmpl $0x57, %ecx
jne 0xf7930
movq %r9, %r15
callq 0xf3598
decl (%r14)
movb $0x0, (%r15)
xorl %r15d, %r15d
xorl %r12d, %r12d
movb (%rbx), %al
testb %al, %al
sete %dl
movl (%r14), %ecx
testl %ecx, %ecx
setle %sil
testb %sil, %dl
jne 0xf7895
testb %r13b, %r13b
setne %dl
testl %ecx, %ecx
setg %cl
cmpb $0x53, %al
je 0xf781d
andb %cl, %dl
je 0xf7831
callq 0xf86eb
leaq 0x123be8(%rip), %rax    # 0x21b411
cmpb $0x0, (%rax)
jne 0xf784d
decl (%r14)
movzbl (%rbx), %eax
cmpl $0x4d, %eax
je 0xf784d
cmpl $0x42, %eax
je 0xf784d
testl %eax, %eax
jne 0xf7855
testb %r12b, %r12b
je 0xf7855
cmpl $0x0, (%r14)
jle 0xf7855
callq 0xf7f67
decl (%r14)
leaq 0x123bb5(%rip), %rax    # 0x21b411
movb $0x0, (%rax)
cmpb $0x0, (%rbx)
jne 0xf7895
cmpl $0x0, (%r14)
jle 0xf7a2d
leaq 0x1476c9(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0xf7883
callq 0x7a2cc
testb %al, %al
jne 0xf7892
testb %r15b, %r15b
je 0xf7895
callq 0xf735a
callq 0xf3598
decl (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x121025(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x1ffffff, %rax        # imm = 0x1FFFFFF
jg 0xf794d
cmpq $0x3fffff, %rax         # imm = 0x3FFFFF
jg 0xf79b2
cmpq $0x20000, %rax          # imm = 0x20000
je 0xf7a54
cmpq $0x40000, %rax          # imm = 0x40000
jne 0xf7895
movl $0x1, %edi
movl $0x4, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaeafd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf7ac8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf7c4a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf7dc5
movl %eax, %ecx
andb $-0x2, %cl
cmpb $0x58, %cl
jne 0xf7993
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf7f67
cmpq $0xfffffff, %rax        # imm = 0xFFFFFFF
jg 0xf79ec
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0xf7a67
cmpq $0x8000000, %rax        # imm = 0x8000000
jne 0xf7895
movl $0x1, %edi
movl $0x3, %esi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc7df1
cmpb $0x60, %al
je 0xf74a8
testb %al, %al
jne 0xf77f1
cmpb $0x0, (%r9)
jne 0xf774d
jmp 0xf77f1
cmpq $0x400000, %rax         # imm = 0x400000
je 0xf7a89
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0xf7895
movl $0x1, %edi
movl $0x3, %esi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc8588
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0xf7aa6
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
jne 0xf7895
movl $0x1, %edi
movl $0x3, %esi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc7ba5
leaq 0x120e9c(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x800000, %rax         # imm = 0x800000
je 0xf786e
cmpq $0x400, %rax            # imm = 0x400
je 0xf786e
jmp 0xf7895
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xca584
movl $0x1, %edi
movl $0x3, %esi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc958a
movl $0x1, %edi
movl $0x4, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaee2b
movl $0x1, %edi
movl $0x3, %esi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc788c