Help With Patricknet Development

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.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Help With Patricknet Development

Post by Troy Martin »

What exactly do you want to learn? PM me and I'll see what I can do.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: Help With Patricknet Development

Post by M-Saunders »

PatrickV wrote:Can anyone give me links to webiste or operating system i can learn of from. os wiki and members are not helping and i need something to learn from
There is a HUGE amount of information out there Patrick. If you want to write a simple, real mode operating system, my project will help. I've put a lot of work into the Handbook, and the "Making your own OS" section teaches you the basics of assembly language, PC booting, and making a micro bootloader-OS:

http://mikeos.berlios.de/handbook.html#makeintro

That's just the absolute basics. Once you're familiar with that, try the bigger projects and tutorials written by the very knowledgeable folks here and elsewhere -- eg bkerndev is an excellent place to start. JamesM's tutorials are great. DexOS has a lot of valuable assembly code. Brendan provides a great deal of knowledge.

So we ARE helping; we are providing lots of stuff you can use to learn from. But you are taking on one of the most difficult challenges in programming, seemingly without much programming history, so why are you surprised that it's difficult? OS development is VERY hard. It requires a lot of patience and knowledge -- we all make false starts like Troy says.

If you want to be an OS developer, you have to read, study and try a lot of code. It's always going to be hard. I still say good luck, but you may be diving in at the deep end without knowing how to swim!

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Help With Patricknet Development

Post by PatrickV »

Thanks for all the support that you all of u guys given me. I've done as far as the basics of my knowledge will let me. You are guy are right, it is getting harder. For those you are wondering what my skill base level in programming is that average good in Visual Basic 4. As i was saying before i am learning c and do have programming background not in c though. I know BASIC and very little of c++. I can post my source code what i have done so far if you want to look at it. Only got to the printing, clearing, updating cusor part.
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: Help With Patricknet Development

Post by M-Saunders »

PatrickV wrote:i am learning c and do have programming background not in c though.
Then good luck with your C learning! But trying to write an OS in C, when you're new to the language, is going to be impossible. It's like taking a "Learn French in 60 minutes" audio course, and then attempting to translate a French thesis on the economic benefits of renewable power sources into English. It just isn't going to happen -- it takes many months, usually years, of work.

To write an OS in C, you will have to be a very good C programmer. Given that you're new to C, you simply can't take on such a monumental work now. Remember that C itself doesn't really do much; you need the standard libraries to get input/output, perform math operations and so forth. You don't have any of those in your own OS until you port a C library (which is absolutely ages away from your current point).

So basically, you're starting from nothing, with no knowledge of the target language -- I'm afraid it's nigh-on impossible Patrick! You absolutely need to learn C: get a good book, write programs and get a solid grasp of the language (especially memory management and pointers). Then you'll be ready to take the first steps in OS development without the support of libraries that you get when coding on a regular OS platform.

Otherwise you'll forever remain in the same position -- the same place you've been for months. Code or knowledge isn't going to appear out of nowhere. This is hard work, and demands a LOT of investment of your time and learning.

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Help With Patricknet Development

Post by Combuster »

Have you found the FreeBasic Barebones yet? </shameless plug>

With your background that may just work out.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
XFire
Posts: 5
Joined: Mon Nov 17, 2008 10:34 am
Location: Cambridgeshire - UK

Re: Help With Patricknet Development

Post by XFire »

I have no idea if you have not read this, but http://www.osdever.net/bkerndev/Docs/keyboard.htm provides you with the code that is a keyboard driver, whether it is complete or not I do not know.

What architecture are you using? If you were to use 16 bit as MikeOS does, you do not need to write a keyboard driver as it is passed on from the BIOS so you would not have to spend time trying to work it out. Also, MikeOS uses assembly, which you have stated that you are more familiar with, it also uses DOS which I believe you stated that you wanted / are going to use later on. So like Mike said, viewing his code and documentation maybe very helpful for you.

Don't stake complete validity from what I have said, I am just going on by what I have read. :)
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: Help With Patricknet Development

Post by M-Saunders »

That's my goal, XFire, and I hope it helps people. Sure, it doesn't lead to a 'serious' OS as it doesn't delve into C/32-bit/protected mode, but as a first project (to understand how an OS fits together and the challenges involved) I hope it provides a good foothold.

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Help With Patricknet Development

Post by PatrickV »

Thanks xfire. I had a look at that. But i am not sure if it is finished or complete or not. If it is i don't know where to put into my kernel. I am using c. Thanks combutser. I have the backgroung under control. It took me a while to program clear screen methods twice. I am going to post my source code which is for the whole community to make comments and changes to. This is what I have done so far.

Code: Select all

/* Patricknet Kernel*/
// Include files of Library's created for Patricknet
#include "colourcode.h"

#define UCHAR unsigned char
#define USHORT unsigned short
// Loading begins here of kernel
inline void outportb(unsigned int port,unsigned char value);

void clear_screen();
void set_header();
unsigned int print_header(char *message, unsigned int line);
unsigned int print_text(char *message, unsigned int line);
void update_cursor(int row, int col);

kmain()
{
	clear_screen();
	set_header();
	print_header("Patricknet", 0);
	print_text("Beta 0.2 - 16.11.2008",1);
	update_cursor(2, 0);
};

void clear_screen() // This clears the whole screen with: BLUE_LIGHTRED
{
	char *vidmem = (char *) 0xb8000;
	unsigned int i=0;
	while(i<(80*2*25))
	{
		vidmem[i]=' ';
		i++;
		vidmem[i]=BLUE_LIGHTRED;
		i++;
	};
};
void set_header() // setup of header background
{
	char *vidmem = (char *) 0xb8000;
	unsigned int i=0;
	while(i<(80*2*1))
	{
		vidmem[i]=' ';
		i++;
		vidmem[i]=LIGHTGRAY_BLACK;
		i++;
	};
};

unsigned int print_header(char *message, unsigned int line) // This prints a header to screen
{
	char *vidmem = (char *) 0xb8000;
	unsigned int i=0;

	i=(line*80*2);

	while(*message!=0) // 24h
	{
		if(*message==0x2F)
		{
			*message++;
			if(*message==0x6e)
			{
				line++;
				i=(line*80*2);
				*message++;
				if(*message==0)
				{
					return(1);
				};
			};
		};
		vidmem[i]=*message;
		*message++;
		i++;
		vidmem[i]=LIGHTGRAY_BLACK;
		i++;
	};

	return(1);
};
unsigned int print_text(char *message, unsigned int line) // This prints txt to screen
{
	char *vidmem = (char *) 0xb8000;
	unsigned int i=0;

	i=(line*80*2);

	while(*message!=0) // 24h
	{
		if(*message==0x2F)
		{
			*message++;
			if(*message==0x6e)
			{
				line++;
				i=(line*80*2);
				*message++;
				if(*message==0)
				{
					return(1);
				};
			};
		};
		vidmem[i]=*message;
		*message++;
		i++;
		vidmem[i]=BLUE_LIGHTRED;
		i++;
	};

	return(1);
};

inline void outportb(unsigned int port,unsigned char value)  // Output a byte to a port
{
    asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
};


void update_cursor(int row, int col)  // This Changes Cursor Postion
{
	USHORT	position=(row*80) + col;
	// cursor LOW port to vga INDEX register
	outportb(0x3D4, 0x0F);
	outportb(0x3D5, (UCHAR)(position&0xFF));
	// cursor HIGH port to vga INDEX register
	outportb(0x3D4, 0x0E);
	outportb(0x3D5, (UCHAR)((position>>8)&0xFF));
};


PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Libraries Help

Post by PatrickV »

Hey. I noticed that people are very angry with me. Don't be. The whole problem is that i am object orninated and working with libraries. The problem that i had is to write my own libraries. Have you got any pointers about used precreated libraries. I had a look on wiki, but i check with you guys first if i can used pre compiled libraries than writing my own
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Help With Patricknet Development

Post by 01000101 »

If you aren't concerned about proprietary/home-brew licensing, you could check out uCLib and related C libraries that handle the core functions.
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Help With Patricknet Development

Post by PatrickV »

Thanks. uCLib, i must of stumble into at wiki and didn't get anywhere.. But thanks anyway. I will look into it.
Post Reply