The first bug

Start the program under szadb control
adb.ttp unexpand.tos
and set a breakpoint at settab+4, just after link instruction. Run the program with :c ; $C. This will produce the following display


[]bcktrace.exm


In the absence of better information all arguments shown in the stack backtrace are assumed to be two bytes wide. We know from the source that settab() actualy expects one pointer. Confirm that it got a right one by putting it together from two halfs and using the request 68bb4=p to print it as the symbol. You should see _tabs in response. To continue execution of the current function till it returns to its caller, use :f which stands for :finish.

It is clear from lines 30 and 35 that the first tabstop in _tabs is expected to be on a position TABSTOP - 1. Dumping some initial fragment of the just initialized array we see the following:


[]tabs.exm


This is clearly wrong and one bug becomes obvious. To repair it line 59 should be changed to

for (i = 1; i <= MAXLIN; i++) {...}