Skip to navigation

Elite on the BBC Micro and NES

Universe: GINF

[NES version, Bank 7]

Name: GINF [Show more] Type: Subroutine Category: Universe Summary: Fetch the address of a ship's data block into INF
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ClearScanner calls GINF * FRMIS calls GINF * InSystemJump calls GINF * Main flight loop (Part 4 of 16) calls GINF * NWSHP calls GINF * WPSHPS calls GINF

Get the address of the data block for ship slot X and store it in INF. This address is fetched from the UNIV table, which stores the addresses of the 13 ship data blocks in workspace K%.
Arguments: X The ship slot number for which we want the data block address
.GINF TXA ; Set Y = X * 2 ASL A TAY LDA UNIV,Y ; Get the high byte of the address of the X-th ship STA INF ; from UNIV and store it in INF LDA UNIV+1,Y ; Get the low byte of the address of the X-th ship STA INF+1 ; from UNIV and store it in INF RTS ; Return from the subroutine