TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: FERNANDO ARIEL GONT
date: 1998-03-05 05:34:00
subject: Vertical retrace / sprites

Hullo All , hope you are having a nice day!!
Well, I made three routines to use sprites:
One of them saves a block of pixels to a buffer.
Other puts the sprite on the screen.
And the other restores the contents of a buffer on the screen.
To avoid "snow" (or "flicker"), I waited for the vertical retrace.
I read that there are two "techniques" to do it:
One:
%%%
* Wait until bit 3 of port 3dah is 1
* Then wait until the bit 3 of port 3dah is 0h
* Now, you can work "safely" with the video memory.
Two:
%%%
* Wait until the bit 3 of port 3dah is 0h
* Now, you can work "safely" with the video memory.
Well, and I have read that the difference between them is that in the first
one you're sure that you'll begin working on the screen just after the
vertical retrace has begun.
In the second one, it's possible that you'll get "caught", and there might
be "snow" (or "flicker") on the screen.
At first, I used the first method, but it was too slow on my P120.
Then, I used the second method, but I get "snow" (or "flicker") on the
screen....
What should I do?
In the next three messages I'll post the three routines I've made.
Just a few comments:
They work in a very similar way.
"putsprite" reads each of the sprite's pixels, and if they aren't equal to
00h, they are copied to the video memory.
"saveblock" will get the x and y coordinates, and the number of rows and
columns, and will copy this block to a buffer specified by the user.
"restoreblock" does the opposite: it copies the contents of a buffer to the
video memory.
Note: I only use *byte* moves and *not* word or dword moves, because the
routine is intended to work on any size of sprite.
The format of the sprite is quite simple: a matrix of 32*32 bytes, each of
them is the color code of the pixel.
That means that the first byte of the sprite will hold the color code of
its first pixel, and the last byte will hold the color code of the last
pixel of it.
In fact, it needn't be a 32*32 matrix, as I've made the routine to work on
any size of sprite (up to 256*256 (256 colors)).
If you want me to post an example of the sprite, just ask me....
I wish you criticized my code, so that I could improve it....
 -=> Yours sincerely, Fernando Ariel Gont <=-
e-mail: FGont@siscor.bibnal.edu.ar
e-mail "Good Stuff!" _*Magazine*_ : gstuff@siscor.bibnal.edu.ar
FidoNet: 4:900/470.10
Sk-Network (Argentina): Murdock's Point (200:201/300.27)
--- Terminate 5.00 UnReg(142)
---------------
* Origin: This point doesn't suck!! (4:900/470.10)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.