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 glyph trimming issues vs. PolyMega #377

Closed lgblgblgb closed 1 year ago

lgblgblgb commented 1 year ago

PolyMega intro seems to produce(d) empty screen on Xemu. Initial guess was a DMA problem, but it turned out to be a glyph-trimming issue. It's a bit unclear for now, if it's not problematic on MEGA65 either (ie, compared to the document at least!).

Round-1

Author of PolyMega (Mirage_BD) looked into the issue, and suggested a solution as can be seen in commit f80a4f3bbc478920c03cbe233452a6ac8045c420 Discord discussion: https://discord.com/channels/719326990221574164/1043843197803175976/1113091458556252243

The change was relative simple:

change this:

const Uint8 glyph_trim = SXA_TRIM_RIGHT_BITS012(char_value) + (SXA_TRIM_RIGHT_BIT3(color_data) ? 8 : 0);

to this:

const Uint8 glyph_trim = SXA_TRIM_RIGHT_BITS012(char_value);

It seemed, that the bit3 stuff is mostly ignored by MEGA65 even if it's in contradict with the documentation. This change fixed PolyMega to also work on Xemu/MEGA65.

Round-2

It turned out that a fix above breaks trimming in NCM mode though. Discussion on Discord: https://discord.com/channels/719326990221574164/781481205639020554/1113877474292551690 commit is: 368a7c3c8fd6a702a0043edb886abfc37b69bd93

This change idea from Mirage_BD suggested this line instead:

const Uint8 glyph_trim = SXA_TRIM_RIGHT_BITS012(char_value) + ((SXA_TRIM_RIGHT_BIT3(color_data) & (SXA_4BIT_PER_PIXEL(color_data)>>1)) ? 8 : 0);

Conclusion

This, it should be tested, if it's really OK in all cases for now. Also there are at least one trimming related other issue, though, I think, it's unrelated to our topic here: #373

@hernandp If you have some time, and willpower, would you have a look on this, if the "round-2" is OK in general according to you as well? Thanks a lot!

lgblgblgb commented 1 year ago

Closing it for now ...