[SOLVED] understanding bank and slot

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Posts: 26
Joined: Sun Dec 24, 2017 10:16 am

[SOLVED] understanding bank and slot

Post by hoit » Wed Nov 18, 2020 11:38 am


I saw in different snes code sample an .asm file crt0_snes.asm which begin with :

Code: Select all

.include "hdr.asm"

.ramsection ".registers" bank 0 slot 1 priority 1
tcc__registers dsb 0
tcc__r0 dsb 2
tcc__r0h dsb 2
tcc__r1 dsb 2
tcc__r1h dsb 2
tcc__r2 dsb 2
tcc__r2h dsb 2
tcc__r3 dsb 2
tcc__r3h dsb 2
tcc__r4 dsb 2
tcc__r4h dsb 2
tcc__r5 dsb 2
tcc__r5h dsb 2
tcc__r9 dsb 2
tcc__r9h dsb 2
tcc__r10 dsb 2
tcc__r10h dsb 2
; f0/f1 defined in libm.asm
tcc__f2 dsb 2
tcc__f2h dsb 2
tcc__f3 dsb 2
tcc__f3h dsb 2
move_insn dsb 4	; 3 bytes mvn + 1 byte rts
move_backwards_insn dsb 4 ; 3 bytes mvp + 1 byte rts
nmi_handler dsb 4

tcc__registers_irq dsb 0
tcc__regs_irq dsb 48

.BANK 0 SLOT 0                  ; Defines the ROM bank and the slot it is inserted in memory.
.ORG 0                          ; .ORG 0 is really $8000, because the slot starts at $8000

With wla dx 9.12 (and probably previous versions), the build provide this warning :

crt0_snes.asm:35: WARNING: There is a SLOT number 0, but there also is a SLOT (with ID 1) with starting address 0 ($0)... Using SLOT 0.

I am not fluent with asm and explanations i found on bank are clear, but i do not understand the slot.

I can easily solve the warning by doing :

Code: Select all

.ramsection ".registers" bank 1 priority 1
in line 3

Code: Select all

.BANK 0             ; Defines the ROM bank and the slot it is inserted in memory.
in line 35
but i guess it is not a good idea to use a new bank.

Does someone can explain me what is a "slot" and how i can solve this issue properly ?

Thanks for your help
Last edited by hoit on Fri Nov 27, 2020 12:22 pm, edited 1 time in total.

Posts: 22286
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Re: understanding bank and slot

Post by tepples » Wed Nov 18, 2020 2:05 pm

A "slot" is one of the windows that the mapper provides. For example, UNROM provides two slots: one at $C000 fixed to last 16 KiB of the ROM and one at $8000 that is switchable. MMC3 provides two fixed* slots at $C000 and $E000 that always reflect the last two 8K banks of the PRG ROM, as well as two slots at $8000 and $A000 that can be independently switched to any PRG ROM bank by writing 6 or 7 to $8000 then the bank number to $8001.

See previous topics What is a "slot" in wla dx assembler? and What exactly is a slot in WLA?.

* MMC3 has a switchable-DPCM mode that swaps the functions of $8000 and $C000 slots.

Posts: 1080
Joined: Tue Feb 07, 2017 2:03 am

Re: understanding bank and slot

Post by Oziphantom » Wed Nov 18, 2020 9:29 pm

However on a SNES 99% of the time there are no slots. The SNES has a full flat memory model and thus "never"* swaps parts of the ROM in and out as you do on NES and Master System for example.

It would be better if you could share the header that defines the map.
It will be something like

Code: Select all

;==LoRom==      ; We'll get to HiRom some other time.
.MEMORYMAP                      ; Begin describing the system architecture.
  SLOTSIZE $8000                ; The slot is $8000 bytes in size. More details on slots later.
  DEFAULTSLOT 0                 ; There's only 1 slot in SNES, there are more in other consoles.
  SLOT 0 $8000                  ; Define's Slot 0's starting address.
.ENDME          ; End MemoryMap definition
It also seems that the code was made with the Tiny C Compiler 65815 "port" https://github.com/nArnoSNES/tcc-65816

* some expansion chips do allow you to swap banks or change what is presented to the SNES in various memory locations

Posts: 1758
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: understanding bank and slot

Post by Pokun » Thu Nov 19, 2020 3:59 am

Forcing you to use ROMBANKs and SLOTs is one thing I dislike about WLA-DX.
Another is the weird bugs it has. Apparently it is very buggy for SPC700 as well.

But yeah, normally you only declare a single slot and never touch slots again when using WLA-DX on SNES.

Posts: 26
Joined: Sun Dec 24, 2017 10:16 am

Re: understanding bank and slot

Post by hoit » Fri Nov 27, 2020 12:21 pm

Thank you everybody for your informations.

Post Reply