CPU12
HIGH-LEVEL LANGUAGE SUPPORT
MOTOROLA
REFERENCE MANUAL
C-1
APPENDIX C
HIGH-LEVEL LANGUAGE SUPPORT
Many programmers are turning to high-level languages such as C as an alternative to
coding in native assembly languages. High-level language (HLL) programming can
improve productivity and produce code that is more easily maintained than assembly
language programs. The most serious drawback to the use of HLL in MCUs has been
the relatively large size of programs written in HLL. Larger program ROM size require-
ments translate into increased system costs.
Motorola solicited the cooperation of third-party software developers to assure that the
CPU12 instruction set would meet the needs of a more efficient generation of compil-
ers. Several features of the CPU12 were specifically designed to improve the efficien-
cy of compiled HLL, and thus minimize cost.
This appendix identifies CPU12 instructions and addressing modes that provide im-
proved support for high-level language. C language examples are provided to demon-
strate how these features support efficient HLL structures and concepts. Since the
CPU12 instruction set is a superset of the M68HC11 instruction set, some of the dis-
cussions use the M68HC11 as a basis for comparison.
C.1 Data Types
The CPU12 supports the bit-sized data type with bit manipulation instructions which
are available in extended, direct, and indexed variations. The char data type is a sim-
ple 8-bit value that is commonly used to specify variables in a small microcontroller
system because it requires less memory space than a 16-bit integer (provided the vari-
able has a range small enough to fit into eight bits). The 16-bit CPU12 can easily han-
dle 16-bit integer types and the available set of conditional branches (including long
branches) allow branching based on signed or unsigned arithmetic results. Some of
the higher math functions allow for division and multiplication involving 32-bit values,
although it is somewhat less common to use such long values in a microcontroller sys-
tem.
The CPU12 has special sign extension instructions to allow easy type-casting from
smaller data types to larger ones, such as from char to integer. This sign extension is
automatically performed when an 8-bit value is transferred to a 16-bit register.
C.2 Parameters and Variables
High-level languages make extensive use of the stack, both to pass variables and for
temporary and local storage. It follows that there should be easy ways to push and pull
all CPU registers, stack pointer based indexing should be allowed, and that direct
arithmetic manipulation of the stack pointer value should be allowed. The CPU12 in-
struction set provided for all of these needs with improved indexed addressing, the ad-
dition of an LEAS instruction, and the addition of push and pull instructions for the D
accumulator and the CCR.
Summary of Contents for CPU12
Page 8: ...MOTOROLA CPU12 viii REFERENCE MANUAL ...
Page 14: ...MOTOROLA INTRODUCTION CPU12 1 4 REFERENCE MANUAL ...
Page 20: ...MOTOROLA OVERVIEW CPU12 2 6 REFERENCE MANUAL ...
Page 38: ...MOTOROLA INSTRUCTION QUEUE CPU12 4 6 REFERENCE MANUAL ...
Page 300: ...MOTOROLA DEVELOPMENT AND DEBUG SUPPORT CPU12 8 16 REFERENCE MANUAL ...
Page 338: ...MOTOROLA MEMORY EXPANSION CPU12 10 8 REFERENCE MANUAL ...
Page 364: ...MOTOROLA INSTRUCTION REFERENCE CPU12 A 26 REFERENCE MANUAL ...
Page 386: ...MOTOROLA HIGH LEVEL LANGUAGE SUPPORT CPU12 C 6 REFERENCE MANUAL ...
Page 438: ...MOTOROLA SUMMARY OF CHANGES CPU12 S 2 REFERENCE MANUAL ...
Page 439: ......