Skip to Content
The Art of Assembly Language, 2nd Edition
book

The Art of Assembly Language, 2nd Edition

by Randall Hyde
March 2010
Beginner content levelBeginner
760 pages
18h 51m
English
No Starch Press
Content preview from The Art of Assembly Language, 2nd Edition

3.12 The inc and dec Instructions

As the example in the previous section indicates—indeed, as several examples up to this point have indicated—adding or subtracting 1 from a register or memory location is a very common operation. In fact, these operations are so common that Intel's engineers included a pair of instructions to perform these specific operations: the inc (increment) and dec (decrement) instructions.

The inc and dec instructions use the following syntax:

inc( mem/reg );
dec( mem/reg );

The single operand can be any legal 8-bit, 16-bit, or 32-bit register or memory operand. The inc instruction will add 1 to the specified operand, and the dec instruction will subtract 1 from the specified operand.

These two instructions are slightly shorter ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

x64 Assembly Language Step-by-Step, 4th Edition

x64 Assembly Language Step-by-Step, 4th Edition

Jeff Duntemann
C Programming Language, 2nd Edition

C Programming Language, 2nd Edition

Brian W. Kernighan, Dennis Ritchie

Publisher Resources

ISBN: 9781593272074Errata Page