03 instruction set overview Flashcards

1
Q

Refers to where the data is coming from and/or where the result is to be placed

A

Operands

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

What is the general form of the move instruction?

A

mov < dest>, < src>

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

____ operand is copied into the destination operand

A

Source

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

Conditions in using move instruction

A

Destination and source operand must be of the same size

Operands cannot be both memory variables

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

What are the basic addressing modes?

A

Register, Immediate, Memory

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

The operand is a CPU register. (kind of mode addressing)

A

Register Mode Addressing

ex:
move eax, ebx
(both eax and ebx are in register mode addressing)

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

The operand is an immediate value. (kind of mode addressing)

A

Immediate Mode Addressing

ex:
move eax, 130
(eax is in register mode, 130 is in immediate mode)

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

The operand is a location in memory (accessed via an address) referred to as indirection or dereferencing. (kind of mode addressing)

Brackets [ ] are used to access the values of memory variables.

Omitting the brackets will not access the value and instead obtain the address of the variable.

A

Memory Mode Addressing

ex:
mov rax, qword[var1]
(value of var1 in rax)

mov rax, var1
(address of var1 in rax)

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

What is the general form of integer addition instruction?

A

add < dest>, < src>

which performs:
< dest> = < dest> + < src>

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

What are the conditions in using addition instruction?

A

The destination and source operand must be of the same size

operands cannot be both memory variables

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

Convert to Assembly:
num1 db 42
num2 db 73
ans db 0

ans = num1 + num2

A

num1 db 42
num2 db 73
ans db 0

mov al, byte[num1]
add al, byte[num2]
mov byte[ans], al

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

What is the general form of increment instruction?

A

inc <operand></operand>

which performs:

<operand> = <operand> + 1
</operand></operand>

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

Convert to Assembly:
num dw 4200

num = num + 1

A

num dw 4200

inc word[num]

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

What is the general form of integer subtraction instruction?

A

sub <dest>, <src></src></dest>

which performs:

<dest> = <dest> - <src>
</src></dest></dest>

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

What are the conditions in using subtraction instruction?

A

The destination and source operand must be of the same size.

Operands cannot be both memory variables.

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

Convert to Assembly:
num1 db 73
num2 db 42
ans db 0

ans = num1 - num2

A

num1 db 73
num2 db 42
ans db 0

mov al, byte[num1]
sub al, byte[num2]
mov byte[ans], al

17
Q

What is the general form of decrement instruction?

A

dec <operand></operand>

which performs:

<operand> = <operand> - 1
</operand></operand>

18
Q

Convert to Assembly:
num dw 4200

num = num - 1

A

num dw 4200

dec word[num]

19
Q

What is the general form of unsigned multiplication instruction?

A

mul <src></src>

where the source operand must be a register or memory location

20
Q

What register must be used for one of the operands in unsigned multiplication?

A

A register (al/ax/eax/rax)

21
Q

The result will be placed in the ___ and possibly ____ registers, based based on the sizes being multiplied.

22
Q

Convert to Assembly:
num1 db 42
num2 db 73
ans dw 0

ans = num1*num2

A

num1 db 42
num2 db 73
ans dw 0

mov al, byte[num1]
mul byte[num2]
mov word[ans], ax

23
Q

What is the general form of unsigned division instruction?

A

div <src></src>

where the source operand must be a register or memory location

24
Q

The ___ and possibly the ___ register, must be used in combination for the dividend.

The result will be placed in the A register (al/ax/eax/rax)

25
The remainder will be placed in the __, ___, ___, or ___ register.
ah, dx, edx, or rdx register
26
Convert to Assembly: num1 db 63 num2 db 17 ans db 0 rem db 0 ans = num1/num2 rem = num1%num2
num1 db 63 num2 db 17 ans db 0 rem db 0 mov ah, 0 mov al, byte[num1] div byte[num2] mov byte[ans], al mov byte[rem], ah