Index Register (H:x); Stack Pointer (Sp) - NXP Semiconductors MC9S08SU16 Reference Manual

Table of Contents

Advertisement

Chapter 10 Central processor unit
accumulator can be loaded from memory using various addressing modes to specify the
address where the loaded data comes from, or the contents of A can be stored to memory
using various addressing modes to specify the address where data from A will be stored.
Reset has no effect on the contents of the A accumulator.

10.2.2 Index Register (H:X)

This 16-bit register is actually two separate 8-bit registers (H and X), which often work
together as a 16-bit address pointer where H holds the upper byte of an address and X
holds the lower byte of the address. All indexed addressing mode instructions use the full
16-bit value in H:X as an index reference pointer; however, for compatibility with the
earlier M68HC05 family, some instructions operate only on the low-order 8-bit half (X).
Many instructions treat X as a second general-purpose 8-bit register that can be used to
hold 8-bit data values. X can be cleared, incremented, decremented, complemented,
negated, shifted, or rotated. Transfer instructions allow data to be transferred from A or
transferred to A where arithmetic and logical operations can then be performed.
For compatibility with the earlier M68HC05 family, H is forced to 0x00 during reset.
Reset has no effect on the contents of X.

10.2.3 Stack Pointer (SP)

This 16-bit address pointer register points at the next available location on the automatic
last-in-first-out (LIFO) stack. The stack may be located anywhere in the 64 KB address
space that has RAM, and can be any size up to the amount of available RAM. The stack
is used to automatically save the return address for subroutine calls, the return address
and CPU registers during interrupts, and for local variables. The AIS (add immediate to
stack pointer) instruction adds an 8-bit signed immediate value to SP. This is most often
used to allocate or deallocate space for local variables on the stack.
SP is forced to 0x00FF at reset for compatibility with the earlier M68HC05 family.
HCS08 V6 programs normally change the value in SP to the address of the last location
(highest address) in on-chip RAM during reset initialization to free up direct page RAM
(from the end of the on-chip registers to 0x00FF).
The RSP (reset stack pointer) instruction was included for compatibility with the
M68HC05 family and is seldom used in new HCS08 V6 programs because it affects only
the low-order half of the stack pointer.
MC9S08SU16 Reference Manual, Rev. 5, 4/2017
NXP Semiconductors
129

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mc9s08su16vfkMc9s08su8vfk

Table of Contents