Setting code register
Posted: Sat Oct 08, 2022 1:02 pm
Hey all,
I am writing my first bootloader and going through some tutorials and can't really figure out the answer.
Some tutorials do that:
I totally understand why it is important to initialize the data and extra segment.
Why is the first jmp also initializes the code segment?
I guess that IPC begins to run from the beginning of the code segment, along the code segment, so it'll be set as a result of setting the code segment register.
I am writing my first bootloader and going through some tutorials and can't really figure out the answer.
Some tutorials do that:
Code: Select all
[ORG 0]
jmp 07C0h:start ; Goto segment 07C0
start:
; Update the segment registers
mov ax, cs
mov ds, ax
mov es, ax
Why is the first jmp also initializes the code segment?
I guess that IPC begins to run from the beginning of the code segment, along the code segment, so it'll be set as a result of setting the code segment register.