diff options
| author | Christian Cunningham <cc@localhost> | 2024-07-13 21:52:22 -0700 | 
|---|---|---|
| committer | Christian Cunningham <cc@localhost> | 2024-07-13 21:52:22 -0700 | 
| commit | f77b1d7a4500b3600bf802ce9f572fb58f813c50 (patch) | |
| tree | c30047c9c880b4d825e499f7be48f87c37a13424 | |
| parent | 3cf5ac94d47262dd3cc2b6a3e0b12bf3e0321af9 (diff) | |
Add debug function
| -rw-r--r-- | debug.inc | 25 | ||||
| -rw-r--r-- | main.asm | 1 | 
2 files changed, 26 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 @@ -6,6 +6,7 @@  %include "zstring.inc"  %include "dtos.inc"  %include "file.inc" +%include "debug.inc"  	section .data  	make_lstring	test_lstring,	"LString Test: Ok",10  | 
