OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Dec 06, 2019 6:39 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: issue with int 0x13
PostPosted: Sat Nov 09, 2019 11:55 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 576
Location: USA
Armature wrote:
I've already loaded both the FAT and root Directory into a memory location. I'm not searching for that. I'm searching for a file that's on the disk. As for the value I was getting from the root directory, I said I think I'm getting the wrong one. I think its meant to be 0x001A which would be sector 26

You may be correct, however, my point is, with a starting cluster value of 0x1A00 (6656d), it is irrelevant whether your LBA to CHS code, or your read sector code is correct or not. I would start finding out why I found a cluster number of 6656 to begin with.

- Am I reading the root directory correctly?
- Am I reading from the correct root entry?
- Am I reading from the correct offset within that entry?

Once I have figured out that I have TRUE for all three questions, why am I still getting a cluster number of 6656? If any of those questions are FALSE, then I have found the issue.

I have created a tool to view disk images to help in my development. If you have a 1.44Meg disk image, using a similar tool, you can view the image's boot sector, fat, root, file data area, etc. Doing so will eliminate the possibility of a faulty file system.

Once I have figured out that the file system (image file) is correct, the FAT(s) are correct, and the root directory is valid, I can then move on to finding out why I am reading from the wrong place. For example, once I have a valid starting cluster number (in your case it might be 1Ah (26d)), I can then read from sector (1 + 9 + 9 + 14 + 26 - 2) to get the first sector (cluster) of the file, assuming I have a 1:1 ratio of clusters to sectors. Dump this sector to the screen to see if it matches the sector on the image file (disk).

Ben
- http://www.fysnet.net/osdesign_book_series.htm


Top
 Profile  
 
 Post subject: Re: issue with int 0x13
PostPosted: Tue Nov 12, 2019 4:06 pm 
Offline

Joined: Wed Apr 25, 2018 2:44 pm
Posts: 24
BenLunt wrote:
Armature wrote:
I've already loaded both the FAT and root Directory into a memory location. I'm not searching for that. I'm searching for a file that's on the disk. As for the value I was getting from the root directory, I said I think I'm getting the wrong one. I think its meant to be 0x001A which would be sector 26

You may be correct, however, my point is, with a starting cluster value of 0x1A00 (6656d), it is irrelevant whether your LBA to CHS code, or your read sector code is correct or not. I would start finding out why I found a cluster number of 6656 to begin with.

- Am I reading the root directory correctly?
- Am I reading from the correct root entry?
- Am I reading from the correct offset within that entry?

Once I have figured out that I have TRUE for all three questions, why am I still getting a cluster number of 6656? If any of those questions are FALSE, then I have found the issue.

I have created a tool to view disk images to help in my development. If you have a 1.44Meg disk image, using a similar tool, you can view the image's boot sector, fat, root, file data area, etc. Doing so will eliminate the possibility of a faulty file system.

Once I have figured out that the file system (image file) is correct, the FAT(s) are correct, and the root directory is valid, I can then move on to finding out why I am reading from the wrong place. For example, once I have a valid starting cluster number (in your case it might be 1Ah (26d)), I can then read from sector (1 + 9 + 9 + 14 + 26 - 2) to get the first sector (cluster) of the file, assuming I have a 1:1 ratio of clusters to sectors. Dump this sector to the screen to see if it matches the sector on the image file (disk).

Ben
- http://www.fysnet.net/osdesign_book_series.htm


That program was incredibly useful. It's shown me that the first cluster is actually 0x000F. Which means im getting the completely wrong byte from somewhere but i dont know where now. I tried using a program called sectedit to look at the 512 bytes within the sectors on the disk but i cant open an image, only physical disks. Do you guys know any programs that are able to do that? I'n the mean time I'm going to scower through all my lines of code and follow the logic to see if i've gone wrong somewhere.


Top
 Profile  
 
 Post subject: Re: issue with int 0x13
PostPosted: Tue Nov 12, 2019 8:10 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 576
Location: USA
Armature wrote:
That program was incredibly useful. It's shown me that the first cluster is actually 0x000F. Which means im getting the completely wrong byte from somewhere but i dont know where now. I tried using a program called sectedit to look at the 512 bytes within the sectors on the disk but i cant open an image, only physical disks. Do you guys know any programs that are able to do that? I'n the mean time I'm going to scower through all my lines of code and follow the logic to see if i've gone wrong somewhere.

Another tool that should be in your tool box. Have a look at my dump tool. It allows you to dump any part, given a byte offset, or any sector, giving a sector offset, to multiple output forms. It even has a little bit of error checking on the dump data. It is a tool I add to when I need a new feature or need to parse the data a little different. (I haven't worked on that tool in a while. I think it is still a 32-bit Windows executable, but should still work just fine on later machines)

Ben
- http://www.fysnet.net/osdesign_book_series.htm


Top
 Profile  
 
 Post subject: Re: issue with int 0x13
PostPosted: Wed Nov 13, 2019 2:34 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1697
Armature wrote:
I tried using a program called sectedit to look at the 512 bytes within the sectors on the disk but i cant open an image, only physical disks. Do you guys know any programs that are able to do that?

I've found HxD to be quite nice. Since it's more of a general-purpose editor than a disk editor, it doesn't display sector boundaries when you're editing a disk image. I like to resize the window to show exactly 512 (0x200) bytes, so I can use page-up and page-down to scroll between sectors.


Top
 Profile  
 
 Post subject: Re: issue with int 0x13
PostPosted: Fri Nov 15, 2019 9:25 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1055
Octocontrabass wrote:
Armature wrote:
I tried using a program called sectedit to look at the 512 bytes within the sectors on the disk but i cant open an image, only physical disks. Do you guys know any programs that are able to do that?

I've found HxD to be quite nice. Since it's more of a general-purpose editor than a disk editor, it doesn't display sector boundaries when you're editing a disk image. I like to resize the window to show exactly 512 (0x200) bytes, so I can use page-up and page-down to scroll between sectors.


Active @ Disk Editor is simply the best!
I've been using it for years and I'm supper satisfied with it.

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: issue with int 0x13
PostPosted: Sat Nov 16, 2019 8:55 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3589
Location: Chichester, UK
ghex works fine on *nix platforms to edit files, virtual disks, or physical disks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group