// File: /workspace/github_cpp_makefile_star2_O3/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 0x214c29(%rip), %rbx    # 0x30c7a8
movzbl (%rbx), %edx
cmpl $0x51, %edx
je 0xf7b9f
cmpl $0x60, %edx
jne 0xf7bc4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x262dd
leaq 0x215986(%rip), %rax    # 0x30d52c
movl (%rax), %edi
leaq 0x215979(%rip), %rax    # 0x30d528
movl (%rax), %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf3fa6
movl %edx, %eax
leaq 0x2437cf(%rip), %r10    # 0x33b39c
movl $0x0, (%r10)
leaq 0x120bfd(%rip), %rsi    # 0x2187d8
xorl %ecx, %ecx
cmpl $0x0, (%rsi)
jne 0xf7c00
leaq 0x23f42f(%rip), %rsi    # 0x337018
cmpb $0x0, (%rsi)
movl $0x0, %esi
jne 0xf7c50
testl %edx, %edx
je 0xf7c04
xorl %ecx, %ecx
cmpl $0x4c, %edx
je 0xf7c50
jmp 0xf7c48
xorl %esi, %esi
jmp 0xf7c50
leaq 0x120bf5(%rip), %rsi    # 0x218800
leaq 0x12b932(%rip), %rcx    # 0x223544
imull $0x31a, (%rcx), %ecx    # imm = 0x31A
movslq %ecx, %rcx
imulq $0x51eb851f, %rcx, %rdi # imm = 0x51EB851F
movq %rdi, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rdi
addl %ecx, %edi
leaq 0x2437b2(%rip), %rcx    # 0x33b3e8
movb (%rcx), %cl
cmpl %edi, (%rsi)
jge 0xf7f7e
testb %cl, %cl
je 0xf804a
movb $0x1, %sil
movl $0x1, %ecx
leaq 0x1237b1(%rip), %rdi    # 0x21b408
leaq 0x1237b5(%rip), %r8     # 0x21b413
cmpb $0x58, %al
movzbl (%rdi), %r15d
movl $0x1, %edi
cmovel %edi, %r15d
movl %eax, %r9d
andb $-0x2, %r9b
cmpb $0x58, %r9b
movzbl (%r8), %r12d
cmovel %edi, %r12d
leaq 0x12377d(%rip), %r9     # 0x21b404
cmpb $0x49, %al
cmovel %edi, %r12d
movl %ecx, (%r9)
leaq 0x1472c1(%rip), %rdi    # 0x23ef58
cmpl $0x0, (%rdi)
leaq 0x123774(%rip), %rdi    # 0x21b415
sete %r8b
xorb $0x1, %sil
orb %r8b, %sil
jne 0xf7cf7
leaq 0x120b4b(%rip), %rcx    # 0x218800
leaq 0x12b888(%rip), %rsi    # 0x223544
imull $0x31a, (%rsi), %esi    # imm = 0x31A
movslq %esi, %rsi
imulq $0x51eb851f, %rsi, %rsi # imm = 0x51EB851F
movq %rsi, %r8
shrq $0x3f, %r8
sarq $0x25, %rsi
addl %r8d, %esi
cmpl %esi, (%rcx)
setge %cl
leaq 0x145058(%rip), %rsi    # 0x23cd3e
cmpb $0x0, (%rsi)
sete %sil
andb %cl, %sil
movzbl %sil, %ecx
movl %ecx, (%r9)
movb (%rdi), %r11b
leaq 0x12370f(%rip), %r8     # 0x21b410
xorl %esi, %esi
movb %sil, (%r8)
leaq 0x123704(%rip), %r13    # 0x21b411
movb %sil, (%r13)
testb %r15b, %r15b
setne %sil
testb %r12b, %r12b
setne %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0xf7d9c
cmpl $0x1, %ecx
je 0xf7d3e
testb %r11b, %r11b
jne 0xf7d3e
leaq 0x243577(%rip), %rsi    # 0x33b2b0
cmpb $0x0, (%rsi)
je 0xf7d9c
movb $0x1, (%r8)
testl %edx, %edx
je 0xf7e8a
cmpl $0x4b, %edx
je 0xf7e8a
leaq 0x24363a(%rip), %rsi    # 0x33b394
leaq 0x24362b(%rip), %rdi    # 0x33b38c
movl (%rdi), %edi
movq %r8, %r14
movl %edi, %r8d
shrl $0x1f, %r8d
addl %edi, %r8d
sarl %r8d
addl $-0x2, %r8d
movl (%rsi), %esi
addl %r8d, %esi
leaq 0x2435f1(%rip), %rdi    # 0x33b374
movl %esi, (%rdi)
leaq 0x243604(%rip), %rsi    # 0x33b390
addl (%rsi), %r8d
leaq 0x2435e2(%rip), %rsi    # 0x33b378
movl %r8d, (%rsi)
movq %r14, %r8
addl $-0x49, %edx
cmpl $0x10, %edx
ja 0xf7e8a
movl $0x18401, %esi          # imm = 0x18401
btl %edx, %esi
jae 0xf7e8a
testl %ecx, %ecx
je 0xf8244
testb %al, %al
jne 0xf7e22
leaq 0x2434e7(%rip), %rdx    # 0x33b2b0
cmpb $0x0, (%rdx)
je 0xf7e22
leaq 0x123603(%rip), %r14    # 0x21b3d8
cmpb $0x0, (%r14)
je 0xf7e0f
movl %r11d, %ebx
movq %r8, %r13
callq 0xdb2e0
movq %r13, %r8
movl %ebx, %r11d
leaq 0x2435a9(%rip), %r10    # 0x33b39c
leaq 0x123617(%rip), %r13    # 0x21b411
leaq 0x123603(%rip), %r9     # 0x21b404
leaq 0x2149a0(%rip), %rbx    # 0x30c7a8
movb $0x0, (%r14)
movl (%r9), %ecx
movl %ecx, %eax
leal -0x1(%rax), %ecx
movl %ecx, (%r9)
cmpl $0x2, %eax
jl 0xf8244
movb (%rbx), %al
movzbl %al, %edx
cmpl $0x54, %edx
jg 0xf7ec5
addl $-0x42, %edx
cmpl $0x7, %edx
ja 0xf802d
leaq 0x3347f(%rip), %rsi     # 0x12b2c0
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq %r8, %r12
movl %r11d, %r15d
movq %r9, %r14
leaq 0x1209ce(%rip), %rax    # 0x218828
cmpl $0x0, (%rax)
je 0xf7e83
cmpl $0x0, (%r10)
jne 0xf7e83
leaq 0x243524(%rip), %rax    # 0x33b390
movl (%rax), %eax
leaq 0x120a07(%rip), %rcx    # 0x21887c
cmpl (%rcx), %eax
jl 0xf7e83
movl $0x14, %edi
callq 0xed9e
callq 0xf86e1
jmp 0xf7eee
testb %r12b, %r12b
je 0xf7db6
testb %r11b, %r11b
je 0xf7db6
cmpb $0x3, %r11b
je 0xf7db6
cmpl $0x1, %ecx
je 0xf7ebb
leaq 0x2433fe(%rip), %rdx    # 0x33b2b0
cmpb $0x0, (%rdx)
je 0xf7db6
movb $0x1, (%r13)
jmp 0xf7db6
cmpl $0x55, %edx
je 0xf8007
cmpl $0x56, %edx
je 0xf801a
cmpl $0x57, %edx
jne 0xf802d
movq %r8, %r12
movl %r11d, %r15d
movq %r9, %r14
callq 0xf3c61
movl (%r14), %edx
leal -0x1(%rdx), %ecx
movl %ecx, (%r14)
movb $0x0, (%r12)
movb (%rbx), %al
testb %al, %al
sete %sil
cmpl $0x2, %edx
setl %dl
testb %dl, %sil
jne 0xf8244
movq %r14, %r9
movl %r15d, %r11d
xorl %r12d, %r12d
xorl %r15d, %r15d
testb %r11b, %r11b
setne %dl
testl %ecx, %ecx
setg %sil
cmpb $0x53, %al
je 0xf7f34
andb %sil, %dl
je 0xf7f54
movq %r9, %r14
callq 0xf8e75
cmpb $0x0, (%r13)
jne 0xf8155
movq %r14, %r9
movl (%r14), %ecx
decl %ecx
movl %ecx, (%r14)
movb (%rbx), %al
movq %r9, %r14
testb %al, %al
je 0xf8144
movzbl %al, %eax
cmpl $0x42, %eax
je 0xf8155
cmpl $0x4d, %eax
je 0xf8155
movb $0x0, (%r13)
jmp 0xf8244
movb $0x1, %sil
testb %cl, %cl
je 0xf7c4b
leaq 0x144dae(%rip), %rdi    # 0x23cd3e
xorl %ecx, %ecx
cmpb $0x1, (%rdi)
adcl $0x1, %ecx
jmp 0xf7c50
leaq 0x12092c(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x1ffffff, %rax        # imm = 0x1FFFFFF
jg 0xf8064
cmpq $0x3fffff, %rax         # imm = 0x3FFFFF
jg 0xf80c9
cmpq $0x20000, %rax          # imm = 0x20000
je 0xf8175
cmpq $0x40000, %rax          # imm = 0x40000
jne 0xf8244
movl $0x1, %edi
movl $0x4, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaedf0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf8253
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf83c4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf853f
movl %eax, %edx
andb $-0x2, %dl
cmpb $0x58, %dl
jne 0xf80aa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf86e1
leaq 0x12087f(%rip), %rsi    # 0x2188d0
xorl %ecx, %ecx
cmpq $0x400, (%rsi)          # imm = 0x400
sete %cl
movl %ecx, %esi
jmp 0xf7c50
cmpq $0xfffffff, %rax        # imm = 0xFFFFFFF
jg 0xf8103
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0xf8188
cmpq $0x8000000, %rax        # imm = 0x8000000
jne 0xf8244
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 0xc8441
cmpb $0x60, %al
je 0xf7b8c
testb %al, %al
jne 0xf7f1f
cmpb $0x0, (%r8)
jne 0xf7e4a
jmp 0xf7f1f
cmpq $0x400000, %rax         # imm = 0x400000
je 0xf81aa
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0xf8244
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 0xc8bd8
cmpq $0x10000000, %rax       # imm = 0x10000000
je 0xf81c7
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
cmpq %rcx, %rax
jne 0xf8244
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 0xc81f5
testb %r12b, %r12b
je 0xf81e9
testl %ecx, %ecx
jle 0xf81e9
callq 0xf86e1
movq %r14, %rdx
movl (%r14), %ecx
decl %ecx
movl %ecx, (%r14)
cmpb $0x0, (%rbx)
movb $0x0, (%r13)
jne 0xf8244
jmp 0xf81f1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcabd6
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 0xc9bdc
movl $0x1, %edi
movl $0x4, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaf11e
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 0xc7edc
movb $0x0, (%r13)
movq %r14, %rdx
testl %ecx, %ecx
jle 0xf822a
leaq 0x146d42(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0xf8214
movq %rdx, %rbx
callq 0x7a054
movq %rbx, %rdx
testb %al, %al
je 0xf8214
decl (%rdx)
jmp 0xf8244
testb %r15b, %r15b
je 0xf8244
movq %rdx, %rbx
callq 0xf7a3e
callq 0xf3c61
decl (%rbx)
jmp 0xf8244
leaq 0x12069f(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x800000, %rax         # imm = 0x800000
je 0xf81f5
cmpq $0x400, %rax            # imm = 0x400
je 0xf81f5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq