CFLAGS = +cpm -Wall -clib=8080 --list --c-code-in-asm -s -m -subtype=z80pack -DAMALLOC
LINKOP = +cpm -create-app -clib=8080 -subtype=z80pack -DAMALLOC
CC = zcc
zcc +cpm -create-app -clib=8080 -subtype=z80pack -DAMALLOC -ote_ansi te_ansi.o
Error at file 'free.asm' line 14: symbol '_heap' not defined
Error at file 'malloc.asm' line 16: symbol '_heap' not defined
Errors in source file /home/jay/projects/z88dk/lib/config//../..//lib/target/cpm/classic/cpm_crt0.asm:
Error at file 'free.asm' line 14: symbol '_heap' not defined
Error at file 'malloc.asm' line 16: symbol '_heap' not defined
Is -DAMALLOC supported with 8080 ?
Re: Is -DAMALLOC supported with 8080 ?
Seems to be good for this example - maybe you've not included stdlib.h/malloc.h?
Code: Select all
#include <stdlib.h>
#include <stdio.h>
int main() {
void *p = malloc(10);
printf("%x\n",p);
}
% zcc +cpm malloc.c -DAMALLOC -clib=8080
% ln -s a.bin a.com
% z88dk-ticks a.com
c723
99048
Re: Is -DAMALLOC supported with 8080 ?
This does not seem to be defined DEFINED_USING_amalloc in z88dk/lib/target/cpm/classic/cpm_crt0.asm
Your example does compile.
Here are the headers included in my case.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
Your example does compile.
Here are the headers included in my case.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
Re: Is -DAMALLOC supported with 8080 ?
O.k. I got around the bug using zpgrama-include:zpragma.inc
zpragma.inc
#pragma output USING_amalloc
I think the issue is that I use multiple build command to create a binary, so the -D is not getting passed from one section to the next.
zpragma.inc
#pragma output USING_amalloc
I think the issue is that I use multiple build command to create a binary, so the -D is not getting passed from one section to the next.
Re: Is -DAMALLOC supported with 8080 ?
Oh, sorry, I've re-read your post again, yes I know what this is.
Have a read of the first few paragraphs here: https://github.com/z88dk/z88dk/wiki/Classic--Pragmas
Basically with the one line compilation (as my example) the pragmas are kept, but with the two stage compilation you're using the pragmas are lost, so you need to use a zpragma.inc file to hold them.
The difficulty is that AMALLOC is turned on by preprocessor #define and the pragma isn't (yet) documented - they're in malloc.h so just copy the one you want and put into your zpragma.inc file.
Have a read of the first few paragraphs here: https://github.com/z88dk/z88dk/wiki/Classic--Pragmas
Basically with the one line compilation (as my example) the pragmas are kept, but with the two stage compilation you're using the pragmas are lost, so you need to use a zpragma.inc file to hold them.
The difficulty is that AMALLOC is turned on by preprocessor #define and the pragma isn't (yet) documented - they're in malloc.h so just copy the one you want and put into your zpragma.inc file.
Re: Is -DAMALLOC supported with 8080 ?
