Chapter 3 - Assembly Flashcards
Special Purpose Registers
IP SP Flags CS DS ES FS GS
IP
instruction pointer; points to next sequential instruction
SP
stack pointer; addresses stack area
flags
collection of control properties
12 bits
C flag
carry flag; holds the carry after addition or borrow after subtraction
Z flag
zero flag; reports the result of an arithmetic operation as zero
S flag
sign flag; holds the sign of the result after an arithmetic or logic instruction
O flag
overflow flag; indicates overflow as a result from signed arithmetic operations
CS
code segment; holds the programs used by the system
DS
data segment; contains most of the data used by program
data accessed by offset address
ES
extra segment; an additional data segment
SS
stack segment; defines the are of memory used for the stack.
Stack pointer register determines entry point in stack segment
FS & GS
additional segment registers
Real mode
allows the microprocessor to only address the 1st MB of memory. any program can access any area of memory
offset address
used to select a location within a 64kb segment to address a given program
Assembler start of program
.Model small
.stack 100h
Main PROC
mov ax, @data
mov ds, ax
Register Addressing
transfers a copy of a byte or word from one register to another
ex: mov ax, bx
Immediate addressing
transfers the source immediate byte (actual value) into a register or memory location
ex: mov ah, 0
Direct addressing
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)
Displacement addressing
almost identical to direct addressing except instruction is 4 bytes wide instead of 3 bytes wide
How to move 8 bits into 16 bit register
2 moves
mov al, temp
mov ah, 00h
MOV operations allowed
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
_GetCh
grabs char from input. result in BL register
_GetDate
grabs date.
DL = day DH = month CX = year AL = day of week