I´m working on a program to create a basic image editor (like paint) on DOSBOX with C using BORLAND 3.1. Right now I´m trying to implement a simple undo button. For this I created a double array to store 10 times the drawing area (which is 288*180). However, when adding the line of the array intialization, I cannot allocate memory for a double buffer I use in other functionalities of the program.
Is there any way I can get more memory in DOSBOX or another implementation that doesn´t give me this problem?
I compile my program like this:
bcc -mh paint.c
This is my code:
byte huge undo[51840][10]; // This is the array that is giving me problems
void welcome_screen(){
BITMAP fondo_inicio,normal_ptr_image,boton_inicio,boton_salir;
MOUSE mouse_welcome;
unsigned long int h;
int a[2];
byte *double_buffer;
sword new_x, new_y;
word redraw,press,release;
sword dx,dy=0;
MOUSEBITMAP *normal_pointer=NULL;
MOUSEBITMAP *mouse_new=NULL;
word last_time;
int i,done = 0;
filled=-1;
/* allocate memory for double buffer and background image SCREEN_SIZE = 320*200 */
if ((double_buffer = (byte *) malloc(SCREEN_SIZE)) == NULL)
{
printf("Not enough memory for double buffer.\n"); // ---> This is the error I get when adding the above line
exit(1);
}