i have installed nasm in ubuntu in linux but dont know how to and where to write code of assembly language and run my code please give me information as soon as possible.

Recommended Answers

All 9 Replies

You write your code in the text editor of your choice, then pass the text file to NASM for assembly.

i have installed nasm in ubuntu in linux but dont know how to and where to write code of assembly language and run my code please give me information as soon as possible.

Using the menu at the top of the screen, go to Applications > Accessories and select "Text Editor" -- when it appears, type this there:

global _start

section .data
	hello	db	"Hello, World!", 10
	length	equ	$-hello

section .text

_start:
	mov eax, 4		; write to file
	mov ebx, 1		; STDOUT handle
	mov ecx, hello	; our message
	mov edx, length	; size of message
	int 80h			; execute the syscall

	xor ebx, ebx		; send 0 as 'exit code'
	mov eax, 1		; terminate process
	int 80h			; execute the syscall

Save that as "helloworld.asm" into your home directory (the one with *your* name on it).

Then, go back to Applications > Accessories and select "Terminal" and type the following:

nasm -f elf helloworld.asm
ld -o helloworld helloworld.o
./helloworld

You can always type "man nasm" for more help.

thank you evinbit for information about nasm in ubuntu

your post reached Hong Kong. Thank you very much, Well, i wonder if you also know how to do this with xSPIM, i had it installed but remain clueless.

thanks dear.
then what about when we use assembly in PIC Programming ?

First off, please do not post new requests into old threads like this. This thread was originally posted more than half a decade ago; some of the details are now out of data (though fortunately the jist of it hasn't changed), and if nothing else it is problematic if you are adding new questions to solved threads. Please create new threads of your own in the future.

As for the question, the basic answer is the same: you can use any text editor of your choice to write the code in. Assuming you are using Ubuntu Linux, and specifically the latest version, you would again probably use gedit (which is technically a GNOME program, but can be run under Unity as well), though you are free to use any editor that produces unformatted text documents.

For assembling the PIC code, there is a full suite of GNU utilities for this, but I don't personally know much about them.

your post passed on Brazil! Thanks a lot!
BTW! do you have mor info about Nasm in x64?

TKS!

Jean_3, did you read the post just above yours?

First off, please do not post new requests into old threads like this. This thread was originally posted more than half a decade ago; some of the details are now out of data (though fortunately the jist of it hasn't changed), and if nothing else it is problematic if you are adding new questions to solved threads. Please create new threads of your own in the future.

thanx, a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.