X16Community / vera-module

Versatile Embedded Retro Adapter
MIT License
13 stars 5 forks source link

For L0 and L1: palette offset bit 7 is OR-ed with T256C (in 2bpp, 4bpp and 8bpp mode) #23

Closed visual-trials closed 7 months ago

visual-trials commented 7 months ago

For L0 and L1: palette offset bit 7 is OR-ed with T256C (in 2bpp, 4bpp and 8bpp mode)

This allows for certain effects like creating "underwater effects": at a specific line interrupt this bit is can be set which switches all colors in all tiles to a different palette (like monochrome blue-ish colors). More usages can be thought of. These include (fast global or screenbar) color changes for

Its a very simple change with little cost.

LUT cost: LUT usage goes from 5012 to 5015, so +3 LUTs. So very minimal. (Place and Routing) Timing analysis shows no issues.

This idea was originally suggested by fearlabsaudio in Discord. See here for discussion (scroll up for history): https://discord.com/channels/547559626024157184/549247967945687071/1175531621760368660

MooingLemur has implemented this feature in the emulator.

Here is an example of the water effect running on this version of the emulator: https://github.com/X16Community/vera-module/assets/17767704/36edffa9-395b-4a1a-a94f-62ba299c75e4

This was also tested on real hardware: https://discord.com/channels/547559626024157184/549247967945687071/1175565800376119366

After running several programs there doesnt seem to be anything broken. https://discord.com/channels/547559626024157184/549247967945687071/1175682555186520156


Several other kinds of logic have been proposed, but this implementation is both simple and cheap (cost is actually zero LUTs for the logical change and 3 LUTs for changing the version number of VERA):

In all it seems like a nice little feature that is basicly free. It fits in the spirit of VERA and feels like a good addition to it.

mooinglemur commented 7 months ago

MooingLemur has implemented this feature in the emulator.

Currently in only my fork. After discussion and approval here, I'll submit those features to x16-emulator and Box16

catmeow72 commented 7 months ago

If and when this is merged or closed, make sure to notify me on Discord (Foxwoof on the Discord server) so I can convert my draft PR for the documentation to a regular PR, or close it.