Classic Computer Magazine Archive COMPUTE! ISSUE 54 / NOVEMBER 1984 / PAGE 10

Atari Keyboard Scanning

I own an Atari 800. When I OPEN #l, 4, 0, "K:", GET #1, N, press the letter A, and PRINT N, I get the number 65. But when I PRINT PEEK (764) and press A, I get a different number. Are there any PEEKs that will get me 65? Or is there another way to OPEN and GET so it doesn't pause?

Brian Worley

Location 764 holds the value of the last key pressed. This value is not in Atari ASCII (ATASCII), but represents the row and column of the key pressed. When no key has been pressed, PEEK(764) returns a 255. If you don't want to wait for a keypress, yet get the ATASCII value once the key is pressed, use something like this:

100 OPEN # 1, 4, 0, "K :"
110  IF PEEK(764) = 255 THEN 130
120 GET # 1, N : PRINT N, CHR$ (N) : END
130 PRINT "Still waiting…":GO TO 110