Академический Документы
Профессиональный Документы
Культура Документы
Ciro Ceissler
clac@cin.ufpe.br / ciro.ceissler@gmail.com
Assembly
Assembly
Cada
Por
Assembly
Antes
do assembly:
Assembly
As
Assembly - Histria
Assembly
Isso
Assembly - Histria
Atualmente
Device
Assembly - Histria
Quem
Assembly - Assembler
Exemplo:
Assembly - Assembler
Byte,
Um
Assembly - Fundamentos
Em
Assembly - Fundamentos
Um
Logo
Assembly - Fundamentos
Binrio
Hexa
Decimal
Tipo
10000000
80
128
byte
8001
32.769
word
111111111111
1111
FFFF
65.535
word
111111111111
111111111111
11111111
FFFFFFFF
4.294.967 dword
.295
100000000000
0001
Assembly - Fundamentos
Registradores
Como
Assembly - Registradores
So
eles:
EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP
Os
Assembly - Registradores
Assembly - Registradores
Nos
EAX
EBX
Assembly - Registradores
ECX
EDX
Assembly - Registradores
ESI
Assembly - Registradores
ESP
Assembly - Registradores
Entre
Atravs
Assembly - Registradores
Assembly - Registradores
O => Overflow
D => Direction
I => Interrupt Enable
T => Trap
S => Signal
Assembly - Registradores
Z
A
P
C
=> Zero
=> Auxiliar Carry
=> Parity
=> Carry
Todos
Assembly - Pilha
Assembly - Pilha
As
Assembly - Pilha
push
push
push
push
push
push
push
push
ax
bx
cx
dx
ds
es
di
si
pusha
push es, ds
popa
pop es, ds
Movimentao
de dados:
Assembly - Instrues
Intel
AT&T
mov eax, 1
movl 3(%ebx),
%eax
Assembly - Instrues
Instruo
de soma:
Assembly - Instrues
Instruo
de subtrao:
Assembly - Instrues
Instrues
de operaes lgicas:
Assembly - Instrues
Instruo
de comparao:
Assembly - Instrues
Instrues
de jump:
Pulo incondicional:
- jmp [100] (Sintaxe Intel)
- jmp eax (Sintaxe Intel)
- jmp *100 (Sintaxe AT&T)
- jmp *%eax (Sintaxe AT&T)
Assembly - Instrues
Pulo condicional:
- je [100] (Sintaxe Intel)
- jne eax (Sintaxe Intel)
- je *100 (Sintaxe AT&T)
- jne *%eax (Sintaxe AT&T)
Assembly - Instrues
Instrues
de manipulao da pilha:
Assembly - Instrues
Assembly - Sees
- Exemplo:
section .data
mensagem: db 'Hello world!'
msglength: equ 12
Assembly - Sees
Assembly - Sees
.
.
.
.
.
.
.
.
.
Assembly - Sees
Interrupes
so chamadas ao
processador requisitando um servio
Assembly - Interrupes
Quando
Aps
Assembly - Interrupes
Para
Assembly - Interrupes
Assembly - Interrupes
Assembly - Interrupes
Um
Pilha
Heap
Cdigo
Dados
Assembly Organizao do
Programa
section .data
hello: db 'Hello world!',10 ; A string 'Hello World! e um linefeed
helloLenght: equ $-hello ; Tamanho da string hello
section .text
global _start
_start:
mov eax,4 ; Interrupo de escrita (sys_write)
mov ebx,1 ; Argumento que indica modo de escrita
mov ecx,hello ; Argumento que indica o endereo da string
mov edx,helloLenght ; Argumento que indica o tamanho da string
int 80h ; Chamada da interrupo
mov eax,1 ; Interrupo exit (sys_exit)
mov ebx,0 ; Argumento da interrupo
int 80h ; Chamada da interrupo
Assembly - Exemplo
.data hello:
.string "Hello World!\n"
.text
.globl main
main:
mov $4,%eax
mov $1,%ebx
mov $hello,%ecx
mov $13,%edx
int $0x80
mov $1,%eax
mov $0,%ebx
int $0x80
Assembly - Exemplo
.stack
.data
include arquivo1.asm
include arquivo2.asm
.code
start:
include arquivo3.asm
end start
Assembly - Include
.data
arquivo1
arquivo2
arquivo3
arquivo4
arquivo5
arquivo6
arquivo7
arquivo8
db
db
db
db
db
db
db
db
'dat/arquivo1'
'dat/arquivo2'
'dat/arquivo3'
'dat/arquivo4'
'dat/arquivo5'
'dat/arquivo6'
'dat/arquivo7'
'dat/arquivo8'
,
,
,
,
,
,
,
,
0
0
0
0
0
0
0
0
.text
call NomeProcedimento
NomeProcedimento PROC NEAR
mov ax, 0x0F;
ret
NomeProcedimento ENDP
Assembly - Procedimentos
Exemplo
mov ah, 0
mov al, 13h
int 10h
Video
www.cin.ufpe.br/~clac/infra_de_software
http://www.wagemakers.be/english/doc/vga
http://www.scribd.com/doc/13290971/INTERRUPCOES
http://maven.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html
http://www.xs4all.nl/~smit/asm04001.htm#vga
http://arapaho.nsuok.edu/~kingw/CS3173/Chapter9.htm
http://burks.bton.ac.uk/burks/language/asm/asmtut/asm8.htm
Assembly Referncias