Some CISC221 students, having begun to work on their second assignments may have begun to realize that debugging assembler level code is pretty tricky. Here are some hints.
DECO or HEXO
or CHARO instructions. Unfortunately a single
instruction like that doesn't do much, but you can put in several.
Another possibility would be to add a little tiny Pep/6 debugging
subroutine to your program, like this:
debug: CHARO c#/!/,i ; debugging line
CHARO c#/n/,i ; show value of n
CHARO c#/=/,i
HEXO n,d
etc.
etc. putting in whichever debugging outputs you need
CHARO d#13,i ; newline at end of debugging line
RTS
and then you can just drop in JSR debug wherever
you need a debugging output. If there are different debugging
outputs you need, you could write different debugging subroutines.
The subroutine doesn't have any parameters, so there is no need to
worry about parameter passing conventions, just JSR
and RTS! If the debugging print routine doesn't do
anything except output, then it will have no effect on status
registers or anything else in the state of the Pep/6 machine.
When interruption takes place, you want to know what's in the registers and what's in memory. You ought know what your algorithm is supposed to be doing, because you have to be able to compute (in your head or on paper) the expected bit patterns, or hex, or decimal, or character values in each register and in the memory locations you're interested in.
Good places to put breakpoints are:
The placement of breakpoints is greatly eased by using a consistent and structured programming style. Addresses for breakpoints and data (variables) can be obtained from the Assembler Listing.