Memory Maps are used to describe a range of addresses belonging to a CPU. [...]
Memory banking is a technique [...] to expand the amount of memory that the CPU can use beyond the normal amount. This is accomplished by swapping different sections of RAM and ROM, or "banks", into the same address range at different times.
I understand the concepts. I just don't get exactly what each section of code is doing. Tell me if I get it right:
This section of code just defines the possible ranges of memory. (It neither allocates memory for the banks, nor sets which bank is active.)
(Why does the range 0x2800~0x3fff is defined differently? It just says "AM_RAM", not "AM_RAMBANK(n)"? Is this how one defines a non-switchable range?)
Then...
this section of code under MACHINE_START defines the banks that can be active in each range of memory.
(Is this where the memory is actually allocated for each bank? By the way, I don't see any memory allocation for the non-switchable range 0x2800~0x3fff above.)
The banks that will be active are selected by means of the memory_set_bank() function call.
Then comes the
bankswitch function... I would expect it to use make a lot of memory_set_bank() function calls based on the state of the machine... but it calls a memory_install_readwrite8_handler() instead. What is the difference between both functions?