X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: DPMI code in EXE file Date: Sun, 28 Sep 2008 06:53:59 -0400 Organization: Aioe.org NNTP Server Lines: 53 Message-ID: References: NNTP-Posting-Host: mQokHQeKeRC37oD/Mq9UYg.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse AT aioe DOT org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-Priority: 3 X-MSMail-Priority: Normal To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "IcEonFirE" wrote in message news:BAY106-W1618A377C6F1AC7342ED8889460 AT phx DOT gbl... > I am trying to program a floppy boot sector. I am using djgpp on ms-dos > 6.22. when I build the *.s file and check code with fsdb, I noticed > EXE > file make DPMI INT calls. Is that a way to remove these call[s] No. As long as you're using C functions which call DOS, BIOS, or DPMI, you'll have interrupts in the code. Any function which does file I/O or allocates or frees memory will call interrupts. Character functions and string functions (which don't do file I/O) are free from interrupts. printf() and fprintf() etc. are string functions which do file I/O. > since my floppy > boot code must be 16-bit. I thought .code16 > and .code16gcc directives in the *.s file would do so, I was wrong > > Any Idea please ? I've a few for you... Pick the one below you like. > Any Idea please ? Don't write a bootsector. Look into GNU Multiboot protocol which will boot ELF executables and a.out objects with a multiboot header. GRUB, GRUB4DOS, and Chris Giese' MBload will all start your ELF or a.out kernel. > Any Idea please ? DJGPP doesn't produce ELF, AFAIK. But, DJELF does, and then your kernel will be bootable: http://www.geocities.com/dborca/djgpp/elf/djelf.html > Any Idea please ? If you insist on writing a bootloader, don't use djasm or GAS for assembly. Use NASM. It's much easier to write the 16-bit code assembly in NASM. NASM can create a.out objects and DJGPP coff objects which you can link with LD to the 32-bit COFF objects DJGPP produces. > Any Idea please ? "Yeah, don't use [those DJGPP assemblers]" unless you are restricted to the DJGPP toolchain, in which case you are stuck with GAS for 32-bit code unless you get the directives work, and with djasm for 16-bit code. You should also consider posting to alt.os.development for OS queries (such as bootloaders) or alt.lang.asm or comp.lang.asm.x86 for assembly queries. Many on a.o.d, including myself, have written bootloaders both simple and complex. Rod Pemberton