Skip to content

Instantly share code, notes, and snippets.

@felipecruz
Created December 1, 2013 21:45
Show Gist options
  • Save felipecruz/7741250 to your computer and use it in GitHub Desktop.
Save felipecruz/7741250 to your computer and use it in GitHub Desktop.
assembly
.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