Skip to navigation

Elite on the BBC Micro

Version analysis of TRNME

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: TRNME Type: Subroutine Category: Save and load Summary: Copy the last saved commander's name from INWK to NA%
.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

Code variation 1 of 2Specific to an individual platform

This variation is blank in the Cassette, Disc (docked), 6502 Second Processor and Electron versions.


LDA NAMELEN1 \ Copy the length of the commander's name from NAMELEN1 STA NAMELEN2 \ to NAMELEN2 (though this is never used, so this \ doesn't have any effect)

Code variation 2 of 2Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Electron

Docked, 6502SP, Master

LDA INWK,X \ Copy the X-th byte of INWK to the X-th byte of NA% STA NA%,X
LDA INWK+5,X \ Copy the X-th byte of INWK+5 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