[Coco] INSTR question

Robert Gault robert.gault at att.net
Thu Feb 9 17:48:06 EST 2017


Allen,

Can't answer your specific INKEY$ questions but here is an alternative approach.

$87 is the INKEY$ RAM image

I use something like the following example in my menu programs to process selections. The following 
accepts numbers 1-F (hexadecimal) as single key strokes. If you want more than 15 entries, just 
extend the acceptable values.

Obviously in a menu, the subroutines do more than print the  pressed key. :)

10 CLS:GOSUB 100: IF A>0 AND A<10 THEN 30
20 A=A-7:IF A<10 OR A>15 THEN 40
30 ON A GOSUB 300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460
40 LOCATE23,10:PRINT;:GOTO10
100 A=PEEK(&H87)-&H30:POKE&H87,0:RETURN
300 LOCATE23,10:PRINT HEX$(A):RETURN
310 GOTO 300
320 GOTO 300
330 GOTO 300
340 GOTO 300
350 GOTO 300
360 GOTO 300
370 GOTO 300
380 GOTO 300
390 GOTO 300
400 GOTO 300
410 GOTO 300
420 GOTO 300
430 GOTO 300
440 GOTO 300
450 GOTO 300
460 GOTO 300

Robert


More information about the Coco mailing list