aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kapp Lindquist <alind24@student.sdu.dk>2025-10-08 13:33:47 +0200
committermithe24 <mithe24@student.sdu.dk>2025-10-29 13:49:57 +0100
commit1b8cebf54c10acc4d895d88063f6a6eaf4aa9923 (patch)
tree0b05e98f96962010a1cee6e7b93c3f693f422cb5
parentd8003db60fe37c7e3402c8eae12f3c92575c4268 (diff)
downloadsorter-1b8cebf54c10acc4d895d88063f6a6eaf4aa9923.tar.gz
sorter-1b8cebf54c10acc4d895d88063f6a6eaf4aa9923.zip
fix(outputGenerator.s): renamed printNum to print_num
Diffstat (limited to '')
-rw-r--r--src/outputGenerator.s22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/outputGenerator.s b/src/outputGenerator.s
index 8a885d1..d547c59 100644
--- a/src/outputGenerator.s
+++ b/src/outputGenerator.s
@@ -5,7 +5,7 @@ newline:
tab:
.byte 9 # '\tab'
-
+.section .text
# --------------------------------------------
# FUNCTION: print_tab
# PURPOSE : print a tab character ('\t')
@@ -55,12 +55,12 @@ print_buffer:
cmpq $0, %rsi
jle done # if n > 0 print_coordinate
- movq %rdi, %rdx # keep pointer here, rdi will be used for printNum
+ movq %rdi, %rdx # keep pointer here, rdi will be used for print_num
loop:
# print x and tab
movq (%rdx), %rdi # load x
- call printNum
+ call print_num
push %rdx # save pointer
push %rsi # save n
call print_tab
@@ -69,7 +69,7 @@ loop:
# print y and newline
movq 8(%rdx), %rdi # load y
- call printNum
+ call print_num
push %rdx # save pointer
push %rsi # save n
call print_newline
@@ -90,9 +90,9 @@ ret
# Print RDI as an unsigned integer without any new line.
# Note: the function does not follow the ordinary calling convention,
# but restores all registers.
-.type printNum, @function
-.globl printNum
-printNum:
+.type print_num, @function
+.globl print_num
+print_num:
push %rbp
movq %rsp, %rbp
@@ -107,7 +107,7 @@ printNum:
movq %rdi, %rax # arg
movq $0, %r9 # digit count
-.LprintNum_convertLoop:
+.Lprint_num_convertLoop:
movq $0, %rdx
movq $10, %rcx
idivq %rcx
@@ -115,8 +115,8 @@ printNum:
push %rdx
addq $1, %r9
cmpq $0, %rax
- jne .LprintNum_convertLoop
-.LprintNum_printLoop:
+ jne .Lprint_num_convertLoop
+.Lprint_num_printLoop:
movq $1, %rax # sys_write
movq $1, %rdi # stdout
movq %rsp, %rsi # buf
@@ -124,7 +124,7 @@ printNum:
syscall
addq $8, %rsp
addq $-1, %r9
- jne .LprintNum_printLoop
+ jne .Lprint_num_printLoop
# restore
pop %r9