basic : I'm looking for a quick key query and jump with gosub

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

basic : I'm looking for a quick key query and jump with gosub

Post by funkheld »

Hi good afternoon.

I'm looking for a quick key query and jump with gosub.
How can my key query be made faster please?

Thanks.
greeting

Code: Select all

START:
  GET A$ 
  B=ASC(A$)
  IF B=88 THEN GOTO WEITER
  IF B=81 THEN GOSUB SPRLI
  IF B=69 THEN GOSUB SPRRE
  IF B=87 THEN GOSUB SPRUP
  IF B=83 THEN GOSUB SPRDOWN
  IF B=82 THEN GOSUB SCRLINKS
  IF B=84 THEN GOSUB SCRRECHTS
GOTO START

SPRLI:
...
...
return

SPRRE:
.....
......
return

Last edited by funkheld on Mon Mar 25, 2024 1:18 pm, edited 1 time in total.
User avatar
ahenry3068
Posts: 1145
Joined: Tue Apr 04, 2023 9:57 pm

Re: basic : I'm looking for a quick key query and jump with gosub

Post by ahenry3068 »

Look at the ON (X) GOTO/GOSUB STATEMENT. You'll have to rearrange your code a little but it will give you better response than the IF / THENS
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: basic : I'm looking for a quick key query and jump with gosub

Post by funkheld »

hello thanks for info.


greeting
Post Reply