Date: Wed, 15 Jul 1998 10:42:08 +0300 (IDT) From: Eli Zaretskii To: Jedediah Smith cc: djgpp AT delorie DOT com Subject: Re: How to use 32 bit regs in 16 bit C prog? In-Reply-To: <35AC4574.2A32@interlog.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 14 Jul 1998, Jedediah Smith wrote: > I need to optimize a little inner loop in a 16 bit C prog and I want to > use the 32 bit general purpose registers (EAX,EBX,ECX,EDX). I don't need > to do any flat memory addressing or anything like that, just use those 4 > regs to temporarily store data and do arithmetic. I can stick the > machine code into the C source using the _emit_ macro but I want to know > what I have to do to the CPU state before I can use the registers. Use the GCC inline assembly facilities. They allow you to explain to the compiler which registers does your assembly fragment use, and the compiler will then take care of saving and restoring these registers. The inline assembly facilities are described in the GCC on-line docs. From the DOS prompt, type this: info gcc "C Extensions" "Extended Asm" (note the quotes: they are important) and read there.