summaryrefslogtreecommitdiff
path: root/kernel/vesa.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-08-27 14:24:42 +0200
committerMichal Idziorek <m.i@gmx.at>2014-08-27 14:24:42 +0200
commit5e48d8259fb2857ad4441de77cbacddd50a21ec0 (patch)
treeec10871a799b6d1ab1c3fff7d275714b5af22632 /kernel/vesa.c
parentced08dbfa11aee29a2f6f6801de243f4a160e5a1 (diff)
added bitmap fonts and put string for vesa modes
Diffstat (limited to 'kernel/vesa.c')
-rw-r--r--kernel/vesa.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/kernel/vesa.c b/kernel/vesa.c
index 93a42f3..b1a298f 100644
--- a/kernel/vesa.c
+++ b/kernel/vesa.c
@@ -38,6 +38,14 @@ typedef struct ModeInfoBlock {
static vbemodeinfo *VbeModeInfoBlock;
+
+typedef struct foolfont_struct
+{
+ uint8_t line[10]; //every single fool font consists of 10 lines a 8 bit
+
+}foolfont;
+
+
void vesa_init(vbeinfo *info,vbemodeinfo *mode)
{
int i=0;
@@ -109,3 +117,51 @@ void PutPixel(int x,int y, int color){
cTemp[x+y+2] = (uint8_t)((color>>16) & 0xff);
}
+void PutFont(foolfont *font , char c, int x,int y, int color)
+{
+ int fnt=0;
+
+
+ if(c>='A'&&c<='Z')fnt=c-'A'+1;
+ else if(c>='a'&&c<='z')fnt=c-'a'+1;
+ else if(c>='0'&&c<='9')fnt=c-'0'+28;
+ else if(c=' ')fnt=27;
+
+
+ int posx, posy, sizex=8, sizey=10;
+
+ for(posx=x;posx<x+sizex;posx++)
+ for(posy=y;posy<y+sizey;posy++)
+ {
+ if(font[fnt].line[posy-y]&1<<(7-(posx-x)))
+ {
+ PutPixel(posx,posy,color);
+ }
+ else
+ {
+ PutPixel(posx,posy,0);
+ }
+
+ }
+
+
+
+}
+
+void PutString(foolfont *font , char *str, int x,int y, int color)
+{
+
+ int i=x;
+ while((*str)!=0)
+ {
+ PutFont(font ,*str, i,y, color);
+ i+=9; // spacing
+ str++;
+ }
+
+
+
+
+
+
+}