About the bootsector...
About the bootsector...
Hi, I'm the new guy
Okay, so before I start let me tell you that I have 5 yesrs of experience in C/C++ and 3 months in ASM ( But I'm a fast learner - I know that [ax] is a pointer to ax !; acually I leanrd it while looking at MS Vc++ disasembly ). But I fell quite at home with the intel-like syntax of NASM.
Soooo... I worte a small bootsector that prints "Hello world" and detects what kind of CPU you have (8086, 286, 386+). But now I want to do more.
I'll limit my post to a few questions beacuse I really want to understand this before going and writting other parts of my os...
So I would like to know if it's best to do a much as possible in the bootsector or a little as possible. I would also like to know where should I enable pMode ? In the bootsector (I don't want my OS to switch modes in run-time; it will always be in pMode). And how do I enable pMode and, from ASM, how do I call a 'C' function. I understant I must go a global _myCFoo and that the params are in revers order but how is it done in real-life ?
Thanks for all your comments/answers/links.
Oh, btw, if you must know; I'm 17 and I come form Canada, Quebec.
Okay, so before I start let me tell you that I have 5 yesrs of experience in C/C++ and 3 months in ASM ( But I'm a fast learner - I know that [ax] is a pointer to ax !; acually I leanrd it while looking at MS Vc++ disasembly ). But I fell quite at home with the intel-like syntax of NASM.
Soooo... I worte a small bootsector that prints "Hello world" and detects what kind of CPU you have (8086, 286, 386+). But now I want to do more.
I'll limit my post to a few questions beacuse I really want to understand this before going and writting other parts of my os...
So I would like to know if it's best to do a much as possible in the bootsector or a little as possible. I would also like to know where should I enable pMode ? In the bootsector (I don't want my OS to switch modes in run-time; it will always be in pMode). And how do I enable pMode and, from ASM, how do I call a 'C' function. I understant I must go a global _myCFoo and that the params are in revers order but how is it done in real-life ?
Thanks for all your comments/answers/links.
Oh, btw, if you must know; I'm 17 and I come form Canada, Quebec.
Re:About the bootsector...
want PMode and a C kernel loaded with your bootsector? look at my web site and download pk0.6. look at boot.asm ( it loads my C kernel, sets Pmode and a GDT )
I use elf so I don't need the _'s in my kernel linked with asm.
It's best to do as much as possible in a bootsector...at least for my OS, FritzOS.
But it's all your idea...( I do as much as possible for easy coding )
Check FritzOS and see if it helps...
I use elf so I don't need the _'s in my kernel linked with asm.
It's best to do as much as possible in a bootsector...at least for my OS, FritzOS.
But it's all your idea...( I do as much as possible for easy coding )
Check FritzOS and see if it helps...
Re:About the bootsector...
Thanks !
I rewote all of your functions and splitted in 6 files and it still works !!!. I'll start the keyboard driver now !
Thanks again ! ;D ;D
I rewote all of your functions and splitted in 6 files and it still works !!!. I'll start the keyboard driver now !
Thanks again ! ;D ;D
Re:About the bootsector...
Are you making the keyboard driver with a IDT? if so...I would like the code... ;D
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:About the bootsector...
hum ... i'm afraid you're wrong on that point! [ax] is by no way a pointer: it is a memory region addressed by ax. So maybe we could tell ax is a pointer to [ax] but that would still be weird-sounding in a low-level language where there's no type and therefore no pointer type ...Yoshy wrote: ( But I'm a fast learner - I know that [ax] is a pointer to ax !; acually I leanrd it while looking at MS Vc++ disasembly ).
Re:About the bootsector...
as long as the concept is understood, what use are semantics?
Re:About the bootsector...
times 1000 MOV AX, BX
times 1000 MOV AX, [Somewhere in memory]
If they match in execution time then I'll eat my hat (Have to go buy one first of course ). Knowing about the existence of registers is...err...kinda important if you wander into assembly language.
Curufir
times 1000 MOV AX, [Somewhere in memory]
If they match in execution time then I'll eat my hat (Have to go buy one first of course ). Knowing about the existence of registers is...err...kinda important if you wander into assembly language.
Curufir
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:About the bootsector...
funny enough, they *could* almost match in execution time, as the very first mov ax,[mem] will make [mem] to be in cache and reading from the cache will probably require just 1 cycle - as reading from a register do
Re:About the bootsector...
Pype.Clicker has a very valid point -- accessing the L1 cache on modern CPUs is as quick as accessing registers.
Re:About the bootsector...
Ahh, but those 2 extra cycles (Or is it 3, can't remember) for the first reference are saving me from hat eating...which is lucky, I'm out of tomato sauce ;D.
Curufir
Curufir