[Coco] How to detect a key pressed in OS-9

Wayne Campbell asa.rand at gmail.com
Wed Apr 24 10:57:20 EDT 2013


Inkey asm listing was in the 6809 version Basic09 manual. Syscall listing was in the OSK 2.4 Microware Basic manual AFAIR.

Inkey syntax is

RUN inkey([#path],char)

#path is optional file or input path (default is stdin if not specified

char is variable of type byte or type string

Wayne

Bill Pierce <ooogalapasooo at aol.com> wrote:

>
>Mr Gault,
>Thanks, I had forgotten the code for inkey and syscall were in the manual. I knew there was a getstat call that would sense a key but hadnt't thought of doing a read afterwards. Also, in both cases, the getstt and the read nead the path in A which would be STDIN (0). The full code would be:
>
>InASM:
>buffer rmb 1
>  clra
>  ldb #SS.Ready
>  OS9 I$GetStt
>  bsc Exit   no then exit
>  clra
>  leax buffer,pcr
>  ldy #1
>  OS9 I$Read go read one character
>Exit  rts
>
>In C:
>
>  Registers regs;
>  char mbuffer[32];
>  char buffer;
>
>  regs.rg_a = 0;
>  regs.rg_b = SS_READY;
>  regs.rg_x = *mbuffer   /* 32 byte buffer address for getstt data */
>  if(_os9( I_GETSTT,&regs); == 0) {
>     read(STDIN,buffer,1);
>  }
>
>I think that is right. I haven't had to use an inkey type loop in my programs lately, so I'm basing this on the Basic09 inkey call.  
>
>Bill Pierce
>My Music from the Tandy/Radio Shack Color Computer 2 & 3
>https://sites.google.com/site/dabarnstudio/
>Co-Webmaster of The TRS-80 Color Computer Archive
>http://www.colorcomputerarchive.com/
>Co-Contributor, Co-Editor for CocoPedia
>http://www.cocopedia.com/wiki/index.php/Main_Page
>E-Mail: ooogalapasooo at aol.com
>
>
>
>
>-----Original Message-----
>From: Robert Gault <robert.gault at att.net>
>To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
>Sent: Tue, Apr 23, 2013 9:58 pm
>Subject: Re: [Coco] How to detect a key pressed in OS-9
>
>
>Bill Pierce wrote:
>>
>> Luis,
>> I think Inkey for Basic09 acts just like Basic's INKEY$.
>
>Not only is that true, but the source code for the Basic09 INKEY$ routine is 
>listed in the owner's manual in the Basic09 section, Appendix B.
>
>The gist of the code is
>  ldb #SS.Ready
>  OS9 I$GetStt
>  bsc Exit   no then exit
>  ldy #1
>  OS9 I$Read go read one character
>  rts
>
>
>
>--
>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