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 > 64bit - how to load bit value and printf it

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 6521
Location: ˛                              ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ Posts: 6699
64bit - how to load bit value and printf it
this seems troublesome, are there other methods?


Code:

 mov    rdi,f3a
 xor    rax,rax
 call   [SDL_GetVersion]

 mov    rdi,f3

 xor    r8,r8
 mov    r8b,[f3a]
 mov    rsi,r8

 xor    r9,r9
 mov    r9b,[f3b]
 mov    rdx,r9

 xor    r10,r10
 mov    r10b,[f3c]
 mov    rcx,r10

 xor    rax,rax
 call   [printf]

segment readable writeable
f3      db 'SDL version %d.%d.%d',10,0
f3a     db 0
f3b     db 0
f3c     db 0




SDL version 2.0.4
Post 27 Mar 2016, 03:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14795
Location: Lost in translation
Is this for Linux or Windows?
Post 27 Mar 2016, 04:36
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 6521
Location: ˛                              ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ Posts: 6699
sorry revolution,
this for linux.
Post 27 Mar 2016, 05:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14795
Location: Lost in translation
Moved to Linux.
Post 27 Mar 2016, 11:20
View user's profile Send private message Visit poster's website Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 251
Location: Australia
Maybe I am missing something here, but at the very least:

Code:
        mov     rdif3a
        call    PLT [SDL_GetVersion]

        mov     rdif3
        movzx   esibyte [f3a]
        movzx   edxbyte [f3b]
        movzx   ecxbyte [f3c]
        call    PLT [printf]


rax doesn't need to be defined prior to a normal register-argument function, and the argument order for x86_64 ABI non-syscall is rdi, rsi, rdx, rcx, r8, r9.

Did I miss something?

_________________
2 Ton Digital - https://2ton.com.au/
Post 27 Mar 2016, 23:18
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 6521
Location: ˛                              ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ Posts: 6699
thanks redsock, =)
Post 30 Mar 2016, 11:42
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.