🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #4736

Re: Character I/O from the 'CON:'sole

#4736
From: markv
Date: Mon, 06 Aug 1990 15:40
58 lines
3155 bytes
In article <32495@cup.portal.com>, Radagast@cup.portal.com (sullivan - segall) writes:
> Does anyone know how to get immediate keyboard events from the 
> default console?  (I.e: The one that is attached to the CLI.) 

Yes.

> I've tried finding it in the system lists (unsuccessfully) and
> I've tried setting the raw keyboard events Ansi command:

First you need to find *your* consoles device handler.  You use
DevProc() to do this.  DevProc() takes a string as an argument,
(device name) and returns it's process pointer.  In the case of your
console window you DONT do DevProc("CON:") because there will be
several CON:s and you will most likely NOT get yours.  Use 
DevProc("*") which returns your stdin/out handler which is a CON: or
NEWCON: if things havn't been redirected.
 
> 	puts("\x9b" "1{"); 
> The latter seems to lock to the program up permanently.  It
> becomes impossible to get a linefeed because the return key
> has been converted into an escape sequence, and getchar() seems
> to want a complete line before continuing.

Your problem is getting normal (cooked) ASCII codes, but
console.device buffers input to a new line.  If you put it in RAW:
mode then you get other problems. 

> I need an example that will allow me to react to keyboard input
> the way the Commodore supplied "more" command does.

You need to Send an AmigaDOS "packet" to your console's device handler
process.  A packet is an Exec Message with a pointer to a command
and N arguments.

With 1.2 there is a new packet type that is something like SETRAWMODE
which turns off line buffering (it is different than making it RAW:).
The 1.2 AmigaDOS manual has the packet buried in the text under a "new
for 1.2 note".  Also the packet IDs and a structure definition for a
StdPacket message which is a Message with the packet tacked on the
end can be found in dosextens.h.

Arp has a function SendPacket() that can greatly simplify the code.

> I asked once before and got no replies, so I hit the books and I'm
> still stumped.  I'd really appreciate the help, or any indication
> of the right place to look.
> 
>                            -Sullivan_-_Segallc(a.k.a. Radagast)

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum			Only...		\    Good Cheer !!!
Academic Computing Services	       ///	  \___________________________
University of Kansas		     ///  /|         __    _
Bix:	  markgood	      \\\  ///  /__| |\/| | | _   /_\  makes it
Bitnet:   MARKV@UKANVAX		\/\/  /    | |  | | |__| /   \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <25172.26bd492d@kuhub.cc.ukans.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!markv
References: <32495@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!markv
From: markv@kuhub.cc.ukans.edu
Newsgroups: comp.sys.amiga.tech
Subject: Re: Character I/O from the 'CON:'sole
Message-ID: <25172.26bd492d@kuhub.cc.ukans.edu>
Date: 6 Aug 90 15:40:45 GMT
References: <32495@cup.portal.com>
Distribution: na
Organization: University of Kansas Academic Computing Services
Lines: 58