Skip to navigation


Utility routines: ResetBankP

[NES version, Bank 7]

Name: ResetBankP [Show more] Type: Subroutine Category: Utility routines Summary: Page a specified bank into memory at $8000 while preserving the value of A and the processor flags Deep dive: Splitting NES Elite across multiple ROM banks
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * CheckForPause_b0 calls ResetBankP * CheckPauseButton calls via RTS4 * ChooseMusic_b6 calls via RTS4

Arguments: Stack The number of the bank to page into memory at $8000
Other entry points: RTS4 Contains an RTS
.ResetBankP PLA ; Fetch the ROM bank number from the stack PHP ; Store the processor flags on the stack so we can ; retrieve them below JSR SetBank ; Page bank A into memory at $8000 PLP ; Restore the processor flags, so we return the correct ; Z and N flags for the value of A .RTS4 RTS ; Return from the subroutine