Fix printing in kernel
This commit is contained in:
parent
770e040383
commit
8774b20356
|
@ -76,8 +76,8 @@ int Main(void) {
|
|||
InternalBuffer = (char*) kmalloc(4096);
|
||||
SerialPrintf("[ Mem] Allocated a text buffer at 0x%p\r\n", (size_t) InternalBuffer);
|
||||
|
||||
WriteString("\\${FF0000}C\\${<green>}h\\${<blue>}r\\${FFFF00}o\\${FF00FF}m\\${FFFF}a ");
|
||||
WriteString("\\${FFFFFF}T\\${AAAA}i\\${BBBBBB}m\\${<forgeb>}e\\${<forgey>}!\n");
|
||||
Printf("\\${FF0000}C\\${<green>}h\\${<blue>}r\\${FFFF00}o\\${FF00FF}m\\${FFFF}a ");
|
||||
Printf("\\${FFFFFF}T\\${AAAA}i\\${BBBBBB}m\\${<forgeb>}e\\${<forgey>}!\n");
|
||||
|
||||
SetForegroundColor(0x00FFFFFF);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ size_t strlen(const char* String) {
|
|||
bool strcmp(char* a, const char* b) {
|
||||
size_t aI = 0, bI = 0;
|
||||
while(true) {
|
||||
if(b[bI] == '\0') return true;
|
||||
if(a[aI] != b[bI]) return false;
|
||||
if(a[aI] == '\0') return true;
|
||||
aI++;
|
||||
bI++;
|
||||
}
|
||||
|
|
|
@ -202,23 +202,24 @@ int Printf(const char* Format, ...) {
|
|||
switch(*Format) {
|
||||
case '$': {
|
||||
// COLOR
|
||||
Format ++; // Skip $ and {
|
||||
Format ++; // Skip $
|
||||
size_t Color = 0;
|
||||
bool bgFlag = false;
|
||||
|
||||
switch(*Format) {
|
||||
case '[':
|
||||
// bg
|
||||
bgFlag = true;
|
||||
[[fallthrough]];
|
||||
// bg
|
||||
case '{':
|
||||
// fg
|
||||
Format++;
|
||||
Format++; // [ or {
|
||||
|
||||
if(*Format == '<') {
|
||||
Color = ParseEnglishColor((char*) ++Format);
|
||||
Format++;
|
||||
Color = ParseEnglishColor((char*) Format);
|
||||
} else {
|
||||
Color = ParseHexColor(++Format, bgFlag);
|
||||
Color = ParseHexColor(Format, bgFlag);
|
||||
}
|
||||
|
||||
if(bgFlag)
|
||||
|
@ -226,20 +227,18 @@ int Printf(const char* Format, ...) {
|
|||
else
|
||||
SetForegroundColor(Color);
|
||||
|
||||
Format++;
|
||||
while(*Format != '}')
|
||||
Format++;
|
||||
Format++; // }
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Format++;
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
// FORMAT
|
||||
break;
|
||||
}
|
||||
|
||||
Format++;
|
||||
} else {
|
||||
WriteChar(*Format);
|
||||
Format++;
|
||||
|
@ -277,11 +276,10 @@ size_t ParseHexColor(const char* Stream, bool bgFlag) {
|
|||
size_t val = 0;
|
||||
char c;
|
||||
|
||||
while ((*Stream != (bgFlag ? ']' : '}')) && (c = *Stream++)) {
|
||||
while ((*Stream != (bgFlag ? ']' : '}')) && (c = *(++Stream))) {
|
||||
char v = ((c & 0xF) + (c >> 6)) | ((c >> 3) & 0x8);
|
||||
val = (val << 4) | (size_t) v;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user