https://wiki.osdev.org/ATA_read/write_sectors
Some of the time, it does work, some of the time it does not.
I can only read and write in one function, then the code quits working.
https://gist.github.com/iProgramMC/8328 ... 9bdfd6909f
https://gist.github.com/iProgramMC/8d92 ... 52e7b76b31
The basic code required to test the functions is here.
The code returns zeros from the FileOpen function, even though the InitFilesystem function worked beforehand and made a full tree of the filesystem.
File system is very simple, you've got the classical BPB boot-sector, then 16 sectors' worth of root directory files, and data area.
All other FAT features were stripped down as this is planned to be a read-only file system.
Its main purpose is to load other programs into memory.
I'm not sure what causes the random halt of the functioning of AtaLbaRead and AtaLbaWrite, but I have a suspicion it may be in regards to the drive not being initialized and such, even though the file system was loaded successfully.
Please help?
OSDev Wiki ATA read/write sectors code not working right
-
- Member
- Posts: 81
- Joined: Sun Apr 21, 2019 7:39 am
-
- Member
- Posts: 81
- Joined: Sun Apr 21, 2019 7:39 am
Re: OSDev Wiki ATA read/write sectors code not working right
i think that you're messing up some code.
in the wiki says:
and then
but instead in your code you're doing:
correct me if i'm wrong
in the wiki says:
Code: Select all
mov edx, 0x1f4
mov eax, ebx
shr eax, 8
out dx, al
Code: Select all
mov edx, 0x1f4
mov eax, ebx
shr eax, 16
out dx, al
Code: Select all
mov edx, 0x1f4
mov eax, ebx
shr eax, 16
out dx, al
-
- Member
- Posts: 81
- Joined: Sun Apr 21, 2019 7:39 am
Re: OSDev Wiki ATA read/write sectors code not working right
I've fixed it.
The resulting array is still inconsistent even if I read the same sector over and over.
The resulting array is still inconsistent even if I read the same sector over and over.