Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
peeking arrowkeys
#1
is it possible to use peek to determine a press of an arrow key? if so how?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
it's not really using peek to read in the keystrokes, but inp:

Code:
DEF SEG = 1
POKE (&H41A), PEEK(&H41C) 'Clear the keyboard buffer
DEF SEG

CLS
PRINT "Try out arrow keys, and hit ESC to exit."

DO
     k% = INP(96)
    
     SELECT CASE k%
          CASE 72
               LOCATE 3, 1: PRINT "Up"
          CASE 200
               LOCATE 3, 1: PRINT "  "
          CASE 75
               LOCATE 3, 4: PRINT "Left"
          CASE 203
               LOCATE 3, 4: PRINT "    "
          CASE 77
               LOCATE 3, 9: PRINT "Right"
          CASE 205
               LOCATE 3, 9: PRINT "     "
          CASE 80
               LOCATE 3, 15: PRINT "Down"
          CASE 208
               LOCATE 3, 15: PRINT "    "
     END SELECT

LOOP UNTIL k% = 1


*peace*

Meg.
Reply
#3
I wanted a program that you can hold multiple keys, like the arrow keys, down at the same time but i found one. thanks anyway

Code:
'===========================================================================
' Subject: MULTIPLE KEYS                     Date: 03-08-97 (13:07)
' Author:  Joe Huber, Jr.                    Code: QB, QBasic, PDS
' Origin:  huberjjr@nicom.com              Packet: KEYBOARD.ABC
'===========================================================================


DECLARE FUNCTION MULTIKEY (KEYNUM)
DIM SHARED KEYS(255), SC(255), DU(255)

FUNCTION MULTIKEY (KEYNUM)

STATIC FIRSTIME

IF FIRSTIME = 0 THEN
  FOR E = 0 TO 127        
  SC(E) = E: DU(E) = 1          
  NEXT                          
  FOR E = 128 TO 255            
  SC(E) = E - 128: DU(E) = 0  
  NEXT                    
  FIRSTIME = -1      
END IF                    
                                
I$ = INKEY$      
I = INP(&H60)    
OUT &H61, INP(&H61) OR &H82: OUT &H20, &H20      
KEYS(SC(I)) = DU(I)

MULTIKEY = KEYS(KEYNUM)


END FUNCTION

I cut it out of a big prog so i might have missed something
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#4
you can hold down multiple arrow keys in my program...

*peace*

Meg.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)