/* christmas.c by bill buckels 1990    */
/* writing direct to screen            */
/* using bios calls to set the adapter */
/* compile using small memory model    */
/* written in mix c (sound function required) */

/* a table of coordinates and ascii values for the bouncing notes */
unsigned char stuffage[94][3]={
7,11,14,
/* O */
7,13,14,
7,11,32,
/* come */
7,18,14,
7,13,32,
/* all */
7,22,14,
7,18,32,
/* ye */
7,25,14,
7,22,32,
/* faith- */
/* ful */
7,25,32,
7,35,14,
/* joy- */
/* ful */
7,35,32,
7,42,14,
/* and */
7,42,32,
7,46,14,
/* tri- */
/* um- */
/* phant */
7,46,32,
10,11,14,
/* o */
10,11,32,
10,13,14,
/* come */
10,13,32,
10,18,14,
/* ye */
10,18,32,
10,22,14,
/* o */
10,22,32,
10,24,14,
/* come */
10,24,32,
10,29,14,
/* ye */
10,29,32,
10,32,14,
/* to */
10,32,32,
10,35,14,
/* beth- */
/* le- */
/* hem */
10,35,32,
13,11,14,
/* come */
13,11,32,
13,16,14,
/* and */
13,16,32,
13,20,14,
/* be */
/* hold */
13,20,32,
13,27,14,
/* him */
13,27,32,
13,32,14,
/* born */
13,32,32,
13,37,14,
/* the */
13,37,32,
13,41,14,
/* king */
13,41,32,
13,46,14,
/* of */
13,46,32,
13,49,14,
/* an- */
/* gels */
13,49,32,
16,11,14,
/* o */
16,11,32,
16,13,14,
/* come */
16,13,32,
16,18,14,
/* let */
16,18,32,
16,22,14,
/* us */
16,22,32,
16,25,14,
/* a- */
/* dore */
16,25,32,
16,31,14,
/* him */
16,31,32,
16,36,14,
/* o */
16,36,32,
16,38,14,
/* come */
16,38,32,
16,43,14,
/* let */
16,43,32,
16,47,14,
/* us */
16,47,32,
16,50,14,
/* a- */
/* dore */
16,50,32,
16,56,14,
/* him */
16,56,32,
19,11,14,
/* o */
19,11,32,
19,13,14,
/* come */
19,13,32,
19,18,14,
/* let */
19,18,32,
19,22,14,
/* us */
19,22,32,
19,25,14,
/* a- */
/* dore */
19,25,32,
19,31,14,
/* him */
19,31,32,
19,36,14,
/* christ */
19,36,32,
19,43,14,
/* the */
19,43,32,
19,47,14,
/* lord */
19,47,32};


/* a table of frequency and duration values for the song */
/* with logical break insertions */
/* array structure is frequency,duration */
int XMAS[]={
   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,   555,  1,
   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,   880,  1,
 32767,  2,
-1,
   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
   555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
   880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
   555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
   880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
   555,  1,   659,  1,   880,  1,
-1,
   440,  1,   555,  1,   659,  1,
   440,  1,   555,  1,   659,  1,   440,  1,   555,  1,   659,  1,
   440,  1,   555,  1,   659,  1,
-1,
   440,  1,   555,  1,   659,  1,
   880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
   555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
   880,  1,
-1,
   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
   494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
   988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
   494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
   988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
   494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
   416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
   416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
   416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
 32767,  2,
-1,
   440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  1111,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
   494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
   988,  1,   416,  1,   494,  1,   659,  1,   988,  1,
-1,
   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
-1,
   294,  1,
   440,  1,   741,  1,  1175,  1,   294,  1,   440,  1,   741,  1,
  1175,  1,   294,  1,   440,  1,   741,  1,  1175,  1,   294,  1,
   440,  1,   741,  1,  1175,  1,   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
   988,  1,   330,  1,   416,  1,   659,  1,   988,  1, 32767,  2,

-1,
   371,  1,   440,  1,   555,  1,   880,  1,   371,  1,   440,  1,
   555,  1,   880,  1,   371,  1,   440,  1,   555,  1,   880,  1,
 32767,  2,
-1,
   371,  1,   440,  1,   555,  1,   880,  1,   371,  1,
   440,  1,   555,  1,   880,  1,   371,  1,   440,  1,   555,  1,
   880,  1,   371,  1,   440,  1,   555,  1,   880,  1,   371,  1,
   440,  1,   623,  1,   880,  1,   371,  1,   440,  1,   623,  1,
   880,  1,   371,  1,   440,  1,   623,  1,   880,  1,   371,  1,
   440,  1,   623,  1,   880,  1,
-1,
   330,  1,   494,  1,   659,  1,
   832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
   494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
   832,  1,
-1,
   247,  1,   494,  1,   623,  1,   741,  1,   247,  1,
   494,  1,   623,  1,   741,  1,   247,  1,   494,  1,   623,  1,
   741,  1,   247,  1,   494,  1,   623,  1,   741,  1,
-1,
   330,  1,
   494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
   832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
   494,  1,   659,  1,   832,  1,   278,  1,   440,  1,   659,  1,
   880,  1,   278,  1,   440,  1,   659,  1,   880,  1,   278,  1,
   440,  1,   659,  1,   880,  1,   278,  1,   440,  1,   659,  1,
   880,  1,
-1,
   208,  1,   416,  1,   659,  1,   988,  1,   208,  1,
   416,  1,   659,  1,   988,  1,   208,  1,   416,  1,   659,  1,
   988,  1,   208,  1,   416,  1,   659,  1,   988,  1,
-1,
   220,  1,
   371,  1,   659,  1,  1111,  1,   220,  1,   371,  1,   659,  1,
  1111,  1,   220,  1,   371,  1,   659,  1,  1111,  1,   220,  1,
   371,  1,   659,  1,  1111,  1,
-1,
   247,  1,   494,  1,   659,  1,
   832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
   494,  1,   659,  1,   832,  1,   247,  1,   494,  1,   659,  1,
   832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
   494,  1,   659,  1,   832,  1,   247,  1,   494,  1,   659,  1,
   832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
   440,  1,   623,  1,   741,  1,   247,  1,   440,  1,   623,  1,
   741,  1,   247,  1,   440,  1,   623,  1,   741,  1,   247,  1,
   440,  1,   623,  1,   741,  1,   247,  1,   440,  1,   623,  1,
   741,  1,   247,  1,   440,  1,   623,  1,   741,  1,   247,  1,
   440,  1,   623,  1,   741,  1,   659,  1, 32767,  0,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
   416,  1,   659,  1,   330,  1,   416,  1,   659,  1, 32767,  4,

-1,
   555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
   555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
   555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
   555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,

-1,
   494,  1,   587,  1,   741,  1,  1175,  1,   494,  1,   587,  1,
   832,  1,  1175,  1,   494,  1,   587,  1,   741,  1,  1175,  1,
   494,  1,   587,  1,   832,  1,  1175,  1,
-1,
   440,  1,   659,  1,
   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
   880,  1,  1111,  1,   494,  1,   587,  1,   880,  1,  1175,  1,
   494,  1,   587,  1,   880,  1,  1175,  1,   494,  1,   587,  1,
   880,  1,  1175,  1,   494,  1,   587,  1,   880,  1,  1175,  1,
   494,  1,   587,  1,   832,  1,  1175,  1,   494,  1,   587,  1,
   832,  1,  1175,  1,   494,  1,   587,  1,   832,  1,  1175,  1,
   494,  1,   587,  1,   832,  1,  1175,  1,
-1,
   440,  1,   659,  1,
   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
   880,  1,  1111,  1, 32767,  2,
-1,
   416,  1,   659,  1,   988,  1,
   416,  1,   659,  1,   988,  1,   416,  1,   659,  1,   988,  1,
   416,  1,   659,  1,   988,  1,
-1,
   440,  1,   659,  1,  1111,  1,
   440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
   440,  1,   659,  1,  1111,  1,
-1,
   371,  1,   555,  1,   741,  1,
   880,  1,   371,  1,   555,  1,   741,  1,   880,  1,   371,  1,
   555,  1,   741,  1,   880,  1,   371,  1,   555,  1,   741,  1,
   880,  1,
-1,
   294,  1,   587,  1,   741,  1,   988,  1,   294,  1,
   587,  1,   741,  1,   988,  1,   294,  1,   587,  1,   741,  1,
   988,  1,   294,  1,   587,  1,   741,  1,   988,  1,
-1,
   330,  1,
   494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
   832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
   494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
   832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
   440,  1,   659,  1,   741,  1,   330,  1,   440,  1,   659,  1,
   741,  1,   330,  1,   416,  1,   659,  1,   330,  1,   416,  1,
   659,  1,   330,  1,   416,  1,   659,  1, 32767,  2,
-1,
   555,  1,
   880,  1,   555,  1,   880,  1,   555,  1,   880,  1, 32767,  2,

-1,
   555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
   555,  1,   880,  1,
-1,
   494,  1,   832,  1,   494,  1,   832,  1,
   494,  1,   832,  1,   494,  1,   832,  1,
-1,
   555,  1,   880,  1,
   555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,

-1,
   587,  1,   988,  1,   587,  1,   988,  1,   587,  1,   988,  1,
   587,  1,   988,  1,   555,  1,   880,  1,   555,  1,   880,  1,
   555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
   555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,

-1,
   555,  1,   659,  1,   555,  1,   659,  1,   555,  1,   659,  1,
 32767,  2,
-1,
   440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  1111,  1,   440,  1,   659,  1,  1111,  1, 32767,  2,
-1,
   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
-1,
   416,  1,
   659,  1,   988,  1,   416,  1,   659,  1,   988,  1,   416,  1,
   659,  1,   988,  1,   416,  1,   659,  1,   988,  1,
-1,
   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
-1,
   494,  1,
   659,  1,  1175,  1,   494,  1,   659,  1,  1175,  1,   494,  1,
   659,  1,  1175,  1,   494,  1,   659,  1,  1175,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
-1,
   416,  1,
   659,  1,   988,  1,   416,  1,   659,  1,   988,  1,   416,  1,
   659,  1,   988,  1, 32767,  2,
-1,
   440,  1,   659,  1,   880,  1,
  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,
   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,
  1111,  1,
-1,
   494,  1,   659,  1,   832,  1,  1175,  1,   494,  1,
   659,  1,   832,  1,  1175,  1,   494,  1,   659,  1,   832,  1,
  1175,  1,   494,  1,   659,  1,   832,  1,  1175,  1,
-1,
   440,  1,
   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,
  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,
   659,  1,   880,  1,  1111,  1,
-1,
   416,  1,   494,  1,   659,  1,
   988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
   494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
   988,  1,
-1,
   371,  1,   494,  1,   659,  1,   880,  1,   371,  1,
   494,  1,   623,  1,   880,  1,   371,  1,   494,  1,   659,  1,
   880,  1,   371,  1,   494,  1,   623,  1,   880,  1,   330,  1,
   494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
   832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
   494,  1,   659,  1,   832,  1,   294,  1,   494,  1,   659,  1,
   832,  1,   294,  1,   494,  1,   659,  1,   832,  1,   294,  1,
   494,  1,   659,  1,   832,  1,   294,  1,   494,  1,   659,  1,
   832,  1,
-1,
   278,  1,   440,  1,   659,  1,   880,  1,   278,  1,
   440,  1,   659,  1,   880,  1,   278,  1,   440,  1,   659,  1,
   880,  1,   278,  1,   440,  1,   659,  1,   880,  1,   294,  1,
   440,  1,   741,  1,  1175,  1,   294,  1,   440,  1,   741,  1,
  1175,  1,   294,  1,   440,  1,   741,  1,  1175,  1,   294,  1,
   440,  1,   741,  1,  1175,  1,
-1,
   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
   416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
   988,  1,   330,  1,   416,  1,   659,  1,   988,  1,   330,  1,
   416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
   988,  1,   330,  1,   416,  1,   659,  1,   988,  1, 32767,  2,

-1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1, 32767,  1, 32767,  2,
-1,
   220,  1,   440,  1,
   555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
   220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
   555,  1,   880,  1,
-2};

#include <dos.h>
#include <bios.h>
#include <conio.h>

#define CGA  3
#define HERCULES 99

int ADAPTER = CGA   ;

void cursoroff(void)
{
   union REGS regs;

   regs.h.ah = 0x01;
   regs.x.cx = 0x2000;
   int86(0x10,&regs,&regs);
}


void cursoron(void)
{
   union REGS regs;

   regs.h.ah = 0x01;
   regs.x.cx = 0x0607;
   int86(0x10,&regs,&regs);
}


void cls(int BACK,int FRONT)
{
	union REGS reg;

	reg.h.ah = 6;
	reg.h.al = 0;
	reg.h.ch = 0;
	reg.h.cl = 0;
	reg.h.dh = 24;
	reg.h.dl = 79;
    reg.h.bh = (BACK << 4) + FRONT;
	int86(0x10, &reg, &reg);
}


void DMC(int Row, int Column, unsigned BYTE, int BACK, int FRONT, int QUANT)
{
    /*  DMA replacement for writechs function */

    unsigned segment= 0xB000, offset;
    int One_Too_Many = (QUANT+1);
    int i, Attribute;

    Attribute = (BACK << 4) + FRONT;

    if(ADAPTER!=HERCULES)segment = 0xB800;    /* CGA or Equivalent */
    offset = 160 * Row + 2 * Column ;
    for (i=1; i< One_Too_Many ; i++){
        poke(segment,offset, BYTE|Attribute<<8);
        offset+=2;
        }
}


void DMM(char *String, int Row, int Column, int BACK, int FRONT)
{
    /*  DMA replacement for puts
        centre justified string    */

    unsigned Character, segment=0xB000, offset;
    int Attribute;

    Attribute = (BACK << 4) + FRONT;

    Column =   ((Column+1)-(.5*(strlen(String))));

    if(ADAPTER != HERCULES)segment = 0xB800;    /* CGA or Equivalent */
    offset = 160 * Row + 2 * Column ;
    while ((Character = *String++)!=0){
        if(Character!='\n'){
        poke(segment,offset,Character|Attribute<<8);
        offset+=2;
        }
        }
}


void DML(char *String, int Row, int Column, int BACK, int FRONT)
{
    /*  DMA replacement for puts
        left justified string    */
    unsigned Character, segment=0xB000, offset;
    int Attribute;

    Attribute = (BACK << 4) + FRONT;

    if(ADAPTER!=HERCULES)segment = 0xB800; /* CGA or Equivalent */
    offset = 160 * Row + 2 * Column ;
    while ((Character = *String++)!=0){
        if(Character!='\n'){
        poke(segment,offset, Character|Attribute<<8);
        offset +=2;
        }
    }
}



void getadaptertype(void)
{
    if(((biosequip() >>4) &3) <3)ADAPTER=CGA;
    else ADAPTER=HERCULES;
}


char *thesong[]={
 "O come all ye faithful, joyful and triumphant",
 "O come ye, O come ye to Bethlehem",
 "Come and behold Him, born the King of Angels",
 "O come let us adore Him, O come let us adore Him",
 "O come let us adore Him, Christ the Lord."};

void letterthescreen()
{
       int back=0, front=4;
       int row=8,col=11;
       int i;

       for(i=0;i!=5;i++)
          {
           DML(thesong[i],row,col,back,front);
           row+=3;
           }

}


char *starofbethlehem[12]={
 "                                          º",
 "\"When they Saw the Star They Rejoiced  \\  º  /",
 " With Exceeding Great Joy.\"            \\\\\\Û///",
 "                                       \\\\ÛÛÛ//",
 "                              ÄÄÄÄÍÍÍÍÛÛÛÛÛÛÛÛÛÍÍÍÍÄÄÄÄ",
 "                                       //ÛÛÛ\\\\",
 "                                      ////Û\\\\\\\\",
 "                                      //  º  \\\\",
 "                                     //   º   \\\\",
 "                                    /     º     \\",
 "                                   /      º      \\",
 "                                          º"};

void matthew2verse10(void)
{
    int row,col=22;
    int i;
    int back=0, front=14;

    for(row=1;row!=13;row++)
        DML(starofbethlehem[row-1],row,col,back,front);

}



int ohcomeallyefaithful()
{
    int freq,duration,i=0,ctr=0;
    int front = 3,back =0;


    DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
        back,front,1);
    ctr++;
    freq=XMAS[i];
    do{
        if(kbhit())
            if(getch()==27)
               return -1;
        i++;
        if(freq==-1)
        {
         DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
             back,front,1);
             ctr++;
         DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
             back,front,1);
             ctr++;
             freq=XMAS[i];
             i++;
             }
             duration=XMAS[i];
             sound(freq,duration);
             i++;
             freq=XMAS[i];
            }while(freq!=-2);
     DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
        back,front,1);
return 0;
}

char *greetings[]=
{
 "MERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMAS",
 "and May the New Year bring you Peace and Prosperity"};

int drawtree()
{
    int quant = 1;
    int front = 2;
    int back  = 0;
    int row =5, col = 39;
    int i;

    if(ADAPTER==HERCULES)front=14;
    /* branches */
    for(i=0;i!=10;i++)
        {
         DMC(row,col,219,back,front,quant);
         row++;
         col--;
         quant+=2;
         }

         /* trunk */
         col=38;
         DMC(row,col,219,back,front,2);

                       front=14;
                       back= 0;
                       row = 19;
                       col = 39;

         /* greeting */
         DMM(greetings[0],row,col,back,front);
         row+=2;
         DMM(greetings[1],row,col,back,front);

}




main()
{
    getadaptertype();
    cursoroff();
    cls(0,14);
    matthew2verse10();
    letterthescreen();
    if(ohcomeallyefaithful()==0)
      {
       getch();
       cls(0,14);
       drawtree();
       getch();
       }
    cls(0,15);
    cursoron();
    exit(0);

}

