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?
Thank you for the help in advance
Help with folders (FAT12)
Help with folders (FAT12)
Working on a DOS:
Bootloader - DONE
Kernel - 5%
I would be grateful if you would like to help me
Bootloader - DONE
Kernel - 5%
I would be grateful if you would like to help me
Re: Help with folders (FAT12)
The name of a directory is 11 bytes long, filled with spaces if the name is shorter.
Simply show the asm code that finds the file.
Simply show the asm code that finds the file.
Re: Help with folders (FAT12)
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.
- Attachments
-
- 2016-01-02 (4).png (2.23 KiB) Viewed 4193 times
-
- 2016-01-02 (3).png (2.04 KiB) Viewed 4195 times
Working on a DOS:
Bootloader - DONE
Kernel - 5%
I would be grateful if you would like to help me
Bootloader - DONE
Kernel - 5%
I would be grateful if you would like to help me
Re: Help with folders (FAT12)
Then show up your finding Routine
Btw bochs has a wonderful debugger.
Btw bochs has a wonderful debugger.
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Help with folders (FAT12)
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.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: Help with folders (FAT12)
That is incorrect.onlyonemac wrote:More specifically, folders can't have extensions.
@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.
Re: Help with folders (FAT12)
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.
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.