This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
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:
This variation is blank in the Cassette, 6502 Second Processor, Master and Electron versions.
Other entry points: GTNME Skip the delay at the start of the routine
The disc version has a delay in the routine to fetch a commander name, though I'm not sure why.
This variation is blank in the Cassette, Master and Electron versions.
Tap on a block to expand it, and tap it again to revert.
.GTNME
This variation is blank in the Disc (docked), 6502 Second Processor and Master versions.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Disc (docked), 6502 Second Processor, Master and Electron versions.
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)
This variation is blank in the Disc (docked), 6502 Second Processor and Master versions.
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
This variation is blank in the Disc (docked), 6502 Second Processor and Master versions.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Cassette and Electron versions.
Tap on a block to expand it, and tap it again to revert.
.GTL3 LDA NA%-5,X \ Copy the X-th byte from NA%-5 to INWK STA INWK,X DEX \ Decrement the loop counter BPL GTL3 \ Loop back until the whole drive and directory string \ has been copied to INWK to INWK+4 LDA #7 \ The call to MT26 below uses the OSWORD block at RLINE STA RLINE+2 \ to fetch the line, and RLINE+2 defines the maximum \ line length allowed, so this changes the maximum \ length to 7 (as that's the longest commander name \ allowed) LDA #8 \ Print extended token 8 ("{single cap}COMMANDER'S JSR DETOK \ NAME? ") JSR MT26 \ Call MT26 to fetch a line of text from the keyboard \ to INWK+5, with the text length in Y, so INWK now \ contains the full pathname of the file, as in \ ":0.E.JAMESON", for example LDA #9 \ Reset the maximum length in RLINE+2 to the original STA RLINE+2 \ value of 9
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