Skip to navigation

Elite on the BBC Micro and NES

Text: write_msg3

[Elite-A, Parasite]

Name: write_msg3 [Show more] Type: Subroutine Category: Text Summary: Print an extended recursive token from the msg_3 token table Deep dive: The Encyclopedia Galactica
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * controls calls write_msg3 * equip_data calls write_msg3 * menu calls write_msg3 * ships_ag calls write_msg3 * write_card calls write_msg3

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
.write_msg3 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 LDA #LO(msg_3) \ Set V to the low byte of msg_3 STA V LDA #HI(msg_3) \ Set A to the high byte of msg_3 BNE DTEN \ Call DTEN to print token number X from the msg_3 \ 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)