Skip to navigation


Save and load: GTNME

[Acorn Electron version]

Name: GTNME [Show more] Type: Subroutine Category: Save and load Summary: Fetch the name of a commander file to save or load
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * BR1 (Part 1 of 2) calls GTNME * SVE calls GTNME

Get the commander's name for loading or saving a commander file. The name is stored in the INWK workspace and is terminated by a return character (13). If ESCAPE is pressed or a blank name is entered, then the name stored is set to the name from the last saved commander block.
Returns: INWK The commander name entered, terminated by a return character (13)
.GTNME LDA #1 \ Clear the top part of the screen, draw a white border, JSR TT66 \ and set the current view type in QQ11 to 1 LDA #123 \ Print recursive token 123 ("{crlf}COMMANDER'S NAME? ") JSR TT27 JSR DEL8 \ Call DEL8 to wait for 30 delay loops LDA #15 \ Call OSBYTE with A = 15 (flush all buffers) TAX JSR OSBYTE LDX #LO(RLINE) \ Set (Y X) to point to the RLINE parameter block LDY #HI(RLINE) \ configuration block below LDA #0 \ Set A = 0 for the following OSWORD call DEC KEYB \ Decrement KEYB, so it is now &FF, to indicate that we \ are reading from the keyboard using an OS command JSR OSWORD \ Call OSWORD with A = 0 to read a line from the current \ input stream (i.e. the keyboard) INC KEYB \ Increment KEYB back to 0 to indicate we are done \ reading the keyboard BCS TR1 \ The C flag will be set if we pressed ESCAPE when \ entering the name, in which case jump to TR1 to copy \ the last saved commander's name from NA% to INWK \ and return from the subroutine there TYA \ The OSWORD call returns the length of the commander's \ name in Y, so transfer this to A BEQ TR1 \ If A = 0, no name was entered, so jump to TR1 to copy \ the last saved commander's name from NA% to INWK \ and return from the subroutine there JMP TT67 \ We have a name, so jump to TT67 to print a newline \ and return from the subroutine using a tail call