Page 17 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 17
xvi List of Figures
Figure 4.26 Machine and Source Code for SA2 i 13
Figure 4.27 FINDLBL Subroutine with Errors 115
Figure 4.28 Line Print Subroutine with Errors 116
Figure 5.1 Loader Record 121
Figure 5.2 An S- Record 121
Figure 53 A Program 122
Figure 5.4 Sections in Different Source Code Files 123
Figure 5.5 A Parameter File 124
Figure 5.6 Loop Macro to Add Consecutive Values 129
Figure 5.7 Recursive Macro to Add up to Eight Values 129
Figure 5.8 Example Control Sequence Program 131
Figure 5.9 Flowchart for Example Control Sequence 132
Figure 6.1 Subroutine Calling and Returning 138
Figure 6.2 Program Segment with a Plurality of Entry and Exit Points 139
Figure 6.3 Changing a Global Variable before It Has Been Completely Used 141
Figure 6.4 Inner Product Utilizing a Global Variable such as TEMP 141
(a Bad Example)
Figure 6.5 Inner Product Utilizing Different Global Variables (a Bad Example) 142
Figure 6.6 Inner Product Registers 142
Figure 6.7 Inner Product Program Segment Utilizing Local Variables on the Stack 143
Figure 6.8 Nested Subroutines Using Local Variables 144
Figure 6.9 Local variables stored on the stack, for Successive Subroutines 144
Figure 6.10 Using Symbolic Names for Stacked Local Variables 145
Figure 6.11 Defining Symbolic Names for Stacked Local Variables by Sizes 146
Figure 6.12 Declaring Symbolic Names for Local Variables using DS Directives 146
Figure 6.13 Declaring Symbolic Names for Extended Local Access 147
Figure 6.14 Accessing Stacked Local Variables Using a Stack Marker 148
Figure 6.15 A Subroutine with Parameters in Registers 150
Figure 6.16 Change a Global Parameter before its Subroutine Has Used It 152
Figure 6.17 A Subroutine with Parameters in Global Variables 152
Figure 6.18 Calling a Subroutine for Figure 6.17 153
Figure 6.19 Calling a Subroutine with Parameters on the Stack for Figure 6.21 153
Figure 6.20 Location of Parameters Passed on the Hardware Stack 154
Figure 6.21 A Subroutine with Parameters on the Stack 154
Figure 6.22 Revised Subroutine with Local Variables and Parameters on the Stack 155
Figure 6.23 Calling a Subroutine with Parameters on the Stack for Figure 6.22 155
Figure 6.24 Parameters Passed after the Call 156
Figure 6.25 A Subroutine with Parameters after the Call, which Pulls the Return 157
Figure 6.26 A Subroutine Calling Sequence for Figure 6.25 157
Figure 6.27 A Subroutine with Parameters after the Call, Which Uses RTS 158
Figure 6.28 A Subroutine Call with Parameters after the Call for Figure 6.27 158
Figure 6.29 A Subroutine with In-Line Parameters that Are Addresses 159
Figure 6.30 An In-Line Argument List of Addresses, for Figure 6.29 159
Figure 6.31 Implementation of a C or C++ switch—Case Statement 160