Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char *test = (char*) malloc(5 * sizeof(char));
unsigned short addr = (unsigned short) test;
strcpy(test, "test");
printf("%04x, %04x\n", test, addr);
free(test);
return 0;
}
A>MEMTEST
B65F, B65F
According to https://github.com/z88dk/z88dk/wiki/Cla ... ive-sizing the heap should start with the last byte of the program? The program is like 4 or 5K and should be loaded at 0x100?
Build line looks like:
zcc +cpm -vn -DAMALLOC -I"$HOME/z88dk/include" -I./include -o ./build/demo/memtest.com ./src/demo/memtest.c
Target is C128 CPM Plus. On HTC compiler the heap does start after the last program byte using same code.