flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > [solved] Problem with printf

Author
Thread Post new topic Reply to topic
dstyl



Joined: 23 Jul 2015
Posts: 48
[solved] Problem with printf
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                     rdititle
                xor                     raxrax
                call            printf
;               call            cpuid                           ;
                mov                     rdibfer
                mov                     rsiname
                xor                     raxrax
                call            printf
                ret
cpuid:
        push            rbx
        mov             eaxesi
        mov             ecxedx
        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"100
title:  db              "CPUID v1.0 by capo245"100
bfer:   dd              "test"100
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: 15241
Location: 1I/╩╗Oumuamua
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: 48
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.