Skip to navigation


Keyboard: GetNumberInput

Name: GetNumberInput [Show more] Type: Subroutine Category: Keyboard Summary: Fetch a number between 0 and 40 from the keyboard
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * GetWingSettings calls GetNumberInput

Returns: A The value of the number entered (0 to 40)
.GetNumberInput LDA #LO(T) \ Set (Y A) = T LDY #HI(T) LDX #2 \ Fetch a string of up to two characters from the JSR GetTextInput \ keyboard, store the characters at location T and U (as \ U = T + 1), and set Y to the number of characters \ entered JSR GetNumberFromText \ Convert the two-character input into a number in A, \ and report the conversion status in the C flag BCC numb2 \ If we got a valid number that is 40 or less then the C \ flag will be clear, so jump to numb2 to return from \ the subroutine .numb1 DEY \ Decrement the number of characters in the entered \ string, which is in Y BMI GetNumberInput \ If Y is now negative, then there are no characters \ left on-screen, so jump back to the start of the \ routine to try fetching another number LDA #127 \ Otherwise delete the last character shown on-screen by JSR OSWRCH \ printing a delete character (ASCII 127) JMP numb1 \ Jump back to numb1 to delete any other on-screen \ characters before starting again .numb2 RTS \ Return from the subroutine