Advertisement

Pmode

Started by March 20, 2000 11:22 PM
3 comments, last by Jeremiah 24 years, 5 months ago
- General info: I am creating a 32-bit DOS game using DJGPP. I will use Allegro for sound effects, and I will write all the graphic functions myself. My game will be tiled top-down 2D in mode 13h (320x200x256). since I am used to writing in real-mode, Im still getting used to Protected-mode, but its great. No more Far pointers, you get 4 GB to play with! - Now just a couple quick questions: since you get like 4GB, you really shouldnt need any more memory than that, so I can do things like: unsigned char *buffer[64000]; and not worry about alloc anymore right? can I still access files using fopen(), fread(), fwrite(), fclose(), and fgetc()? Is there a faster timer than the 0x0000046C 18.2 Hz available to me? - Thanx in advance for your replies. :-) Jeremiah
http://fakemind.com
I have an answer to 2 of your questions:
-Yes you can ''allocate'' everything static in the compiler. However there is one catch: When you have a buffer of buffer[307200] the .EXE-file grows 307200 bytes. So alloc is still the way to go.
-You _can_ use file reading/writing. I think it has changed from fopen() to open() etc. Maybe fopen() etc. still works too.
Advertisement
There is a faster time in DJGPP. I believe it is utime(). If I remember correctly, it will give you a resolution down to a few milliseconds. I could be wrong though. Check it out on the DJGPP C reference on their homepage.
thanx for the replies guys!

I''ll use alloc then, since it wont cause my program to grow a lot. You use it the same as in Real mode right? And the pointers are near?
http://fakemind.com
Actually, just creating an array of char[64000] doesn''t make the exe any bigger. The only time the compiler needs to store data in the obj/exe file is if the data is initialized (which obviously nobody is going to manually initialize this array ). If you just declare the array, the compiler records the size needed in the obj/exe, and doesn''t allocate until the program is run.

fopen should always work, and is usually the preferred way to handle files (well, preferred for portability anyway).

Rock

This topic is closed to new replies.

Advertisement