<HTML><h1>FastSpr Version 3.01</h1>

<h6>SWI Documentation</h6>

FastSpr supports an SWI block based at &amp;47D00.

	<a href="#plot">FastSpr_Plot</a>
	<a href="#clearwindow">FastSpr_ClearWindow</a>
	<a href="#setclipwindow">FastSpr_SetClipWindow</a>
	<a href="#load">FastSpr_Load</a>
	<a href="#getaddress">FastSpr_GetAddress</a>
	<a href="#setbackdrop">FastSpr_SetBackdrop</a>
	<a href="#screenbank">FastSpr_ScreenBank</a>
	<a href="#spritesareat">FastSpr_SpritesAreAt</a>
	<a href="#readsize">FastSpr_ReadSize</a>
	<a href="#getpointer">FastSpr_GetPointer</a>

--------------------------------

<a name="plot"><h6>FastSpr_Plot</h6></a>

Plots a sprite

On Entry
 R0 = sprite number
 R1 = x coordinate
 R2 = y coordinate

On exit
 R0 corrupted
 R1, R2 preserved

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI plots a sprite to the current screen bank (see the SWI
FastSpr_ScreenBank).  The sprite number is made up as follow.

MSB
/--byte 3 --\ /--  byte 2 --  \ /-- bytes 1 and 0 --\
[sprite pool] [animation frame]    [sprite number]

So animation frame 4 of sprite 7 from pool 2 would have the number &amp;02040007.

The coordinates are in pixels from the top left.  Note that this is different
from OS cooridinates, which begin at the bottom left.  For a MODE 13 screen
the bottom right hand pixel is (319,255).  The sprite will be plotted so that
its centre is at the coordinates given (unless you choose differently with
FSPConv).

<a name="clearwindow"><h6>FastSpr_ClearWindow</h6></a>

Clears the current graphics window

On Entry

No parameters

On exit

No results

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI fills the current graphics window with the current backdrop colour. 
The action is similar to BASICs CLS, but only the FastSpr window, as set by
FastSpr_SetClipWindow, is cleared.

<a name="setclipwindow"><h6>FastSpr_SetClipWindow</h6></a>

Sets the graphics window

On Entry

R0 = minimum x coord (inclusive)
R1 = minimum y coord (inclusive)
R2 = maximum x coord (exclusive)
R3 = maximum y coord (exclusive)

On exit

Registers preserved

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI sets the current clipping window.  If you wish to use FSP2 type
files the minimum and maximum x coordinates must be multiples of 4.  For FSP1
files they may assume any value.  The clipping window must be within the
screen boundaries.  When a screen mode is selected the clip window is set to
the whole screen.  For MODE 13 this means R0=0, R1=0, R2=320, R3=256.

<a name="load"><h6>FastSpr_Load</h6></a>

Loads a sprite file

On Entry

R0 = filename
R1 = pool number

On Exit

R0 corrupted
R1 preserved

Executes in SVC mode.  Interrupt status may be altered.  SWI is not
re-entrant.

Use

This command loads a sprite file into the RMA.  The pool number is in the
range 0-&amp;3E.

<a name="getaddress"><h6>FastSpr_GetAddress</h6></a>

Returns addresses of certain routines within FastSpr.

On Entry

No parameters

On Exit

R0 = address of <a href="#plot">Plot</a> routine
R1 = address of <a href="#clearwindow">ClearWindow</a> routine
R2 = address of <a href="#screenbank">ScreenBank</a> routine

R4 = address of FastSprs variables.

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI returns addresses of useful routines within FastSpr.  You may set up
registers as for the relevant SWI and call these routines directly.  This
will save a bit of time by bypassing the operating systems SWI handler, but
will lead to problems if the RMA is tidied or FastSpr is RMKilled etc.

<a name="setbackdrop"><h6>FastSpr_SetBackdrop</h6></a>

Sets the backdrop colour

On Entry

R0 = colour 0-&amp;FF

On Exit

Registers preserved

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI sets the backdrop colour as used by <a href="#clearwindow">FastSpr_ClearWindow</a>.  R0 is the
byte value written to the screen, so the colours are identical to those shown
in the palette of Paint.

<a name="screenbank"><h6>FastSpr_ScreenBank</h6></a>

Selects the current screen bank

On Entry

R0 = bank number or address

On Exit

R0 preserved

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI sets the screen bank.  R0=0 selects bank 1, R0=1 selects bank 2
(yes, Im sorry...).  A value greater than &amp;8000 is taken to be the address
of an area of memory to be used as a screen.

<a name="spritesareat"><h6>FastSpr_SpritesAreAt</h6></a>

The old form of implementing sprite pools

On Entry

R0 = address of sprite files

On Exit

R0 preserved

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI sets the address of the sprite file in pool 0.  It should not be
used for new programs and is retained for past comptibility.

<a name="readsize"><h6>FastSpr_ReadSize</h6></a>

Return the size of a sprite

On Entry

R0 = sprite number

On Exit

R0 = x size
R1 = y size

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI returns the size of a sprite in pixels.  The sprite number is in the
same format as used by <a href="#plot">FastSpr_Plot</a>.

<a name="getpointer"><h6>FastSpr_GetPointer</h6></a>

Get the address of a sprite pool pointer

On Entry

R0 = pool number

On Exit

R0 = address of pointer

Executes in SVC mode.  Interrupt status unaltered.  SWI is re-entrant.

Use

This SWI returns the address of FastSprs pointer to the sprite file in the
specified pool.  If you wish to tell FastSpr you have loaded a sprite file
into user memory you would store its address at the address returned in R0.

Example

...load file into memory block at R1...
MOV R0,#1
SWI FastSpr_GetPointer
STR R1,[R0]

This is very easily interfaced with Amnesia.

MOV R0,#1
SWI FastSpr_GetPointer
ADR R1,filename
MOV R2,#0
SWI <a href="Amnesia:Microhelp.SWIDocs#loadfile">Amnesia_LoadFile</a>

...

.filename
DCB "FSPSprites",0

or identically

SYS "FastSpr_GetPointer",1 TO adr
SYS "Amnesia_LoadFile",adr,"FSPSprites",0

<a name="setflash"><h6>FastSpr_SetFlash</h6></a>

SetFlash was inactive in this version.

--------------

This file last updated 16/10/94 by A.Southgate.
