// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: config_screen(int)
void config_screen(int why)
{
int i;

   // setup variables related to the video screen size
   no_x_margin = no_y_margin = 0;

   VERT_MAJOR = 30;    // the graph axes tick mark spacing (in pixels)
   VERT_MINOR  = 6;    // VERT_MAJOR/VERT_MINOR should be 5

   HORIZ_MAJOR = 60;
   HORIZ_MINOR = 10;

   INFO_COL = 65;
   if(text_mode) INFO_COL -= 1;
   else if(SCREEN_WIDTH <= 480) {
      INFO_COL -= 3;  // piss
   }
   else if(SCREEN_WIDTH <= 640) INFO_COL -= 2;
   else if(1 && (SCREEN_HEIGHT <= TINY_HEIGHT) && (SCREEN_WIDTH > NARROW_SCREEN-20) && (SCREEN_WIDTH <= NARROW_SCREEN+X11_MARGIN)) {
      INFO_COL -= 2;  // kludge for small touch screens (800x480)
   }
   else if(SCREEN_WIDTH <= NARROW_SCREEN) INFO_COL -= 1;
   else if(small_font == 1) INFO_COL -= 1;

   FILTER_ROW = 18;
   FILTER_COL = INFO_COL;

   AZEL_SIZE = LLA_SIZE = (MAX_AZEL); // size of the az/el map area
   eofs = 1;

   PLOT_COL = 0;

   config_res();   // set the height/width, etc.
   SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);

//sprintf(plot_title, "PLOT_ROW:%d  VM:%d  texth:%d", PLOT_ROW, VERT_MAJOR, TEXT_HEIGHT);
   if(zoom_screen == 'P') {
      if(user_set_plot_row == 0) {
         if((SCREEN_WIDTH < TINY_TINY_WIDTH) || (SCREEN_WIDTH < SCREEN_HEIGHT)) {  //piss
            PLOT_ROW = TEXT_HEIGHT*12;
         }
         else {
            PLOT_ROW = TEXT_HEIGHT*8;
         }
         scale_plot_row();
      }
   }
   else if(1 && luxor) {
//      PLOT_ROW = SCREEN_HEIGHT / 2;
//      scale_plot_row();
//if(PLOT_ROW > TEXT_HEIGHT*26) PLOT_ROW = TEXT_HEIGHT*26;
//      PLOT_ROW /= TEXT_HEIGHT;
//      PLOT_ROW *= TEXT_HEIGHT;
      if(user_set_plot_row == 0) {
         if(plot_digital_clock == 0) {
            PLOT_ROW -= VERT_MAJOR*2;
            scale_plot_row();
         }
      }
   }
   else if((all_adevs == SINGLE_ADEVS) && (SCREEN_HEIGHT > SHORT_SCREEN) && (max_sats > 8) && plot_digital_clock) {
      i = (max_sats-8) * TEXT_HEIGHT;
      if(sat_cols > 1) i = (sat_rows-8) * TEXT_HEIGHT;
      i += ((VERT_MAJOR*2) - 1);
      i /= (VERT_MAJOR*2);  // makes graph prettier to have things a multiple of VERT_MAJOR*2
      i *= (VERT_MAJOR*2);

      if(user_set_plot_row == 0) {
         PLOT_ROW = PLOT_ROW + i;
         scale_plot_row();
      }
   }

   if(small_sat_count) {  // compress sat count to VERT_MINOR ticks per sat
      COUNT_SCALE = VERT_MINOR;
   }
   else {                 // expand sat count to VERT_MAJOR ticks per sat
      COUNT_SCALE = VERT_MAJOR;
   }

   if(no_plots) {
      if(user_set_plot_row == 0) {
         PLOT_ROW = SCREEN_HEIGHT;
      }
//    scale_plot_row();
   }

   // graphs look best if PLOT_HEIGHT is a multiple of (2*VERT_MAJOR)
   // but small screens don't have room to waste
   PLOT_HEIGHT = (SCREEN_HEIGHT-PLOT_ROW);
   PLOT_HEIGHT /= (VERT_MAJOR*2);  // makes graph prettier to have things a multiple of VERT_MAJOR*2
   PLOT_HEIGHT *= (VERT_MAJOR*2);

   PLOT_CENTER = (PLOT_HEIGHT/2-1);

if(1 && ((PLOT_ROW+PLOT_HEIGHT) < SCREEN_HEIGHT)) {  // shift plot down to bottom of the screen
   PLOT_ROW += (SCREEN_HEIGHT - (PLOT_ROW + PLOT_HEIGHT) - 0);
}

   PLOT_WIDTH = (SCREEN_WIDTH/HORIZ_MAJOR) * HORIZ_MAJOR;
   if(day_plot) {
      PLOT_WIDTH = HORIZ_MAJOR * day_plot;
      if(interval_set) {
         queue_interval = (60L*60L) / HORIZ_MAJOR;
         interval_set = 0;
      }
   }

   // when graph fills, scroll it left this many pixels
   if(continuous_scroll) PLOT_SCROLL = 1;  // live update mode for fast processors
   else                  PLOT_SCROLL = (HORIZ_MAJOR*2);

   if(rcvr_type == NO_RCVR) ;
   else if(no_plots) ;
   else if(0 && SMALL_SCREEN) {  // undersized screen
      if     (plot_azel)     shared_plot = 1;
      else if(plot_signals)  shared_plot = 1;
      else if(plot_watch)    shared_plot = 1;
      else if(plot_lla)      shared_plot = 1;
      else                   shared_plot = 0;
   }

   if(fix_mode && plot_lla && (plot_azel || plot_signals) && (WIDE_SCREEN == 0)) {
      shared_plot = 1;
   }
   if(all_adevs && plot_lla) {
      shared_plot = 1;
   }

   config_zoom();  // see if Z zoom command can be used
   config_azel();  // setup for drawing azel map (and analog watch)
   config_lla();   // setup for drawing lat/lon/alt plot
   config_text();  // setup for drawing text
   config_watch(); // setup for drawing the analog watch

// sprintf(plot_title, "share:%d azel:%d,%d  lla:%d,%d  watch:%d,%d  adev:%d,%d", share_active, AZEL_ROW,AZEL_COL, LLA_ROW,LLA_COL, WATCH_ROW,WATCH_COL, ADEV_ROW,ADEV_COL);

   if(PLOT_ROW >= (PLOT_TOP+2*VERT_MAJOR)) big_plot = 1;
   else                                    big_plot = 0;

   if(SCREEN_HEIGHT <= TINY_HEIGHT) {
      if((rcvr_type == SCPI_RCVR) || (rcvr_type == UCCM_RCVR) || (rcvr_type == TRUE_RCVR) || (rcvr_type == ZYFER_RCVR)) ;
      else if(have_ffom || have_tfom) ;
      else if(!user_set_dops) plot_dops = 0;
   }

   screen_configed = 1;

   if(no_redraw == 0) need_redraw = why;
   force_adev_redraw(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %eax, %eax
movb %al, 0x1f5bfc(%rip)     # 0x20285b
movb %al, 0x1f5bf5(%rip)     # 0x20285a
movl $0x1e, 0x1f5bfd(%rip)   # 0x20286c
movl $0x6, 0x1f5bf7(%rip)    # 0x202870
movl $0x3c, 0x1f5bf1(%rip)   # 0x202874
movl $0xa, 0x1f5beb(%rip)    # 0x202878
movl $0x41, 0x1f5b05(%rip)   # 0x20279c
pushq $0x40
popq %rsi
cmpl $0x0, 0x1f5b37(%rip)    # 0x2027d8
je 0xcca7
movl %esi, %ecx
jmp 0xccc9
movl 0x1f5b53(%rip), %edi    # 0x202800
cmpl $0x1e1, %edi            # imm = 0x1E1
jge 0xccba
pushq $0x3e
popq %rcx
jmp 0xccc9
pushq $0x3f
popq %rcx
cmpl $0x281, %edi            # imm = 0x281
jae 0xcff5
movl %ecx, 0x1f5acd(%rip)    # 0x20279c
movl $0x12, 0x1f5ac7(%rip)   # 0x2027a0
movl %ecx, 0x1f5ac5(%rip)    # 0x2027a4
movl $0x140, %eax            # imm = 0x140
movl %eax, 0x3185ae(%rip)    # 0x325298
movl %eax, 0x31869c(%rip)    # 0x32538c
movl $0x1, 0x21c246(%rip)    # 0x228f40
andl $0x0, 0x1f5b7f(%rip)    # 0x202880
callq 0x121c2
cmpl $0x0, 0x1f5b1b(%rip)    # 0x202828
je 0xcd2d
movl 0x1f5aef(%rip), %eax    # 0x202804
movl %eax, 0x1f5b11(%rip)    # 0x20282c
movl 0x1f5adf(%rip), %ecx    # 0x202800
movl %ecx, 0x1f5add(%rip)    # 0x202804
movl %eax, 0x1f5ad3(%rip)    # 0x202800
cmpb $0x50, 0x2e9a74(%rip)   # 0x2f67a8
jne 0xcd6c
cmpl $0x0, 0x20080f(%rip)    # 0x20d54c
jne 0xce14
movl 0x1f5ab7(%rip), %ecx    # 0x202800
movl 0x1f5ac5(%rip), %eax    # 0x202814
imull $0xc, %eax, %edx
shll $0x3, %eax
cmpl 0x1f5aa9(%rip), %ecx    # 0x202804
cmovll %edx, %eax
cmpl $0x1c2, %ecx            # imm = 0x1C2
cmovll %edx, %eax
jmp 0xce09
cmpb $0x0, 0x21c1cb(%rip)    # 0x228f3e
je 0xcda1
cmpl $0x0, 0x2007d0(%rip)    # 0x20d54c
jne 0xce14
cmpb $0x0, 0x1f865c(%rip)    # 0x2053e5
jne 0xce14
movl 0x1f5ad7(%rip), %ecx    # 0x20286c
addl %ecx, %ecx
movl 0x1f5adf(%rip), %eax    # 0x20287c
subl %ecx, %eax
jmp 0xce09
cmpb $0x0, 0x219f96(%rip)    # 0x226d3e
jne 0xce14
cmpl $0x259, 0x1f5a50(%rip)  # imm = 0x259
jl 0xce14
movl 0x21c15c(%rip), %eax    # 0x228f18
cmpl $0x9, %eax
jl 0xce14
cmpb $0x0, 0x1f861d(%rip)    # 0x2053e5
je 0xce14
cmpl $0x0, 0x20077b(%rip)    # 0x20d54c
jne 0xce14
cmpl $0x2, 0x2e99aa(%rip)    # 0x2f6784
jl 0xcde2
movl 0x2e99a6(%rip), %eax    # 0x2f6788
addl $-0x8, %eax
imull 0x1f5a28(%rip), %eax    # 0x202814
movl 0x1f5a7a(%rip), %ecx    # 0x20286c
leal (%rax,%rcx,2), %esi
addl %ecx, %ecx
leal -0x1(%rsi), %eax
cltd
idivl %ecx
movl 0x1f5a79(%rip), %eax    # 0x20287c
subl %edx, %eax
addl %esi, %eax
decl %eax
movl %eax, 0x1f5a6d(%rip)    # 0x20287c
callq 0x1166a
cmpb $0x0, 0x1f85c1(%rip)    # 0x2053dc
movl 0x1f5a4a(%rip), %r8d    # 0x20286c
movl %r8d, %eax
je 0xce2d
movl 0x1f5a43(%rip), %eax    # 0x202870
movl %eax, 0x1f5a75(%rip)    # 0x2028a8
cmpl $0x0, 0x31cf2e(%rip)    # 0x329d68
movl 0x1f59c4(%rip), %esi    # 0x202804
je 0xce55
cmpl $0x0, 0x200703(%rip)    # 0x20d54c
jne 0xce55
movl %esi, 0x1f5a2b(%rip)    # 0x20287c
movl %esi, %edi
jmp 0xce5b
movl 0x1f5a21(%rip), %edi    # 0x20287c
movl %esi, %ecx
subl %edi, %ecx
addl %r8d, %r8d
movl %ecx, %eax
cltd
idivl %r8d
subl %edx, %ecx
movl %ecx, 0x1f5a18(%rip)    # 0x202888
movl %ecx, %eax
sarl %eax
decl %eax
movl %eax, 0x1f5a18(%rip)    # 0x202894
addl %edi, %ecx
cmpl %esi, %ecx
jge 0xce8c
addl %esi, %edi
subl %ecx, %edi
movl %edi, 0x1f59f0(%rip)    # 0x20287c
movl 0x1f596e(%rip), %ecx    # 0x202800
movl 0x1f59dc(%rip), %esi    # 0x202874
movl %ecx, %eax
cltd
idivl %esi
movl %ecx, %eax
subl %edx, %eax
movl %eax, 0x1f59dd(%rip)    # 0x202884
movl 0x1f59ef(%rip), %eax    # 0x20289c
testl %eax, %eax
je 0xcedc
imull %esi, %eax
movl %eax, 0x1f59ca(%rip)    # 0x202884
cmpb $0x0, 0x1f84d3(%rip)    # 0x205394
je 0xcedc
movl $0xe10, %eax            # imm = 0xE10
xorl %edx, %edx
idivl %esi
cltq
movq %rax, 0x1f84c3(%rip)    # 0x205398
movb $0x0, 0x1f84b8(%rip)    # 0x205394
addl %esi, %esi
cmpb $0x0, 0x1f84e3(%rip)    # 0x2053c8
pushq $0x1
popq %rax
cmovel %esi, %eax
movl %eax, 0x1f59a7(%rip)    # 0x202898
cmpb $0x0, 0x3183de(%rip)    # 0x3252d6
setne %dl
movb 0x3183af(%rip), %al     # 0x3252b0
testb %al, %al
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0xcf32
movb 0x1f84ff(%rip), %dl     # 0x205415
orb 0x1f84f7(%rip), %dl     # 0x205413
setne %dl
cmpl $0x68f, %ecx            # imm = 0x68F
jg 0xcf32
testb %dl, %dl
je 0xcf32
movb $0x1, 0x3184b6(%rip)    # 0x3253e8
testb %al, %al
setne %al
cmpb $0x0, 0x219e00(%rip)    # 0x226d3e
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xcf4f
movb $0x1, 0x318499(%rip)    # 0x3253e8
callq 0x1215e
callq 0x117cd
callq 0x11eb6
callq 0x1152c
callq 0x11d0f
movl 0x1f58fe(%rip), %eax    # 0x20286c
addl %eax, %eax
movl $0x1e0, %ecx            # imm = 0x1E0
addl %ecx, %eax
cmpl %eax, 0x1f58ff(%rip)    # 0x20287c
setge 0x1f58ac(%rip)          # 0x202830
cmpl %ecx, 0x1f587a(%rip)    # 0x202804
jg 0xcfd1
movq 0x1f593d(%rip), %rax    # 0x2028d0
cmpq $0x8, %rax
je 0xcfd1
cmpq $0x10, %rax
je 0xcfd1
cmpq $0x100000, %rax         # imm = 0x100000
je 0xcfd1
cmpq $0x200000, %rax         # imm = 0x200000
je 0xcfd1
cmpl $0x0, 0x2e9ca6(%rip)    # 0x2f6c5c
jne 0xcfd1
cmpl $0x0, 0x2e9c95(%rip)    # 0x2f6c54
jne 0xcfd1
cmpb $0x0, 0x1f8458(%rip)    # 0x205420
jne 0xcfd1
movb $0x0, 0x200567(%rip)    # 0x20d538
movb $0x1, 0x1f8400(%rip)    # 0x2053d8
cmpl $0x0, 0x1f5869(%rip)    # 0x202848
jne 0xcfe7
movl %ebx, 0x1f585d(%rip)    # 0x202844
pushq $0x1
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xc7144
movl 0x1f5808(%rip), %r8d    # 0x202804
imull $0x31a, 0x20053e(%rip), %eax # imm = 0x31A
pushq $0x64
popq %r9
cltd
idivl %r9d
cmpl $0x1e0, %r8d            # imm = 0x1E0
jg 0xd037
leal -0x14(%rax), %edx
cmpl %edx, %edi
setle %dl
leal 0x6(%rax), %r8d
cmpl %r8d, %edi
setg %r8b
orb %dl, %r8b
cmpb $0x1, %r8b
jne 0xccc9
cmpl %eax, %edi
jle 0xcca3
cmpb $0x1, 0x1f5813(%rip)    # 0x202859
movl %esi, %ecx
je 0xccc9
pushq $0x41
popq %rcx
jmp 0xcccf