Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!munnari.oz.au!uhccux!galileo!ressler From: ressler@galileo.ifa.hawaii.edu (Mike "IR" Ressler) Newsgroups: comp.os.msdos.programmer Subject: (Summary) Novice 386 C Compiler/Video Driver/EMM Questions (long) Summary: Thanks everyone ... Message-ID: <11978@uhccux.uhcc.Hawaii.Edu> Date: 16 Mar 91 02:32:44 GMT Sender: news@uhccux.uhcc.Hawaii.Edu Organization: UH IfA and NASA Infrared Telescope Facility Lines: 292 I'd like to extend my sincere thanks to everyone who responded to my post at the beginning of the week. I don't have enough time to respond to everyone individually, so I thought I'd post again. As you pointed out, my hardware setup will certainly do what I want; I just have to turn over enough software rocks to find the appropriate tools. In an effort to simply get the 1024x768 graphics working I found a PD device driver for Turbo C which talks to my card just fine (SVGABG17.ZIP at wuarchive.wustl.edu in mirrors/msdos/graphics, I think). This has at least allowed me to get started. For the 32 bit C compiler, there is a port of GNU's gcc for MS-DOS which I've downloaded (from pub/msdos/djgcc at grape.ecs.clarkson.edu - watch out: 2.2 Mbyte zip file!) but haven't yet gotten a chance to try out. From the doc files I've read, it will produce only 32 bit code and you must have a floating point coprocessor if you want floating point variables. But since that is what I want, and it comes with its own built-in DOS extender, and it's free (the key ingredient), I'll give it a very good shot. As for the extended memory stuff, when I installed Windows 3.0 on Monday, it took care of installing all the Microsoft drivers for me. It's a start at least. Some day when I'm feeling rich again, I'll get QEMM 5.1x since everyone (including a few people I work with) recommends it highly over the Microsoft stuff. Once again, thank you very much. I really do appreciate all your input. I'm not so frustrated any more. I'll by you guys dinner if you ever get out to Honolulu ... (I'm asking for it now!) Mike Ressler ressler@galileo.ifa.hawaii.edu Since several people also asked me to summarize what I found out, here goes (edited to cut down size - hopefully nothing will be ripped too far out of context; editorial comments in []): --------------------------------------------------------------------------- From: "Brian K. W. Hook" First off, you will likely need a matched compiler AND graphics library. For compiler you would be looking at the MetaWare compiler or the new Intel compiler. [...] For graphics there is only one company that I can recommend -- Metagraphics. They have inexpensive toolkits, written in 100% assembly but with hooks into C, that support ALL kinds of graphics adapters. Look in the latest issue of Dr. Dobbs or C Gazette or Computer Language and get their phone number and call them. Ask them if they support a 386 specific compiler and which one, and ask them if they support your video card. Your money was not wasted. Just get your system set up correctly. Use QEMM 5.11 and you shouldn't have problems. If you have a Gateway computer (which it sounds like...not sure though) [no - but it's reasonably similar] and it uses a Micronics board, use this line in config.sys device=qemm.sys NOSH NOEMS ROM RAM And then loadhi everything you can get ahold of. You might need some other switches for DOS 4.01. emm386.sys: Expanded memory manager for 386 protected mode...QEMM takes care of this. himem.sys: XMS manager for Windows....QEMM takes care of this smartdrv.sys: Disk caching program. Poor, but better than nothing. Ramdrive.sys: Makes a virtual disk drive out of physical RAM. --------------------------------------------------------------------------- From: morris@probitas.cs.utas.edu.au (John Morris) Try Hi-Tech in Brisbane: Their C compiler certainly had 80186 and 80286 support - they may have 80386 too. Contact is: Clyde Smith-Stubbs clyde@hitech.ht.oz.au HI-TECH Software, Brisbane, QLD, Australia. Voice: +61 7 300 5011 Fax: +61 7 300 5246 If you use the EMS memory, you can allocate a handle with more than one 16Kbyte pages. You will still need to map in 64Kbytes at a time to actually address it though! Perhaps not the simple solution you hoped for? The HiTech compilers are excellent value if they'll do what you want. emm386 provides you with EMS memory - so you can use int 67 to allocate handles containing one or more 16Kbyte pages. --------------------------------------------------------------------------- From: phacb@cc.flinders.edu.au () Mike, you have to purchase a 386 knowledgeable C compiler, with a DOS extender, or switch to OS/2 and use microsoft C under that. Two Choices for you are both expensive. NDP C 386 compiler + Phar Lap from Microway WATCOM c 386 compiler Another would be Zortech C++ which includes a DOS extender I think, but don't know for sure. [I believe it uses Phar Lap, too] Some of people I programme for here had 512 by 512 image problems, so they had to got the Dos extender way ( NDP Fortran not C though), another person got WATCOM C for 386 and is quite satisfied. He wanted to handle 10 512 by 512 arrays so he has 16M extended memory. He says that the compiler is MS C compatible as far as library goes. --------------------------------------------------------------------------- From: hansen@snll-arpagw.llnl.gov (hansen fred r) > QEMM seemed to make >PCWrite barf (what does "packed file is corrupt" mean?) while Microsoft On your "file is corrupt" error, it's covered in the Q&A section of the QEMM manual. Basically, QEMM did too good a job. It feed enough memory that PCWrite had a starting address in the bottom 64K bytes of memory. DOS can't handle this for some types of EXE files. Quess microsoft never thought such a thing could happen (like needing more than 640 K of memory). The solution is to change one or more of your drivers or TSR to low memory until you only have only 576 KB free memory. That way no program can be loaded in the bottom 64 K. [I understand this "feature" will be removed from DOS 5.0.] --------------------------------------------------------------------------- From: mcdonald@aries.scs.uiuc.edu (Doug McDonald) Yes. MicroWay sells Fortran, C and PAscal compilers. Lahey sells Fortran, Metaware C. And you can get gcc (C and C++) free (but you need a compiler to compile it, unless somebody has posted the executable, which they probably have.) I have and love MicroWay. > What things do I need so I can do a malloc for 1 Mbyte? you say ptr = malloc(1000000); What did you expect??? [everybody is a comedian - Hi, Doug!] They [compilers] will happily talk to your board - just poke numbers at absolute addresses 0xxa0000000 to 0xa0000ffff. To access more than 65536 pixels (i.e. 600x800x256 colors or 1024x768x256 colors) you have to "bank switch" which involves doing "outp" commands in MSC (or similar in Turbo) to the card's control registers. To see how to do this, you either call the card manufacturer and buy their programming book or -- easier -- get the program "fractint" and get it running on your board in the resolution you need. [I have - it's a great program] Then read the video.asm source file from fractint to find how it switched. The secret of "malloc(1000000);" is what is known as a DOS extender. All the above compilers use one - gcc comes with one (incompatible with QEMM and himem) and for the other (expensive commercial) 32 bit compilers you need to get one (that DOES work with QEMM). I suggest you try gcc. Use ONLY Smartdrive [from the Microsoft drivers] (or another disk cache program). Use QEMM 5.1 (make SURE you have 5.1) instead of all the rest. Also, VGA cards can't do 256 level gray scale. They can do on 64 level gray scale. But you can get a very nice useful 256 level false-color image instead if you really need that level of resolution. --------------------------------------------------------------------------- From: kenyee@ksr.com 1) The Diamond Speedstar can only display 256/256K colors. It has a 6-bit color palette, meaning that you can only get 64 shades in each color... so you can't do 256 color grayscale.. I looked at the Speedstar a while back as well. 2) 32-bit code can be done with a version of the Zortech compiler..but only if you're running Unix (I think). [My impression is that there is an MS-DOS version, too.] I think Borland's compiler supports the 1Meg data space you need but it automatically does the 286 page swapping crap (I'm getting the compiler soon, so I'll find out). 3) Borland has a BGI interface and there is a public domain SVGA driver called SVGA17.BGI that supports the 1024x768x256 mode. Basically, life is a hack in the DOS world. Try to get your prof to grab a copy of ISC Unix with X-windows support...it's wicked expensive though.. (~$1000) And if you do, send me a copy :-) I don't know why Unix makers gouge so much...there's also supposed to be a version of Mach for the 386.. of course, then you could compile gcc and have an awesome compiler ;-) --------------------------------------------------------------------------- From: humu!trout.nosc.mil!optigfx!uunet!amc.com!jwbirdsa@pegasus.com (James Birdsall) There are several compilers which produce real 32-bit 386 protected mode binaries. These binaries run under a "DOS extender," usually supplied with the compiler, which puts the 386 in protected mode and allows access to all the memory in the computer, but also provides an interface back to DOS for file I/O and other necessities. As these are somewhat exotic products, they tend toward the pricey. Phar Lap is the best known of these products. On the other hand, there is now a port of gcc (the Gnu C compiler) from Unix to DOS. I believe that it produces 32-bit code and comes with a DOS extender, and it is absolutely free if you can find it and get it working (it's not the friendliest thing in the world, from the reports I've seen). As a third alternative, you could work in real mode in the compiler of your choice (such as MSC or Turbo C) and swap bits and pieces of the image in and out of XMS (stands for eXtended Memory Specification, a standard way of accessing extended memory from real mode. himem.sys is a driver that implements XMS). This is something of a pain in the neck, but lots of programs work this way and it avoids certain other troubles (see below). As for the video, welcome to the wonderful world of SVGA. You can talk to the video BIOS or the hardware directly; the hardware is more of a pain but gives much better performance. I believe the Speedstar is based on the Tseng 4000 chips [yes, it is], which are quite common these days, so you should be able to get hardware programming information if you look around. On the other hand, I can't comment on the intricacies of accessing the hardware from protected mode. Most DOS extenders provide services for calling the video BIOS and other such things, so that might be much easier. Of course, if you're working in real mode, then it's easy -- or as easy as it ever gets. --------------------------------------------------------------------------- From: ZLSIIAL@cms.manchester-computing-centre.ac.uk I can recommend a good C compiler which runs on 386's and which should let you malloc mbs with no problem: DJ Delorie's port of gcc. It's free and available from grape.ecs.clarkson.edu [128.153.28.129] by anonymous ftp from pub/msdos/djgcc. It produces 386 specific code and comes with its own memory extender/management system. It is NOT compatible with QEMM. --------------------------------------------------------------------------- From: oliver@karakorum.berkeley.edu (Oliver Sharp) Well, you've got a couple of different issues here. The first one is that you want a large flat address space. This is only available in protected mode, so you need to get into protected mode and execute your code there. If you still want DOS services (like reading the keyboard, and so forth) you need some kind of a shell once you are in protected mode that will escape back out into real mode, do things there, and go back into protected. Such a shell is called a `DOS extender'. You have three options: 1) Roll your own extender This is the hackers solution, and there have been some articles about doing it in various magazines (I could chase one down if you really intend to do this). The problem is that you will be doing a lot of stuff by hand that you probably want your compiler to do. This will take a lot of hacking, and is probably not feasible unless you have a lot of OS and assembler experience OR a lot of time, patience, and interest. 2) Buy an extender and a 32-bit C compiler (you did say malloc, so I assume you want C) This is the standard solution that is used by everyone in the market who sells software that won't fit in real mode. There are three such compilers that you should look at and all were reviewed in a recent Doctor Dobb's Journal, I think. The most established one is called Metaware C and comes with a debugger plus lots of other stuff. You still need to buy an extender, though. This is probably your best bet, but it will cost you $$. The Metaware package is about $700-800, I think. You might do better, but it will be in that range, anyway. Another possibility is Zortech, which has a 386 C++ native compiler, I think. The graphics support should be available if you do this, but you'd better check the various vendors. They must do something ... 3) Buy a 386 UNIX. This solves all your problems, pretty much, but you have to be willing to deal with UNIX. Also, your disk is kind of small, and you may need more memory. You should be able to get something for $600-1000, and you will get the ability to malloc away, virtual memory, etc. etc. and ... CORE DUMPS! I never thought I'd be lusting after those :-). You ought to get support for your VGA card if the UNIX implementation is any good, although you may need to use X windows. --------------------------------------------------------------------------- From: OSMOVIITA@cc.Helsinki.FI Read Computer Language May 1990. They compare C-compilers and you can find something interesting. Perhaps in september issue also. The sure way is to buy HALO Professional graphics library and compatible DOS extender and 386 compiler -- for example Phar Lap's extender and Watcom 8.0 C compiler -- expensive. In Zortech's C/C++ integrated programming environment package (almost like Turbo environment) there is support for SuperVGA cards but I don't know yet what kind. They have a 386 version in addition [to] the normal one. You can also get **free** GNU C/C++ -compiler for 386 which has support for TSENG ET-4000 chip (it is in Diamond Speedstar) and mouse too. I have tried GNU C-compiler. It manages up to 128 MBytes memory (I tried up to 96 MB). It swaps to disk if you don't have enough memory. But its documentation is mainly the source code and very short other documents. [Since I'm] just learning to program [in] C, [I] haven't yet got any graphics [to] work. You can FTP it from grape.ecs.clarkson.edu in directory /pub/msdos/djgcc. I am not sure if it works with DOS 4 but it works with 3.3. -- Mike Ressler - Infrared Photon Jockey ressler@galileo.ifa.hawaii.edu If at first you don't succeed, get a bigger sledgehammer.