BAsic Kernel
Posted: Fri Jul 10, 2009 8:01 pm
Well i followed this tutorial : http://74.125.155.132/custom?q=cache:d4 ... 1971271392
it's also a pdf..
but i get these errors when compiling kernel.cpp to kernel.o using the g++ compiler
error:
=============================
In file included from Kernel.cpp:1:
Video.h:8: error: ‘Video::Video()’ cannot be overloaded
Video.h:7: error: with ‘Video::Video()’
=============================
this is my code :
Kernel.cpp
=============================
#include "Video.h"
int main(void)
{
Video vid;
vid.write("Hello, world!");
}
============================
Video.h
============================
#ifndef VIDEO_H
#define VIDEO_H
class Video
{
public:
Video();
Video();
void clear() ;
void write(const char *cp) ;
void put(const char c) ;
private:
unsigned short *videomem ; //pointer to video memory
unsigned int off ; //offset, used like a y cord
unsigned int pos ; //position, used like x cord
}; //don't forget the semicolon!
#endif
===========================
Video.cpp
===========================
#include "Video.h"
Video::Video()
{
pos=0 ; off=0 ;
videomem = (unsigned short*) 0xb8000 ;
}
Video::Video()
void Video::clear()
{
unsigned int i;
for(i=0; i<(80*25); i++)
{
videomem = (unsigned const char) ' ' | 0x0700 ;
}
pos=0 ; off=0 ;
}
void Video::write(const char *cp)
{
const char *str = cp, *ch;
for (ch = str; *ch; ch++)
{
put(*ch) ;
}
}
void Video::put(char c)
{
if(pos>=80)
{
pos=0 ;
off += 80 ;
}
if(off>=(80*25))
{
clear() ;
clear
}
videomem[off + pos] = (unsigned const char) c | 0x0700 ;
pos++ ;
}
==============================
Please Help Thanks!!!!!!!!!
website : http://qwiic.homelinux.com
it's also a pdf..
but i get these errors when compiling kernel.cpp to kernel.o using the g++ compiler
error:
=============================
In file included from Kernel.cpp:1:
Video.h:8: error: ‘Video::Video()’ cannot be overloaded
Video.h:7: error: with ‘Video::Video()’
=============================
this is my code :
Kernel.cpp
=============================
#include "Video.h"
int main(void)
{
Video vid;
vid.write("Hello, world!");
}
============================
Video.h
============================
#ifndef VIDEO_H
#define VIDEO_H
class Video
{
public:
Video();
Video();
void clear() ;
void write(const char *cp) ;
void put(const char c) ;
private:
unsigned short *videomem ; //pointer to video memory
unsigned int off ; //offset, used like a y cord
unsigned int pos ; //position, used like x cord
}; //don't forget the semicolon!
#endif
===========================
Video.cpp
===========================
#include "Video.h"
Video::Video()
{
pos=0 ; off=0 ;
videomem = (unsigned short*) 0xb8000 ;
}
Video::Video()
void Video::clear()
{
unsigned int i;
for(i=0; i<(80*25); i++)
{
videomem = (unsigned const char) ' ' | 0x0700 ;
}
pos=0 ; off=0 ;
}
void Video::write(const char *cp)
{
const char *str = cp, *ch;
for (ch = str; *ch; ch++)
{
put(*ch) ;
}
}
void Video::put(char c)
{
if(pos>=80)
{
pos=0 ;
off += 80 ;
}
if(off>=(80*25))
{
clear() ;
clear
}
videomem[off + pos] = (unsigned const char) c | 0x0700 ;
pos++ ;
}
==============================
Please Help Thanks!!!!!!!!!
website : http://qwiic.homelinux.com