Search⌘ K
AI Features

Instructions I

Explore how CPU flags register bits influence instruction execution in x64 assembly. Learn to interpret and use instructions like TEST, CMP, STOSQ, and REP to manipulate memory and control program flow, enhancing your debugging and assembly analysis skills.

CPU flags register

In addition to registers, the CPU also contains a 6464–bit %RFLAGS register where individual bits are set or cleared in response to arithmetic and other operations. Separate machine instructions can manipulate some bit values, and their values affect code execution.

For example, the DF (Direction Flag) bit determines the direction of memory copy operations. It can be set by STD and cleared by CLD instructions. It has the default value of 0, and its location is shown ...

The fast way to fill a memory

The STOSQ instruction stores a quadword value from %RAX into a memory location, the address of which is in the %RDI register (the ‘D’ stands for destination). After the value from %RAX is transferred to memory, the instruction increments %RDI by ...