MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Pages: 1

AtomR
MAME Fan
Reged: 11/21/11
Posts: 3
Send PM


I need help reading some memory from mame.
#269396 - 11/23/11 08:22 PM


Good afternoon,
I've been trying for two very troublesome days to understand the inner workings of mame. I think I finally got a good grasp of how to access info on the emulated ram.
First off I'm specifically working with the pbaction driver. Which has the following memory setup

Code:


static ADDRESS_MAP_START( pbaction_map, AS_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE_MEMBER(pbaction_state, m_work_ram)
AM_RANGE(0xd000, 0xd3ff) E(pbaction_videoram2_w) AM_BASE_MEMBER(pbaction_state, m_videoram2)
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(pbaction_colorram2_w) AM_BASE_MEMBER(pbaction_state, m_colorram2)
AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(pbaction_videoram_w) AM_BASE_MEMBER(pbaction_state, m_videoram)
AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(pbaction_colorram_w) AM_BASE_MEMBER(pbaction_state, m_colorram)
AM_RANGE(0xe000, 0xe07f) AM_RAM AM_BASE_SIZE_MEMBER(pbaction_state, m_spriteram, m_spriteram_size)
AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0xe600, 0xe600) AM_READ_PORT("P1") AM_WRITE(interrupt_enable_w)
AM_RANGE(0xe601, 0xe601) AM_READ_PORT("P2")
AM_RANGE(0xe602, 0xe602) AM_READ_PORT("SYSTEM")
AM_RANGE(0xe604, 0xe604) AM_READ_PORT("DSW1") AM_WRITE(pbaction_flipscreen_w)
AM_RANGE(0xe605, 0xe605) AM_READ_PORT("DSW2")
AM_RANGE(0xe606, 0xe606) AM_READNOP /* ??? */ AM_WRITE(pbaction_scroll_w)
AM_RANGE(0xe800, 0xe800) AM_WRITE(pbaction_sh_command_w)
ADDRESS_MAP_END



So I've put in the running_machine::run method the following code, inside the if(!m_paused)

Code:

					memory_region *r = m_regionlist.find("maincpu");
if(r!=NULL)
{
printf("%s\n",r->name());
for(int i=0xC000;i<0xC010;i++)
printf("%02X",r->u8(i));
}
printf("\n");



Basically my question is, why is it that memory data below address 0xC000 shows exactly as the dump file does, but anything above that address just comes out 00 when I can see in the dumpfile that there is actual data there?

I appreciate any help you can give. Thanks.



drewcifer
One bad Mutha-(shut yo' mouth!)
Reged: 07/01/04
Posts: 428
Loc: Sweden
Send PM


Re: I need help reading some memory from mame. new [Re: AtomR]
#269426 - 11/24/11 03:32 AM


The part of the code you're looking at is pretty deep in the core of MAME. If your goal is to learn the internals of how MAME works, you're definitely looking in the right spot, but I can't help you much off the top of my head.

If, however, you are looking at doing something interesting with the contents of pbaction's RAM, I might recommend adding your own AM_READ or AM_WRITE handlers to the memory map or inspecting the member variables (eg. m_work_ram) that hold the system's memory at each screen refresh or something along those lines.

Andrew



> Good afternoon,
> I've been trying for two very troublesome days to understand the inner workings of
> mame. I think I finally got a good grasp of how to access info on the emulated ram.
> First off I'm specifically working with the pbaction driver. Which has the following
> memory setup
>
> static ADDRESS_MAP_START( pbaction_map, AS_PROGRAM, 8 )
> AM_RANGE(0x0000, 0x7fff) AM_ROM
> AM_RANGE(0x8000, 0xbfff) AM_ROM
> AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE_MEMBER(pbaction_state, m_work_ram)
> AM_RANGE(0xd000, 0xd3ff) E(pbaction_videoram2_w) AM_BASE_MEMBER(pbaction_state,
> m_videoram2)
> AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(pbaction_colorram2_w)
> AM_BASE_MEMBER(pbaction_state, m_colorram2)
> AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(pbaction_videoram_w)
> AM_BASE_MEMBER(pbaction_state, m_videoram)
> AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(pbaction_colorram_w)
> AM_BASE_MEMBER(pbaction_state, m_colorram)
> AM_RANGE(0xe000, 0xe07f) AM_RAM AM_BASE_SIZE_MEMBER(pbaction_state, m_spriteram,
> m_spriteram_size)
> AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w)
> AM_BASE_GENERIC(paletteram)
> AM_RANGE(0xe600, 0xe600) AM_READ_PORT("P1") AM_WRITE(interrupt_enable_w)
> AM_RANGE(0xe601, 0xe601) AM_READ_PORT("P2")
> AM_RANGE(0xe602, 0xe602) AM_READ_PORT("SYSTEM")
> AM_RANGE(0xe604, 0xe604) AM_READ_PORT("DSW1") AM_WRITE(pbaction_flipscreen_w)
> AM_RANGE(0xe605, 0xe605) AM_READ_PORT("DSW2")
> AM_RANGE(0xe606, 0xe606) AM_READNOP /* ??? */ AM_WRITE(pbaction_scroll_w)
> AM_RANGE(0xe800, 0xe800) AM_WRITE(pbaction_sh_command_w)
> ADDRESS_MAP_END
>
>
> So I've put in the running_machine::run method the following code, inside the
> if(!m_paused)
> memory_region *r = m_regionlist.find("maincpu");
> if(r!=NULL)
> {
> printf("%s\n",r->name());
> for(int i=0xC000;i<0xC010;i++)
> printf("%02X",r->u8(i));
> }
> printf("\n");
>
>
> Basically my question is, why is it that memory data below address 0xC000 shows
> exactly as the dump file does, but anything above that address just comes out 00 when
> I can see in the dumpfile that there is actual data there?
>
> I appreciate any help you can give. Thanks.



sz72
MAME Fan
Reged: 08/20/07
Posts: 78
Send PM


Re: I need help reading some memory from mame. new [Re: AtomR]
#269485 - 11/24/11 09:09 PM


What do you mean with "dump file" ? The rom dumps from the game board ?



Sune
Connected
Reged: 09/21/03
Posts: 5648
Loc: Lagoa Santa, Brasil
Send PM


Re: I need help reading some memory from mame. new [Re: sz72]
#269551 - 11/25/11 08:40 PM


> What do you mean with "dump file" ? The rom dumps from the game board ?

No, he's talking about RAM, not ROM.

He's asking about the memory space dumped using his own code.

S



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9711
Loc: ECV-197 The Orville
Send PM


Re: I need help reading some memory from mame. new [Re: AtomR]
#269685 - 11/27/11 04:10 PM


You'd be ahead just using m_work_ram as a pointer to the RAM; your method is a little too far into the implementation details so most of us can't easily help you.


Pages: 1

MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 8 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2943