home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PB_FIRE.ZIP / FIRE.BAS < prev    next >
BASIC Source File  |  1996-12-20  |  3KB  |  137 lines

  1. ' Fire routine in PowerBasic by fr[ee]k on 12-20-1996
  2. ' ===================================================
  3. '
  4. ' Send your comments to   magik@videotron.ca
  5. '
  6. '    No, i am not insane... I coded this fire routine
  7. ' in Basic to teach how to program them...
  8. ' Assembly is hard to understand.. but basic is easy
  9. ' and i never found any basic vga/demo src code
  10. '
  11. ' I will release every thing i know about vga demo in
  12. ' BASIC....
  13. '
  14. ' By the way, PowerBasic is not shit, look what i can
  15. ' code with it...
  16. '
  17. ' And they're we go...
  18. ' I hope it will be easy to read
  19. '
  20. ' THANKS to
  21. '
  22. ' -----------------------------------
  23. ' ------------> Vulture <------------
  24. ' -----------------------------------
  25. '
  26. ' For his good Source code
  27. '
  28. '
  29. ' I used the VGA 0013h routines from ftp.powerbasic.com to code it
  30. ' because PowerBasic can't do 320x200x256 by itself and asm routines
  31. ' is alwais faster than the BASIC ones
  32. '
  33. ' - fr[ee]k
  34.  
  35.  
  36. $OPTIMIZE SIZE        ' Optimizr the EXE size
  37.  
  38. TYPE RGB        ' RGB Palette type
  39.   R AS BYTE
  40.   G AS BYTE
  41.   B AS BYTE
  42. END TyPE
  43.  
  44. '------------------[CODE START]--------------
  45. SCREEN13                                       ' Set 320x200x256
  46.  
  47. for i% = 1 to 255                              '
  48.     SetRgb i%, i% / 4, 0, 0                ' Set the palette in red
  49. next i                                         '
  50.  
  51. Randomize Timer                       ' Randomize timer to get random
  52.                            ' Numbers from [rnd]
  53.  
  54. DO                            ' Start the loop
  55.  
  56. for i% = 1 to 319
  57.     xpset i%, 199, int(100 + rnd * 15)     ' It put the bottom random pixel
  58.                                ' line
  59.  
  60. for j% = 198 to 150 step -1
  61.         temp = xpoint(i%, j% + 1) - 5           ' Get the point color and
  62.                                                ' drop the color by 5
  63.         if not temp < 10 then
  64.         xpset i%, j%, temp
  65.         end if
  66.  
  67. next j%
  68.  
  69. next i%
  70.  
  71. LOOP WHILE INKEY$ = ""                   ' Loop until someone press a key
  72.  
  73.                                                ' Fade down the palette
  74. for i% = 1 to 255
  75.  
  76.       for j% = 255 to 0 step -1
  77.     SetRgb i%, j%,0,0
  78.       next j%
  79.  
  80. for t = 1 to 10000: next t                     ' Timer loop
  81. next i%
  82. TEXTMODE
  83.  
  84. '-------------------[CODE END]---------------
  85. end
  86.  
  87. 'switchs into SCREEN 13
  88. SUB SCREEN13 PUBLIC
  89.  
  90.   ! MOV AX , &h13
  91.   ! INT &h10
  92.  
  93. END SUB
  94.  
  95. 'switchs into textmode
  96. SUB TEXTMODE PUBLIC
  97.  
  98.   ! MOV AX , &h3
  99.   ! INT &h10
  100.  
  101. END SUB
  102.  
  103. 'sets a point witout clipping
  104. SUB XPSET (BYVAL x% ,BYVAL y% ,BYVAL col?) PUBLIC
  105.  
  106.   ! MOV AX , 320
  107.   ! MUL y%
  108.   ! MOV DI , AX           ; Formel : 320 * y + x
  109.   ! ADD DI , x%           ; für Offset
  110.   ! MOV DX , &hA000       ; Segment : A000h (Videospeicher)
  111.   ! MOV ES , DX
  112.   ! MOV AL , col?         ; Farbe
  113.   ! STOSB
  114.  
  115. END SUB
  116.  
  117. 'gets the color of a point
  118. FUNCTION XPOINT? (BYVAL x% , BYVAL y%) PUBLIC
  119.   ! MOV AX , 320
  120.   ! IMUL y%
  121.   ! MOV SI , AX
  122.   ! ADD SI , x%
  123.   ! MOV DX , &hA000
  124.   ! MOV ES , DX
  125.   ! MOV AX , ES:[SI]
  126.   ! MOV SP , BP
  127.   ! POP BP
  128.   ! RETF 4
  129. END FUNCTION
  130.  
  131. SUB SetRGB(Nr% , r% , g% , b%)
  132.   OUT &h3C8 , Nr%
  133.   OUT &h3C9 , r%
  134.   OUT &h3C9 , g%
  135.   OUT &h3C9 , b%
  136. END SUB
  137.