04 control Flashcards

(11 cards)

1
Q

Transfers to a specific location in the program denoted with a program label without evaluating any condition.

A

Unconditional Control Transfer

jmp <label></label>

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

The target or a location to jump to for control statements.

Starts with a letter, followed by letters, numbers, or “_”, terminated with a colon (“:”).

A

label (program label)

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

True or False:

Labels may be defined only once.

A

True

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

Control transfer instruction that provides a conditional jump based on a comparison.

This provides the functionality of a basic IF statement.

A

Conditional Control Transfer (jae, jbe, ja, jb, etc.)

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

Two steps that are required for a comparison

A

compare instruction
&
conditional jump instruction

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

True or False:

The conditional jump instruction always jumps to the provided label regardless of the result of the previous comparison or condition.

A

False

(will or will not jump)

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

What is the general form of the compare instruction?

A

cmp <op1>, <op2></op2></op1>

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

True or False:

<op1> can be an immediate value, but
<op2> may not be an immediate value
</op2></op1>

A

False

(Should always be cmp eax, 10 or cmp ebx, ecx)

cmp 10, eax (INVALID)

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

True or False:

The conditional jump instruction is based only on the values of general-purpose registers, not the rFlag register.

A

False

(based on the contents of the rFlag register) (CF,ZF,SF,OF, etc.)

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

Convert to Assembly:
num db 3
max db 8

if (num > max)
max = num

A

num db 3
max db 8

mov al, byte[num]
cmp al, byte[max]
jg newMax

newMax:
mov byte[max], al

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

Convert to Assembly:

if ((ax >= 100) && (ax <= 120)){
bx = ax;
}else {
bx = cx;
}

A

cmp ax, 100
jl else_stmt
cmp ax, 120
jg else_stmt
mov bx, ax

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