Beispiel #1
0
void putc(char c)
{
    char* vidmem = (char*)0xb8000;     
    switch(c)
    {
        case (0x08):
                if(cursorX > 0) 
                {
	                cursorX--;									
                        vidmem[(cursorY * sw + cursorX)*sd]=0x00;	                              
	        }
	        break;
       case (0x09):
                cursorX = (cursorX + 8) & ~(8 - 1); 
                break;
        case ('\r'):
                cursorX = 0;
                break;
        case ('\n'):
                cursorX = 0;
                cursorY++;
                break;
        default:
                vidmem [((cursorY * sw + cursorX))*sd] = c;
                vidmem [((cursorY * sw + cursorX))*sd+1] = color;
                cursorX++; 
                break;
	
    }
    if(cursorX >= sw)                                                                   
    {
        cursorX = 0;                                                                
        cursorY++;                                                                    
    }
    updateCursor();
    newLineCheck();
}
Beispiel #2
0
void printch(char c)
{
    string vidmem = (string) VIDMEMADDR;
    switch(c)
    {
    case (0x08):
        if(cursorX > 0)
        {
            cursorX--;
            vidmem[(cursorY * sw + cursorX) * sd] = 0x00;
        }
        break;
    case (0x09):
        cursorX = (cursorX + 8) & ~(8 - 1);
        break;
    case ('\r'):
        cursorX = 0;
        break;
    case ('\n'):
        cursorX = 0;
        cursorY++;
        break;
    default:
        vidmem[((cursorY * sw + cursorX)) * sd] = c;
        vidmem[((cursorY * sw + cursorX)) * sd + 1] = 0x0F;
        cursorX++;
        break;
    }

    if(cursorX >= sw)
    {
        cursorX = 0;
        cursorY++;
    }
    newLineCheck();
    updateCursor();
}