Author Topic: Yabasic Keyboard Keys  (Read 1088 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Yabasic Keyboard Keys
« on: October 11, 2021 »
This activates all 16 buttons.

It shows momentary on and press on.

Code: [Select]
restore keytype
read keys
dim go(keys)
dim g(keys)
dim z(keys)
dim key(keys)
dim key$(keys)

for a=1 to keys
read key$(a)
read z(a)
key(a)=1
next a

open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

for a=1 to keys
if and(c,2^(a-1))<>0 go(a)=1
if go(a)=1 g(a)=g(a)+1
if g(a)>2 g(a)=2
if g(a)=2 go(a)=0
if and(c,2^(a-1))=0 g(a)=0
if go(a)=1 key(a)=key(a)+1
if key(a)>2 key(a)=1
next a

for a=1 to keys
if and(c,2^(a-1))>0 z(a)=z(a)+1
if z(a)>100 z(a)=0
text 240,a*20+100,str$(z(a))
next a

for a=1 to keys
if key(a)=2 then
setrgb 1,0,256,0
else
setrgb 1,256,256,256
endif
text 300,a*20+100,key$(a)
setrgb 1,256,256,256
if a>9 then
space=10
else
space=0
endif
text 270-space,a*20+100,str$(a)+"."
next a

until (1=0)

label keytype
data 16
data "pageup",0
data "F1",0
data "F2",0
data "pagedown",0
data "up",0
data "right",0
data "down",0
data "left",0
data "menu",0
data "tab",0
data "control",0
data "caps",0
data "home",0
data "end",0
data "delete",0
data "insert",0

I have it in all my programs.

Even though I mostly use
go(5), go(6), go(7) and go(8).
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.