Difference between revisions of "Assembler:Commands:DEC"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''command''' dec ''operand'' Decreases the operand by one. Subtracts 1 from the operand, while preserving the state of the '''CF''' flag. The operand can be a register or a m…')
 
Line 3: Line 3:
 
Decreases the operand by one.
 
Decreases the operand by one.
  
 +
 +
The '''CF''' flag is not affected. The '''OF''', '''SF''', '''ZF''', '''AF''',
 +
and '''PF''' flags are set according to the result.
 +
 +
operand = operand - 1
 +
 +
 +
<div style="padding:2px;border:1px dashed #2f6fab;background-color:#f4f4f4;">
 
Subtracts 1 from the operand, while preserving the state of the '''CF''' flag.  
 
Subtracts 1 from the operand, while preserving the state of the '''CF''' flag.  
 
The operand can be a register or a memory location.  
 
The operand can be a register or a memory location.  
Line 9: Line 17:
 
use a [[Assembler:Commands:SUB|SUB]] instruction with an immediate operand of 1.)
 
use a [[Assembler:Commands:SUB|SUB]] instruction with an immediate operand of 1.)
  
 
+
[http://x86.renejeschke.de/html/file_module_x86_id_71.html x86.renejeschke.de/html/file_module_x86_id_71.html]
The '''CF''' flag is not affected. The '''OF''', '''SF''', '''ZF''', '''AF''',
+
</div>
and '''PF''' flags are set according to the result.
 
 
 
operand = operand - 1
 
  
  
Line 40: Line 45:
  
 
  dec [SomeSymbol]
 
  dec [SomeSymbol]
 
  
 
== See also ==
 
== See also ==
Line 51: Line 55:
 
* [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions]
 
* [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions]
 
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org]
 
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org]
* [http://x86.renejeschke.de/html/file_module_x86_id_71.html x86.renejeschke.de/html/file_module_x86_id_71.html]
 

Revision as of 07:49, 14 March 2017

command dec operand

Decreases the operand by one.


The CF flag is not affected. The OF, SF, ZF, AF, and PF flags are set according to the result.

operand = operand - 1


Subtracts 1 from the operand, while preserving the state of the CF flag. The operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF flag. (To perform a decrement operation that updates the CF flag, use a SUB instruction with an immediate operand of 1.)

x86.renejeschke.de/html/file_module_x86_id_71.html


Command Parameters

Parameter Description
operand The destination operand


Examples

dec al
dec ax
dec eax
dec rax
dec [00123ABC]
dec [rax]
dec [SomeSymbol]

See also

External links