Read Floppy sector

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.
Cjmovie

Read Floppy sector

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Read Floppy sector

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

Re:Read Floppy sector

Post by Cjmovie »

Woah, no wonder I couldn't pick anything up from those example kernels :).

Thanks for the Quick reply, it comes in handy.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Read Floppy sector

Post 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...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Read Floppy sector

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Cjmovie

Re:Read Floppy sector

Post 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:

Code: Select all

mov cx, [DS:EAX]
mov [DS:EBX], cx
Any ideas? When I try to load >1mb, it doesn't crash, but instead freezes BOCH's.
Kemp

Re:Read Floppy sector

Post by Kemp »

Have you enabled the A20 line? Even with unreal mode you can't access addresses >1Mb without that enabled.
Cjmovie

Re:Read Floppy sector

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

Re:Read Floppy sector

Post by Dex4u »

I read some where that Bochs does not support unreal-mode properly :o .
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Read Floppy sector

Post by Brendan »

Hi,
Dex4u wrote: I read some where that Bochs does not support unreal-mode properly :o .
Where? I've never had any problems...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Dex4u

Re:Read Floppy sector

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

Re:Read Floppy sector

Post 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"...
Cjmovie

Re:Read Floppy sector

Post 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?
DynatOS

Re:Read Floppy sector

Post 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 :)
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Read Floppy sector

Post 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..
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply