aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-07-14 11:07:06 -0700
committerChristian Cunningham <cc@localhost>2024-07-14 11:07:06 -0700
commit13799fb3f48d8446046b901233c449fadc1af3b2 (patch)
tree56d89be961021aa8f1754231748fc1fe5e1cf38d
parent5b0f04f0c5d406def1acbcdbcc114e9b4bf5c7da (diff)
Display Flag RegistersHEADmaster
-rw-r--r--debug.inc6
-rw-r--r--linked_list.inc16
-rw-r--r--main.asm10
3 files changed, 25 insertions, 7 deletions
diff --git a/debug.inc b/debug.inc
index 230c7e8..f410096 100644
--- a/debug.inc
+++ b/debug.inc
@@ -37,4 +37,10 @@
m_bind data_to_zstring_m%2
m_call print_zstring
%endm
+
+%macro FLAGD 0-1 h
+ pushfq
+ pop rax
+ REGD rax, %1
+%endm
%endif
diff --git a/linked_list.inc b/linked_list.inc
index 0e5042b..6e0e0e4 100644
--- a/linked_list.inc
+++ b/linked_list.inc
@@ -99,4 +99,20 @@ _dll_end:
mov qword [rax + dll_prev], %1
%endm
+_dll_free:
+ push rbp
+ mov rbp, rsp
+ push rbx
+
+ dll_end
+.free_loop:
+ mov rbx, [rax + dll_prev]
+ dll_free
+ mov rax, rbx
+ cmp rbx, 0
+ jne .free_loop
+ pop rbx
+ mov rsp, rbp
+ pop rbp
+ ret
%endif
diff --git a/main.asm b/main.asm
index 77d214b..2e5d293 100644
--- a/main.asm
+++ b/main.asm
@@ -146,13 +146,9 @@ _main:
pop rax
pop rax
pop rax
- dll_end
-.free_loop:
- mov rbx, [rax + dll_prev]
- dll_free
- mov rax, rbx
- cmp rbx, 0
- jne .free_loop
+ call _dll_free
+
+ FLAGD b
exit_prog