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.
It looks like you're getting a successful read, but there's nothing for Bochs to read. How big is you image your using to boot from? If you don't have anything after the boot sig, try putting something there, and see if one of those "read() on floppy image returns 0" turns into "read() on floppy image returns [however much you added]".
Thanks for your reply.Could you plz tell how can i write some to an image file after first 512 byte using dd
command or any other tools.The size of the image file is 5kb and i am giving this image file as input to floppy drive of bochs.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
You don't have to go through the trouble of using some external utility, just define a really long variable after the boot signature. Possibly a string, then use int 10h, 0eh to print the string from the read buffer to test if the read was successful.
But if your image is >512b then you should at least get a partial read. I don't see where you set dl = drive number, the drive number is passed by Bochs in dl(so you don't necessarily have to set it, but if you modify dl before the read, save it to memory somewhere first. Also, check CF, it's set on an error. Another thing, heads start at 0. Here's a good resource, it has the possible values for the input regs. You may want to look into getting Helppc(and a DOS emulator), it's good for helping with simple things like this.
I doubt anyone really could help. You're not providing nearly enough context. Have you tried following the advice already given to you in this thread? We really don't know...
You should take a look at this essay and really understand it before posting back. Perhaps then you'll be better prepared to help us help you.
Don't think we're mean here or anything, but just remember, these are real people, and they have to live life, go to their jobs, and go home and recline on the sofa . So try to ask questions the right way, because these nice people(that being us, and including me ) are taking time out of their busy schedules to come help you.
Do you really think they are going to respond nicely if you give a vague question, have to squeeze information out of you, and have to spoonfeed you solutions?
So please, be considerate!
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
You know it's a funny thing that you are saying that you are busy and don't have time to answer, but you have the time to spend lecturing about how to post properly. Isn't it also easy to just provide enough information to prompt the correct questions? People who are using your forums and your tutorials are coming here to potentially try your code and service and are sometimes getting frustrated with incomplete or inaccurate or not up to date data and are not always in the right state of mind to ask the appropriate questions.
All communication has to start with a prompt - if it is ok from a console or I have a question from a forum, and turning people off or turning people away is not a good way to promote your forum or site.
Having said that and probably hit a nerve on your end, I am having the same issue, and would like to say that I used a tutorial example on this site and and receiving the following:
00070749873i[BIOS ] Booting from 0000:7c00
00071532363i[FDD ] partial read() on floppy image returns 280/512
00071643984i[FDD ] read() on floppy image returns 0
00071755605i[FDD ] read() on floppy image returns 0
00071867226i[FDD ] read() on floppy image returns 0
00071978847i[FDD ] read() on floppy image returns 0
00072090468i[FDD ] read() on floppy image returns 0
My on disk image file is kernel.img from the tutorials on idt and gdt - it is 4.27 kb
At first glance it appears that the boot code is being loaded and then I am potentially endless looping with 0 bytes returned
Someone mentioned something about setting bochs to use a specific floppy device or association, does anyone know how to do this? I will post my bochrc
# You many now use double quotes around pathnames, in case
# your pathname includes spaces.
Please give us the exact size (in bytes) of the image file, and have your code print the floppy CHS values (or AX, CX, DX values) just before the INT 0x13. These will almost certainly show that you are trying to read off the end of your image file. The question is why are you doing such a thing? What do you expect to find there?
My on disk image file is kernel.img from the tutorials on idt and gdt - it is 4.27 kb
Well, since CPU-related code doesn't normally help in solving floppy-related problems, please show us how you create the entire floppy image.
then I am potentially endless looping with 0 bytes returned
Is it an endless loop or is it not an endless loop. What does it do exactly in that loop? Being vague about details doesn't work.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
floppy read code - there are more like this - the potentially endless loop is via the jc read - there are many of these statements in the code to load things. I have not looped them, I am
read:
xor ax,ax ; Floppy Reset BIOS Function
mov dl,[drive] ; Select floppy that was booted from
int 0x13
jc read
mov ax,0xffff
mov es,ax ; Data buffer for file
mov bx,0x10 ; Start of segment
mov ah,2 ; Function to read disk
mov al,17 ; Total sectors to read
mov ch,0 ; Track
mov cl,2 ; Sector
mov dh,0 ; Head | Drive is already loaded
int 0x13 ; Call BIOS read disk function
jc read
I have since realized that this is not the same site I was using the original tutorials from so I am probably not going to post or read anything else here.
In regards to being vague, instead of posting 10 miles of code puke, I am attempting to minimize the garbage and prompt where I think the problem is. When I get a request for more information I will provide it - this is how communication normally works.
The reads that I am doing with the floppy is not my own code, I am using bios calls and am asking this community if they have had similar issues.
Two things, the bootloader blatantly dumps a part of the floppy into memory, much more than what the kernel's size actually is. While this doesn't cause problems with Bochs, several other tools are known to have issues with images that are not 1.4M in size.
Anyway, the problem is more likely in how the kernel is stored in memory and started. If your tutorial doesn't have any specific code to locate main() or force it at some fixed location (the order you put things on the command line does not work), its broken and you are probably better off using another one (preferrably one from the wiki). And that doesn't seem to be your tutorial's only problem based on this short description...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]