cdoty Posted August 21, 2020 Share Posted August 21, 2020 Has their been any clever code you've amazed yourself with lately? For me, it's a joystick handling routine. Handling joystick input, in any assembly language, is always messy. I got the idea to wrap the joystick handling into a macro that accepts "callback" routines for each of the movements, buttons, and an idle "callback". This is closer to the model used in many higher level languages. This separates the joystick handling logic from the bit processing to identify the inputs, and it allows the code to be used in different sections of the game, I just have to write routines to handle the specific inputs. I also customize the macro based on the inputs expected. My current one only looks for left, right, and fire. But, in a high score screen, I might need all four directions. A potential downside would be the handling of diagonal movements near an edge. The macro could be expanded to check for diagonal movements first, and call the appropriate callback. 1 Quote Link to comment Share on other sites More sharing options...
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.