Load files from disk

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.
Post Reply
keyboard_ninja

Load files from disk

Post by keyboard_ninja »

I found a boot sector which executes code in a
file. I wrote the sector to disk and copied kernel.bin
to a drive. My kernel just prints something to the screen
and thats it. When it tries to load kernel.bin
It either shows nothing, or print garbage to screen.
Does anybody have any source to the examples of what i'm trying to do ?
WHAT IS WRONG!!!!
Schol-R-LEA

RE:Load files from disk

Post by Schol-R-LEA »

>On 2002-05-15 22:48:28, keyboard_ninja wrote:
>I found a boot sector which executes code in a
>file. I wrote the sector to disk and copied kernel.bin
>to a drive. My kernel just prints something to the screen
>and thats it. When it tries to load kernel.bin
>It either shows nothing, or print garbage to screen.
>Does anybody have any source to the examples of what i'm trying to do ?
>WHAT IS WRONG!!!!


Uhm, without knowing more about the boot loader in question, that's hard to say. The main questions I have are:

Just what is the boot loader loading, and where?
When you say it loads a file, do you mean that
it reads a FAT (or some other filesystem structure), finds the file, and loads part or all of it? Or does it just load sectors x through y as raw data?

Where is the data loaded to, and is it loaded, as raw binary (probably) or in a relocatable format? If it is raw binary, are you sure that your code's origin was set to it correctly? If relocatable format, what format should it have been in (you seem to be using raw binary yourself)?

How did you write the boot sector to the disk? Are you sure it wouldn't have overwritten the file format in the process?

How did you write the 'kernel.bin' file to the disk?

Could you provide the code (or better, pointers to it) so we can go over it?
Post Reply