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.
Hi guys, I have a big problem with my kernel. I have already programmed a library (in Assembly) to find Files and luckily it works. Now I'm trying to find a folder (named TRY) and in the FAT sector of my virtual floppy disk it is marked as TRY followed by some spaces. I have attached a picture. I have used the same code I used for files but it doesn't work. It has no sense for me, if I put in the variable the name of a file (for example TEST BIN) it works while if I put the name of the folder (TRY ) It doesn't work. Why is there this error?
I know this, in my code if I use a variable with a file name such as "TEST BIN" it works while for a folder named "TRY " it doesn't work. Look at the pictures, with the file variable it works while with the folder it doesn't. The code is the same. I can't understand why there is this error. When I execute the kernel in the first case (file case) the file is found while in the second case(folder) the folder is not found.
I'm going to take a shot in the dark (literally, since I can't see the picture) and guess that the problem has something to do with fact that one's a file and the other is a folder. More specifically, folders can't have extensions.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
onlyonemac wrote:More specifically, folders can't have extensions.
That is incorrect.
@OP - You are basically saying "I have a file/directory finding routine that doesn't work properly. I'm not going to show it to you but I'd like you to tell me why it isn't working." Talk about making life difficult.
The only significant differences between a directory entry representing a directory and one representing a file are that the size of a directory is always 0 and a directory has bit 4 set in the "file attributes" field. (A file could also have zero size, so the former is not a guaranteed indication of a directory.)
As we can't see how you are searching the directory, it's impossible to know what you are doing wrong. We can't even take it that the failure is as you describe. Perhaps you are not treating deleted entries properly and there is a deleted entry in front of the directory you are searching for. In other words, perhaps the failure has nothing to do with the fact that the name that you are searching for is a directory but is connected with the position of the entry in the directory entries that you are searching. Again, you don't say how you have tested the function, and how comprehensive those tests have been.
The best advice I can give, boring though it is becoming, is to debug your function. Single-step through it in a debugger and the error should become obvious. You will learn a lot more, and become more self-sufficient and a better programmer, if you do this rather than posting your code and asking someone else to find your error. It has to be something really trivial as searching a FAT directory for a particular file/directory name is a pretty trivial function.
If you're not happy about debugging your OS (which you really should learn how to do), write a userspace version of your FAT routines and debug that. Then apply what you find to your OS.