back buffer in C

i want to develop a simple graphics libirary in C. Now, for smooth display i require to allocate some memory e.g (320*200)bytes for mode 13h. I am using turboc c++ 3.0 compiler and have 64 mb ram.
when i try to allocate this much memory i get out of memory message or in other words i am not able to allocate such large memory.
Is is b'cos DOS cannot use all the avaliable RAM? And if so what should i do to get around this problem.
Plz guide me in this matter


  • Hi,

    In DOS with Turbo-C 3.0 you cannot allocate RAM simply by calling malloc at all. It is a pain to get more memory than 640kb in DOS, unless you use some kind of library that will do it for you, or for example you can use DJGPP, which uses DPMI memory (Some more installing and 'hacking' is required). I wouldn't advise you to try to make 13h library at all, there should be plenty of these already available for download. And you don't really need to use RAM if you need as much as 320*200=64000 bytes of memory, it can be allocated using farmalloc();
    Turbo-C has great help (in my opinion much better than windows help system) and you should find more excact description there.

  • SephirothSephiroth Fayetteville, NC, USA
    Not sure why the heck you're trying to code in DOS in this day and age. I would recomend picking up the Win32 API. You can do it in a week or less, new to coding or not. Then you can use malloc until your heart's content. Plus there's no need for a lot of the code required to backbuffer. You also gain access to DirectX or OpenGL. In fact, once you can create a plain window with nothing in it (about an hour of studying), you cna EASILY pick up GL since you're doing C. And with GL, you could have a double or triple-buffered 3D world with textures and dynamic lighting in about four to five hours.

    One final note is that there's a 90% chance that your app, if written for DOS, won't work in Windows2000 or Windows XP. That's the major fault in those two operating systems.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!