Listing and reading files on a floppy disk

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.
Post Reply
User avatar
sadisoft
Posts: 10
Joined: Sun Nov 16, 2008 11:08 am
Contact:

Listing and reading files on a floppy disk

Post by sadisoft »

How can I list all files on Floppy? And how can I get the text of a file on the floppy with the filename?
User avatar
negcit.K
Member
Member
Posts: 34
Joined: Fri Dec 07, 2007 9:57 am

Re: [TUTORIAL]: How to read (and supposedly write) floppies.

Post by negcit.K »

sadisoft wrote:How can I list all files on Floppy? And how can I get the text of a file on the floppy with the filename?
I think then you need implement a file system.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Listing and reading files on a floppy disk

Post by Combuster »

Split since the topic was about reading the contents of a floppy, not about interpreting that info.

See FAT12 for starters
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Listing and reading files on a floppy disk

Post by System123 »

Text files are like bin files they contain no headers and therefore can be read to the buffer and then printed to screen
Gizmic OS
Currently - Busy with FAT12 driver and VFS
User avatar
sadisoft
Posts: 10
Joined: Sun Nov 16, 2008 11:08 am
Contact:

Re: Listing and reading files on a floppy disk

Post by sadisoft »

Is there any short example that prints a text file on screen (from floppy)??
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: Listing and reading files on a floppy disk

Post by yemista »

im actually trying to figure this out myself right now. look at http://en.wikipedia.org/wiki/INT_13
you want function 02h. Most is elf explanatory but im not sure how to fill in cx and dh
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Listing and reading files on a floppy disk

Post by Troy Martin »

yemista: You need to have a way to convert a logical sector number (0,1,2,3,4,5,6,7,8,9, etc.) to a Head/Track/Sector format.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Listing and reading files on a floppy disk

Post by JohnnyTheDon »

Troy Martin wrote:yemista: You need to have a way to convert a logical sector number (0,1,2,3,4,5,6,7,8,9, etc.) to a Head/Track/Sector format.
You could also use int 13h ah=42h and use Logical Block Addressing, which will do that for you and will work with up to 8 exabyte disks.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Listing and reading files on a floppy disk

Post by Troy Martin »

Sure, but the INT 13h Extensions are required and they use a packet, requiring a packet to be customised for each read/write.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Listing and reading files on a floppy disk

Post by JohnnyTheDon »

Troy Martin wrote:Sure, but the INT 13h Extensions are required and they use a packet, requiring a packet to be customised for each read/write.
Idk how common it is to find a BIOS that doesn't support the extension, but AFAIK the extensions were created quite a while ago so most BIOSes should support them. Also, the packet can be reused and the only fields that need to be changed are the buffer, block number, and number of blocks to read (the same stuff that would be put in registers for each int 13h ah=02h call).
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Listing and reading files on a floppy disk

Post by Troy Martin »

Eh, good point. I should consider using them!

[offtopic]I think cotton509 should come back, I have some rage to vent. My trollskin pants have holes and I need to patch them with something...[/offtopic]
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Listing and reading files on a floppy disk

Post by System123 »

I thought you were working in protected mode. If you are I would say its better not to use bios interrupts. Build your own drivers and File system routines.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Post Reply