0% found this document useful (0 votes)
29 views

ECE391: Computer Systems Engineering Fall 2008 Reference: x86 Assembly x86 Assembly Reference Sheet

This document provides reference information for an x86 Assembly course, including: - A register reference chart for common 32-bit and 16-bit x86 registers - Condition codes and flags for conditional jump instructions - Examples of mov and call instructions - A table with preferred conditional branch forms for signed and unsigned comparisons - A diagram illustrating stack frame layout and growth during a function call
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

ECE391: Computer Systems Engineering Fall 2008 Reference: x86 Assembly x86 Assembly Reference Sheet

This document provides reference information for an x86 Assembly course, including: - A register reference chart for common 32-bit and 16-bit x86 registers - Condition codes and flags for conditional jump instructions - Examples of mov and call instructions - A table with preferred conditional branch forms for signed and unsigned comparisons - A diagram illustrating stack frame layout and growth during a function call
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ECE391: Computer Systems Engineering

Reference: x86 Assembly

Fall 2008

x86 Assembly Reference Sheet

32bit 16bit
AX
EAX
BX
EBX
CX
ECX
DX
EDX
SI
ESI
DI
EDI
BP
EBP
SP
ESP

8bit
high low
AH AL
BH BL
CH CL
DH DL

AX
31

16 15

8 7

AH

AL

EAX

jo
jp

below
below or
equal
equal
less
less or
equal
overflow
parity

js

sign

jb
jbe
je
jl
jle

CF is set
CF or ZF
is set
ZF is set
SF 6= OF
(SF 6= OF) or
ZF is set
OF is set
PF is set
(even parity)
SF is set
(negative)

movb
movb
movb
movb
movb
movb
movb
movb
movb
movb
movb
movb

(%ebp),%al
-4(%esp),%al
(%ebx,%edx),%al
13(%ecx,%ebp),%al
(,%ecx,4),%al
-6(,%edx,2),%al
(%esi,%eax,2),%al
24(%eax,%esi,8),%al
100,%al
label,%al
label+10,%al
10(label),%al

#
#
#
#
#
#
#
#
#
#
#
#

AL M[EBP]
AL M[ESP - 4]
AL M[EBX + EDX]
AL M[ECX + EBP + 13]
AL M[ECX * 4]
AL M[EDX * 2 - 6]
AL M[ESI + EAX * 2]
AL M[EAX + ESI * 8 + 24]
AL M[100]
AL M[label]
AL M[label+10]
NOT LEGAL!

movb
movb

label(%eax),%al
7*6+label(%edx),%al

# AL M[EAX + label]
# AL M[EDX + label + 42]

movw
movw
movw

$label,%eax
$label+10,%eax
$label(%eax),%eax

# EAX label
# EAX label+10
# NOT LEGAL!

call
call
call
call
call

printf
*%eax
*(%eax)
*fptr
*10(%eax,%edx,2)

#
#
#
#
#
#

(push
(push
(push
(push
(push

EIP), EIP
EIP), EIP
EIP), EIP
EIP), EIP
EIP), EIP
M[EAX +

printf
EAX
M[EAX]
M[fptr]

EDX*2 + 10]

Conditional branch sense is inverted by inserting an N after initial J, e.g., JNB. Preferred forms in
table below are those used by debugger in disassembly. Table use: after a comparison such as
cmp %ebx,%esi

# set flags based on (ESI - EBX)

choose the operator to place between ESI and EBX, based on the data type. For example, if ESI and EBX
hold unsigned values, and the branch should be taken if ESI EBX, use either JBE or JNA. For branches
other than JE/JNE based on instructions other than CMP, check the branch conditions above instead.

return address
a = 10

EBP

...

b = 20

stack at start of function

jnae
jb

jna
jbe

jz
je

jnb
jae

jnbe
ja

6=

<

>

jne
jnz

jl
jnge

jle
jng

je
jz

jge
jnl

jg
jnle

/* the function */
/* (returns int in EAX) */
int a func (int a, int b);

unsigned comparisons

signed comparisons

ESP

result

EBP

old EBP
return address
a = 10

/* local variable */
int result;
/* the call */
a func (10, 20);

b = 20

stack growth

ESP

stack growth

preferred form

jnz
jne

...

preferred form

stack during function execution

You might also like