1
我最近在爲Operating System Engineering進行學習,當我試圖閱讀源代碼時,我發現了一個「幻數」,在kern/console.c
中我找不到。cga_putc中0x0700的功能是什麼?
基本上,static void cga_putc(int c)
在kern/console.c
是一個用於輸出字符到控制檯的函數,它在此內核中被cprintf
使用。
static void cga_putc(int c)
{
// if no attribute given, then use black on white
if (!(c & ~0xFF))
c |= 0x0700;
switch (c & 0xff) {
case '\b':
...
case '\n':
...
default:
crt_buf[crt_pos++] = c; /* write the character */
break;
}
...
}
不過,我不明白的if (!(c & ~0xFF)) c |= 0x0700;
的功能,任何人可以幫助我嗎?我不知道我應該看哪種材料。