wammder wrote:Hello,
I have started to read courses / articles about OS devlopment and I do not understand a choice in bootloader dev.
The bootloader must be placed at address 0x7C00, ok. And in severals articles they do :
Code: Select all
[BITS 16]
[ORG 0x0]
mov ax, 0x07C0
mov ds, ax
mov es, ax
There is a reason to choose ds and es registers ? Or is it possible to use the cs register for instance ?
I am not an asm expert, I have the basics, but I try to get the right way.
Really thank you
You should learn x86 assembly language before even stepping into OS development. Learn user space first. Write some programs in your operating system (Windows or Linux for example).
You might also want to learn C.
The link below is the Intel Manual and should help you get started. The 10 volume set manuals would be good. Start reading a little bit of basic architecture. If you need help on instructions, use the instruction set reference and find the instruction (Control+F or Command+F will help).
You should be familiar with memory addresses. Little endian means starting from the least significant byte.
For example, 0xAABBCCDD (a made up memory address) is big endian and 0xDDCCBBAA is little endian. It's reversing the bytes around.
The most significant byte would be 0xAA and the least would be 0xDD.
Little endian is used in memory.
When you read Basic Architecture, the most important sections are around 3.1 and 3.4.
1.3 is also very important (apart from 1.3.5, that might confuse beginners).
https://software.intel.com/en-us/articles/intel-sdm
If you want to learn about BIOS interrupts, learn DOS Assembly. Please be warned that 16-bit mode (Real Mode) has many limitations. BIOS interrupts are deprecated. Learn with it, then get away from it.
You may also want to check out
Ralf Brown's Interrupt List.
Learn about registers, segments, instructions and the environment of x86.
You don't need to understand everything but here
Instructions to look at would be
MOV (essential, the most used instruction)
ADD (adding numbers. can be useful)
INC (short for using ADD to add 1 to a register, increment by 1)
DEC (decrement by 1)
SUB
DIV
STOSB (very useful, stores byte from AL to SI).
LODSB (very useful as well, reads byte from SI to AL)
INT (interrupt)
You might like to read Section 6 of Basic Architecture as well.