[comp.sys.apple] Reading the Button with PDL

KAPFFER@DMZRZU71.BITNET (Matthias Kapffer) (01/11/88)

 I/O  addresses  from $C060 thru $C067 (cassette in/button 0-2/paddle 0-3) are
repeated  immediatly after them.  Therefore a PDL(n), n= 4..7, will access the
four one-bit inputs mentioned above.  Taking a look at the paddle read routine
at  $FB1E  will  reveal that PDL(5) for example yields 0 if button 0 (the open
apple key) is open and 255 if it is pressed (values in between can be obtained
if the button is released during the loop).
 I.e. the following A/S program line
   10 DEF FN BT(N)= INT(PDL(5+N)/255)
or
   10 DEF FN BT(N)= PDL(5+N)>0
defines  a  function similar to Apple Pascal's BUTTON boolean function in UNIT
AppleStuff.  (Note that both defs are *not* fully equivalent !)

                                        Matthias Kapffer
                                        <KAPFFER@DMZRZU71.BITNET>

Please note that my former account (MAT6013) is no longer valid.