// File: jkingan[P]ladyheather/heather.cpp
// Function: show_plot_grid()
void show_plot_grid()
{
int x, y;
int color;
int col;
int j;
int top_adev_row;
int adev_decade_width;  // HORIZ_MAJOR divisions per decade

   if(bin_scale == 8) adev_decade_width = 4;  // 1-2-4-8 decades
   else if(bin_scale == 1) adev_decade_width = 1;  // 1 per decade
//   else if(bin_scale == 2) adev_decade_width = 4;  // 1 per octave
   else adev_decade_width = 3;  // 1-2-5 decades

   if(rcvr_type == NO_RCVR) return;
   top_adev_row = SCREEN_HEIGHT;


   for(x=0; x<PLOT_WIDTH; x++) {  // draw vertical features
      col = PLOT_COL + x;
      if((x % HORIZ_MAJOR) == 0) {  // major tick marks
         dot(col, PLOT_ROW+1, WHITE);               // along top horizontal axis
         dot(col, PLOT_ROW+2, WHITE);
         dot(col, PLOT_ROW+3, WHITE);

         dot(col, PLOT_ROW+PLOT_HEIGHT-2, WHITE);   // along bottom horizontal axis
         dot(col, PLOT_ROW+PLOT_HEIGHT-3, WHITE);
         dot(col, PLOT_ROW+PLOT_HEIGHT-4, WHITE);

         for(j=0; j<=PLOT_CENTER; j+=VERT_MAJOR) {
            dot(col,   PLOT_ROW+PLOT_CENTER+j-1, WHITE);  // + at intersections
            dot(col,   PLOT_ROW+PLOT_CENTER+j,   WHITE);
            dot(col,   PLOT_ROW+PLOT_CENTER+j+1, WHITE);
            if(col > PLOT_COL) dot(col-1, PLOT_ROW+PLOT_CENTER+j,WHITE);
            dot(col+1, PLOT_ROW+PLOT_CENTER+j,   WHITE);

            dot(col,  PLOT_ROW+PLOT_CENTER-j-1, WHITE);  // + at intersections
            dot(col,  PLOT_ROW+PLOT_CENTER-j,   WHITE);
            dot(col,  PLOT_ROW+PLOT_CENTER-j+1, WHITE);
            if(col > PLOT_COL) dot(col-1,PLOT_ROW+PLOT_CENTER-j, WHITE);
            dot(col+1,PLOT_ROW+PLOT_CENTER-j,    WHITE);
         }

         color = GREY;  // WHITE;
         if(plot_adev_data) {
            if((x % (HORIZ_MAJOR*adev_decade_width)) == 0) color = CYAN;  // ADEV 1-2-5 bins
         }

         for(j=VERT_MINOR; j<=PLOT_CENTER; j+=VERT_MINOR) {
            dot(col, PLOT_ROW+PLOT_CENTER+j, color);
            dot(col, PLOT_ROW+PLOT_CENTER-j, color);
         }
      }
      else if((x % HORIZ_MINOR) == 0) {  // minor tick marks
         dot(col, PLOT_ROW+1, WHITE);
         dot(col, PLOT_ROW+PLOT_CENTER, GREY);  // center line tick marks
         dot(col, PLOT_ROW+PLOT_HEIGHT-2, WHITE);

         if(plot_adev_data) color = CYAN;  // subtly highlight ADEV decades
         else               color = GREY;

         for(j=VERT_MAJOR; j<=PLOT_CENTER; j+=VERT_MAJOR) {
            dot(col, PLOT_ROW+PLOT_CENTER+j, color);
            dot(col, PLOT_ROW+PLOT_CENTER-j, color);
            if((PLOT_ROW+PLOT_CENTER-j) < top_adev_row) {
               if(color == CYAN) top_adev_row = (PLOT_ROW+PLOT_CENTER-j);
            }
            if(SCREEN_HEIGHT > SHORT_SCREEN) {
               if(plot_adev_data && (color != CYAN)) color = CYAN;
               else color = GREY;  // WHITE;
            }
            else if(zoom_screen == 'P') {
               if(plot_adev_data && (color != CYAN)) color = CYAN;
               else color = GREY;  // WHITE;
            }
            else {
               dot(col, PLOT_ROW+PLOT_CENTER, color);
            }
         }
      }
   }

   for(y=0; y<=PLOT_CENTER; y++) {  // draw horizontal features
      if((y % VERT_MAJOR) == 0) {
         if((HIGHLIGHT_REF == 0) || (y != 0)) {
            dot(PLOT_COL+1,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+1,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-1, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-1, PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+2,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+2,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-2, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-2, PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+3,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+3,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-3, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-3, PLOT_ROW+PLOT_CENTER-y, WHITE);
         }
      }
      else if((y % VERT_MINOR) == 0) {
         dot(PLOT_COL+1,             PLOT_ROW+PLOT_CENTER+y,  WHITE);
         dot(PLOT_COL+1,             PLOT_ROW+PLOT_CENTER-y,  WHITE);
         dot(PLOT_COL+PLOT_WIDTH-1-1,PLOT_ROW+PLOT_CENTER+y,  WHITE);
         dot(PLOT_COL+PLOT_WIDTH-1-1,PLOT_ROW+PLOT_CENTER-y,  WHITE);
      }
   }

   // draw plot border
   draw_rectangle(PLOT_COL,PLOT_ROW+1, PLOT_WIDTH-1,PLOT_HEIGHT-1-1, WHITE);

   if(HIGHLIGHT_REF) {   // highlight plot center reference line with > ,,, < markers
      mark_row(PLOT_CENTER);
   }

   label_adev_grid(top_adev_row);  // label the ADEV grid lines if adevs being shown
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
cmpl $0x8, 0x27b09d(%rip)    # 0x29be5c
jne 0x20dca
movl $0x4, -0x1c(%rbp)
jmp 0x20de5
cmpl $0x1, 0x27b08b(%rip)    # 0x29be5c
jne 0x20ddc
movl $0x1, -0x1c(%rbp)
jmp 0x20de3
movl $0x3, -0x1c(%rbp)
jmp 0x20de5
cmpq $0x400, 0x256cc0(%rip) # imm = 0x400
jne 0x20df7
jmp 0x21562
movl 0x256be7(%rip), %eax    # 0x2779e4
movl %eax, -0x18(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x256c54(%rip), %eax    # 0x277a64
jge 0x2125b
movl 0x256c44(%rip), %eax    # 0x277a60
addl -0x4(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x4(%rbp), %eax
cltd
idivl 0x256c28(%rip)          # 0x277a54
cmpl $0x0, %edx
jne 0x210c7
movl -0x10(%rbp), %edi
movl 0x256c1e(%rip), %esi    # 0x277a5c
addl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256c08(%rip), %esi    # 0x277a5c
addl $0x2, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256bf2(%rip), %esi    # 0x277a5c
addl $0x3, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256bdc(%rip), %esi    # 0x277a5c
addl 0x256be2(%rip), %esi    # 0x277a68
subl $0x2, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256bc0(%rip), %esi    # 0x277a5c
addl 0x256bc6(%rip), %esi    # 0x277a68
subl $0x3, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256ba4(%rip), %esi    # 0x277a5c
addl 0x256baa(%rip), %esi    # 0x277a68
subl $0x4, %esi
movl $0xf, %edx
callq 0x10d70
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x256b99(%rip), %eax    # 0x277a74
jg 0x21038
movl -0x10(%rbp), %edi
movl 0x256b72(%rip), %esi    # 0x277a5c
addl 0x256b84(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
subl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256b53(%rip), %esi    # 0x277a5c
addl 0x256b65(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256b37(%rip), %esi    # 0x277a5c
addl 0x256b49(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
addl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %eax
cmpl 0x256b1c(%rip), %eax    # 0x277a60
jle 0x20f65
movl -0x10(%rbp), %edi
subl $0x1, %edi
movl 0x256b0a(%rip), %esi    # 0x277a5c
addl 0x256b1c(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
addl $0x1, %edi
movl 0x256aeb(%rip), %esi    # 0x277a5c
addl 0x256afd(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256acf(%rip), %esi    # 0x277a5c
addl 0x256ae1(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
subl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256ab0(%rip), %esi    # 0x277a5c
addl 0x256ac2(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256a94(%rip), %esi    # 0x277a5c
addl 0x256aa6(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
addl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %eax
cmpl 0x256a79(%rip), %eax    # 0x277a60
jle 0x21008
movl -0x10(%rbp), %edi
subl $0x1, %edi
movl 0x256a67(%rip), %esi    # 0x277a5c
addl 0x256a79(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
addl $0x1, %edi
movl 0x256a48(%rip), %esi    # 0x277a5c
addl 0x256a5a(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256a1f(%rip), %eax    # 0x277a4c
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x20ed2
movl $0x8, -0xc(%rbp)
cmpb $0x0, 0x259573(%rip)    # 0x27a5b9
je 0x21066
movl -0x4(%rbp), %eax
movl 0x256a03(%rip), %ecx    # 0x277a54
imull -0x1c(%rbp), %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x21064
movl $0xb, -0xc(%rbp)
jmp 0x21066
movl 0x2569e4(%rip), %eax    # 0x277a50
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x2569fc(%rip), %eax    # 0x277a74
jg 0x210c2
movl -0x10(%rbp), %edi
movl 0x2569d9(%rip), %esi    # 0x277a5c
addl 0x2569eb(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
movl -0xc(%rbp), %eax
movzbl %al, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x2569bc(%rip), %esi    # 0x277a5c
addl 0x2569ce(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
movl -0xc(%rbp), %eax
movzbl %al, %edx
callq 0x10d70
movl 0x256996(%rip), %eax    # 0x277a50
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x2106f
jmp 0x2124b
movl -0x4(%rbp), %eax
cltd
idivl 0x256987(%rip)          # 0x277a58
cmpl $0x0, %edx
jne 0x21249
movl -0x10(%rbp), %edi
movl 0x256979(%rip), %esi    # 0x277a5c
addl $0x1, %esi
movl $0xf, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x256963(%rip), %esi    # 0x277a5c
addl 0x256975(%rip), %esi    # 0x277a74
movl $0x8, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x25694a(%rip), %esi    # 0x277a5c
addl 0x256950(%rip), %esi    # 0x277a68
subl $0x2, %esi
movl $0xf, %edx
callq 0x10d70
cmpb $0x0, 0x25948d(%rip)    # 0x27a5b9
je 0x21137
movl $0xb, -0xc(%rbp)
jmp 0x2113e
movl $0x8, -0xc(%rbp)
movl 0x256908(%rip), %eax    # 0x277a4c
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x256924(%rip), %eax    # 0x277a74
jg 0x21247
movl -0x10(%rbp), %edi
movl 0x2568fd(%rip), %esi    # 0x277a5c
addl 0x25690f(%rip), %esi    # 0x277a74
addl -0x14(%rbp), %esi
movl -0xc(%rbp), %eax
movzbl %al, %edx
callq 0x10d70
movl -0x10(%rbp), %edi
movl 0x2568e0(%rip), %esi    # 0x277a5c
addl 0x2568f2(%rip), %esi    # 0x277a74
subl -0x14(%rbp), %esi
movl -0xc(%rbp), %eax
movzbl %al, %edx
callq 0x10d70
movl 0x2568c6(%rip), %eax    # 0x277a5c
addl 0x2568d8(%rip), %eax    # 0x277a74
subl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x211be
cmpl $0xb, -0xc(%rbp)
jne 0x211bc
movl 0x2568ac(%rip), %eax    # 0x277a5c
addl 0x2568be(%rip), %eax    # 0x277a74
subl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x211be
cmpl $0x258, 0x25681c(%rip)  # imm = 0x258
jle 0x211eb
cmpb $0x0, 0x2593e8(%rip)    # 0x27a5b9
je 0x211e2
cmpl $0xb, -0xc(%rbp)
je 0x211e2
movl $0xb, -0xc(%rbp)
jmp 0x211e9
movl $0x8, -0xc(%rbp)
jmp 0x21234
movzbl 0x34a796(%rip), %eax    # 0x36b988
cmpl $0x50, %eax
jne 0x21218
cmpb $0x0, 0x2593bb(%rip)    # 0x27a5b9
je 0x2120f
cmpl $0xb, -0xc(%rbp)
je 0x2120f
movl $0xb, -0xc(%rbp)
jmp 0x21216
movl $0x8, -0xc(%rbp)
jmp 0x21232
movl -0x10(%rbp), %edi
movl 0x25683b(%rip), %esi    # 0x277a5c
addl 0x25684d(%rip), %esi    # 0x277a74
movl -0xc(%rbp), %eax
movzbl %al, %edx
callq 0x10d70
jmp 0x21234
jmp 0x21236
movl 0x256810(%rip), %eax    # 0x277a4c
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x21147
jmp 0x21249
jmp 0x2124b
jmp 0x2124d
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x20e07
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x256809(%rip), %eax    # 0x277a74
jg 0x21520
movl -0x8(%rbp), %eax
cltd
idivl 0x2567d1(%rip)          # 0x277a4c
cmpl $0x0, %edx
jne 0x21461
cmpl $0x0, -0x8(%rbp)
je 0x2145c
movl 0x2567cc(%rip), %edi    # 0x277a60
addl $0x1, %edi
movl 0x2567bf(%rip), %esi    # 0x277a5c
addl 0x2567d1(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x2567aa(%rip), %edi    # 0x277a60
addl $0x1, %edi
movl 0x25679d(%rip), %esi    # 0x277a5c
addl 0x2567af(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256788(%rip), %edi    # 0x277a60
addl 0x256786(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x1, %edi
movl 0x256772(%rip), %esi    # 0x277a5c
addl 0x256784(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x25675d(%rip), %edi    # 0x277a60
addl 0x25675b(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x1, %edi
movl 0x256747(%rip), %esi    # 0x277a5c
addl 0x256759(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256732(%rip), %edi    # 0x277a60
addl $0x2, %edi
movl 0x256725(%rip), %esi    # 0x277a5c
addl 0x256737(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256710(%rip), %edi    # 0x277a60
addl $0x2, %edi
movl 0x256703(%rip), %esi    # 0x277a5c
addl 0x256715(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x2566ee(%rip), %edi    # 0x277a60
addl 0x2566ec(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x2, %edi
movl 0x2566d8(%rip), %esi    # 0x277a5c
addl 0x2566ea(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x2566c3(%rip), %edi    # 0x277a60
addl 0x2566c1(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x2, %edi
movl 0x2566ad(%rip), %esi    # 0x277a5c
addl 0x2566bf(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256698(%rip), %edi    # 0x277a60
addl $0x3, %edi
movl 0x25668b(%rip), %esi    # 0x277a5c
addl 0x25669d(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256676(%rip), %edi    # 0x277a60
addl $0x3, %edi
movl 0x256669(%rip), %esi    # 0x277a5c
addl 0x25667b(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256654(%rip), %edi    # 0x277a60
addl 0x256652(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x3, %edi
movl 0x25663e(%rip), %esi    # 0x277a5c
addl 0x256650(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256629(%rip), %edi    # 0x277a60
addl 0x256627(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x3, %edi
movl 0x256613(%rip), %esi    # 0x277a5c
addl 0x256625(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
jmp 0x21510
movl -0x8(%rbp), %eax
cltd
idivl 0x2565e5(%rip)          # 0x277a50
cmpl $0x0, %edx
jne 0x2150e
movl 0x2565e6(%rip), %edi    # 0x277a60
addl $0x1, %edi
movl 0x2565d9(%rip), %esi    # 0x277a5c
addl 0x2565eb(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x2565c4(%rip), %edi    # 0x277a60
addl $0x1, %edi
movl 0x2565b7(%rip), %esi    # 0x277a5c
addl 0x2565c9(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x2565a2(%rip), %edi    # 0x277a60
addl 0x2565a0(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x1, %edi
movl 0x25658c(%rip), %esi    # 0x277a5c
addl 0x25659e(%rip), %esi    # 0x277a74
addl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
movl 0x256577(%rip), %edi    # 0x277a60
addl 0x256575(%rip), %edi    # 0x277a64
subl $0x1, %edi
subl $0x1, %edi
movl 0x256561(%rip), %esi    # 0x277a5c
addl 0x256573(%rip), %esi    # 0x277a74
subl -0x8(%rbp), %esi
movl $0xf, %edx
callq 0x10d70
jmp 0x21510
jmp 0x21512
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x21262
movl 0x25653a(%rip), %edi    # 0x277a60
movl 0x256530(%rip), %esi    # 0x277a5c
addl $0x1, %esi
movl 0x25652f(%rip), %edx    # 0x277a64
subl $0x1, %edx
movl 0x25652a(%rip), %ecx    # 0x277a68
subl $0x1, %ecx
subl $0x1, %ecx
movl $0xf, %r8d
callq 0x12030
movl 0x25651f(%rip), %edi    # 0x277a74
callq 0x1fe50
movl -0x18(%rbp), %edi
callq 0x15f8d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)