Previous Thread
Next Thread
Print Thread
Page 5 of 9 1 2 3 4 5 6 7 8 9
Haze #64820 10/03/10 08:57 PM
Joined: Aug 2009
Posts: 1,147
Likes: 12
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,147
Likes: 12
Cosmic Carnage does this:


06002CB0: MOV.W @($0008,PC),R0
06002CB2: BSRF R0
06002CB4: LDS.L @SP+,PR
06001CCC: MOV.L R4,@-SP
06001CCE: MOV.L R5,@-SP
06001CD0: MOV.L R6,@-SP
06001CD2: MOV.L R7,@-SP
06001CD4: MOV.L R8,@-SP
06001CD6: MOV.L R2,@-SP


(executes the branch sub-routine then ...)


06001D66: MOV.L @SP+,R8
06001D68: MOV.L @SP+,R7
06001D6A: MOV.L @SP+,R6
06001D6C: MOV.L @SP+,R5
06001D6E: MOV.L @SP+,R4
06001D70: RTS
06001D72: NOP
06002CB6: RTS
06002CB8: NOP
06002CB6: RTS
06002CB8: NOP
indefinitely

SH-2 delay slot bug I suppose?





EDIT: Uhm, wait a second ... maybe the delay slot branch occurs only for the sub-routine, then PR "pops" the old value once that RTS is tripped?

Last edited by Kale; 10/03/10 09:26 PM. Reason: better formatting
Kale #64821 10/03/10 10:42 PM
Joined: Mar 2001
Posts: 16,892
Likes: 51
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,892
Likes: 51
The delay slot handling should largely be correct - the Success games on the ST-V and one of the non-Kaneko SNKS games abused the living hell out of it. I'm a little fuzzy on what they're actually trying to do in that posted code snippet.

Kale #64822 10/03/10 11:44 PM
Joined: Jun 2009
Posts: 6
O
Member
Offline
Member
O
Joined: Jun 2009
Posts: 6
Originally Posted By Kale
I can confirm that Fusion clearly kludges this thing somehow ... changed the game header at 0x120 / 0x150 and game has missing 32x gfxs too ...


Steve Snake has admitted that his 32x support was basically designed to just get it running, rather than doing it right.

Joined: Aug 2009
Posts: 1,147
Likes: 12
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,147
Likes: 12
Yeah, good as could possibly be good patching Mars Check Test Program to get all OK ...


Joined: May 2004
Posts: 1,703
Likes: 1
H
Haze Offline OP
Very Senior Member
OP Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,703
Likes: 1
Originally Posted By R. Belmont
The delay slot handling should largely be correct - the Success games on the ST-V and one of the non-Kaneko SNKS games abused the living hell out of it. I'm a little fuzzy on what they're actually trying to do in that posted code snippet.


yeah but for the RTS/NOP/RTS sequence to continue indefinitely something must be resetting the SP?

The operation in the delay slot for the initial branch manipulates the SP, could this have something to do with it ? The code flow makes no sense to me anyway, even considering there is a delay slot, where is the SP being changed back?

It looks like some kind of edge case that maybe the other games don't catch to me ..

I wouldn't be surprised if the 32x games are abusing the hell out of the SH2 a lot more than any ST-V or Kaneko stuff ;-) It's pretty common to find the most abuse on home systems.. There is still talk of possible *68k* bugs on some forums.

Haze #64825 10/04/10 02:01 AM
Joined: Mar 2001
Posts: 16,892
Likes: 51
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,892
Likes: 51
Both Puzz Loop and the Success games extensively manipulate both SP and PR in the delay slot, so I have a hard time believing this is something new. (Many ST-V games were ported *from* Saturn, so they're just as home-console as 32X). Please enable the interpreter and see if your game runs any better.

Joined: May 2004
Posts: 1,703
Likes: 1
H
Haze Offline OP
Very Senior Member
OP Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,703
Likes: 1
Originally Posted By R. Belmont
Both Puzz Loop and the Success games extensively manipulate both SP and PR in the delay slot, so I have a hard time believing this is something new. (Many ST-V games were ported *from* Saturn, so they're just as home-console as 32X). Please enable the interpreter and see if your game runs any better.


The interpreter no longer compiles

src/emu/cpu/sh2/sh2.c: In function 'void cpu_execute_sh2(legacy_cpu_device*)':
src/emu/cpu/sh2/sh2.c:2240: error: 'memory_decrypted_read_word' was not declared in this scope
src/emu/cpu/sh2/sh2.c:2244: error: 'memory_decrypted_read_word' was not declared in this scope

it would be really nice if MAME/MESS had the option to select specific cores at runtime for testing such things.

That said, I'm almost certain it's a bug.. getting stuck in an infinite NOP / RTS 'loop' makes no sense from a logic point of view to me, and bypassing (and returning to the expected addresss) fixes the game from what Kale has shown.


Haze #64837 10/04/10 05:15 PM
Joined: Mar 2001
Posts: 16,892
Likes: 51
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,892
Likes: 51
You know the right address? What's the intended sequence of behavior then? That would be very useful to know to fix it smile

Joined: May 2004
Posts: 1,703
Likes: 1
H
Haze Offline OP
Very Senior Member
OP Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,703
Likes: 1
Originally Posted By R. Belmont
You know the right address? What's the intended sequence of behavior then? That would be very useful to know to fix it smile


Given that Kale has posted screenshots.. and as things stand all you actually get is get a black screen I'm guessing he knows the right address ;-)

Haze #64844 10/04/10 09:26 PM
Joined: Aug 2009
Posts: 1,147
Likes: 12
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,147
Likes: 12
do pr = 600606e on the RTS iirc, I was busy all the day so I tell you for sure ... after a shower wink

EDIT: ok, it's actually do PR = 600060e, a.k.a. the value of PR before the BSRF call (at bp 6002cb2).

And, wait, is BSRF is *already* supposed to put the PR inside it? If I NOP the LDS.L @SP+,PR opcode then I still get value uploading?

Last edited by Kale; 10/04/10 10:25 PM.
Page 5 of 9 1 2 3 4 5 6 7 8 9

Link Copied to Clipboard
Who's Online Now
0 members (), 26 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,072
Posts118,947
Members5,014
Most Online890
Jan 17th, 2020
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com