From: "John S. Fine" Newsgroups: comp.os.msdos.djgpp Subject: Re: asm problem Date: Tue, 05 Jan 1999 18:59:25 -0500 Lines: 30 Message-ID: <3692A75D.200C@erols.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: TeO9YCoGCCEI6nhawQcBgaNC+TU+QjvW5X6fjzEEZl8= X-Complaints-To: abuse AT rcn DOT com NNTP-Posting-Date: 6 Jan 1999 00:00:29 GMT X-Mailer: Mozilla 3.01 (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Wojciech Piechowski wrote: > > void Flip(unsigned char far *source,unsigned char far *dest, unsigned int > > num_bytes) > > { > > _asm { > > push ds > > les di, [dest] > > lds si, [source] > > mov cx, [num_bytes] > > rep movsw > > pop ds > > } > > } > > Since this function does not contain any C code (pure assembler), you > should consider writing it as separate asm module. Then you could use NASM > (quite pleasant assembler with the well-known Intel syntax) and wouldn't > have to learn the AT&T convention. That is a great suggestion in general, but in this case there is a more serious problem. The entire operation being performed by the subroutine is based on real mode addressing. When you run this with DJGPP you will need to change the routine (and almost certainly the caller as well) to fit DJGPP addressing. (Time to read the FAQ). When doing that, this whole routine should probably be replaced by a call to a library routine anyway. -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/