Writing multiple VSRAM values per scanline

SGDK only sub forum

Moderator: Stef

Post Reply
Joe Musashi
Interested
Posts: 17
Joined: Sat Oct 13, 2018 10:08 pm

Writing multiple VSRAM values per scanline

Post by Joe Musashi » Sat Jan 23, 2021 11:58 pm

I've been experimenting with writing multiple values to VSRAM in the HInt routine each line in order to set vertical scroll values for a number of two-tile columns.

In the example shown here, this is used to generate a fake transparent highlight bar by setting the vertical scroll value to select a specific brightness level per line. (In the Gens VDP Plane Explorer you can see the different versions of the SEGA logo.) If we are in two-tile scrolling mode, we can exploit this to tilt the highlight bar a little.

This example looks OK in emulators, I have also tested it on real hardware on a PAL MegaDrive 1. It would be great if other could try it on different machines and let me know it works or if it flickers ;) Binary and source can be found in the attached ZIP file.

Thanks!

SEGA.png
SEGA.png (3.14 KiB) Viewed 6355 times
PlaneExplorer.png
PlaneExplorer.png (15.75 KiB) Viewed 6355 times
Attachments
VScrollExperiments.zip
(34.32 KiB) Downloaded 231 times

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: Writing multiple VSRAM values per scanline

Post by ob1 » Mon Jan 25, 2021 8:00 am

I'm not sure that I understood everything,
but I have played a few times with HInt, and I must say this rock stable image is great.
Bravo for this piece of work.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Writing multiple VSRAM values per scanline

Post by Stef » Mon Jan 25, 2021 1:12 pm

Well done, very nice trick to do animated reflection :)
How much of the VSRAM table you transfer per line ? here you don't need to transfer the whole table (and i guess that's not possible) ?

Joe Musashi
Interested
Posts: 17
Joined: Sat Oct 13, 2018 10:08 pm

Re: Writing multiple VSRAM values per scanline

Post by Joe Musashi » Tue Jan 26, 2021 7:51 pm

Thanks ob1 and Stef!

Yes, the transfer is limited to 6 values (the logo is 96 pixels wide). I had to use some inline assembly and a lot of trial and error to get there. I haven't done any cycle counting, but I don't think it can be much more.

One could try to move the HInt code to Sega.s, or maybe use an exactly timed loop instead of an interrupt (like on an Atari 2600).

Post Reply