Date: Wed, 3 May 2000 12:22:43 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Dave White cc: djgpp AT delorie DOT com Subject: Re: Embedded programming In-Reply-To: <390f923f$0$91337$61169c8d@news.thebestisp.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 2 May 2000, Dave White wrote: > I won't need any of the standard library routines, not evem malloc You seem to be forgetting about the startup code. Every DJGPP program begins by calling quite a few library functions, beginning from those in the crt0.S and crt1.c files. These functions set up the execution environment which DJGPP programs need to run. It's quite possible that you might not need large parts, or even all, of that code. But you need to check that, you cannot simply say that you don't need them. > Ultimately what I want to is create a binary image that can either be loaded > from EPROM, or from a boot floppy, switch into protected mode, set up a > couple of interrupt handlers, then call my C _main function. That's a plenty. Take switching to PM, for example. This is currently done in DJGPP by calling a special function defined by the DPMI spec. In a nutshell, DJGPP programs don't themselves switch into protected mode, the call upon a DPMI server to do that. Interrupt handlers setup is also largely handled by the DPMI server. If you want to keep that, you will have to keep large parts of the startup code and load a DPMI server on top of that. If you want to toss this, you will need to write your own code for switching into PM, including the necessary setup of descriptors, the memory arena, and the interrupt descriptor table. You will also need to write this setup like code produced by DJGPP expects (DS=SS=ES, CS and DS span the same memory, etc.) > but have no simple way to start. I'm > pretty sure that the complexity of the task I'm trying to accomplish isn't > too hard, but the wealth of information is confusing. I suggest to take it one step at a time, and ask lots of questions here and occasionally on other forums. It seems like the first step would be to study the DJGPP startup code and decide how would you like to change it for your purposes. I suggest to download djlsr203.zip and take a good look at the files in the src/libc/crt0 directory.