Created
December 1, 2013 21:45
-
-
Save felipecruz/7741250 to your computer and use it in GitHub Desktop.
assembly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
int_pattern: .ascii "%d\12\0" | |
string_pattern: .ascii "%s\12\0" | |
.text | |
.globl _print_int | |
_print_int: | |
pushl %ebp | |
movl %esp, %ebp | |
pushl %ebx | |
subl $20, %esp | |
movl 8(%ebp), %eax | |
movl %eax, 4(%esp) | |
leal int_pattern, %eax | |
movl %eax, (%esp) | |
call _printf | |
add $8, %esp | |
leave | |
ret | |
.globl _main | |
_main: | |
push %ebp | |
mov %esp, %ebp | |
sub $24, %esp | |
# Chamada | |
movl $2, %eax | |
movl %eax, (%esp) | |
pushl %eax | |
call _print_int | |
addl $4, %esp | |
# Fim Chamada | |
mov $1, %eax | |
mov %ebp, %esp | |
pop %ebp | |
ret | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment