home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / other / xmas-etc.lzh / XMAS.C < prev    next >
Text File  |  1990-09-03  |  21KB  |  704 lines

  1. /* christmas.c by bill buckels 1990    */
  2. /* writing direct to screen            */
  3. /* using bios calls to set the adapter */
  4. /* compile using small memory model    */
  5. /* written in mix c (sound function required) */
  6.  
  7. /* a table of coordinates and ascii values for the bouncing notes */
  8. unsigned char stuffage[94][3]={
  9. 7,11,14,
  10. /* O */
  11. 7,13,14,
  12. 7,11,32,
  13. /* come */
  14. 7,18,14,
  15. 7,13,32,
  16. /* all */
  17. 7,22,14,
  18. 7,18,32,
  19. /* ye */
  20. 7,25,14,
  21. 7,22,32,
  22. /* faith- */
  23. /* ful */
  24. 7,25,32,
  25. 7,35,14,
  26. /* joy- */
  27. /* ful */
  28. 7,35,32,
  29. 7,42,14,
  30. /* and */
  31. 7,42,32,
  32. 7,46,14,
  33. /* tri- */
  34. /* um- */
  35. /* phant */
  36. 7,46,32,
  37. 10,11,14,
  38. /* o */
  39. 10,11,32,
  40. 10,13,14,
  41. /* come */
  42. 10,13,32,
  43. 10,18,14,
  44. /* ye */
  45. 10,18,32,
  46. 10,22,14,
  47. /* o */
  48. 10,22,32,
  49. 10,24,14,
  50. /* come */
  51. 10,24,32,
  52. 10,29,14,
  53. /* ye */
  54. 10,29,32,
  55. 10,32,14,
  56. /* to */
  57. 10,32,32,
  58. 10,35,14,
  59. /* beth- */
  60. /* le- */
  61. /* hem */
  62. 10,35,32,
  63. 13,11,14,
  64. /* come */
  65. 13,11,32,
  66. 13,16,14,
  67. /* and */
  68. 13,16,32,
  69. 13,20,14,
  70. /* be */
  71. /* hold */
  72. 13,20,32,
  73. 13,27,14,
  74. /* him */
  75. 13,27,32,
  76. 13,32,14,
  77. /* born */
  78. 13,32,32,
  79. 13,37,14,
  80. /* the */
  81. 13,37,32,
  82. 13,41,14,
  83. /* king */
  84. 13,41,32,
  85. 13,46,14,
  86. /* of */
  87. 13,46,32,
  88. 13,49,14,
  89. /* an- */
  90. /* gels */
  91. 13,49,32,
  92. 16,11,14,
  93. /* o */
  94. 16,11,32,
  95. 16,13,14,
  96. /* come */
  97. 16,13,32,
  98. 16,18,14,
  99. /* let */
  100. 16,18,32,
  101. 16,22,14,
  102. /* us */
  103. 16,22,32,
  104. 16,25,14,
  105. /* a- */
  106. /* dore */
  107. 16,25,32,
  108. 16,31,14,
  109. /* him */
  110. 16,31,32,
  111. 16,36,14,
  112. /* o */
  113. 16,36,32,
  114. 16,38,14,
  115. /* come */
  116. 16,38,32,
  117. 16,43,14,
  118. /* let */
  119. 16,43,32,
  120. 16,47,14,
  121. /* us */
  122. 16,47,32,
  123. 16,50,14,
  124. /* a- */
  125. /* dore */
  126. 16,50,32,
  127. 16,56,14,
  128. /* him */
  129. 16,56,32,
  130. 19,11,14,
  131. /* o */
  132. 19,11,32,
  133. 19,13,14,
  134. /* come */
  135. 19,13,32,
  136. 19,18,14,
  137. /* let */
  138. 19,18,32,
  139. 19,22,14,
  140. /* us */
  141. 19,22,32,
  142. 19,25,14,
  143. /* a- */
  144. /* dore */
  145. 19,25,32,
  146. 19,31,14,
  147. /* him */
  148. 19,31,32,
  149. 19,36,14,
  150. /* christ */
  151. 19,36,32,
  152. 19,43,14,
  153. /* the */
  154. 19,43,32,
  155. 19,47,14,
  156. /* lord */
  157. 19,47,32};
  158.  
  159.  
  160. /* a table of frequency and duration values for the song */
  161. /* with logical break insertions */
  162. /* array structure is frequency,duration */
  163. int XMAS[]={
  164.    440,  1,   555,  1,   659,  1,   880,  1,   440,  1,   555,  1,
  165.    659,  1,   880,  1,   440,  1,   555,  1,   659,  1,   880,  1,
  166.  32767,  2,
  167. -1,
  168.    440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
  169.    555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
  170.    880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
  171.    555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
  172.    880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
  173.    555,  1,   659,  1,   880,  1,
  174. -1,
  175.    440,  1,   555,  1,   659,  1,
  176.    440,  1,   555,  1,   659,  1,   440,  1,   555,  1,   659,  1,
  177.    440,  1,   555,  1,   659,  1,
  178. -1,
  179.    440,  1,   555,  1,   659,  1,
  180.    880,  1,   440,  1,   555,  1,   659,  1,   880,  1,   440,  1,
  181.    555,  1,   659,  1,   880,  1,   440,  1,   555,  1,   659,  1,
  182.    880,  1,
  183. -1,
  184.    416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
  185.    494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
  186.    988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
  187.    494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
  188.    988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
  189.    494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
  190.    416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
  191.    416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
  192.    416,  1,   494,  1,   659,  1,   416,  1,   494,  1,   659,  1,
  193.  32767,  2,
  194. -1,
  195.    440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  196.   1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  197.   1111,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
  198.    494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
  199.    988,  1,   416,  1,   494,  1,   659,  1,   988,  1,
  200. -1,
  201.    440,  1,
  202.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  203.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
  204. -1,
  205.    294,  1,
  206.    440,  1,   741,  1,  1175,  1,   294,  1,   440,  1,   741,  1,
  207.   1175,  1,   294,  1,   440,  1,   741,  1,  1175,  1,   294,  1,
  208.    440,  1,   741,  1,  1175,  1,   330,  1,   440,  1,   659,  1,
  209.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  210.    440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  211.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  212.    440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  213.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  214.    416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
  215.    988,  1,   330,  1,   416,  1,   659,  1,   988,  1, 32767,  2,
  216.  
  217. -1,
  218.    371,  1,   440,  1,   555,  1,   880,  1,   371,  1,   440,  1,
  219.    555,  1,   880,  1,   371,  1,   440,  1,   555,  1,   880,  1,
  220.  32767,  2,
  221. -1,
  222.    371,  1,   440,  1,   555,  1,   880,  1,   371,  1,
  223.    440,  1,   555,  1,   880,  1,   371,  1,   440,  1,   555,  1,
  224.    880,  1,   371,  1,   440,  1,   555,  1,   880,  1,   371,  1,
  225.    440,  1,   623,  1,   880,  1,   371,  1,   440,  1,   623,  1,
  226.    880,  1,   371,  1,   440,  1,   623,  1,   880,  1,   371,  1,
  227.    440,  1,   623,  1,   880,  1,
  228. -1,
  229.    330,  1,   494,  1,   659,  1,
  230.    832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
  231.    494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
  232.    832,  1,
  233. -1,
  234.    247,  1,   494,  1,   623,  1,   741,  1,   247,  1,
  235.    494,  1,   623,  1,   741,  1,   247,  1,   494,  1,   623,  1,
  236.    741,  1,   247,  1,   494,  1,   623,  1,   741,  1,
  237. -1,
  238.    330,  1,
  239.    494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
  240.    832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
  241.    494,  1,   659,  1,   832,  1,   278,  1,   440,  1,   659,  1,
  242.    880,  1,   278,  1,   440,  1,   659,  1,   880,  1,   278,  1,
  243.    440,  1,   659,  1,   880,  1,   278,  1,   440,  1,   659,  1,
  244.    880,  1,
  245. -1,
  246.    208,  1,   416,  1,   659,  1,   988,  1,   208,  1,
  247.    416,  1,   659,  1,   988,  1,   208,  1,   416,  1,   659,  1,
  248.    988,  1,   208,  1,   416,  1,   659,  1,   988,  1,
  249. -1,
  250.    220,  1,
  251.    371,  1,   659,  1,  1111,  1,   220,  1,   371,  1,   659,  1,
  252.   1111,  1,   220,  1,   371,  1,   659,  1,  1111,  1,   220,  1,
  253.    371,  1,   659,  1,  1111,  1,
  254. -1,
  255.    247,  1,   494,  1,   659,  1,
  256.    832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
  257.    494,  1,   659,  1,   832,  1,   247,  1,   494,  1,   659,  1,
  258.    832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
  259.    494,  1,   659,  1,   832,  1,   247,  1,   494,  1,   659,  1,
  260.    832,  1,   247,  1,   494,  1,   659,  1,   832,  1,   247,  1,
  261.    440,  1,   623,  1,   741,  1,   247,  1,   440,  1,   623,  1,
  262.    741,  1,   247,  1,   440,  1,   623,  1,   741,  1,   247,  1,
  263.    440,  1,   623,  1,   741,  1,   247,  1,   440,  1,   623,  1,
  264.    741,  1,   247,  1,   440,  1,   623,  1,   741,  1,   247,  1,
  265.    440,  1,   623,  1,   741,  1,   659,  1, 32767,  0,   330,  1,
  266.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  267.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  268.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  269.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  270.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  271.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1,   330,  1,
  272.    416,  1,   659,  1,   330,  1,   416,  1,   659,  1, 32767,  4,
  273.  
  274. -1,
  275.    555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
  276.    555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
  277.    555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
  278.    555,  1,   659,  1,  1318,  1,   555,  1,   659,  1,  1318,  1,
  279.  
  280. -1,
  281.    494,  1,   587,  1,   741,  1,  1175,  1,   494,  1,   587,  1,
  282.    832,  1,  1175,  1,   494,  1,   587,  1,   741,  1,  1175,  1,
  283.    494,  1,   587,  1,   832,  1,  1175,  1,
  284. -1,
  285.    440,  1,   659,  1,
  286.    880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
  287.    440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
  288.    880,  1,  1111,  1,   494,  1,   587,  1,   880,  1,  1175,  1,
  289.    494,  1,   587,  1,   880,  1,  1175,  1,   494,  1,   587,  1,
  290.    880,  1,  1175,  1,   494,  1,   587,  1,   880,  1,  1175,  1,
  291.    494,  1,   587,  1,   832,  1,  1175,  1,   494,  1,   587,  1,
  292.    832,  1,  1175,  1,   494,  1,   587,  1,   832,  1,  1175,  1,
  293.    494,  1,   587,  1,   832,  1,  1175,  1,
  294. -1,
  295.    440,  1,   659,  1,
  296.    880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
  297.    440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
  298.    880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,
  299.    440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,
  300.    880,  1,  1111,  1, 32767,  2,
  301. -1,
  302.    416,  1,   659,  1,   988,  1,
  303.    416,  1,   659,  1,   988,  1,   416,  1,   659,  1,   988,  1,
  304.    416,  1,   659,  1,   988,  1,
  305. -1,
  306.    440,  1,   659,  1,  1111,  1,
  307.    440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
  308.    440,  1,   659,  1,  1111,  1,
  309. -1,
  310.    371,  1,   555,  1,   741,  1,
  311.    880,  1,   371,  1,   555,  1,   741,  1,   880,  1,   371,  1,
  312.    555,  1,   741,  1,   880,  1,   371,  1,   555,  1,   741,  1,
  313.    880,  1,
  314. -1,
  315.    294,  1,   587,  1,   741,  1,   988,  1,   294,  1,
  316.    587,  1,   741,  1,   988,  1,   294,  1,   587,  1,   741,  1,
  317.    988,  1,   294,  1,   587,  1,   741,  1,   988,  1,
  318. -1,
  319.    330,  1,
  320.    494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
  321.    832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
  322.    494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
  323.    832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
  324.    440,  1,   659,  1,   741,  1,   330,  1,   440,  1,   659,  1,
  325.    741,  1,   330,  1,   416,  1,   659,  1,   330,  1,   416,  1,
  326.    659,  1,   330,  1,   416,  1,   659,  1, 32767,  2,
  327. -1,
  328.    555,  1,
  329.    880,  1,   555,  1,   880,  1,   555,  1,   880,  1, 32767,  2,
  330.  
  331. -1,
  332.    555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
  333.    555,  1,   880,  1,
  334. -1,
  335.    494,  1,   832,  1,   494,  1,   832,  1,
  336.    494,  1,   832,  1,   494,  1,   832,  1,
  337. -1,
  338.    555,  1,   880,  1,
  339.    555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
  340.  
  341. -1,
  342.    587,  1,   988,  1,   587,  1,   988,  1,   587,  1,   988,  1,
  343.    587,  1,   988,  1,   555,  1,   880,  1,   555,  1,   880,  1,
  344.    555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
  345.    555,  1,   880,  1,   555,  1,   880,  1,   555,  1,   880,  1,
  346.  
  347. -1,
  348.    555,  1,   659,  1,   555,  1,   659,  1,   555,  1,   659,  1,
  349.  32767,  2,
  350. -1,
  351.    440,  1,   659,  1,  1111,  1,   440,  1,   659,  1,
  352.   1111,  1,   440,  1,   659,  1,  1111,  1, 32767,  2,
  353. -1,
  354.    440,  1,
  355.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  356.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
  357. -1,
  358.    416,  1,
  359.    659,  1,   988,  1,   416,  1,   659,  1,   988,  1,   416,  1,
  360.    659,  1,   988,  1,   416,  1,   659,  1,   988,  1,
  361. -1,
  362.    440,  1,
  363.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  364.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
  365. -1,
  366.    494,  1,
  367.    659,  1,  1175,  1,   494,  1,   659,  1,  1175,  1,   494,  1,
  368.    659,  1,  1175,  1,   494,  1,   659,  1,  1175,  1,   440,  1,
  369.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  370.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  371.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,   440,  1,
  372.    659,  1,  1111,  1,   440,  1,   659,  1,  1111,  1,
  373. -1,
  374.    416,  1,
  375.    659,  1,   988,  1,   416,  1,   659,  1,   988,  1,   416,  1,
  376.    659,  1,   988,  1, 32767,  2,
  377. -1,
  378.    440,  1,   659,  1,   880,  1,
  379.   1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,
  380.    659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,
  381.   1111,  1,
  382. -1,
  383.    494,  1,   659,  1,   832,  1,  1175,  1,   494,  1,
  384.    659,  1,   832,  1,  1175,  1,   494,  1,   659,  1,   832,  1,
  385.   1175,  1,   494,  1,   659,  1,   832,  1,  1175,  1,
  386. -1,
  387.    440,  1,
  388.    659,  1,   880,  1,  1111,  1,   440,  1,   659,  1,   880,  1,
  389.   1111,  1,   440,  1,   659,  1,   880,  1,  1111,  1,   440,  1,
  390.    659,  1,   880,  1,  1111,  1,
  391. -1,
  392.    416,  1,   494,  1,   659,  1,
  393.    988,  1,   416,  1,   494,  1,   659,  1,   988,  1,   416,  1,
  394.    494,  1,   659,  1,   988,  1,   416,  1,   494,  1,   659,  1,
  395.    988,  1,
  396. -1,
  397.    371,  1,   494,  1,   659,  1,   880,  1,   371,  1,
  398.    494,  1,   623,  1,   880,  1,   371,  1,   494,  1,   659,  1,
  399.    880,  1,   371,  1,   494,  1,   623,  1,   880,  1,   330,  1,
  400.    494,  1,   659,  1,   832,  1,   330,  1,   494,  1,   659,  1,
  401.    832,  1,   330,  1,   494,  1,   659,  1,   832,  1,   330,  1,
  402.    494,  1,   659,  1,   832,  1,   294,  1,   494,  1,   659,  1,
  403.    832,  1,   294,  1,   494,  1,   659,  1,   832,  1,   294,  1,
  404.    494,  1,   659,  1,   832,  1,   294,  1,   494,  1,   659,  1,
  405.    832,  1,
  406. -1,
  407.    278,  1,   440,  1,   659,  1,   880,  1,   278,  1,
  408.    440,  1,   659,  1,   880,  1,   278,  1,   440,  1,   659,  1,
  409.    880,  1,   278,  1,   440,  1,   659,  1,   880,  1,   294,  1,
  410.    440,  1,   741,  1,  1175,  1,   294,  1,   440,  1,   741,  1,
  411.   1175,  1,   294,  1,   440,  1,   741,  1,  1175,  1,   294,  1,
  412.    440,  1,   741,  1,  1175,  1,
  413. -1,
  414.    330,  1,   440,  1,   659,  1,
  415.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  416.    440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  417.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  418.    440,  1,   659,  1,  1111,  1,   330,  1,   440,  1,   659,  1,
  419.   1111,  1,   330,  1,   440,  1,   659,  1,  1111,  1,   330,  1,
  420.    416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
  421.    988,  1,   330,  1,   416,  1,   659,  1,   988,  1,   330,  1,
  422.    416,  1,   659,  1,   988,  1,   330,  1,   416,  1,   659,  1,
  423.    988,  1,   330,  1,   416,  1,   659,  1,   988,  1, 32767,  2,
  424.  
  425. -1,
  426.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  427.    555,  1,   880,  1, 32767,  1, 32767,  2,
  428. -1,
  429.    220,  1,   440,  1,
  430.    555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
  431.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  432.    555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
  433.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  434.    555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
  435.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  436.    555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
  437.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  438.    555,  1,   880,  1,   220,  1,   440,  1,   555,  1,   880,  1,
  439.    220,  1,   440,  1,   555,  1,   880,  1,   220,  1,   440,  1,
  440.    555,  1,   880,  1,
  441. -2};
  442.  
  443. #include <dos.h>
  444. #include <bios.h>
  445. #include <conio.h>
  446.  
  447. #define CGA  3
  448. #define HERCULES 99
  449.  
  450. int ADAPTER = CGA   ;
  451.  
  452. void cursoroff(void)
  453. {
  454.    union REGS regs;
  455.  
  456.    regs.h.ah = 0x01;
  457.    regs.x.cx = 0x2000;
  458.    int86(0x10,®s,®s);
  459. }
  460.  
  461.  
  462. void cursoron(void)
  463. {
  464.    union REGS regs;
  465.  
  466.    regs.h.ah = 0x01;
  467.    regs.x.cx = 0x0607;
  468.    int86(0x10,®s,®s);
  469. }
  470.  
  471.  
  472. void cls(int BACK,int FRONT)
  473. {
  474.     union REGS reg;
  475.  
  476.     reg.h.ah = 6;
  477.     reg.h.al = 0;
  478.     reg.h.ch = 0;
  479.     reg.h.cl = 0;
  480.     reg.h.dh = 24;
  481.     reg.h.dl = 79;
  482.     reg.h.bh = (BACK << 4) + FRONT;
  483.     int86(0x10, ®, ®);
  484. }
  485.  
  486.  
  487. void DMC(int Row, int Column, unsigned BYTE, int BACK, int FRONT, int QUANT)
  488. {
  489.     /*  DMA replacement for writechs function */
  490.  
  491.     unsigned segment= 0xB000, offset;
  492.     int One_Too_Many = (QUANT+1);
  493.     int i, Attribute;
  494.  
  495.     Attribute = (BACK << 4) + FRONT;
  496.  
  497.     if(ADAPTER!=HERCULES)segment = 0xB800;    /* CGA or Equivalent */
  498.     offset = 160 * Row + 2 * Column ;
  499.     for (i=1; i< One_Too_Many ; i++){
  500.         poke(segment,offset, BYTE|Attribute<<8);
  501.         offset+=2;
  502.         }
  503. }
  504.  
  505.  
  506. void DMM(char *String, int Row, int Column, int BACK, int FRONT)
  507. {
  508.     /*  DMA replacement for puts
  509.         centre justified string    */
  510.  
  511.     unsigned Character, segment=0xB000, offset;
  512.     int Attribute;
  513.  
  514.     Attribute = (BACK << 4) + FRONT;
  515.  
  516.     Column =   ((Column+1)-(.5*(strlen(String))));
  517.  
  518.     if(ADAPTER != HERCULES)segment = 0xB800;    /* CGA or Equivalent */
  519.     offset = 160 * Row + 2 * Column ;
  520.     while ((Character = *String++)!=0){
  521.         if(Character!='\n'){
  522.         poke(segment,offset,Character|Attribute<<8);
  523.         offset+=2;
  524.         }
  525.         }
  526. }
  527.  
  528.  
  529. void DML(char *String, int Row, int Column, int BACK, int FRONT)
  530. {
  531.     /*  DMA replacement for puts
  532.         left justified string    */
  533.     unsigned Character, segment=0xB000, offset;
  534.     int Attribute;
  535.  
  536.     Attribute = (BACK << 4) + FRONT;
  537.  
  538.     if(ADAPTER!=HERCULES)segment = 0xB800; /* CGA or Equivalent */
  539.     offset = 160 * Row + 2 * Column ;
  540.     while ((Character = *String++)!=0){
  541.         if(Character!='\n'){
  542.         poke(segment,offset, Character|Attribute<<8);
  543.         offset +=2;
  544.         }
  545.     }
  546. }
  547.  
  548.  
  549.  
  550. void getadaptertype(void)
  551. {
  552.     if(((biosequip() >>4) &3) <3)ADAPTER=CGA;
  553.     else ADAPTER=HERCULES;
  554. }
  555.  
  556.  
  557. char *thesong[]={
  558.  "O come all ye faithful, joyful and triumphant",
  559.  "O come ye, O come ye to Bethlehem",
  560.  "Come and behold Him, born the King of Angels",
  561.  "O come let us adore Him, O come let us adore Him",
  562.  "O come let us adore Him, Christ the Lord."};
  563.  
  564. void letterthescreen()
  565. {
  566.        int back=0, front=4;
  567.        int row=8,col=11;
  568.        int i;
  569.  
  570.        for(i=0;i!=5;i++)
  571.           {
  572.            DML(thesong[i],row,col,back,front);
  573.            row+=3;
  574.            }
  575.  
  576. }
  577.  
  578.  
  579. char *starofbethlehem[12]={
  580.  "                                          ║",
  581.  "\"When they Saw the Star They Rejoiced  \\  ║  /",
  582.  " With Exceeding Great Joy.\"            \\\\\\█///",
  583.  "                                       \\\\███//",
  584.  "                              ────════█████████════────",
  585.  "                                       //███\\\\",
  586.  "                                      ////█\\\\\\\\",
  587.  "                                      //  ║  \\\\",
  588.  "                                     //   ║   \\\\",
  589.  "                                    /     ║     \\",
  590.  "                                   /      ║      \\",
  591.  "                                          ║"};
  592.  
  593. void matthew2verse10(void)
  594. {
  595.     int row,col=22;
  596.     int i;
  597.     int back=0, front=14;
  598.  
  599.     for(row=1;row!=13;row++)
  600.         DML(starofbethlehem[row-1],row,col,back,front);
  601.  
  602. }
  603.  
  604.  
  605.  
  606. int ohcomeallyefaithful()
  607. {
  608.     int freq,duration,i=0,ctr=0;
  609.     int front = 3,back =0;
  610.  
  611.  
  612.     DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
  613.         back,front,1);
  614.     ctr++;
  615.     freq=XMAS[i];
  616.     do{
  617.         if(kbhit())
  618.             if(getch()==27)
  619.                return -1;
  620.         i++;
  621.         if(freq==-1)
  622.         {
  623.          DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
  624.              back,front,1);
  625.              ctr++;
  626.          DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
  627.              back,front,1);
  628.              ctr++;
  629.              freq=XMAS[i];
  630.              i++;
  631.              }
  632.              duration=XMAS[i];
  633.              sound(freq,duration);
  634.              i++;
  635.              freq=XMAS[i];
  636.             }while(freq!=-2);
  637.      DMC(stuffage[ctr][0],stuffage[ctr][1],stuffage[ctr][2],
  638.         back,front,1);
  639. return 0;
  640. }
  641.  
  642. char *greetings[]=
  643. {
  644.  "MERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMASMERRYCHRISTMAS",
  645.  "and May the New Year bring you Peace and Prosperity"};
  646.  
  647. int drawtree()
  648. {
  649.     int quant = 1;
  650.     int front = 2;
  651.     int back  = 0;
  652.     int row =5, col = 39;
  653.     int i;
  654.  
  655.     if(ADAPTER==HERCULES)front=14;
  656.     /* branches */
  657.     for(i=0;i!=10;i++)
  658.         {
  659.          DMC(row,col,219,back,front,quant);
  660.          row++;
  661.          col--;
  662.          quant+=2;
  663.          }
  664.  
  665.          /* trunk */
  666.          col=38;
  667.          DMC(row,col,219,back,front,2);
  668.  
  669.                        front=14;
  670.                        back= 0;
  671.                        row = 19;
  672.                        col = 39;
  673.  
  674.          /* greeting */
  675.          DMM(greetings[0],row,col,back,front);
  676.          row+=2;
  677.          DMM(greetings[1],row,col,back,front);
  678.  
  679. }
  680.  
  681.  
  682.  
  683.  
  684. main()
  685. {
  686.     getadaptertype();
  687.     cursoroff();
  688.     cls(0,14);
  689.     matthew2verse10();
  690.     letterthescreen();
  691.     if(ohcomeallyefaithful()==0)
  692.       {
  693.        getch();
  694.        cls(0,14);
  695.        drawtree();
  696.        getch();
  697.        }
  698.     cls(0,15);
  699.     cursoron();
  700.     exit(0);
  701.  
  702. }
  703.  
  704.