RCA COSMAC Operator's Manual page 110

Microkit
Hide thumbs Also See for COSMAC:
Table of Contents

Advertisement

Page 73
Common Program Bugs
Program debugging often consumes a large amount of .
system development time.
It would be impossible to
list all of the programming errors that are possible.
However, based on experience, there are a few pro-
gramming errors that are frequently made by new
COSMAC programmers.
Avoiding these programming pit-
falls will considerably reduce program debugging time.
One of the most common errors involves the wrong
value in X.
Setting X to the proper value immediately
before use eliminates this potential problem.
The
COSMAC programmer must also keep track of which
register is currently being used as the program counter.
He must also keep track of 256 byte memory segments to
avoid branching problems, since BRANCH instructions
cannot directly branch between 256 byte memory segments.
For long programs a long branch subroutine should be
employed.
Improper scratchpad register initialization before use
is often a source of program bugs.
The programmer
should maintain a register utilization list and initialize
eadh register before use.
Program interrupt routines can cause very hard-to-find
bugs.
For example, if the interrupt routine uses ·an
F6 instruction, DF mayor may not be changed during the
interrupt routine.
If DF is not saved and restored by
the interrupt routine, programs will run properly most
of the time.
Once in a great while, however, interrupt
will occur before a BRANCH instruction and the interrupt
routine will change DF.
This type of non-repetitive bug
should be avoided at all cost.
A machine register that
can be modified by an interrupt routine must be saved and
restored.
In general, program debugging will be reduced to a minimum
by careful planning and flowcharting prior to machine
language coding.
Manually going through several flow-
chart examples will often turn up bugs that would take
much more time to discover in the actual program.
COSMAC is actually quite easy to program.
Potential
pitfalls are easy to avoid and the simple, consistent
set of instructions is easy to understand and use.
Large programs are best written using a subroutine
structure and/or an interpetive structure.

Advertisement

Table of Contents
loading

Table of Contents