flat assembler
Message board for the users of flat assembler.
Index
> Main > Why CLD not used in display_string? |
Author |
|
Tomasz Grysztar 05 Feb 2016, 19:57
fasm relies on the convention that DF flag remains cleared by default. So every time fasm changes the direction flag to 1 for some reason (with STD), it clears it back with CLD immediately after.
In DOS interface (SOURCE/DOS/FASM.ASM) you may notice that there is a single CLD during the startup and then DF remains 0 for the entire life of program. In modern systems the DF is already by convention cleared as default, so Windows/Linux versions do not even have that initial CLD. You may find this mention in the Anger Fog's document on calling conventions: Anger Fog wrote: The rules for the direction flag is the same in all systems. The direction flag is cleared by default. If the direction flag is set, then it must be cleared again before any call or return. |
|||
05 Feb 2016, 19:57 |
|
alkap 05 Feb 2016, 20:04
Thanks very much, Tomasz, for a prompt reply. I use fasm on Linux. The explanation you have given makes perfect sense.
|
|||
05 Feb 2016, 20:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.