LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-29-2017, 09:49 AM   #1
Fractal Cat
LQ Newbie
 
Registered: Jul 2017
Posts: 8

Rep: Reputation: Disabled
Assembly language Hello World not working


Hi,

I have been using the SASM assembly language editor for a couple of days now and I've found a number of programs on the net to display a Hello World message. I have tried a number of these and none of them output anything at all. Below is an example of the code I've found :

.intel_syntax noprefix

.bss

.data

msg:
.asciz "Hello, world!\n\r"
.equ len, 15

.text

.global _start

_start:
push rbp
mov ebp,esp
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
pop rbp
mov eax,1
int 0x80
.end

Another thing I want is to output all files, source, object files and so on to the same folder when assembling. How do I do this, because when the object file is assembled it outputs to the folder /tmp/SASM and not my folder ?

Thanks

FC.
 
Old 07-29-2017, 12:33 PM   #2
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,638

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
here is a show me

Hello, world!


SASM: The Simple Assembler
Reference Manual


In care of google.

that is all I know about it , sorry

Last edited by BW-userx; 07-29-2017 at 12:37 PM.
 
Old 07-31-2017, 10:05 AM   #3
Fractal Cat
LQ Newbie
 
Registered: Jul 2017
Posts: 8

Original Poster
Rep: Reputation: Disabled
Sorted

Hi,

After much hair pulling concerning this problem I thought I would try the NASM assembler instead of the GCC
assembler and the programs work, albeit with a little bit of tweaking. So I will continue using NASM when writing assembly language coding in Linux.

FC.
 
Old 07-31-2017, 10:29 AM   #4
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,638

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by Fractal Cat View Post
Hi,

After much hair pulling concerning this problem I thought I would try the NASM assembler instead of the GCC
assembler and the programs work, albeit with a little bit of tweaking. So I will continue using NASM when writing assembly language coding in Linux.

FC.


pls - mark solved. cheers!
 
Old 08-09-2017, 10:21 AM   #5
Fat_Elvis
Member
 
Registered: Oct 2016
Posts: 146

Rep: Reputation: 35
For 64 bit, you might want syscall, instead of int 0x80.

Code:
	movq	$1, %rax		# syscall: write.
	movq	$1, %rdi		# File descriptor: stdout.
	movq	$msg, %rsi	# String pointer.
	movq	$0x0E, %rdx	# String length.

	syscall

	movq	$0x3C, %rax	# syscall: exit.
	movq	$0, %rbx		# Return value.

	syscall

Last edited by Fat_Elvis; 08-09-2017 at 10:23 AM.
 
Old 08-10-2017, 07:52 AM   #6
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 996
Blog Entries: 11

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
You don't really need an OS, just <446 bytes in the boot sector
https://www.google.com/search?q=bios+hello+world Wiki is your friend!
Now, that's what I'd enjoy doing
 
Old 08-10-2017, 09:22 AM   #7
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,638

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by Jjanel View Post
You don't really need an OS, just <446 bytes in the boot sector
https://www.google.com/search?q=bios+hello+world Wiki is your friend!
Now, that's what I'd enjoy doing
Writing Hello World Bootloader interesting.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A problem. When using assembly language to call the C language function mirage1993 Programming 3 10-03-2014 08:15 AM
Assembly Language ashish anand Programming 9 10-18-2011 10:53 PM
assembly language ramorous24 Programming 4 08-21-2011 11:31 PM
Is Assembly Language considered a Structured Language? theKbStockpiler Programming 4 01-30-2011 09:09 AM
assembly language directives ashlesha Programming 2 07-03-2006 09:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration