Motorola M68000 User Manual Page 28

  • Download
  • Add to my manuals
  • Print
  • Page
    / 92
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 27
Addressing Capabilities
2-28 M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL MOTOROLA
2.6 OTHER DATA STRUCTURES
Stacks and queues are common data structures. The M68000 family implements a system
stack and instructions that support user stacks and queues.
2.6.1 System Stack
Address register seven (A7) is the system stack pointer. Either the user stack pointer (USP),
the interrupt stack pointer (ISP), or the master stack pointer (MSP) is active at any one time.
Refer to Section 1 Introduction for details on these stack pointers. To keep data on the
system stack aligned for maximum efficiency, the active stack pointer is automatically
decremented or incremented by two for all byte-size operands moved to or from the stack.
In long-word-organized memory, aligning the stack pointer on a long-word address
significantly increases the efficiency of stacking exception frames, subroutine calls and
returns, and other stacking operations.
The user can implement stacks with the address register indirect with postincrement and
predecrement addressing modes. With an address register the user can implement a stack
that fills either from high memory to low memory or from low memory to high memory.
Important consideration are:
Use the predecrement mode to decrement the register before using its contents as the
pointer to the stack.
Use the postincrement mode to increment the register after using its contents as the
pointer to the stack.
Maintain the stack pointer correctly when byte, word, and long-word items mix in these
stacks.
To implement stack growth from high memory to low memory, use -(An) to push data on the
stack and (An) + to pull data from the stack. For this type of stack, after either a push or a
pull operation, the address register points to the top item on the stack.
.
BOTTOM OF STACK
LOW MEMORY
(FREE)
TOP OF STACK
HIGH MEMORY
An
Page view 27
1 2 ... 23 24 25 26 27 28 29 30 31 32 33 ... 91 92

Comments to this Manuals

No comments