As all of you, I've been drawn to develop my own operating system and I'm having a lot of fun
But I've a problem with the loading from the floppy that I was unable to solve. My kernel is loaded from the floppy using the int 0x13 call.
Here is the code I'm using to load the kernel into memory in my bootloader:
Code: Select all
xor ax, ax
xor ah, ah
mov dl, 0
int 0x13
jc reset_failed
KERNEL_BASE equ 0x100 ; 0x0100:0x0 = 0x1000
sectors equ 0x30 ; sectors to read
mov ax, KERNEL_BASE
mov es, ax
xor bx, bx
mov ah, 0x2 ; Read sectors from memory
mov al, sectors ; Number of sectors to read
xor ch, ch ; Cylinder 0
mov cl, 2 ; Sector 2
xor dh, dh ; Head 0
mov dl, 0 ; Drive
int 0x13
jc read_failed
cmp al, sectors
jne read_failed
jmp dword KERNEL_BASE:0x0
Code: Select all
sectors equ 0x40 ; sectors to read
Bochs logs these two lines:
And nothing else happens. The data on the floppy remains exactly the same and there is no LOCK prefix in it.00076015894i[CPU0 ] LOCK prefix unallowed (op1=0x53, modrm=0x00)
00076015898i[CPU0 ] LOCK prefix unallowed (op1=0x53, modrm=0x00)
I suppose that's because I'm trying to read too many sectors at once and it just fails at some point. So, what is a good method to read many sectors from the floppy ? Do I have to read sectors one by one using something like a lba to chs function ?
Thank you