lgblgblgb / xemu

Emulations (running on Linux/Unix/Windows/macOS, utilizing SDL2) of some - mainly - 8 bit machines, including the Commodore LCD, Commodore 65, and the MEGA65 as well.
https://github.com/lgblgblgb/xemu/wiki
GNU General Public License v2.0
201 stars 31 forks source link

MEGA65: VIC-IV (alt-)palette related issues #402

Open lgblgblgb opened 3 months ago

lgblgblgb commented 3 months ago

_Mirage_BD_ on Discord has some very useful observations (thanks!) in terms of bugs in Xemu's VIC-IV emulation. This issue stands here as a reminder for me not to forget these and also as a place to discuss further this (these) issues.

The thread on Discord: https://discord.com/channels/719326990221574164/781481205639020554/1249020115085955123

Test program: megajpg.d81.zip

The highlights (so far):

The good: MEGAJPG seems to work (compared to 2023/July/2 state) basically

image1

The bad: ... however the file selector has a strange red background which was not the case before:

image2

His suggestion:

if bold and reverse both need to be set, shouldn't SXA_ATTR_ALTPALETTE(cw) in vic4.h be this: #define SXA_ATTR_ALTPALETTE(cw) (((cw) & 0x0060) == 0x0060) instead of just ((cw) & 0x0060) [...] Just had another look at it, and the other thing you'll have to change is line 1474 of vic4.c: const Uint32 *palette_now = ((REG_VICIII_ATTRIBS) && SXA_ATTR_ALTPALETTE(color_data)) ? altpalette : used_palette; The change being the extra check for REG_VICIII_ATTRIBS... The alternate palette only has to be selected if bold+reverse and vic3-attribs are enabled. That with the fix for the #define fixes all the issues in my programs.

And the ugly: bad border colour?

Unknown if there is anything related to the previous topic here, or something independent as a bug. Xemu currently does this, when it needs to render border colour: palette[REG_BORDER_COLOR]. Maybe this should be done?

used_palette[REG_BORDER_COLOR]

_Images got from Discord and were taken by Mirage_BD._