Skip to navigation

Text: PrintTextToken

Name: PrintTextToken [Show more] Type: Subroutine Category: Text Summary: Print a recursive text token
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * FinishLandscape calls PrintTextToken * MainGameLoop calls PrintTextToken * MainTitleLoop calls PrintTextToken * PreviewLandscape calls PrintTextToken * ProcessCharacter calls PrintTextToken * SecretCodeError calls PrintTextToken

Arguments: X The number of the text token to print (0 to 17)
.PrintTextToken LDY tokenOffset,X \ Set Y to the offset for text token X, which we can use \ as a character index to print each character in turn .text1 LDA tokenBase,Y \ Set A to the Y-th character of the text token CMP #&FF \ If A = &FF then we have reached the end of the token, BEQ text2 \ so jump to text2 to return from the subroutine JSR ProcessCharacter \ Process the Y-th character of the text token in A, so \ if A is a token number in the format 200 + token, we \ print the text token, otherwise we print A as a simple \ one-byte character INY \ Increment the character index in Y to point to the \ next character of the text token JMP text1 \ Loop back to print the next character .text2 RTS \ Return from the subroutine