All pastes #740149 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-17 18:52 UTC
rendered paste body
=======================================================

/* C++ hello world */
#include<iostream.h>
using namespace std;

int main()
{
   cout << "Hello World" << endl;
   return 0;
}

=======================================================

/* C Hello World */
#include<stdlib.h>

int main()
{
   printf("Hello World\n");
   exit(0);
}

=======================================================

;ASM [NASM] Hello World
;Linux on an Intel x86

section .text			

			
    global _start

_start:

;write our string to stdout

        mov     edx,len
        mov     ecx,msg 
        mov     ebx,1   
        mov     eax,4   
        int     0x80	

;and exit

	mov	ebx,0	
        mov     eax,1   
        int     0x80	

section .data				

msg     db      "Hello, world!",0xa	
len     equ     $ - msg              

=======================================================
;ASM [MASM] Hello World
;DOS on an Intel x86

.model small

.stack 100h

 

.data

message db "Hello World", 13, 10, "$"

 

.code
start:            

  mov   ax, @data
  mov   ds, ax

 

  mov   dx, offset message      ; copy address of message to dx

  mov   ah, 9h                  ; subprogram for string output

  int   21h                     ; call ms-dos to display string

 

  mov   ax, 4c00h

  int   21h

 

end   start