Rename int2str/uint2str -> dec2str/udec2str
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
;---
|
||||
|
Reference in New Issue
Block a user