From 486b4d5d9bd7fd5740509facf156435dcfa557a1 Mon Sep 17 00:00:00 2001 From: Kwarde Date: Fri, 1 Aug 2025 11:01:16 +0200 Subject: [PATCH] __INTERNAL_fmt: write_format_data writes to array directly; do not strcat __fmt_Buff to array --- src/console.asm | 8 -------- src/tests.asm | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/console.asm b/src/console.asm index 3c9c2c0..ab6534b 100644 --- a/src/console.asm +++ b/src/console.asm @@ -524,14 +524,6 @@ __INTERNAL_fmt: test rbx, rbx jz .wrapup_print mov byte [r15+r10+1], EOS - lea rdi, [r15] - lea rsi, [rel __fmt_Buff] - mov rdx, rbx - sub rsp, SIZE_QWORD - push r11 - call strcat - pop rax - add rsp, SIZE_QWORD jmp .quit .wrapup_print: mov rax, NR_write diff --git a/src/tests.asm b/src/tests.asm index cd3412b..25425a2 100644 --- a/src/tests.asm +++ b/src/tests.asm @@ -85,6 +85,7 @@ extern strcat extern strclr extern strcmp extern strfind +extern format ;convert.asm extern atoi extern itoa @@ -421,7 +422,11 @@ section .rodata addTest(fgetmod2, "fgetmod(statbuff2)") fgetmodStr db "\t- File permissions of file '%s': %04o\n",EOS + fmt_str db "%s",EOS + section .bss + fmt_out resb 5 + fmt_over resb 64 inputBuffer_4 resb 4 inputBuffer_32 resb 32 strBuff1 resb 64 @@ -1660,6 +1665,16 @@ _start: sub rcx, r14 call printf + lea rdi, [rel fmt_out] + mov rsi, 5 + lea rdx, [rel fmt_str] + xor rcx, rcx + call format + lea rdi, [rel fmt_out] + call puts + lea rdi, [rel fmt_over] + call puts + ;--- exit() xor rdi, rdi call exit