flat assembler
Message board for the users of flat assembler.

Index > Linux > String comparison (64 bit linux)

Author
Thread Post new topic Reply to topic
orbital_fox



Joined: 08 Sep 2006
Posts: 14
orbital_fox
Greetings..

I have finally started to try making something.

I am now trying to make a program, that does a string comparison, but i am having a bit of problem with the data sizes (i think :/)

Here are the parts of tha program related to that:


Code:
        mov     edx,input_buffer_size
        lea     rsi,[input_buffer]
        mov     edi,0
        mov     eax,0   ; see /usr/share/man/man2/read.2.gz
        syscall

 mov rax, input_buffer
 cmp qword[rax], '49' ; I want the input buffer to be compared with the string 49
 je lmsg2

;The messages etc..
;    .
;    .
;    .

segment readable writeable

input_buffer_size       =       0xFFFF
input_buffer            rb      input_buffer_size
    


The code assembles, but just doesnt work right..

_________________
http://section-9.co.nr
Post 31 Oct 2006, 09:34
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you must know what is encoding of string. if it's ascii then you just do cmp word [rax], '49', which is equivalent to memcmp((char*)rax, "49", 2)
Post 31 Oct 2006, 09:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
orbital_fox



Joined: 08 Sep 2006
Posts: 14
orbital_fox
whats the usuall encoding from a command line input? Is that the one defined in the settings of the command line terminal?

_________________
http://section-9.co.nr
Post 31 Oct 2006, 16:50
View user's profile Send private message Visit poster's website Reply with quote
orbital_fox



Joined: 08 Sep 2006
Posts: 14
orbital_fox
Thanks! it worked Smile

_________________
http://section-9.co.nr
Post 31 Oct 2006, 16:54
View user's profile Send private message Visit poster's website 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 © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.