News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

inc dec ,and carry flag

Started by ERNI, August 11, 2005, 09:05:46 AM

Previous topic - Next topic

ERNI

Hey

are we know why INC  ,and DEC d't change CARRY flag ,but change ZERO and OVERLOF flags
WHY  :red :eek

Mirno

Because that is the design.
I'm sure it's more of a pain for Intel now, but the original x86 had those semantics, so they must continue with them.

Mirno

raymond

I have often found it very usefull that the CARRY flag was not affected by the INC/DEC instructions.

Simply use the SIGN flag if you need to be informed when a register gets decremented below 0 with the DEC instruction. That SIGN is also affected by the INC instruction.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

tenkey

Multiprecision arithmetic.

When incrementing addresses and decrementing loop counters, you don't want to destroy the carry/borrow between adds or subtracts.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

Mark Jones

Look in Opcodes.HLP (possibly under JMP):
JC/JNC --> Jump if/not if Carry flag set
JS/JNS --> Jump if/not if Sign flag set
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08