Emuforums.com

Go Back   Emuforums.com > Handheld Emulation > DeSmuME Discussion
Register FAQ Members List Calendar Mark Forums Read

Login to remove all ads!
Reply
 
LinkBack Thread Tools Display Modes
Old April 21st, 2008   #241 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
It's, afaik, a timing problem, related to the IRQs. Check the Zelda Video Demo (it isn't running), and you'll see it's the same problem. I've worked on it a few hours, with mid to good results, but it's far for finished.
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 21st, 2008   #242 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
Thanks. I can tell you RaymanDS is not working because of a strange problem in the ARM9. The ARM9 freezes on this opcode :
MCR CP15, 0, R0, CR7, CR0, 4
which means "Wait for IRQ". IE=0x00040019 and IF=0x000C0019, so IRQ should be triggered, but it is not.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 21st, 2008   #243 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
Quote:
Originally Posted by NHervé View Post
Thanks. I can tell you RaymanDS is not working because of a strange problem in the ARM9. The ARM9 freezes on this opcode :
MCR CP15, 0, R0, CR7, CR0, 4
which means "Wait for IRQ". IE=0x00040019 and IF=0x000C0019, so IRQ should be triggered, but it is not.
Same problem as Mario Kart, Pokemon, Zelda Video Demo and probably others :P
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 21st, 2008   #244 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
This is VERY strange. IE&IF=0x00040019, so IRQs should be triggered. DeSmuME does'nt trigger these IRQs, I don't know why. Very strange.

PS : Why do you don't commit your changes to CVS ?
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!

Last edited by NHervé; April 21st, 2008 at 21:24. Reason: Automerged Doublepost
NHervé is offline   Reply With Quote
Old April 21st, 2008   #245 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
Quote:
Originally Posted by NHervé View Post
(...)

PS : Why do you don't commit your changes to CVS ?
Why should I? That's the interesting question. Anyway, to make a long story short, I'm not very interested on seeing games running on desmume, but making it a good development tool. As of now, the included debugger tools are far from good, so if it's not going to be useful for homebrew development, there isn't much point for me.

Of course I make an incompatible game run once and then, just because the challenge is fun.
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 21st, 2008   #246 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
Okay. I think I'll have to debug my incompatible games myself (Worms2, MarioKart, RaymanDS). I think the RaymanDS bug is very strange.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 21st, 2008   #247 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
Oh, and I forgot that I won't be committing minor fixes on official Desmume for a long while (as I did before, basically supporting homebrewers requests), you can find the reason somewhere in the forums.
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 22nd, 2008   #248 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
I found what's wrong with RaymanDS : The ARM9 freezes on this MCR opcode because the I flag is set, which means "Disable IRQ".
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 22nd, 2008   #249 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
Quote:
Originally Posted by NHervé View Post
I found what's wrong with RaymanDS : The ARM9 freezes on this MCR opcode because the I flag is set, which means "Disable IRQ".
Hacking it to one makes the game run ? :P
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 22nd, 2008   #250 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
PS : I hacked this by forcing the I flag to be 0, I got over 2 intros further but the game still doesn't work. After reading the ARM datasheet, I found that this MCR opcode switches the proc in low-power mode, and any IRQ can wake it up even if IRQs are disabled (I flag set to 1), which DeSmuME doesn't support. I'll try to implement this feature and I'll tell you.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 22nd, 2008   #251 (permalink)
Emu author
 
shashClp's Avatar
 
Join Date: Sep 2006
Location: VisualC
Posts: 656
Quote:
Originally Posted by NHervé View Post
PS : I hacked this by forcing the I flag to be 0, I got over 2 intros further but the game still doesn't work. After reading the ARM datasheet, I found that this MCR opcode switches the proc in low-power mode, and any IRQ can wake it up even if IRQs are disabled (I flag set to 1), which DeSmuME doesn't support. I'll try to implement this feature and I'll tell you.
Didn't know that it was meant to ignore the I register, good luck implementing it.
__________________
Emulator development blog
shashClp is offline   Reply With Quote
Old April 22nd, 2008   #252 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
I'm gathering more and more infos : before calling the MCR opcode, the game stores the 8 first bits of R2 into the control bits of the CPSR. Maybe R2 is having wrong value. I think any NDS program shouldn't set I flag to 1 before calling a "wait for IRQ" opcode.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 22nd, 2008   #253 (permalink)
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 9,591
Just thought id put my 2 cents in with my lack of knowledge.

from reading this

Quote:
FIQ (Fast Interrupt Request)
This interrupt is generated by a LOW level on the nFIQ input. It is supposed to process timing critical interrupts at a high priority, as fast as possible.
Additionally to the common banked registers (R13_fiq,R14_fiq), five extra banked registers (R8_fiq-R12_fiq) are available in FIQ mode. The exception handler may freely access these registers without modifying the main programs R8-R12 registers (and without having to save that registers on stack).
In privileged (non-user) modes, FIQs may be also manually disabled by setting the F Bit in CPSR.

IRQ (Normal Interrupt Request)
This interrupt is generated by a LOW level on the nIRQ input. Unlike FIQ, the IRQ mode is not having its own banked R8-R12 registers.
IRQ is having lower priority than FIQ, and IRQs are automatically disabled when a FIQ exception becomes executed. In privileged (non-user) modes, IRQs may be also manually disabled by setting the I Bit in CPSR.
To return from IRQ Mode (continuing at following opcode):
SUBS PC,R14,4 ;both PC=R14_irq-4, and CPSR=SPSR_irq
It sounds like (what you are describing) could be a Fast IRQ, which looking at that description can only be disabled by the F bit in the CPSR reg, totally ignoring the I bit. So it might be worth checking some of the other register settings.

Im probably completely wrong, but if it gets the cogs ticking, thats all that matters
__________________

http://www.generalemu.net/
Intel Core 2 Quad Q6600 @ 3.4Ghz (425x8), eVGA 8800GTX 768mb, 996Gb HDs, 2Gb Corsair DDR2-800 @ DDR2-1020 5-5-5-18 Dual Channel, 14605 3dMark 06 Points
CPU-Z Link
3dMark06 Score Link
Dont PM me for help, use the forums, thats what its for!



refraction is offline   Reply With Quote
Old April 22nd, 2008   #254 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
Maybe it's that, or maybe the game is disabling IRQs for a special purpose and it uses that MCR opcode that ignores the I flag.

I tried by adding a "lowPower" variable in the armcpu_t struct, setting it to 1 when the MCR opcode is called and to 0 when a IRQ occurs, but it is still not correct. It makes the game freezes in a strange location (0x0FFF0000).
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!

Last edited by NHervé; April 22nd, 2008 at 19:51. Reason: Automerged Doublepost
NHervé is offline   Reply With Quote
Old April 22nd, 2008   #255 (permalink)
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 9,591
do you know when the IRQ disable flag is being set? or is it being done manually and not being reset? i dunno cos ive not looked at the source
__________________

http://www.generalemu.net/
Intel Core 2 Quad Q6600 @ 3.4Ghz (425x8), eVGA 8800GTX 768mb, 996Gb HDs, 2Gb Corsair DDR2-800 @ DDR2-1020 5-5-5-18 Dual Channel, 14605 3dMark 06 Points
CPU-Z Link
3dMark06 Score Link
Dont PM me for help, use the forums, thats what its for!



refraction is offline   Reply With Quote
Old April 22nd, 2008   #256 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
Yes. The game calls a subroutine in order to set the CPSR to 0x1F (I=0), then calls the MCR that succeds, calls then another subroutine that sets the CPSR to 0x9F (I=1), then calls the same MCR. This time the MCR lamentably freezes the ARM9 due to I=1.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 22nd, 2008   #257 (permalink)
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 9,591
okay, any idea what causes the interrupt?, maybe it expects a response by then.

Meh, ill leave you guys to it, i really dont know the DS system
__________________

http://www.generalemu.net/
Intel Core 2 Quad Q6600 @ 3.4Ghz (425x8), eVGA 8800GTX 768mb, 996Gb HDs, 2Gb Corsair DDR2-800 @ DDR2-1020 5-5-5-18 Dual Channel, 14605 3dMark 06 Points
CPU-Z Link
3dMark06 Score Link
Dont PM me for help, use the forums, thats what its for!



refraction is offline   Reply With Quote
Old April 22nd, 2008   #258 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
I don't know. When I hack it I get 3 intros instead of 1, but it's still not correct. It seems that what I described in my previous post is done by the game in order to "test" something. Maybe it's the init sequence of the SDK that's been used to develop this game.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Old April 24th, 2008   #259 (permalink)
Registered User
 
Join Date: Nov 2007
Location: NZ
Posts: 10
NHervé, can you post a disassembly of the last few opcodes before it freezes, maybe it will tell us what its doing and expecting from the hardware.
Normmatt is offline   Reply With Quote
Old April 24th, 2008   #260 (permalink)
Plugin author
 
NHervé's Avatar
 
Join Date: Jul 2007
Location: Nulle part
Posts: 370
Well, I'll do it.
Sorry to be late, but the forums recently had problems due to moving servers.
__________________
Pcsx2 is great emulator and Megapad is great pad plugin !!!
NHervé is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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