void parseCommand(const char *cmd){

	if(strcmp(cmd, "reboot") == 0){
		reboot();
	}else if(strcmp(cmd, "kernel") == 0){
		jump_to_kernel();
	}
	else if(strcmp(cmd, "help") == 0){
		help();
	}
	else if(strcmp(cmd, "ramtest") == 0){
		ramtest();
	}
	else if(strcmp(cmd, "flashtest") == 0){
		flashtest();
	}
	else if(strcmp(cmd, "halt") == 0){
		halt();
	}
	else if(strcmp(cmd, "white") == 0){
		vga_white();
	}
	else if(strcmp(cmd, "black") == 0){
		vga_black();
	}
	else{
		printfln("Unknown command... %s", cmd);
	}
}
Exemple #2
0
static void testmode(int mode)
{
    int xmax, ymax, i, x, y, yw, ys, c;
    vga_modeinfo *modeinfo;

    vga_setmode(mode);

    modeinfo = vga_getmodeinfo(mode);

    printf("Width: %d  Height: %d  Colors: %d\n",
           modeinfo->width,
           modeinfo->height,
           modeinfo->colors);
    printf("DisplayStartRange: %xh  Maxpixels: %d  Blit: %s\n",
           modeinfo->startaddressrange,
           modeinfo->maxpixels,
           modeinfo->haveblit ? "YES" : "NO");

#ifdef TEST_MODEX
    if (modeinfo->colors == 256)
        printf("Switching to ModeX ... %s\n",
               (vga_setmodeX()? "done" : "failed"));
#endif

    vga_screenoff();

    xmax = vga_getxdim() - 1;
    ymax = vga_getydim() - 1;

    vga_setcolor(vga_white());
    vga_drawline(0, 0, xmax, 0);
    vga_drawline(xmax, 0, xmax, ymax);
    vga_drawline(xmax, ymax, 0, ymax);
    vga_drawline(0, ymax, 0, 0);

    /* Draw crosses */
    for (i = 0; i <= 15; i++) {
        vga_setegacolor(i);
        vga_drawline(10 + i * 5, 10, 89 + i * 5, 89);
    }
    for (i = 0; i <= 15; i++) {
        vga_setegacolor(i);
        vga_drawline(89 + i * 5, 10, 10 + i * 5, 89);
    }

    vga_screenon();

    ys = 100;
    yw = (ymax - 100) / 4;
    switch (vga_getcolors()) {
    case 256:
        /* Draw horizontal color bands using palette */
        for (i = 0; i < 60; ++i) {
            c = (i * 64) / 60;
            vga_setpalette(i + 16, c, c, c);
            vga_setpalette(i + 16 + 60, c, 0, 0);
            vga_setpalette(i + 16 + (2 * 60), 0, c, 0);
            vga_setpalette(i + 16 + (3 * 60), 0, 0, c);
        }
        line[0] = line[xmax] = 15;
        line[1] = line[xmax - 1] = 0;
        for (x = 2; x < xmax - 1; ++x)
            line[x] = (((x - 2) * 60) / (xmax - 3)) + 16;
        for (y = ys; y < ys + yw; ++y)	/* gray */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* red */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* green */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* blue */
            vga_drawscanline(y, line);
        break;

    case 1 << 15:
    case 1 << 16:
    case 1 << 24:
        /* Draw horizontal color bands in RGB */
        for (x = 2; x < xmax - 1; ++x) {
            c = ((x - 2) * 255) / (xmax - 4);
            y = ys;
            vga_setrgbcolor(c, c, c);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(c, 0, 0);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(0, c, 0);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(0, 0, c);
            vga_drawline(x, y, x, y + yw - 1);
        }
        drawSquares(xmax, ymax);
        break;
    default:
        /* Draw vertical color bars */
        if (vga_getcolors() == 16) {
            for (i = 0; i < xmax - 1; i++)
                line[i] = (i + 2) % 16;
            line[0] = line[xmax] = 15;
            line[1] = line[xmax - 1] = 0;
        }
        if (vga_getcolors() == 2) {
            for (i = 0; i <= xmax; i++)
                line[i] = 0x11;
            line[0] = 0x91;
        }
        for (i = 100; i < ymax - 1; i++)
            vga_drawscanline(i, line);
        break;

    }

    if (getchar() == 'd')
        vga_dumpregs();

}
void graphicsinit(char *svgamode) //initialization of graphics, mode according to X_LOPIF
{
const short cur[32] =
	 { 0x9FFF, 0x0FFF, 0x07FF, 0x83FF, 0xC1FF, 0xE0FF, 0xF067, 0xF003,
	   0xF001, 0xF000, 0xF800, 0xF800, 0xF800, 0xFC00, 0xFC00, 0xFC00,
	   0x0000, 0x6000, 0x7000, 0x3800, 0x1C00, 0x0E00, 0x0700, 0x0018,
	   0x07EC, 0x07EE, 0x001E, 0x03EE, 0x03EE, 0x001E, 0x00EC, 0x0002 };


  xg_256=MM_Hic; //set Hicolor flag...
  initpalette();
  x_settextjusty(0,2);	// always write text from upper left corner

#ifdef GGI
// printf("Initializing GGI visual target.\n");
 ggiVis = ggiOpen (NULL);
 ggiGetMode (ggiVis, &origMode);
 ggiSetSimpleMode (ggiVis, 800, 600, 1, GT_16BIT);
 SVGAx=799;
 SVGAy=599;
 ggiAddFlags(ggiVis,GGIFLAG_ASYNC);
#else
 strupr(svgamode);
// printf("Console switched to graphics mode.\n");
 if(strstr(svgamode,".I"))
 {
  vga_setmode(G640x480x64K);
  gl_setcontextvga(G640x480x64K);
  SVGAx=639;
  SVGAy=479;
 }
 else
 if(strstr(svgamode,".K"))
 {
  vga_setmode(G1024x768x64K);
  gl_setcontextvga(G1024x768x64K);
  SVGAx=1023;
  SVGAy=767;
 }
 else
 if(strstr(svgamode,".L"))
 {
  vga_setmode(G1280x1024x64K);
  gl_setcontextvga(G1280x1024x64K);
  SVGAx=1279;
  SVGAy=1023;
 }
 if(strstr(svgamode,".M"))
 {
  vga_setmode(G1600x1200x64K);
  gl_setcontextvga(G1600x1200x64K);
  SVGAx=1599;
  SVGAy=1199;
 }
 {
  vga_setmode(G800x600x64K);
  gl_setcontextvga(G800x600x64K);
  SVGAx=799;
  SVGAy=599;
 }
 vga_runinbackground(1);
 vga_oktowrite();
 gl_setwritemode(FONT_COMPRESSED|WRITEMODE_MASKED);
 gl_setfontcolors(0,vga_white());
 //gl_setfont(8,8,gl_font8x8);
 gl_setrgbpalette();
 gl_enableclipping();
#endif
 x_defcurs( (short *)cur, (short *)&cur[16], 15); //mouse kursor
}