You're not the only one who's struggling! I think I've missed handling of that scenario out, but since I'm guessing you're on +zx where it's all a bit complicated and non-linear in terms of mapping statically placed data to a far pointer it may be for the best.
The far pointer code uses the banks in this order:
Code: Select all
pages:
; Support up to 96k of heap, but...
; last 32k conflict with other things
defb 1,3,4,6,0,7
So we end up with far pointers mapping as follows:
* 0x010000 -> 0x013fff = bank 1
* 0x014000 -> 0x017fff = bank 3
* 0x018000 -> 0x01bfff = bank 4
* 0x01c000 -> 0x01ffff = bank 6
So we can see for _pic1 we need to construct an address somewhere in the range 0x18000 -> 0x1bfff
So, here's a workaround:
Code: Select all
SECTION BANK_04
_pic1:
INCBIN "../assets/pic1.lz77"
Code: Select all
char *__far getpic1() __naked
{
#asm
EXTERN _pic1
ld hl,+((_pic1 % 65536) & 0xbfff)
ld de,1
ret
#endasm
}
void func()
{
far char * __far ptr = getpic1();
....
}
I'll need to figure out how to make it automatic, but hopefully this will get you unstuck.