Skip to content

Instantly share code, notes, and snippets.

@sebbekarlsson
Last active November 2, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebbekarlsson/e34cd735de51d13df111fe5fa4b97523 to your computer and use it in GitHub Desktop.
Save sebbekarlsson/e34cd735de51d13df111fe5fa4b97523 to your computer and use it in GitHub Desktop.
.type to_str, @function
to_str:
pushl %ebp
movl %esp, %ebp
movl 8(%esp), %eax
jmp to_str_loop
to_str_loop:
movl $0, %edx
movl $10, %ecx
div %ecx
cmp $0, %edx
je to_str_end
addl $48, %edx # convert to ascii
pushl %edx # remain
jmp to_str_loop
to_str_end:
movl %ebp, %esp
popl %ebp
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment