Page 2 of 2
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 9:16 am
by Rukog
Klakap wrote:Can you figure out if dl on non-working computers is 0x00 or 0x80?
It's exact, the working PC has DL = 0x80 and same for QEMU
The others have 0x00
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 9:39 am
by Klakap
Well, this is also exact situation. DL=0x00 mean that computer is emulating USB like floppy disk. It happens because you start code with short jmp. Your computers are assuming that you have written BPB, because it also start with short jump. So BIOS read values from BPB - in this case from your code and it is why it do not work - BIOS is initalized with wrong values. Try to remove jmp from start of your code and read if dl value changed from 0x00 to 0x80. DL=0x80 mean that USB is emulates as hard disk and it is what we want.
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 10:10 am
by Rukog
Klakap wrote:Well, this is also exact situation. DL=0x00 mean that computer is emulating USB like floppy disk. It happens because you start code with short jmp. Your computers are assuming that you have written BPB, because it also start with short jump. So BIOS read values from BPB - in this case from your code and it is why it do not work - BIOS is initalized with wrong values. Try to remove jmp from start of your code and read if dl value changed from 0x00 to 0x80. DL=0x80 mean that USB is emulates as hard disk and it is what we want.
Still DL = 0
Else the fun fact is that when Ive started developing OS, ive done that with laptop only until now and it appears that only laptop's BIOS do not have this floppy protocol but desktop's BIOS do (even recent ones)
My Both desktops do have this floppy issue but not my laptop (another laptop from my first one).
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 10:21 am
by Klakap
My both of my desktop do have this floppy issue
It sounds like problem is lying in BIOS settings. Try to go to BIOS settings and look if you do not have something like USB emulating = Floppy and try to change it on Hard disk. Or if not, try to remain space for BPB:
Code: Select all
jmp Bootloader.Code.Entry
times 0x3E db 0 ;BPB
Or try to write BPB values for yourself.
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 11:28 am
by Rukog
Klakap wrote:My both of my desktop do have this floppy issue
It sounds like problem is lying in BIOS settings. Try to go to BIOS settings and look if you do not have something like USB emulating = Floppy and try to change it on Hard disk. Or if not, try to remain space for BPB:
Code: Select all
jmp Bootloader.Code.Entry
times 0x3E db 0 ;BPB
Or try to write BPB values for yourself.
Perfect, thank you very much and yes there is no setting to turn off the floppy thing.
The BIOS list the USB device as diskette in my BIOS.
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 11:32 am
by Klakap
Great!
You can edit thread title to [solved]. Just for interest, is it working with BPB as zero, or you write your own BPB?
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 11:37 am
by Rukog
Klakap wrote:Great!
You can edit thread title to [solved]. Just for interest, is it working with BPB as zero, or you write your own BPB?
Oof is that a DOS thing ?
https://en.wikipedia.org/wiki/BIOS_parameter_block
Yes it's worked with BPB filled with zero.
Re: [SOLVED] Int 0x13 doesn't want to load up my kernel, str
Posted: Mon Aug 02, 2021 11:45 am
by Klakap
BPB is not only DOS thing, but it is connected with FATxx system, so in this way it was also DOS thing.
Yes it's worked with BPB filled with zero.
Thanks for answer.
And for last tip for future, if BIOS emulate USB like hard disk, you can use int 13h ah=42h for reading your code. It is much more easier than ah=0x2.
Re: [SOLVED] Int 0x13 doesn't want to load up my kernel, str
Posted: Mon Aug 02, 2021 11:51 am
by Rukog
Klakap wrote:
BPB is not only DOS thing, but it is connected with FATxx system, so in this way it was also DOS thing.
Yes it's worked with BPB filled with zero.
Thanks for answer.
And for last tip for future, if BIOS emulate USB like hard disk, you can use int 13h ah=42h for reading your code. It is much more easier than ah=0x2.
Re: Int 0x13 doesn't want to load up my kernel, strange
Posted: Mon Aug 02, 2021 12:58 pm
by MichaelPetch
Klakap wrote:Your computers are assuming that you have written BPB, because it also start with short jump. So BIOS read values from BPB - in this case from your code and it is why it do not work - BIOS is initalized with wrong values. Try to remove jmp from start of your code and read if dl value changed from 0x00 to 0x80.
Some BIOSes don't even check the instruction and blindly assume the BPB is there and just write over the area the BPB would be in when emulating a floppy device.