Page 2 of 14 FirstFirst 123412 ... LastLast
Results 11 to 20 of 133

Thread: Gameboy Advance

  1. #11
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    Quote Originally Posted by Flerovium View Post

    Code:
    ldr r0, =0x080000E1
    Oh, this is a problem for me when it comes to assemblers. To my knowledge, LDR (ARM.9) can either only use a 12-bit immediate value or a shifted register as the offset. The default value of R0 on the GBA (after exiting BIOS) is zero. So the assembler has to be doing something other than LDR to get a value of 0x080000E1 into R0; there's no way to get that value by just using the LDR instruction (as defined in ARM.9), especially since all other registers at this time are 0 except R14 and R15. I would guess that the assembler actually adds other instructions (MOVS and such) to the binary output so that the value of 0x080000E1 can be placed into R0 when LDR is called.

    This is great for programming demos from the perspective that you do not really care what goes on, so long as in the end R0 holds the value of 0x080000E1, but when you are trying to develop a cycle-accurate emulator or you want to test specific behavior, it will be a major pain. Sure, it is convenient on one hand, but when you are trying to recreate a system as accurately as possible, assemblers obfuscate certain things like what I pointed out. Ideally, I need to know every input (yes, on a binary level) I'm feeding into my program to measure the output. It's not just a matter of printing or drawing things to the screen like the demos I posted above; it's important for verifying accurate CPU emulation.

    Assemblers are good for "quick and dirty" work. I have no issues with that, but I'm very strict about details :p


  2. #12
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    The GNU Assembler translates it to somewhat like that:
    Code:
    ldr r0, .offset 
     @...
    .offset:
    .word 0x080000E1

  3. #13
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    My bad, I completely forgot about loading from an address. I have not extensively gone over ARM.9, so ignore the above post.

    But how does the assembler grab the word in .offset? When writing assembly by hand, you would first set a register as Rn (the base address) after loading 0x80000E1 into it. Now this is something that gets obfuscated.

  4. #14
    EmuTalk Member
    Join Date
    Sep 2014
    Posts
    1
    Mentioned
    0 Post(s)
    I'm trying to port some GBA emulator to rockbox. The target I have for testing is the Fuze+, which has a stmp3780 processor and a 454 MHz clock speed, which seemed enough for GBA.

    I'd like a recommendation for which open-source GBA compilers it would be easiest to port. I know Gpsp was ported to Ipodlinux, which implies it might be easier to port in general.

    Preferably, something written in C, so I don't have to re-write everything. I've found the Gpsp source code, although there seems to be several forks of it which aren't easy to find source code for. (Gpsp-J and others.)

    I know how to code in C. I've never done any emulator work before, though. How long can I realistically expect it to take, and can anyone give me tips? What do I need to know about emulation for porting?

  5. #15
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    So, any one else been working on their stuff? Flerovium? Well, there's been a flurry of work on my end recently. Super Dodge Ball Advance is basically the only thing that boots and displays something, only because I've focused on that exclusively for the time being:



    Sprites are not yet implemented (weekend project ) and neither are timers or input. Hopefully the game will be mostly playable once that's added. Then I'll try to get other games running.

  6. #16
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    I'm too lazy, just as always currently. Not happy with that
    Haven't worked on it for some time. I hope I'll be able to continue my work after my next exams..

    Greetz

  7. #17
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    Yay, I got THUMB finally implemented! I'm hoping there aren't too much bugs
    You can take a look at it here: https://github.com/hackiosa/fba/

    EDIT:


    Wow! The first looks quite good, the second one freaks the **** out of me xD
    Thanks to your test I already was able to fix some bugs in my Load / Store instructions! I hope I get the second test fully working too

    EDIT2: I actually got it fixed It was a bug in my drawing routine
    Last edited by Flerovium; November 1st, 2014 at 20:02.

  8. #18
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    Hey, that's great that you were able to work on it! If you have anything specific you want, I could make some more tests.

    Currently I'm dealing with bugs, bugs, and more bugs. I have Super Dodge Ball Advance, Kirby: Nightmare in Dreamland, and Mega Man Battle Network 4: Blue Moon working to some extent. I can play around in all of them, but eventually errors prevent further gameplay. Bomberman Tournament boots, but it freezes for some reason, fixing this will be key since it seems to be the same kind of freeze I recently introduced as a regression (I bet it's when I changed the code that calculates the Overflow flag...) I really want to get Mega Man Zero to boot, that game's one of my favorites and a classic

    Good luck with things on FakeBoyAdvance, nice name btw

    EDIT: Hmm.. yeah, my new method of calculating the V flag sucks. The old implementation boots Bomberman Tournament just fine. The new one fails pretty hard and breaks other games. Back to the drawing board. But at least Bomberman Tournament goes in game (with bad graphics however...) but progress is progress. I've been trying to get this game to work for a week now, so I'm glad something is showing up now.



    Goes in-game, but it draws a lot of nothing once the intro (pictured above) is finished. Maybe the data is there in VRAM but my LCD emulation isn't complete enough? It seems to work (pressing A goes through text, and I can start a new game if I just keep tapping Start). I'll have to investigate later. I have my eyes set on booting Final Fantasy Tactics Advance next. Looks this is one of the few games I've encountered so far that use DMA0 and DMA3. I only implemented DMA3, since that's what commonly used in most games.
    Last edited by Shonumi; November 2nd, 2014 at 03:47.

  9. #19
    EmuTalk Member
    Join Date
    Feb 2014
    Location
    Niedersachsen, Germany
    Posts
    87
    Mentioned
    8 Post(s)
    What methods do you use for overflow? I use this one:
    Code:
    overflow = (result >> 31 != reg(rs) >> 31) && (reg(rs) >> 31 == (n) >> 31);
    result = result of the addition or subtraction
    reg(rs) = first operand of addition / subtraction (in this case the value of a register rs)
    (n) = second operand

    Don't know if this method is correct but maybe it helps you..

  10. #20
    EmuTalk Member
    Join Date
    Mar 2014
    Location
    Chicago, IL
    Posts
    166
    Mentioned
    28 Post(s)
    I figured it out. I was flipping some bits incorrectly. I read a portion of an ARM assembly book that had rules for the V Flag and basically described them as such

    Addition

    * Are MSBs of the Input and Operand different?
    * Clear V Flag

    * Are the MSBs of the Input and Operand the same?
    * Is the MSB of the Result the same as the MSBs of the Input and Operand?
    * Clear V Flag
    * Is the MSB of the Result different from the MSBs of the Input and Operand?
    * Set V Flag

    Subtration

    * Are MSBs of the Input and Operand the same?
    * Clear V Flag

    * Are the MSBs of the Input and Operand different?
    * Is the MSB of the Result the same as the MSB of the Operand?
    * Set V Flag
    * Is the MSB of the Result different from the MSB of the Operand?
    * Clear V Flag

    I was reversing when to set or clear the V flag during addition. No more freezes

Page 2 of 14 FirstFirst 123412 ... 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
  •