[Coco] Extended basic 1.1 command?

Bill Pierce ooogalapasooo at aol.com
Tue Nov 20 23:48:53 EST 2012


This would be one way to do it in Assembly:


08500 *THIS DOES A BUTTON READ OFF THE RIGHT/LEFT JOYSTICK
08600 BUTSTA   PSHS      A                           SAVE RIGHT/LEFT FLAG
08700                         LDX          #$FF00             POINT TO THE I/O PORT
08800                         LDA          2,X                       GET THE KEY SELECT DATA
08900                         LDB          #$FF         SELECT NO KEYS
09000                         STB          2,X                       TO READ JUST THE BUTTONS
09100                         PULS    B                            GET RIGHT/LEFT BUTTON SELECT
09200                         INCB                                        MAKE IT "01"(R) OR "10" (L)
09300                         COMB                                      MAKE SELECTED BIT ZERO
09400                         ORB     ,X                IS GET THAT BUTTON BIT
09500                         STA      2,X                        RESTORE KEY SELECT DATA
09600                         COMB                                       MAKE IT A ONE IF PRESS
09700                         ANDB      #3                         ONLY RIGHT/LEFT BUTTON BITS!
09800                         STB       BDWN,U  UPDATE BUTTON DOWN STATUS
09900                         RTS                                          AND EXIT

Bill P


Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Bill Pierce
ooogalapasooo at aol.com




-----Original Message-----
From: William Astle <lost at l-w.ca>
To: coco <coco at maltedmedia.com>
Sent: Tue, Nov 20, 2012 11:31 pm
Subject: Re: [Coco] Extended basic 1.1 command?


On 12-11-20 09:12 PM, Arthur Flexser wrote:
> The ECB manual method would be equivalent to ORing with $80.  They
> assume bits 2-6 to be ones, as they should be if no key is down.  But
> bit 7 might be a zero, since that's the joystick comparator.

Because basic leaves FF02 set to $FF after scanning the keyboard, the 
value in FF00 will not change at all when keys are pressed. The joystick 
buttons are not attached to any bits in FF02 so the relevant bits in 
FF00 will go to 0 regardless of the value in FF00. Thus, you can assume 
that using PEEK() on FF00 will only return the joystick button status 
and the comparator value.

Now, if you're messing with the PIA yourself (in asm), you can't rely on 
the above, but basic polls the keyboard between every command so you 
can't change FF02 with a POKE in basic.

>
> Art
>

 



More information about the Coco mailing list