After adding a large amount of code in my kernel, I was surprised to see that it wouldn't boot anymore. I made some tests, and saw that it would boot only when it takes less than 75 sectors or so, on my floppy disk.
I had this problem once, but managed to get around it by adding a second int 0x13.
Here is my code, what is wrong about it ?
Code: Select all
;; Load Kernel ;;
xor ax, ax
int 0x13
push es
mov ax, 0x200
mov es, ax
mov bx, 0
mov ah, 2
mov al, 72 ;sector num -- max = 72 (2 full cylinders)
mov ch, 0
mov cl, 3
mov dh, 0
mov dl, 0
int 0x13
;; Load Kernel 2 ;;
xor ax, ax
int 0x13
push es
mov ax, 0x1100
mov es, ax
mov bx, 0
mov ah, 2
mov al, 72 ;sectors number
mov ch, 2 ;cylinder num
mov cl, 3 ;sector
mov dh, 0 ;head
mov dl, 0
int 0x13
I want my kernel at 0x2000, that's why I have es:bx equal 0x200:0x0. I begin to read at sector 3, because the first ones are my bootloader and stage2. (this code is from my stage 2).
In my second read, I juste have to add 2 to the cylinder index, since 72 sectors = 2 cylinders. Also, the es:bx is now 0x1100:0, because 72 sectors is 0x9000 bytes (512 bytes per sector * 18 sectors per track * 2 heads per cylinder * 2 cylinder).
Any idea ? Thanks.