?login_element?

Subversion Repositories NedoOS

Rev

Rev 50 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //// song = 18 positions
  2.  
  3. //// imported
  4. PROC halt FORWARD();
  5. PROC border FORWARD(BYTE col);
  6. FUNC BYTE random FORWARD();
  7.  
  8. PROC pokenet FORWARD(BYTE row, BYTE col, BYTE data);
  9. FUNC BYTE peeknet FORWARD(BYTE row, BYTE col);
  10. PROC pokenetcolor FORWARD(BYTE row, BYTE col, BYTE data);
  11. FUNC BYTE peeknetcolor FORWARD(BYTE row, BYTE col);
  12. PROC testcube FORWARD();
  13. PROC cubecolumn FORWARD();
  14. FUNC BYTE getayreg FORWARD(BYTE reg);
  15. PROC decay FORWARD();
  16. PROC clearnet FORWARD();
  17. PROC drawcubetexture FORWARD();
  18. PROC jumpay FORWARD(BYTE tonereg, BYTE volreg, BYTE mask);
  19.  
  20. PROC prch FORWARD(UINT addr, CHAR c);
  21.  
  22. EXTERN UINT _timer;
  23.  
  24. ////
  25.  
  26. VAR UINT _wastimer;
  27. VAR UINT _curtimer;
  28. VAR UINT _logicframes;
  29. VAR UINT _textlogicframes;
  30.  
  31. VAR BOOL _frameready;
  32.  
  33. CONST BYTE _wid = 0x20;
  34. CONST BYTE _hgt = 0x18;
  35. CONST BYTE _scrhgt = 0x14;
  36.  
  37. CONST BYTE _netwid = 0x20;
  38. CONST BYTE _nethgt = 0x20;
  39.  
  40. VAR PBYTE _net;
  41. CONST BYTE _net35[768];
  42. CONST BYTE _nettort[768];
  43. /**= {
  44. 0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,B-L,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
  45. 0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,LLL,0x4,BBB,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,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0x6,0x6,0x6,0x6,0x6,0x6,0x4,0x6,0x6,0x6,0x4,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
  62. 0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x4,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
  63. 0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x4,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
  64. 0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
  65. 0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
  66. 0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
  67. 0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6
  68. };
  69. */
  70. CONST UINT _netaddr = 0xd000; //запорчено ещё 256 байт ниже
  71. //CONST UINT _net2addr = 0xd040;
  72. CONST UINT _netcoloraddr = 0xd080;
  73. CONST UINT _attrbuf = 0xf000;
  74. CONST UINT _attrbuf2 = 0xf300;
  75.  
  76. VAR UINT _curattrbuf;
  77. VAR UINT _readyattrbuf;
  78.  
  79. CONST BYTE _clBlue = 0x01;
  80. CONST BYTE _clRed = 0x05;
  81.  
  82. VAR UINT _position;
  83. VAR UINT _tact;
  84. VAR UINT _quarter;
  85. VAR BYTE _noteintact;
  86. VAR BYTE _noteinquarter;
  87.  
  88. VAR BYTE _jump;
  89. VAR BYTE _jumptime;
  90. VAR BYTE _row;
  91. VAR BYTE _picrow;
  92. VAR BYTE _col;
  93. //VAR BYTE _curhgt;
  94. //VAR BOOL _backslash;
  95. //VAR BOOL _rowstep;
  96. //VAR BYTE _curcolor;
  97. //VAR BYTE _oldcolor;
  98. //VAR BYTE _y;
  99. VAR UINT _addr;
  100.  
  101. VAR BYTE _stage;
  102. VAR BYTE _wasstage;
  103.  
  104. VAR BYTE _dotext;
  105.  
  106. CONST PCHAR _text =
  107. "It's a boy!!!                   "
  108. "                       Ho-ho!   "
  109. "        Hello, LVD!             "
  110. "                                "
  111.  
  112. "   |   |   |   |   |   |   |   |"
  113. "   |   |   |   |   |   |   |   |"
  114. "   |   |   |   |   |   |   |   |"
  115. "   |   |   |   |   |   |   |   |"
  116.  
  117. " ALONE CODER, SAND, NQ & others "
  118. "       WISH U ALL DA BEST!      "
  119. "    b  happy, don't  worry      "
  120. "          und HBD!!             "
  121.  
  122. "   |   |   |   |   |   |   |   |"
  123. "   |   |   |   |   |   |   |   |"
  124. "   |   |   |   |   |   |   |   |"
  125. "   |   |   |   |   |   |   |   |"
  126.  
  127. " This iz the first demo made in "
  128. "            NedoLang            "
  129. "da  programming  system         "
  130. "            of  da  future ;)   "
  131.  
  132. "   |   |   |   |   |   |   |   |"
  133. "   |   |   |   |   |   |   |   |"
  134. "   |   |   |   |   |   |   |   |"
  135. "   |   |   |   |   |   |   |   |"
  136.  
  137. "        okay                    "
  138. "    some     wishes             "
  139. "          right       now       "
  140. "                 !!!            "
  141.  
  142. "   |   |   |   |   |   |   |   |"
  143. "   |   |   |   |   |   |   |   |"
  144. "   |   |   |   |   |   |   |   |"
  145. "   |   |   |   |   |   |   |   |"
  146.  
  147. "SAND/MAYhEM:\n"
  148. "Ну что!  С  Днюшечкой,   Бро!!! "
  149. "Ты  стал   уже  совсем  большой "
  150. " и сам знаешь,  что тебе нужно! "
  151.  
  152. " Вот именно этого тебе и желаю!!"
  153. "А от себя  лично  пожелаю  тебе "
  154. "стандартный  набор   из счастья,"
  155. "успехов, здоровья и, конечно же,"
  156.  
  157. " какую-нибудь дельную хрень типа"
  158. "лазерного   мешка    или  робота"
  159. "   |   | на  батарейках,  |   | "
  160. " | чтоб  пиликал  и   катался!  "
  161.  
  162. "   |   |   |   |   |   |   |   |"
  163. "   |   |   |   |   |   |   |   |"
  164. "   |   |   |   |   |   |   |   |"
  165. "   |   |   |   |   |   |   |   |"
  166.  
  167. "NQ/SKRJU:                       "
  168. "Вадя,   пишу  тебе  из  вот этих"
  169. "своих  жарких  югов  в эту  твою"
  170. "Москву!  Тебе   и твоим близким,"
  171.  
  172. "чтобы  хорошо  было  и  все друг"
  173. "другу  улыбались  и  радовались,"
  174. "потому  что  хорошие люди вокруг"
  175. "и  ничего  не  болит ни  у кого,"
  176.  
  177. "а один  лишь достаток и радость,"
  178. "  | вот  такая |   |   |   |   |"
  179. "           прошивка-установка!  "
  180. "  |   ! ! !|   |   |   |   |   |"
  181.  
  182. "   |   |   |   |   |   |   |   |"
  183. "   |   |   |   |   |   |   |   |"
  184. "   |   |   |   |   |   |   |   |"
  185. "   |   |   |   |   |   |   |   |"
  186.  
  187. "ALONE CODER/Conscience:         "
  188. "   Желаю,    чтобы    схемы     "
  189. "всегда  разводились  с  первой  "
  190. "             попытки,           "
  191.  
  192. "cигналы всегда успевали вовремя,"
  193. "эффекты кодились  самые быстрые,"
  194. "а  пакер  паковал  круче  всех! "
  195. "   |   |   |   | ...            "
  196.  
  197. "    ...            И на всё это "
  198. "хватало времени до, после       "
  199. "              и вместо работы :)"
  200. "     ! ! !                      "
  201.  
  202. "   |   |   |   |   |   |   |   |"
  203. "   |   |   |   |   |   |   |   |"
  204. "   |   |   |   |   |   |   |   |"
  205. "   |   |   |   |   |   |   |   |"
  206.  
  207. "LOUISA/Conscience:              "
  208. "Поздравляю тебя с днём рождения,"
  209. "     наш   дорогой   LVD!    :) "
  210. "  Всего самого расчудесного  и  "
  211.  
  212. " привлекательного!   Счастья,   "
  213. "     здоровья и всего того, что "
  214. "пожелаешь  сам!  Достатка       "
  215. "    финансов, творческих идей   "
  216.  
  217. "и  времени  на  их  исполнение! "
  218. "Ах да, карапузиков в твой дом!:)"
  219. "                 Ура!           "
  220. "           ! ! !                "
  221.  
  222. "   |   |   |   |   |   |   |   |"
  223. "   |   |   |   |   |   |   |   |"
  224. "   |   |   |   |   |   |   |   |"
  225. "   |   |   |   |   |   |   |   |"
  226.  
  227. "HIPPIMAN/Conscience:            "
  228. " Я тоже  хочу  присоединиться  к"
  229. "   всеобщим    поздравлениям.   "
  230. " Не, ну  а  как  не  поздравить "
  231.  
  232. " человека, который  даровал миру"
  233. " |   |   | BASECONF!  |   |   | "
  234. " Вадим,   всяческих благ  тебе, "
  235. "  здоровья  и  побольше денег.  "
  236.  
  237. "Денег столько, чтобы у тебя было"
  238. " побольше свободного  времени и "
  239. "ты мог посвятить  его творчеству"
  240. "и  новым  разработкам,  которыми"
  241.  
  242. " |   радовал  бы  уже  нас,|   |"
  243. " | простых любителей Спекки :)  "
  244. " |   |   |  ! ! ! |   |   |   | "
  245. "   |   |   |   |   |   |   |   |"
  246.  
  247. "   |   |   |   |   |   |   |   |"
  248. "   |   |   |   |   |   |   |   |"
  249. "   |   |   |   |   |   |   |   |"
  250. "   |   |   |   |   |   |   |   |"
  251.  
  252. "FYREX/MhM:                      "
  253. "        Всего наилучшего!       "
  254. "   И поддерживай отечественную  "
  255. "          демосцену ! )         "
  256.  
  257. "   |   |   |   |   |   |   |   |"
  258. "   |   |   |   |   |   |   |   |"
  259. "   |   |   |   |   |   |   |   |"
  260. "   |   |   |   |   |   |   |   |"
  261.  
  262. "DIMON\"ШМЕЛЕ\"MEDVED-ER:          "
  263. "Сколково, инновации... руссиано "
  264. "            ...                 "
  265. "      НAHOтехнологии, знаете ли!"
  266.  
  267. "   |   |   |   |   |   |   |   |"
  268. "   |   |   |   |   |   |   |   |"
  269. "   |   |   |   |   |   |   |   |"
  270. "   |   |   |   |   |   |   |   |"
  271.  
  272. "-HBD---#-----#---#--###---------"
  273. "-------#-----#---#--#--#--------"
  274. "-------#------#-#---#---#-------"
  275. "-------#####---#----####----!!!-"
  276.  
  277. "   |   |   |   |   |   |   |   |"
  278. "   |   |   |   |   |   |   |   |"
  279. "   |   |   |   |   |   |   |   |"
  280. "   |   |   |   |   |   |   |   |"
  281.  
  282. "idea .... ALONE CODER & SAND/MhM"
  283. "kodes .............. ALONE CODER"
  284. "soundtrakk ............ NQ/SKRJU"
  285. "some gfx, etc ......... SAND/MhM"
  286.  
  287. "   |   |   |   |   |   |   |   |"
  288. "   |   |   |   |   |   |   |   |"
  289. "   |   |   |   |   |   |   |   |"
  290. "   |   |   |   |   |   |   |   |"
  291.  
  292. "                                "
  293. "                                "
  294. "                                "
  295. "          read  again?!         "
  296.  
  297. "   |   |   |   |   |   |   |   |"
  298. "   |   |   |   |   |   |   |   |"
  299. "   |   |   |   |   |   |   |   |"
  300. "   |   |   |   |   |   |   |   |"
  301. ;
  302. //" Und now play-on da Allegrowa's "
  303. //"song  'S Dnem Rozhdenija!' )))))"
  304. //"  start  dancin' and boozein'   "
  305. //"make volumemax! komon! doit now!"
  306.  
  307.  
  308. /**
  309. PROC pokenet(BYTE _row, BYTE _col, BYTE data)
  310. {
  311.   POKE *(PBYTE)(_netaddr + ((UINT)_row<<8) + (UINT)_col) = data;
  312. }
  313.  
  314. FUNC BYTE peeknet(BYTE _row, BYTE _col)
  315. {
  316.   RETURN *(PBYTE)(_netaddr + ((UINT)_row<<8) + (UINT)_col);
  317. }
  318.  
  319. PROC pokenetcolor(BYTE _row, BYTE _col, BYTE data)
  320. {
  321.   POKE *(PBYTE)(_netcoloraddr + ((UINT)_row<<8) + (UINT)_col) = data;
  322. }
  323.  
  324. FUNC BYTE peeknetcolor(BYTE _row, BYTE _col)
  325. {
  326.   RETURN *(PBYTE)(_netcoloraddr + ((UINT)_row<<8) + (UINT)_col);
  327. }
  328. */
  329. /**
  330. PROC testcube()
  331. {
  332. VAR BYTE hgt;
  333.  
  334.       //определяем цвет и двигаем _row (_col)
  335.       //если hgt==_curhgt, то пол и _row++ (_col--)
  336.       //если hgt>_curhgt, то стена
  337.       //если hgt<_curhgt, то _row++ (_col--) и крутимся
  338.       //_row,_col указывают на то, что мы видим в этой клетке, или на яму
  339.         IF (_rowstep != _backslash) { //чётность не соответствует, так что границы не будет
  340.           _curcolor = _oldcolor;
  341.           //_curhgt++;
  342.         }ELSE { //чётность соответствует
  343.  
  344.          invisloop:
  345.           IF (_rowstep) { // \ - пересечение _row, дальше идём по _col
  346.             hgt = peeknet(_row, _col);
  347.             IF (hgt==_curhgt) { //пол (только при правильной чётности!)
  348.               IF (_rowstep==_backslash) {
  349.                 _curcolor = peeknetcolor(_row, _col); //clWhite; //новый наравне
  350.                 DEC _col;
  351.                 _rowstep = !_rowstep;
  352.               }ELSE {
  353.                 IF (_oldcolor != _clBlue) _curcolor = _clRed; //новый выше
  354.               };
  355.             }ELSE IF (hgt>_curhgt) { //стена пересечение _row
  356.               IF (_oldcolor != _clBlue) _curcolor = _clRed; //новый выше
  357.               IF (_rowstep==_backslash) INC _curhgt;
  358.               //теперь чётность _rowstep может не соответствовать _backslash!
  359.             }ELSE { //яма
  360.               DEC _col;
  361.               _rowstep = !_rowstep;
  362.               IF (_rowstep==_backslash) {
  363.                 DEC _curhgt;
  364.               };
  365.               goto invisloop;
  366.             };
  367.           }ELSE { // / - пересечение _col, дальше идём по _row
  368.             hgt = peeknet(_row, _col);
  369.             IF (hgt==_curhgt) { //пол (только при правильной чётности!)
  370.               IF (_rowstep==_backslash) {
  371.                 _curcolor = peeknetcolor(_row, _col); //clWhite; //новый наравне
  372.                 INC _row;
  373.                 _rowstep = !_rowstep;
  374.               }ELSE {
  375.                 IF (_oldcolor != _clRed) _curcolor = _clBlue; //новый выше
  376.               };
  377.             }ELSE IF (hgt>_curhgt) { //стена пересечение _col
  378.               IF (_oldcolor != _clRed) _curcolor = _clBlue; //новый выше
  379.               IF (_rowstep==_backslash) INC _curhgt;
  380.               //теперь чётность _rowstep может не соответствовать _backslash!
  381.             }ELSE { //яма
  382.               INC _row;
  383.               _rowstep = !_rowstep;
  384.               IF (_rowstep==_backslash) {
  385.                 DEC _curhgt;
  386.               };
  387.               goto invisloop;
  388.             };
  389.           }; //!_rowstep
  390.  
  391.         }; //_rowstep==_backslash
  392. }
  393. */
  394. /**
  395. PROC cubecolumn()
  396. {
  397. VAR BYTE b;
  398.     _curhgt = 0x00;
  399.     _backslash = (((BYTE)_addr&0x02)==0x00); //_backslash - пересечение _row
  400.     _rowstep = _backslash;
  401.     _oldcolor = 0x07;
  402.     _y = _hgt;
  403.     REPEAT {
  404.       testcube();
  405.       //_row,_col указывают на то, что мы видим в следующей клетке, или на яму
  406.       //чётность _rowstep должна соответствовать _backslash, кроме случая, когда нашли стену
  407.  
  408.       //рисуем цвет
  409.       IF (_y <= _scrhgt) {
  410.         b = (_curcolor<<0x03) + _oldcolor;
  411.         POKE *(PBYTE)(_addr) = b;
  412.         POKE *(PBYTE)(_addr+1) = b;
  413.       };
  414.       _addr = _addr - 0x0020;
  415.       _oldcolor = _curcolor;
  416.       _backslash = !_backslash; //привязано к "y"
  417.       DEC _y;
  418.     }UNTIL (_y == 0x00);
  419. }
  420. */
  421. PROC fillworm()
  422. {
  423.       _picrow = 0x04/**0x00*/;
  424.       WHILE (_row < 0x15) {
  425.         pokenet(_row, _col, 0x01);
  426.         pokenetcolor(_row, _col, _net[((UINT)_picrow<<5)+ (UINT)_col + 31]);
  427.         INC _row;
  428.         INC _picrow;
  429.       };
  430. };
  431.  
  432. PROC fillwormforth()
  433. {
  434.       _picrow = 0x00;
  435.       WHILE (_row < 0x15) {
  436.         pokenet(_row, _col, 0x01);
  437.         pokenetcolor(_row, _col, _net[((UINT)_picrow<<5)+ (UINT)_col + 31]);
  438.         INC _row;
  439.         INC _picrow;
  440.       };
  441. };
  442.  
  443. PROC fillwormback()
  444. {
  445.       _picrow = 0x13;
  446.       WHILE (_row != 0xff) {
  447.         pokenet(_row, _col, 0x01);
  448.         pokenetcolor(_row, _col, _net[((UINT)_picrow<<5)+ (UINT)_col + 31]);
  449.         DEC _row;
  450.         DEC _picrow;
  451.       };
  452. };
  453.  
  454. PROC clearworm()
  455. {
  456.       _row = 0x01;
  457.       WHILE (_row < 0x16) {
  458.         pokenet(_row, _col, 0x00);
  459.         pokenetcolor(_row, _col, 0x00);
  460.         INC _row;
  461.       };
  462. };
  463.  
  464. PROC unfillworm()
  465. {
  466. VAR BYTE c;
  467. VAR BYTE cnew;
  468. VAR BYTE h;
  469. VAR BYTE hnew;
  470.       _row = 0x00;
  471.       h = 0x00;
  472.       c = 0x00;
  473.       WHILE (_row < 0x16) {
  474.         hnew = peeknet(_row, _col);
  475.         cnew = peeknetcolor(_row, _col)
  476.         pokenet(_row, _col, h);
  477.         pokenetcolor(_row, _col, c);
  478.         h = hnew;
  479.         c = cnew;
  480.         INC _row;
  481.       };
  482. };
  483.  
  484. PROC unfillwormback()
  485. {
  486. VAR BYTE c;
  487. VAR BYTE cnew;
  488. VAR BYTE h;
  489. VAR BYTE hnew;
  490.       _row = 0x16;
  491.       h = 0x00;
  492.       c = 0x00;
  493.       WHILE (_row != 0xff) {
  494.         hnew = peeknet(_row, _col);
  495.         cnew = peeknetcolor(_row, _col)
  496.         pokenet(_row, _col, h);
  497.         pokenetcolor(_row, _col, c);
  498.         h = hnew;
  499.         c = cnew;
  500.         DEC _row;
  501.       };
  502. };
  503. /**
  504. PROC jumpay(BYTE tonereg, BYTE volreg, BYTE mask)
  505. {
  506. VAR UINT frq;
  507. VAR BYTE vol;
  508. VAR INT x;
  509. VAR BYTE y;
  510. VAR BYTE hgt;
  511.   frq = (UINT)getayreg(tonereg) + ((UINT)getayreg(tonereg+0x01)<<8);
  512.   IF ((getayreg(0x07)&mask)!=mask) {
  513.     vol = getayreg(volreg);
  514.     IF       (vol>=0x10) {vol = 0x04;
  515.     }ELSE IF (vol==0x0f) {vol = 0x06;
  516.     }ELSE IF (vol==0x0e) {vol = 0x05;
  517.     }ELSE IF (vol==0x0d) {vol = 0x04;
  518.     }ELSE IF (vol==0x0c) {vol = 0x03;
  519.     }ELSE IF (vol==0x0b) {vol = 0x02;
  520.     }ELSE IF (vol>=0x09) {vol = 0x01;
  521.     }ELSE vol = 0x00;
  522.   }ELSE vol = 0x00;
  523.   IF (volreg!=0x09) vol = vol + vol; //low center, high left&right
  524.   frq = frq + 8; //против бесконечного цикла
  525.   y = 0x02;
  526.   WHILE (frq < 1000) {
  527.     frq = frq + (frq >> 2);
  528.     INC y;
  529.   };
  530.   IF (volreg == 0x08) {
  531.     x = - (INT)(y>>0x02);
  532.   }ELSE IF (volreg == 0x0a) {
  533.     x = (INT)(y>>0x02);
  534.   }ELSE x = -0;
  535.   _row = (BYTE)((INT)y + x);
  536.   //IF ((_row<0x02)||(_row>=0x40)) _row = 0x02;
  537.   _col = 0x19 - (BYTE)((INT)y - x);
  538.   //IF ((_col<0x02)||(_col>=0x40)) _col = 0x02;
  539.   hgt = peeknet(_row, _col);
  540.   IF (hgt < vol) {
  541.     pokenet(_row, _col+0x40, vol);
  542.   }; //ELSE pokenet(_row, _col, hgt-0x01);
  543. }
  544. */
  545. PROC demo()
  546. {
  547. VAR PCHAR ptxt;
  548. VAR CHAR c;
  549. VAR UINT scrtxt;
  550. VAR UINT addry;
  551. VAR UINT addr;
  552. VAR UINT addrbase;
  553. VAR BYTE x;
  554. VAR BYTE y;
  555. VAR BYTE suby;
  556. VAR BYTE b;
  557. VAR UINT w;
  558. VAR BYTE hgt;
  559. VAR BOOL cleared;
  560.  
  561.   _readyattrbuf = _attrbuf;
  562.  
  563.   _wastimer = _timer;
  564. //  border(0x00);
  565. /**
  566.   y = 0x00;
  567.   WHILE (y < _scrhgt) {
  568.     x = 0x00;
  569.     WHILE (x < _wid) {
  570.       addr = _attrbuf + ((UINT)y<<5) + (UINT)x;
  571.       POKE *(PBYTE)(addr) = 0x00;
  572.       INC x;
  573.     };
  574.     INC y;
  575.   };
  576.   WHILE (y < _hgt) {
  577.     x = 0x00;
  578.     WHILE (x < _wid) {
  579.       addr = _attrbuf + ((UINT)y<<5) + (UINT)x;
  580.       POKE *(PBYTE)(addr) = 0x07;
  581.       INC x;
  582.     };
  583.     INC y;
  584.   };
  585. */
  586. /**
  587.   addr = _netaddr;
  588.   _row = 0x00;
  589.   WHILE (_row < _nethgt) {
  590.     _col = 0x00;
  591.     WHILE (_col < _netwid) {
  592.       pokenet(_row, _col, random()&0x03);
  593.       pokenetcolor(_row, _col, (_row&0x07)|0x04);
  594.       INC _col;
  595.     };
  596.     INC _row;
  597.   };
  598. */
  599. //draw cube texture  
  600.   //drawcubetexture();
  601. /**
  602.   addr = 0x4000;
  603.   y = 0x00;
  604.   WHILE (y < _scrhgt) {
  605.     addry = 0x4000 + ((UINT)y<<5)&0x00e0 + ((UINT)y<<8)&0x1800;
  606.     x = 0x00;
  607.     WHILE (x < _wid) {
  608.       addr = addry + (UINT)x;
  609.       IF ((((x>>0x01)^y)&0x01) == 0x00) {
  610.         w = 0x0001;
  611.         suby = 0x00;
  612.         WHILE (suby < 0x08) {
  613.           POKE *(PBYTE)(addr) = (BYTE)(w>>8);
  614.           POKE *(PBYTE)(addr+1) = (BYTE)w;
  615.           w = (w<<2) + 0x0003;
  616.           addr = addr + 0x0100;
  617.           INC suby;
  618.         };
  619.       }ELSE {
  620.         w = 0x8000;
  621.         suby = 0x00;
  622.         WHILE (suby < 0x08) {
  623.           POKE *(PBYTE)(addr) = (BYTE)(w>>8);
  624.           POKE *(PBYTE)(addr+1) = (BYTE)w;
  625.           w = (w>>2) + 0xc000;
  626.           addr = addr + 0x0100;
  627.           INC suby;
  628.         };
  629.       };
  630.       x = x + 0x02;
  631.     };
  632.     INC y;
  633.   };
  634. */
  635.   scrtxt = 0x5080;
  636.   ptxt = _text;
  637.   _dotext = 0x00;
  638.  
  639. //  _frameready = +FALSE;
  640.  
  641.   cleared = +TRUE;
  642.  
  643.   _jumptime = 0x00;
  644.  
  645.   _net = _net35;
  646.  
  647.   _stage = 0x00;
  648.  
  649. loop:
  650.  
  651.   //halter();
  652.  
  653.   IF (!_frameready) {
  654.     x = 0x00;
  655.     _curattrbuf = _attrbuf + _attrbuf2 - _readyattrbuf;
  656.     addrbase = _curattrbuf + ((UINT)(_scrhgt-0x01)<<5);
  657.     IF (_jumptime!=0x00) {_jump = 0x01;
  658.     }ELSE _jump = 0x00;
  659.     WHILE (x < _wid) {
  660.       _col = 0x12 + (x>>0x02) + _jump;
  661.       _row = (x>>0x02) - _jump; //0
  662.       _addr = addrbase + (UINT)x;
  663.       cubecolumn();
  664.       x = x + 0x02;
  665.     };
  666.     IF (_jumptime!=0x00) DEC _jumptime;
  667.     _frameready = +TRUE;
  668.     _readyattrbuf = _curattrbuf;
  669.   };
  670.  
  671.   _curtimer = _timer; //однократное чтение гарантирует синхронность
  672.   _logicframes = _curtimer - _wastimer;
  673.   _textlogicframes = _curtimer - _wastimer;
  674.   WHILE (_logicframes != 0) {
  675.     _wasstage = _stage;
  676.     _quarter = _wastimer / 12;
  677.     _tact = _quarter >> 2;
  678.     _position = _tact >> 2;
  679.     _stage = (BYTE)(_position - (_position/18)*18);//(_tact >> 2)&0x0f; //song = 18 positions
  680.     _noteintact = (BYTE)(_wastimer - (_tact * 48)); //max 47
  681.     _noteinquarter = (BYTE)(_wastimer - (_quarter * 12)); //max 11
  682.     IF (_stage == 0x00) { //очистка колбасками
  683.  
  684.       IF (cleared) {
  685.         _row = 0x00;
  686.         WHILE (_row < _nethgt) {
  687.           _col = 0x00;
  688.           WHILE (_col < _netwid) {
  689.             pokenet(_row, _col, 0x01);
  690.             INC _col;
  691.           };
  692.           INC _row;
  693.         };
  694.         cleared = +FALSE;
  695.         _col = 0x06;
  696.         clearworm();
  697.         _col = 0x07;
  698.         clearworm();
  699.         IF (_net == _net35) {_net = _nettort;
  700.         }ELSE _net = _net35;
  701.       };
  702.       _col = 0x08 + ((BYTE)_quarter & 0x0f);
  703.       IF ((_col&0x01)==0x00) {
  704.         _row = 0x0b - (_noteinquarter & 0x0f);
  705.         unfillworm();
  706.         unfillworm();
  707.       }ELSE {
  708.         _row = 0x08 + (_noteinquarter & 0x0f);
  709.         unfillwormback();
  710.         unfillwormback();
  711.       };
  712.      
  713.     }ELSE IF (_stage < 0x04) { //очистка и заполнение кубиками
  714.       IF (!cleared) {
  715.         clearnet();
  716.         cleared = +TRUE;
  717.       };
  718.       IF ((_noteinquarter == 0x00)&&(((BYTE)_quarter&0x01)==0x00)) {
  719.         badrnd:
  720.         x = (random()&0x07) + 0x01;// + 0x01; // + (random()&0x01); //0x00..0x10
  721.         y = (random()&0x07) + 0x01;// + 0x08; //0x08..0x18
  722.         _row = 0x00 + y + x; // + random()&0x01;
  723.         _col = 0x0f - y + x + random()&0x01;
  724.         IF (peeknet(_row, _col) == 0x01) goto badrnd;
  725.         IF (peeknet(_row+0x01, _col) == 0x01) goto badrnd;
  726.         IF (peeknet(_row, _col+0x01) == 0x01) goto badrnd;
  727.         IF (peeknet(_row-0x01, _col) == 0x01) goto badrnd;
  728.         IF (peeknet(_row, _col-0x01) == 0x01) goto badrnd;
  729.         pokenet(_row, _col, 0x01);
  730.         pokenetcolor(_row, _col, 0x07);
  731.       };
  732.     }ELSE IF (_stage == 0x04) { //медленное заполнение колбасками
  733.       //pokenet(0x0a, 0x07, 0x01); //top left
  734.       //pokenetcolor(0x0a, 0x07, _netpic[((UINT)0x0a<<5)+ (UINT)0x07]);
  735.       IF (_wasstage != _stage) {
  736.         _col = 0x06;
  737.         _row = 0x04/**0x00*/;
  738.         fillworm();
  739.         _col = 0x07;
  740.         _row = 0x04/**0x00*/;
  741.         fillworm();
  742.       };
  743.       _col = 0x08 + ((BYTE)_tact & 0x03);
  744.       _row = 0x0f/**0x0b*/ - ((_noteintact>>0x2) & 0x0f);
  745.       fillworm();
  746.     }ELSE IF (_stage == 0x05) { //быстрое дозаполнение колбасками
  747.       _col = 0x08 + 0x04 + ((BYTE)_quarter & 0x0f);
  748.       IF ((_col&0x01)==0x00) {
  749.         _row = 0x0b - (_noteinquarter & 0x0f);
  750.         fillwormforth();
  751.       }ELSE {
  752.         _row = 0x08 + (_noteinquarter & 0x0f);
  753.         fillwormback();
  754.       };
  755.       cleared = +TRUE;
  756.     }ELSE IF (_stage < 0x08) { //прыгающая доска
  757.       IF (cleared) {
  758.         _row = 0xff;
  759.         WHILE (_row != _nethgt) {
  760.           _col = 0x00;
  761.           WHILE (_col != _netwid) {
  762.             pokenet(_row, _col, 0x01);
  763.             IF (_row == 0xff) pokenetcolor(_row, _col, 0x04);
  764.             INC _col;
  765.           };
  766.           INC _row;
  767.         };
  768.         cleared = +FALSE;
  769.       };
  770.       IF ((_noteinquarter == 0x00)&&(((BYTE)_quarter&0x01)==0x00)) {
  771.         _jumptime = 0x04;
  772.       };
  773.     }ELSE IF (_stage < 0x0a) { //заваливание квадратами
  774.         x = (random()&0x0f) + 0x01;// + 0x01; // + (random()&0x01); //0x00..0x10
  775.         y = (random()&0x0f) + 0x00;// + 0x08; //0x08..0x18
  776.         _row = 0x00 + y + x;
  777.         _col = 0x10 - y + x;
  778.         hgt = peeknet(_row, _col);
  779.         IF ((random()&0x01) == 0x00) {
  780.           IF (hgt!=0x00) DEC hgt;
  781.         }ELSE INC hgt;
  782.         pokenet(_row, _col, hgt);
  783.         pokenet(_row+0x01, _col, hgt);
  784.         pokenet(_row, _col+0x01, hgt);
  785.         pokenet(_row+0x01, _col+0x01, hgt);
  786.     }ELSE /**IF (_stage < 0x0f)*/ { //анализатор музыки
  787.  
  788.       IF (!cleared) {
  789.         _row = 0x00;
  790.         WHILE (_row < _nethgt) {
  791.           _col = 0x00;
  792.           WHILE (_col < _netwid) {
  793.             pokenet(_row, _col+0x40, 0x01);
  794.             pokenet(_row, _col+0xc0, 0x01);
  795.             INC _col;
  796.           };
  797.           INC _row;
  798.         };
  799.         cleared = +TRUE;
  800.       };
  801. /**
  802.   _row = 0x01;
  803.   WHILE (_row < 0x13) {
  804.     _col = 0x04;
  805.     WHILE (_col < 0x18) {
  806.       hgt = peeknet(_row, _col)+0x01;
  807.       IF       (hgt < peeknet(_row+0x01, _col)) {pokenet(_row, _col+0x40, hgt);
  808.       }ELSE IF (hgt < peeknet(_row, _col-0x01)) {pokenet(_row, _col+0x40, hgt);
  809.  
  810.       }ELSE IF (hgt < peeknet(_row-0x01, _col)) { pokenet(_row, _col+0x40, hgt);
  811.       }ELSE IF (hgt < peeknet(_row, _col+0x01)) { pokenet(_row, _col+0x40, hgt);
  812.       //}ELSE IF (hgt == peeknet(_row+0x01, _col)) {
  813.       //}ELSE IF (hgt == peeknet(_row, _col-0x01)) {
  814.       }ELSE IF (hgt != 0x01) {pokenet(_row, _col+0x40, hgt-0x02);
  815.       }ELSE pokenet(_row, _col+0x40, hgt-0x01);
  816.       INC _col;
  817.     };
  818.     INC _row;
  819.   };
  820.    
  821.   _row = 0x01;
  822.   WHILE (_row < 0x13) {
  823.     _col = 0x04;
  824.     WHILE (_col < 0x18) {
  825.       pokenet(_row, _col, peeknet(_row, _col+0x40));
  826.       INC _col;
  827.     };
  828.     INC _row;
  829.   };
  830. */
  831.       jumpay(0x00, 0x08, /**mask*/0x09);
  832.       jumpay(0x02, 0x09, /**mask*/0x12);
  833.       jumpay(0x04, 0x0a, /**mask*/0x24);
  834.       IF ((_noteinquarter&0x01) == 0x00) {
  835.         decay();
  836.         goto quitlogic;
  837.       };
  838.     };
  839.  
  840.    
  841.     INC _wastimer;
  842.     DEC _logicframes;
  843.     //_logicframes = 0;
  844.   };
  845. quitlogic:
  846.   _wastimer = _curtimer;
  847.  
  848.   WHILE (_textlogicframes != 0) {
  849.     INC _dotext;
  850.     IF ((_dotext&0x03) == 0x00) {
  851.   REPEAT {
  852.     c = *(PCHAR)ptxt;
  853.     IF (c == '\n') {
  854.       scrtxt = (scrtxt&0xffe0) + 0x0020;
  855.     }ELSE IF (c == '|') {
  856.       prch(scrtxt, ' ');
  857.       INC scrtxt;
  858.     }ELSE {
  859.       prch(scrtxt, c);
  860.       INC scrtxt;
  861.     };
  862.     IF (scrtxt >= 0x5100) scrtxt = 0x5080;
  863.     INC ptxt; IF (*(PCHAR)ptxt == '\0') ptxt = _text;
  864.   }UNTIL (c != ' ');
  865.     };
  866.     DEC _textlogicframes;
  867.   };
  868.  
  869.   goto loop;
  870. }
  871.