fix: correction conversion EGA->RGB et decodage caractère...Reste bogue

This commit is contained in:
Nicolas Hordé 2018-10-14 16:18:51 +02:00
parent ba7361eae6
commit 09e4ebbb38
6 changed files with 31 additions and 15 deletions

View File

@ -24,3 +24,4 @@ int disas(u8* commandline);
int bpset(u8* commandline); int bpset(u8* commandline);
int bpclr(u8* commandline); int bpclr(u8* commandline);
int help(); int help();
int logo();

View File

@ -94,7 +94,7 @@ u8 getattrib (u16 coordx, u16 coordy);
void writepxl (u16 x, u16 y, u32 color); void writepxl (u16 x, u16 y, u32 color);
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color); void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color);
void changemode(u8 mode); void changemode(u8 mode);
u32 vgatorgb(u8 ega); u32 egatorgb(u8 ega);
u8 egatovga(u8 ega); u8 egatovga(u8 ega);
/* Fonctions de console */ /* Fonctions de console */

View File

@ -30,4 +30,4 @@ u8 ansilogo[]="\
\xB3\033[0m\033[6C\033[1mF1-F8\033[30m Consoles virtuelles \033[37mF9\033[30m Debug \033[37mF10\033[30m Mode graphique \033[37mF11\033[30m Aide\033[0m\033[9C\033[1;30m\xB3\r\n\ \xB3\033[0m\033[6C\033[1mF1-F8\033[30m Consoles virtuelles \033[37mF9\033[30m Debug \033[37mF10\033[30m Mode graphique \033[37mF11\033[30m Aide\033[0m\033[9C\033[1;30m\xB3\r\n\
\xB3\033[0m\033[77C\033[1;30m\xB3\r\n\ \xB3\033[0m\033[77C\033[1;30m\xB3\r\n\
\xB3\033[0m Developpe par \033[5;1;47mMrNop\033[0m\033[55C\xB3\r\n\ \xB3\033[0m Developpe par \033[5;1;47mMrNop\033[0m\033[55C\xB3\r\n\
\xC0\033[1;30m\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\033[0m\xC4\033[1;30m\xC4\033[0m\xC4\xC4\033[1m\xD9\r\n\r\n"; \xC0\033[1;30m\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\033[0m\xC4\033[1;30m\xC4\033[0m\xC4\xC4\033[1m\xD9\033[0m\r\n\r\n";

View File

@ -13,6 +13,7 @@
#include "multiboot2.h" #include "multiboot2.h"
#include "math.h" #include "math.h"
#include "debug.h" #include "debug.h"
#include "VGA/ansi.c"
static command commands[] = { static command commands[] = {
{"reboot" , "", &rebootnow}, {"reboot" , "", &rebootnow},
@ -31,6 +32,7 @@ static command commands[] = {
{"bpset" , "", &bpset}, {"bpset" , "", &bpset},
{"bpclr" , "", &bpclr}, {"bpclr" , "", &bpclr},
{"help" , "", &help}, {"help" , "", &help},
{"logo" , "", &logo},
}; };
/*******************************************************************************/ /*******************************************************************************/
@ -70,6 +72,15 @@ int test(void)
return; return;
} }
/*******************************************************************************/
/* Affiche le logo */
int logo()
{
print(ansilogo);
return;
}
/*******************************************************************************/ /*******************************************************************************/
/* Renvoie les commandes disponibles */ /* Renvoie les commandes disponibles */

View File

@ -1051,15 +1051,22 @@ void showchar(u16 coordx, u16 coordy, u8 thechar, u8 attrib)
pattern = font8x8[(thechar<<3) + y]; pattern = font8x8[(thechar<<3) + y];
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
rol(pattern);
set = pattern & 0x1; set = pattern & 0x1;
if (set == 0) if (set == 0)
color = egatovga((attrib & 0xF0) >> 8); if (vinfo->currentdepth==32)
color = egatorgb((attrib & 0xF0) >> 8);
else
color = egatovga((attrib & 0xF0) >> 8);
else else
color = egatovga(attrib & 0x0F); if (vinfo->currentdepth==32)
if (vinfo->currentdepth==32) color = egatorgb(attrib & 0x0F);
color = vgatorgb(color); else
color = egatovga(attrib & 0x0F);
writepxl((coordx<<3) + x, (coordy<<3) + y, color); writepxl((coordx<<3) + x, (coordy<<3) + y, color);
rol(pattern);
} }
} }
} }
@ -1078,13 +1085,11 @@ u8 egatovga(u8 ega)
/******************************************************************************/ /******************************************************************************/
/* Retourne une couleur RGB 32 bits depuis une couleur EGA/VGA */ /* Retourne une couleur RGB 32 bits depuis une couleur EGA/VGA */
u32 vgatorgb(u8 vga) static convertrgb[]={0x000000,0x0000AA,0x00AA00,0x00AAAA,0xAA0000,0xAA00AA,0xAA5500,0xAAAAAA,0x555555,0x5555FF,0x55FF55,0x55FFFF,0xFF5555,0xFF55FF,0xFFFF55,0xFFFFFF};
u32 egatorgb(u8 vga)
{ {
if (vga==0) return 0; return convertrgb[vga & 0xF];
u8 red = 85 * (((vga >> 4) & 2) | (vga >> 2) & 1);
u8 green = 85 * (((vga >> 3) & 2) | (vga >> 1) & 1);
u8 blue = 85 * (((vga >> 2) & 2) | vga & 1);
return (red<<16)+(green<<8)+blue+(0x0<<24);
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -12,7 +12,6 @@
#include "cpu.h" #include "cpu.h"
#include "string.h" #include "string.h"
#include "2d.h" #include "2d.h"
#include "ansi.c"
#include "gdt.h" #include "gdt.h"
#include "shell.h" #include "shell.h"
#include "syscall.h" #include "syscall.h"
@ -56,7 +55,7 @@ int main(u32 magic, u32 addr)
/* Efface l'ecran */ /* Efface l'ecran */
print("\033[2J\r\n\000"); print("\033[2J\r\n\000");
print(ansilogo); logo();
print("\033[37m\033[0m -Chargement noyaux"); print("\033[37m\033[0m -Chargement noyaux");
ok(); ok();