let us review the operation of the stack within


Let us review the operation of the stack within the 68HC11, the stack is a defined area of RAM which is last in first out register (LIFO) . Access to the stack is made via a stack pointer (SP). In the 68HC11 there is only one stack pointer and it is initialised by the LDS command. To transfer data onto the stack we can use the command PSHA or PSHB i.e. push register A or B onto the stack. To remove data simply pull it i.e PULA or PULB, likewise the index registers may be stacked  etc.

      PSHA Push A onto Stack
      PSHB  Push B onto Stack
      PSHX  Push X onto Stack
      PSHY  Push Y onto Stack
      PULA Pull A onto Stack
      PULB  Pull B onto Stack
      PULX  Pull X onto Stack
      PULY  Pull Y onto Stack

Every time data is 'Pushed' onto the stack the Stack pointer is decrements accordingly. The stack is used often by the micro controller for temporary holding data, if a subroutine occurs, the processor stacks the return address and upon the receipt of the RTS command, it pulls the return address automatically. During an interrupt the processor stacks the full details of itself i.e.

  SP    Condition code  
  SP-1    Accumulator A
  SP-2    Accumulator B
  SP-3    Index register X high
  SP-4    Index register X low
  SP-5    Index register Y high
  SP-6    Index register Y low
  SP-7    return address High
  SP-8    Return address Low 
  SP-9    Stack pointer after interrupt

Therefore great care should be taken when using the stack as during an interrupt or subroutine if you place data on the stack you must remove the data before you return from it.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: let us review the operation of the stack within
Reference No:- TGS0265191

Expected delivery within 24 Hours