Jump to content

Photo

help with simple BASIC fix using strig(0)

BASIC stick trigger programming

9 replies to this topic

#1 hloberg OFFLINE  

hloberg

    Dragonstomper

  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 10:20 AM

This is fairly simple I just can't seem to get a good fix on it.

I have a Atari BASIC (actually TBXL) program where you move the stick then choose a menu option by pressing the trigger. then I jump to another menu option that also presses the trigger for confirmation. Problem is the 1st trigger press will carry over to the 2nd menu if you don't pull off the trigger fast enough. I have tried a timing loop for a short pause but that only mostly work. what i want to do is after the 1st trigger press make the user re-press the trigger before it works again. any ideas?

thx, HLO



#2 thank you OFFLINE  

thank you

    Combat Commando

  • 2 posts

Posted Mon Aug 27, 2018 10:40 AM

when the trigger is pressed branch to a loop that waits for it to be released, then jump to the second menu.



#3 hloberg OFFLINE  

hloberg

    Dragonstomper

  • Topic Starter
  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 10:52 AM

when the trigger is pressed branch to a loop that waits for it to be released, then jump to the second menu.

in other words:

90 rem ***strig wait loop***

100 if strig(0)<>15 then 100

200 return

 

don't know why i didn't think of that. i guess i was trying to make it too complicated. :)

thx



#4 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 311 posts

Posted Mon Aug 27, 2018 10:57 AM

Turbo Basic XL?

REPEAT:UNTIL STRIG(0)


#5 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 311 posts

Posted Mon Aug 27, 2018 11:01 AM

in other words:

90 rem ***strig wait loop***

100 if strig(0)<>15 then 100

200 return

 

don't know why i didn't think of that. i guess i was trying to make it too complicated. :)

thx

 

Line with 15 seems to be checking for joystick position, and that should be using STICK(0) function instead of STRIG(0), which can only return 0 (pressed) or 1 (released).


Edited by vitoco, Mon Aug 27, 2018 11:39 AM.


#6 hloberg OFFLINE  

hloberg

    Dragonstomper

  • Topic Starter
  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 2:08 PM

 

Line with 15 seems to be checking for joystick position, and that should be using STICK(0) function instead of STRIG(0), which can only return 0 (pressed) or 1 (released).

figured that I had goofed later but didn't have the time to change it. yup, should be strig(0)<>0

been out of 800 programming for so long forgot the basics. :)



#7 hloberg OFFLINE  

hloberg

    Dragonstomper

  • Topic Starter
  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 2:12 PM

 

Turbo Basic XL?

REPEAT:UNTIL STRIG(0)

elegant. i try it



#8 hloberg OFFLINE  

hloberg

    Dragonstomper

  • Topic Starter
  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 2:53 PM

another question

 

10 if x=y then gosub 4000: g=g+1

20 rem dummy line

 

in line 10

does the return from 'gosub 4000' go to to the next statement in the IF statement 'g=g+1'

or does it drop down to line 20 after the return from 4000 ignoring the 'g=g+1'?

some BASICs have a real problem with this. I can't remember if TBXL and Atari BASIC does.



#9 Rybags OFFLINE  

Rybags

    Quadrunner

  • 15,887 posts
  • Location:Australia

Posted Mon Aug 27, 2018 5:42 PM

After return it'll execute the g=g+1.

To get it to execute only if x isn't = y you'd use ELSE.  But Atari basic doesn't support it.

The substitute for else would be to put a GOTO that skips the next line, and put your "ELSE" code in the skipped line.



#10 hloberg OFFLINE  

hloberg

    Dragonstomper

  • Topic Starter
  • 744 posts
  • Atari Microsoft BASIC
  • Location:New Braunfels, Texas.

Posted Mon Aug 27, 2018 9:33 PM

Ugh.

I'm rewriting a MilleBourne BASIC card game for joystick entry instead of keyboard. 

I'm going to use it on my Atari 800 emulator of my Sony PSP (which works really well with games that don't use the keyboard).

finding out how much I forgot about Atari 8-bit programing.

can't wait till I get back to assembler. should be real fun. :P







Also tagged with one or more of these keywords: BASIC, stick, trigger, programming

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users