summary refs log tree commit diff homepage
path: root/lib.asm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib.asm19
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