flat assembler
Message board for the users of flat assembler.

flat assembler > Linux > [solved] Problem with printf

Author
Thread Post new topic Reply to topic
dstyl



Joined: 23 Jul 2015
Posts: 58
Hi dear FASM Members Wink ,
i have trouble using printf.
I want to pass an %s arg to printf.
But i get only my %s printed not the entire string.
Thanks in advance Smile
Code:
; ----------------------------------------------------------------------------- ;Simple CPUID Programm. Based on agner.orgs asmlib ; ----------------------------------------------------------------------------- global main extern printf default rel section .text main: mov rdi, title xor rax, rax call printf ; call cpuid ; mov rdi, bfer mov rsi, name xor rax, rax call printf ret cpuid: push rbx mov eax, esi mov ecx, edx cpuid ; input eax, ecx. output eax, ebx, ecx, edx mov [bfer], eax mov [bfer+4], ebx mov [bfer+8], ecx mov [bfer+12], edx pop rbx ret section .data name: db "Vendor %s", 10, 0 title: db "CPUID v1.0 by capo245", 10, 0 bfer: dd "test", 10, 0 len: equ $-bfer
Post 30 Apr 2017, 09:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15859
Location: 162173 Ryugu
Just looking at your code (i.e. I can't test it) you appear to have loaded the wrong registers in the second call to printf. Maybe RDI should point to 'name'?
Post 30 Apr 2017, 09:59
View user's profile Send private message Visit poster's website Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 58
Thanks it worked Smile
Post 30 Apr 2017, 10:16
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.