Hi,
I'm using inline ASM in C, and I'm wondering how I can get the variable 'test' to contain a whole sector from a floppy disk.
Any ideas?
Jonny
Sector reading in ASM with C
-
- Member
- Posts: 144
- Joined: Tue Oct 26, 2004 11:00 pm
- Location: Australia
Re: Sector reading in ASM with C
1. Make 'test' an array of 512 bytes.
2. Load the sector into the address of 'test'
3. Voila
If you want the memory address to be mapped to the sector on the disk and updated with reads/writes...that's way too complicated for your every day homebrew os :-p
2. Load the sector into the address of 'test'
3. Voila
If you want the memory address to be mapped to the sector on the disk and updated with reads/writes...that's way too complicated for your every day homebrew os :-p
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
--- Albert Einstein
Re: Sector reading in ASM with C
Thanks, but umm, I need to know how to actually read a sector
Jonny
Jonny
-
- Member
- Posts: 144
- Joined: Tue Oct 26, 2004 11:00 pm
- Location: Australia
Re: Sector reading in ASM with C
Ok well that's a different question alltogether.
It depends on whether you are running in real-mode or protected-mode.
In real mode this is as easy as using the BIOS. However when you do this you loose the ability to switch to a different task while the disk is being read.
For this and for protected-mode it is recommended that you access the disk hardware directly. There is plenty of sample code available, and intels documentation on their floppy disk controller is pretty good.
I can't refer you to any links...I'm posting from work
Anyone else know anywhere you can find manuals/references/code?
Adam
It depends on whether you are running in real-mode or protected-mode.
In real mode this is as easy as using the BIOS. However when you do this you loose the ability to switch to a different task while the disk is being read.
For this and for protected-mode it is recommended that you access the disk hardware directly. There is plenty of sample code available, and intels documentation on their floppy disk controller is pretty good.
I can't refer you to any links...I'm posting from work
Anyone else know anywhere you can find manuals/references/code?
Adam
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
--- Albert Einstein
Re: Sector reading in ASM with C
try http://www.osdever.net/cottontail/
it has almost everything one would need.
it has almost everything one would need.