home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Really Useful CD 1
/
ReallyUsefulCD1.iso
/
extras
/
progutils
/
spiteplot
/
text
< prev
Wrap
Text File
|
1990-06-16
|
3KB
|
63 lines
FASTPLOT
The fastest way ever to plot 2D sprites in mode 13!!!
Author : Eirik Hansen
Where : Industriveien 12
: 8500 NARVIK
: Norway
:
: #440 at Arcade
When : About a year ago
The procedures given in the BASIC program FastPlot yield the fastest
possible code to plot 2D-sprites in mode 13. You need to:
- load the relevant sprite into memory at a prepared site of the
appropriate size.
--- In=OPENIN "SpriteName"
--- Ext%=EXT#In
--- DIM WhereSpriteIsLocated Ext%
--- CLOSE#In
- know the height and width of the sprite.
- then call PROCMakeFastMC(WhereSpriteIsLoaded%,Width%,Height%),
where the variable names should be self explanatory.
The procedures will then generate code according to the shape of the sprite.
Black colour is treated as a mask. It`ll not be the shortest code, but shure
the fastest one. ( At least on an ARM2. )
Usually the code will be much shorter than the size of the sprite, but when
a very complex sprite is 'compiled' the code might be longer.
The code generated will only cope with plotting at 4 bytes intervals. So if
you need to plot at a higher resolution you in fact need to shift the sprite
right one byte (this can be done by hand using !Paint or similar apps.), and then call the routine again with the new sprite.
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
code is generated.
You need to know the height and width of the sprite before calling
PROCMakeFastMC(). I haven`t bothered to dissect how sprites are stored at
disc\memory on the Arc, but if you have the relevant know-how it should be
possible to modify this routine to just input the sprite name (or number).
To plot the sprite you first load the address of where the sprite is in
memory into R1, and the address on screen where you want it put, in R0.
Then call the code generated.
Eg .
.
ADR R1,TheAddressOfSpriteInMemory
ADR R0,TheScreenAddressYouWantItPut ;At word boundary
BL (The code generated)
.
.
Hope the routine will be helpfull and a time-saver for someone out there.
Eirik
NOTE The procedures given will only generate code for sprites not wider than
120 pixels.