Assembly Language Flashcards

1
Q

What are the 4 general purpose registers?

A

EAX - Accumulator
EBX - Base register
ECX - Counter register
EDX - Data register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 pointers?

A

ESP - Stack Pointer
EIP - Instruction Pointer
EBP - Base Pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What format string is needed for an integer?

A

“%d”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you output a string variable named StrOne?

A

lea eax, StrOne
push eax
call printf
pop eax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you perform integer user input to store the value in a variable called num?
A variable called fmt exists with “%d”

A
lea eax, num
push eax
lea eax, fmt
push eax
call scanf
add esp, 8
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does immediate addressing work?

A

Value is put directly into instruction.

e.g. mov eax, 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does register addressing work?

A

The value is stored in a register

e.g. mov eax, ebx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does direct addressing work?

A

Operand is in main memory and instruction has its address.

e.g. mov eax, [memory address]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does register indirect addressing work?

A

Instruction points to a register and the register stores the memory address.

e.g. mov eax, [ebx]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you put a register into an instruction so it uses the value in the register as and address rather than a value?

A

put square brackets around it.

[ebx]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the 4 things in the Flags register?

A

Sign (S)
Zero (Z)
Carry (C)
Overflow (O)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the sign flag show?

A

Whether result is + or -

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the zero flag show?

A

Whether the result is zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the carry flag show?

A

Whether result has an arithmetic carry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the overflow flag show?

A

Whether results has arithmetic overflow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What instruction is done before a conditional jump?

A

cmp

the compare instruction is what sets the flags

17
Q

When will JMP jump?

A

always, its unconditional

18
Q

When will JC jump?

A

When carry flag is set (=1)

19
Q

When will JNC jump?

A

When carry flag isn’t set (=0)

20
Q

When will JZ jump?

A

When zero flag is set (=1)

21
Q

When will JNZ jump?

A

When zero flag isn’t set (=0)

22
Q

When will JS jump?

A

When sign flag is set (=1)

23
Q

When will JNS jump?

A

When sign flag isn’t set (=0)

24
Q

When will JO jump?

A

When overflow flag is set (=1)

25
Q

When will JNO jump?

A

When overflow flag isn’t set (=0)

26
Q

When will JE jump?

A

When previous comparison is equal

a = b

27
Q

When will JNE jump?

A

When previous comparison isn’t equal

a != b

28
Q

When will JG/JNLE jump?

A

When a > b

Jump is assumed to come after cmp a, b

29
Q

When will JGE/JNL jump?

A

When a >= b

Jump is assumed to come after cmp a, b

30
Q

When will JLE/JNG jump?

A

When a <= b

Jump is assumed to come after cmp a, b

31
Q

When will JL/JNGE jump?

A

When a < b

Jump is assumed to come after cmp a, b

32
Q

With eax stroring the address of a string, how would you move just the first character into edx?

A

movzx edx, byte ptr [eax]