home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / p640x480.zip / PIXEL.BAS < prev    next >
BASIC Source File  |  1993-03-02  |  4KB  |  116 lines

  1. '╔═══════════════════════════════════════════════════════════════════════════╗
  2. '║                                                                           ║
  3. '║ PIXEL: Demo of pixel plotting routine for VGA mode 12 / 640x480x16 color. ║
  4. '║ Downloaded from the Grey Matter Electronic Mail and Shareware File Center ║
  5. '║                                                                           ║
  6. '╚═══════════════════════════════════════════════════════════════════════════╝
  7. '
  8. '╔═══════════════════════════════════════════════════════════════════════════╗
  9. '║                                                                           ║
  10. '║ Don't forget to give the Grey Matter Electronic Mail and Shareware File   ║
  11. '║ Center a call.  Open 24 hours a day, 7 days a week.  Reasonable rates     ║
  12. '║ (subscribe online with your MC/Visa), over seven thousand files online    ║
  13. '║ as of March 3, 1993.  Megabytes more coming in every day from all over    ║
  14. '║ the country.  If you're a programmer you'll find lots of useful source    ║
  15. '║ code, thousands of utilities, and technical information on everything     ║
  16. '║ from graphic file formats to sound card programming.  Check us out ...    ║
  17. '║ we're always here!                                                        ║
  18. '║                                                                           ║
  19. '╚═══════════════════════════════════════════════════════════════════════════╝
  20.  
  21. 'Procedure declarations.
  22.  
  23. DECLARE SUB ShowRegion (X%, Y%, w%, h%, f%, d%)
  24. DECLARE SUB PIXEL (X AS INTEGER, Y AS INTEGER, c AS INTEGER, m AS INTEGER)
  25.  
  26. 'Initialize screen display to 640x480x16 color VGA.  Clear palette entry
  27. '15 to 0 so that hidden text may be printed on a black background.
  28.  
  29. SCREEN 12: LOCATE 3
  30. PALETTE 15, 0
  31.  
  32. 'Generate text screen, but plot it in color 15 so that it won't show up
  33. 'right away.
  34.  
  35. COLOR 15
  36.  
  37. PRINT "   This is a piece of sample code to demonstrate using the PIXEL routine."
  38. PRINT "   It really is pretty straightforward, just pass it the following"
  39. PRINT "   parameters:"
  40. PRINT
  41. PRINT "         PIXEL <xcoord>, <ycoord>, <color>, <maskcolor>"
  42. PRINT
  43. PRINT "      1. The x co-ordinate may range from 0 - 639."
  44. PRINT
  45. PRINT "      2. The y co-ordinate may range from 0 - 479."
  46. PRINT
  47. PRINT "      3. The color value may range from 0 - 15."
  48. PRINT
  49. PRINT "      4. The mask color may range from 0 - 15."
  50. PRINT
  51. PRINT "   If any of you assembler jocks out there make any interesting improvements"
  52. PRINT "   or other modifications to the PIXEL routine, we'd appreciate your uploading"
  53. PRINT "   a copy of your modified source code to our system:"
  54. PRINT
  55. PRINT "   The Grey Matter Electronic Mail and Shareware File Center  (708) 208-0662"
  56. PRINT "   (Member of SourceNet: The Programmer's Network)            (708) 208-4716"
  57. PRINT
  58. PRINT "   Over seven thousand files online as of March 2, 1993, something for"
  59. PRINT "   everyone.  Lots of useful source files and technical information; if"
  60. PRINT "   you're a programmer check us out.  All lines are USR 14400.";
  61. PRINT
  62. PRINT
  63.  
  64. PRINT "                             PRESS ANY KEY TO CONTINUE"
  65.  
  66. 'Now, selectively display the pre-printed hidden text by updating the text
  67. 'in each of the regions defined below.
  68.  
  69. ShowRegion 20, 0, 580, 80, 9, 3
  70. ShowRegion 30, 80, 500, 30, 10, 1
  71. ShowRegion 30, 110, 430, 140, 12, 2
  72. ShowRegion 20, 250, 610, 60, 13, 1
  73. ShowRegion 20, 320, 610, 30, 11, 2
  74. ShowRegion 20, 350, 610, 65, 14, 3
  75. ShowRegion 120, 430, 350, 6, 6, 1
  76. ShowRegion 120, 436, 350, 8, 7, 2
  77.  
  78. 'Wait here until key pressed.
  79.  
  80. DO: LOOP UNTIL INKEY$ <> ""
  81.  
  82. SUB ShowRegion (X%, Y%, w%, h%, f%, d%)
  83.  
  84. SELECT CASE d%
  85.  
  86. CASE 1
  87.  
  88.    FOR xcoord% = X% TO X% + w%
  89.       FOR ycoord% = Y% TO Y% + h%
  90.          PIXEL xcoord%, ycoord%, f%, 15
  91.       NEXT ycoord%
  92.    NEXT xcoord%
  93.  
  94. CASE 2
  95.  
  96.    FOR xcoord% = X% + w% TO X% STEP -1
  97.       FOR ycoord% = Y% TO Y% + h%
  98.          PIXEL xcoord%, ycoord%, f%, 15
  99.       NEXT ycoord%
  100.    NEXT xcoord%
  101.  
  102. CASE 3
  103.  
  104.    FOR ycoord% = Y% TO Y% + h%
  105.       FOR xcoord% = X% TO X% + w%
  106.          PIXEL xcoord%, ycoord%, f%, 15
  107.       NEXT xcoord%
  108.    NEXT ycoord%
  109.  
  110. CASE ELSE
  111.  
  112. END SELECT
  113.  
  114. END SUB
  115.  
  116.