[Coco] signal/intercept routine in Basic09
Bob Devries
devries.bob at gmail.com
Sun Jan 24 00:57:06 EST 2010
Which code effectively does this:
STB 00,U
RTI
Thanks, Aaron. You da man!
--
Besides a mathematical inclination, an exceptionally good mastery of one's
native tongue is the most vital asset of a competent programmer.
Edsger W.Dijkstra, 18 June 1975
----- Original Message -----
From: "Wayne Campbell" <asa.rand at gmail.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Sunday, January 24, 2010 4:50 PM
Subject: Re: [Coco] signal/intercept routine in Basic09
> Aaron Wolfe came up with a signal handler for Basic09, and it works. I
> tested it myself. When you run it, use another window to type
> send -<signal> <proc> where signal is the number and proc is the process.
>
> Wayne
>
> example:
>
> PROCEDURE testsig
> TYPE REG=cc,a,b,dp:BYTE; x,y,u:INTEGER
> DIM regs:REG
> DIM sigHandler(3),callCode,signal:BYTE
> sigHandler(1):=231
> sigHandler(2):=196
> sigHandler(3):=59
> callCode:=$09
> regs.x:=ADDR(sigHandler)
> regs.u:=ADDR(signal)
> RUN SysCall(callCode,regs)
> LOOP
> EXITIF signal=3 THEN
> ENDEXIT
> IF signal>0 THEN
> PRINT signal
> signal:=0
> ENDIF
> ENDLOOP
> END
>
> ----- Original Message -----
> From: "Bob Devries" <devries.bob at gmail.com>
> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
> Sent: Saturday, January 23, 2010 9:20 PM
> Subject: Re: [Coco] signal/intercept routine in Basic09
>
>
>> I'm wondering if the ON ERROR GOTO in Basic09 only handles errors
>> generated by the Basic09 interpreter, but not those which come from an
>> external source?
>>
>> --
>> Besides a mathematical inclination, an exceptionally good mastery of
>> one's native tongue is the most vital asset of a competent programmer.
>>
>> Edsger W.Dijkstra, 18 June 1975
>>
>> ----- Original Message -----
>> From: "Aaron Wolfe" <aawolfe at gmail.com>
>> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
>> Sent: Sunday, January 24, 2010 3:19 PM
>> Subject: Re: [Coco] signal/intercept routine in Basic09
>>
>>
>> Are signals really equivalent to errors? That doesn't seem right. Or
>> is this a Basic09 thing?
>> Signals can happen for many "non error" reasons, for instance a Wake
>> signal often means a very normal, non error condition. In the case at
>> hand, the "other end hung up" signal is sort of an error I guess, but
>> it's not an OS9 error like read or write errors are.
>>
>> as I understand it, os9 'sends' a signal by calling the routine at the
>> address stored in the P$SigVec field of the process descriptor. Does
>> Basic09 automatically put a routine here that turns a signal into an
>> error that will trip the ON ERROR of a running program?
>>
>>
>> On Sat, Jan 23, 2010 at 11:02 PM, Wayne Campbell <asa.rand at gmail.com>
>> 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
>>>
>>> ----- Original Message ----- From: "Christopher Hawks" <chawks at dls.net>
>>> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
>>> Sent: Saturday, January 23, 2010 7:36 PM
>>> Subject: Re: [Coco] signal/intercept routine in Basic09
>>>
>>>
>>>> Wayne Campbell said the following on 01/23/2010 07:59 PM:
>>>>>
>>>>> This sounds like a modification to the way drivewire sends signals?
>>>>
>>>> Standard OS9 signaling. Drivewire sends a Hangup signal.
>>>>
>>>> lda P$ID,x Process to send to
>>>> ldb #S$HUP Signal to send ( 4 )
>>>> os9 F$Send doit
>>>>
>>>>> ----- Original Message ----- From: "Robert Gault"
>>>>> <robert.gault at worldnet.att.net>
>>>>> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
>>>>> Sent: Saturday, January 23, 2010 5:52 PM
>>>>> Subject: Re: [Coco] signal/intercept routine in Basic09
>>>>>
>>>>>
>>>>>> Aaron Wolfe wrote:
>>>>>>>
>>>>>>> It's probably worth noting that the "port closed" signal is not a
>>>>>>> part
>>>>>>> of standard OS-9, it is a feature of the DriveWire additions we're
>>>>>>> working on. The signal's value is 4. It is sent to a process when
>>>>>>> the remote end of a TCPIP connection closes.
>>>>>>>
>>>>>>
>>>>>> For what it is worth, Basic09 would trap the error 4.
>>>>>> ON ERROR GOTO 100
>>>>>> ERROR 4
>>>>>> END
>>>>>> 100 PRINT"The error was caught."
>>>>>>
>>>>>> When this is run, the message is printed. Now the manual indicates
>>>>>> that
>>>>>> there is no real difference between signals and errors. Errors are
>>>>>> just
>>>>>> specific signals. So, if the signal to be caught is coming from
>>>>>> Drivewire,
>>>>>> it does not seem to be getting through to Basic09. That's assuming
>>>>>> error
>>>>>> trapping as above is being used.
>>>>>>
>>>>>> It may mean that using syscall to set up an intercept may not work
>>>>>> either.
>>>>>>
>>>>>> --
>>>>>> Coco mailing list
>>>>>> Coco at maltedmedia.com
>>>>>> http://five.pairlist.net/mailman/listinfo/coco
>>>>>
>>>>>
>>>>> --
>>>>> Coco mailing list
>>>>> Coco at maltedmedia.com
>>>>> http://five.pairlist.net/mailman/listinfo/coco
>>>>>
>>>>
>>>>
>>>> --
>>>> Christopher R. Hawks
>>>> HAWKSoft
>>>> ---------------------------------------------------------
>>>> "The reasonable man adapts himself to the world: the unreasonable one
>>>> persists in trying to adapt the world to himself. Therefore all
>>>> progress
>>>> depends on the unreasonable man."
>>>> -- George Bernard Shaw
>>>>
>>>> --
>>>> Coco mailing list
>>>> Coco at maltedmedia.com
>>>> http://five.pairlist.net/mailman/listinfo/coco
>>>
>>>
>>> --
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> http://five.pairlist.net/mailman/listinfo/coco
>>>
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> http://five.pairlist.net/mailman/listinfo/coco
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> http://five.pairlist.net/mailman/listinfo/coco
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list