flat assembler
Message board for the users of flat assembler.

Index > Linux > Problem with add comand

Author
Thread Post new topic Reply to topic
Rock24



Joined: 13 Feb 2015
Posts: 5
Rock24
Hello.
Code:
 format ELF64 executable 
entry _start
segment readable executable
_start:
        mov rbx,'75'
        add [z],rbx
        
        call wypisz
        
        mov rax,60
        syscall

        
wypisz:
        mov rax,1
        mov rdi,1
        mov rsi,z
        mov rdx,[dl_z]
        syscall
        ret
        
segment writable readable
z dq '0'
dl_z dq $- z    


I wonder why I got these results.
1. rbx,'75'
z, '0'
result g5 - why?

2. rbx,75
z, '0'
resultt { -why?

3 rbx,'75'
z, 0
result 75 - why not { ? Smile
Post 23 Feb 2015, 20:11
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 161
gens
man ascii

1.
"0" = 48
"75" = 55 shl 8 + 53 = 55 * 2^8 + 53 = 14133
14133 + 48 = "75" + "0"
hint: ascii output might be clearer if you convert this to binary

2.
48 + 75 = 123 = "{"

3.
same as 1, without + 48
Post 23 Feb 2015, 21:23
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]
Post 23 Feb 2015, 21:29
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 © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.