Académique Documents
Professionnel Documents
Culture Documents
Pipelining
Two ways to make CPU process information faster:
AL
BL
CL
DL
Overview
Registers
The stack
Registers
To store information temporarily
Category
General
8
Pointer
Index
Segment
AX
16-bit register
AH
AL
8-bit reg. 8-bit reg.
Anatomy of a Register
Extended Register
Word Register
Bits 16-31
Bits 8-15
Bits 0-7
General Registers
32 bit Registers
16 bit Registers
8 bit Registers
EAX
EBP
AX
BP
AH
AL
EBX
ESI
BX
SI
BH
BL
ECX
EDI
CX
DI
CH
CL
EDX
ESP
DX
SP
DH
DL
Bits 16-31
Bits 8-15
Bits 0-7
General Registers I
EAX Accumulator
accumulator for operands and results data
usually used to store the return value of a procedure
ECX Counter
counter for string and loop operations
General Registers II
ESI Source Index
source pointer for string operations
typically a pointer to data in the segment pointed to
by the DS register
Segment Registers
CS Code Segment
SS Stack Segment
contains the segment selector for the stack
segment, where the procedure stack is stored
Instruction Pointer
EIP
Instruction Pointer
Contains the offset within the code segment of
the next instruction to be executed
Cannot be accessed directly by software
The Stack
EBP
Current
stack
frame
Callers
stack
frame
stack
growth
Intel Assembly
Flag Register
Flag Register (status register)
16-bit register
Conditional flags: CF, PF, AF, ZF, SF, OF
Control flags: TF, IF, DF
ZF
Segments
Segment definition:
The 80x86 CPU has four segment registers: CS, DS, SS, ES
Segments of a program:
.STACK
; marks the beginning of the stack segment
example:
.STACK 64;reserves 64B of memory for the stack
Segments
.CODE
; marks the beginning of the code segment
- starts with PROC (procedures) directive
- the PROC directive may have the option FAR or NEAR
- ends by ENDP directives
EQU
25
example:
DATA1
DATA2
DATA3
DQ
DQ
DQ
6723F9H;hex
Hi
;ASCII characters
?
;nothing
example:
DATA1
DT
123456789123
;BCD
DATA2
DT
?
;nothing
DATA3
DT
76543d ;assembler will convert decimal
number to hex and store it