[Coco] technical assembler question

Robert Gault robert.gault at worldnet.att.net
Fri May 18 03:01:54 EDT 2007


Darren A. wrote:
>> From: Arthur Flexser
>> Subject: Re: [Coco] technical assembler question
>> Date: Thu, 17 May 2007 19:33:39 -0400 (EDT)
>>
>> If I were doing this, I'd check the keyboard PIA directly, and forget 
>> about
>> using POLCAT.  Much more efficient.  I don't have any notes handy, but 
>> the code
>> is something like:
>>
>> LDA #(value that depends on break key's row in keyboard matrix)
>> STA $FF02
>> LDA $FF03
>> ANDA #(value that depends on break key's column in keyboard matrix)
>> BEQ someplace (break key is being held down)
>>
>> Perhaps someone here can supply the necessary row and column values, 
>> and tell me
>> if I've mixed up $FF03 and $FF02 or some such.  (It's been a long 
>> time!) This is
>> an excellent method for efficiently checking whether a particular key 
>> is down,
>> and even works with the shift key, which POLCAT can't be used to 
>> detect the
>> status of when it is the only key being held down.
>>
>> Art
>>
> -- 
> 
> I think this will do the trick:
> 
>     LDD    #$FBFF
>     STA    $FF02    ; Strobe column 3
>     LDA    $FF00    ; Read rows
>     STB    $FF02    ; Strobe none
>     BITA   #$40     ; Test row 7
>     BEQ    DOBRK    ; Branch if Break down
> 
> Darren
> 

Those are good ideas but if this is for a Coco3 why not use the keyboard 
IRQ or FIRQ at $FF92/$FF93? Any key will generate the interrupt which 
can then be strobed manually or just checked with
  jsr $a1c1
  cmpa #3

Since the check will only occur if there is a key pressed, there is no 
time issue.



More information about the Coco mailing list