4 Replies - 328 Views - Last Post: 16 September 2017 - 12:38 AM

#1 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Hello world in different assembler's ?

Posted 15 September 2017 - 09:51 PM

Is this how you write the assembly language code in assemblers like

NASM
FASM
SASM

Posted Image

Or is it different for different assemblers ?
Is This A Good Question/Topic? 0
  • +

Replies To: Hello world in different assembler's ?

#2 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6380
  • View blog
  • Posts: 25,775
  • Joined: 12-December 12

Re: Hello world in different assembler's ?

Posted 15 September 2017 - 11:55 PM

Please paste the code directly here, between code tags, not just as a screenshot that will probably disappear at some point.
Was This Post Helpful? 0
  • +
  • -

#3 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: Hello world in different assembler's ?

Posted 16 September 2017 - 12:20 AM

Ok , i am trying to understand the difference between these two codes .

section	.text
	global _start       ;must be declared for using gcc
_start:                     ;tell linker entry point
	mov	edx, len    ;message length
	mov	ecx, msg    ;message to write
	mov	ebx, 1	    ;file descriptor (stdout)
	mov	eax, 4	    ;system call number (sys_write)
	int	0x80        ;call kernel
	mov	eax, 1	    ;system call number (sys_exit)
	int	0x80        ;call kernel

section	.data

msg	db	'Hello, world!',0xa	;our dear string
len	equ	$ - msg			;length of our dear string



%include "io64.inc"

      section .data
hello   db "Hello World!",0xa
len equ $-hello

    section .text
    global  CMAIN

CMAIN:
    mov eax, 4
    mov ebx, 1
    mov ecx, hello
    mov edx, len
    int 80h

    mov eax, 1 ; exit(0)
    mov ebx, 0
    int 80h 

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6380
  • View blog
  • Posts: 25,775
  • Joined: 12-December 12

Re: Hello world in different assembler's ?

Posted 16 September 2017 - 12:35 AM

That's a different question (although your first post didn't present a question anyway).

The first code has comments, so this should make it much easier to compare to the second (assuming they both do the same thing).

What is your specific question? Just "i am trying to understand the difference between these two codes" is a statement, not a question.
Was This Post Helpful? 0
  • +
  • -

#5 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: Hello world in different assembler's ?

Posted 16 September 2017 - 12:38 AM

What is this ?

%include "io64.inc"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1