DEV Community

Discussion on: "Hello, World!" but in 30 different languages!!!

Collapse
 
nexwebsites profile image
NexWebSites

;Don't forget Assembly Language:
section .text
global _start

_start:

mov edx, len

mov ecx, msg

mov ebx, 1

mov eax, 4

int 0x80

mov eax, 1

int 0x80

section .data
msg db 'Hello, world!',0xa
len equ $ - msg

Collapse
 
jmcp profile image
James McPherson

For completeness one should mention that this example is x86 assembler (not even amd64!), and for extra credit how about ARMv7, SPARC and POWER versions too? :p

Collapse
 
nexwebsites profile image
NexWebSites • Edited

Yes, thought it would be better to start with the basics.

global _start
section .text
_start:
mov rdi,1

mov rsi,hello_world

mov rdx,hello_world_size

mov rax,1

syscall
mov rdi,0

mov rax,60

syscall

hello_world: db "Hello, world!",10
hello_world_size EQU $ - hello_world

Thread Thread
 
nexwebsites profile image
NexWebSites • Edited

How about one for Windows 64?

Window 64 bit Assembly
extrn ExitProcess: PROC
extrn MessageBoxA: PROC

.data
caption db 'Windows 64-bit hello!', 0
message db 'Hello, world!', 0

.code

Start PROC
sub rsp,28h

mov rcx, 0

lea rdx, message
lea r8, caption
mov r9d, 0

call MessageBoxA
mov ecx, eax

call ExitProcess
Start ENDP
End