+ 1
Coding in x86 asm
I want to create my own os And i want to try It in x86 asm but first i need to learn x86 asm does anybody know where to go to learn It
4 ответов
+ 1
Nobody builds operating system using ASM anymore. You write it in C or C++. Linux was written in C. If you are going to write your own OS, consider starting by studying the Linux source code.
Coding your own OS in ASM is a little like saying, I want to build my own car and I want to smelt my own iron. It can be done, but it doesn't make sense.
+ 1
Sure! Check out "Programming from the Ground Up" and osdev.org for x86 assembly learning.
section .data
msg db 'Hello, x86 Assembly!', 0
section .text
global _start
_start:
; Print message
mov eax, 4 ; syscall number for sys_write
mov ebx, 1 ; file descriptor (1 = stdout)
mov ecx, msg ; pointer to the message
mov edx, 20 ; length of the message
int 0x80 ; interrupt to invoke system call
; Exit
mov eax, 1 ; syscall number for sys_exit
xor ebx, ebx ; return code 0
int 0x80 ; interrupt to exit
0
I agree with Jerry Hobby. The C compiler can optimize the assembler code better than a human, almost always!
Studying assembler output from the C compiler is a good way to learn ASM.
0
Why do you want to solve both these _complex_ tasks (creating an OS and learning asm) in a single go, provided that you have no knowledge in either of these fields?
I understand, it could be a cool project and you'll learn a lot in the end, but you _really_ need to assess your capabilities before diving into it. Maybe is better to start learning asm (x86 version as you like, because there are tons of different assemblers in the world) on some simple projects and then turn to writing as OS?