save_video() restore_video() - 2


int popup(menu,keys,count,x,y,border)

char *menu[]; /* */

char *keys; /* */

int count; /* */

int x,y; /* */

int border; /* 0 */

/* */

for(i=0;i<count;i++)

if(strlen(menu[i]) > len) len=strlen(menu[i]);

if((endx+1>24) || (endy+1>79))

printf(" ");

return -2;

vmode = video_mode();

if((vmode!=2) && (vmode!=3) && (vmode!=7))

printf(" 80 ");

exit(1);

/* */

else vid_mem=(char far *)0xB8000000;

p=(unsigned int *)malloc((endx-x+1)*(endy-y+1));

if(!p) exit(1); /* */

/* */

void display_menu(menu,x,y,count);

/* */

free(p);

void display_menu(menu,x,y,count)

int x,y,count;

for(i=0;i<count;i++,x++)

write_string(x,y,menu[i],NORM_VID);

int startx,starty,endx,endy;

write_char(startx,starty,218,NORM_VID);

write_char(endx ,starty,192,NORM_VID);

goto_xy(startx,endy ); putchar(191);

goto_xy(endx ,endy ); putchar(217);

/* */

int x,y,count;

char *keys;

y++;

goto_xy(x,y);

write_string(x,y,menu[0],REV_VID);

/* */

goto_xy(arrow_choice,y);

if(c.ch[0]) /* */

key_choice= is_in(keys,tolower(c.ch[0]));

switch(c.ch[0])

case '\r' : return arrow_choice;

case ' ' : arrow_choice++;

break;

case ESC : return -1; /* */

if(arrow_choice<0) arrow_choice=count-1;

/* */

goto_xy(x+arrow_choice,y);

write_string(x+arrow_choice,y,menu[arrow_choice],REV_VID);

void write_string(x,y,p,attrib)

char *p;

register int i,j;