about the kernel

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.
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

alright the file u gave me .. it doesnt works either .. i loaded ur bootsector (fritzbootsector.asm) in the first sector and 2nd loader in sector 2 and it didnt worked ..
Tom

Re:about the kernel

Post by Tom »

thats because you loaded PMode again...here. use this as the 2nd loader and the fritzbootsector as the bootsector:

[org 0x1000]

jmp jump

jump:
jmp $ ; Does This Work?
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

well i can understand that much atleast ;) .. i didnt loaded the pmode twice i tried ur fritzbootsector with 2nd stage loader which was just showing some messages and halt the computer .. but now i have checked it with the code u gave me now for the 2nd loader and still it just reboots ... doesnt halts or do anything else .. i dont know what the heck is wrong .. have u checked this code by running it ..
well thanx for ur help .. sorry for being trouble ..
plz help me out of this
thnax
Tom

Re:about the kernel

Post by Tom »

try installing Prekernel 0.6 with out mods...and if it still doesn't work, it's your computer or partcopy(most likely)
_Tom

Re:about the kernel

Post by _Tom »

did that work?
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

:( nop it didnt worked .. also i downloaded some source codes from other sites and checked alot of them but all work fine but only the ones which set the Pmode doesnt works .. i dont know whats wrong .. :( .. it surely means that there is a problem with the computers i m working with .. but u know there are 100 or more computers in my university lab and all of them are Dell Pentium 4 latest computers.. but i dont know why they dont allow to set the pmode .. if it has some thing to do with the permissions, for that reason i checked it on my home PC (same DELL machine) and didnt worked there either .. now i dont know what to do ...
does this all stuff works on 386 or 286 etc ?? .. is it not for pentium computers ??
so what should i do now ???
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

yup :) its working now on my home pc .. may be there is some restrcition in my univ computers .. i dont know what kind of restriction is this which works on such low level ..
however thanx for ur help . ur code worked now i gotta see what i can make .. but tell me one thing .. like the way we use to show some strings on the screen in real mode .. for example

mov si,msg

Code: Select all

print:
lodsb
cmp al,0
je done
mov ah,0eh
mov bx,7
int 10h
jmp print
done:
ret
so i need to ask u will i be able to do this while in PM .. or is it gonna be different?
thanx for ur help
Tom

Re:about the kernel

Post by Tom »

you cant' use ints in PMode( the int 0x10- 0x21 or otheres )(the BIOS you can't use ).

So, load a C Kernel(mine)and use my printf.
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

hi
yeah now i know wat was the problem .. actually i was using the same real mode addressing mode in pmode thats why it was not working (i guess so) but now without that everything is working fine .. ok done with the boot loader and pmode and gdt stuff .. now can u suggest me about what should i study now .. i think Interrupts comes after this that IDT.. ??
by the way just wanted to tell u that i m not using ur source code in a sense that i m not making anything .. i am just learning all this and for that i m using ur code ..
so my question is what should i go for next ? (always a beginner question ;) )
thanx for ur help
Tom

Re:about the kernel

Post by Tom »

You should load a C Kernel. Mine or someone elses. That's how you learn. Useing someone elses code and then changing it to your own way. I got some of my printf from abless's (I learned from it, I just ddin't copy/paste).

Load a C Kernel. Use someone else's printf. If that works, make your own other C functions.

That's how you learn. Once you have a C Kernel loaded and a putch, make a printf (look at my code).

You will also need a getch, and a gotoxy and a update_cursor(look at fstdio.h in my code).

Hope that helps, and don't worrie about the IDT untill your OS is at my point, at least...
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

ok now for the C kernel i have a few questions in mind:
1. first of all i was thinking that as we write this C code for our operating system .. is it possible that we could see the output of this C program in windows coz its just a C program it should work in windows or Dos.. thats what i thought and i tried to compile this code:

Code: Select all

char message[]="Hello world";
int main(void){
char* dest=(char *)0Xb8000;
char* src=message;
while(*src){
*dest++=*src++;
*dest++=7;
}
return 0;
}
and i was using DJGPP and i when i run that it didnt showed anything .. why is that ?

2. secondly i m confused about the header files .. coz C files are changed to binary files but header files are just text files .. how does computer understands them or do we have to change them to binary too ??

3. what environment is better to make and compile these C programs and change them to binary
thanx
Tom

Re:about the kernel

Post by Tom »

Linux I think is better for OS Dev...

don't you know what executable file format's are? Win and dos can't run .bin files made with DJGPP(even it can't run .bin files renamed to .exe or .com)

The compiler makes a executable file for the OS you select. Binary is for just place code for the computer without and OS(your OS). .exe and .com are for windows and dos.
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

i know that win and dos cant run .bin thats why i compiled this code to .o first and then with ld i made an exe file of this...but still it didnt showed anything .. what i was thinking is that may be like in this program we are straight away pointing 2wards the video memory ... may be this is not allowed in windows or something like that i m not sure..
Tom

Re:about the kernel

Post by Tom »

yea...I bet that's the prob...use the built in printf with your compiler(i.e. include DJGPP's stdio.h) and use that printf untill your ready to test yours on a floppy.
adeelmahmood1

Re:about the kernel

Post by adeelmahmood1 »

alright ..
well u missed one of my question.. about the header files .. like for example for ur fritz OS u have all these header files which has the actual definations for the functions so i m asking u that like we write the boot.asm and kernel32.c on the sectors of floppy in binary format .. is this the same we do with the header files (.h) or something else
Post Reply