aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-11-02 17:18:08 -0700
committerChristian Cunningham <cc@localhost>2024-11-02 17:18:08 -0700
commitccbc8a00aeb72f2b54bafacd6ccaad6f93c6e95e (patch)
treea97e5898047c9b3f2dc34ebc729c14f214ec4e1d
parent2c9097c47f4b6612bdc67d4de6868dab737fc4a0 (diff)
Remove `mov rax rax`
-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