AssemblyのInstructionのByte and Word

947 ワード


Byte and word issues
  The MSP430 is byte-addressed, and little-endian. Word operands must be located at even addresses
1  Appending “.b” to an instruction makes it a byte operation.
  A byte instruction with a register destination clears the high 8 bits of the register to 0. Thus, the following would clear the top byte of the register, leaving the lower byte unchanged:
mov.b Rn,Rn

 
2  Adding ".w"(or nothing) to an instruction makes it a word operation, which is also the default behaviour.
 
3  Peripherals are divided into an 8-bit bank and a 16-bit bank.
   The 8-bit peripherals must only be accessed using 8-bit instructions; using a 16-bit access produces garbage in the high byte.
   The 16-bit peripherals must only be accessed at even addresses. Byte accesses to even addresses are legal, but not usually useful.