Skip to content

Instantly share code, notes, and snippets.

@Codonaut
Created March 29, 2012 14:54
Show Gist options
  • Save Codonaut/2238173 to your computer and use it in GitHub Desktop.
Save Codonaut/2238173 to your computer and use it in GitHub Desktop.
Tested to work right
getCharAsInt:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl 12(%ebp), %edx
addl %edx, %eax
movl %eax, %ecx
movl $0, %eax
movb (%ecx), %eax
movl %ebp, %esp
popl %ebp
ret
@ox
Copy link

ox commented Mar 29, 2012

Line 9 is illegal, apparently. It should be this:

.text
.globl getCharAsInt
getCharAsInt:
pushl %ebp          
movl %esp, %ebp     
movl 8(%ebp), %eax         
movl 12(%ebp), %edx  
addl %edx, %eax
movb (%eax), %al
movsbl %al, %eax
popl %ebp           
ret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment