First post here. Long time software engineer, my first assembly was a long long time ago on M68000.
I have three very related, very detailed questions:
Let's say I have physical memory at $10000 - $1FFFF (Just an example). No one's home at $20000+, so any access there will obviously result in an internal Bus Error.
Let's also assume I am running on one of the MC68000/MC68010s with a 16bit databus (or one of the ones that can run either 8 or 16bit, but with MODE not grounded, so it runs in 16bit mode).
1) I do the following:
Code: Select all
MOVE.L #$12345678,D0 # Set up D0 with a known value. MOVE.W #$DEAD,($1FFFE).L # Prime the last word in memory, $1FFFE-$1FFFF with #$DEAD. MOVE.L ($1FFFE).L,D0 # Do a longword read (32bit) from $1FFFE-$20001.
Does it contain :
a) The original value of D0, i.e. #$12345678?
b) Garbage? #$XXXXXXXX?
c) The high word of D0 contains the contents from $1FFFE-$1FFFF and the low word is zero, i.e. #$DEAD0000?
d) Same as c) except low word is garbage? #$DEADXXXX?
e) Same as c) except low word is unchanged, i.e. #$DEAD5678?
f) Something completely different?
2) I do the following:
Code: Select all
MOVE.W #$1234,($1FFFE).L # Set up the last word in memory, $1FFFE-$1FFFF with a known value. MOVE.L #$DEADBEEF,($1FFFE).L # Do a longword write (32bit) to $1FFFE-$20001.
Does $1FFFE-$1FFFF contain
a) The original value in $1FFFE-$1FFFF, i.e. #$1234?
b) Garbage? #$XXXX?
c) The high word from D0, i.e. #$DEAD?
d) Zero, i.e. #$0000?
e) Something completely different?
3) Will the exception stack frames for Bus Error (in either case) contain $1FFFE or $20000 as address? $1FFFE is the start address of the first word, but it's the second one that would be the actual error address.
Why I'm wondering is that because I am reading/writing a longword using a 16bit data-bus, so that in practice it is two reads (or writes), or is it?
I am setting up something to test things on, but I'm not there yet, the only thing I have access to is an emulator, and I don't know if it actually does the correct thing in this corner-case. I haven't been able to find this information from either the M68000UM or M68000PM, or any of the other 68020, 68030, 68040 or 68060 UMs, but they're pretty thick, so I may have missed it.
The M68000 can all handle longword accesses on word-alignment, so it won't be an alignment issue, as we're not doing a word- or longword access on byte-alignment here, (Address Error Exception).
My question in reality also extends to the 68020-68060, as it would also trigger an internal Bus Error on the read and write, and it may come up with a different result than the 68000/68010, due to the 32bit nature of the databus.