// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movzbl 0x35a006(%rip), %eax    # 0x36b988
cmpl $0x4b, %eax
je 0x1198c
jmp 0x11b89
movl 0x266062(%rip), %eax    # 0x2779f4
shll %eax
addl $0x0, %eax
movl %eax, -0x8(%rbp)
movl 0x266054(%rip), %eax    # 0x2779f4
shll %eax
addl $0x0, %eax
movl %eax, -0xc(%rbp)
movl 0x2660ae(%rip), %eax    # 0x277a5c
movl 0x266040(%rip), %ecx    # 0x2779f4
shll %ecx
subl %ecx, %eax
movl %eax, -0x10(%rbp)
movl 0x26601f(%rip), %eax    # 0x2779e0
movl 0x26602d(%rip), %ecx    # 0x2779f4
shll %ecx
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %eax
subl -0x8(%rbp), %eax
movl $0x6, %ecx
cltd
idivl %ecx
movl %eax, 0x38d96a(%rip)    # 0x39f34c
movl -0x14(%rbp), %eax
subl -0xc(%rbp), %eax
movl $0xf, %ecx
cltd
idivl %ecx
movl %eax, 0x38d952(%rip)    # 0x39f348
cmpl $0x0, -0x4(%rbp)
je 0x11a01
callq 0x117e0
movl $0x0, -0x18(%rbp)
cmpl $0x6, -0x18(%rbp)
jge 0x11a4a
movl $0x0, -0x1c(%rbp)
cmpl $0xf, -0x1c(%rbp)
jge 0x11a33
movl -0x18(%rbp), %edi
movl -0x1c(%rbp), %esi
xorl %edx, %edx
callq 0x12b60
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x11a15
movl 0x38d913(%rip), %eax    # 0x39f34c
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x11a08
movb 0x265ff8(%rip), %al     # 0x277a48
addb $0x1, %al
movb %al, 0x265ff0(%rip)     # 0x277a48
movl -0x8(%rbp), %edi
addl 0x265f93(%rip), %edi    # 0x2779f4
movl -0xc(%rbp), %esi
movl $0xb, %edx
leaq 0x15e50e(%rip), %rcx    # 0x16ff7e
callq 0x10ee0
movb 0x265fcd(%rip), %al     # 0x277a48
addb $-0x1, %al
movb %al, 0x265fc5(%rip)     # 0x277a48
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpq $0x60, %rax
jae 0x11b06
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1adaa1(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x2, 0x10(%rax)
jne 0x11ab5
movl -0x24(%rbp), %eax
movl %eax, 0x38d8b3(%rip)    # 0x39f368
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1ada7f(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jne 0x11ad7
movl -0x24(%rbp), %eax
movl %eax, 0x38d885(%rip)    # 0x39f35c
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1ada5d(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x3, 0x10(%rax)
jne 0x11af9
movl -0x24(%rbp), %eax
movl %eax, 0x38d867(%rip)    # 0x39f360
jmp 0x11afb
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x11a8a
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpq $0x60, %rax
jae 0x11b89
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1aec1e(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x2, 0x10(%rax)
jne 0x11b38
movl -0x24(%rbp), %eax
movl %eax, 0x38d834(%rip)    # 0x39f36c
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1aebfc(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jne 0x11b5a
movl -0x24(%rbp), %eax
movl %eax, 0x38d802(%rip)    # 0x39f35c
movl -0x24(%rbp), %eax
movl %eax, %ecx
leaq 0x1aebda(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x3, 0x10(%rax)
jne 0x11b7c
movl -0x24(%rbp), %eax
movl %eax, 0x38d7e8(%rip)    # 0x39f364
jmp 0x11b7e
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x11b0d
addq $0x30, %rsp
popq %rbp
retq
nop