naTmeg / ScriptedAmigaEmulator

Amiga Emulator in javascript and HTML5
331 stars 63 forks source link

CLXDAT sprite / playfield collision bits #31

Closed dirkwhoffmann closed 5 years ago

dirkwhoffmann commented 5 years ago

Hi Rupert,

to implement collision detection in vAmiga, I’ve started by adding new test cases to vAmiga's test case repo at:

https://github.com/dirkwhoffmann/vAmigaTS

I’ve compared SAE with UAE and found out that test

vAmigaTS/Denise/Sprites/collision1/

fails in SAE. To reproduce, set collision detection in xAE to „full“.

UAE:

Bildschirmfoto 2019-08-06 um 10 31 43

SAE:

Bildschirmfoto 2019-08-06 um 10 13 34

The test draws two sprites and uses the vSync interrupt to transfer bit-chunks from CLXDAT to color registers 0 to 3. Hence, different bit patterns in CLXDAT cause the test image to be colorised differently.

In SAE, CLXDAT has value 0x83FF which is wrong in the lower 8 bits. E.g., SAE detects collisions with sprites 4 and 6, but only sprite 0 and sprite 2 are drawn.

It's a minor issue though, because collision detection is rarely used on the Amiga.

naTmeg commented 5 years ago

Hi Dirk,

thanks for this nice report! I've fixed that and will sync it with the next release.