[Coco] BREAK detection under Basic09

Dave Philipsen dave at davebiz.com
Thu May 31 12:23:27 EDT 2018


Yes, and in reality many programs that are anything more than a simple 
utility will probably want to disable one or more of the special 
functions and then re-enable them when the program is exited.  For 
example, in a text editor or word processor program you probably would 
not want an inadvertent BREAK key press to abort the program nor would 
you want an XOFF to halt output to the screen. And, in a terminal 
program you would most likely want all of the control characters 
available to actually send instead of having certain ones trapped by the 
operating system, etc.

Dave


On 5/31/2018 9:38 AM, L. Curtis Boyle wrote:
> One can use RUN Syscall in BASIC09 to directly access system calls, so that is not a problem (I assume you are talking about using GetStat and SetStat with SS.Opt). BASIC09/RUNB itself does have a signal trap built in (which would catch the CTRL-E and CTRL-C, if they are left to their default values), but it’s use is limited to aborting the procedure (or breaking into the debugger in BASIC09). So the best way is probably to do as you suggested, and used Syscall and the Get/SetStat to get the current path’s PD.Opt packet, reset either or both the quit and abort ASCII codes to 0 (disabling them from triggering a signal), and then Inkey should work.
>
>
> L. Curtis Boyle
> curtisboyle at sasktel.net
>
> TRS-80 Color Computer Games website
> http://www.lcurtisboyle.com/nitros9/coco_game_list.html
>
>
>
>> On May 31, 2018, at 12:37 AM, Dave Philipsen <dave at davebiz.com> wrote:
>>
>> Rogelio,
>>
>> Under OS9 the BREAK key normally has a special function so an INKEY function will never see it because the operating system traps it before it can get to a user program.  However, all of these special functions can be re-mapped so it is possible to read the BREAK key with an INKEY function.  Just for snicks, try a ‘tmode qut=00’ before you start your BASIC09 program and see what happens.  I think the INKEY function will be able to read it as a CONTROL-E.
>>
>> I’m not an expert with BASIC09 but I think that might work.  In assembler there are SetStat routines that allow us to re-map those functions but I don’t know if anything is available from with BASIC09 to do that.
>>
>> Dave
>>
>> Sent from my iPad
>>
>>> On May 31, 2018, at 1:19 AM, Rogelio Perea <os9dude at gmail.com> wrote:
>>>
>>> To date I can't recall if I have ever seen a routine in Basic09 to detect
>>> when the BREAK key is pressed. Top of my head I will try with INKEY or
>>> GET#0 see how things work out... just testing the waters in the CoCo list
>>> for any words of wisdom :-)
>>>
>>>
>>> -- RP
>>>
>>> -- 
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>> -- 
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>



More information about the Coco mailing list