Where do i start??
Re:Where do i start??
Hi,
How do i jump to my second stage loader from my BootSector in real mode??
Ciao
note: i searched google, and nothing was found
How do i jump to my second stage loader from my BootSector in real mode??
Ciao
note: i searched google, and nothing was found
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Where do i start??
just know where you loaded it (segment:offset) and jmp segment:offset ...Berserk wrote: How do i jump to my second stage loader from my BootSector in real mode??
seems you didn't searched very extensively ... 2 mins were enough to find a nicely commented 2-stages bootloader at http://www.dftech.cwc.net/osdev/Bootloader.htmlnote: i searched google, and nothing was found
...
Re:Where do i start??
Hey,
thanx, i got it working. Now for a question:
Do i have to make a new stack when i jump to my Second Stage Loader??
Or do i have to do something with the Stack??
Ciao
thanx, i got it working. Now for a question:
Do i have to make a new stack when i jump to my Second Stage Loader??
Or do i have to do something with the Stack??
Ciao
Re:Where do i start??
While it can be argued that it is not absolutely necessary, it is a very wise idea to set up the stack at some point in the boot loader, the earlier the better; otherwise it will be wherever the BIOS set it up, which could be anywhere in lower memory (I think that there is supposed a standard location for it, but of course no one ever follows the standards...). Most boot loaders reset SS and SP as soon as is feasible, usually together with resetting the code segment (with a far jump) and and the data segment (usually matching it to the CS). For example my first-stage boot loader begins:Berserk wrote: Hey,
thanx, i got it working. Now for a question:
Do i have to make a new stack when i jump to my Second Stage Loader??
Or do i have to do something with the Stack??
Code: Select all
;; constants
loader_base???equ 0x0000
%define loader_offset 0x7C00 ; cannot use EQU to give a value in an ORG statement
stage2_entry???equ 0x1000???; the segment:offset to load the second stage into
stage2_offset???equ 0x0000???
stack_seg???equ 0x9000
stack_top???equ 0xFFFF
;; *** additional EQUs, macroes and comments snipped for space
[bits 16]
[org loader_offset]
entry:
???jmp loader_base:start ; ensures that the CS is really at loader_base
start:
???cli
???mov ax, stack_seg
???mov ss, ax??????; and the stack at an arbitrarily high point past ES.
???mov ax, stack_top
???mov sp, ax ??????; put the stack pointer to the top of SS
???mov ax, cs
???mov ds, ax??????; set DS == CS
???sti??????; reset ints so BIOS calls can be used
If you've set it up in the first-stage loader, then it isn't necessary to do so again; it'll all get changed when you set up you switch to p-mode, anyway. If your loader is still in real mode in the second stage (which is a much easier than trying to stuff the GDT, etc. into the boot sector) and you haven't set up the stack, you probably shouldn't bother unless you are doing some elaborate work before switching to p-mode.
Once you are in p-mode, you should have already taken control of the stack, and you usually will only manipulate it for task-management purposes.
EDIT: I seem to have trailed of a bit on the second paragraph. I've finished what I was trying to say there now.
Re:Where do i start??
Thanks.
i just want to know a few things:
what is the purpose of the variable called variable??
Also, what is the purpose of the variable called offset, and what is offset??
Also, Tom where did you get the mode 13 graphics lib from pk0.6?? Do you know any good links for mode 13 resources??
Ciao ;D
i just want to know a few things:
what is the purpose of the variable called variable??
Code: Select all
void ClearScreen(void)
{
char* VideoMemory = (char*)0xB8000; //Pointer to Video Memory
unsigned int variable = 0;
while(variable < (80 * 25 * 2))
{
VideoMemory[variable] = 0x20;
variable++;
VideoMemory[variable] = 0x07;
variable++;
}
}
Code: Select all
void PutPixel(unsigned int xAxis, unsigned int yAxis, unsigned char PixelColour)
{
unsigned char* VGA = (unsigned char*)0xA0000;
unsigned short offset = 320 * yAxis + xAxis;
VGA[offset] = PixelColour;
}
Ciao ;D
Re:Where do i start??
Bezerk, it looks like you're either lazy, or you don't know how to program. I hope that you're neither of those, because somebody who's lazy or who can't program isn't going to get very far in OS development.
I suggest you look carefully at your own question and answer it yourself.
I suggest you look carefully at your own question and answer it yourself.
Re:Where do i start??
Hey,
Yeh, i was in a bad mood :-[ Anyways, i found a good tutorial place.
Cyaz.
Yeh, i was in a bad mood :-[ Anyways, i found a good tutorial place.
Cyaz.
Re:Where do i start??
Hey,
What is the Simplest way to read from a floppy disk. I have seen all these complex functions with arguments and everything.
Could somebody show me the simplest way to read from a disk, with a function which takes no arguments.
Or does anybody know of any good tutorials??
Ciao
NOTE: I Googled it, I keep on finding very complex functions.
What is the Simplest way to read from a floppy disk. I have seen all these complex functions with arguments and everything.
Could somebody show me the simplest way to read from a disk, with a function which takes no arguments.
Or does anybody know of any good tutorials??
Ciao
NOTE: I Googled it, I keep on finding very complex functions.
Re:Where do i start??
Berserk, where is that 'good tutorial place'?
I would like to know.
I would like to know.
Re:Where do i start??
Thanks! I'll look at it.
What about your OS? In which state is its development?
What about your OS? In which state is its development?
Re:Where do i start??
Hey,
What is the Memory Location right after 0x7C00, i want to load my Second stage loader there. I want it to be right after the BootSector. And what are all these memory locations (e.g. 0x9000) how many are there. What is the maximum?? What are other places i can put the stack??
If you know any good tutorials it would be appreciated.
Now, i'm goin to bed ;D, Good Night. Cyaz in 24 hours
Ciao
note: Sorry i am in a big hurry.
What is the Memory Location right after 0x7C00, i want to load my Second stage loader there. I want it to be right after the BootSector. And what are all these memory locations (e.g. 0x9000) how many are there. What is the maximum?? What are other places i can put the stack??
If you know any good tutorials it would be appreciated.
Now, i'm goin to bed ;D, Good Night. Cyaz in 24 hours
Ciao
note: Sorry i am in a big hurry.
Re:Where do i start??
hmm... that would be 0x7C01. But if you want to load you SSL after the boot code then you need 0x7E00, just as expected, 512 bytes after 0x7C00.
What do you mean, "What are all these memory locations", they are exactly that, MEMORY LOCATIONS, places to store data and code, you can stick your stack in any memory location you want. And as to how many memory locations there are, well to give you a hint, this calculation will tell you how many there are in your system, (MB OF RAM * 1024 * 1024) = number of memory locations.
What do you mean, "What are all these memory locations", they are exactly that, MEMORY LOCATIONS, places to store data and code, you can stick your stack in any memory location you want. And as to how many memory locations there are, well to give you a hint, this calculation will tell you how many there are in your system, (MB OF RAM * 1024 * 1024) = number of memory locations.
Re:Where do i start??
Hey,
Ok, my system has 512mb of ram, so 512*1024*1027=536, 870, 912 - That's an awful lot of memory. So all this memory i am acessing is ram?? Where is the start off it, where is the end??
For example, how would i acess the end of it, would i just put 0x536870912?? or is there another way (or do i have to use hex :-\)
Is there a tutorial on this?? So the memory location after 0x7C00 is 0x7C01, so i just load my ssl to there, and put [ORG 0x7C01] at the top of my ssl, right??
Thanks for your help, I have nearly finished my BootProcess, and i am nearly ready to start PM (Protected Mode) Just another week or so ;D
Ciao
Ok, my system has 512mb of ram, so 512*1024*1027=536, 870, 912 - That's an awful lot of memory. So all this memory i am acessing is ram?? Where is the start off it, where is the end??
For example, how would i acess the end of it, would i just put 0x536870912?? or is there another way (or do i have to use hex :-\)
Is there a tutorial on this?? So the memory location after 0x7C00 is 0x7C01, so i just load my ssl to there, and put [ORG 0x7C01] at the top of my ssl, right??
Thanks for your help, I have nearly finished my BootProcess, and i am nearly ready to start PM (Protected Mode) Just another week or so ;D
Ciao
Re:Where do i start??
Hey,
Sorry, did some typos and forgot to say somestuff. Of course it's written in hex, what was i thinking :-[
What would happen if i went over the limit, e.g. assumed the machine has 512mb ram, but it only has 128mb, and i tried to use more?? What would happen. And where is the absoloute start of the memory. I want to load the ssl there, is the start 0x0000?? And to acess it do i just write the number in hex?? For example, if i wanted to acess memory location 551318; would i just put 551318 in hex??
Ciao, all the other questions remain. Please help.....
Sorry, did some typos and forgot to say somestuff. Of course it's written in hex, what was i thinking :-[
What would happen if i went over the limit, e.g. assumed the machine has 512mb ram, but it only has 128mb, and i tried to use more?? What would happen. And where is the absoloute start of the memory. I want to load the ssl there, is the start 0x0000?? And to acess it do i just write the number in hex?? For example, if i wanted to acess memory location 551318; would i just put 551318 in hex??
Ciao, all the other questions remain. Please help.....