home *** CD-ROM | disk | FTP | other *** search
- <HTML><h1>FastSpr Documentation</h1>
-
- FastSpr is a module occupying about 8K, designed to offer high speed sprite
- plotting to the games writer. Typically it is at least twice as fast as OS
- routines, whilst providing full masking and a variable clipping window. The
- routines may be accessed via SWIs or direct calls.
-
- <h1>Using FastSpr</h1>
-
- FastSpr uses a special sprite format, which provides high speed plotting.
- Sprite files are most easily produced using the application <a href="FSPConv:!Help">FSPConv</a>, with
- which instructions are provided. Basically, you need to do the following:
-
- o Make a SpriteFile (using !Paint) with sprites called 0,1,2,3,4...etc
-
- o Drag this to the FSPConv icon
-
- o Click convert.
-
- The FastSpr files are usually about twice the size of the originating
- sprite file, but may be up to six times as large, or smaller, depending on
- the amount of transparent area of the sprites. See the help files with
- FSPConv for full details.
-
- <h1>Loading the Module</h1>
-
- You can load the module by either double clicking the application, or using
- the command *RMLoad FastSpr:FastSpr, or whatever you can engineer for
- yourself.
-
- <h1>Loading your sprites</h1>
-
- The FastSpr file may be loaded in either of two ways:
-
- (i) Into the RMA : Using *FastSprLoad or the SWI "FastSpr_Load"
- (ii) Into user memory. There is a simple way to load the file into an
- Amnesia area. See the entry on FastSpr_GetPointer in the SWIDocs file.
-
- Typical BASIC coding:
-
- 10 *FastSprLoad 1 Filename
-
- or
-
- 10 SYS "<a href="swidocs#load">FastSpr_Load</a>","Filename",1
-
- <h1>Plotting</h1>
-
- Before any FastSpr operation, select the correct MODE for the sprites you
- are using. The SWI used to plot sprite is "<a href="swidocs#plot">FastSpr_Plot</a>", number &47D00.
- Remeber that for speed, the SWIs should be referred to by number, not name.
-
- Typical BASIC coding:
-
- 10 SYS &47D00,&02000003,160,128 - Plots sprite 3 from pool 2 at coordinates
- 160,128.
-
- <h1>Coordinates</h1>
-
- FastSpr uses memory coordinates. The top left of the screen is (0,0), and
- the bottom right is (x-1,y-1) where x is the number of bytes in one line, and
- y is the number of lines. For example, in MODE 13 (256 colour,320 by 256
- pixels), (319,255) is the bottom right corner of the screen. The application
- !FSPConv produces sprites for which the middle of the sprite is plotted at
- the coordinates given. Negative coords and those off the screen are
- acceptable.
-
- <h1>Clipping Window</h1>
-
- The sprites are clipped (ie parts outside of the window are not plotted)
- according to the window set by SWI "FastSpr_SetClipWindow".
-
- Typical BASIC coding:
-
- 10 SYS "<a href="swidocs#setclipwindow">FastSpr_SetClipWindow</a>",xmin,ymin,xmax,ymax
-
- Xmin and ymin are inclusive, whereas xmax and ymax are exclusive, so the
- correct window for the whole of a MODE 13 screen is 0,0,320,256.
-
- The SWI "<a href="swidocs#clearwindow">FastSpr_ClearWindow</a>" fills the clip window with the current
- backdrop colour, set by SWI "<a href="swidocs#setbackdrop">FastSpr_SetBackdrop</a>" or *FastSprBackdrop.
-
-
- <h1>ScreenBanks</h1>
-
- FastSpr supports switching of screen banks to provide flicker free updates.
- SWI "<a href="swidocs#screenbank">FastSpr_ScreenBank</a>" does the job. A value of 1 supplied switches all
- subsequent operations to the shadow bank (the OS bank 2), any other value to
- the main bank (OS bank 1).
-
- Typical BASIC coding:
-
- 10 b%=1
- 20 REPEAT loop starts
-
- Do plotting, etc, here
-
- 30 WAIT
- 40 SYS &47D06,b% sets FastSpr's bank to one bank
- 50 SYS &6,&71,b% sets the displayed bank to the other (SWI is OS_Byte)
- (55 SYS &6,&70,2-b%) only if you're using normal plotting routines as well
- 60 SYS &47D01 clears FastSpr's window
- 70 bank%=3-b% switches the banks for next time
-
- 80 UNTIL FALSE loop ends
-
- Note : The most common problem with switching banks is neglecting to
- allocate enough screen memory. No errors are produced - it just doesn’t
- work.
-
- <h1>Other Features</h1>
-
- For ultimate speed, you can call some routines directly to save time
- decoding the SWI issued. The SWI "<a href="swidocs#getaddress">FastSpr_GetAddress</a>" returns the addresses
- of the useful routines.
-
- Typical BASIC coding:
-
- 10 SYS "<a href="swidocs#getaddress">FastSpr_GetAddress</a>",plotadr,clearadr,bankadr
- ...
- 20 A%=0
- 30 B%=160
- 40 C%=128
- 50 CALL plotadr
-
- is equivalent to
-
- 10 SYS "<a href="swidocs#plot">FastSpr_Plot</a>",0,160,128
-
- Remember that these routines are in the RMA, so the desktop and RMTidy
- commands may move the module and your addresses will no longer be valid.
-
- <h1>Speed Considerations</h1>
-
- The following guidelines should provide maximum speed.
-
- (1) Use sprites with as many transparent pixels as possible. A sprite with
- twice as many solid pixels takes almost twice as long to plot in most cases.
-
- (2) If you're using SWI <a href="swidocs#clearwindow">FastSpr_ClearWindow</a>, choose a clip window which
- (best) includes the whole width of the screen, or (next best) where xmin and
- xmax are multiples of 4.
-
- (3) In BASIC refer to all SWIs by number if they need to be fast.
-
- (4) Avoid horizontal clipping if you can. Clipping the top or bottom of a
- sprite carries no time penalty, but clipping the sides may increase plotting
- time to up to twice. When clipping both sides, plotting time may be x3.
-
- <h1>What it can't cope with</h1>
-
- (1) Sprites bigger than 255 pixels along either axis in FSP1 format.
-
- (2) Screen modes wider than 640 pixels, or narrower than 4 (window clearing
- only).
-
- To avoid problems, the following may be helpful.
-
- (1) Make sure you are in the right mode for your sprite.
-
- (2) Don't set clip windows and then change mode (which resets them).
-
- (3) Don't chop up your machine with an axe.
-
- (4) Don't forget that the module uses non-standard coordinates.
-
- <h1>Conditions</h1>
-
- This version of FastSpr may be freely used and distributed for commercial
- or non-commercial applications. If you can distribute the whole application
- and the application !FSPConv with your software then so much the better, but
- otherwise just include whatever you need. You must not remove my copyright
- notice from the module.
- This software is supplied as is, and no liability will be accepted for loss
- or damage of any kind arising from its use or misuse.
-
- Andy Southgate, 5th Nov 1993. Updated 16th October 1994.
-