dirkwhoffmann / vAmiga

vAmiga is a user-friendly Amiga 500, 1000, 2000 emulator for macOS
https://dirkwhoffmann.github.io/vAmiga
Other
293 stars 24 forks source link

Sprite bug in Elfmania #750

Closed dirkwhoffmann closed 1 year ago

dirkwhoffmann commented 1 year ago

Reported by @chris70c: Colors of the player sprite are wrong and part of the score and health bar are missing.

image

X-ray:

Bildschirm­foto 2022-11-13 um 17 43 51
dirkwhoffmann commented 1 year ago

The Copper list reveals what I've expected: Sprites are created on-the-fly by the Copper. Hence, it's most likely a sprite register timing issue.

Bildschirm­foto 2022-11-13 um 21 05 57

TODO:

mras0 commented 1 year ago

Probably related to this comment in WinUAE:

SPRxDATA and SPRxDATB is moved to shift register when SPRxPOS matches. When copper writes to SPRxDATx exactly when SPRxPOS matches:

  • If sprite low x bit (SPRCTL bit 0) is not set, shift register copy is done first (previously loaded SPRxDATx value is shown) and then new SPRxDATx gets stored for future use.
  • If sprite low x bit is set, new SPRxDATx is stored, then SPRxPOS matches and value written to SPRxDATx is visible.
  • Writing to SPRxPOS when SPRxPOS matches: shift register copy is always done first, then new SPRxPOS value is stored for future use. (SPRxCTL not tested)

Here's a small test that shows a difference for SPRxPOS: sprxpos.zip. There should be a striped rgb pattern in the middle of the screen, but the screen is blank in vAmiga. As a hack you can add 1 to pos in Denise::pokeSPRxPOS to make it show up.

dirkwhoffmann commented 1 year ago

For reference: sprxpos.exe on my Amiga 500 (ECS, 68010):

IMG_4752

dirkwhoffmann commented 1 year ago

Fixed. The error was due to what @mras0 expected: Timing of SPRxPOS.

Bildschirm­foto 2022-11-15 um 17 40 54 Bildschirm­foto 2022-11-15 um 17 41 12

Relevant new regression tests for this issue:

Denise/Sprites/timing/sprtimpos1
Denise/Sprites/timing/sprtimctl1
Denise/Sprites/timing/sprxpos

Test sprtimctl1 has shown that timing of the SPRxCTL register needed the same adjustment.

There are two more new tests:

Denise/Sprites/timing/sprtimdat1
Denise/Sprites/timing/sprtimdat2

They show that SPRxDATA and SPRxDATB have no issues in the old and the new code.

dirkwhoffmann commented 1 year ago

Fixed in v2.2b1