aboutsummaryrefslogtreecommitdiff
path: root/debug.inc
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-07-13 21:52:22 -0700
committerChristian Cunningham <cc@localhost>2024-07-13 21:52:22 -0700
commitf77b1d7a4500b3600bf802ce9f572fb58f813c50 (patch)
treec30047c9c880b4d825e499f7be48f87c37a13424 /debug.inc
parent3cf5ac94d47262dd3cc2b6a3e0b12bf3e0321af9 (diff)
Add debug function
Diffstat (limited to 'debug.inc')
-rw-r--r--debug.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/debug.inc b/debug.inc
new file mode 100644
index 0000000..e401c1f
--- /dev/null
+++ b/debug.inc
@@ -0,0 +1,25 @@
+%ifndef DEBUG_INC
+%define DEBUG_INC
+%ifndef ZSTRING_INC
+%include "zstring.inc"
+%endif
+%ifndef DTOS_INC
+%include "dtos.inc"
+%endif
+
+ ;; TODO: Make print without newline
+%macro DEBUG_HERE 0-1 ""
+ section .data
+ make_zstring %%head, "Log: ", __?FILE?__,":"
+ make_zstring %%text, %1,10
+ section .text
+ lea rax, [rel %%head]
+ call print_zstring
+ mov rax, __?LINE?__
+ call data_to_zstring_md
+ mov rax, [rax]
+ call print_zstring
+ lea rax, [rel %%text]
+ call print_zstring
+%endm
+%endif