Re: Bulkding banked code questions
Posted: Thu May 17, 2018 12:54 am
Ok I've misunderstood what you were doing! You are making your own section "CODESWITCHING" and putting some c code there. You can do this but you have to make sure you add new sections to the memory map so that the linker knows where it's supposed to org to.--exclude-sections CODESWITCHING
So we'll do something a little more advanced.
Add this to your zpragma.inc file:
Next create a file "mmap.inc" to define your new sections:
Code: Select all
// append to the memory map from file "mmap.inc" #pragma output CRT_APPEND_MMAP = 1
Now the "--exclude-sections CODESWITCHING" where the sna/bin/tap/etc is built is what you want. Anything in this section will not be processed and will only be output as a raw binary. And this you can load as you were doing.
Code: Select all
SECTION CODESWITCHING org 0xc000
So that was a bit of detour and thinking outside the box on your part But the method of placing such data into the sections z88dk already defines to represent memory (BANK, PAGE) would allow z88dk to automatically process that data and check if stuff overlaps.
This I think I know the answer to. When things don't make sense I always ask "where are the interrupts going" (z88dk's crts disable interrupts by default) and "where is my stack?". I have this list because I am frequently caught by it The answer to the last question is at address 65368 by default. That's in the top 16k so I am thinking you are paging out the stack and that's what's causing the crash. A "#pragma output REGISTER_SP = 0x8000" (or similar) will let you move the stack someplace out of harm's way.In the bankSwitchTest.map file there is a line for "_displayBank3Function = $C000 ; addr, public, , displayBank3Function_c, CODESWITCHING, displayBank3Function.c:4" so I assume it has the correct symbol.
By printing the address of the function it is indeed 0xC000 so my next dilema is why its crashing immediatly on calling this