From f77b1d7a4500b3600bf802ce9f572fb58f813c50 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 13 Jul 2024 21:52:22 -0700 Subject: Add debug function --- debug.inc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 debug.inc (limited to 'debug.inc') 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 -- cgit v1.2.1