#include "dec_menu.c"
char edit(char buf[12],char x1,char y1,char x2,char color)
{
 char far* vid;
 char x,y,i=0;
 union keyb
 {
  int k;
  char ch[2];
 } key;
 union REGS r;
 r.h.ah = 2;
 r.h.bh = 0;
 r.h.dh = y = y1;
 r.h.dl = x = x1;
 int86(0x10,&r,&r);
 vid = (char far*)(0xb8000000l + 160*y1 + 2*x1);
 do
 {
  key.k = bioskey(0);
  switch(key.ch[1])
  {
   case 14: if(x > x1)  //bksp
            {
             x--;  
             vid = (char far*)(0xb8000000l + 160*y + 2*x);
             *vid = ' ';
             if(i<12) i--;
             r.h.ah = 2;
             r.h.bh = 0;
             r.h.dh = y;
             r.h.dl = x;
             int86(0x10,&r,&r);
            }
           break;
   case 1: r.h.ah = 2;     
           r.h.bh = 0;
           r.x.dx = 0x1900;
           int86(0x10,&r,&r);
           return 0;
   default:
   if((isalnum(key.ch[0]))||(key.ch[0] == '.'))
   {
    *vid++ = key.ch[0];
    *vid++ = color;
    if(i<12) buf[i++] = key.ch[0];
    x++;
    r.h.ah = 2;
    r.h.bh = 0;
    r.h.dh = y;
    r.h.dl = x;
    int86(0x10,&r,&r);
    if(x == x2)
    {
     x = x1;
     vid = (char far*)(0xb8000000l + 160*y + 2*x);
     i = 0;
    }
   }
  }
 }
 while(key.ch[1] != 28);
  r.h.ah = 2;
  r.h.bh = 0;
  r.x.dx = 0x1900;
  int86(0x10,&r,&r);
 return 1;
}
