Skip to navigation

BBC Micro Elite

Save and load: GTNME (Cassette version)

Name: GTNME [View in context] Type: Subroutine Category: Save and load Summary: Fetch the name of a commander file to save or load
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 \ Wait for 8/50 of a second (0.16 seconds) LDA #%10000001 \ Clear 6522 System VIA interrupt enable register IER STA VIA+&4E \ (SHEILA &4E) bit 1 (i.e. enable the CA2 interrupt, \ which comes from the keyboard) 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, which reads a line from LDA #0 \ Call OSWORD with A = 0 to read a line from the current JSR OSWORD \ input stream (i.e. the keyboard) \LDA #%00000001 \ These instructions are commented out in the original \STA VIA+&4E \ source, but they would set 6522 System VIA interrupt \ enable register IER (SHEILA &4E) bit 1 (i.e. disable \ the CA2 interrupt, which comes from 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