Execution of a return jump instruction causes the
address of the next instruction to be executed in the
main program to be stored (usually in the entry cell of
the subroutine). It then causes the instruction of the
second cell of the subroutine to be executed. The last
instruction to be executed will usually be a straight
jump to the address contained in the entry cell. Since
a jump instruction specifies the address of the next
instruction to be executed, the computer is provided
with a means of returning to the main program once
the subroutine has been executed.
PROGRAM CONSTRUCTION
The process of writing a program is broken down
into six basic steps.
1. Statement. A statement forms a clear compre-
hensive statement of the problem.
2. Analysis. Analysis consists of laying out the
problem in a form that will lend itself to arithmetical
and/or logical analysis, determining what logical
decision must be made, and if data manipulation is
required.
3. Flow diagram. A flow diagram, or chart, is an
expansion of the steps in which special symbols are
used to represent the various operations to be
performed and the sequence in which they are to fall.
4. Encoding. The process of converting the
operations listed in the flow chart into language the
computer will use, either machine instructions, words,
or compiler statements.
5. Debugging. The process of locating errors in
the program is called debugging. Various
techniques are available for this purpose. A program
may be written to include some aids for itself, or a
separate debugging program may be run to test the
operation of a malfunctioning program. For a simple
program, a trial solution may be done on paper, and
the computed results compared with those actually
obtained at each step.
6. Documentation.
Documentation is very
important because later changes may be warranted in
a program, or it may be desirable to use subroutines
from another program.
Proper documentation will
ensure that this can be accomplished. Documentation
should include the following:
l Program title
. Problem statement
l
l
l
l
l
l
l
l
Programmers name
Date
Memory area used and/or number of cells used
Registers used
I/O devices required
Flow diagram(s)
Hard copy (program listings, especially a
listing of the coded instructions)
Program tapes
FLOW CHARTING
The programmer constructs a program map in
determining a solution to a problem. This map is
commonly called a flow chart and serves a multitude
of important functions.
The flow chart maps the
logical steps required, decisions to be reached, and
paths to be followed as a result of the decisions.
When properly annotated, it defines input/output
requirements, address allocations, data accuracy
considerations, and register usage. A flow chart is
valuable when debugging a program and when
making future changes.
Flow charting can be constructed at various levels
of complexity. A high-level flow chart consists of a
few symbols and presents a broad overview of the
problem. A low-level flow chart may approach a
one-to-one correspondence between flow chart
symbol and program instruction. Usually, there will
be several flow charts for a program area. These may
be compared to the prints found in a maintenance
manual.
These prints include a block diagram to
show the relationship of major units (high-level),
functional block diagrams showing the major circuits
in a unit (intermediate-level), and the schematics of
the circuits (low-level). Flow charts should beat such
a level that they will implement all the uses
previously discussed.
MAINTENANCE PROGRAMS
As we have previously stated, a routine or
program is a series of instructions that control the
operations of a computer. Each instruction is used to
cause some action that is part of the overall task the
computer must perform.
Therefore, an instruction
may be considered as the basic building block of a
computer program.
8-15