home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 18 / CD_ASCQ_18_111294_W.iso / dos / prg / pas / gfxfx / stars.pas < prev    next >
Pascal/Delphi Source File  |  1994-04-21  |  18KB  |  369 lines

  1.  
  2. program _Stars;
  3. { First starroutine (paralax behind picture, by Bas van Gaalen, Holland, PD }
  4. uses
  5.   crt,dos;
  6.  
  7. const
  8.   NofStars = 50;
  9.   ZFactor = 200;
  10.   Xc = 160;
  11.   Yc = 100;
  12.  
  13.   Palette : array[0..$2ff] of byte = (
  14. 0,0,0,2,2,2,4,4,4,6,6,6,8,8,8,
  15. 10,10,10,12,12,12,14,14,14,16,16,16,18,18,18,20,
  16. 20,20,22,22,22,24,24,24,26,26,26,28,28,28,30,30,
  17. 30,33,33,33,35,35,35,37,37,37,39,39,39,41,41,41,
  18. 43,43,43,45,45,45,47,47,47,49,49,49,51,51,51,53,
  19. 53,53,55,55,55,57,57,57,59,59,59,61,61,61,63,63,
  20. 63,63,51,51,63,63,51,51,63,51,51,63,63,51,51,63,
  21. 63,51,63,63,39,39,63,51,39,63,63,39,51,63,39,39,
  22. 63,39,39,63,51,39,63,63,39,51,63,39,39,63,51,39,
  23. 63,63,39,63,63,39,51,63,27,27,63,39,27,63,51,27,
  24. 63,63,27,51,63,27,39,63,27,27,63,27,27,63,39,27,
  25. 63,51,27,63,63,27,51,63,27,39,63,27,27,63,39,27,
  26. 63,51,27,63,63,27,63,63,27,51,63,27,39,63,15,15,
  27. 63,27,15,63,39,15,63,51,15,63,63,15,51,63,15,39,
  28. 63,15,27,63,15,15,63,15,15,63,27,15,63,39,15,63,
  29. 51,15,63,63,15,51,63,15,39,63,15,27,63,15,15,63,
  30. 27,15,63,39,15,63,51,15,63,63,15,63,63,15,51,63,
  31. 15,39,63,15,27,63,3,15,63,3,3,63,15,3,63,27,
  32. 3,63,39,3,63,51,3,63,63,3,51,63,3,39,63,3,
  33. 27,63,3,15,63,3,3,63,3,3,63,15,3,63,27,3,
  34. 63,39,3,63,51,3,63,63,3,51,63,3,39,63,3,27,
  35. 63,3,15,63,3,3,63,15,3,63,27,3,63,39,3,63,
  36. 51,3,63,63,3,63,63,3,51,63,3,39,63,3,27,51,
  37. 3,15,51,3,3,51,15,3,51,27,3,51,39,3,51,51,
  38. 3,39,51,3,27,51,3,15,51,3,3,51,3,3,51,15,
  39. 3,51,27,3,51,39,3,51,51,3,39,51,3,27,51,3,
  40. 15,51,3,3,51,15,3,51,27,3,51,39,3,51,51,3,
  41. 51,51,3,39,51,3,27,39,3,15,39,3,3,39,15,3,
  42. 39,27,3,39,39,3,27,39,3,15,39,3,3,39,3,3,
  43. 39,15,3,39,27,3,39,39,3,27,39,3,15,39,3,3,
  44. 39,15,3,39,27,3,39,39,3,39,39,3,27,27,3,15,
  45. 27,3,3,27,15,3,27,27,3,15,27,3,3,27,3,3,
  46. 27,15,3,27,27,3,15,27,3,3,27,15,3,27,27,3,
  47. 27,15,3,3,15,15,3,3,15,3,3,15,15,3,3,15,
  48. 15,3,15,27,15,15,27,27,15,15,27,15,15,27,27,15,
  49. 15,27,27,15,27,39,15,15,39,27,15,39,39,15,27,39,
  50. 15,15,39,15,15,39,27,15,39,39,15,27,39,15,15,39,
  51. 27,15,39,39,15,39,39,15,27,51,15,15,51,27,15,51,
  52. 39,15,51,51,15,39,51,15,27,51,15,15,51,15,15,51,
  53. 27,15,51,39,15,51,51,15,39,51,15,27,51,15,15,51,
  54. 27,15,51,39,15,51,51,15,51,51,15,39,51,15,27,51,
  55. 27,27,51,39,27,51,51,27,39,51,27,27,51,27,27,51,
  56. 39,27,51,51,27,39,51,27,27,51,39,27,51,51,27,51,
  57. 51,27,39,51,39,39,51,51,39,39,51,39,39,51,51,39,
  58. 39,51,51,39,51,39,27,27,39,39,27,27,39,27,27,39,
  59. 39,27,27,39,39,27,39,3,3,3,15,15,15,27,27,27,
  60. 39,39,39,51,51,51,63,63,63,63,22,3,39,7,5,36,
  61. 36,63,0,0,0,22,22,22,38,38,38,52,52,52,63,0,0);
  62.  
  63.   Picture : array[0..102*32] of byte = (
  64. 0,0,0,0,242,242,2,180,180,180,180,180,180,180,180,180,
  65. 180,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
  66. 0,0,0,0,0,0,0,1,2,180,180,180,180,180,180,180,
  67. 180,180,180,242,0,0,0,0,0,0,0,0,0,0,0,0,
  68. 0,0,0,0,1,242,242,242,242,242,242,1,1,1,242,242,
  69. 242,242,242,180,180,173,173,173,173,173,159,159,159,159,159,180,
  70. 173,173,180,1,0,0,0,0,0,173,173,173,173,159,139,139,
  71. 139,139,139,139,139,139,159,173,180,180,242,242,242,242,1,0,
  72. 0,0,0,0,0,0,0,0,0,0,0,0,1,180,173,159,
  73. 139,139,138,138,159,139,139,139,159,173,242,0,0,0,1,1,
  74. 242,242,242,1,1,0,1,242,2,2,180,180,180,180,180,180,
  75. 180,180,180,173,173,173,173,173,173,173,173,159,159,138,138,138,
  76. 113,113,113,113,139,173,158,158,173,2,0,0,0,0,173,139,
  77. 139,138,138,138,112,112,112,112,112,112,112,112,138,159,159,173,
  78. 173,173,173,173,180,2,242,242,242,242,242,242,242,1,0,0,
  79. 1,242,180,159,138,112,112,112,112,112,138,112,112,112,139,173,
  80. 180,242,242,242,180,173,173,173,173,173,180,2,3,3,180,180,
  81. 179,173,173,173,173,173,173,173,159,139,139,137,139,138,138,139,
  82. 138,138,138,112,112,112,111,110,110,110,137,111,138,158,172,180,
  83. 1,0,0,180,159,112,112,112,112,112,111,138,138,138,138,138,
  84. 138,138,138,138,159,159,159,138,138,139,159,173,173,173,173,173,
  85. 173,173,173,173,180,180,173,173,159,139,112,111,138,138,138,138,
  86. 138,138,138,138,138,159,173,180,173,173,159,139,138,138,139,159,
  87. 173,180,4,180,173,172,172,158,159,159,158,137,139,139,139,111,
  88. 111,111,112,112,112,112,112,112,111,138,138,138,138,138,138,138,
  89. 138,138,138,138,158,180,2,1,0,180,139,112,111,138,138,138,
  90. 138,138,138,138,138,138,138,138,138,138,138,138,138,112,112,138,
  91. 138,159,138,138,138,138,138,138,139,159,173,173,159,139,138,138,
  92. 112,138,138,138,138,138,138,138,138,138,138,159,159,158,138,138,
  93. 138,112,112,112,138,139,173,173,173,159,158,158,138,138,138,159,
  94. 111,112,112,111,111,111,138,138,138,138,138,138,138,138,138,138,
  95. 138,138,138,138,138,138,138,138,138,138,158,172,180,242,0,180,
  96. 139,112,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  97. 138,138,138,138,138,138,138,138,138,112,112,112,112,112,138,138,
  98. 159,139,138,112,112,111,111,138,138,138,138,138,138,138,138,138,
  99. 138,138,111,111,111,111,111,111,138,138,138,138,159,159,158,138,
  100. 138,138,112,112,112,112,111,138,138,138,138,138,138,138,138,138,
  101. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  102. 138,158,172,180,1,180,139,112,138,138,138,138,138,138,138,138,
  103. 138,138,138,211,211,211,211,138,138,138,138,138,138,138,138,138,
  104. 138,138,138,138,138,138,138,159,111,111,138,138,138,138,138,138,
  105. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  106. 138,138,158,138,138,138,112,112,138,138,138,138,138,138,138,138,
  107. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  108. 138,138,138,138,138,138,138,138,158,180,2,180,139,112,138,138,
  109. 138,138,138,211,211,211,211,211,225,46,46,46,62,212,138,138,
  110. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,111,138,
  111. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  112. 138,138,138,138,138,138,138,138,138,112,112,112,112,138,138,138,
  113. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  114. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,158,172,
  115. 180,180,159,138,138,138,138,138,211,46,46,46,46,46,45,36,
  116. 46,250,62,212,138,138,138,138,138,138,138,138,138,138,138,138,
  117. 138,138,138,138,138,138,211,211,211,211,138,138,138,138,211,211,
  118. 211,211,211,211,138,138,138,138,138,138,138,138,138,138,138,138,
  119. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  120. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  121. 138,138,138,138,138,158,172,1,180,173,159,158,138,138,225,36,
  122. 46,46,46,46,46,250,62,62,84,138,138,138,211,211,138,138,
  123. 138,138,138,138,211,138,138,138,138,138,226,46,46,46,46,250,
  124. 211,138,138,211,46,46,46,46,46,226,212,138,138,138,138,138,
  125. 211,211,138,138,138,138,138,138,138,138,138,211,211,211,211,211,
  126. 211,138,138,138,138,138,138,138,138,138,138,138,211,211,138,138,
  127. 211,211,211,211,211,211,211,138,138,138,138,158,172,0,242,180,
  128. 173,158,137,211,61,46,250,62,62,62,62,62,62,212,138,138,
  129. 138,211,46,250,211,138,138,138,138,211,226,211,138,138,138,226,
  130. 45,36,46,250,250,250,62,212,138,211,46,46,46,250,62,212,
  131. 138,138,138,138,138,226,46,46,46,46,46,250,211,138,138,211,
  132. 225,46,46,46,46,46,250,211,211,138,138,138,138,138,211,211,
  133. 211,225,46,250,212,211,46,46,46,46,46,46,61,212,138,138,
  134. 138,158,172,0,2,173,159,138,111,137,211,250,250,62,212,212,
  135. 212,212,138,138,138,138,138,211,46,46,62,138,138,138,138,226,
  136. 225,212,138,138,211,46,36,250,62,212,212,62,62,62,138,211,
  137. 46,46,250,62,212,138,138,138,138,138,226,45,36,46,250,250,
  138. 250,250,62,138,212,225,46,36,46,46,46,46,250,250,61,211,
  139. 138,138,138,226,46,46,46,45,36,250,212,226,36,46,250,62,
  140. 250,250,250,211,138,138,138,158,179,1,180,159,138,111,111,137,
  141. 226,46,46,62,212,138,138,138,138,138,137,138,138,211,250,250,
  142. 62,212,138,138,211,225,226,138,138,138,225,36,46,62,212,138,
  143. 138,211,250,62,212,211,46,46,250,62,138,138,137,138,138,211,
  144. 46,36,250,84,212,212,62,250,62,212,138,211,46,250,62,62,
  145. 62,62,62,250,250,62,212,138,211,46,36,46,46,46,250,62,
  146. 211,46,36,62,212,138,212,62,62,62,138,138,138,158,179,242,
  147. 173,139,112,111,138,211,46,36,250,62,211,211,211,137,138,138,
  148. 138,138,138,138,211,62,62,62,211,137,225,46,211,138,138,211,
  149. 61,46,62,212,138,138,137,211,46,250,212,211,46,46,62,212,
  150. 138,138,138,138,138,225,36,250,212,138,138,138,211,62,62,211,
  151. 138,211,46,250,212,212,212,212,211,62,250,250,62,138,211,46,
  152. 46,62,62,62,62,84,211,250,250,84,138,138,137,211,62,62,
  153. 212,138,138,158,179,2,173,138,112,138,138,211,46,46,250,250,
  154. 250,46,61,212,138,138,138,138,138,138,138,212,62,62,62,62,
  155. 46,46,212,138,138,138,211,250,62,212,138,137,138,211,46,62,
  156. 212,211,45,46,62,212,138,137,138,138,211,46,45,62,138,138,
  157. 138,137,138,211,250,62,137,211,46,250,212,138,138,138,138,211,
  158. 250,46,62,212,211,46,250,212,212,212,212,138,211,250,62,212,
  159. 138,137,211,211,61,62,212,138,138,158,172,180,159,138,112,138,
  160. 138,211,46,46,250,250,250,250,62,212,138,138,138,138,138,138,
  161. 138,138,211,62,250,46,46,226,138,138,138,138,211,46,62,212,
  162. 138,138,138,225,45,62,138,211,45,46,62,212,138,138,138,138,
  163. 211,46,250,212,138,138,138,138,138,211,46,250,212,211,46,250,
  164. 62,137,138,138,137,225,46,46,62,138,211,46,250,212,138,138,
  165. 138,138,211,46,62,212,137,225,45,46,46,62,212,138,138,158,
  166. 172,173,138,112,111,138,138,211,46,46,250,62,212,212,138,138,
  167. 138,138,138,138,138,138,138,226,46,46,46,46,250,211,211,137,
  168. 138,138,211,46,250,211,211,211,225,45,45,62,138,211,45,46,
  169. 62,212,138,138,138,138,211,46,62,138,138,137,138,138,138,211,
  170. 46,62,212,211,46,46,62,212,138,138,226,45,36,62,212,138,
  171. 225,45,250,62,211,211,137,138,211,46,250,62,61,45,36,46,
  172. 62,212,138,138,138,158,172,173,138,111,138,138,138,226,46,250,
  173. 250,62,212,138,138,138,137,211,211,138,138,211,225,45,36,46,
  174. 250,62,62,250,61,211,138,138,211,46,250,62,46,46,46,46,
  175. 62,212,138,211,45,46,62,212,138,138,138,138,211,46,62,138,
  176. 138,138,138,138,138,211,46,62,138,211,45,46,62,211,138,211,
  177. 46,36,250,84,138,211,45,36,250,250,250,61,211,138,211,46,
  178. 46,250,46,45,46,62,84,138,138,137,138,158,172,173,138,138,
  179. 138,138,226,45,45,250,250,62,211,137,137,211,225,46,250,212,
  180. 211,46,36,36,46,250,62,212,212,62,250,62,212,138,211,46,
  181. 46,250,250,62,62,212,212,138,138,210,46,46,62,212,138,138,
  182. 138,138,211,46,250,211,211,138,138,138,138,211,46,62,138,211,
  183. 45,46,250,62,211,225,36,46,62,212,138,211,46,46,62,62,
  184. 62,62,211,138,211,46,46,250,250,250,250,62,62,211,211,211,
  185. 211,158,158,173,158,138,138,211,61,45,46,250,250,250,62,211,
  186. 225,46,36,36,250,212,211,45,46,250,62,62,62,138,138,211,
  187. 250,250,62,138,211,46,46,62,212,212,138,138,138,138,137,225,
  188. 45,46,62,212,138,138,138,138,211,46,250,62,61,211,138,138,
  189. 138,211,46,62,138,211,45,46,250,250,250,46,45,62,84,138,
  190. 138,137,211,250,62,212,212,212,138,138,211,46,46,250,62,62,
  191. 250,250,250,62,61,61,226,196,158,173,159,138,138,211,61,46,
  192. 250,250,250,250,250,250,46,36,46,250,62,212,225,45,46,250,
  193. 62,212,138,138,138,211,46,46,62,138,211,46,46,62,212,138,
  194. 138,138,137,137,226,45,36,250,62,211,211,211,211,211,211,46,
  195. 46,250,250,211,211,211,211,226,46,62,138,211,45,46,250,250,
  196. 250,250,62,62,62,211,137,138,211,46,62,212,138,138,138,138,
  197. 211,46,46,62,212,212,61,250,250,250,250,250,211,196,172,180,
  198. 159,139,138,211,225,250,62,62,62,250,250,46,46,250,250,250,
  199. 62,211,61,45,250,62,62,138,138,138,138,211,46,250,212,138,
  200. 225,45,46,62,212,138,138,138,138,211,46,36,46,250,250,250,
  201. 46,46,250,62,62,250,250,250,250,250,46,46,250,61,46,62,
  202. 212,225,45,46,250,62,212,212,211,250,250,62,211,138,211,46,
  203. 250,211,211,211,137,138,211,46,46,62,212,138,211,62,250,250,
  204. 250,62,212,172,1,180,159,138,138,138,211,211,212,212,211,62,
  205. 62,62,250,250,250,250,62,212,211,62,62,212,138,138,138,138,
  206. 138,211,61,62,138,211,45,36,250,62,211,138,138,138,138,225,
  207. 36,46,250,250,250,46,46,46,250,250,62,83,62,250,250,46,
  208. 46,46,250,250,46,62,211,46,36,250,62,212,138,138,211,61,
  209. 250,250,62,211,211,250,250,62,46,250,211,211,226,46,46,62,
  210. 212,138,138,211,250,46,250,83,138,172,1,180,139,112,111,138,
  211. 138,138,138,138,138,137,212,211,62,62,62,62,212,138,138,138,
  212. 138,138,138,138,138,138,138,138,212,212,138,225,36,46,250,250,
  213. 62,137,138,138,211,225,46,62,62,62,62,62,250,250,250,250,
  214. 62,212,212,62,250,250,250,250,250,250,250,83,211,250,46,250,
  215. 62,212,138,137,137,211,250,250,250,62,212,211,62,62,46,250,
  216. 250,62,226,61,250,62,211,138,138,211,61,62,62,212,158,172,
  217. 180,180,139,112,138,138,138,138,138,138,138,138,138,138,137,212,
  218. 212,138,138,138,137,138,138,138,137,138,138,138,138,138,138,138,
  219. 211,225,46,62,62,62,62,138,138,138,138,211,211,212,212,212,
  220. 212,211,62,250,250,62,212,138,138,211,62,62,62,62,62,62,
  221. 62,212,138,211,62,62,62,211,211,137,138,212,62,250,250,62,
  222. 212,138,138,212,62,62,250,62,211,212,211,62,211,138,138,138,
  223. 211,212,138,138,138,158,180,180,139,112,138,138,138,138,138,138,
  224. 138,138,138,138,138,138,138,138,138,137,138,138,138,138,138,138,
  225. 138,138,138,138,138,138,138,211,211,212,212,212,138,138,138,138,
  226. 138,138,138,138,138,138,138,138,211,62,62,62,138,138,137,138,
  227. 138,212,212,212,212,212,138,138,138,138,211,62,62,62,226,212,
  228. 138,138,211,62,250,62,212,138,138,138,138,211,62,62,138,138,
  229. 138,138,138,138,138,138,138,138,138,138,138,158,180,180,139,112,
  230. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  231. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  232. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  233. 212,138,138,138,138,138,138,138,138,138,138,138,138,138,137,138,
  234. 138,138,212,212,212,138,138,138,138,211,62,62,138,138,138,138,
  235. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  236. 138,158,179,180,139,112,138,138,138,138,138,138,138,138,138,138,
  237. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  238. 138,138,138,138,138,158,158,159,159,159,138,138,138,138,138,138,
  239. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  240. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  241. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  242. 138,138,138,138,138,138,138,158,172,180,159,139,138,138,138,138,
  243. 138,138,138,138,138,138,138,138,138,158,158,172,159,159,138,138,
  244. 138,138,138,138,138,138,138,138,138,159,173,180,180,180,180,173,
  245. 159,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  246. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  247. 138,138,138,138,138,138,139,139,138,138,138,138,138,138,138,138,
  248. 138,138,138,138,138,138,138,138,138,158,159,159,159,159,173,242,
  249. 173,173,159,159,159,138,138,138,138,159,159,159,158,158,172,172,
  250. 179,180,180,173,159,159,159,159,159,159,158,159,159,159,173,180,
  251. 180,242,1,0,1,180,173,159,138,138,138,138,138,138,138,138,
  252. 138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,
  253. 138,138,138,138,138,138,159,159,159,159,159,173,173,173,159,159,
  254. 158,159,159,159,158,159,159,159,158,158,138,138,138,158,159,173,
  255. 180,180,180,180,180,0,242,180,180,180,173,159,159,159,173,173,
  256. 180,180,180,180,180,2,1,0,1,180,180,180,180,180,180,180,
  257. 180,180,180,180,180,242,1,0,0,0,0,242,180,173,159,159,
  258. 159,159,159,158,158,158,158,158,158,158,158,158,158,158,138,138,
  259. 138,138,138,138,138,138,158,158,158,158,159,173,180,180,180,180,
  260. 180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,172,
  261. 158,159,159,173,180,180,2,2,2,2,2,0,0,1,1,1,
  262. 180,180,180,180,180,2,242,0,0,0,0,0,0,0,0,1,
  263. 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  264. 0,0,242,180,180,180,180,180,180,180,180,180,180,180,180,180,
  265. 180,180,180,173,173,173,173,173,173,173,173,173,173,180,180,180,
  266. 180,180,242,1,0,0,0,0,0,0,0,0,0,0,0,0,
  267. 0,0,1,242,180,180,180,180,180,180,2,242,1,1,1,1,1);
  268.  
  269. type
  270.   StarRec = record
  271.               X,Y,Z : integer;
  272.             end;
  273.   StarPos = array[0..NofStars] of StarRec;
  274.   StarSpd = array[0..NofStars] of word;
  275.  
  276. var
  277.   Stars : StarPos;
  278.   Speed : StarSpd;
  279.  
  280. {----------------------------------------------------------------------------}
  281.  
  282. procedure SetGraphics(Mode : byte); assembler;
  283. asm mov AH,0; mov AL,Mode; int 10h; end;
  284.  
  285. {----------------------------------------------------------------------------}
  286.  
  287. procedure Init;
  288.  
  289. var
  290.   Regs : registers;
  291.   C : word;
  292.   I,X,Y : byte;
  293.  
  294. begin
  295.   randomize;                                              { Initialize stars }
  296.   for I := 0 to NofStars do begin
  297.     Stars[I].X := random(100)-50;
  298.     Stars[I].Y := random(100)-50;
  299.     Stars[I].Z := random(900)+200;
  300.     Speed[I] := 0;
  301.   end;
  302.  
  303.   C := 0;                                                      { Set palette }
  304.   for I := 0 to $ff do begin
  305.     port[$3C8] := I;
  306.     port[$3C9] := Palette[C];
  307.     port[$3C9] := Palette[C+1];
  308.     port[$3C9] := Palette[C+2];
  309.     inc(C,3);
  310.   end;
  311.  
  312.   for X := 1 to 102 do                               { Put picture on screen }
  313.     for Y := 0 to 31 do
  314.       mem[$a000:(Y+160)*320+X+10] := Picture[Y*102+X];
  315. end;
  316.  
  317. {----------------------------------------------------------------------------}
  318.  
  319. procedure DoStars;
  320.  
  321. var
  322.   X,Y : integer;
  323.   I,Color : byte;
  324.  
  325. procedure NewStar(Num : byte);
  326.  
  327. var
  328.   X,Y : integer;
  329.  
  330. begin
  331.   X := Xc+round(Stars[Num].X*Stars[Num].Z/ZFactor);
  332.   Y := Yc+round(Stars[Num].Y*Stars[Num].Z/ZFactor);
  333.   if (X > 0) and (X < 320) and (Y > 0) and (Y < 200) then
  334.     mem[$a000:Y*320+X] := 0;
  335.   Stars[Num].X := random(100)-50;
  336.   Stars[Num].Y := random(100)-50;
  337.   Stars[Num].Z := random(100)+200;
  338. end;
  339.  
  340. begin
  341.   repeat
  342.     while (port[$3da] and 8) <> 8 do;
  343.     while (port[$3da] and 8) = 8 do;
  344.     for I := 0 to NofStars do begin                                  { Stars }
  345.       X := Xc+round(Stars[I].X*Stars[I].Z/ZFactor);
  346.       Y := Yc+round(Stars[I].Y*Stars[I].Z/ZFactor);
  347.       if mem[$a000:Y*320+X] <= 31 then mem[$a000:Y*320+X] := 0;
  348.       X := Xc+round(Stars[I].X*(Stars[I].Z+Speed[I])/ZFactor);
  349.       Y := Yc+round(Stars[I].Y*(Stars[I].Z+Speed[I])/ZFactor);
  350.       if (X > 0) and (X < 320) and (Y > 0) and (Y < 200) then begin
  351.         Color := 6+(Stars[I].Z div 150);
  352.         if Color > 31 then Color := 31;
  353.         if mem[$a000:Y*320+X] = 0 then mem[$a000:Y*320+X] := Color;
  354.       end else NewStar(I);
  355.       inc(Stars[I].Z,Speed[I]); if Stars[I].Z > 20000 then NewStar(I);
  356.       Speed[I] := (Stars[I].Z div 150)*(5-(abs(Stars[I].X*Stars[I].Y) div 500));
  357.     end;
  358.   until keypressed;
  359. end;
  360.  
  361. {----------------------------------------------------------------------------}
  362.  
  363. begin
  364.   SetGraphics($13);
  365.   Init;
  366.   DoStars;
  367.   textmode(lastmode);
  368. end.
  369.