Where do i start??
Re:Where do i start??
obviously Berserk wants an example, so give him an example if u can?
an example of a splash screen that is.
& also, what kind of colour is Monchrome??
If i did 640x480 ?? what kind of colour is monchrome??
bye;D
an example of a splash screen that is.
& also, what kind of colour is Monchrome??
If i did 640x480 ?? what kind of colour is monchrome??
bye;D
Re:Where do i start??
Don't worry, i've found a resolution to the "Splash Screen Problem!"
But it won't work if i can't do this (Here is my question):
can i jump to a different graphics mode from my 'c' kernel using inline assembler?? (while 'in' protected mode?) If i can, could i see an example??
If i can't do it because of PM (Protected Mode) could i go into Real Mode, change the graphics mode using interrupt 10 & then switch back to PM?? If i have to do this, could i see example code?? (please)
If my resolutions are not possibe, does anybody else have any ideas??
How can i jump into another graphics mode, from my C Kernel??
Please help, after i get a splash screen up & running, i swear i will start making my OWN bootsector & kernel, instead of using this example one i got, I REALLY, need this problem solved, so i can move on...
Please help.....
But it won't work if i can't do this (Here is my question):
can i jump to a different graphics mode from my 'c' kernel using inline assembler?? (while 'in' protected mode?) If i can, could i see an example??
If i can't do it because of PM (Protected Mode) could i go into Real Mode, change the graphics mode using interrupt 10 & then switch back to PM?? If i have to do this, could i see example code?? (please)
If my resolutions are not possibe, does anybody else have any ideas??
How can i jump into another graphics mode, from my C Kernel??
Please help, after i get a splash screen up & running, i swear i will start making my OWN bootsector & kernel, instead of using this example one i got, I REALLY, need this problem solved, so i can move on...
Please help.....
Re:Where do i start??
If you don't mind me asking, why are you so concerned about the splash screen at such an early part of development? Most OSes don't have one at all, and even among the major commercial designs - Windows, MacOS, the various Linux distributions - the spash screen is one of the last things added, and invariably runs as the very last step before the user login. Trying to write a splash screen before writing a running kernel is like trying to paint a house before it has been built (and trying to write one that fits into the boot sector is like tryng to paint it before the lumber has been cut and the bricks kilned).
Is there some strong reason you need it to work from such an early stage?
Is there some strong reason you need it to work from such an early stage?
Re:Where do i start??
i am not that concerned about making a splash screen, i want to get to know graphics mode's, and the best way to do it is to make a splash screen and i also want to make my OS look prfessional ;D
Now, some questions,
When i link asm functions to my kernel, how come does the C function get arguments, i do not see any sign of them in the asm code, WHAT THE???
And also what does this do:
global _function
why do i see this in linked asm functions?
and what is the difference between this:
global _function
and this
[global _function]
??
What are the '[' & ']' for , i've seen them in alot of asm code??
Now the main question:
I have come up with a resolution for my problem, THEN i will finally start making my OS, here are my questions:
I want to link a couple of asm functions to my kernel, a function that Switch's to Real Mode, a function that switch's to Protected Mode from real mode, and a function that changes the Graphics mode via int 0x10
Could i see some example code of this being done, i know how to link the functions, i just need code, and also how do i make the asm function take arguments??
One last thing, i have heard of a thing called Unreal Mode, what mode is this? what is it used for? can i see some code to intitialise it, please! And also, (i will call unreal mode UM) here is a list of questions: can i go into UM while in Real Mode??, can i go into UM while in Protected Mode? can i go into Real Mode while in UM?, can i go into Protected mode while in UM?
also can i please, see example code of UM being initialised?
One last thing...Is there any, ANY way, to get into 800x600x256 without going into something like VESA? (any way, int 10h doesn't have to be used)
Please, answer as many questions above as you can, if they don't get answered i will just keep asking them.
Please help, ciao
Now, some questions,
When i link asm functions to my kernel, how come does the C function get arguments, i do not see any sign of them in the asm code, WHAT THE???
And also what does this do:
global _function
why do i see this in linked asm functions?
and what is the difference between this:
global _function
and this
[global _function]
??
What are the '[' & ']' for , i've seen them in alot of asm code??
Now the main question:
I have come up with a resolution for my problem, THEN i will finally start making my OS, here are my questions:
I want to link a couple of asm functions to my kernel, a function that Switch's to Real Mode, a function that switch's to Protected Mode from real mode, and a function that changes the Graphics mode via int 0x10
Could i see some example code of this being done, i know how to link the functions, i just need code, and also how do i make the asm function take arguments??
One last thing, i have heard of a thing called Unreal Mode, what mode is this? what is it used for? can i see some code to intitialise it, please! And also, (i will call unreal mode UM) here is a list of questions: can i go into UM while in Real Mode??, can i go into UM while in Protected Mode? can i go into Real Mode while in UM?, can i go into Protected mode while in UM?
also can i please, see example code of UM being initialised?
One last thing...Is there any, ANY way, to get into 800x600x256 without going into something like VESA? (any way, int 10h doesn't have to be used)
Please, answer as many questions above as you can, if they don't get answered i will just keep asking them.
Please help, ciao
Re:Where do i start??
Hi Berserk,
If you want your questions answered, you may try a different approach to asking, you are being a bit rude.
You must at least try to solve your problems yourself, I and most people on this forum are willing to help, however some people will just ignore you if you ask like this.
How much programming experience do you have? I think that you should have at least a year of experience where you have been spending a few hours a day programming. You need to understand the concepts of programming and problem solving before starting an OS, it really depends on how much time you have to learn programming.
With OS programming ALL beginners will need to ask many questions, however some of the questions you are asking are very easy to get answers to from a simple google search. There is nothing wrong with asking questions, but it can be very annoying when someone demands code, especially when that person shows no desire to find the information themselves, everybody, myself included, starts out demanding code from others until they realise that they are no getting as much help as others, find the thread about asking questions, it is on this forum somewhere, and read it, it will help you.
OK, now for some answers :
C Arguments are pushed onto the stack in reverse order, so a C function declared like this
void sumof(int a, int b);
and called like this
int x = sumof(5, 10);
would have asm code like this
Assigning to x is not as simple as this, but you will not need to worry about this because C will generate this code for you.
OK, First we push the arguments in reverse order, it is important to use the DWORD size type so that args smaller than a DWORD (like 5 or 10) are zero extended, then we call the function which would have been declared as external to our asm file like this
extern _sumof or [extern _sumof]
after this by C conventions the caller must clean the stack, so we simply add 8 (4 bytes per arg) to esp to allow the stack to overwrite these values. All arguments regardless of type are DWORDs (4 bytes) in 32bit PMode.
OK using the above example the sumof function would be written like this in an asm file, you will normally only be writing functions in asm and calling them from C so the above info is not needed but included for you info.
So what is this you ask:
First we push the base pointer to save it, when we use the CALL instruction it automatically saves the return address on the stack (this only applies to a flat memory, where CS has unrestricted access to all parts of memory, more than 4 bytes is pushed otherwise), so when we get to the function CALL has pushed 4 bytes, then we push 4 bytes so our arguments start 8 bytes into the stack, so we copy the stack pointer into the base pointer and use this as a reference to the arguments, this is called a stack frame, so 8 bytes into the stack is our first arg, so ebp + 8 = arg1, and add 4 bytes for every arg, so ebp + 12 = arg 2. At the end we simply pop ebp to restore the base pointer. EAX, AX, AL are used for return values, EAX for 4 byte return, AX for 2 bytes and AL for 1.
I am sorry but I cannot help you with your other questions you will have to hope that someone else is willing to help.
I hope that I have helped.
If anyone knows of an error in this please say so as I have done this without referring to any docs.
If you want your questions answered, you may try a different approach to asking, you are being a bit rude.
You must at least try to solve your problems yourself, I and most people on this forum are willing to help, however some people will just ignore you if you ask like this.
How much programming experience do you have? I think that you should have at least a year of experience where you have been spending a few hours a day programming. You need to understand the concepts of programming and problem solving before starting an OS, it really depends on how much time you have to learn programming.
With OS programming ALL beginners will need to ask many questions, however some of the questions you are asking are very easy to get answers to from a simple google search. There is nothing wrong with asking questions, but it can be very annoying when someone demands code, especially when that person shows no desire to find the information themselves, everybody, myself included, starts out demanding code from others until they realise that they are no getting as much help as others, find the thread about asking questions, it is on this forum somewhere, and read it, it will help you.
OK, now for some answers :
C Arguments are pushed onto the stack in reverse order, so a C function declared like this
void sumof(int a, int b);
and called like this
int x = sumof(5, 10);
would have asm code like this
Code: Select all
PUSH DWORD 10
PUSH DWORD 5
CALL _sumof
ADD esp, 8
MOV DWORD [x], EAX
OK, First we push the arguments in reverse order, it is important to use the DWORD size type so that args smaller than a DWORD (like 5 or 10) are zero extended, then we call the function which would have been declared as external to our asm file like this
extern _sumof or [extern _sumof]
after this by C conventions the caller must clean the stack, so we simply add 8 (4 bytes per arg) to esp to allow the stack to overwrite these values. All arguments regardless of type are DWORDs (4 bytes) in 32bit PMode.
OK using the above example the sumof function would be written like this in an asm file, you will normally only be writing functions in asm and calling them from C so the above info is not needed but included for you info.
Code: Select all
_sumof:
push ebp
mov ebp, esp
mov eax, DWORD [ebp + 8]
add eax, DWORD [ebp + 12]
pop ebp
ret
First we push the base pointer to save it, when we use the CALL instruction it automatically saves the return address on the stack (this only applies to a flat memory, where CS has unrestricted access to all parts of memory, more than 4 bytes is pushed otherwise), so when we get to the function CALL has pushed 4 bytes, then we push 4 bytes so our arguments start 8 bytes into the stack, so we copy the stack pointer into the base pointer and use this as a reference to the arguments, this is called a stack frame, so 8 bytes into the stack is our first arg, so ebp + 8 = arg1, and add 4 bytes for every arg, so ebp + 12 = arg 2. At the end we simply pop ebp to restore the base pointer. EAX, AX, AL are used for return values, EAX for 4 byte return, AX for 2 bytes and AL for 1.
I am sorry but I cannot help you with your other questions you will have to hope that someone else is willing to help.
I hope that I have helped.
If anyone knows of an error in this please say so as I have done this without referring to any docs.
Re:Where do i start??
Sorry if i was being a bit rude, thanks for the help.
But could someone please help with the other questions :'(
But could someone please help with the other questions :'(
Re:Where do i start??
global makes the identifier "_function" available for calling from other modules. i.e., from .c files and from other .asm/.s files. some assemblers require the brackets to make it a directive, but others will see it as a directive even without brackets. check your assembler's documentation.Berserk wrote:And also what does this do:
global _function
why do i see this in linked asm functions?
and what is the difference between this:
global _function
and this
[global _function]
??
What are the '[' & ']' for , i've seen them in alot of asm code??
Unreal mode is also called "v86 mode" and "voodoo mode". it is esentially real mode, but it allows full access to 32-bit memory addresses and 32-bit code. you can switch from any mode to any other mode whenever you want, but it's damned slow, so i don't see why you'd want to.One last thing, i have heard of a thing called Unreal Mode, what mode is this? what is it used for? can i see some code to intitialise it, please! And also, (i will call unreal mode UM) here is a list of questions: can i go into UM while in Real Mode??, can i go into UM while in Protected Mode? can i go into Real Mode while in UM?, can i go into Protected mode while in UM?
as for working code, there's a little something called "Google" that some people use to find such things.
yes, by directly programming the video card using ports. this requires intimate knowledge of the video card, its registers, its functions, its commands and its features. it is called "hardware acceleration." stick with using VESA until you can convince companies to write drivers for your OS.One last thing...Is there any, ANY way, to get into 800x600x256 without going into something like VESA? (any way, int 10h doesn't have to be used)
better yet, have a look at Google!Please, answer as many questions above as you can, if they don't get answered i will just keep asking them.
Re:Where do i start??
Thank you. That answers most of my questions.
Except for one.
How do i switch to Real Mode from my 'C' kernel while in Protected Mode, and how do i switch back to Real Mode after i go into PM.
As for google, everybody recomends it, i search it, i can't find anything reliable (except sometimes) and there are usally too many results.
But as for switching to RM from my kernel, i am going to try this my self, but i would appreciate if somebody could tell me how to do it.....
Except for one.
How do i switch to Real Mode from my 'C' kernel while in Protected Mode, and how do i switch back to Real Mode after i go into PM.
As for google, everybody recomends it, i search it, i can't find anything reliable (except sometimes) and there are usally too many results.
But as for switching to RM from my kernel, i am going to try this my self, but i would appreciate if somebody could tell me how to do it.....
Re:Where do i start??
Ok,
it didn't work. So could somebody please tell me how to switch to Real Mode while in Protected Mode from my kernel.
And then how to switch back.
Please, Please help...i couldn't find anything on google.
ciao
it didn't work. So could somebody please tell me how to switch to Real Mode while in Protected Mode from my kernel.
And then how to switch back.
Please, Please help...i couldn't find anything on google.
ciao
- 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??
Sorry, i have to stop propagation of false infos.grey wolf wrote: Unreal mode is also called "v86 mode" and "voodoo mode". it is esentially real mode, but it allows full access to 32-bit memory addresses and 32-bit code. you can switch from any mode to any other mode whenever you want, but it's damned slow, so i don't see why you'd want to.
v86 mode and "unreal" mode are *not* the same thing. unreal mode is a hack that allow a real-mode program to access the whole 32bits space of datas (used in games, mainly), while V86 mode is a 8086 emulation mode within protected mode (see 8086 emulation chapter in Intel docs), which is intended to provide a backward compatibility and run DOS programs in Windows 3.11, for instance ... or call BIOS from your pmode kernel. EMM386 used v86 mode to provide access to extended memory to real-mode programs without they notice they were even running in virtual mode ...
Re:Where do i start??
i was wondering that aswell, thanks for the correction mate.
do you have a solution to my other question?
do you have a solution to my other question?
Re:Where do i start??
Well I sort of have an answer, after 5 mins on yahoo.com I found this ftp://x2ftp.oulu.fi/pub/msdos/programmi ... ealmem.zip, I have been able to successfully integrate this stuff into my boot code, so now I will have no limit to the size of my kernel, I can use BIOS to load the kernel and copy it into high memory (ie: 1MB+).
I am not going to post the code I used because it was easy to do and it will serve as a good learning experience for you to implement it. It is inline asm, I am not sure what compiler, but it is not using GCC inline asm syntax, it is more like Intel syntax. So it is really just a matter of writing the code, if you do have problems after a while of trying, I will help you, I would however like to see you implement it.
Good Luck and let me know how you go.
I am not going to post the code I used because it was easy to do and it will serve as a good learning experience for you to implement it. It is inline asm, I am not sure what compiler, but it is not using GCC inline asm syntax, it is more like Intel syntax. So it is really just a matter of writing the code, if you do have problems after a while of trying, I will help you, I would however like to see you implement it.
Good Luck and let me know how you go.
Re:Where do i start??
Actually read the info on the page that I got that link from.
http://www.faqs.org/faqs/assembly-langu ... ion-1.html
http://www.faqs.org/faqs/assembly-langu ... ion-1.html