Skip to navigation

Elite on the BBC Micro and NES

Drawing ships: GetDefaultNEWB

[NES version, Bank 7]

Name: GetDefaultNEWB [Show more] Type: Subroutine Category: Drawing ships Summary: Fetch the default NEWB flags for a specified ship type
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * NWSHP calls GetDefaultNEWB * TACTICS (Part 4 of 7) calls GetDefaultNEWB

Arguments: Y The ship type
Returns: A The default NEWB flags for ship type Y
.GetDefaultNEWB LDA currentBank ; Fetch the number of the ROM bank that is currently PHA ; paged into memory at $8000 and store it on the stack LDA #1 ; Page ROM bank 1 into memory at $8000 JSR SetBank LDA E%-1,Y ; Set A to the default NEWB flags for ship type Y JMP ResetBankA ; Jump to ResetBankA to retrieve the bank number we ; stored above and page it back into memory, returning ; from the subroutine using a tail call