Freescale Semiconductor, Inc.
JSR, JUMP TO SUBROUTINE
MAIN PROGRAM
$9D = JSR
RTI, RETURN FROM INTERRUPT
INTERRUPT PROGRAM
$3B = RTI
STACK
PC
SP
SP+1
SP+2
SP+3
SP+4
SP+5
PC
DIRECT
dd
CONDITION CODE
ACMLTR B
RTN
NEXT MAIN INSTR
ACMLTR A
MAIN PROGRAM
$AD = JSR
INDEX REGISTER (X )
H
INDEX REGISTER (X )
PC
INDXD,X
L
ff
SP+6 INDEX REGISTER (Y )
H
RTN
NEXT MAIN INSTR
STACK
SP+7 INDEX REGISTER (Y )
L
SP-2
SP-1
SP
MAIN PROGRAM
$18 = PRE
RTN
SP+8
SP+9
RTN
H
H
PC
RTN
RTN
L
L
$AD = JSR
INDXD,Y
EXTEND
ff
RTN
PC
NEXT MAIN INSTR
SWI, SOFTWARE INTERRUPT
MAIN PROGRAM
STACK
MAIN PROGRAM
PC
$3F = SWI
SP-9
SP-8
SP-7
SP-6
SP-5
SP-4
$BD = JSR
RTN
CONDITION CODE
ACMLTR B
hh
ll
ACMLTR A
RTN
NEXT MAIN INSTR
INDEX REGISTER (X )
H
INDEX REGISTER (X )
L
BSR, BRANCH TO SUBROUTINE
MAIN PROGRAM
WAI, WAIT FOR INTERRUPT
MAIN PROGRAM
SP-3 INDEX REGISTER (Y )
H
SP-2 INDEX REGISTER (Y )
STACK
L
PC
$8D = BSR
rr
PC
$3E = WAI
SP-2
SP-1
SP
RTN
SP-1
SP
H
RTN
H
RTN
RTN
L
RTN
RTN
NEXT MAIN INSTR
L
RTS, RETURN FROM SUBROUTINE
SUBROUTINE
STACK
LEGEND:
SP
SP+1
SP+2
RTN Address of next instruction in main program to be
executed upon return from subroutine.
PC
$39 = RTS
RTN
H
RTN
Most significant byte of return address.
Least significant byte of return address.
Shaded cells show stack pointer position after
operation is complete.
H
L
RTN
L
RTN
dd 8-bit direct address ($0000-$00FF) (high byte
assumed to be $00).
ff 8-bit positive offset $00 (0) to $FF (256) is added
to index.
hh High-order byte of 16-bit extended address.
ll Low-order byte of 16-bit extended address.
rr Signed-relative offset $80 (-128) to $7F (+127)
(offset relative to the address following the
machine code offset byte).
Figure 3-2 Stacking Operations
When a subroutine is called by a jump to subroutine (JSR) or branch to subroutine
(BSR) instruction, the address of the instruction after the JSR or BSR is automatically
pushed onto the stack, least significant byte first. When the subroutine is finished, a
return from subroutine (RTS) instruction is executed. The RTS pulls the previously
stacked return address from the stack, and loads it into the program counter. Execu-
tion then continues at this recovered return address.
CENTRAL PROCESSING UNIT
MC68HC11F1
3-4
TECHNICAL DATA
For More Information On This Product,
Go to: www.freescale.com