I have the 'C' code:
Code: Select all
void* far_heap_start = (void*)0x12f111;
void* far_heap_end = (void*)0x1fffff;
void main(void)
{
void* pvBackground;
for (;;)
{
pvBackground = farmalloc(100);
...
}Code: Select all
wdc816cc.exe -bs -DUSING_816 -ml -wr -wu -so -sp -lt -pb -pp -px -o Main.obj Main.c
wdcln.exe -C10000 -D20000 -g -t -sz -HIE -obin\Video.hex Main.obj -lcl -lml
The WDC documentation indicates:
Code: Select all
void *heap_start = (void * )0x28000, *heap_end = (void * )0x48000;The sharp eyed among you will have already noticed that heap_start is not the same as far_heap_start however if I use heap_start and heap_end then I get the following linker error:
Code: Select all
Undefined symbol: ~~far_heap_end
Undefined symbol: ~~far_heap_start
~~far_heap_end and ~~far_heap_start are definitely referenced int the cl.lib file. So I think the WDC documentation is incorrect in their example.
If I look at the generated main.lst file I can see that ~~far_heap_start and ~~far_heap_end are correctly externally defined
Code: Select all
701 ;void* far_heap_start = (void*)0x12f111;
702 data
703 xdef ~~far_heap_start
704 ~~far_heap_start:
705 00:0000: 11 F1 12 00 dl $12F111
706 00:0004: ends
707 ;void* far_heap_end = (void*)0x1fffff;
708 data
709 xdef ~~far_heap_end
710 ~~far_heap_end:
711 00:0004: FF FF 1F 00 dl $1FFFFF
712 00:0008: ends
Has anyone managed to use farmalloc before (I think so) and if so please could you post how you did it! I don't know if I'm an idiot or if farmalloc really is broken.