Strings Flashcards
(25 cards)
true/false
strings should always have a value equal to the total number of cells declared
false, strings may have an actual value less then the total number of cells declared
string instructions and meaning (5)
- LODS - load string
- STOS - store string
- MOVS - move string
- CMPS - compare string
- SCAS - scan string
required operand/s for LODS
source
required operand/s for STOS
destination
required operand/s for MOVS
src and dest
required operand/s for CMPS
src and dest
required operand/s for SCAS
dest
what register/s do string instructions use as operand/s?
rsi (src) and rdi (dest)
true/false
string instructions automatically increment/decrement the index registers used by them
true
controls the direction of string processing
direction flag
in what direction will string operations proceed if the direction flag is clear (DF = 0)?
forward (head to tail)
instructions to explixitly manipulate the direction flag (2)
std: set DF (DF = 1)
cld: clear DF (DF = 0)
MOVS format
movs dest_str, src_str
a prefix accepted by string instructions to repeatedly execute the operation
repetition prefix
prefix categories (2)
- unconditional repetition
- conditional repetition
unconditional repeat prefix
rep
rep repeats the instruction until ____
the value of the rcx register reaches 0
repeats the instruction until either the rcx register reaches 0 or the zero flag (ZF) is equal to 0
repe/repz
repeats the instruction until either the rcx register reaches 0 or the zero flag (ZF) is not equal to 0
repne/repnz
copies the value from the source string (rsi) to the a register
LODS
copies the value from the A register to the destination string (rdi)
STOS
what will this block of code do?
mov rcx, qword[strlen] mov rsi, string1 mov rdi, string2 loop1: lodsb stosb loop loop1
it copies the content of string1 into string2
compares the two strings at RSI and RDI and sets the flags
CMPS
true/false
CMPS performs RDI - RSI and sets the flags according to the comparison made
false, it should be RSI - RDI