Instruction set overview Flashcards

1
Q

In general, an instruction consists of the instruction or ___________ itself and the __________.

A

Operation and operands.

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

It refer to the 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
3
Q

What is the general form of the move instruction?

A

mov <destination>, <source></source></destination>

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

In mov command, source operand is _________ into the destination operand.

A

Copied

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

In data movement, the destination and source operand must be ________________.

A

same size

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

In data movement, operands cannot be _____________________.

A

both memory variables

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

In using a memory variable in an instruction, what is the format?

A

<size>[<variable>]

ex. dword[myVariable]
</variable></size>

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

How do you code the following?

value = 27
ans = num

section .data
value dd 0
num db 19
ans db 0

A

mov byte[value], 27

mov al, byte[num]
mov byte[ans], al

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
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
10
Q

In register mode addressing, the operand is a ____________.

A

CPU register

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

In immediate mode addressing, the operand is _______________.

A

an immediate value

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

In the instruction:
mov eax, 130

eax and 130 is/are in what mode/s

A

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

In memory mode addressing, the operand is a _________________ referred to as indirection or dereferencing.

A

location in memory (accessed via an address)

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

What is the general form of integer addition instruction?

A

add <dest>, <src></src></dest>

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

What is the equivalent of the code below in C?
add <dest>, <src></src></dest>

A

<dest> = <dest> + <src>
</src></dest></dest>

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

What are the restrictions/limitations in addition instruction?

A

Destination and source operand must be of the same size or operands cannot be both memory variable

17
Q

What is the assembly code of ans = num1 + num2 if all of these variables are in byte size.

A

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

18
Q

What is the general form of the increment instruction?

A

inc <operand></operand>

19
Q

What is the general form of integer subtraction instruction?

A

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

20
Q

What is the equivalent of
sub <dest>, <src>
in C language?</src></dest>

A

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

21
Q

What are the restrictions/limitations in subtraction instruction?

A

Destination and source operand must be of the same size or operands cannot be both memory variable

22
Q

What is the assembly code of
ans = num1 - num2
if all of these variables are in byte size.

A

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

23
Q

What is the general form of unsigned multiplication?

A

mul <src></src>

24
Q

In mul <src>, the source operand must be a \_\_\_\_\_\_\_\_\_.</src>

A

register or memory location

25
For the single operand multiplication instruction, the _ register must be used for one of the operands.
A register
26
What are the different parts of the A register that must be used for different operand sizes?
al for 8 bits ax for 16 bits eax for 32 bits rax for 64 bits
27
For the single operand multiplication instruction, the result will be placed in the _ and possibly _ registers, based on the sizes being multiplied.
A and D registers
28
What is the equivalent of ans = num1*num2 in assembly code if the operands are byte sizes?
mov al, byte[num1] mul byte[num2] mov word[ans], ax
29
What is the equivalent of ans = num1*num2 in assembly code if the operands are word sizes?
mov ax, byte[num1] mul word[num2] mov dword[ans], ax mov dword[ans+2], dx
30
What is the general form of the unsigned division instruction?
div
31
In div , the source operand must be a ________ or _________.
register or memory location.
32
The A and possibly the D register, must be used in combination for the ________.
dividend
33
The result of a division instruction will be placed in the ________ and the remainder in the _________.
A register remainder in ah,dx,edx, or rdx
34
What is the equivalent assembly code of this: ans = num1/num2
mov ah, 0 ; for resetting/making sure it does not contain anything mov al, byte[num1] div al, byte[num2] mov byte[ans], al mov byte[rem], ah