diff options
Diffstat (limited to 'kernel/vesa.c')
| -rw-r--r-- | kernel/vesa.c | 56 |
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++; + } + + + + + + +} |
