// File: /workspace/github_cpp_makefile_star2_O2/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 0x2143e1(%rip), %rbx    # 0x2f67a8
movzbl (%rbx), %edi
cmpl $0x51, %edi
je 0xe23e7
cmpl $0x60, %edi
jne 0xe240c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x246ae
leaq 0x21513e(%rip), %rax    # 0x2f752c
movl (%rax), %edi
leaq 0x215131(%rip), %rax    # 0x2f7528
movl (%rax), %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdeb78
leaq 0x242f89(%rip), %r13    # 0x32539c
andl $0x0, (%r13)
movl %edi, %ecx
leaq 0x1203b7(%rip), %rax    # 0x2027d8
xorl %esi, %esi
cmpl $0x0, (%rax)
pushq $0x1
popq %r9
pushq $0x64
popq %r8
jne 0xe2457
leaq 0x23ebe1(%rip), %rax    # 0x321018
cmpb $0x0, (%rax)
movl $0x0, %eax
jne 0xe2459
testl %edi, %edi
je 0xe275e
xorl %esi, %esi
cmpl $0x4c, %edi
je 0xe2459
movb $0x1, %al
movl %r9d, %esi
jmp 0xe2459
xorl %eax, %eax
leaq 0x122fa4(%rip), %r11    # 0x205404
leaq 0x122fa1(%rip), %rdx    # 0x205408
leaq 0x122fa5(%rip), %r10    # 0x205413
cmpb $0x58, %cl
movzbl (%rdx), %r15d
cmovel %r9d, %r15d
movl %ecx, %edx
andb $-0x2, %dl
cmpb $0x58, %dl
movzbl (%r10), %r12d
cmovel %r9d, %r12d
movl %esi, (%r11)
cmpb $0x49, %cl
cmovel %r9d, %r12d
leaq 0x146abe(%rip), %rdx    # 0x228f58
cmpl $0x0, (%rdx)
leaq 0x122f71(%rip), %rdx    # 0x205415
movb (%rdx), %r9b
sete %dl
xorb $0x1, %al
orb %dl, %al
jne 0xe24e4
leaq 0x120349(%rip), %rax    # 0x202800
movl (%rax), %esi
leaq 0x12b084(%rip), %rax    # 0x20d544
imull $0x31a, (%rax), %eax    # imm = 0x31A
cltd
idivl %r8d
cmpl %eax, %esi
setge %al
leaq 0x144868(%rip), %rdx    # 0x226d3e
cmpb $0x0, (%rdx)
sete %dl
andb %al, %dl
movzbl %dl, %esi
movl %esi, (%r11)
leaq 0x122f25(%rip), %r8     # 0x205410
xorl %eax, %eax
movb %al, (%r8)
leaq 0x122f1a(%rip), %r10    # 0x205411
movb %al, (%r10)
testb %r15b, %r15b
setne %al
testb %r12b, %r12b
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0xe2581
cmpl $0x1, %esi
je 0xe2523
testb %r9b, %r9b
jne 0xe2523
leaq 0x242d92(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
je 0xe2581
movb $0x1, (%r8)
testl %edi, %edi
je 0xe2665
cmpl $0x4b, %edi
je 0xe2665
leaq 0x242e55(%rip), %r8     # 0x325394
leaq 0x242e46(%rip), %rax    # 0x32538c
movl (%rax), %eax
movl %r9d, %r14d
pushq $0x2
popq %r9
cltd
idivl %r9d
movl %r14d, %r9d
addl $-0x2, %eax
movl (%r8), %edx
addl %eax, %edx
leaq 0x242e0f(%rip), %r8     # 0x325374
movl %edx, (%r8)
leaq 0x122ea1(%rip), %r8     # 0x205410
leaq 0x242e1a(%rip), %rdx    # 0x325390
addl (%rdx), %eax
leaq 0x242df9(%rip), %rdx    # 0x325378
movl %eax, (%rdx)
addl $-0x49, %edi
cmpl $0x10, %edi
ja 0xe2665
movl $0x18401, %eax          # imm = 0x18401
btl %edi, %eax
jae 0xe2665
testl %esi, %esi
je 0xe2a1e
testb %cl, %cl
jne 0xe2607
leaq 0x242d02(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
je 0xe2607
leaq 0x122e1e(%rip), %r14    # 0x2053d8
cmpb $0x0, (%r14)
je 0xe25f4
movl %r9d, %ebx
movq %r8, %r13
callq 0xc9736
movq %r13, %r8
movl %ebx, %r9d
leaq 0x122e39(%rip), %r10    # 0x205411
leaq 0x122e25(%rip), %r11    # 0x205404
leaq 0x2141c2(%rip), %rbx    # 0x2f67a8
leaq 0x242daf(%rip), %r13    # 0x32539c
movb $0x0, (%r14)
movl (%r11), %esi
movl %esi, %eax
leal -0x1(%rax), %esi
movl %esi, (%r11)
cmpl $0x2, %eax
jl 0xe2a1e
movb (%rbx), %cl
movzbl %cl, %eax
leal -0x42(%rax), %edx
cmpl $0x7, %edx
ja 0xe269f
leaq 0x32be3(%rip), %rax     # 0x115200
movslq (%rax,%rdx,4), %rdx
addq %rax, %rdx
jmpq *%rdx
movq %r8, %r15
movl %r9d, %r12d
movq %r11, %r14
leaq 0x1201f2(%rip), %rax    # 0x202828
cmpl $0x0, (%rax)
je 0xe265e
cmpl $0x0, (%r13)
jne 0xe265e
leaq 0x242d47(%rip), %rax    # 0x325390
movl (%rax), %eax
leaq 0x12022a(%rip), %rcx    # 0x20287c
cmpl (%rcx), %eax
jl 0xe265e
pushq $0x14
popq %rdi
callq 0xe87c
callq 0xe2e51
jmp 0xe26c8
testb %r12b, %r12b
je 0xe259b
testb %r9b, %r9b
je 0xe259b
cmpb $0x3, %r9b
je 0xe259b
cmpl $0x1, %esi
je 0xe2696
leaq 0x242c23(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
je 0xe259b
movb $0x1, (%r10)
jmp 0xe259b
cmpl $0x55, %eax
je 0xe289a
cmpl $0x56, %eax
je 0xe2887
cmpl $0x57, %eax
jne 0xe27cb
movq %r8, %r15
movl %r9d, %r12d
movq %r11, %r14
callq 0xde84e
movl (%r14), %eax
leal -0x1(%rax), %esi
movl %esi, (%r14)
movb $0x0, (%r15)
movb (%rbx), %cl
testb %cl, %cl
sete %dl
cmpl $0x2, %eax
setl %al
testb %al, %dl
leaq 0x122d26(%rip), %r10    # 0x205411
jne 0xe2a1e
movq %r14, %r11
movl %r12d, %r9d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq %r10, %r13
testb %r9b, %r9b
setne %al
testl %esi, %esi
setg %dl
cmpb $0x53, %cl
je 0xe2714
andb %dl, %al
je 0xe2734
movq %r11, %r14
callq 0xe35a6
cmpb $0x0, (%r13)
jne 0xe28de
movq %r14, %r11
movl (%r14), %esi
decl %esi
movl %esi, (%r14)
movb (%rbx), %cl
movq %r11, %r14
testb %cl, %cl
je 0xe28cd
movzbl %cl, %eax
cmpl $0x42, %eax
je 0xe28de
cmpl $0x4d, %eax
je 0xe28de
movb $0x0, (%r13)
jmp 0xe2a1e
leaq 0x12009b(%rip), %rdx    # 0x202800
leaq 0x12add8(%rip), %rax    # 0x20d544
imull $0x31a, (%rax), %eax    # imm = 0x31A
movl (%rdx), %esi
cltd
idivl %r8d
leaq 0x242c69(%rip), %rdx    # 0x3253e8
movb (%rdx), %dl
cmpl %eax, %esi
jge 0xe27ad
movb $0x1, %al
movl %r9d, %esi
testb %dl, %dl
jne 0xe2459
leaq 0x120137(%rip), %rax    # 0x2028d0
xorl %esi, %esi
cmpq $0x400, (%rax)          # imm = 0x400
sete %sil
movl %esi, %eax
jmp 0xe2459
movb $0x1, %al
testb %dl, %dl
je 0xe2452
leaq 0x144580(%rip), %rdx    # 0x226d3e
xorl %esi, %esi
cmpb $0x1, (%rdx)
adcl $0x1, %esi
jmp 0xe2459
movl %ecx, %eax
andb $-0x2, %al
cmpb $0x58, %al
jne 0xe28ad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe2e51
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe2a2d
leaq 0x1200cc(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x20000, %rax          # imm = 0x20000
je 0xe29b0
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
je 0xe295b
cmpq $0x400000, %rax         # imm = 0x400000
je 0xe2997
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0xe2979
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0xe2901
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0xe293d
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0xe291f
cmpq $0x40000, %rax          # imm = 0x40000
jne 0xe2a1e
pushq $0x1
popq %rdi
pushq $0x4
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9ecc0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe2cd7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe2b7f
cmpb $0x60, %cl
je 0xe23d4
testb %cl, %cl
jne 0xe26fd
cmpb $0x0, (%r8)
jne 0xe2626
jmp 0xe26fd
testb %r12b, %r12b
je 0xe29c3
testl %esi, %esi
jle 0xe29c3
callq 0xe2e51
movq %r14, %rcx
movl (%r14), %esi
decl %esi
movl %esi, (%r14)
cmpb $0x0, (%rbx)
movb $0x0, (%r13)
jne 0xe2a1e
jmp 0xe29cb
pushq $0x1
popq %rdi
pushq $0x3
popq %rsi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb87da
pushq $0x1
popq %rdi
pushq $0x3
popq %rsi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb6b75
pushq $0x1
popq %rdi
pushq $0x3
popq %rsi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb70b8
pushq $0x1
popq %rdi
pushq $0x3
popq %rsi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb6e78
pushq $0x1
popq %rdi
pushq $0x3
popq %rsi
movl $0x3e7, %edx            # imm = 0x3E7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb7811
pushq $0x1
popq %rdi
pushq $0x4
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9efd8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb9783
movb $0x0, (%r13)
movq %r14, %rcx
testl %esi, %esi
jle 0xe2a04
leaq 0x146568(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
je 0xe29ee
movq %rcx, %rbx
callq 0x6f8d4
movq %rbx, %rcx
testb %al, %al
je 0xe29ee
decl (%rcx)
jmp 0xe2a1e
testb %r15b, %r15b
je 0xe2a1e
movq %rcx, %rbx
callq 0xe2295
callq 0xde84e
decl (%rbx)
jmp 0xe2a1e
leaq 0x11fec5(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x800000, %rax         # imm = 0x800000
je 0xe29cf
cmpq $0x400, %rax            # imm = 0x400
je 0xe29cf
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq