From f8df1242fc78f5ac062df90b0b908da636a17d4a Mon Sep 17 00:00:00 2001 From: Kwarde Date: Tue, 8 Jul 2025 17:49:38 +0200 Subject: [PATCH] Rename int2str/uint2str -> dec2str/udec2str --- src/console.asm | 8 ++++---- src/convert.asm | 16 ++++++++-------- src/tests.asm | 18 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/console.asm b/src/console.asm index 5f2caea..b82a98d 100644 --- a/src/console.asm +++ b/src/console.asm @@ -1,8 +1,8 @@ %include "src/constants.asm" extern strlen -extern int2str -extern uint2str +extern dec2str +extern udec2str section .rodata mNL db NL @@ -166,11 +166,11 @@ printf: cmp byte [rdi + 1], 'd' je .callINT2STR mov rdi, rsi - call uint2str + call udec2str jmp .loadConvertedStr .callINT2STR: mov rdi, rsi - call int2str + call dec2str .loadConvertedStr: mov rsi, rax add rsp, SIZE_QWORD diff --git a/src/convert.asm b/src/convert.asm index 2babc10..6591b24 100644 --- a/src/convert.asm +++ b/src/convert.asm @@ -3,11 +3,11 @@ section .bss cnvtBuff resb 21 section .text - global int2str - global uint2str + global dec2str + global udec2str -;----- int2str(num) -----; -; Converts a signed integer to a string +;----- dec2str(num) -----; +; Converts a signed integer to a string (decimal output) ; Return value: Pointer to string containing the converted number ; Used registers: ; rax* num stored for div >> (ret) pointer to cnvtBuff[] @@ -16,7 +16,7 @@ section .text ; rdi* (arg) number to convert to string >> Remembers if num is negative ; rsi* Points to cnvtBuff for writing characters ; r8* Dividor for div -int2str: +dec2str: mov rsi, cnvtBuff test rdi, rdi jnz .notZero @@ -56,8 +56,8 @@ int2str: mov rax, cnvtBuff ret -;----- uint2str(num) -----; -; Converts an unsigned integer to a string +;----- udec2str(num) -----; +; Converts an unsigned integer to a string (decimal output) ; Return value: Pointer to string containing the converted number ; Used registers: ; rax* num stored for div >> (ret) pointer to cnvtBuff[] @@ -66,7 +66,7 @@ int2str: ; rdi* (arg) number to convert to string ; rsi* Points to cnvtBuff for writing characters ; r8* Dividor for div -uint2str: +udec2str: mov rsi, cnvtBuff test rdi, rdi jnz .notZero diff --git a/src/tests.asm b/src/tests.asm index 2ce7eb2..d386af6 100644 --- a/src/tests.asm +++ b/src/tests.asm @@ -12,13 +12,13 @@ extern strcpy extern strcat extern strclr ; convert.asm -extern int2str -extern uint2str +extern dec2str +extern udec2str section .rodata TEST_print equ 1 TEST_puts equ 1 - TEST_int2str equ 1 ;includes uint2str + TEST_dec2str equ 1 ;includes udec2str TEST_printf equ 1 TEST_strlen equ 1 TEST_strcpy equ 1 @@ -111,18 +111,18 @@ _start: %endif ;--- -;--- int2str() / uint2str() +;--- dec2str() / udec2str() ;--- -%if TEST_int2str +%if TEST_dec2str ; x/s $rax after calls to confirm proper output mov rdi, -569384 - call int2str + call dec2str mov rdi, -569384 - call uint2str + call udec2str mov rdi, 0xFFFFFFFFFFFFFFFF - call int2str + call dec2str mov rdi, 0xFFFFFFFFFFFFFFFF - call uint2str + call udec2str %endif ;---