-
I just got Black Art of 3D Programming in C, and i want to know????
Which compiler should i use to compile the older code, and did the book help you?
-
Code Goddess
All of the latest compilers should properly compile old C code without errors, maybe a slew of warnings, but it should work just fine. And I've never read that book, maybe someone else has.
-Prelude
-
I never had any luck getting the old code to compile with the copy of borland I was using (5.02 if I remember right) now I am trying to work my way through using djgpp and allegro but so far no success...please post if it works for you =)
-
If you want to compile the example-code as is the book advices you to use BorlandC4.5 and Tasm4.0 (as you may have read), but you also can use any, older, 16/32 bit compiler. I tried some examples with Symantec and TurboCx.x which you can download for free at e.g.: http://alpha.faikham.com/members/infostud/turbo.html(The link from where I got it died a long time ago).
But a better alternative would be to use WatcomC/C++ and modify the code so that it works without the 'near' and 'far'-stuff.
The code will get a lot easier to read and understand...
far-version...
'byte far* vga = (byte far*)0xa0000000'
or
'far byte* vga = (far byte*)0xa0000000'
near(Watcom-version)...
'byte* vga = (byte*)0xa0000'
When using an older compiler you have to check out if the order is 'data_type far*' or 'far data_type*'.
DJGPP give you two possibilities to interact with Dos-memory...
1)
with functions declared in 'sys/farptr.h' like '_farpokeb()' etc...
take a look at the include files
2)
including 'sys/nearptr' using the nearptr ?trick? which doesn't work on NT-OS.
...
short* mono;
if (__djgpp_nearptr_enable() > 0)
{
mono = (short*)(0xb8000 + __djgpp_conventional_base);
//some stuff
mono[80 * 3 + 40] = 0x7 << 8 | 'Q';
//a grey 'Q' should appear in the center of the 4th screen row
__djgpp_nearptr_disable();
}
...
Hope it helps (!!!errors are possible!!!)
-
Well the source from the book works on Borland 3.1 and you can get borland 3.1 from http://www.geocities.com/tvanputten/download.htm
-