Assembly Language Flashcards
What are the 4 general purpose registers?
EAX - Accumulator
EBX - Base register
ECX - Counter register
EDX - Data register
What are the 3 pointers?
ESP - Stack Pointer
EIP - Instruction Pointer
EBP - Base Pointer
What format string is needed for an integer?
“%d”
How do you output a string variable named StrOne?
lea eax, StrOne
push eax
call printf
pop eax
How do you perform integer user input to store the value in a variable called num?
A variable called fmt exists with “%d”
lea eax, num push eax lea eax, fmt push eax call scanf add esp, 8
How does immediate addressing work?
Value is put directly into instruction.
e.g. mov eax, 5
How does register addressing work?
The value is stored in a register
e.g. mov eax, ebx
How does direct addressing work?
Operand is in main memory and instruction has its address.
e.g. mov eax, [memory address]
How does register indirect addressing work?
Instruction points to a register and the register stores the memory address.
e.g. mov eax, [ebx]
How do you put a register into an instruction so it uses the value in the register as and address rather than a value?
put square brackets around it.
[ebx]
What are the 4 things in the Flags register?
Sign (S)
Zero (Z)
Carry (C)
Overflow (O)
What does the sign flag show?
Whether result is + or -
What does the zero flag show?
Whether the result is zero
What does the carry flag show?
Whether result has an arithmetic carry
What does the overflow flag show?
Whether results has arithmetic overflow