Created
August 30, 2018 11:12
-
-
Save routevegetable/16a3dd00f009b9ef7b2fa627a38b1f1d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// void print_hex(unsigned char num); | |
.data | |
buff: | |
.ascii "0x00\n" | |
.global print_hex | |
.text | |
print_hex: | |
mov %rdi,%rax | |
and $0x0F,%rax | |
add $0x30,%rax | |
cmp $0x3A,%rax | |
jl 1f | |
add $0x7,%rax | |
1: | |
mov %al,buff+3(%rip) | |
mov %rdi,%rax | |
shr $0x4,%rax | |
and $0x0F,%rax | |
add $0x30,%rax | |
cmp $0x3A,%rax | |
jl 1f | |
add $0x7,%rax | |
1: | |
mov %al,buff+2(%rip) | |
mov $0x1,%rdi | |
lea buff(%rip),%rsi | |
mov $0x5,%rdx | |
mov $0x1,%rax | |
syscall | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment