sam-users  

Re: Basic keyboard scanning with IN

Colin Piggot
Tue, 07 Aug 2007 16:53:08 -0700

The manual for Simon's excellent Turbomon has the keyboard port map
(http://simonowen.com/sam/turbomon/TurboMON.pdf)

Quickly looking at the PDF myself the ports you need are:

O - IN 57342 - (bit 1)
P - IN 57342 - (bit 0)
Z - IN 65278 - (bit 1)
M - IN 32766 - (bit 2)
SPACE - IN 32766  (bit 0)

The first five bits of each port is used for keys, so BAND is an excellent
way to strip off the unwanted bits to check, and the bits will be LOW if the
key is pressed, so to test bit 0, do BAND 1, bit1 - do BAND 2, bit 2 - BAND
4 ...

E.g. test for say, O, in BASIC....

IF NOT ((IN 57342) BAND 2) THEN .....

Colin
======
Quazar : Hardware, Software, Spares and Repairs for the Sam Coupe
1995-2007 - Celebrating 12 Years of developing for the Sam Coupe
Website: http://www.samcoupe.com/