             /* Beispielprogramm Start */
           /* Copyright H.-J. Schloáarek 1989 */

#include <stdio.h>
#include <stdlib.h>
#include <bios.h>
#include <dos.h>
#include "a:bschirm.h"   /* muss im Compilerverzeichnis */
                         /* stehen, oder Pfad angeben */


void H_menue (void);

unsigned int bildseg;

main()
{
  unsigned int karte;
/* Grafikkarte ermitteln */
  karte = biosequip();

  if ((karte & 0x30) == 0x30)
   bildseg = 0xb000;   /* Mono */
    else
     bildseg = 0xb800; /* Color */
      H_menue();
}

void H_menue ()
{
   unsigned  pos_b = 1;
   unsigned antwort;
   struct date datbuf;
   struct time zeitbuf;

   while (1)
   {
    loesch(0,0,24,79);
     rahmen(0,0,79,4,NOR,2);
      rahmen(20,0,79,3,NOR,2);
       rahmen(7,27,26,10,INT,5);

  getdate(&datbuf);
  /* Systemdatum abfragen */

 poscurs(2,2);
 printf("Datum : %2d.%2d.%2d",
 datbuf.da_day,datbuf.da_mon,datbuf.da_year - 1900);

  gettime(&zeitbuf);
 /* Systemzeit abfragen */

 poscurs(2,60);
 printf("Uhrzeit : %2d:%2d:%2d",
 zeitbuf.ti_hour,zeitbuf.ti_min,zeitbuf.ti_sec);

  /* String's ausgeben */
 p_satz(2,33,NOR,"START-MENUE");
 p_satz(21,57,NOR,"Auswahl mit : ");
 p_satz(22,57,NOR,"Cursor-Taste (auf/ab)");
 p_satz(8,30,NOR,"POWERC ?");
 p_satz(9,30,NOR,"TURBO-PASCAL ?");
 p_satz(10,30,NOR,"TASM ?");
 p_satz(11,30,NOR,"T-DEBUGGER ?");
 p_satz(12,30,NOR,"GW_BASIC ?");
 p_satz(13,30,NOR,"PC-WRITE ?");
 p_satz(14,30,NOR,"FORMAT A: ?");
 p_satz(15,30,NOR,"DIRECTORY ANZEIGEN ?");
 p_satz(16,30,NOR,"Programm-Ende (Exit) ?");
    cursoff();
    poscurs(21,3);

  /* Leuchtbalken zeichnen und Pos abfragen */
     antwort = n_balken(8,28,24,0,1,9,pos_b,'v');

  /* Auswahl durch Rckgabewert */
  /* in Variable antwort       */
      switch(antwort)
      {
   case 1 : loesch(21,3,22,40);

  /*  ausgabe einer Meldung */
      p_satz(21,3,NOR,"Meldung:");
      p_satz(22,3,INV,"Powerc wird geladen!");

  /* Pause von 3 Sekunden */
      sleep(3);

  /* cursor an */
      curson();

  /*  aufruf des Befehls wechsele Directory */
      system("cd powerc");

  /*  starte z.B.: powerc */
      system("pc");

  /*  abfragebereich 1 ende */
  /*  wird gebraucht falls in antwort */
  /*  nicht 1 enthalten, damit naechste */
  /*  m”glichkeit ausgewertet werden kann */
      break;

   case 2 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung:");
      p_satz(22,3,INV,"Turbo-Pascal wird geladen!");
      sleep(3);
      curson();
      system("cd Turbo");
      system("Turbo");
      cursoff();
      break;

   case 3 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung:");
      p_satz(22,3,INV,"TASM wird geladen!");
      sleep(3);
      curson();
      system("cd tasm");
      system("tasm");
      cursoff();
      break;

   case 4 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung:");
      p_satz(22,3,INV,"T-Debugger wird geladen!");
      sleep(3);
      curson();
      system("cd tdebug");
      system("td");
      cursoff();
      break;

   case 5 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung :");
      p_satz(22,3,INV,"GW-Basic wird geladen!");
      sleep(3);
      curson();
      system("cd Basic");
      system("gwbasic");
      cursoff();
      break;

   case 6 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung :");
      p_satz(22,3,INV,"PC-Write wird geladen!");
      sleep(3);
      curson();
      system("cd pc-write");
      system("ed");
      cursoff();
      break;

   case 7 : loesch(21,3,22,40);
      p_satz(21,3,NOR,"Meldung :");
      p_satz(22,3,INV,"Formatbefehl wird ausgefhrt!");
      sleep(3);
      curson();
      loesch(0,0,24,79);
      system("format a:/v");
      cursoff();
      break;

   case 8 : loesch(21,3,22,40);
    p_satz(21,3,NOR,"Meldung :");
    p_satz(22,3,INV,"Inhalt des Directory's !");
    sleep(3);
    loesch(22,3,22,40);
    p_satz(22,3,INV,"Die letzte Anzeige erscheint 10 sek!");
    sleep(3);
    curson();
    loesch(0,0,24,79);
    system("dir/p");
    sleep(10);
    cursoff();
    break;

    case 9 : loesch(21,3,22,40);
       p_satz(21,3,NOR,"Meldung :");
       p_satz(22,3,INV,"Zurueck zum System !");
       sleep(2);
       loesch(0,0,24,79);
       curson();
       exit(0);

    default: return;
       }
    }
}
