diff --git a/src/sys/drivers/video.c b/src/sys/drivers/video.c index 3474cb9..b2e0015 100755 --- a/src/sys/drivers/video.c +++ b/src/sys/drivers/video.c @@ -9,7 +9,7 @@ #include unsigned char *videoBuffer = (char *)0xB8000; -int printColor = 0x07; +int printColor = defaultColor; void kprint(char *string) { unsigned int bufferOffset = 0,character = 0,i = 0; @@ -48,4 +48,19 @@ outportByte(0x3d5, bufferOffset & 0x0ff); outportWord(0x3d4, 0x0e); outportByte(0x3d5, bufferOffset >> 8); + } + +/* Clears The Screen */ +void clearScreen() { + unsigned int i; + for (i = 0; i < (80*25); i++) { /* Fill the screen with */ + /* background Color */ + videoBuffer[i*2] = 0x20; + videoBuffer[i*2+1] = defaultColor; + } + + outportByte(0x3d4, 0x0f); /* Set the cursor to the */ + outportByte(0x3d5, 0); /* upper-left corner of the */ + outportWord(0x3d4, 0x0e); /* screen */ + outportByte(0x3d5, 0); } \ No newline at end of file diff --git a/src/sys/include/drivers/video.h b/src/sys/include/drivers/video.h index 98763c4..1a5ff8c 100755 --- a/src/sys/include/drivers/video.h +++ b/src/sys/include/drivers/video.h @@ -8,9 +8,12 @@ #ifndef _VIDEO_H #define _VIDEO_H +#define defaultColor 0xF0 + extern int printColor; void kprint(char *string); int kprintf(const char *fmt, ...); +void clearScreen(); #endif \ No newline at end of file diff --git a/src/sys/include/stdarg.h b/src/sys/include/stdarg.h index bf7b3ae..df1c4e9 100755 --- a/src/sys/include/stdarg.h +++ b/src/sys/include/stdarg.h @@ -1,37 +1,18 @@ /************************************************************************************** -$Id$ + Copyright (c) 2002 + The UbixOS Project - + $Id$ **************************************************************************************/ -#ifndef _STDARG_H -#define _STDARG_H +#ifndef _ULIBC_STDARG_H +#define _ULIBC_STDARG_H -typedef char *va_list; +typedef char *vaList; -/* Amount of space required in an argument list for an arg of type TYPE. - TYPE may alternatively be an expression whose type is used. */ - -#define __va_rounded_size(TYPE) \ - (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) - -#ifndef __sparc__ -#define va_start(AP, LASTARG) \ - (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) -#else -#define va_start(AP, LASTARG) \ - (__builtin_saveregs (), \ - AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) -#endif - -void va_end (va_list); /* Defined in gnulib */ +#define _vaSize(TYPE) (((sizeof(TYPE) + sizeof(int) -1) / sizeof(int)) * sizeof(int)) +#define va_start(AP, LASTARG) (AP=((vaList)&(LASTARG) + _vaSize(LASTARG))) #define va_end(AP) +#define va_arg(AP, TYPE) (AP += _vaSize(TYPE), *((TYPE *)(AP - _vaSize(TYPE)))) -#define va_arg(AP, TYPE) \ - (AP += __va_rounded_size (TYPE), \ - *((TYPE *) (AP - __va_rounded_size (TYPE)))) - - -int vsprintf(char *buf, const char *fmt, va_list args); - -#endif /* _STDARG_H */ +#endif \ No newline at end of file diff --git a/src/sys/include/version/version.h b/src/sys/include/version/version.h index 2749a8e..620418e 100755 --- a/src/sys/include/version/version.h +++ b/src/sys/include/version/version.h @@ -8,7 +8,7 @@ #ifndef _VERSION_H #define _VERSION_H -#define ubixVersion "0.01a" +#define ubixosVersion "0.01a" void outputVersion(); diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 5507f3d..dcdb3f6 100755 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -8,6 +8,7 @@ #include #include #include +#include int main(); @@ -58,6 +59,7 @@ */ int main() { + clearScreen(); outputVersion(); //Display Version Info return(0); } \ No newline at end of file diff --git a/src/sys/kernel/kprintf.c b/src/sys/kernel/kprintf.c index 29d0127..000c711 100755 --- a/src/sys/kernel/kprintf.c +++ b/src/sys/kernel/kprintf.c @@ -8,13 +8,16 @@ #include #include +int vsprintf(char *buf, const char *fmt, vaList args); + int kprintf(const char *fmt, ...) { - va_list args; + vaList args; int i; char buf[1024]; va_start(args, fmt); i=vsprintf(buf,fmt,args); va_end(args); kprint(buf); + printColor = defaultColor; return(i); } \ No newline at end of file diff --git a/src/sys/kernel/version.c b/src/sys/kernel/version.c index 6d73777..f9ff31c 100755 --- a/src/sys/kernel/version.c +++ b/src/sys/kernel/version.c @@ -9,6 +9,22 @@ #include void outputVersion() { - kprintf("Copyright (c) 2002 - The UbixOS Project\n"); - kprintf("Woot"); + // 0x00 - Black + // 0x01 - Blue + // 0x02 - Green + // 0x03 - Teal + // 0x04 - Red + // 0x05 - Purple + // 0x06 - Brown + // 0x07 - Grey + // 0x08 - Charcole + // 0x09 - Light Blue + // 0x0A - Light Green + // 0x0B - Aqua + // 0x0C - Light Red + // 0x0D - Light Purple + // 0x0E - Yellow + // 0x0F - White + kprintf("%zUbixOS v%s\n",0xF1,ubixosVersion); + kprintf("%zCopyright (c) 2002 - The UbixOS Project\n",0xFB); } diff --git a/src/sys/kernel/vsprintf.c b/src/sys/kernel/vsprintf.c index 37864c5..21bdb92 100755 --- a/src/sys/kernel/vsprintf.c +++ b/src/sys/kernel/vsprintf.c @@ -10,6 +10,7 @@ */ #include +#include //#include /* we use this so that we can do without the ctype library */ @@ -55,9 +56,10 @@ } else sign=(type&PLUS) ? '+' : ((type&SPACE) ? ' ' : 0); if (sign) size--; - if (type&SPECIAL) + if (type&SPECIAL) { if (base==16) size -= 2; else if (base==8) size--; + } i=0; if (num==0) tmp[i++]='0'; @@ -70,12 +72,13 @@ *str++ = ' '; if (sign) *str++ = sign; - if (type&SPECIAL) + if (type&SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; + } } if (!(type&LEFT)) while(size-->0) @@ -89,7 +92,7 @@ return str; } -int vsprintf(char *buf, const char *fmt, va_list args) +int vsprintf(char *buf, const char *fmt, vaList args) { int len; int i; @@ -216,6 +219,11 @@ ip = va_arg(args, int *); *ip = (str - buf); break; + + //Font Color Added By Ubu + case 'z': + printColor = va_arg(args, int); + break; default: if (*fmt != '%') diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 0222f96..9a2338c 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -251,7 +251,7 @@ type=DATA [src/sys/kernel/Makefile.am] -files=src/sys/kernel/Makefile,src/sys/kernel/io.c,src/sys/kernel/version.c,src/sys/kernel/kprintf.c +files=src/sys/kernel/Makefile,src/sys/kernel/io.c,src/sys/kernel/version.c,src/sys/kernel/kprintf.c,src/sys/kernel/vsprintf.c sub_dirs= type=static_library @@ -272,3 +272,9 @@ install=false install_location= type=SOURCE + +[src/sys/kernel/vsprintf.c] +dist=true +install=false +install_location= +type=SOURCE