// File: /workspace/github_cpp_makefile_star2_O1/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, 0x20b8ca(%rip)     # 0x21885b
movb %al, 0x20b8c3(%rip)     # 0x21885a
movl $0x1e, 0x20b8cb(%rip)   # 0x21886c
movl $0x6, 0x20b8c5(%rip)    # 0x218870
movl $0x3c, 0x20b8bf(%rip)   # 0x218874
movl $0xa, 0x20b8b9(%rip)    # 0x218878
movl $0x41, 0x20b7d3(%rip)   # 0x21879c
cmpl $0x0, 0x20b808(%rip)    # 0x2187d8
je 0xcfd9
movl $0x40, %ecx
jmp 0xcffb
movl 0x20b821(%rip), %eax    # 0x218800
movl $0x3e, %ecx
cmpl $0x1e1, %eax            # imm = 0x1E1
jl 0xcffb
movl $0x3f, %ecx
cmpl $0x281, %eax            # imm = 0x281
jge 0xd350
movl %ecx, 0x20b79b(%rip)    # 0x21879c
movl $0x12, 0x20b795(%rip)   # 0x2187a0
movl 0x20b78b(%rip), %eax    # 0x21879c
movl %eax, 0x20b78d(%rip)    # 0x2187a4
movl $0x140, %eax            # imm = 0x140
movl %eax, 0x32e276(%rip)    # 0x33b298
movl %eax, 0x32e364(%rip)    # 0x33b38c
movl $0x1, 0x231f0e(%rip)    # 0x23ef40
movl $0x0, 0x20b844(%rip)    # 0x218880
callq 0x12aeb
cmpl $0x0, 0x20b7e0(%rip)    # 0x218828
je 0xd068
movl 0x20b7b4(%rip), %eax    # 0x218804
movl %eax, 0x20b7d6(%rip)    # 0x21882c
movl 0x20b7a4(%rip), %ecx    # 0x218800
movl %ecx, 0x20b7a2(%rip)    # 0x218804
movl %eax, 0x20b798(%rip)    # 0x218800
cmpb $0x50, 0x2ff739(%rip)   # 0x30c7a8
jne 0xd0ae
cmpl $0x0, 0x2164d4(%rip)    # 0x22354c
jne 0xd156
movl 0x20b77c(%rip), %ecx    # 0x218800
movl 0x20b78a(%rip), %edx    # 0x218814
leal (,%rdx,8), %eax
shll $0x2, %edx
cmpl 0x20b76a(%rip), %ecx    # 0x218804
leal (%rdx,%rdx,2), %edx
cmovll %edx, %eax
cmpl $0x1c2, %ecx            # imm = 0x1C2
cmovll %edx, %eax
jmp 0xd14b
cmpb $0x0, 0x231e89(%rip)    # 0x23ef3e
je 0xd0e3
cmpl $0x0, 0x21648e(%rip)    # 0x22354c
jne 0xd156
cmpb $0x0, 0x20e31a(%rip)    # 0x21b3e5
jne 0xd156
movl 0x20b795(%rip), %ecx    # 0x21886c
addl %ecx, %ecx
movl 0x20b79d(%rip), %eax    # 0x21887c
subl %ecx, %eax
jmp 0xd14b
cmpb $0x0, 0x22fc54(%rip)    # 0x23cd3e
jne 0xd156
cmpl $0x259, 0x20b70e(%rip)  # imm = 0x259
jl 0xd156
movl 0x231e1a(%rip), %eax    # 0x23ef18
cmpl $0x9, %eax
jl 0xd156
cmpb $0x0, 0x20e2db(%rip)    # 0x21b3e5
je 0xd156
cmpl $0x0, 0x216439(%rip)    # 0x22354c
jne 0xd156
cmpl $0x2, 0x2ff668(%rip)    # 0x30c784
jl 0xd124
movl 0x2ff664(%rip), %eax    # 0x30c788
addl $-0x8, %eax
imull 0x20b6e6(%rip), %eax    # 0x218814
movl 0x20b738(%rip), %ecx    # 0x21886c
leal (%rax,%rcx,2), %esi
addl %ecx, %ecx
leal -0x1(%rsi), %eax
cltd
idivl %ecx
movl 0x20b737(%rip), %eax    # 0x21887c
subl %edx, %eax
addl %esi, %eax
decl %eax
movl %eax, 0x20b72b(%rip)    # 0x21887c
callq 0x11e50
cmpb $0x0, 0x20e27f(%rip)    # 0x21b3dc
leaq 0x20b708(%rip), %rax    # 0x21886c
leaq 0x20b705(%rip), %rcx    # 0x218870
cmoveq %rax, %rcx
movl (%rcx), %eax
movl %eax, 0x20b731(%rip)    # 0x2188a8
cmpl $0x0, 0x332bea(%rip)    # 0x33fd68
je 0xd195
cmpl $0x0, 0x2163c5(%rip)    # 0x22354c
jne 0xd195
movl 0x20b675(%rip), %eax    # 0x218804
movl %eax, 0x20b6e7(%rip)    # 0x21887c
movl 0x20b669(%rip), %edi    # 0x218804
movl 0x20b6db(%rip), %esi    # 0x21887c
movl %edi, %ecx
subl %esi, %ecx
movl 0x20b6c0(%rip), %r8d    # 0x21886c
addl %r8d, %r8d
movl %ecx, %eax
cltd
idivl %r8d
subl %edx, %ecx
movl %ecx, 0x20b6cb(%rip)    # 0x218888
movl %ecx, %eax
sarl %eax
decl %eax
movl %eax, 0x20b6cb(%rip)    # 0x218894
addl %esi, %ecx
cmpl %edi, %ecx
jge 0xd1d9
addl %edi, %esi
subl %ecx, %esi
movl %esi, 0x20b6a3(%rip)    # 0x21887c
movl 0x20b621(%rip), %ecx    # 0x218800
movslq 0x20b68e(%rip), %rsi    # 0x218874
movl %ecx, %eax
cltd
idivl %esi
movl %ecx, %eax
subl %edx, %eax
movl %eax, 0x20b68f(%rip)    # 0x218884
movl 0x20b6a1(%rip), %eax    # 0x21889c
testl %eax, %eax
je 0xd229
imull %esi, %eax
movl %eax, 0x20b67c(%rip)    # 0x218884
cmpb $0x0, 0x20e185(%rip)    # 0x21b394
je 0xd229
movl $0xe10, %eax            # imm = 0xE10
xorl %edx, %edx
idivq %rsi
movq %rax, 0x20e176(%rip)    # 0x21b398
movb $0x0, 0x20e16b(%rip)    # 0x21b394
addl %esi, %esi
cmpb $0x0, 0x20e196(%rip)    # 0x21b3c8
movl $0x1, %eax
cmovel %esi, %eax
movl %eax, 0x20b658(%rip)    # 0x218898
cmpb $0x0, 0x32e08f(%rip)    # 0x33b2d6
setne %dl
movb 0x32e060(%rip), %al     # 0x33b2b0
testb %al, %al
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0xd281
movb 0x20e1b0(%rip), %dl     # 0x21b415
orb 0x20e1a8(%rip), %dl     # 0x21b413
setne %dl
cmpl $0x68f, %ecx            # imm = 0x68F
jg 0xd281
testb %dl, %dl
je 0xd281
movb $0x1, 0x32e167(%rip)    # 0x33b3e8
testb %al, %al
setne %al
cmpb $0x0, 0x22fab1(%rip)    # 0x23cd3e
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd29e
movb $0x1, 0x32e14a(%rip)    # 0x33b3e8
callq 0x12a84
callq 0x11fcf
callq 0x12759
callq 0x11d00
callq 0x125a1
movl 0x20b5af(%rip), %eax    # 0x21886c
addl %eax, %eax
movl $0x1e0, %ecx            # imm = 0x1E0
addl %ecx, %eax
cmpl %eax, 0x20b5b0(%rip)    # 0x21887c
setge 0x20b55d(%rip)          # 0x218830
cmpl %ecx, 0x20b52b(%rip)    # 0x218804
jg 0xd32a
movq 0x20b5ee(%rip), %rax    # 0x2188d0
cmpq $0xfffff, %rax          # imm = 0xFFFFF
jg 0xd2f8
cmpq $0x8, %rax
je 0xd32a
cmpq $0x10, %rax
je 0xd32a
jmp 0xd308
cmpq $0x100000, %rax         # imm = 0x100000
je 0xd32a
cmpq $0x200000, %rax         # imm = 0x200000
je 0xd32a
cmpl $0x0, 0x2ff94d(%rip)    # 0x30cc5c
jne 0xd32a
cmpl $0x0, 0x2ff93c(%rip)    # 0x30cc54
jne 0xd32a
cmpb $0x0, 0x20e0ff(%rip)    # 0x21b420
jne 0xd32a
movb $0x0, 0x21620e(%rip)    # 0x223538
movb $0x1, 0x20e0a7(%rip)    # 0x21b3d8
cmpl $0x0, 0x20b510(%rip)    # 0x218848
jne 0xd340
movl %ebx, 0x20b504(%rip)    # 0x218844
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xd846f
cmpl $0x1e0, 0x20b4aa(%rip)  # imm = 0x1E0
jg 0xd39a
imull $0x31a, 0x2161de(%rip), %edx # imm = 0x31A
movslq %edx, %rdx
imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
leal -0x14(%rdx), %esi
cmpl %esi, %eax
setle %sil
addl $0x6, %edx
cmpl %edx, %eax
setg %dl
orb %sil, %dl
cmpb $0x1, %dl
jne 0xcffb
imull $0x31a, 0x2161a0(%rip), %ecx # imm = 0x31A
movslq %ecx, %rcx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
cmpl %ecx, %eax
jle 0xcfd2
cmpb $0x1, 0x20b48f(%rip)    # 0x218859
movl $0x40, %ecx
jne 0xd001
jmp 0xcffb