80-Bus News

  

September–October 1984, Volume 3, Issue 5











Page 7 of 47











DETERMINING THE NASCOM KEYBOARD STATUS By Geoff Higgs

When Nas-Sus scans the keyboard it stores the state of all the keys in ? “KMAF” positions, known as KMAFO to KMAFS, at locations O0CO1 to 0CO9 hex, 3073 to 3081 decimal. These are updated every time the keyboard is scanned.

The chart shows the Nascom 2 keyboard as layed out. Beneath the legend for each key is the address and below that it’s contents after 3 keyboard scam when that key is pressed. This is shown in both Hex and decimal notation. The contents remain the game on repeated scans until the key is released. Since each key is bit-mapped it can be detected irrespective of how many keys are simultaneously pressed. When several keys sharing the same map address are pressed, the content is the sum of the values for all the keys pressed.

Note that SHIFT does not chaneae the contents for ary key but only puts 10 Chex), 16 (dec) in KMAFO. Similarly GRAPH and CTRL are mapped es any other key.

When Key presses are required to control features of programmes, the use of this table avoids involvement with repeat keyboard routines and their associated adjustable delays.

Example? Assembly

SCANKE EQU 62H KMAFPO EQU OCOQ1H

TESTKY LD HL,» KMAPO+Z SCAL SCANKE

BEIT 3, CHL) ; “D” pressed, other keys “don’t care JR Z,RTNI

INC HL

INC HL

LD A,4

CF CHL) ; “B” pressed but mo others using O0COSH JR Z,RTNZ j or CALL Z

dR TESTKY 3} aor RET

Basic

10 K=USRCO)IREM Scan keyboard user routine

20 IF FEEK(S3075) AND G=8 THEN 1007RKEM Go to routine 1 30 TF PEEKC3077)=4 THEN 200?REM or GOSUE

40 GOTO 10!RKEMN or RETURN

KMAFO is “duplicated” as KMAF& at OC09’ hex (3081 decimal) and properly should be used instead. In practice I nave never found any difficulty either way.


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 7 of 47