示例#1
0
void
cwrite(char *buf, usize nbytes)
{
    for (; nbytes > 0; nbytes--, buf++)
        cputc0(*buf);
    updatecursor();
}
示例#2
0
void
cclear(void)
{
    int i;

    for (i = 0; i < CSIZE; i++) {
        vmem[i] = SPACE;
    }

    pos = 0;
    updatecursor();
}
示例#3
0
void newLine(void)
{
	currentColumn = 0;
	++currentLine;

	if(currentLine >= LINESPERSCREEN)
	{
		memcpy((void*)(VIDMEMSTART), (void*)(VIDMEMSTART + 2 * CHARSPERLINE), (LINESPERSCREEN - 1) * 160);
		memset((void*)(VIDMEMSTART + ((LINESPERSCREEN - 1) * CHARSPERLINE) * 2), 0, CHARSPERLINE * 2);
		currentLine = LINESPERSCREEN - 1;
	}

	updatecursor();

	writes("enigmOS :> ");
}
示例#4
0
void incChar(unsigned short cols)
{
	currentColumn += cols;
	while(currentColumn >= CHARSPERLINE)
	{
		currentColumn %= CHARSPERLINE;
		++currentLine;

		if(currentLine >= LINESPERSCREEN)
		{
			memcpy((void*)(VIDMEMSTART), (void*)(VIDMEMSTART + 2 * CHARSPERLINE), (LINESPERSCREEN - 1) * 160);
			memset((void*)(VIDMEMSTART + ((LINESPERSCREEN - 1) * CHARSPERLINE) * 2), 0, CHARSPERLINE * 2);
			currentLine = LINESPERSCREEN - 1;
		}
	}

	updatecursor();
}
示例#5
0
void cls(void)
{
	memset((void*)(VIDMEMSTART), 0, (LINESPERSCREEN - 1) * 160);
	updatecursor();
	writes("enigmOS :> ");
}
示例#6
0
void
cvprintf(char *fmt, va_list ap)
{
    char c;
    char *s;

    if (fmt == nil)
        panic("null fmt");

    for (; (c = *fmt); fmt++) {
        long npad = 0;
        char padchar = ' ';

        if (c != '%') {
            cputc0(c);
            continue;
        }

        fmt++;

        // padding character
        if (*fmt == '0') {
            padchar = '0';
            fmt++;
        }

        // min field width
        if (isdigit(*fmt)) {
            npad = strtol(fmt, &fmt, 0);
        }

        c = *fmt;

        if (c == 0)
            break;

        switch (c) {
            case '%':
                cputc0('%');
                break;
            case 'c':
                cputc0((char)va_arg(ap, int));
            case 's':
                s = va_arg(ap, char *);
                if (s == 0)
                    s = "(null)";
                for (; *s; s++)
                    cputc0(*s);
                break;
            case 'd':
                printint(va_arg(ap, int), 10, 1, npad, padchar);
                break;
            case 'o':
                printint(va_arg(ap, int), 8, 0, npad, padchar);
                break;
            case 'l':
                printint(va_arg(ap, long), 10, 1, npad, padchar);
                break;
            case 'u':
                printint(va_arg(ap, long), 10, 0, npad, padchar);
                break;
            case 'p':
            case 'x':
                printint(va_arg(ap, long), 16, 0, npad, padchar);
                break;
            case 'b':
                printint(va_arg(ap, long), 2, 0, npad, padchar);
                break;
            default:
                cputc0('%');
                cputc0(c);
                break;
        }
    }
    updatecursor();
}
示例#7
0
void
cputs(char *s)
{
    cputs0(s);
    updatecursor();
}
示例#8
0
void
cputc(uchar c)
{
    cputc0(c);
    updatecursor();
}