home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / progutils / spiteplot / text < prev   
Text File  |  1990-06-16  |  3KB  |  63 lines

  1.  
  2.                                  FASTPLOT
  3.  
  4.            The fastest way ever to plot 2D sprites in mode 13!!!
  5.  
  6.                            Author   : Eirik Hansen
  7.                            Where    : Industriveien 12
  8.                                     : 8500 NARVIK
  9.                                     : Norway
  10.                                     :
  11.                                     : #440 at Arcade
  12.                            When     : About a year ago
  13.  
  14. The  procedures given in the BASIC program FastPlot yield the fastest 
  15. possible code to plot 2D-sprites in mode 13. You need to:
  16.  
  17.     - load the relevant sprite into memory at a prepared site of the 
  18.                                                     appropriate size.
  19.                        --- In=OPENIN "SpriteName"
  20.                        --- Ext%=EXT#In
  21.                        --- DIM WhereSpriteIsLocated Ext%
  22.                        --- CLOSE#In
  23.  
  24.     - know the height and width of the sprite.
  25.  
  26.     - then call PROCMakeFastMC(WhereSpriteIsLoaded%,Width%,Height%),
  27.                 where the variable names should be self explanatory.
  28.  
  29. The procedures will then generate code according to the shape of the sprite.
  30. Black colour is treated as a mask. It`ll not be the shortest code, but shure 
  31. the fastest one. ( At least on an ARM2. )
  32. Usually the code will be much shorter than the size of the sprite, but when
  33. a very complex sprite is 'compiled' the code might be longer.
  34.  
  35. The code generated will only cope with plotting at 4 bytes intervals. So if
  36. you need to plot at a higher resolution you in fact need to shift the sprite
  37. right one byte (this can be done by hand using !Paint or similar apps.), and then call the routine again with the new sprite. 
  38.  
  39. So to plot at the resolution in mode 13 you need to genereate four different plot-routines with the same sprite, shifted right one byte every time the
  40. code is generated. 
  41. You need to know the height and width of the sprite before calling 
  42. PROCMakeFastMC(). I haven`t bothered to dissect how sprites are stored at 
  43. disc\memory on the Arc, but if you have the relevant know-how it should be 
  44. possible to modify this routine to just input the sprite name (or number).
  45.  
  46. To plot the sprite you first load the address of where the sprite is in 
  47. memory into R1, and the address on screen where you want it put, in R0.
  48. Then call the code generated.
  49.  
  50. Eg       .
  51.          .
  52.          ADR R1,TheAddressOfSpriteInMemory
  53.          ADR R0,TheScreenAddressYouWantItPut    ;At word boundary
  54.          BL (The code generated)
  55.          .
  56.          .
  57.  
  58. Hope the routine will be helpfull and a time-saver for someone out there.
  59.  
  60. Eirik       
  61.  
  62. NOTE The procedures given will only generate code for sprites not wider than
  63.      120 pixels.