Originally posted by: jarrodparkes
I have been doing my best to understand banking; however, I am still a little unclear about why explicitly specifying it is necessary. Here is my understanding and questions, let me know where I am messing up...
1. A bank is portion of memory that is set aside as a holding place for some kind of data (like CHR or PRG)
2. For the NESASM, banks occupy a space of 8KB
3. The .bank directive does what exactly? Couldn't you just get by using a .org directive to navigate to the portions of memory where CHR/PRG data is intended to be stored? Why do you have to specify the .bank?
4. How are you supposed to know if your PRG memory exceeds a 8KB bank? What would happen if it does?
5. Are all directives handled pre-assembling? Almost like C++ pre-processor directives?
Thanks,
Jarrod
1. Yes, "bank" can mean any arbitrary block of memory, depending on the context. NESASM bank is 8KB, MMC1 bank can be 16KB or 32KB, UxROM bank is 16KB, MMC3 uses 8KB banks, NSF uses 4KB banks, and so on.
2. Yes, this is an arbitrary restriction stemming from the fact that it was originally an assembler for the PC Engine/TurboGrafx-16, which has native support for 8KB banking.
3. It specifies the 8KB multiple of where the data should go in the output file. And yes, other assemblers use .org (and some other directives to reset the address, etc) or some other method (linker memory configuration file in CA65) for the same purpose.
4. The assembler is supposed to tell you. NESASM has bugs in it so it sometimes doesn't, and will overwrite the beginning of the bank instead.
5. Yes.