[Coco] signal/intercept routine in Basic09
Aaron Wolfe
aawolfe at gmail.com
Sun Jan 24 19:32:46 EST 2010
I think there is great confusion here over what is a signal, and what
is an error. Maybe there is conflicting documentation out there that
is adding to the mixups.
To (hopefully) clarify, based on experiments done recently with Wayne
and all the docs I have here:
Signals are *not* errors. Entirely different things. Errors don't
directly cause signals, nor vice versa. There are some situations
where both an error and a signal occur together, or times where the
lack of a proper signal handler causes Basic09 to have an error. This
probably adds to the confusion.
Basic09's ON ERROR statement does not catch signals. It catches errors.
Basic09 does not appear to have any built in mechanism for
intercepting signals. There is no "ON SIGNAL" equivalent to "ON
ERROR".
Despite this, it's still pretty easy to add your own signal handler
from within Basic09 by putting the asm for the handler in a variable
and doing a syscall F$Icpt with register X set to that variable's
ADDR(). You can use U to pass the ADDR of another variable or array,
and have your asm signal routine store the signal in the second
variable or array.
On Sun, Jan 24, 2010 at 7:45 AM, Robert Gault
<robert.gault at worldnet.att.net> wrote:
> Wayne Campbell wrote:
>>
>> Apparently, ON ERROR GOTO doesn't like 4. I opened a window, ran a test
>> prog that just ran a loop and reacted to ON ERROR GOTO. When I sent the
>> signal 4 to the process from the other window (used send -1 <proc>),
>> Basic09 dropped into debug instead of going thru the error trap.
>>
>> Wayne
>
> That may be the case but here is a more relevant example.
>
> ON ERROR GOTO 100
> SHELL "dir /x2"
> END
> 100 PRINT "Drive not ready."
>
> If this is run without an image mounted in Drivewire slot 2, the message is
> printed. If there is an OS-9 image mounted in slot 2, the directory is
> displayed.
> The signal sent without a disk is 244, read error.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list