SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 282 | Next

Shon Harris, Allen Harper, Chris Eagle, and Jonathan Ness

"Gray Hat Hacking, Second Edition"


??? AT&T format uses a $ before literal values; NASM does not.
??? AT&T handles memory references differently than NASM.
In this section, we will show the syntax and examples in NASM format for each
command. Additionally, we will show an example of the same command in AT&T format
for comparison. In general, the following format is used for all commands:

The number of operands (arguments) depends on the command (mnemonic). Although
there are many assembly instructions, you only need to master a few. These are shown in
the following sections.
Gray Hat Hacking: The Ethical Hacker??™s Handbook
134
mov
The mov command is used to copy data from the source to the destination. The value is
not removed from the source location.
mov , mov eax, 51h ;comment movl $51h, %eax #comment
Data cannot be moved directly from memory to a segment register. Instead, you must
use a general-purpose register as an intermediate step, for example:
mov eax, 1234h ; store the value 1234 (hex) into EAX
mov cs, ax ; then copy the value of AX into CS.
add and sub
The add command is used to add the source to the destination and store the result in the
destination.


Pages:
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294