[SOLVED] Int 0x13 doesn't want to load up my kernel, strange

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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.
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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).
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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.
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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.
=D>

The BIOS list the USB device as diskette in my BIOS.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Int 0x13 doesn't want to load up my kernel, strange

Post by Klakap »

Great! :D You can edit thread title to [solved]. Just for interest, is it working with BPB as zero, or you write your own BPB?
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

Re: Int 0x13 doesn't want to load up my kernel, strange

Post by Rukog »

Klakap wrote:Great! :D 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.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: [SOLVED] Int 0x13 doesn't want to load up my kernel, str

Post 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.
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

Re: [SOLVED] Int 0x13 doesn't want to load up my kernel, str

Post 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.
Image
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Int 0x13 doesn't want to load up my kernel, strange

Post 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.
Post Reply