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: Start and end Summary: Reset the current commander data block to the last saved commander
This variation is blank in the Disc (docked), 6502 Second Processor and Master versions.
\ By the time we get here, the correct commander name \ is at NA% and the correct commander data is at NA%+8. \ Specifically: \ \ * If we loaded a commander file, then the name and \ data from that file will be at NA% and NA%+8 \ \ * If this is a brand new game, then NA% will contain \ the default starting commander name ("JAMESON") \ and NA%+8 will contain the default commander data \ \ * If this is not a new game (because they died or \ quit) and we didn't want to load a commander file, \ then NA% will contain the last saved commander \ name, and NA%+8 the last saved commander data. If \ the game has never been saved, this will still be \ the default commander
This variation is blank in the Disc (docked), 6502 Second Processor, Master and Electron versions.
\JSR TTX66 \ This instruction is commented out in the original \ source; it clears the screen and draws a border
.QUL1
DEX \ Decrement the loop counter BNE QUL1 \ Loop back for the next byte of the commander data \ block STX QQ11 \ X is 0 by the end of the above loop, so this sets QQ11 \ to 0, which means we will be showing a view without a \ boxed title at the top (i.e. we're going to use the \ screen layout of a space view in the following) \ If the commander check below fails, we keep jumping \ back to here to crash the game with an infinite loop
This variation is blank in the Cassette, Disc (docked), 6502 Second Processor and Electron versions.
JSR CHECK \ Call the CHECK subroutine to calculate the checksum \ for the current commander block at NA%+8 and put it \ in A CMP CHK \ Test the calculated checksum against CHK
This variation is blank in the Cassette, Disc (docked), Master and Electron versions.
\JSR BELL \ This instruction is commented out in the original \ source. It would make a standard system beep
\ The checksum CHK is correct, so now we check whether \ CHK2 = CHK EOR A9, and if this check fails, bit 7 of \ the competition flags at COK gets set, to indicate \ to Acornsoft via the competition code that there has \ been some hacking going on with this competition entry EOR #&A9 \ X = checksum EOR &A9 TAX LDA COK \ Set A to the competition flags in COK CPX CHK2 \ If X = CHK2, then skip the next instruction BEQ tZ ORA #%10000000 \ Set bit 7 of A to indicate this commander file has \ been tampered with .tZ
When you save a commander file, the version details get saved along with the competition flags. The flags get set as follows: the BBC Micro cassette version sets bit 1, the BBC Micro disc version sets bit 2 or 5 depending on the variant, the 6502SP version sets bit 2, and the Electron and Master versions both set bit 3.
Tap on a block to expand it, and tap it again to revert.
STA COK \ Store the updated competition flags in COK