I have seen all sorts of stuff talking about bankswitching, and how to do it, but I can't find anything that gives me a clear idea of what it is.
What is it for? When should I use it? If I am making an NROM-256 game, do I need to use bankswitching when going between the first 16kb bank and the second 16kb bank?
Thanks in advance!
NES has a 64KB address space. The top 32KB is ROM. NROM-256 is a 32KB ROM, there's no bankswitching, hence the boards being ROMS only. You'd need a mapper to swap (size) bank in (where it is in the ROM), and all mappers are different, but otherwise, that's basically it. If you need 64KB of PRG space or <8KB of CHR space, you need a mapper.
NROM does not use bankswitching. Bankswitching is used for cartridges having more than 32K PRG ROM, or more than 8K CHR ROM. (Some mappers can also bankswitch RAM, but usually it is the ROM which is bankswitched.)
The 6502 can only see 64KB of memory. On the NES, the upper half of the addressing space is dedicated to ROM (while the lower half is used for RAM and registers), meaning that the NES can only "see" 32KB of ROM at any given time. Bankswitching is basically a trick, that allows different parts of a larger chip to be visible in that 32KB window at a time.
For example, a 128KB ROM has 4 32KB pieces/banks, and a mapper can allow the program to select which of these 4 banks it wants the CPU to see. The actual size of the banks will vary from mapper to mapper, but the most common sizes are 32KB (the 32KB window contains 1 slot), 16KB (the 32KB window contains 2 slots) and 8KB (the 32KB window contains 4 slots). Depending on the mapper, some of these slots may be hardwired to specific banks, while the others can be changed freely.
The exact same thing happens with CHR-ROM: the way the NES is built only allows the PPU to see 8KB of CHR memory (ROM or RAM) at a time, but a mapper can break up this space into several slots (8KB, 4KB, 2KB and 1KB are all common sizes) and allow parts of a larger ROM chip to be mapped to each of them.