Quote:
|
@Fudeba:
Well, hoping that these tech info could help in done better convertions, but now i've a question for you:
zx does not have hw sprites, so sprites are managed in sw (the cpu does). In this way there is the problem of flickering: to avoid this YOU MUST MAKE SURE that the cycle used (restore background-save background-plot sprite) is performed while the raster beam is off the region you are working. In speccy i assume that (like on msx) this is pratically done in vblank. HOWEVER THERE IS an alternative. the usual backbuffer.
Do you know if speccy games make use of backbuffers almost always?
thx
|
Well, AFAIK, some yes, some no. As an example, AFAIR, Shinobi indeed does use a framebuffer... but not all games do it. in fact, I believe that no 48K spectrum game use a framebuffer, but many 128 spectrum games does use them. Besides, 128 spectrum games can even use the page 7 as page-shift framebuffer (you can select what page is displayed by ULA: page 5 or 7).
A good reason for Spectrum games using framebuffer (when there is RAM available) is the fact that Spectrum "VRAM" is not really "linear" in the sense it would be nice to work with; in fact, working directly on VRAM area is even worse than it is on MSX. Video memory in Spectrum follow this distribution:
4000h - 32 bytes that forms the line 0
4020h - 32 bytes that forms the line 8
4040h - 32 bytes that forms the line 16
4060h - 32 bytes that forms the line 24
4080h - 32 bytes that forms the line 32
40A0h - 32 bytes that forms the line 40
40C0h - 32 bytes that forms the line 48
40E0h - 32 bytes that forms the line 56
4100h - 32 bytes that forms the line 1
4120h - 32 bytes that forms the line 9
...
and so on. And the screen is divided in 3 thirds also, meaning that 4800h is the start of the
sequence 4800h - 32 bytes that forms the 64 line...
As you can see, data is arranged in a very complex way, and there is a calculation to be done every
line to be changed. When using a framebuffer, usually the framebuffer is built in a straight linear fashion
(32 bytes for the first line, 32 bytes for the second line, 32 bytes for the third line...) and the computation
is needed only once per line, and the transfer is done with a sequence of 32 LDIs and a INC H and a
LD L,0 (this is done 8 times and then the original address usually in HL) is popped and incremented in
one... and the whole process is repeated 8 times.
This is a lot faster than plotting shapes directly on the VRAM (specially if one piece of the shape is
placed in one third of the screen and other piece of the shape is placed in other third of the screen).
Some 128 games adapted for MSX where changed to write its (linear) framebuffer on the
4000h~5B00h area ... and then this data is converted "on-the-fly" while is OUT to the VDP. Games
that do OUT directly (without framebuffer) usually has a conversion function that gets the "virtual
line" and convert to the correct address to plot on Spectrum VRAM. When those games are
converted to MSX, this function is rewritten to reflect the correct address in MSX VRAM.
Of course there are much more ways of doing these things, but I believe these too are the
most common ones (considering what I had already seen when modifying converted spectrum
games).