Developing Software in Assembly Language
By Jonathan W. Valvano
This article, which discusses assembly language programming,
accompanies the book Embedded Microcomputer Systems: Real Time Interfacing published by Brooks-Cole 1999.
For an introduction describing how to run the application
TExaS, see the help files included with the application. To develop
assembly language software, we first use an editor to create our
source code. Source code contains specific commands in human-readable-form.
Next, we use an assembler to translate our source code into object code. Object code contains the specific commands in machine-readable-form.
When developing software for a real microcomputer, a loader is
used to place the object code into our computer's memory. We test
our program with the aid of a debugger. For more information on
the allocation into specific type of memory within the embedded
microcomputer see the section on Memory Allocation in Chapter
2 of Embedded Microcomputer Systems: Real Time Interfacing by Jonathan W. Valvano. In the final product, the power on reset
is used to start software execution after power is supplied to
the microcomputer. If the object code is to be stored in EPROM,
we can use an EPROM programmer. Many microcomputers contain built
in features that assist in programming its EPROM, while other
microcomputers require a separate apparatus to program. The following
figure outlines the software development process.
This document has four overall parts:
Overview
The overview section includes a simple case study illustrating the software
development process. The basic terminology used in assembly language
development is defined and examples are given. The development
environments of evaluation boards and simulation are introduced.
Syntax
The syntax section defines the various components of an assembly program.
Some of specific topics include labels, op codes, pseudo-op codes, numbers, strings, operands, comments and assembly errors. Descriptions of the assembly opcodes and their addressing modes
for the 6805, 6808, 6811 and 6812 can be found in the help file
of the application TExaS. This application can be found on the CD accompanying the book.
Local variables
Local variables are an important topic in assembly language programming. This
document defines methodologies for implementing local variables
on the 6808 6811 and 6812. There are examples of how C compilers
generate local variables. The particular environments illustrated
include the Symantec Think C version 7 for the 68K Macintosh,
the ImageCraft ICC11 version 4.0 for the Motorola 6811, the ImageCraft
ICC12 version 4.0 for the Motorola 6812, and the Borland C version
3 for the Intel 386 IBM-PC.
Examples
Observing working examples is an effective method for learning assembly language programming.
Included in subsection are many 6812 assembly language programs
on if-then, for-loop, while-loop, addition, subtraction, multiplication, digital filters, table
interpolation, shifting, stack initialization, interrupt vectors, first in first out queues, and command interpreters. The example subsection of this html document only includes 6812
code, but there are many more examples for the 6805, 6808, 6811
and 6812 installed with the application TExaS. Some examples are RTF files, which can be found in the MC6805,
MC6808, MC6811 and MC6812 subdirectories. These examples can be
loaded directly into the simulator and executed. Other examples
can be found as part of the help file of TExaS.