I figured rather than filling up the forum it might be better to ask here.
I had this reply from Dom:
int i,j,fontdatastart,textchar; int fontoffset,arrayoffset; char
Which defines an array with 0 elements - i.e. it consumes no space on the
stack. So you've got on the stack:
sp+0 = fontarray
sp+0 = arrayoffset
sp+2 = fontoffset
And then you've got:
fontarray = fontspec.width;
fontarray = fontspec.height;
Which will overwrite array offset with the value 7 * 256 + 5 = 1797
I want to understand when things get added to the stack and if it's not
possible to declare an array but not set a size since it won't grow by
pushing other variables down, but will overwrite other variables.
Should I use malloc to set the array size since I don't know at the start
how large the array size will need to be until a separate file with array
data is read in?
Does declaring fontoffset and arrayoffset not reserve the space of an int?
Are arrays with no size declared not usable with z80 C programming?
For other code reference, this is from:
I tried using malloc then got an error saying missing _heap so I read I
need to declare "long heap" which I did, then I read I need "void
mallinit(void)" and now my code doesn't run at all.
https://JasonOakley.com/ - Voice acting and geeky stuff
https://OziByte.com - Fitbit Ionic clock faces and games
http://AussieTechHeads.com.au/ - Australian technology podcast
https://www.facebook.com/RetroRegeneration/ - My retro 80s radio show
https://BlueBilby.com/ - My retro VZ200 website
Bridge to the z88dk-users mailing list
1 post • Page 1 of 1