Skip to content

Commit

Permalink
MEGA65: H640 mustn't limit used bitplanes #421
Browse files Browse the repository at this point in the history
Probably because of C65 limitation, MEGA65 emulation still had the limit
of used bitplanes to max 4 when H640 feature is used. I guess it was an
accident after the C65/MEGA65 emulation target split in Xemu near the
year of 2021 or so. However it results corrupted screen now when more
than 4 bitplanes (and/or other than the first 4)  are used with H640 bit
set.
  • Loading branch information
lgblgblgb committed Jan 26, 2025
1 parent 7a41cd4 commit e46f2bb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions targets/mega65/vic4.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2024 LGB (Gábor Lénárt) <[email protected]>
Copyright (C)2016-2025 LGB (Gábor Lénárt) <[email protected]>
Copyright (C)2020-2022 Hernán Di Pietro <[email protected]>
This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -1337,7 +1337,6 @@ static XEMU_INLINE void set_bitplane_pointers ( void )
// Render a bitplane-mode character cell row
static XEMU_INLINE void vic4_render_bitplane_char_row ( const Uint32 offset, const int glyph_width )
{
const Uint8 bpe_mask = vic_registers[0x32] & (REG_H640 ? 15 : 255);
for (float cx = 0; cx < glyph_width && xcounter < border_x_right; cx += char_x_step) {
const Uint8 bitsel = 0x80 >> ((int)cx);
*(current_pixel++) = palette[(( // Do not try this at home ...
Expand All @@ -1349,7 +1348,7 @@ static XEMU_INLINE void vic4_render_bitplane_char_row ( const Uint32 offset, con
((*(bitplane_p[5] + offset) & bitsel) ? 32 : 0) |
((*(bitplane_p[6] + offset) & bitsel) ? 64 : 0) |
((*(bitplane_p[7] + offset) & bitsel) ? 128 : 0)
) & bpe_mask) ^ vic_registers[0x3B]
) & vic_registers[0x32]) ^ vic_registers[0x3B]
];
is_fg[xcounter++] = (*(bitplane_p[2] + offset) & bitsel);
}
Expand Down

0 comments on commit e46f2bb

Please sign in to comment.