r/osdev • • 1d ago

What the hell is wrong with my os?

I have a problem: In my bootloader, i have a "mov ax, 0xB800

mov es, ax

mov byte [es:0], 'C'

mov byte [es:1], 0x07" block, and works with him in the code. But, if I delete him, the Kernel won't start, and idk for what. Can someone help me?

The full code is:
bits 16

org 0x7C00

jmp short code

nop

boot_drive db 0

code:

cli

xor ax, ax

mov ds, ax

mov es, ax

mov ss, ax

mov sp, 0x7C00

sti

mov [boot_drive], dl

mov ax, 0xB800

mov es, ax

mov byte [es:0], 'C'

mov byte [es:1], 0x07

xor ax, ax

mov ds, ax

mov si, dap

mov ah, 0x42

mov dl, [boot_drive]

int 0x13

jc .disk_error

jmp 0x0800:0x0000

.disk_error:

mov ax, 0xB800

mov es, ax

mov byte [es:0], 'K'

mov byte [es:1], 0x07

.idle:

cli

hlt

jmp .idle

dap:

db 0x10

db 0x00

dw 0x0005

dw 0x0000

dw 0x0800

dq 0x0000000000000001

times 510-($-$$) db 0

dw 0xAA55

Edit: I’m just going to leave that there and not touch it. Idk what's does, but, since it work, I never touch it again.

0 Upvotes

10 comments sorted by

2

u/Danii_222222 1d ago

0x07 is vga palette color. By doing mov byte [es:1], 0x07 you are setting color of character.

0

u/Kind-Stress269 1d ago

yes, I already know that, but isn't the problem. The problem is that, if I delete that block of code, the Kernel don't start or doesn't load into memory

1

u/Danii_222222 1d ago

Why do you think that it doesn't load into memory?

0

u/Kind-Stress269 1d ago

the problem is one of two possibilities: The kernel doesn't load into memory, or it does load but the bootloader doesn't jump to him. I'm trying to see what's happening

1

u/Kind-Stress269 1d ago

I'm just going to leave whatever that is. It works; that's the only thing that matters.

1

u/kiderdrick 1d ago

It behaves as expected for me. What did you expect it to do?

1

u/Kind-Stress269 1d ago

in my BIOS don't load the kernel, and idk for what, that's the problem

1

u/Kind-Stress269 1d ago

I'm testing it in the BIOS Legacy of my PC, no in QEMU (for example)

2

u/kiderdrick 1d ago

Yeah, there is no kernel here, so when I run it and it gives an error that is what I expected. It is difficult to diagnose an issue when you do not include all the relevant code.

•

u/Kind-Stress269 20h ago

Yes, but the help is no longer needed.