 |
 |
 |
 |
| Programming & Packaging A place to discuss programming and packaging. |

6th August 2009, 06:53 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Location: India
Posts: 26

|
|
|
learning assembly language on fedora 10
hi...
I m trying to learn assembly language. i have intel processor . please suggest e some good books of intel instruction set and also want to know that how to run assemble prog from terminal..
thanks in advance.
|

6th August 2009, 12:25 PM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 742

|
|
|
|

6th August 2009, 12:40 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
You can also run assembler code directly from C, here's an a post which uses an example from Linus Torvalds demonstrating the performance of the cmov instruction (bad on out-of-order processors (most modern ones are), good on in-order processors like the intel atom)
http://forums.fedoraforum.org/showpo...29&postcount=6
|

6th August 2009, 02:05 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Location: India
Posts: 26

|
|
|
thank you for your time and advice..but i m still not satisified with the ans..
|

6th August 2009, 03:51 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
Use 'as' and 'ld' from the binutils package
Code:
# hello.s
.section .data
hello:
.ascii "Hello, world!\n"
hello_len:
.long . - hello
.section .text
.globl _start
_start:
## display string using write () system call
xorl %ebx, %ebx # %ebx = 0
movl $4, %eax # write () system call
xorl %ebx, %ebx # %ebx = 0
incl %ebx # %ebx = 1, fd = stdout
leal hello, %ecx # %ecx ---> hello
movl hello_len, %edx # %edx = count
int $0x80 # execute write () system call
## terminate program via _exit () system call
xorl %eax, %eax # %eax = 0
incl %eax # %eax = 1 system call _exit ()
xorl %ebx, %ebx # %ebx = 0 normal program return code
int $0x80 # execute system call _exit ()
Code:
$ as -o hello.o hello.s
$ ld -o hello -O0 hello.o
Code:
$ ./hello
Hello, world!
(use 'objdump -d hello' to check the assembly code is correct)
http://database.sarang.net/study/lin.../linux-asm.txt
This link should satisfy you http://tinyurl.com/n4sop5
|

7th August 2009, 08:48 PM
|
|
Registered User
|
|
Join Date: May 2009
Location: Nor Cali
Posts: 67

|
|
Quote:
Originally Posted by Gödel
Use 'as' and 'ld' from the binutils package
Code:
# hello.s
.section .data
hello:
.ascii "Hello, world!\n"
hello_len:
.long . - hello
.section .text
.globl _start
_start:
## display string using write () system call
xorl %ebx, %ebx # %ebx = 0
movl $4, %eax # write () system call
xorl %ebx, %ebx # %ebx = 0
incl %ebx # %ebx = 1, fd = stdout
leal hello, %ecx # %ecx ---> hello
movl hello_len, %edx # %edx = count
int $0x80 # execute write () system call
## terminate program via _exit () system call
xorl %eax, %eax # %eax = 0
incl %eax # %eax = 1 system call _exit ()
xorl %ebx, %ebx # %ebx = 0 normal program return code
int $0x80 # execute system call _exit ()
Code:
$ as -o hello.o hello.s
$ ld -o hello -O0 hello.o
Code:
$ ./hello
Hello, world!
(use 'objdump -d hello' to check the assembly code is correct)
http://database.sarang.net/study/lin.../linux-asm.txt
This link should satisfy you http://tinyurl.com/n4sop5
|
use this....for doing it in a C program. usually ya need to add some commands to the makefile, which depends on what you do in the assembly. Otherwise just make it a <name>.S. which is the usual way assembly programs are labeled in linux. though some times you get funcy names form windows
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 16:33 (Monday, 20-05-2013)
|
|
 |
 |
 |
 |
|
|