
- •Acknowledgments
- •About the Author
- •1.1 Basic Computer Structure
- •1.3 A Few Instructions and Some Simple Programs
- •2 The Instruction Set
- •3.1 Op Code Byte Addressing Modes
- •4.2 Assembler Directives
- •4.3 Mechanics of a Two-Pass Assembler
- •4.6 Summary
- •5.1 Cross Assemblers and Downloaders
- •5 Problems
- •6.3 Passing Arguments by Value, Reference, and Name
- •7 Arithmetic Operations
- •7.2 Integer Conversion
- •8 Programming in C and C++
- •8.1 Compilers and Interpreters
- •9 Implementation of C Procedures
- •9.2 Expressions and Assignment Statements
- •9.4 Loop Statements, Arrays, and Structs
- •10 Elementary Data Structures
- •10.1 What a Data Structure Is
- •11.4 Synchronization Hardware
- •12.4 The 68300 Series
- •A2.1 Loading HiWare Software
- •A2.2 Opening the HiWare Toolbox
- •A2.3 Running Examples From the ManualProgramFolder
- •A2.6 POD-Mode BDM Interface
- •Index

358 |
Chapter 12 OtherMicrocontrollers |
*SUBROUTINE DOTPRD
*GLOBAL VARIABLES USED IN SUBROUTINE AND AS PARAMETERS
TERM: |
RMB |
2 |
|
LOCV: |
RMB |
2 |
|
LOCW |
RMB |
2 |
|
LOCDP: |
RMB |
2 |
|
* |
|
|
|
DOTPRD: |
LDAA |
LOCV |
|
|
LDX |
LOCW |
|
|
MUL |
|
|
|
STAA |
TERM+1 |
; Copy first term low byte to local variables |
|
STX |
TERM |
; Copy first term high byte to local variables |
|
LDAA |
LOCV+1 |
|
|
LDX |
LOCW+1 |
|
|
MUL |
|
|
|
ADD |
TERM+1 |
; Add first term low byte to product |
|
STAA |
LDCDP+l |
; Copy first term low byte to out. param. |
|
TXA |
|
; Move high byte to accumulator |
|
ADC |
TERM |
; Add first term high byte to product |
|
STAA |
LDCDP |
; Copy first term high byte to out. param. |
|
RTS |
|
|
Figure 12.7. A 6805 Dot Product Subroutine
12.4 The 68300 Series
The preceding sections covered microcomputers that are less powerful than the 6812. We now present an overview of the 68300 series of microcomputers (the 68332, 68340) to convey an understanding of the strengths and weaknesses of these microcomputers in particular and of similar 16-bit microcomputers in general. The next section will similarly introduce the 500 and M-CORE series of RISC microcontrollers. However, in these two sections, we will at best be able to prepare you to write a few programs, similar to those written for the 6812, for these microcomputers. There is much more to these computers than we can discuss in the short section we can allot to each computer.
The register set for the 68300 series features seventeen 32-bit registers, a 32-bit program counter, and a 16-bit status register (see Figure 12.8). The eight data registers are functionally equivalent to the accumulators in the 6812, and the nine address registers are similar to the index registers.
The low byte of the status register is similar to the 6812 condition code register, having the familiar N, Z, V, and C condition code bits and a new condition code bit X, which is very similar to the carry bit C. Bits X and C differ in that C is changed by many instructions and is tested by conditional branch instructions, while X is changed only by a few arithmetic instructions and is used as the carry input to multiple-precision arithmetic operations. Having two carry bits, X and C, avoids some dilemmas in the design of the computer that are inherent in simpler computers such as the 6812. This



























Appendix 1 NumberRepresentations and Binary Arithmetic |
385 |
46 = $2E and the 16's-complement of $2E is $D1 + 1 = $D2, the desired result. You should try to understandhow this works. (See the problems at the end of this appendix.)
A1.3 Remarks
The material discussed here can be found in any introductory text on logic design. We recommend the book Fundamentals of Logic Design, 4th ed., by C. H. Roth (PWS Publishing Co., Boston MA, 1995).
