Download presentation
Presentation is loading. Please wait.
1
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks Chapter 2
2
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
3
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell The System Stack
4
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Pushing D on the stack
5
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
6
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutines chap2a.asm
7
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell chap2a.lst
8
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Using the D-Bug12 asm command
9
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell
10
Saving and restoring registers in a subroutine ;subroutine example subname pshb; save B pshx; save X ---- ;instructions that ----;change B and X ---- pulx; restore X pulb; restore B rts
11
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
12
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Using X as a stack pointer for a data stack LDY 2,X+ will pop $1234 into Y
13
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine to add two numbers on the data stack
14
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine to subtract two numbers on the data stack
15
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Program to call the subroutine plus
16
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
17
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Making Subroutines Interactive C++ program running on PC –contains a dictionary of subroutine names like + (plus) and - (minus) with their addresses –If you type + the address of plus is sent to the 68HC12 and the subroutine plus is executed This is the way that WHYP works Typing a number causes it to be pushed on the 68HC12 data stack
18
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Sample of Using WHYP
19
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
20
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell
22
DUP
23
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell SWAP
24
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell DROP
25
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell OVER
26
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell FLIP
27
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Testing stack words using.S
28
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell WHYP words SP@ and SP!
29
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks The System Stack Subroutines A Data Stack Making Subroutines Interactive Stack Manipulation Words The Return Stack
30
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell The Return Stack
31
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell
33
WHYP words RP@ and RP!
34
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Testing return stack words using.R
35
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.