// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: show_touch_kbd(int)
void show_touch_kbd(int erase)
{
int t,l, b,r;  // top,left, bottom,right
int row,col;
int key_size;
unsigned i;

   // draw the touch screen keyboard (upper or lower case)

   if(zoom_screen != 'K') return;

   t = 0+TOUCH_MARGIN;   // allowable keyboard outline
   l = 0+TOUCH_MARGIN;

   b = PLOT_ROW-TOUCH_MARGIN;
   r = SCREEN_WIDTH-TOUCH_MARGIN;

   if(0) {  // always square keys
     key_size = (b-t)/KBD_ROWS;
     if(((r-l)/KBD_COLS) < key_size) key_size = ((r-l)/KBD_COLS);
     r = TOUCH_MARGIN + (KBD_COLS*key_size);
     key_width = key_height = key_size;
   }
   else {   // possible rectangular keys to fill the keyboard space
      key_height = (b-t)/KBD_ROWS;
      key_width = (r-l)/KBD_COLS;
   }

   if(erase) {  // screen erase needed
      erase_screen();
   }

   for(row=0; row<KBD_ROWS; row++) {     // draw the keyboard grid
      for(col=0; col<KBD_COLS; col++) {
         show_key(row,col, 0);
      }

      t += key_height;
   }

   ++graphics_coords;
   vidstr(t+TEXT_HEIGHT,l, KBD_TITLE_COLOR, "Touch screen keyboard.  Enter a command or touch any blank key to exit.");
   --graphics_coords;

   // get the keyboard table indexes of the SHIFT and CAPS LOCK keys
   // so we can change the labels depending upon their state
   for(i=0; i<((sizeof(normal_lc_table) / sizeof(struct KEY_CAP))); i++) {
      if(normal_lc_table[i].val == TOUCH_SH) lc_shift_index = i;
      if(normal_lc_table[i].val == TOUCH_CAP) uc_cap_lock_index = i;
      if(normal_lc_table[i].val == TOUCH_BUT) lc_but_lock_index = i;
   }
   for(i=0; i<((sizeof(uc_table) / sizeof(struct KEY_CAP))); i++) {
      if(uc_table[i].val == TOUCH_SH) uc_shift_index = i;
      if(uc_table[i].val == TOUCH_CAP) uc_cap_lock_index = i;
      if(uc_table[i].val == TOUCH_BUT) uc_but_lock_index = i;
   }
}

// Assembly:
cmpb $0x4b, 0x2e7ec8(%rip)   # 0x2f67a8
jne 0xe9f5
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x1f3f1d(%rip), %ebx    # 0x202814
movl 0x1f3f7f(%rip), %eax    # 0x20287c
movl 0x1f3efd(%rip), %ecx    # 0x202800
leal (,%rbx,4), %esi
subl %esi, %eax
pushq $0x6
popq %r8
cltd
idivl %r8d
movl %eax, 0x31b852(%rip)    # 0x32a16c
subl %esi, %ecx
pushq $0xf
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, 0x31b83e(%rip)    # 0x32a168
testl %edi, %edi
je 0xe933
callq 0xe7d9
addl %ebx, %ebx
xorl %r15d, %r15d
movl %ebx, %r14d
cmpl $0x6, %r15d
je 0xe968
xorl %r12d, %r12d
cmpl $0xf, %r12d
je 0xe95c
movl %r15d, %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0xf493
incl %r12d
jmp 0xe944
addl 0x31b809(%rip), %r14d   # 0x32a16c
incl %r15d
jmp 0xe93b
incb 0x1f3efa(%rip)          # 0x202868
addl 0x1f3e9f(%rip), %r14d   # 0x202814
leaq 0xe56ab(%rip), %rcx     # 0xf4027
pushq $0xb
popq %rdx
movl %r14d, %edi
movl %ebx, %esi
callq 0xe2d2
decb 0x1f3ed9(%rip)          # 0x202868
leaq 0x13bbca(%rip), %rax    # 0x14a560
xorl %ecx, %ecx
leaq 0x12b159(%rip), %rdx    # 0x139af8
cmpq $0x60, %rcx
je 0xe9be
movslq (%rax), %rsi
cmpq $-0x3, %rsi
jb 0xe9b5
movq 0x18(%rdx,%rsi,8), %rsi
movl %ecx, (%rsi)
incq %rcx
addq $0x18, %rax
jmp 0xe99f
leaq 0x13cd9b(%rip), %rax    # 0x14b760
xorl %ecx, %ecx
leaq 0x12b142(%rip), %rdx    # 0x139b10
cmpq $0x60, %rcx
je 0xe9ed
movslq (%rax), %rsi
cmpq $-0x3, %rsi
jb 0xe9e4
movq 0x18(%rdx,%rsi,8), %rsi
movl %ecx, (%rsi)
incq %rcx
addq $0x18, %rax
jmp 0xe9ce
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq