Jump to content
IGNORED

Opt 1, Opt 2 and Pause


GadgetUK

Recommended Posts

Is there an easy way to check if opt1, opt2 or pause have been pressed?

 

At the moment in my games I am using:-

 

temp = kbhit();

 

To identify if any of the 3 have been pressed but they all register the same value I think. Does anyone know if there's a quick way to detect these on an individual basis?

Link to comment
Share on other sites

Here's a piece of code that might help you get started:

// Wait for user to press Option 1
while (true)
{
 if (kbhit())
 {
  key = cgetc();
  if (key == 'F') tgi_flip();
  if (key == '1') break;
 }
}

It might be a bit weird example, but it reads the "character" that is read from the "console". It will wait till Option1 is pressed. If you press Flip in the meantime, it will do the flip while waiting for Opt1.

From the cgetc.s source code:

 

; The Atari Lynx has a very small keyboard - only 3 keys
; Opt1, Opt2 and Pause.
; But the designers have decided that pressing Pause and Opt1 at the
; same time means Restart and pressing Pause and Opt2 means Flip screen.
; For "easter egg" use I have also included all three keys pressed '?'
; and Opt1 + Opt2 pressed '3'.
; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'.

Link to comment
Share on other sites

Thanks, I should have thought about looking there. I am sure I tried to check the response from kbhit months ago and it came back with the same value regardless of which button was pressed - but that was an older version of CC65, maybe it has been fixed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...