Marius Posted February 23, 2011 Share Posted February 23, 2011 Hi! Is there a way of switching the Arrow Keys off? I am writing a routine with some input fields. I don't want that the user can WALK over the screen with the cursor. The only thing I can think of is check ROWCRS ($54) and COLCRS ($55, $56) all the time, and reset those registers when someone walks out of the range. Break can be switched off by disableng the IRQ for that. Is there such a solution for the ARROW keys too? Thanks M. Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 23, 2011 Share Posted February 23, 2011 There's a few things you could do: 1. On the XL/XE only, the keyboard definition table can be user-provided in RAM, so you could have an alternate map without cursor movement. 2. DIY keyboard IRQ routine that masks out cursor keys. 3. Easiest way - just use K: for input instead of E:, mask out the keys you don't want, then echo input to E: Advantage there is you could also put a limit on input field size, disadvantage is you still need to handle Backspace, and you'd need to read the input off the screen once the user presses Return. Problem with 1 & 2 is with cursor keys disabled you can still get runaway conditions e.g. where the user just enters hundreds of characters worth of input, but of course E: will never return more than 3 screen lines worth of data. 1 Quote Link to comment Share on other sites More sharing options...
Marius Posted February 23, 2011 Author Share Posted February 23, 2011 @Rybags Wow. Thanks for your feedback. That is a lot of interesting information. I will think it over. Thanks a lot! Greetz M. Quote Link to comment Share on other sites More sharing options...
Fox-1 / mnx Posted February 24, 2011 Share Posted February 24, 2011 (edited) Use address $02FC. INPUT LDA #$FF STA $02FC ; Reset register LOOP LDA $02FC ; CH holds last key press CMP #$06 ; left arrow BEQ LOOP CMP #$07 ; right arrow BEQ LOOP etc... CMP #$FF ; No key pressed BEQ LOOP INPUT_ROUTINE_GOES_HERE .. .. JMP INPUT If you have a lot of keys you want to exclude it's better to create a table of internal key (characters) values and walk through that. Also, you need to input one character at a time in your routine, not whole words at once. edit: readability... Edited February 24, 2011 by Fox-1 / mnx 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.