AWJ |
|
|
|
Reged: 03/08/05
|
Posts: 936
|
Loc: Ottawa, Ontario
|
|
Send PM
|
|
Re: How to get real offset
11/09/15 07:56 PM
|
|
|
> Hi again . > > If I have for example: > AM_RANGE(0x1000, 0x1FFF) AM_MIRROR(0x3FC) AM_WRITE (test_w) > > WRITE8_MEMBER (test_state :: test_w) > { > int real_ofs = ??? (offset); > printf ("0x%04X\n", real_ofs); > } > > How to get the real offset (e.g. excluding the mirror address 'effect') into the > test_w handler? > > Additionally, what exactly AM_MIRROR does? > > Is it a module of 0x3FC of the address, perhaps?
That's not how you use AM_MIRROR and that address map entry doesn't make any sense. AM_MIRROR causes the specified mirror bits to be ORed with the AM_RANGE bits. For example,
AM_RANGE(0x1000, 0x1003) AM_MIRROR (0x03fc) AM_WRITE(foo_w)
causes foo_w to be mapped at every address from 0x1000 to 0x13ff.
Your use of AM_MIRROR doesn't make any sense because the range 0x1000, 0x1fff already contains all the bits in 0x3fc.
I think what you actually want is AM_MASK, but it isn't clear to me what you're trying to do. Can you try to explain better what you mean by "real offset"?
|
|