Need help to understand sonic rom [Resolved]

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Need help to understand sonic rom [Resolved]

Post by mickagame » Mon Feb 08, 2021 8:30 pm

I'm actually implementing higan 68k core in my emulator and i would need help in understanding the code of sonic rom.

My emulator actually loop at this place :

Code: Select all

0029AC     TST.b      $FFFFF62A.w
0029B0     BNE.b     *+$FA                  => 0029AC
With other 68k core (musashi, c68k ...) everything works ok.

Edit :

if found this in a sonic dissasembly :

Code: Select all

; ---------------------------------------------------------------------------
; Subroutine to	delay the program by ($FFFFF62A) frames
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DelayProgram:				; XREF: PauseGame
		move	#$2300,sr

loc_29AC:
		tst.b	($FFFFF62A).w
		bne.s	loc_29AC
		rts	
; End of function DelayProgram
I imagine the data located at the adress ($FFFFF62A) is decremented at each V-interrupt until it reach 0 value.

So a infinite loop would mean that v-interrupt subroutine is not executed by the core
Last edited by mickagame on Tue Feb 09, 2021 7:40 pm, edited 1 time in total.

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Re: Need help to understand sonic rom

Post by mickagame » Tue Feb 09, 2021 7:01 pm

After adding log trace the problem seems to be the v-int not catched with higan core :

traces with musashi 68k :

Code: Select all

PC = 0x000018A8
PC = 0x000018AA
PC = 0x000018AC
V-Int!
PC = 0x000018B0
Write Addr : 0x00FFFDF6, data : 0xFFF62A -> 0x0000FF1F
PC = 0x000018B4
Write Addr : 0x00FFFDF6, data : 0xFFF62A -> 0x0000001F
PC = 0x000018B6
PC = 0x000018B8
PC = 0x000018BA
Traces with Higan Core :

Code: Select all

PC = 0x000018A8
PC = 0x000018AA
PC = 0x000018AC
	  
PC = 0x000018B0
Write Addr : 0x00FFFDF6, data : 0xFFF62A -> 0x0000FF1F
PC = 0x000018B4
Write Addr : 0x00FFFDF6, data : 0xFFF62A -> 0x0000001F
PC = 0x000018B6
PC = 0x000018B8
PC = 0x000018BA

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Re: Need help to understand sonic rom [Resolved]

Post by mickagame » Tue Feb 09, 2021 7:41 pm

Finally i correct it!
The vdp did not raise cpu v-int for higan core ...
Now sonic is running great with this new core :-)

Post Reply