MEGA65 / mega65-rom-public

MEGA65 ROM public issue reporting
4 stars 0 forks source link

VSYNC less than 6 hangs in NTSC mode #131

Closed dansanderson closed 4 months ago

dansanderson commented 4 months ago

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

Describe the bug In PAL video mode, VSYNC accepts a value between 0 and 311, and returns an Illegal Quantity Error for values out of range.

In NTSC video mode, VSYNC accepts a value between 0 and 262, and returns an Illegal Quantity Error for values out of range. However, for values 0-5 and 262, the command hangs.

To Reproduce Use the Freezer to switch to NTSC video mode, then:

10 VSYNC 5
RUN

Expected behavior Ideally, VSYNC would support (and not hang for) values down to 0 in both video modes. I don't have a personal preference for what the bottommost line is numbered, but it's a little odd that a program can't VSYNC 0 reliably in both modes.

VSYNC busy-waits on the VIC-II raster position register. Presumably this bug is caused by this register never reaching the affected values in NTSC mode. If the core can't be pleasantly fixed to support this value range for this register, it'd be an improvement for the ROM to reject the unsupported values with the Illegal Quantity Error, and to document the range per mode.

dansanderson commented 4 months ago

This is the cause in the core: https://github.com/MEGA65/mega65-core/issues/362

As above, we should either fix in the core, or code around it in VSYNC.

dansanderson commented 4 months ago

Workaround implemented: https://github.com/MEGA65/mega65-rom/commit/89f7337663a13142c6e00d6018640e222ee50685

The workaround can be removed when the core is fixed.