home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Falcon 030 Power 2
/
F030_POWER2.iso
/
ST_STE
/
MAGS
/
ICTARI07.ARJ
/
ictari.07
/
ASSEMBLY
/
SPRITES
/
SPR_INIT.DOC
< prev
next >
Wrap
Text File
|
1993-09-03
|
3KB
|
61 lines
SUB-ROUTINE NAME sprite_init
BRIEF DESCRIPTION Load sprite file and initialise table
FILENAME SPRITE.S
OTHER RESOURCES
LANGUAGE Assembler (Devpac)
AUTHOR Peter Hibbs
ENTRY PARAMETERS 'sprite_file' string holds pathname for file
EXIT PARAMETERS (screen) holds screen start address
(sprite_tab..) holds sprite look-up table
(sprite_data..) holds sprite data
(sprite_mask..) holds sprite mask data
various registers changed
d0.L=0 if file loaded OK or neg value if not
DETAILS -
This routine should be called near the start of the program and before
any sprites are displayed. It fetches the start address of the screen and
stores it in (screen). It then loads the sprite file data from disk
(using the filename defined in the sprite_file string) and stores it in
the 'sprite_data' buffer which should be defined in the data area of the
source code. Make sure the buffer is large enough to store the file data
and place the sprite data file in the same directory as the program. The
routine then generates a look-up table of addresses for each sprite data
block and automatically generates a mask data block for each sprite which
is required by the sprite display routines. A mask_buffer should be
defined which is one quarter the size of the data buffer, the sprite data
requires 4 planes whereas the mask only requires one plane. Another
buffer, sprite_tab, should also be defined for the sprite look-up table,
the size of this should be 16 times the number of sprites in the file as
each sprite block uses 16 bytes. If the m_sprite routine is to be used
another temporary buffer (spr_buffer) should also be defined, see the
m_sprite data sheet for further information.
Although the programmer does not need to know the layout of this table to
use the routine, the information is shown below for reference purposes.
sprite 1 width of sprite in bytes 1 word
height of sprite in lines 1 word
x offset value 1 word
y offset value 1 word
sprite data address 1 longword
sprite mask address 1 longword
sprite 2 as above
..
sprite n as above
On return from the routine, register d0.L should be tested for an error
code which is generated by the file handling BIOS calls. If d0 is
negative an error occurred, the negative value will indicate the type of
error. A typical example code is shown below -
bsr sprite_init set up table and buffers
tst.l d0 check for error
bmi error_label branch if load error
.. ..
sprite_file dc.b 'SPRITES.OBJ',0
even