aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dtos.inc14
1 files changed, 13 insertions, 1 deletions
diff --git a/dtos.inc b/dtos.inc
index fb4a048..56bd0c6 100644
--- a/dtos.inc
+++ b/dtos.inc
@@ -3,7 +3,8 @@
%ifndef MONAD_INC
%include "monad.inc"
%endif
-
+
+ ;; TODO: Thread safety, allocate the write buffer instead of a global state incase it is interrupted and rewritten
section .data
_NUMERALS db "0123456789ABCDEF"
_DATA_BYTE_BUFFER times 63 db "0"
@@ -12,25 +13,33 @@
m_make DTOS_RESULT, _DATA_BYTE_BUFFER
%macro dtomz_h 1
+ %if "%1" != "%rax"
mov rax, %1
+ %endif
mov rcx, 16
call data_to_zstring
%endm
%macro dtomz_d 1
+ %if "%1" != "%rax"
mov rax, %1
+ %endif
mov rcx, 10
call data_to_zstring
%endm
%macro dtomz_o 1
+ %if "%1" != "%rax"
mov rax, %1
+ %endif
mov rcx, 8
call data_to_zstring
%endm
%macro dtomz_b 1
+ %if "%1" != "%rax"
mov rax, %1
+ %endif
mov rcx, 2
call data_to_zstring
%endm
@@ -100,6 +109,9 @@ data_to_zstring:
pop rbp
ret
+ ;; Monadic functions (m_bind d2zs_m?)
+ ;; data_to_zstring_m?
+ ;; rax -> M (d2zs_? rax)
data_to_zstring_mh:
mov rcx, 16
call data_to_zstring