Skip to navigation

Cracker protection: SetSecretStash

Name: SetSecretStash [Show more] Type: Subroutine Category: Cracker protection Summary: Alter the secret code stash, as part of the anti-cracker code
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.SetSecretStash \ This routine sets the value of stashOffset, which is \ the offset into the secretCodeStash where we store a \ set of generated values for later checking in the \ GetRowVisibility routine \ \ The offset is set to the middle byte from the \ landscape seed linear feedback shift register (LFSR), \ overwriting previous values until we get here for the \ last time \ \ As we only reach this routine when drawing flat tiles \ in colour 0, so stashOffset is set to the middle byte \ from the landscape seed linear feedback shift register \ for the last flat colour 0 tile to be drawn \ \ The value itself doesn't matter, it's just another way \ of throwing crackers off the trail of working out how \ to generate landscape codes, as it changes the address \ of the secret code stash for each landscape LDA seedNumberLFSR+2-8,X \ At this point, X = 8 from DrawFlatTile, so this STA stashOffset-8,X \ sets the following: \ \ stashOffset = seedNumberLFSR+2 \ seedNumberLFSR+2 is the middle byte of the LFSR at \ seedNumberLFSR(4 3 2 1 0), so this sets the secret \ code stash offset to a unique and consistent value for \ each landscape \ Fall through into DrawOneFaceTile to finish drawing \ the flat tile