English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Asm / Hardware (https://eab.abime.net/forumdisplay.php?f=112)
-   -   what could cause this sprite corruption (https://eab.abime.net/showthread.php?t=101626)

jotd 07 April 2020 23:39

what could cause this sprite corruption
 
1 Attachment(s)
I'm trying to fix a game (Oscar).

Using SPS 1228 (ECS, 2 disks) with WinUAE quickstart A500

When using cycle exact (full), all is okay

But when not using cycle exact (which is the default), character sprite sometimes is shifted to the bottom with a corrupt first graphics line (white pixels like morse code)

Attachment 66739

Looks like a timing issue. Copperlist has a copper jump for double buffering probably, switched in vertical blank. Could it be because sometimes there's extra processing in vblank before the switch?

I don't understand why this is happening: sprite control word is okay (else sprite would be somewhere else), and data aren't changed either (note: this is a composite sprite with 4 sprites, note that the corrupt pattern is doubled, on 2 or 4 sprites composing both halves of the character)

The same issue happens in the AGA version, but in the underwater levels, just when a sound is played (so extra CPU used) a trashed pixel line appears and character is shifted down by 1 pixel...

dlfrsilver 08 April 2020 00:57

Quote:

Originally Posted by jotd (Post 1390315)
I'm trying to fix a game (Oscar).

Using SPS 1228 (ECS, 2 disks) with WinUAE quickstart A500

When using cycle exact (full), all is okay

But when not using cycle exact (which is the default), character sprite sometimes is shifted to the bottom with a corrupt first graphics line (white pixels like morse code)

Attachment 66739

Looks like a timing issue. Copperlist has a copper jump for double buffering probably, switched in vertical blank. Could it be because sometimes there's extra processing in vblank before the switch?

I don't understand why this is happening: sprite control word is okay (else sprite would be somewhere else), and data aren't changed either (note: this is a composite sprite with 4 sprites, note that the corrupt pattern is doubled, on 2 or 4 sprites composing both halves of the character)

The same issue happens in the AGA version, but in the underwater levels, just when a sound is played (so extra CPU used) a trashed pixel line appears and character is shifted down by 1 pixel...

an A500 is cycle exact. Not cycle exact doesn't exist on real hardware ;)

jotd 08 April 2020 10:02

yeah, but it means that on another machine (A1200, A4000 ...) the bug will appear. Games usually don't need cycle exact to run, and when they do, we have to fix them for whdload.

Galahad/FLT 08 April 2020 11:04

The sprite data change is that via CPU or Blitter?

Toni Wilen 08 April 2020 11:34

If only sprite has corruption: it isn't going to be copper list double buffer related or lots more than single sprite would get corrupted.

Most likely CPU is doing some direct sprite register copper list or sprite coordinate or sprite data modifications too late or too early.

jotd 08 April 2020 16:18

I could fix it by removing the COPJMP just after switching the copperlist in vblank

Code:

00C0C454 23f9 00c2 ff0e 00df f080 MOVE.L $00c2ff0e [0007664c],$00dff080
00C0C45E 4279 00df f088          CLR.W $00dff088

The vblank seems to process a lot of stuff, rework copperlist, etc... before setting it, and resetting the copper pointer with the CLR.W instruction.

Doing this fixes the sprite issue, but all the rest (bobs) are flickering. Seems that it breaks double buffering...

Toni Wilen 08 April 2020 16:38

Perhaps above code runs after line that does first sprite DMA fetches (25 in PAL) and if CPU is faster, it runs early and updates sprite pointers too early.

It would be quite strange way to handle sprites, loads sprite control words from previous copper list but sprite data from pointers loaded by new copper list :)

jotd 08 April 2020 17:05

I'm not going to worry about that now. I investigated this after I had a similar problem while doing the whdload patch, only when sound was played.

It appears that we delay sound play using vpos wait, and not doing this trashes the sound but fixes the sprite issue!

Seiya 08 April 2020 17:09

i tried Oscar SPS on A500 Quickstart with WinUAE 4.2.1 without cycle exact and sprite is perfect
https://i.ibb.co/3s5TGcY/oscar-glitches.png

jotd 08 April 2020 18:15

got 4.3.1 beta here.

Toni Wilen 08 April 2020 18:32

I wouldn't trust that version too much yet..

Also changelog explains another (more likely) reason that almost guarantees different timing in non-ce 68000 modes compared to old versions. In non-ce mode 68000 cycle counting was mostly approximate. Now it is fully accurate. (It means: if program runs in fast ram and it never accesses chip ram, both ce mode and non-ce 68000 will have 100% exact same timing.)

jotd 08 April 2020 19:15

Don't worry Toni. I fixed the sprite glitch that occurred on very fast configurations (and is probably related to that one).

To fix CPU-dependent loop on audio DMACON writes; we had inserted VPOS loops. I think we overdid it too much and when the "bubble" sample was played, it slowed down the main loop too much and it desynced the sprite refresh. Why did that happen on fast configs I don't know. Probably because in that case, vblank runs faster than expected.

Reducing the VPOS loops (still checking that audio was playing okay with winuae using chip hack to trash audio on purpose) just a little bit fixes the sprite issue...

Torti-the-Smurf 09 April 2020 11:52

HA, you make a WHDLoad Installer for Oscar ECS ?
Sweeeeet :spin I was waiting for this, hehe :) Yes the game is, well say, not the best ;) ..... but still

Thank you JODT and all WHDLoad installer creators :bowdown

jotd 09 April 2020 12:50

yes, Oscar ECS is completed now :) Waiting for Wepl to update whdload page.

This is really a colorful platformer with 7 levels & bonuses, water/mirror effects, etc.... This is huge. I think the gameplay is too boring which explains people don't like it too much.

I added trainer features like:

- instant kill of enemies (instead of 3 times, suggested by Hexae, nice idea)
- find the clapperboard => end of level (this is too much of a cheat)
- second button jump

I couldn't cancel the annoying respawn easily though.

Torti-the-Smurf 10 April 2020 13:06

AWESOME, this makes Oscar "almost" playable. The 3 hit kills of the Original where always ridiculous.:o , so youre improvements really helps this game :great

Sure, Jumping and runnings feels as bad as always but that is not youre fault.

To be fair to Flair , its technically well made, so i am really happy to see Oscar on my A600 :) The Second Button option dosent work for me (Mega-Drive Pad) .
Huge Thanks to Jotd for the Installer :great

jotd 10 April 2020 14:00

> The Second Button option dosent work for me (Mega-Drive Pad):

damn. I have to dig out my old joysticks & test. Pad has more than 2 buttons. Are you sure one of the buttons doesn't match the amiga second button? because 2 button joysticks are also designed for sega.

Torti-the-Smurf 10 April 2020 18:51

The C Button on the Mega Drive Joypad works normally just like the 2nd button, but it dosent work with the Oscar Ecs slave.

jotd 10 April 2020 19:16

I happen to have a sega quickjoy with lots of buttons. Going to test that.


All times are GMT +2. The time now is 10:04.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05256 seconds with 11 queries