Page 1 of 2
Read Floppy sector
Posted: Thu Sep 15, 2005 2:54 pm
by Cjmovie
How would you read floppy sectors at the 1MB mark or above?
I've enable UnReal mode (So I have 32-bit data segment). But how to tell BIOS?
I've tried looking through some example kernels, etc, but to no avail.
Re:Read Floppy sector
Posted: Thu Sep 15, 2005 3:01 pm
by Pype.Clicker
As explained
in the FAQ, you cannot tell the BIOS to load directly above 1MB. You need to load sectors in a temp. location and _then_ move the data above 1MB manually.
Re:Read Floppy sector
Posted: Thu Sep 15, 2005 3:30 pm
by Cjmovie
Woah, no wonder I couldn't pick anything up from those example kernels
.
Thanks for the Quick reply, it comes in handy.
Re:Read Floppy sector
Posted: Fri Sep 16, 2005 1:15 am
by Candy
Pype.Clicker wrote:
As explained
in the FAQ, you cannot tell the BIOS to load directly above 1MB. You need to load sectors in a temp. location and _then_ move the data above 1MB manually.
Are you sure that also applies with int13 extensions (ah=0x42)? I thought they specifically could do that...
Re:Read Floppy sector
Posted: Fri Sep 16, 2005 1:49 am
by Brendan
Hi,
Candy wrote:Are you sure that also applies with int13 extensions (ah=0x42)? I thought they specifically could do that...
According to:
http://www.ctyme.com/intr/rb-0708.htm
They can load to any 32 bit physical address (or 64 bit physical address for EDD 3.0)....
But
According to:
http://www.ctyme.com/intr/rb-0706.htm
The Int 13h extensions only apply to drive numbers from 0x80 to 0xFF, which doesn't include floppies.
For hard drives the ATA controller can use bus mastering to read the data where you want it without any problems, but for floppies this isn't the case - the BIOS would need to use protected mode (in some form) and a buffer below 1 MB, just like us. I guess some BIOS's might actually implement this, but I wouldn't rely on it.
I could be wrong though - I've never used Int 13h extensions because I'd need to support the normal BIOS and unreal mode method in case int13 extensions aren't supported (old computers), and I haven't done a hard disk boot sector for many years.
Cheers,
Brendan
Re:Read Floppy sector
Posted: Sat Sep 17, 2005 11:11 am
by Cjmovie
Hmm, I'm having a bit of trouble with my code. (I don't have exact code with me, but I remember what I did).
It works to copy 512bytes from 1 <1mb location to another <1mb location, but not >1mb locations.
It sets up real mode just like in BabySteps 7, (with the exception of a GDT from another UnReal mode tutorial). That is, load GDT, enter PMODE, set DS, exit pmode.
I load it like this:
Any ideas? When I try to load >1mb, it doesn't crash, but instead freezes BOCH's.
Re:Read Floppy sector
Posted: Sat Sep 17, 2005 12:08 pm
by Kemp
Have you enabled the A20 line? Even with unreal mode you can't access addresses >1Mb without that enabled.
Re:Read Floppy sector
Posted: Sat Sep 17, 2005 3:53 pm
by Cjmovie
I thought the BIOS of Bochs defaulted to the Super IO chip, that is, it enabled it for you?
I know I have the A20 auto-enable, well, enabled, on my computer. It's in the BIOS I've got for it.
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 5:22 am
by Dex4u
I read some where that Bochs does not support unreal-mode properly
.
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 6:05 am
by Brendan
Hi,
Dex4u wrote:
I read some where that Bochs does not support unreal-mode properly
.
Where? I've never had any problems...
Cheers,
Brendan
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 6:29 am
by Dex4u
http://board.flatassembler.net/topic.ph ... c&start=50
go to the post by Tomasz Grysztar (the creator of fasm).
This may of changed now, but that where i read it.
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 6:59 am
by Kemp
I would be useful if he gave any reasons or sources or anything at all to back up what he said rather than just "it doesn't work"...
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 11:45 am
by Cjmovie
Hmm...Out of curiosity, is it possible that BOCHS only auto-enables A20 while the PM bit is set in CR0? Meaning I would have to enable A20 myself anyways?
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 12:39 pm
by DynatOS
From what I have seen personally, amongst many forums and especially with recent releases, almost anyone who can't get their primitive OS structure to work on bochs are simply misguided in how the computer is suppose to work and/or how they are suppose to implement their ideas through programming. Keep reading CPU/programming documentation and keep trying and you will surely get things to work
[rant]
Thomasz isn't the end-all ultimate resource for OS development information, especially when he doesn't supply any proof of concept code to back his claims up. Personally I don't think he would be willing to supply the code to prove this (if any actually exists) since someone will most likely find a simple logic error and it might make him seem less of a genius to his FASM followers.
I am sorry if I seem very opinionated about this and about Tomasz Grysztar, but nothing annoys me more than people who (ab)use their position to spew out personal opinions over implicit facts. I have to deal with such nonsense from Steve Hutchesson, the MASM32 package maintainer and frequenter of the
Win32ASM Community Forums that I help maintain, from time to time and the BS can get rather thick.
I am humbled at the work that Tomasz has done with FASM and the work that Steve has done with MASM32, but their work and their position simply do not justify their "I said so, so it must be true" attitude in my book. Bring the facts, or keep your mouth shut
[/rant]
Please continue with the topic at hand, I just thought I needed to say that so rumors and opinions do not win any attention over fact and truth
Re:Read Floppy sector
Posted: Sun Sep 18, 2005 12:54 pm
by bubach
(ab)use their position? comment like that (without any evidence) is made everywhere, all the time.
followers? sounds like you are describing some sect..