Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Looks straightforward, what's terrible about it?
It's equivalent to the c code
#include <unistd.h>
int main() {
write(1, "Hello, world!", 14);
exit();
} -
luxe0115654y@Root I'm used to Julia and Java which take only one line so learning assembly it killing me
-
that’s how assembly is. It’s the nature of the language to take more steps. What’s simple and mindless to do in high level languages is more complicated in assembly bc you’re getting more control over the hardware. There’s nothing terrible about that code bc it’s probably the best way to print hello world with what you have. Assembly is still widely used in certain programs that need to touch the guts.
Related Rants
-
TCPizza28assignment: use winAPI to create a "virus" that put itself in autorun and does nothing. me, a curious student...
-
mcminnra10"Python is such a hard language. It has so many rules" - Undergraduate Student who sent out mass email to the ...
-
arch-chroot2Boss: For next project I suggest we use webassembly Me: Why not use real assembly
```
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 ;string to be printed
len equ $ - msg ;length of the string
```
I've never seen such a terrible way to print "hello world"
rant
assembly