Parsing Mame Code

Discussion in 'Game Development General Discussion' started by subbie, Nov 12, 2010.

  1. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    Hey,

    Does anybody here have any experience with parsing though Mame Code?

    At the moment I'm kind of seeking out what I wan to work on over my Christmas break and one of the things I've always though about is building a portable PS1 Arcade Emu (System10/11/12/Zn1/Zn2/G-Net). I understand a decent amount of MIPS and can easily get all the info together to build a R3000 CPU Emu. My problem is, I don't know where to begin on figuring out the other components to these arcade boards. I know they are emulated in mame and as such Mame should have the info I need (like where are roms loaded/addressed, any custom chips that need emulation, etc). So does anybody have any general info or tips on how to parse this stuff out of mame? I think I checked one time and it was a bit confusing.
     
  2. LoveMHz

    LoveMHz Guest

  3. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    Any docs on the basic workings of mame it self? Like if it calls to do this command it's for x?
     
  4. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    MAME is a macro nightmare. Still it shouldn't be hard to extract what you need. The driver will contain the memory map(s), registers & I/O, raster/render code will be under video. Decoding is generated dynamically, so it's pretty easy to follow.
     
  5. kammedo

    kammedo and the lost N64 Hardware Docs

    Joined:
    Sep 24, 2004
    Messages:
    2,138
    Likes Received:
    12
    Mame may be a "Macro-horror", but once you get over understanding the few basic macros used for handling memory and bits all the rest follows flawlessy.

    Also, another way to go is probably to step through / read the code.

    kammedo
     
  6. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    thanks for the tips. Will do some reading up tonight. =)
     
  7. emu_kidid

    emu_kidid Enthusiastic Member

    Joined:
    Jun 28, 2008
    Messages:
    524
    Likes Received:
    23
    subbie, once you've got all the basics figured out, you can use Pete's PSX GPU plugins since they have ZN support as far as I can recall. http://www.pbernert.com/html/gpu.htm - it should be endian friendly too, and he recently released the hardware accelerated plugin source.
     
  8. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    Sweet. Thanks for the tip on that one. =D


    I think once I get my head wrapped around how a PCB with roms works vs a console I should be able to get somewhere pretty quickly (first will just get a interpreter going then move over to a recompiler).

    Off the bat quesiton (it's been a while). Any idea if the PS1 CPU used Tbl instructions or did it have a custom COP0?

    -edit-
    looks like does. =/ (damn it)
     
    Last edited: Nov 16, 2010
  9. emu_kidid

    emu_kidid Enthusiastic Member

    Joined:
    Jun 28, 2008
    Messages:
    524
    Likes Received:
    23
    yeah.. it's a pretty difficult beast to emulate correctly :(
     
  10. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    Tlb or ps1?

    For me the difficulty in tlb is it makes building a static recompiler pretty difficult. =(

    Emulating mips it self will be pretty straight forward for me since i'm most comfortable with mips instruction set (specially after trying to do a n64 emu on psp way back).

    Actually I should maybe look into a few sys 10/11 games and see if any actually use the tbl instructions (possible they might ignore them).
     
    Last edited: Nov 17, 2010
  11. Calpis

    Calpis Champion of the Forum

    Joined:
    Mar 13, 2004
    Messages:
    5,906
    Likes Received:
    21
    What's wrong with an interpreter core? This is for a recent PC right? Optimize later.
     
    Last edited: Nov 17, 2010
  12. subbie

    subbie Guardian of the Forum

    Joined:
    Feb 25, 2005
    Messages:
    4,749
    Likes Received:
    94
    Eh, not fully sure. I think my primary target is portable devices. I mean hell if you have a pc you can probably run it through mame just fine. But I'll probably still keep an interpreter core for when porting to new platforms.

    On a PSP an interpreter would be too slow.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page