Listing 3

/*various include files*/
#include <stdio.h>
#include <graph.h>
#include <bios.h>
#include <dos.h>

#define FALSE 0
#define TRUE 1
#define VIDEO 0x10                              /*software interrupt 0x10 */
#define WRITE_ATTR_CHAR 9                       /*function 9 */

void disp_screen(struct _scrn *, unsigned short );

struct _scrn    {
       char    *chrs;
       char    cw;
       char    rw;
       char    att;
       };

struct _scrn screen_mainmenu[]={

    {"θλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ£",21,6,31},
    {"                                   ",21,7,31},
    {"        Grade Book Main Menu       ",21,8,31},
    {"                                   ",21,9,31},
    {"        1) Scan Grades             ",21,10,31},
    {"        2) Edit/View Grades        ",21,11,31},
    {"        3) Print Grade Book        ",21,12,31},
    {"        4) Scan Names              ",21,13,31},
    {"        5) Print Rosters           ",21,14,31},
    {"        6) Other Print Functions   ",21,15,31},
    {"        7) Set Teacher Information ",21,16,31},
    {"        8) Drop Lowest Grade       ",21,17,31},
    {"        9) Exit                    ",21,18,31},
    {"                                   ",21,19,31},
    {"     For help, press <Alt><H>.     ",21,20,31},
    {"ΰλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλx",21,21,31},
    {"\0",0,0,0}
    }";
main()
{

disp_screen(screen_mainmenu, TRUE);         /*clear screen and then display the
                                      screen defined by screen_mainmenu*/
}
long color_back_grnd= 1;                        /*all screens will use a blue
                                        background*/
/*-----------------------------------------------------------
| disp_screen - Use ptr passed to array of structures       |
|       containing &text; col; row; and attribute.  |
|       Use BIOS int 10h function 9 to display the  |
|       data.                           |
|                               |
|       If cls_flag is TRUE, clear the screen before|
|               displaying the data. When clearing the       |
|               screen, use the attribute defined in the     |
|               variable color_back_grnd                     |
------------------------------------------------------------*/

void disp_screen(p, cls_flag)
struct _scrn *p;
unsigned short cls_flag;
{
char wcol;
char * wsptr;

union REGS inregs, outregs;


       if (cls_flag)
       {
              _setbkcolor(color_back_grnd);
              _clearscreen(_GCLEARSCREEN);
       }

    inregs.h.ah = WRITE_ATTR_CHAR;          /*print char and attribute*/
    inregs.x.cx = 1;                    /*print 1 char*/
    while ( *(p->chrs) )
    {
        wsptr=p->chrs;                 /*get ptr to string*/
        wcol=p->cw;

        inregs.h.bh = 0;                /*video page 0*/
        inregs.h.bl = p->att;                  /*attribute to use */

        while (inregs.h.al = *wsptr++)           /*char to print*/
        {

                                      /*position the cursor*/
            _settextposition( (short) p->rw, (short) wcol++);

            int86 ( VIDEO, &inregs, &outregs ); /*print with BIOS*/
        }

        p++;
    }
}