Skip to navigation


Text: DETOK3

[NES version, Bank 2]

Name: DETOK3 [Show more] Type: Subroutine Category: Text Summary: Print an extended recursive token from the RUTOK token table Deep dive: Extended system descriptions Extended text tokens
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * PDESC calls DETOK3

Arguments: A The recursive token to be printed, in the range 0-255
Returns: A A is preserved Y Y is preserved V(1 0) V(1 0) is preserved
.DETOK3 PHA ; Store A on the stack, so we can retrieve it later TAX ; Copy the token number from A into X TYA ; Store Y on the stack PHA LDA V ; Store V(1 0) on the stack PHA LDA V+1 PHA LDY languageIndex ; Set Y to the chosen language LDA rutokLo,Y ; Set V(1 0) to the address of the RUTOK table for the STA V ; chosen language LDA rutokHi,Y STA V+1 BNE DTEN ; Call DTEN to print token number X from the RUTOK ; table and restore the values of A, Y and V(1 0) from ; the stack, returning from the subroutine using a tail ; call (this BNE is effectively a JMP as A is never ; zero)