48/317
3 - Programming a microcontroller
Then, once he masters both, he may start to write his source file. Obviously, if later he has to
do the same jobwitha different processor, the source filewill be of no use in the future project.
3.1.2.2 Assembler
The word assembler has usually two meanings. Properly used, it is a program that translates
a text file, written according certain rules, into a binary file that contains a series of instructions
specific to a microprocessor or a microcontroller. However, the word Assembler is often im-
properly used instead of “assembly language”, for example in the sentence: “this program is
written in assembler”. This paragraph introduces the translating tool, or “assembler”.
The assembler is a program that runs on whatever computer is used by the programmer for
his regular job. It takes the source file, as explained above, as an input; then, after translation,
it outputs, depending on the user-specifed options, any of the following files:
The object file, containing binary data intended for further processing. It can not be read by
man.
The listing file, is a report containing both the original source code and its numeric
translation, presented in a tabulated manner. It can be read by man and used for reference
purposes.
In some cases, other files like, lists of variables and labels, or additional data. This varies
fromoneassemblertoanother.
If the assembler encounters an error in the syntax of the source file, or some ambiguity or lack
of information preventing it from completely processing the source file, it generates an error
report, this may be output in the listing, in a separate file, or directly on the computer console.
The error messages tell where the error is located, and, as much as possible, the cause of the
error, as in the following example:
TRIAL.ASM(6): ERROR: not a ST7 instruction or directive