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 > How to loop?

Author
Thread Post new topic Reply to topic
Rock24



Joined: 13 Feb 2015
Posts: 5

How to loop?

Hello.
I would like to display 10 times text on the screen


Code:
format ELF64 executable  
entry _start 
segment readable executable
_start:
        mov rcx,1
loo:
        cmp rcx10
        jae endd
        
        mov rax,1
        mov rdi,1
        mov rsi,abc
        mov rdx,[dlg]
        syscall
        add rcx,1
        jmp loo
endd:

mov rax,60
syscall


segment writeable executable
abc db "abc"0ah
dlg dq $ - abc




This code displays txt only once. What am I doing wrong?
Post 20 Feb 2015, 00:15
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000

loopnz
Post 20 Feb 2015, 00:17
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1171
Location: Unknown

Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 17:54; edited 1 time in total
Post 20 Feb 2015, 00:22
View user's profile Send private message Reply with quote
Rock24



Joined: 13 Feb 2015
Posts: 5

Thank you HaHaAnonymous, typedef.
I was sure that 'syscall' destroy only rax Smile
Post 20 Feb 2015, 00:29
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1171
Location: Unknown

Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 17:54; edited 1 time in total
Post 20 Feb 2015, 00:34
View user's profile Send private message Reply with quote
Rock24



Joined: 13 Feb 2015
Posts: 5

I have one question yet.
What if i use cx register instead rcx? This will change something in the loop / code?
Post 20 Feb 2015, 00:52
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1171
Location: Unknown

Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 17:54; edited 1 time in total
Post 20 Feb 2015, 01:00
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 211
Location: %x

so CX are the first 16 bits of the ecx Register and ecx the first 32 of the rax register
if rcx gets destroyed the other will get too
Post 20 Feb 2015, 01:57
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 159

http://www.logix.cz/michal/devel/amd64-regs/
good table

@badc0de02
"first 32 bits of rcx register"* Smile
Post 20 Feb 2015, 02:06
View user's profile Send private message Reply with quote
nkeck72



Joined: 28 May 2015
Posts: 83
Location: 0000:7C00

Was being an idiot. As such, this post has been removed.

_________________
It may look hard, but it won't take long if you take it one byte at a time.

NOS: www.github.com/nkeck720/nos
Post 28 May 2015, 20:59
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


Powered by phpBB © 2001-2005 phpBB Group.

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