/*MENUPROG.C 10-09-1994*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#define TXT unsigned char
#define DN 80
#define UP 72
#define ENT 13
#define ESC 27
#define REVERSE 112
#define NORMAL 7

TXT mono,secim,tus;
union REGS rg;
struct { unsigned k : 8;
         unsigned r : 8; 
       }far *ekr;  

void blank()
{ rg.h.ah = 1;
  rg.h.ch = 1;
  rg.h.cl = 0;
  int86(0x10,&rg,&rg);
};

void ekrankontrol()       
{ FP_SEG(ekr) = 0;
  FP_OFF(ekr) = 1040;
  mono = (ekr->k & 48) == 48;
  if(mono) FP_SEG(ekr) = 0xb000;
       else FP_SEG(ekr) = 0xb800;
};

void field(TXT sat,TXT sut,TXT rnk,TXT uz)
{ sat--; sut--;
 FP_OFF(ekr) = sat*160+sut*2;
 while(uz--) { ekr->r = rnk; ekr++; };
};

void cls()
{ rg.h.ah = 0xF; int86(0x10,&rg,&rg);
  rg.h.ah = 0; int86(0x10,&rg,&rg);
};
void sekil()
{ cls();
printf("\n\n\n\n\n\n\n\t\t\t ÚÄÄÄÄÄÄÄÄ MAIN MENU ÄÄÄÄÄÄÄÄ¿ \n");
field(8,35,REVERSE,11);
printf("\t\t\t ³                           ³ \n");
printf("\t\t\t ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ \n");
printf("\t\t\t ³ ³  SYSTEM COMMAND LINE  ³ ³ \n");
printf("\t\t\t ³ ³  BORLAND C++          ³ ³ \n");
printf("\t\t\t ³ ³  VISUAL BASIC         ³ ³ \n");
printf("\t\t\t ³ ³  AUTOCAD R12          ³ ³ \n");
printf("\t\t\t ³ ³  PC TOOLS             ³ ³ \n");
printf("\t\t\t ³ ³  WINDOWS              ³ ³ \n");    
printf("\t\t\t ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ \n");
printf("\t\t\t ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ \n");
};
main()
{
ekrankontrol();
secim = 1;
sekil();
blank();
do { field(secim+10,30,REVERSE,21);
    tus = getch(); if(tus==ESC || tus==NULL) tus = getch();
    field(secim+10,30,NORMAL,21);
    switch(tus)
    { case DN  : if(secim<6) secim++; else secim=1; break;
      case UP  : if(secim>1) secim--; else secim=6; break;
      case ENT : break;
      default : printf("\a"); break;
    };
   } while(tus!=ENT);
cls();
switch(secim)
{ case 1: system("command"); break;
  case 2: system("bc"); break;
  case 3: system("wbdos"); break;
  case 4: system("acadr12"); break;
  case 5: system("pc"); break;
  case 6: system("win");
};
return 0;
};
