Brian's Man Cave Posted June 20, 2022 Share Posted June 20, 2022 Does anyone know if there is a code to detect that only the disc was pressed? Like if I say press disc to start, and no other key. Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted June 20, 2022 Share Posted June 20, 2022 (edited) 8 hours ago, Brian's Man Cave said: Does anyone know if there is a code to detect that only the disc was pressed? Like if I say press disc to start, and no other key. You have to decode it. The problem is that there is no unique signal that tells you "disc is pressed"; each disc position is unique, but the signal itself is composed of various bits, and each individual bit may be part of a different input. So, the only way to tell is to decode the entire thing and then see if it is one of the disc signals. One easy way of doing it would be with a lookup table: you put all the valid disc codes in a table, then you iterate through it while comparing each element to the value of CONT. If you find a match, it's a disc input. Otherwise, it is not. dZ. Edited June 20, 2022 by DZ-Jay Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted June 20, 2022 Share Posted June 20, 2022 By the way, the lookup table technique is simple enough that I use it to decode the entire thing. I typically don't bother with a specialized "is disc pressed" decoder; I rather employ a full decoder that tells me what input was pressed -- which disc direction, keypad key, or action button. I first look up the input in a table for the keypad, then if that misses, I check for the disc and action buttons. As I decode, I flag which type of input it is: disc, key, button. That's a more general purpose decoder that I can apply for menus, selectors, game-play, and yes, "press disc to continue." dZ. Quote Link to comment Share on other sites More sharing options...
Zendocon Posted June 22, 2022 Share Posted June 22, 2022 On 6/19/2022 at 10:11 PM, Brian's Man Cave said: Does anyone know if there is a code to detect that only the disc was pressed? Like if I say press disc to start, and no other key. If you were to use "PEEK($1ff) AND PEEK($1fe)" (which checks for input from either controller), you could check for a value in the range $e0 to $fe. The reason for that is because keypad and action button inputs drop one or more of the three high-order bits. The disc only drops the five low-order bits. When there is no input, all the bits are raised, which is why the upper bound is $fe. Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted June 22, 2022 Share Posted June 22, 2022 39 minutes ago, Zendocon said: If you were to use "PEEK($1ff) AND PEEK($1fe)" (which checks for input from either controller), you could check for a value in the range $e0 to $fe. The reason for that is because keypad and action button inputs drop one or more of the three high-order bits. The disc only drops the five low-order bits. When there is no input, all the bits are raised, which is why the upper bound is $fe. But that could catch a glitchy or bouncy signal from a different input ... -dZ. Quote Link to comment Share on other sites More sharing options...
Zendocon Posted June 23, 2022 Share Posted June 23, 2022 On 6/22/2022 at 8:04 AM, DZ-Jay said: But that could catch a glitchy or bouncy signal from a different input ... -dZ. Right. You'd want additional logic to detect that, such as what was in SameGame & Robots. I interpreted the original question to be whether checking for only disc input was even possible. Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted June 23, 2022 Share Posted June 23, 2022 4 hours ago, Zendocon said: Right. You'd want additional logic to detect that, such as what was in SameGame & Robots. I interpreted the original question to be whether checking for only disc input was even possible. I thought he was looking for ideas on how to implement a “press disc to start” function. *shrug* dZ 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.