Page 1 of 2

FAT12 Viewer in ASM

Posted: Tue Dec 14, 2004 5:48 am
by Metallic-Red
Hi, I've attempted to make a module that can display the files on a floppy disk but since I've never done this before, it's hard to get started. I was wondering if anyone knew of any code or a link that works just like the "dir" function in DOS, to display files on a floppy disk. I would like the code to be in PURE ASSEMBLY. Any help is appreciated.

EDIT: I am using 16 bit real mode and I am using the NASM compiler

Re:FAT12 Viewer in ASM

Posted: Tue Dec 14, 2004 7:30 am
by bubach
have you done any fat12 bootsector, or have code for one?
if you have the root directory loaded to mem you can change the loop that searches for a filename, so that it prints it instead. that should give you a start.
later u could add so it prints filesize etc.
info on fat12 is found in the faq.

Re:FAT12 Viewer in ASM

Posted: Tue Dec 14, 2004 8:14 am
by Metallic-Red
I have a FAT12 boot sector that works, so I'll play around with the code. I found the forum to be to basic on the subject. I have the offical Microsoft FAT document and while it has been helpful, it's not that great. If anyone else has anything to add feel free. This problem of mine is not gone as of yet...

Re:FAT12 Viewer in ASM

Posted: Tue Dec 14, 2004 10:44 am
by ASHLEY4
Here is the steps, i have the asm code, but that will not teach you any thing.
Load root dir in memory, test the first byte for "e5h" (file has been deleted), if = add 32, to try for next file/dir, test for also for 00h, if so end of search, also test for 41h if = , test if starting cluster word = 0, if so jump to the next file/dir entry, ( has this is a renamed file).

If it passers all the above, print it.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.

Re:FAT12 Viewer in ASM

Posted: Tue Dec 14, 2004 5:34 pm
by Metallic-Red
Yeah, by giving me the code I definitely wouldn't learn anything and it defeats the purpose of programming. Thanks for your advice.

Re:FAT12 Viewer in ASM

Posted: Wed Dec 15, 2004 5:24 am
by IRBMe
Metallic-Red, I seem to recall you posting a comment on my tutorial (http://www.mega-tokyo.com/forum/index.p ... eadid=7053)

It has a section which explains how the FAT12 file system works and gives you some implementation details. It's in section 5. Perhaps you simply missed it, or maybe you just didn't think it was very good ;) but either way I thought I would mention it incase you missed it. And it gives the example bits in C and in asm. Also, the osdev.zip that it came in now contains a fully functioning fat12 boot loader, and secondary loader with lots of useful code you can examine (load the root directory, load the FAT, scan for a filename in the root directory, load a file from the disk).

Personally I think the FAT12 section in the OS FAQ wiki needs a little more work but it might be worth a read if you haven't read it already. Some bits are ok. Microsoft also have a document containing the FAT12 specification. That's all I needed. Google for fatgen103.pdf. The one I found was http://staff.washington.edu/dittrich/misc/fatgen103.pdf

Good luck.

Re:FAT12 Viewer in ASM

Posted: Wed Dec 15, 2004 5:36 am
by Metallic-Red
Yeah I did read your section about FAT12 but it confused me at the time. Hehe, over the last few days I've been doing some research on the subject and found out some more information. I've been playing around with some of the code to list the file names but the problem is I've got a memory leak or something because I keep getting an error message, so I'll work on that. I'm only just getting the hang of it :)

Re:FAT12 Viewer in ASM

Posted: Thu Dec 16, 2004 10:26 pm
by keeper
<move>Common windows trim that FAT!</move>

If fat is so hard, why dont you use somthing else...

Re:FAT12 Viewer in ASM

Posted: Thu Dec 16, 2004 11:13 pm
by AR
Because FAT is the standard for Floppies and it is relatively simple compared to something like ext3.

BTW. Please don't use pointless marquees, it's just irritating.

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 3:21 am
by Pype.Clicker
btw, FAT is one of the easiest-to-implement filesystem (in addition from being de facto standard on floppies and small flash cards)

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 4:04 am
by distantvoices
];->

I've actually found ext2 to be easy once i've wrapped my mind around certain file system related facts ... have had a spinning brain for some days *gg* and then it went *pof* and I suddenly understood.

When I set off to implement Fat, I gonna do it similar to the ext2 driver: as a thread insidethe file system service -for the reads/writes.

@keeper: what's that for an ugly question in your sig? Me 's neither.

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 5:21 am
by bubach
is it true that not even linux has full ntfs support? how hard can it be?

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 5:41 am
by Metallic-Red
Yeah it is true. I've got Knoppix and it doesn't support NTFS. If you save a file to an NTFS formatted harddrive you can corrupt the harddrive, or so I've heard...

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 5:46 am
by Candy
It's not hard. It's also uncheckable how good your solution is.

If you're blindfolded and are expected to walk up to a white dot, you can never tell how far off you are. If it's a big white dot in a hallway, you can't be far off in any case. Still, since you can't tell when you're there, you can't be sure that it is good, so you should not tell anybody it's good.

You can enable it in the linux kernel configuration, it's marked "dangerous", and I've used it 4 years ago for half a year without a single hitch. I then uninstalled windows and the stuff became uninteresting to me. It should be quite stable now, but I can imagine there being a special case in a way that hasn't happened, in which it fails.

Re:FAT12 Viewer in ASM

Posted: Fri Dec 17, 2004 6:26 am
by Pype.Clicker
bubach wrote: is it true that not even linux has full ntfs support? how hard can it be?
I suggest you google for Andrew Tanenbaum's tutorial about NTFS ... Unlike other FSes, the NTFS structure leaves *much* room for external tools. Two implementation of NTFS formatting could lead to very different NTFS performance, depending on how they arrange all the internal stuff ...