Skip to main content
Became Hot Network Question
Source Link
rwallace
  • 63.8k
  • 18
  • 249
  • 587

Does the 6800 always handle unaligned access correctly?

I asked a similar question about the Intel 8080 to which I guessed the answer would probably be yes, because later Intel CPUs did fully handle unaligned access.

I am less sure about the Motorola 6800, because several of the inventors went on to invent the MOS Technology 6502, which in some contexts treats page boundaries as special. But there are differences between the two; for example, the 6800 has a 16-bit stack pointer, whereas the 6502 has an 8-bit stack pointer. Perhaps this is also a difference.

So:

The 6800 is referred to as an 8-bit CPU because it has an 8-bit data bus, but there are a number of cases where it must perform 16-bit memory access, for example when reading or writing a 16-bit register, or the 16-bit program counter when performing subroutine call or return.

I assume it supports unaligned access, i.e. the address is not required to be even.

Does it support fully unaligned access in all cases, i.e. no requirement that both bytes be in the same page? For example, if you try to write a 16-bit register to address $7fff, will the second byte be written to $8000? Or if the stack pointer was set to $8001 and you perform a subroutine call, will the return address be written to the addresses $8000 and $7fff?