diff options
author | June McEnroe <programble@gmail.com> | 2016-12-02 04:58:57 -0500 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2016-12-02 04:58:57 -0500 |
commit | a1010618a24474e4c8253d2fc1df300474bac609 (patch) | |
tree | e08b59b1e842f2bd948626c87624cee71c2d2e7f /lib.asm | |
parent | Rewrite day 1 solution (diff) | |
download | aoc-a1010618a24474e4c8253d2fc1df300474bac609.tar.gz aoc-a1010618a24474e4c8253d2fc1df300474bac609.zip |
Add 32-bit hex formatting
Diffstat (limited to '')
-rw-r--r-- | lib.asm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib.asm b/lib.asm new file mode 100644 index 0000000..10d0e1c --- /dev/null +++ b/lib.asm @@ -0,0 +1,19 @@ +section .rodata +hexDigits: db '0123456789ABCDEF' + +section .text +hex32: + push rbx + mov rbx, hexDigits + xor rax, rax + +%rep 8 + shl rax, 8 + mov al, dil + and al, 0x0F + xlatb + shr rdi, 4 +%endrep + + pop rbx +ret |