Getting the IN on the 2068

Author(s): Dennis Jurries
Publication: LISTing Newsletter
Date: September 1984
Pages: 12

The are a possible of 65536 I/O ports on the 2068. These are used by the computer for communicating with things like the keyboard or the printer, and the can be controlled from BASIC by using the IN statement.

IN is a function like PEEK IN address

The keyboard is divided up into 8 half rows of 5 keys each.

IN 65278 reads CAPS SHIFT to V
IN 65022 reads A to G
IN 64510 reads Q to T
IN 63486 reads 1 to 5
IN 61438 reads 0 to 6
IN 57342 reads P to 7
IN 49150 reads ENTER to H
IN 32766 reads SPACE to B

The value of these addresses when no key is depressed is 31. Starting from the outside of the keyboard and moving towards the center the values are 30,29,27, 23, & 15. On some models of the Spectrom, no key depressed is 255, and the other values are 254,253,251,247, & 239.

The following program illustrates this.

10 FOR n=0 TO 7: REM half-row #
20 LET a=254+256*(255-2↑n)
30 PRINT AT 0,0;IN a: GOTO 30

When you finish with each half row, press BREAK and then type NEXT n.

The IN function can be used in many ways in a program. One way is to use it to change a position of something on the screen. Say the variable x has some value: LET x=x-(IN65022=30) . This will decrease the value of x by 30 only if the A key is depressed.

Extracted from! Clackamas County Area Timex Sinclair Users Group

Also printed in LISTing September 1989.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.