Topic 3.tools Used in ASL Programming
Topic 3.tools Used in ASL Programming
1] THE ASSEMBLER
An assembly language program cannot be executed by a machine directly as it is not in binary form
[machine language]. Usually we refer to such a program as a source program. A program is needed
in order to translate an assembly language [source] program into the object code executable by the
machine. The program that does all this is called an assembler.
Several types of assemblers are available the most common are;
1] One-pass assemble
2] two-pass assemble
3] Macro assemble
4] Cross-assemble
5] Resident assemble
6] Meta assemble
One-pass assembler.
In one pass assembler the source code is processed only once. As the source code is processed, any
labels encountered are given an address and stored in a table. Therefore when the label is
encountered again the assembler may look backwards to find the address of the label. If the label
has not been defined yet the assembler issues an error message.
Since only one pass is used to translate the source code a one-pass assembler is very fast.
Two-Pass Assembler
The two-pass assembler is similar in operation to the one pass with one major difference i.e the first
pass made through the source code is specifically for the purpose of assigning an address to all
labels. When the labels have been stored in a table with the appropriate addresses a second pass is
made to actually translate the source code into machine code.
Macro-Assembler
A macro assembler is a type of two pass assembler that allows the programmer to write the source
code in a macro. Conditional assembly is also included in macro assemblers.
- 84 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Cross-Assembler
A cross assembler may be of any type already mentioned. The distinguishing feature of across
assembler is that it is not written in the same language used by the processor that will execute the
machine code generated by the assembler. Cross assemblers are usually written in high level
languages e.g. FORTRAN and then the assembler may be executed on another machine e.g.
Motorola 6800.
Resident-Assembler
Is almost the complete opposite of cross-assembler. It is written to run on the same machine that
will execute the source code.
Meta-Assembler
The most powerful assembler is the Meta assembler because it will support many micro-processors.
The programmer merely specifies at the start of the source code which microprocessor. The
assembler will translate the source code to the correct machine code.
NB
The output file from most assemblers is an object file is a code that may be confirmed to execute at
any address.
2] EDITOR
This is the program used to modify and create the files contain your own program and document A
good editor is display oriented i.e. a cursor that shows or marks your place in the file the editor has
commands to change ,delete or insert lines or character The two type of editors currently;
1] Line-Oriented editor
2] Character-Oriented editor
The main difference between the two is that line editor do not display any change in the file whereas
character editors will display the change. Character oriented editor are also called screen editor or
display editor.
- 85 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
3] DEBUGGER
This is a program that removes the bugs/errors out of your program. The debugger provides an
interactive method of executing and debugging the program one or a few instructions at a time.
Debugging Techniques
Debugging a microprocessor based system may be divided into two categories:
(i) Software debugging
(ii) Hardware debugging
Both debugging processes are usually carried out separately from each other because software
debugging can be carried out on an emulator without having the final system hardware.
In a single-board microcomputer, techniques commonly used in debugging are:
i) Single-stepping technique
ii) Breakpoint technique
iii) Register examine/simulator program
a) Single step
A single-stepper facility makes use of a single-step key on a keyboard and allows the user to execute
the program being debugged one instruction at a time. Generally, a single step facility is built with a
hardwired logic circuit. As the single-step key is pushed, it is possible to observe addresses and
codes as they are executed. During debugging, it is usually helpful to examine the state of the data
bus, the address bus, the control bus and the status flags. By the single step technique, one can be
able to detect program faults such as;
i. Incorrect addresses
ii. Incorrect jumps
iii. Incorrect data
iv. Erroneous op-codes etc
The single step technique is useful for short programs.
b) Breakpoint
A breakpoint facility allows the user to execute a program in sections. The breakpoint can be set in a
program by using the RST instructions. When the execute key is pushed, the program is exeuted
until the breakpoint. The registers can then be examined for expected results. If that segment of the
program is found to be satisfactory, a second breakpoint can be set at another memory address to
debug the next segment of the program. With the breakpoint facility, you can isolate the segment of
the program with errors. Then that segment of the program can be debugged with single-step facility.
- 86 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
- 87 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
5] LABLES
When a programmer is writing a program containing jump instruction, he does not always know the
absolute address in memory where the instruction is stored. Therefore it is usual for a programmer to
use „symbolic address name‟ or „labels‟ to indicate the intended addresses of the destination
instruction and it is only during the translation process that these are converted to absolute addresses
as shown below.
Normally the symbolic names used for labels are a mix of alpha – numeric names by the
programmer e.g. REPEAT, START, RESULT, BEGIN, LOOP, SUM, NUM etc
- 88 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
- 89 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
NOTE
The commas are necessary for the assembler to differentiate between data values. When the code is
assembled, the machine code would appear as follows;
2000…….44
2001…….34
2002…….25
2003…….D3
d) Define storage (DS)
This instruction reserves or allocates memory locations for storage of temporary data
e.g. ORG 1800H
TEMP1: DS 2
This reserves 2 bytes of memory at locations starting from 1800H
7] MACRO
A macro is a sequence of instruction that the programmer gives a name. Whenever the programmer
wishes to duplicate the sequence of instruction, the macro name is inserted in the source code. The
macro routine is not the same as a subroutine „call‟ in assembly language. An assembly language
call is a function of the microprocessor. When a macro is used it is a function of the assembler and
not the micro-processor. Every time the macro name is encountered in the source file a block of
instructions (macro) is assembled.
- 90 -