MEGA65 / mega65-core

MEGA65 FPGA core
Other
239 stars 84 forks source link

1351 (and MouSTer attached other mouses) exhibit jumps #694

Closed gardners closed 1 year ago

gardners commented 1 year ago

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

Describe the bug Using a 1351 (or MouSTer connected USB mouse) works fine, except that it jumps at regular intervals by about 32px. This is because the POT input is reading the 1351 as range ~ $00-$60, instead of ~$00-$7F.

To Reproduce Steps to reproduce the behavior:

  1. Plug in 1351 mouse (not Amiga mouse with 1351 emulation enabled, as that doesn't use the POT lines)
  2. Load something that uses the mouse, and doesn't have a driver that compensates for this hardware bug, e.g., Mirage_BD's mod player / MEGAui examples.
  3. Move mouse smoothly and you will observe the big jumps periodically. It is basically impossible to move the mouse cursor into the jumped regions.

Expected behavior Mouse moves smoothly without skipping large slabs of the screen

Screenshots Schnapps hasn't been ported to the MEGA65, and have no shot glasses, so no screen shots available

Additional context The root cause looks to be that mouse_input.vhdl is so old it assumes CPU clock of 50MHz instead of 40.5MHz, which means that it counts too slowly (40.5MHz / 50 = 0.81MHz), which means that when it is counting the POT line up/down time on a 1351 type device that asserts the pot line after a carefully timed value, will be mis-read. This is stopping the full range of values being read.

Since we see $60 instead of $80, fixing this slow counting should increase this to $60 x 50/40.5 = $76 or so, which hopefully will be enough. If not, further investigation will be required.

gardners commented 1 year ago

Confirmed fixes bug in MIRAGE_BD's mod player and via testing of PEEKing the POT lines and also MOUSE ON command in BASIC65. Should be back-ported to development