It took me a little while to figure out why my bank wasn’t running. asm(“call 4030”) does not output machine code that jumps to 0x4030–it jumps to 4030 or 0x0fbe. That’s wrong. So I added in the “0x” and all was well.
So now I am starting to wrap up a refactoring exercise.
I added a block that will go in all 16 sections. Each will have a pointer at 0x0026 that will point to this block.
This will be used for listing the contents of the flash. There will be 3 types of flash banks:
- C Vector: These have the C library and drivers that the applets can use. But they don't really need anything else.
- Applet: These will run the programs that I want to run
- Executable: These will run standalone programs or menu items.
The applets require that they are linked with crt1.rel. The others with crt0.s. The C vectors need to link in c_vector.c.
At this point, I have to start reserving certain banks: 00: flash bank 0 is always run from reset. It will have a standalone executable with complex menu, but no c vector 01: flash bank 1 is always in bank 1 from reset. It will always be available for bank 00 to be able to hold programs larger than 16K. 10: RAM bank 10: This will be placed in bank 2 (i.e. 0x8000-0xbfff). It is there by default 11: RAM bank 11: This will be placed in bank 2 (i.e. 0xc000-0xffff). It is there by default