Fedora Linux Support Community & Resources Center
  #1  
Old 6th August 2009, 06:53 AM
User101 Offline
Registered User
 
Join Date: Jun 2009
Location: India
Posts: 26
linuxfedorafirefox
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.
Reply With Quote
  #2  
Old 6th August 2009, 12:25 PM
mmix Offline
Registered User
 
Join Date: Aug 2009
Posts: 741
linuxfedorafirefox
http://software.intel.com/en-us/arti...ment-emulator/

HTH
Reply With Quote
  #3  
Old 6th August 2009, 12:40 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
windows_vistafirefox
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
Reply With Quote
  #4  
Old 6th August 2009, 02:05 PM
User101 Offline
Registered User
 
Join Date: Jun 2009
Location: India
Posts: 26
linuxfedorafirefox
thank you for your time and advice..but i m still not satisified with the ans..
Reply With Quote
  #5  
Old 6th August 2009, 03:51 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
windows_xp_2003ie
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
Reply With Quote
  #6  
Old 7th August 2009, 08:48 PM
trekkie690 Offline
Registered User
 
Join Date: May 2009
Location: Nor Cali
Posts: 67
linuxfedorafirefox
Quote:
Originally Posted by Gödel View Post
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
Reply With Quote
Reply

Tags
assembly, fedora, language, learning

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assembly language ? converting ascii to decmial matt123 Programming & Packaging 3 27th April 2009 07:10 AM


Current GMT-time: 06:20 (Saturday, 18-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat