I am writing a DOS game framework to learn C better and a general interest in programming on old hardware (especially on the system I grew up with).
I am trying to implement a double buffer system but I am having trouble allocating a far pointer to a 320*200 array.
At first I was trying to use malloc but found out it can only allocate under 64kb. I read that you need to use farmalloc (malloc returns NULL) and it allocated correctly. However, when _fmemset or _fmemcpy is run.... the whole system freezes.
backBuffer = (unsigned char far*) farmalloc(64000);
when it is time to swap buffers I use
_fmemcpy(VGA, backBuffer, 64000);
Program is using the small memory model.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With