Subroutines in LoRom/Mode 20, Address Decoding

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Subroutines in LoRom/Mode 20, Address Decoding
by on (#211640)
I'm confused about how the PC is loaded if I do a JML or JSL. If I understand the mapping correctly, it means that

Code:
SNES Address    ROM Address
$00:8000        $00:0000
$01:8000        $00:8000
$02:8000        $01:0000
.
.
.

And so on. How do absolute long jumps then work? Let's say I tell my assembler to place my reset routine at ROM $00:0000 and my drawing at ROM $01:0000. So If I write
Code:
Reset:
    ; some code
    jsl DrawRoutine
    ; more code

This will become
Code:
jsl $010000

But loading $010000 into the PC of the SNES will point me to the RAM mirror in SNES $01:0000 - which is wrong. How do I adjust this?

I work with cc65, so I guess it would me possibly to write a memory config for the linker that would adjust the addresses of the subroutines accordingly, but that seems somehow too convoluted to me. So again the question, how do I jump between pages/bankes? Assuming I do not want to use the SNES banks $0C or higher.
Re: Subroutines in LoRom/Mode 20, Address Decoding
by on (#211644)
With ld65, you really have to structure your LoROM application as a series of 32 KiB slices. Look at tepples's lorom template
Re: Subroutines in LoRom/Mode 20, Address Decoding
by on (#211645)
lidnariq wrote:
With ld65, you really have to structure your LoROM application as a series of 32 KiB slices. Look at tepples's lorom template


Very helpful, thanks!