Name: Anonymous 2010-04-04 21:39
I'm having some problems figuring out how to program in x86_64 assembly. None of the classes I've taken on assembly have ever trained me on modern assembly programming, and I figured it would make me reach satori, so I would like to learn it. I found this code online, and I was trying to get it to work on my ubuntu system.
1.
global _start
2.
3.
section .data
4.
hello db "Hello, World!", 10
5.
length equ $-hello
6.
7.
section .text
8.
9.
_start:
10.
mov eax, 4 ; write to file
11.
mov ebx, 1 ; STDOUT handle
12.
mov ecx, hello ; our message
13.
mov edx, length ; size of message
14.
int 80h ; execute the syscall
15.
16.
xor ebx, ebx ; send 0 as 'exit code'
17.
mov eax, 1 ; terminate process
18.
int 80h ; execute the syscall
When I was linking the object code it gave me an error about how it isn't compatible with my architecture. What is so different about i386 and i386_64 programming?
1.
global _start
2.
3.
section .data
4.
hello db "Hello, World!", 10
5.
length equ $-hello
6.
7.
section .text
8.
9.
_start:
10.
mov eax, 4 ; write to file
11.
mov ebx, 1 ; STDOUT handle
12.
mov ecx, hello ; our message
13.
mov edx, length ; size of message
14.
int 80h ; execute the syscall
15.
16.
xor ebx, ebx ; send 0 as 'exit code'
17.
mov eax, 1 ; terminate process
18.
int 80h ; execute the syscall
When I was linking the object code it gave me an error about how it isn't compatible with my architecture. What is so different about i386 and i386_64 programming?