Reading sectors FDC on CPU x86 in protected mode
Reading sectors FDC on CPU x86 in protected mode
Hi all, i post this code for reading sectors of the floppy. My question is... why the emulator Bochs show 'partial read() on floppy image returns 510/512' (usually when it does is OK) and doesn't read the next sector with 'call'? Through 'int 13h' is allowed, strange or something wrong?
The code
The code
Re: Reading sectors FDC on CPU x86 in protected mode
Hi,
Cheers,
Brendan
How large if the floppy disk image you're using (and can I guess that the floppy image itself is 510 bytes, and not 1474560 bytes or any other multiple of 512 bytes)?Neo92 wrote:Hi all, i post this code for reading sectors of the floppy. My question is... why the emulator Bochs show 'partial read() on floppy image returns 510/512' (usually when it does is OK) and doesn't read the next sector with 'call'? Through 'int 13h' is allowed, strange or something wrong?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Reading sectors FDC on CPU x86 in protected mode
Hi Brendan, i must to read the second sector's floppy by first. The image is large 1024 bytes (exactly 1022 bytes) divided into 512 bytes for sector. I wouldn't want that there are the mistakes into initialization ports or DMA, i don't know... i will try of read back functions, also if is strange that with interrupt 0x13 read it.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Reading sectors FDC on CPU x86 in protected mode
A floppy image must be exactly the 1.4M size of an actual floppy, anything else makes VMs trip - in different fashions depending on the emulator in question.
Re: Reading sectors FDC on CPU x86 in protected mode
Hi Combuster, i know that the standard format floppy is 1.44 MB but my problem is reading sectors through ports in protected mode, don't work. Why?
The code
The code
Re: Reading sectors FDC on CPU x86 in protected mode
You have already been given the answer -- not only is your image of invalid size, it's also even not sector (512 byte) granular.
Re: Reading sectors FDC on CPU x86 in protected mode
Just add zeros to the end of your image until it is 1474560 bytes long, and see if the problem goes away. If not, let us know.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: Reading sectors FDC on CPU x86 in protected mode
This is my code on FASM:
The code, 3rd revision
I use DMA and FDC. I don't believe that needs add the zeros, because otherwise, how does it work with interrupt 0x13?
The code, 3rd revision
I use DMA and FDC. I don't believe that needs add the zeros, because otherwise, how does it work with interrupt 0x13?
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Reading sectors FDC on CPU x86 in protected mode
The BIOSes in a lot of emulators don't implement int 13 through the standard FDC subsystem; they work through a "back door" route which may or may not be able to handle incorrectly sized images.
Now can you please increase the size of your image before posting again, and repeatedly posting the same (or very similar) code is not going to fix your problem.
Now can you please increase the size of your image before posting again, and repeatedly posting the same (or very similar) code is not going to fix your problem.
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
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Reading sectors FDC on CPU x86 in protected mode
Then let us know so we don't all criticise you .Neo92 wrote:I increase the size of my image (1474560 byte=1 Mbyte) but without reply.
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: Reading sectors FDC on CPU x86 in protected mode
So, to clarify, is it working now? Does Bochs give you the "Partial" error any more?Neo92 wrote:I increase the size of my image (1474560 byte=1 Mbyte) but without reply.
By the way, you could probably use the following code instead:
Code: Select all
times 1474560-$ db 0
Code: Select all
times 512-($-start) db 0
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: Reading sectors FDC on CPU x86 in protected mode
Aaaaaac! Works in Bochs! But with delay, i don't know why...
Re: Reading sectors FDC on CPU x86 in protected mode
I moved the code out of your posts into Pastebin, so the thread is readable again. Please try to use some other code hosting site - can I suggest version control as well - when you want to paste something that's more than a few lines long?
Re: Reading sectors FDC on CPU x86 in protected mode
Thanks Candy, i don't knowed this rule, in the future i'll try don't repeat this action and i'm sorry. But i still don't understand why the floppy reading into second sector is slow. I don't want to read the second sector with interrupt 0x13 (that works) but through ports with DMA, that's all.