MEGA65 / mega65-core

MEGA65 FPGA core
Other
238 stars 84 forks source link

VIC-IV character attribute issues with upper palette ("bold") set #715

Closed dansanderson closed 1 month ago

dansanderson commented 11 months ago

Test Environment (required) You can use MEGA65INFO to retrieve this.

Describe the bug There are two issues with rendering character attributes when the upper palette ("bold") attribute is set (bit 6):

The latest ROMs use the reverse attribute to render the cursor, so this is a usability issue with the upper palette. Ideally this would be fixed in the core instead of rolling back the way the cursor is rendered. https://github.com/MEGA65/mega65-rom-public/issues/56

To Reproduce Here's a rendering of all 16 attribute combinations across 16 color values:

10 print "{clr}";
20 for y=0 to 15
30 print "abcdefghijklmnop ";y
40 for x=0 to 15
50 poke $1f800+y*80+x,y*16+x
60 next x
70 next y

Expected behavior Line 5 should blink between upper palette and background color.

Line 6 should be reversed.

Line 7 should blink between reversed and not reversed, both in the upper palette, similar to line 3.

Line 13 should blink between underlined and not underlined, both in the upper palette, similar to line 9.

Line 14 should be reversed. (Presumably it is correct for reverse + underline to appear simply reversed.)

Line 15 should blink between reversed and not reversed, both in the upper palette, similar to line 7. (Presumably it is correct for reverse + underline to appear simply reversed.)

Screenshots First blink state: blink1

Second blink state: blink2

Program listing: listing

dansanderson commented 11 months ago

To summarize the proposed change to the VIC-III character attribute bits:

  1. Bit 6: select the upper palette. This bit is documented as "bold" for the C65, but it does not have a bold text effect.
  2. Bit 6 + bit 4 (blink): blink between upper palette and empty character, similar to the lower palette (bit 4 on, bit 6 off).
  3. Bit 6 + bit 5 (reverse): reverse the character, in the upper palette.
  4. Bit 6 + bit 4 + bit 5: blink between reverse and non-reverse, both in the upper palette.
  5. Bit 6 + bit 7 (underline): underline the character, in the upper palette.
  6. Bit 6 + bit 7 + bit 4 (blink): blink between underline and non-underline, both in the upper palette.
  7. Bit 6 + bit 7 + bit 5 (reverse), bit 4 off or on: same as if bit 7 is off (reverse overrides underline).

These changes intend to make the upper palette function similarly to the lower palette with regard to the other attributes. A mode that blinks between the two palettes is far less useful than blinking an alternate color character off and on.

This keeps the current behavior of blink + either reverse or underline causing the reverse or underline attribute to blink instead of blinking the entire character on and off. This is consistent with the current implementation for the lower palette.

I notice that viciv-modes.md claims that the upper palette is only used for bit 6 + bit 5, implying that there is no way to reverse the character when the upper palette is selected. This does not match the current implementation, and I assume this was overridden such that bit 6 alone represents the upper palette. I agree with this decision and assume the document just needs to be updated.

dansanderson commented 5 months ago

This is fixed in release v0.96.