Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*

SubjectMAME memory issues Reply to this message
Posted bycgfm
Posted on03/09/04 06:44 AM

I'm a little unclear on how to handle mirroring in MAME, maybe someone can help out.

In one situation, I'm trying to mirror RAM at $F800-$FFFF across $C000-$FFFF. Here's what I've used:

AM_RANGE(0xc000,0xffff) AM_READ(MRA8_RAM) AM_MASK(0x7ff)

This allocates a 16k chunk, and correctly maps all accesses to offsets $0000-$07FF only. So it works but is a waste of space.

AM_RANGE(0xc000,0xc7ff) AM_READ(MRA8_RAM) AM_MIRROR(0xf800)


AM_RANGE(0xc000,0xffff) AM_READ(MRA8_RAM) AM_MIRROR(0xf800)

In both cases 2k is allocated, but the memory isn't mirrored above the base area ($c000-$c7ff) so the game crashes.

I had looked at the system24 driver and saw something confusing about the mirroring used:

AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x140000) AM_ROM AM_SHARE(1)

Going by the documentation in memory.c, I would assume this maps the ROM as follows:

$000000-$03FFFF : ROM
$040000-$07FFFF : ROM (mirror)
$100000-$13FFFF : ROM (mirror)
$140000-$17FFFF : ROM (mirror)

If this means that the mirroring area can exceed the upper bound of the AM_RANGE macro ($03FFFF), then wouldn't AM_MIRROR not work for mirrored memory at a lower address with something above it? For example in my case, if the RAM was mirrored through $C000-$E7FF, but not $E800-$FFFF, AM_MIRROR would still put the mirrored RAM in the $E800-$FFFF range, right?

Now for handling mirroring of handlers, I'm stuck on this one too:

AM_RANGE(0x80, 0x80) AM_WRITE(YM2151_register_port_0_w)
AM_RANGE(0x81, 0x81) AM_WRITE(YM2151_data_port_0_w)

I'd like to mirror these from $80 to $BF each, so the first one is called for I/O ports $80, $82,..$BE, and the latter is for $81, $83,..$BF. Can the mirroring macros handle this? Or would it be better to define a handler for the full range, manage the mirroring myself, and call the above routines from there?

Entire Thread
Subject  Posted byPosted On
.MAME memory issues  cgfm03/09/04 06:44 AM
.*Re: MAME memory issues  galibert03/09/04 10:31 AM