2 Replies - 780 Views - Last Post: 16 January 2016 - 12:46 PM

#1 mark2131   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-December 15

Assembly Language hello world

Posted 14 December 2015 - 04:48 PM

hi all, im beginner in assembly progrmming and can anyone help me with two same codes hello world

ok when i code in dosbox i write this program

.model small
.stack
.data
message   db "Hello world!", "$"

.code

main   proc
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
main   endp
end main




and this works but when i go to tutorialspoint assembly programming i write same hello world but i get errors this is code


section	.text
   global_start     ;must be declared for linker (ld)
	
_start:	            ;tells 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


This post has been edited by no2pencil: 14 December 2015 - 05:14 PM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Assembly Language hello world

#2 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Re: Assembly Language hello world

Posted 15 December 2015 - 06:51 AM

What errors are you getting?

The code on top is for 16bit DOS. The code on the bottom is for 32bit Linux and will not work on DOS or Windows.
Was This Post Helpful? 0
  • +
  • -

#3 honeyx   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 16-January 16

Re: Assembly Language hello world

Posted 16 January 2016 - 12:46 PM

mov edx,offset a
mov ah,9
int 21h

mov ah,0 
int 21h


a db 'HELLO WORLD$'



The tuturial is linux int 80 H is linux int call

This post has been edited by no2pencil: 16 January 2016 - 12:49 PM
Reason for edit:: Added code tags

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1