2007-04-02 14:52:01 +02:00
# include "vga.h"
2007-04-02 15:26:03 +02:00
# include "video.h"
2007-04-02 15:47:30 +02:00
# include "idt.h"
# include "timer.h"
# include "keyboard.h"
2007-04-02 16:19:44 +02:00
# include "mouse.h"
2007-04-02 15:47:30 +02:00
# include "asm.h"
2007-04-02 16:19:44 +02:00
# include "cpu.h"
# include "string.h"
2007-04-02 15:47:30 +02:00
2007-04-02 16:19:44 +02:00
# include "ansi.c"
static cpuinfo cpu ;
static u8 noproc [ ] = " \033 [31mInconnu \033 [0m \000 " ;
void ok ( )
{
static u8 okmsg [ ] = " \033 [99C \033 [8D \033 [37m \033 [1m[ \033 [32mOK \033 [37m ] \033 [0m \000 " ;
print ( okmsg ) ;
return ;
}
2007-04-02 14:52:01 +02:00
2007-04-02 15:26:03 +02:00
int _main ( void ) {
2007-04-02 16:19:44 +02:00
cli ( ) ;
2007-04-02 15:47:30 +02:00
setvmode ( 0x02 ) ;
2007-04-02 16:19:44 +02:00
/* Efface l'ecran */
print ( " \033 [2J \000 " ) ;
printf ( ansilogo ) ;
print ( " \033 [0mNoyau charge en memoire \000 " ) ;
ok ( ) ;
print ( " Initilisation de la table d'interruption \000 " ) ;
2007-04-02 15:47:30 +02:00
initidt ( ) ;
2007-04-02 16:19:44 +02:00
ok ( ) ;
print ( " Initialisation du controleur d'interruption \000 " ) ;
2007-04-02 15:47:30 +02:00
initpic ( ) ;
sti ( ) ;
2007-04-02 16:19:44 +02:00
ok ( ) ;
print ( " Installation du handler timer \000 " ) ;
setidt ( ( u32 ) timer , 0x20 , INTGATE , 32 ) ;
ok ( ) ;
print ( " Activation de l'IRQ 0 \000 " ) ;
2007-04-02 15:47:30 +02:00
enableirq ( 0 ) ;
2007-04-02 16:19:44 +02:00
ok ( ) ;
print ( " Installation du handler clavier \000 " ) ;
setidt ( ( u32 ) keyboard , 0x20 , INTGATE , 33 ) ;
ok ( ) ;
print ( " Activation de l'IRQ 1 \000 " ) ;
2007-04-02 15:47:30 +02:00
enableirq ( 1 ) ;
2007-04-02 16:19:44 +02:00
ok ( ) ;
print ( " Installation du handler souris \000 " ) ;
setidt ( ( u32 ) mouse , 0x20 , INTGATE , 100 ) ;
ok ( ) ;
print ( " Initialisation du controleur souris : \000 " ) ;
if ( initmouse ( ) = = 1 )
print ( " \033 [1m \033 [32mSouris Presente \033 [0m \000 " ) ;
else
print ( " \033 [1m \033 [31mSouris non detecte \033 [0m \000 " ) ;
ok ( ) ;
print ( " Activation de l'IRQ 2 (Controleur esclave) \000 " ) ;
enableirq ( 2 ) ;
ok ( ) ;
print ( " Activation de l'IRQ 12 \000 " ) ;
enableirq ( 12 ) ;
ok ( ) ;
strcpy ( & noproc , & cpu . detectedname ) ;
getcpuinfos ( & cpu ) ;
printf ( " Processeur detecte \r Revision \t :%d \r Modele \t :%d \r Famille \t :%d \r Nom cpuid \t :%s \r Jeux \t :%s \000 " , cpu . stepping , cpu . models , cpu . family , & cpu . detectedname , & cpu . techs ) ;
ok ( ) ;
u8 key = 0 ;
while ( 1 )
{
key = waitascii ( ) ;
putchar ( key ) ;
}
2007-04-02 15:26:03 +02:00
}
2007-04-02 15:47:30 +02:00