Skip to navigation

Elite on the BBC Micro and NES

Save and load: TRNME

[BBC Micro cassette version]

Name: TRNME [Show more] Type: Subroutine Category: Save and load Summary: Copy the last saved commander's name from INWK to NA%
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 TRNME * SVE calls TRNME
.TRNME LDX #7 \ The commander's name can contain a maximum of 7 \ characters, and is terminated by a carriage return, \ so set up a counter in X to copy 8 characters .GTL1 LDA INWK,X \ Copy the X-th byte of INWK to the X-th byte of NA% STA NA%,X DEX \ Decrement the loop counter BPL GTL1 \ Loop back until we have copied all 8 bytes \ Fall through into TR1 to copy the name back from NA% \ to INWK. This isn't necessary as the name is already \ there, but it does save one byte, as we don't need an \ RTS here