// File: 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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movb $0x0, 0x268f39(%rip)    # 0x277a3b
movb $0x0, 0x268f31(%rip)    # 0x277a3a
movl $0x1e, 0x268f39(%rip)   # 0x277a4c
movl $0x6, 0x268f33(%rip)    # 0x277a50
movl $0x3c, 0x268f2d(%rip)   # 0x277a54
movl $0xa, 0x268f27(%rip)    # 0x277a58
movl $0x41, 0x268e41(%rip)   # 0x27797c
cmpl $0x0, 0x268e76(%rip)    # 0x2779b8
je 0xeb58
movl 0x268e32(%rip), %eax    # 0x27797c
subl $0x1, %eax
movl %eax, 0x268e29(%rip)    # 0x27797c
jmp 0xec5d
cmpl $0x1e0, 0x268e7e(%rip)  # imm = 0x1E0
jg 0xeb78
movl 0x268e12(%rip), %eax    # 0x27797c
subl $0x3, %eax
movl %eax, 0x268e09(%rip)    # 0x27797c
jmp 0xec5b
cmpl $0x280, 0x268e5e(%rip)  # imm = 0x280
jg 0xeb98
movl 0x268df2(%rip), %eax    # 0x27797c
subl $0x2, %eax
movl %eax, 0x268de9(%rip)    # 0x27797c
jmp 0xec59
cmpl $0x1e0, 0x268e42(%rip)  # imm = 0x1E0
jg 0xec03
movl 0x268e36(%rip), %eax    # 0x2779e0
movl %eax, -0xc(%rbp)
imull $0x31a, 0x273b6d(%rip), %eax # imm = 0x31A
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xc(%rbp), %eax
subl $0x14, %ecx
cmpl %ecx, %eax
jle 0xec03
movl 0x268e0f(%rip), %eax    # 0x2779e0
movl %eax, -0x10(%rbp)
imull $0x31a, 0x273b46(%rip), %eax # imm = 0x31A
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x10(%rbp), %eax
addl $0x6, %ecx
cmpl %ecx, %eax
jg 0xec03
movl 0x268d84(%rip), %eax    # 0x27797c
subl $0x2, %eax
movl %eax, 0x268d7b(%rip)    # 0x27797c
jmp 0xec57
movl 0x268dd7(%rip), %eax    # 0x2779e0
movl %eax, -0x14(%rbp)
imull $0x31a, 0x273b0e(%rip), %eax # imm = 0x31A
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x14(%rbp), %eax
cmpl %ecx, %eax
jg 0xec38
movl 0x268d4f(%rip), %eax    # 0x27797c
subl $0x1, %eax
movl %eax, 0x268d46(%rip)    # 0x27797c
jmp 0xec55
movzbl 0x268dfa(%rip), %eax    # 0x277a39
cmpl $0x1, %eax
jne 0xec53
movl 0x268d32(%rip), %eax    # 0x27797c
subl $0x1, %eax
movl %eax, 0x268d29(%rip)    # 0x27797c
jmp 0xec55
jmp 0xec57
jmp 0xec59
jmp 0xec5b
jmp 0xec5d
movl $0x12, 0x268d19(%rip)   # 0x277980
movl 0x268d0f(%rip), %eax    # 0x27797c
movl %eax, 0x268d11(%rip)    # 0x277984
movl $0x140, 0x38b7fb(%rip)  # imm = 0x140
movl $0x140, 0x38b8e5(%rip)  # imm = 0x140
movl $0x1, 0x28f48f(%rip)    # 0x29e120
movl $0x0, 0x268dc5(%rip)    # 0x277a60
callq 0x176e0
cmpl $0x0, 0x268d61(%rip)    # 0x277a08
je 0xeccd
movl 0x268d35(%rip), %eax    # 0x2779e4
movl %eax, 0x268d57(%rip)    # 0x277a0c
movl 0x268d25(%rip), %eax    # 0x2779e0
movl %eax, 0x268d23(%rip)    # 0x2779e4
movl 0x268d45(%rip), %eax    # 0x277a0c
movl %eax, 0x268d13(%rip)    # 0x2779e0
movzbl 0x35ccb4(%rip), %eax    # 0x36b988
cmpl $0x50, %eax
jne 0xed24
cmpl $0x0, 0x273a4c(%rip)    # 0x28272c
jne 0xed1f
cmpl $0x1c2, 0x268cf4(%rip)  # imm = 0x1C2
jl 0xecfc
movl 0x268cec(%rip), %eax    # 0x2779e0
cmpl 0x268cea(%rip), %eax    # 0x2779e4
jge 0xed0b
imull $0xc, 0x268cf1(%rip), %eax # 0x2779f4
movl %eax, 0x268d53(%rip)    # 0x277a5c
jmp 0xed1a
movl 0x268ce3(%rip), %eax    # 0x2779f4
shll $0x3, %eax
movl %eax, 0x268d42(%rip)    # 0x277a5c
callq 0x164d0
jmp 0xee1d
cmpb $0x0, 0x28f3f3(%rip)    # 0x29e11e
je 0xed64
cmpl $0x0, 0x2739f8(%rip)    # 0x28272c
jne 0xed5f
movzbl 0x26b888(%rip), %eax    # 0x27a5c5
cmpl $0x0, %eax
jne 0xed5d
movl 0x268d04(%rip), %ecx    # 0x277a4c
shll %ecx
movl 0x268d0c(%rip), %eax    # 0x277a5c
subl %ecx, %eax
movl %eax, 0x268d04(%rip)    # 0x277a5c
callq 0x164d0
jmp 0xed5f
jmp 0xee1b
movzbl 0x28d1b3(%rip), %eax    # 0x29bf1e
cmpl $0x0, %eax
jne 0xee19
cmpl $0x258, 0x268c66(%rip)  # imm = 0x258
jle 0xee19
cmpl $0x8, 0x28f36d(%rip)    # 0x29e0f8
jle 0xee19
cmpb $0x0, 0x26b82d(%rip)    # 0x27a5c5
je 0xee19
movl 0x28f358(%rip), %eax    # 0x29e0f8
subl $0x8, %eax
imull 0x268c4a(%rip), %eax    # 0x2779f4
movl %eax, -0x8(%rbp)
cmpl $0x1, 0x35cbb0(%rip)    # 0x36b964
jle 0xedc9
movl 0x35cbac(%rip), %eax    # 0x36b968
subl $0x8, %eax
imull 0x268c2e(%rip), %eax    # 0x2779f4
movl %eax, -0x8(%rbp)
movl 0x268c7d(%rip), %eax    # 0x277a4c
shll %eax
subl $0x1, %eax
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
movl 0x268c6c(%rip), %ecx    # 0x277a4c
shll %ecx
movl -0x8(%rbp), %eax
cltd
idivl %ecx
movl %eax, -0x8(%rbp)
movl 0x268c5b(%rip), %eax    # 0x277a4c
shll %eax
imull -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, 0x27392b(%rip)    # 0x28272c
jne 0xee17
movl 0x268c53(%rip), %eax    # 0x277a5c
addl -0x8(%rbp), %eax
movl %eax, 0x268c4a(%rip)    # 0x277a5c
callq 0x164d0
jmp 0xee19
jmp 0xee1b
jmp 0xee1d
cmpb $0x0, 0x26b798(%rip)    # 0x27a5bc
je 0xee34
movl 0x268c24(%rip), %eax    # 0x277a50
movl %eax, 0x268c56(%rip)    # 0x277a88
jmp 0xee40
movl 0x268c12(%rip), %eax    # 0x277a4c
movl %eax, 0x268c48(%rip)    # 0x277a88
cmpl $0x0, 0x390101(%rip)    # 0x39ef48
je 0xee60
cmpl $0x0, 0x2738dc(%rip)    # 0x28272c
jne 0xee5e
movl 0x268b8c(%rip), %eax    # 0x2779e4
movl %eax, 0x268bfe(%rip)    # 0x277a5c
jmp 0xee60
movl 0x268b7e(%rip), %eax    # 0x2779e4
subl 0x268bf0(%rip), %eax    # 0x277a5c
movl %eax, 0x268bf6(%rip)    # 0x277a68
movl 0x268bd4(%rip), %ecx    # 0x277a4c
shll %ecx
movl 0x268be8(%rip), %eax    # 0x277a68
cltd
idivl %ecx
movl %eax, 0x268bdf(%rip)    # 0x277a68
movl 0x268bbd(%rip), %eax    # 0x277a4c
shll %eax
imull 0x268bd0(%rip), %eax    # 0x277a68
movl %eax, 0x268bca(%rip)    # 0x277a68
movl 0x268bc4(%rip), %eax    # 0x277a68
movl $0x2, %ecx
cltd
idivl %ecx
subl $0x1, %eax
movl %eax, 0x268bbf(%rip)    # 0x277a74
movl 0x268ba1(%rip), %eax    # 0x277a5c
addl 0x268ba7(%rip), %eax    # 0x277a68
cmpl 0x268b1d(%rip), %eax    # 0x2779e4
jge 0xeeec
movl 0x268b15(%rip), %eax    # 0x2779e4
movl 0x268b87(%rip), %ecx    # 0x277a5c
addl 0x268b8d(%rip), %ecx    # 0x277a68
subl %ecx, %eax
subl $0x0, %eax
addl 0x268b76(%rip), %eax    # 0x277a5c
movl %eax, 0x268b70(%rip)    # 0x277a5c
movl 0x268aee(%rip), %eax    # 0x2779e0
cltd
idivl 0x268b5b(%rip)          # 0x277a54
imull 0x268b54(%rip), %eax    # 0x277a54
movl %eax, 0x268b5e(%rip)    # 0x277a64
cmpl $0x0, 0x268b6f(%rip)    # 0x277a7c
je 0xef4c
movl 0x268b3f(%rip), %eax    # 0x277a54
imull 0x268b60(%rip), %eax    # 0x277a7c
movl %eax, 0x268b42(%rip)    # 0x277a64
cmpb $0x0, 0x26b64b(%rip)    # 0x27a574
je 0xef4a
movslq 0x268b22(%rip), %rcx    # 0x277a54
movl $0xe10, %eax            # imm = 0xE10
cqto
idivq %rcx
movq %rax, 0x26b635(%rip)    # 0x27a578
movb $0x0, 0x26b62a(%rip)    # 0x27a574
jmp 0xef4c
cmpb $0x0, 0x26b655(%rip)    # 0x27a5a8
je 0xef61
movl $0x1, 0x268b19(%rip)    # 0x277a78
jmp 0xef6f
movl 0x268aed(%rip), %eax    # 0x277a54
shll %eax
movl %eax, 0x268b09(%rip)    # 0x277a78
cmpq $0x400, 0x268b36(%rip) # imm = 0x400
jne 0xef7e
jmp 0xef8d
cmpl $0x0, 0x38ffc3(%rip)    # 0x39ef48
je 0xef89
jmp 0xef8b
jmp 0xef8b
jmp 0xef8d
cmpb $0x0, 0x38b522(%rip)    # 0x39a4b6
je 0xefcf
cmpb $0x0, 0x38b4f3(%rip)    # 0x39a490
je 0xefcf
cmpb $0x0, 0x26b64d(%rip)    # 0x27a5f3
jne 0xefb1
cmpb $0x0, 0x26b646(%rip)    # 0x27a5f5
je 0xefcf
cmpl $0x690, 0x268a25(%rip)  # imm = 0x690
setge %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xefcf
movb $0x1, 0x38b5f9(%rip)    # 0x39a5c8
cmpb $0x0, 0x28cf48(%rip)    # 0x29bf1e
je 0xefe8
cmpb $0x0, 0x38b4b1(%rip)    # 0x39a490
je 0xefe8
movb $0x1, 0x38b5e0(%rip)    # 0x39a5c8
callq 0x17660
callq 0x16680
callq 0x171b0
callq 0x16300
callq 0x16ef0
movl 0x268a55(%rip), %eax    # 0x277a5c
movl 0x268a3f(%rip), %ecx    # 0x277a4c
shll %ecx
addl $0x1e0, %ecx            # imm = 0x1E0
cmpl %ecx, %eax
jl 0xf022
movb $0x1, 0x2689f0(%rip)    # 0x277a10
jmp 0xf029
movb $0x0, 0x2689e7(%rip)    # 0x277a10
cmpl $0x1e0, 0x2689b1(%rip)  # imm = 0x1E0
jg 0xf08f
cmpq $0x10, 0x268a73(%rip)   # 0x277ab0
je 0xf063
cmpq $0x8, 0x268a69(%rip)    # 0x277ab0
je 0xf063
cmpq $0x200000, 0x268a5c(%rip) # imm = 0x200000
je 0xf063
cmpq $0x100000, 0x268a4f(%rip) # imm = 0x100000
jne 0xf065
jmp 0xf08d
cmpl $0x0, 0x35cdd0(%rip)    # 0x36be3c
jne 0xf077
cmpl $0x0, 0x35cdbf(%rip)    # 0x36be34
je 0xf079
jmp 0xf08b
cmpb $0x0, 0x26b580(%rip)    # 0x27a600
jne 0xf089
movb $0x0, 0x27368f(%rip)    # 0x282718
jmp 0xf08b
jmp 0xf08d
jmp 0xf08f
movb $0x1, 0x26b522(%rip)    # 0x27a5b8
cmpl $0x0, 0x26898b(%rip)    # 0x277a28
jne 0xf0a8
movl -0x4(%rbp), %eax
movl %eax, 0x26897c(%rip)    # 0x277a24
movl $0x1, %edi
callq 0x127cf0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)