Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first assembly program
07-04-2009, 07:48 AM
Post: #1
My first assembly program
I'm just now learning asm. I use nasm on 64 bit linux if you were wondering.
Here she is:

Code:
bits 64
msg db "looooops iz funnz", 10, 0
global _start

section .code

_start:

mov bx, 0
myloop:

mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 19

cmp bx, 10
je    end
add bx, 1

syscall

jmp myloop



end:

mov rax, 60
mov rdi, 0
syscall

It prints "looooops iz funnz" 10 times.
If you want to know what any part does, just ask.

I Heart C++
Find all posts by this user
Quote this message in a reply
07-04-2009, 09:09 AM
Post: #2
RE: My first assembly program
nice i'm guessing your running a 64-bit system *sarcasm* lol
but what does this part do:

mov rdx, 19

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
07-04-2009, 09:52 AM (This post was last modified: 07-04-2009 09:52 AM by matt..)
Post: #3
RE: My first assembly program
rdx is just like any other register.
Its a 64 bit register.

I Heart C++
Find all posts by this user
Quote this message in a reply
07-04-2009, 10:13 PM
Post: #4
RE: My first assembly program
Wow, i don't know much about assembly , but i suppose it has some good commands, but this is great !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-05-2009, 07:55 AM
Post: #5
RE: My first assembly program
(07-04-2009 07:48 AM)matt. Wrote:  I'm just now learning asm. I use nasm on 64 bit linux if you were wondering.
Here she is:

Code:
bits 64
msg db "looooops iz funnz", 10, 0
global _start

section .code

_start:

mov bx, 0
myloop:

mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 19

cmp bx, 10
je    end
add bx, 1

syscall

jmp myloop



end:

mov rax, 60
mov rdi, 0
syscall

It prints "looooops iz funnz" 10 times.
If you want to know what any part does, just ask.

Good work. A basic understanding of assembler will pay off big time in all your programming endeavors...Pay special attention to function calls and how they work in assembler...G4143
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: