Index

Function Name: JMPFAR

Purpose: Goto another bank
Call address: $FF71 (hex) 65393 (decimal)
Preparation:

	Registers:	none
	Memory:		system map, also:
			$02 -> bank (0-15)
			$03 -> PC high
			$04 -> PC low
			$05 -> .S (status
			$06 -> .A
			$07 -> .X
			$08 -> .Y
	Flags:		none
	Calls:		none
Results:
	Registers:	none
	Memory:		as per call, also:
			$05 -> .S (status)
			$06 -> .A
			$07 -> .X
			$08 -> .Y
	Flags:		none

Description: The routine JMPFAR, enable code executing in the system bank of memory to JMP to a routine in any other bank. It should be noted that JSRFAR calls JMPFAR, which calls GETCFG. When calling a non-system bank, the user should take necessary precautions to ensure that interrupts (IRQ's and NMI's) will be handled properly (or disabled beforehand). Both JSRFAR and JMPFAR are RAM-based routines located in common (shared) RAM at $2CD and $2E3 respectively.
The following code illustrates how to call a subroutine in the second RAM bank from the system bank. Note that we need not worry about IRQ's and NMI's in this case because the system will handle them properly in any configuration that has the Kernal ROM or any valid RAM bank in context at the top page of memory.

EXAMPLE:

	STY	$08	;assumes registers and status
	STX	$07	;already setup for call
	STA	$06
	PHP
	PLA
	STA	$05
	
	LDA	#1	;want to call $2000 in bank 1
	LDY	#$20
	LDX	#$00
	STA	$02
	STY	$03
	STX	$04

	JSR	$FF6E	;JSRFAR

	LDA	$05	;restore status and registers
	PHA
	LDA	$06
	LDX	$07
	LDY	$08
	PLP