English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 07 April 2020, 23:39   #1
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
what could cause this sprite corruption

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)

Click image for larger version

Name:	sprite_bug.PNG
Views:	277
Size:	3.9 KB
ID:	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...
jotd is offline  
Old 08 April 2020, 00:57   #2
dlfrsilver
CaptainM68K-SPS France
 
dlfrsilver's Avatar
 
Join Date: Dec 2004
Location: Melun nearby Paris/France
Age: 46
Posts: 10,414
Send a message via MSN to dlfrsilver
Quote:
Originally Posted by jotd View Post
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
dlfrsilver is offline  
Old 08 April 2020, 10:02   #3
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
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.
jotd is offline  
Old 08 April 2020, 11:04   #4
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,988
The sprite data change is that via CPU or Blitter?
Galahad/FLT is offline  
Old 08 April 2020, 11:34   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,510
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.
Toni Wilen is offline  
Old 08 April 2020, 16:18   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
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...

Last edited by jotd; 08 April 2020 at 16:26.
jotd is offline  
Old 08 April 2020, 16:38   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,510
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
Toni Wilen is offline  
Old 08 April 2020, 17:05   #8
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
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!
jotd is offline  
Old 08 April 2020, 17:09   #9
Seiya
Registered User
 
Seiya's Avatar
 
Join Date: Nov 2014
Location: Italy
Posts: 2,353
i tried Oscar SPS on A500 Quickstart with WinUAE 4.2.1 without cycle exact and sprite is perfect
Seiya is online now  
Old 08 April 2020, 18:15   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
got 4.3.1 beta here.
jotd is offline  
Old 08 April 2020, 18:32   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,510
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.)
Toni Wilen is offline  
Old 08 April 2020, 19:15   #12
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
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...
jotd is offline  
Old 09 April 2020, 11:52   #13
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
HA, you make a WHDLoad Installer for Oscar ECS ?
Sweeeeet 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
Torti-the-Smurf is offline  
Old 09 April 2020, 12:50   #14
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
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.
jotd is offline  
Old 10 April 2020, 13:06   #15
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
AWESOME, this makes Oscar "almost" playable. The 3 hit kills of the Original where always ridiculous. , so youre improvements really helps this game

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
Torti-the-Smurf is offline  
Old 10 April 2020, 14:00   #16
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
> 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.
jotd is offline  
Old 10 April 2020, 18:51   #17
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
The C Button on the Mega Drive Joypad works normally just like the 2nd button, but it dosent work with the Oscar Ecs slave.
Torti-the-Smurf is offline  
Old 10 April 2020, 19:16   #18
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
I happen to have a sega quickjoy with lots of buttons. Going to test that.
jotd is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
FastATA Corruption stevelord support.Hardware 10 09 April 2020 18:34
Corruption - The Original Nightfox Games images which need to be WHDified 11 16 May 2017 20:34
Sprite corruption with OCS Agnus, ECS Denise, Kickstart 3.1 mark_k support.WinUAE 18 08 January 2015 15:27
Graphical Corruption chocolate_boy support.Hardware 3 27 July 2011 13:39
Graphics corruption Minuous support.WinUAE 9 21 July 2005 17:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:14.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09550 seconds with 16 queries