[comp.sys.mac.programmer] Signals for THINK Pascal 3.0

dwright@sif.claremont.edu (Dan '(' Wright)) (07/20/90)

Has anyone used Signals (see TN #88 & DTS sample code #12) with THINK Pascal?
I've been trying to get it to work, but keep getting strange results.  I
assembled the 68000 code with CDS, converted it to a TP library with the
Convert .Rel program, then included it in a simple test program (see below). 
When I run the program with debugging turned on, TP detects a Bus Error upon
returning from the InitSignals.  With debugging turned off, the program runs
fine.. as long as no errors are encountered.  When an error is signalled, the
message "Signal caught from Main: 4" is displayed, and my machine hangs,
usually forcing a reboot.

program TestSignals;
uses Signals;
var
    i : integer;
begin
    {Standard TP initialization takes place here}
    InitSignals;	{Return a bus error w/debugging on}
    i := CatchSignal;
    if i<>0 then begin
	writeln('Signal caught from Main: ',i);
	exittoshell;
    end;

    {other stuff..}
    write('Send signal?');
    readln(response);
    if (response='y') then Signal(-4);
end.

Any ideas about what's going on?  My only guess is that TP uses A6 internally
within the main part of the program, though I can't imagine why (InitSignals
puts $FFFFFFFF in A6 to mark to the outer-most level of the program).

All help much appreciated.
-Dan
-------------------------------------------------------------------------------
Dan Wright          DWRIGHT@SIF	         Macintosh Systems Manager
Internet: dwright@hmcvax.claremont.edu
Harvey Mudd College, Claremont, CA       Consider it disclaimed!
-------------------------------------------------------------------------------