This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
programming:assembly:assembly_programming [2021/03/21 07:51] nanodano [Create an executable] |
programming:assembly:assembly_programming [2021/03/22 02:22] (current) nanodano ↷ Page name changed from programming:assembly:home to programming:assembly:assembly_programming |
||
---|---|---|---|
Line 3: | Line 3: | ||
====== Assembly Programming ====== | ====== Assembly Programming ====== | ||
+ | Assembly is about as close as you can get to machine code. | ||
There are many Assembly compilers out there. '' | There are many Assembly compilers out there. '' | ||
Line 8: | Line 9: | ||
Use interrupt '' | Use interrupt '' | ||
- | For a list of system calls in Linux, refer to [[https:// | + | For a list of system calls in Linux, |
Here is an example of compiling with '' | Here is an example of compiling with '' | ||
Line 47: | Line 48: | ||
int 80h ; call the kernel | int 80h ; call the kernel | ||
+ | </ | ||
+ | |||
+ | Compile and run with: | ||
+ | |||
+ | <code bash> | ||
+ | # Compile | ||
+ | nasm -f elf64 hello.asm -o hello.o | ||
+ | |||
+ | # Link | ||
+ | ld hello.o -o hello | ||
+ | |||
+ | # Run | ||
+ | ./hello | ||
</ | </ | ||
===== x86 on DOS ===== | ===== x86 on DOS ===== | ||
Line 137: | Line 151: | ||
<code c example.c> | <code c example.c> | ||
/* example.c */ | /* example.c */ | ||
+ | /* Compile and run with `gcc example.c say_hi.o -o hello` */ | ||
#include < | #include < | ||