.YESNO LDA fontStyle ; Store the current font style on the stack, so we can PHA ; restore it when we return from the subroutine LDA #2 ; Set the font style to print in the highlight font STA fontStyle LDA #1 ; Push a value of 1 onto the stack, so the following PHA ; prints extended token 1 ("YES") .yeno1 JSR CLYNS ; Clear the bottom two text rows of the upper screen, ; and move the text cursor to the first cleared row LDA #15 ; Move the text cursor to column 15 STA XC PLA ; Print the extended token whose number is on the stack, PHA ; so this will be "YES" (token 1) or "NO" (token 2) JSR DETOK_b2 JSR DrawMessageInNMI ; Configure the NMI to display the YES/NO message that ; we just printed LDA controller1A ; If the A button is being pressed on the controller, BMI yeno3 ; jump to yeno3 to record the choice LDA controller1Up ; If neither the up nor down arrow is being pressed on ORA controller1Down ; the controller, jump to yeno2 to pause and loop back BPL yeno2 ; to keep waiting for a choice to be made ; If we get here then either the up or down arrow is ; being pressed, so we toggle the on-screen choice ; between "YES" and "NO" PLA ; Flip the value on the top of the stack between 1 and 2 EOR #3 ; by EOR'ing with 3, which toggles the token between PHA ; "YES" and "NO" .yeno2 LDY #8 ; Wait until eight NMI interrupts have passed (i.e. the JSR DELAY ; next eight VBlanks) JMP yeno1 ; Loop back to print "YES" or NO" and wait for a choice .yeno3 LDA #0 ; Reset the key logger entry for the icon bar button STA iconBarKeyPress ; choice to clear any icon bar choices that might have ; been processed in the background (via the pause menu, ; for example) STA controller1A ; Reset the key logger for the A button as we have ; consumed the button press PLA ; Set X to the value from the top of the stack, which TAX ; will be 1 for "YES" or 2 for "NO", giving us our ; result to return PLA ; Restore the font style that we stored on the stack STA fontStyle ; so it's unchanged by the routine TXA ; Copy X to A, so we return the result in both A and X RTS ; Return from the subroutineName: YESNO [Show more] Type: Subroutine Category: Controllers Summary: Display "YES" or "NO" and wait until one is chosenContext: See this subroutine in context in the source code References: This subroutine is called as follows: * TBRIEF calls YESNO
This routine does a similar job to the routine of the same name in the BBC Master version of Elite, but the code is significantly different.
Returns: A The result: * 1 if "YES" was chosen * 2 if "NO" was chosen
[X]
Subroutine CLYNS (category: Drawing the screen)
Clear the bottom two text rows of the visible screen
[X]
Subroutine DELAY (category: Utility routines)
Wait until a specified number of NMI interrupts have passed (i.e. a specified number of VBlanks)
[X]
Subroutine DETOK_b2 (category: Text)
Call the DETOK routine in ROM bank 2
[X]
Subroutine DrawMessageInNMI (category: Drawing the screen)
Configure the NMI to send the portion of the screen that contains the in-flight message to the PPU (i.e. tile rows 22 to 24)
[X]
Variable controller1A in workspace WP
A shift register for recording presses of the A button on controller 1
[X]
Variable controller1Down in workspace WP
A shift register for recording presses of the down button on controller 1
[X]
Variable controller1Up in workspace WP
A shift register for recording presses of the up button on controller 1
[X]
Variable iconBarKeyPress in workspace ZP
The button number of an icon bar button if an icon bar button has been chosen
[X]
Label yeno1 is local to this routine
[X]
Label yeno2 is local to this routine
[X]
Label yeno3 is local to this routine