Chapter 3 - Assembly Flashcards

1
Q

Special Purpose Registers

A
IP
SP 
Flags
CS
DS
ES
FS
GS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

IP

A

instruction pointer; points to next sequential instruction

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

SP

A

stack pointer; addresses stack area

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

flags

A

collection of control properties

12 bits

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

C flag

A

carry flag; holds the carry after addition or borrow after subtraction

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

Z flag

A

zero flag; reports the result of an arithmetic operation as zero

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

S flag

A

sign flag; holds the sign of the result after an arithmetic or logic instruction

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

O flag

A

overflow flag; indicates overflow as a result from signed arithmetic operations

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

CS

A

code segment; holds the programs used by the system

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

DS

A

data segment; contains most of the data used by program

data accessed by offset address

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

ES

A

extra segment; an additional data segment

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

SS

A

stack segment; defines the are of memory used for the stack.

Stack pointer register determines entry point in stack segment

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

FS & GS

A

additional segment registers

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

Real mode

A

allows the microprocessor to only address the 1st MB of memory. any program can access any area of memory

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

offset address

A

used to select a location within a 64kb segment to address a given program

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

Assembler start of program

A

.Model small
.stack 100h
Main PROC

mov ax, @data
mov ds, ax

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

Register Addressing

A

transfers a copy of a byte or word from one register to another

ex: mov ax, bx

18
Q

Immediate addressing

A

transfers the source immediate byte (actual value) into a register or memory location

ex: mov ah, 0

19
Q

Direct addressing

A

moves a byte or word between memory and AL, AX, or EAX registers ONLY

most operands must be the same size

ex: count DW 100H
temp DB 20

mov ax, count (or mov count, ax)
mov al, temp (or vice versa)

20
Q

Displacement addressing

A

almost identical to direct addressing except instruction is 4 bytes wide instead of 3 bytes wide

21
Q

How to move 8 bits into 16 bit register

A

2 moves

mov al, temp
mov ah, 00h

22
Q

MOV operations allowed

A

all moves require the source and destination to be of the same size

memory to register; yes (and vice versa)
x bit register to x bit register; yes
x bit register to y bit register; no if x != y
literal to memory; yes
memory to memory; no
23
Q

_GetCh

A

grabs char from input. result in BL register

24
Q

_GetDate

A

grabs date.

DL = day
DH = month
CX = year
AL = day of week
25
Binary subtraction for A - B
= A + twos_complement(B)
26
Twos Complement
flip the bits and add 1
27
Size of number as a result of multiplication
8 bit * 8 bit = 16 bit | 16 bit * 16 bit = 32 bit
28
Multiplication operations
MUL; unsigned number multiplication | IMUL; signed number multiplication
29
Multiplication operation structure
register/memory location * al/ax ex: C = A * B A DW 10 B DW 5 C DW ? ``` mov ax, B mul A (or IMUL A) ``` if C <= 16 bits answer in AX else AX = lower 16 bits DX = remaining upper bits
30
CBW
convert byte to word | sign extend a bye into a word
31
CWD
convert word to double | sign extend word to double word
32
Size of number as a result of division
16 bits / 8 bits = 8 bits | 32 bits / 16 bits = 16 bits
33
Division Operations
DIV; unsigned number division | IDIV; signed number division
34
Division Operation Structure
register or eax or ax / reg or mem location ex: Q = B/C Q DW ? R DW ? B DW 12 C DW 4 ``` mov Ax, B CWD (make AX into EAX) DIV C (or IDIV) ``` ``` AX = quotient DX = remainder ```
35
Jump types
``` JE --> jump equals JNE --> jump not equals JL --> jump less than JG --> jump greater than JGE --> jump greater than or equal JNGE --> jump not greater than or equal JLE --> jump less than or equal JNLE --> jump not less than or equal JMP --> unconditional jump ```
36
What happens when jump instruction is called?
if the criteria is true, then the program jumps to the specified label
37
What does CALL do?
pushes IP on to stack | replaces current address of IP with address of subprogram
38
What does RET do?
pops the return address from the stack into IP plus the number of bytes specified
39
What happens to begin each subprogram?
save the current bp, set sp equal to bp
40
How to add subprogram parameters?
Parameters pushed on stack from left to right. First parameter located at word ptr [bp + 4], the second at word ptr [bp + 6] etc. (the IP at [bp+2]
41
Where are local variables in the stack frame?
at word ptr [bp-2], word ptr [bp -4] etc.