From: Herbert Kleebauer on 7 Feb 2006 03:39 Betov wrote: > "randyhyde(a)earthlink.net" <randyhyde(a)earthlink.net> ?crivait > > Yes. I don't have the URL, but MS documentation states that the DF is > > clear when code comes from Windows, and it must be clear when you call > > a Win32 API. > Take care Herbert!!!... If he says that the Flag is > cleared, it must be set on!!!... Have searched MSDN. The only thing I found was about the C run-time library and CRT function. Don't know if any call to a system library requires the DF cleared. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/vchowDirectionFlag.asp http://support.microsoft.com/default.aspx?scid=kb;en-us;50712 DOC: Run-Time Routines Assume Direction Flag Is Clear in C View products that this article applies to. Article ID : 50712 Last Review : December 12, 2003 Revision : 1.0 This article was previously published under Q50712 SUMMARY The C run-time routines assume that the direction flag is cleared. If you are using other functions with the C run-time functions, you must ensure that the other functions leave the direction flag alone or restore it to its original condition. Expecting the direction flag to be clear upon entry makes the run-time code faster and more efficient. The direction flag is a CPU flag specific to Intel 80x86 processors. It applies to all assembly instructions that use the REP (repeat) prefix, such as MOVS, MOVSD, MOVSW, etc. Addresses provided to applicable instructions are increased if the direction flag is cleared. The CRT function, such as the string manipulation and buffer manipulation routines, expect the direction flag to be clear. This is usually the case and is documented in the "Microsoft Macro Assembler Programmer's Guide," for versions 5.0 and 5.1, as follows: Under DOS, the direction flag will normally be cleared if your program has not changed it.
From: Betov on 7 Feb 2006 04:20 Herbert Kleebauer <klee(a)unibwm.de> ?crivait news:43E85CC4.CB3FE97B(a)unibwm.de: > The C run-time routines assume that the direction flag is cleared. So do i, and i have never seen any problem with this. Now, if some "other C funtions" are playing the fool in the box, i cannot, know as i always saved myself from this horror. ;) Betov. < http://rosasm.org >
From: randyhyde@earthlink.net on 8 Feb 2006 00:01 Herbert Kleebauer wrote: > Betov wrote: > > "randyhyde(a)earthlink.net" <randyhyde(a)earthlink.net> écrivait > > > > Yes. I don't have the URL, but MS documentation states that the DF is > > > clear when code comes from Windows, and it must be clear when you call > > > a Win32 API. > > > > DOC: Run-Time Routines Assume Direction Flag Is Clear in C And as Windows is written in C, guess what? Keep in mind that MSVC++ implements many "stdlib" functions in-line (e.g., memcpy). If you look at the code the compiler emits, you'll notice that it does *not* mess with the direction flag when using one of these sequences. Again, as I said, the direction flag is clear coming in and you must ensure that it is clear whenever you call any C code (including the Windows API). Cheers, Randy Hyde
From: Betov on 8 Feb 2006 04:46 "randyhyde(a)earthlink.net" <randyhyde(a)earthlink.net> ?crivait news:1139374646.137347.142070(a)g47g2000cwa.googlegroups.com: > Repeat the lie often enough, and someone might > actually start believing it. :) A professional liar and swindler is talking, here. :) Betov. < http://rosasm.org >
From: Evenbit on 8 Feb 2006 14:13
randyhyde(a)earthlink.net wrote: > Herbert Kleebauer wrote: > > DOC: Run-Time Routines Assume Direction Flag Is Clear in C > > And as Windows is written in C, guess what? > Keep in mind that MSVC++ implements many "stdlib" functions in-line > (e.g., memcpy). If you look at the code the compiler emits, you'll It also implements the fast API calls (like GetCurrentFiber and GetFiberData) in-line. Nathan. |