Bootloader , TextFiles
-
- Member
- Posts: 63
- Joined: Sat Apr 28, 2012 9:41 am
- Location: Earth -> Asia
Bootloader , TextFiles
I have my bootloader somewhat working, it can read Files form a FAT12,16 FS from a Floppy.
It is 2stage, bootsector loads the 2nd stage.
I can open a file named abc.abc from the root dir, I have some text in it and I wish to read what is in it, how can I do that?
Exactly what I mean is to read a text form a file after it is loaded to memory.
EDIT:
What I am trying is to read a text file containg information wheather to load the kernel in real mode or in protected mode ,paging?,etc
I just want to load the string and look whats in it.
It is 2stage, bootsector loads the 2nd stage.
I can open a file named abc.abc from the root dir, I have some text in it and I wish to read what is in it, how can I do that?
Exactly what I mean is to read a text form a file after it is loaded to memory.
EDIT:
What I am trying is to read a text file containg information wheather to load the kernel in real mode or in protected mode ,paging?,etc
I just want to load the string and look whats in it.
Anyone has a idea of making a ntfs bootsector?if yes PM me , plz.
Re: Bootloader , TextFiles
What do you mean under "reading"?
Displaying the text on the screen?
If so, you need to load executable code by your loader which will print the text on the screen.
Download the archive with OS Boot Tools from the link in my signature, there you'll find the source of very simple demo kernel. That kernel may be loaded at any location and it prints a couple details about your system. There you may find some useful printing utilities.
Displaying the text on the screen?
If so, you need to load executable code by your loader which will print the text on the screen.
Download the archive with OS Boot Tools from the link in my signature, there you'll find the source of very simple demo kernel. That kernel may be loaded at any location and it prints a couple details about your system. There you may find some useful printing utilities.
-
- Member
- Posts: 63
- Joined: Sat Apr 28, 2012 9:41 am
- Location: Earth -> Asia
Re: Bootloader , TextFiles
Mine can print text but I wanted to load a text file from the root, which I can.Then I just want to take the text and compare.
But i have no idea how to get the text.
I was looking at your tool, nice, but a bit complex for me.
Thank You
But i have no idea how to get the text.
I was looking at your tool, nice, but a bit complex for me.
Thank You
Anyone has a idea of making a ntfs bootsector?if yes PM me , plz.
Re: Bootloader , TextFiles
Load and parse the file.
If you have seen bad English in my words, tell me what's wrong, please.
Re: Bootloader , TextFiles
For this you need to add the device drive to you kernel, then file system driver. After that you'll be able to parse disk structures and load files.LindusSystem wrote:Mine can print text but I wanted to load a text file from the root, which I can.Then I just want to take the text and compare.
-
- Member
- Posts: 63
- Joined: Sat Apr 28, 2012 9:41 am
- Location: Earth -> Asia
Re: Bootloader , TextFiles
Mine supports FAT12/16,Floppy and I am able to start my kernel(Kernel is a blank printing just text), What I am trying is to edit my bootloader and keep a configuration file which will contain the kernel environment details according to which the bootloader must setup.
So ,till now I have loaded my config file into memory at 0x7C10.But my question is how can I read it?(Read the text and perform the tasks accordingly.
Yoda, You told you need FS Driver, those things I know before reading a file, I have read so much theory in my studies/ but I have ever done any thing in practical.
So ,till now I have loaded my config file into memory at 0x7C10.But my question is how can I read it?(Read the text and perform the tasks accordingly.
Yoda, You told you need FS Driver, those things I know before reading a file, I have read so much theory in my studies/ but I have ever done any thing in practical.
Anyone has a idea of making a ntfs bootsector?if yes PM me , plz.
-
- Member
- Posts: 63
- Joined: Sat Apr 28, 2012 9:41 am
- Location: Earth -> Asia
Re: Bootloader , TextFiles
Currently I am loading my textfile @ 0x1000...(1MB), I want to take the text from that locaton and look fo a word PMode and if present i wish to go to pmode.
I am still stuck up.
I am still stuck up.
Anyone has a idea of making a ntfs bootsector?if yes PM me , plz.
Re: Bootloader , TextFiles
Hi,
If your problem is searching an area of memory for a sequence of bytes (e.g. searching for the substring 'PMode' within an array of char); then break it into 2 problems:
If your problem is implementing a more complete parser, then break it up into many smaller problems - e.g. a piece of code to skip white space, a piece of code to extract/validate a string, a piece of code to extract/validate an integer, etc. Then have a "while(address < end_address)" loop that calls these routines.
If your problem is figuring out how to turn something simple (text parsing) into a hideously over-complicated and bloated nightmare, just use XML.
If your problem is something else, provide a more accurate description of the problem...
Cheers,
Brendan
If your problem is accessing data you've loaded above 0x00100000 in real mode, then how did you get the text file at 0x00100000 in the first place?LindusSystem wrote:Currently I am loading my textfile @ 0x1000...(1MB), I want to take the text from that locaton and look fo a word PMode and if present i wish to go to pmode.
If your problem is searching an area of memory for a sequence of bytes (e.g. searching for the substring 'PMode' within an array of char); then break it into 2 problems:
- An outer loop that searches for the first byte (e.g. find each occurrence of the byte 'P')
- An inner loop that that checks if the bytes after the first byte are what the should be
If your problem is implementing a more complete parser, then break it up into many smaller problems - e.g. a piece of code to skip white space, a piece of code to extract/validate a string, a piece of code to extract/validate an integer, etc. Then have a "while(address < end_address)" loop that calls these routines.
If your problem is figuring out how to turn something simple (text parsing) into a hideously over-complicated and bloated nightmare, just use XML.
If your problem is something else, provide a more accurate description of the problem...
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: Bootloader , TextFiles
If you want an interpreter in the boot loader to run the text script; then break it into 4 problems:
- Lex parser that parse the text into object tree
- JIT engine that turn tree into intermediate code
- Runtime support for the intermediate code
- interpreter that maintain the execution context of the intermediate code
-
- Member
- Posts: 63
- Joined: Sat Apr 28, 2012 9:41 am
- Location: Earth -> Asia
Re: Bootloader , TextFiles
I made a easier solution ,now I am searching for KRNMODE File in the disk for loading kernel in PMode ,if the file is not found then I will load the kernel in RealMode with nothing, same as the BIOS loading the bootsector(except GDT,etc).
If I get a solution to read my text files, I will post the solution here.
If I get a solution to read my text files, I will post the solution here.
Anyone has a idea of making a ntfs bootsector?if yes PM me , plz.