Page 9 of 14 FirstFirst ... 7891011 ... LastLast
Results 81 to 90 of 133

Thread: Gameboy Advance

  1. #81
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)

    @Shonumi I think I've just found some kind of emulator protection in Advance Wars =)
    When this function is first called r6 is zero, which means that the ROM reads from bios memory. It seems that it compares the value it read with a word which seems to be the word of two thumb instructions.

    EDIT: I also noticed similar odd reads in other ROMs and the bios also reads from an odd address in the io ram. Maybe it was common protection to "provoke" special mmu cases back then?

    Last edited by Flerovium; September 1st, 2015 at 00:35.

  2. #82
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    @Flerovium - If I remember correctly, it's actually pretty common for games to read from the BIOS like that. I saw that behavior a lot while I was debugging various games. Those reads are supposed to return values from the open bus. It could have been a low-quality anti-piracy/anti-emulation measure. The values are pretty consistent when reading from the BIOS, so it's easy to implement. But it's not a very advanced trick, and most games can even be fooled by passing incorrect values (some games check to make sure it's not zero). Other games do this check, but they boot just fine without any proper emulation of BIOS reads.

    One other possibility is that it's just wasting time. I don't know why a game would do that specifically, but a dummy check could wait for a precise number of cycles. Either way, it's odd code. I wonder what the original C source code looked like

  3. #83
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    Pretty interesting stuff I also love this post https://mgba.io//2014/12/28/classic-nes/ about anti-emulation mechanisms of the ported nes games.

    I just took a look at armwrestlers source and it looks like it doesn't expect rrx to happen in thumb mode for ROR with zero as amount? Is this actually correct? Because both NO$GBA and VBA-M do not fail this test which means they don't implement rrx. Anyway a friend of mine will lend me his NDS flashcart so I can test how the arm cpu usually behaves. Also I'm interested why ARM ldm tests fail in no$gba, vba-m and also my emulator. I don't quite get it from the armwrestler_new source.

    This is btw the part testing ROR
    Code:
    	@ Test ROR by reg==0
    	ldr 	r0,=0x80000000
    	mov 	r1,r0	
    	mov 	r2,#1
    	mov 	r3,#0
    	lsr 	r2,r2,#1	@ set carry
    	ror 	r0,r3
    	bcs 	_ror_ok_1
    	orr 	r6,r5
    	_ror_ok_1:
    	cmp 	r0,r1
    	beq 	_ror_ok_2
    	lsl 	r4,r5,#Rd_SHIFT
    	orr 	r6,r4
    	_ror_ok_2:

  4. #84
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    @Shonumi I found out why ldm! instructions where failing in my case. It seems like in the case of LDM the write back is only disabled if the current register is the base register AND the current register is NOT the first register in the list. I actually wrote a small test for the NDS which points this out for ldmia.



    You can find the source code here: http://pastebin.com/CawsS03F
    And the binary file here: https://drive.google.com/file/d/0B-f...ew?usp=sharing

    I also could find out that on real hardware RRX will not happen for ROR #0 in thumb mode

  5. #85
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    Be very careful about LDM! behavior. It's not the same for the GBA and DS. There are differences between the ARMv4 and ARMv5 architectures. The ARM CPU in the GBA is ARMv4 (technically ARMv4T since it supports THUMB mode). For the DS, both CPUs are ARMv5 as I recall. On ARMv4, if the current register is the base register, and the current register is in the list, writebacks are disabled for LDM! On ARMv5 writebacks are enabled if the current register is the only register in the list, or not the last register in the list.

    It's important to know these differences if you're going to make a DS emulator like I plan to See GBATEK about the details -> http://problemkaputt.de/gbatek.htm#a...transferldmstm

  6. #86
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    Thanks I thought that the main differences between ARMv4(T) and ARMv5 were the 5-stage instruction pipeline and the newly introduced instructions.

  7. #87
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    @Shonumi Do you have the cpu test by deadbody? I sadly cannot find any working download using google.

  8. #88
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    @Flerovium - Yes. Here it is.
    Attached Files Attached Files

  9. #89
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    Thanks, you're my lifesaver! Well now I have a reason to implement mode 0
    Let's see if I can finally get something commercial running in the next days
    I already tested Super Dodge Ball but it doesn't get any further than the developers logo..

    EDIT: @Shonumi Does the cpu test store its result on screen? Or does it store it in memory? Because I only get a "done with tests"?
    Last edited by Flerovium; September 3rd, 2015 at 21:19.

  10. #90
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    Deadbody's CPUTest doesn't store results on screen. If it doesn't see a problem, it won't print anything other than "done with tests". The ROM is very basic, so I'd use ARMWrestler if you want something more exact.

    Also, good work getting the to the "ATLUS" screen in Super Dodge Ball! It's a small step, but it's an important one. If I recall, you need to implement DMA 3 (immediate transfer) and the VBlankIntrWait SWI. If your emulated CPU is accurate enough, that should get you to the title screen.

Page 9 of 14 FirstFirst ... 7891011 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •