First post, by thrawn235
Its my first post and i don't quite know whether this is the right place to post this.
Sorry if its not.
I started programming a little game using DJGPP.
Im compiling in linux using the djgpp-linux64-gcc720 package.
Im running my code in DosBox 0.74
The Program uses simple Mode13h
(I have since learned the screen is just 200px high. but that should have anything to do with my problems i think)
Now i have 2 problems that are potetially connected.
The Programm is incredibly slow. especially my drawing.
This is my main loop.
It just draws two rectangles, copies the backbuffer to videomemory and checks for ESC
I use time.h to meassure it.
Just that little bit takes 14ms!!
I dont know whether its my code, or something with dosbox. but thats incredibly slow.
running = false;
Thats my DrawRect function:
void GraphicsEngine::DrawRectangleFast(int x, int y, int w, int h, int color)
int i, j;
for (j=y; j<y+h; j++)
int row = j*320;
for (i=x; i<x+w; i++)
backBuffer[row+i] = color;
char *screen = (char*)0xa0000 + __djgpp_conventional_base;
int maxScreenOffset = 320*240;
for(int i = 0; i < maxScreenOffset; i++)
screen[i] = backBuffer[i];
The other question i have is, i print the frametime every frame. and i would assume them to be constant.
But the frames take much longer at first.
it starts at almost 50ms at first and then gets faster every few frames i gain 1ms after about 50 frames Im at 14ms
I dont do a lot of DOS programming. It is the first time i use DJGPP at all.
I'd appreciate any hints you guys can give me.