[Coco] PIA keyboard input?

Roger Taylor rtaylor at bayou.com
Tue Dec 9 00:16:00 EST 2003


At 07:45 PM 12/8/2003 -0500, you wrote:
>On Monday 08 December 2003 10:42, peak at mail.polarcomm.com wrote:
> >Since I am not a programmer I really dont know if there is
> >another way. If I were trying to bypass basic but there was a
> >basic routine that did what I wanted I would try to examine
> >and copy only the 1 routine. Perhaps someone more familiar
> >with ml/assembly can help.
>
>Thats not really efficient.  One should setup the registers, define
>$POLCAT as jsr [A0xx], getting the xx from the doc file, and just go
>ahead and use the basic rommed code.


If you want, I can post a complete position-independent keyboard routine 
for the CoCo 1/2/3 that has a macro buffer, auto-repeat, Control/Alt keys, 
etc.  It's a totally self-contained routine you can insert right into any 
machine language source code and start using it.  This routine is already 
added to Portal-9 1.3 as a "snippet".   Oh.. since it uses embedded local 
variables (using the @ identifier), this code is not suitable for programs 
that will run from ROM.

In the snippets box you simply double-click on "InKey.asm" and it becomes a 
project component in it's own window.  The easiest way from there to add 
the routine to your ML program is to use "include InKey.asm" somewhere in 
your program.  That's it.  Now you do a "jsr InKey" instead of calling on 
BASIC.

Perhaps with enough snippets or procedures, one can write programs that 
reside anywhere in the 64k map and the ROMs won't be relied on for simple 
routines like polling the keyboard or reading a disk sector, etc.  32K of 
ROM is a large chunk of memory that you can put a whole 320x200 or 640x200 
graphics screen at if you disable the ROMs.

I will be adding a LOT of snippets to Portal-9.  A double-click here, a 
double-click there, and you can build the meat of your program from 
prewritten code that work similar to procedures.  Some of them will require 
a few parameters to be pushed to the stack beforehand, but that's easy to 
do.  :)

I admit that most of my programs run in all-RAM mode but I use the Disk 
BASIC DSKCON routine by switching into ROM mode right before the call, and 
disabling the ROMs right afterwards.  Certain precautions have to be dealt 
with like not placing any IRQ/FIRQ code in the upper 32k area, and even 
switching the 6309 back to 6809 emulation mode during the DSKCON call, etc.




More information about the Coco mailing list