Control Transfer Instruction Flashcards

(15 cards)

1
Q

What is the syntax for the unconditional control transfer instruction?

A

jmp <label></label>

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

jmp transfers to a specific location in the program denoted with a program label without _____________________.

A

evaluating any condition

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

A program _________ is the target, or a location to jump to, for control statements.

A

label

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

A label starts with a letter, followed by letters, numbers, or _, terminated with a _.

A

underscore (_), colon (:)

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

Labels may be defined only _.

A

once

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

Conditional control transfer instructions provide a ______________ based on a comparison.

A

conditional jump

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

A conditional jump is carried out on the basis of a _____ value

A

truth

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

Two steps required for a comparison.

A

compare, conditional jump

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

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
10
Q

What are the restrictions on the compare instruction?

A
  1. operands must of the same size and cannot be both variable.
  2. only operand2 can be an immediate value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The cmp instruction will compare two results and store the results of the comparison in the ________ register.

A

rFlag

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

In conditional transfer instructions,
je means _____
jl means _____
jg means _____
ja means _____
jb means _____
jne means _____

A

je -> op1 == op2
jl -> op1 < op2
jg -> op1 > op2
ja -> op1 > op2
jb -> op1 < op2
jne -> op1 != op2

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

What is the assembly code for this?
if (num > max){
max = num
}

A

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

newMax:
mov byte[max], al

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

What is the assembly code for this?
if (num > max){
max = num
}else{
max = max
}

A

mov al, byte[num]
cmp al, byte[max]
jbe else
mov byte[max], al
else:

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

Translate this code into assembly:
if (ax >= 100 && ax <= 120){
bx = ax
}else{
bx = cx

A

cmp ax, 100
jb elseStatement
cmp ax, 120
ja elseStatement
mov bx,ax
jmp SKIP

elseStatement:
mov bx, cx

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