Results 1 to 3 of 3
I wrote this code and i dont know why only write a 1, it's in intel syntax:
It assemble and link ok but, then only write 1 character:
Code:
section ...
- 12-25-2009 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 2
assembly nasm
I wrote this code and i dont know why only write a 1, it's in intel syntax:
It assemble and link ok but, then only write 1 character:
I would be pleased if any1 could help meCode:section .data vacio db "0", 0ah, 0 activo db "1", 0ah, 0 numero dq 01010101b section .text global main main: xor rax, rax xor ecx, ecx mov rcx, 1 mov rax, 8 push rax push rcx princ: pop rcx pop rax dec rax cmp rax, 0 push rax jz exit mov rax, numero and rax, rcx add rcx, rcx push rcx cmp rax, 0 jz escribe0 jnz escribe1 escribe1: mov rax, 4 mov rbx, 1 mov rcx, activo mov rdx, 2 int 0x80 jmp princ escribe0: mov rax, 4 mov rbx, 1 mov rcx, vacio mov rdx, 2 int 0x80 jmp princ exit: mov rax, 1 int 0x80
- 12-25-2009 #2
I'm not really comfortable with nasm style but I still have a few questions..
Why do you do this:
You clear registers rax and ecx? Are you writing 32 bit or 64 bit. Plus clearing the registers rax and ecx then moving 1 and 8 to them is redundant and then pushing rax and rcx is again redundant. Just push 1 and 8 onto the stack..Code:xor rax, rax xor ecx, ecx mov rcx, 1 mov rax, 8 push rax push rcx
And what is the role of
I can't see any reason for this variable...I guess what I'm getting at is, what's the logic of your program? What does it do?Code:numero dq 01010101b
Make mine Arch Linux
- 12-25-2009 #3Just Joined!
- Join Date
- Dec 2009
- Posts
- 2
Sorry the code works perfectly, the problem was i was running other app XDDDDDDDDDDDDDDDDD
TY for the answers so


Reply With Quote