Exemple #1
0
void beep(uint32_t freq, uint32_t duration)
{
    sti();
    sound(freq);
    sleepMilliSeconds(duration);
    noSound();
}
Exemple #2
0
void lock_get_fid()
{
   int cmd_argc, cmd_retvec;
   char *cmd_argvec[ 3 ];
	cmd_argvec[ 0 ] = "acqipctst";
	cmd_argvec[ 1 ] = "locki('data')";
	cmd_argvec[ 2 ] = NULL;
	cmd_argc	= 2;
	cmd_retvec	= 0;
        sleepMilliSeconds(100);
	acqproc_msge(cmd_argc, &cmd_argvec[ 0 ], 0, NULL);
}
Exemple #3
0
void video_test(void)
{
    extern BMPInfo_t bmp_start;

    textColor(LIGHT_BLUE);
    printf("       >>>>>   Press 's' to skip video test or any key to continue   <<<<<\n\n");
    textColor(TEXT);

    if (getch() == 's')
    {
        return;
    }

    video_install();
    list_t* modelist = list_create();
    video_createModeList(modelist);

    textColor(TABLE_HEADING);
    printf("\nID\tDriver\tResolution\tColor depth\tType\n");
    puts("----------------------------------------------------------------------");
    textColor(TEXT);
    size_t id = 0;
    for (dlelement_t* e = modelist->head; e != 0; e = e->next, id++)
    {
        videoMode_t* mode = e->data;
        printf("\n%u\t%s\t", id, mode->device->driver->driverName);
        if (printf("%ux%u\t", mode->xRes, mode->yRes) <= 8) putch('\t');
        switch (mode->colorMode)
        {
            case CM_2COL:
                puts("2 colors");
                break;
            case CM_16COL:
                puts("16 colors");
                break;
            case CM_256COL:
                puts("256 colors");
                break;
            case CM_15BIT:
                puts("15 bit\t");
                break;
            case CM_16BIT:
                puts("16 bit\t");
                break;
            case CM_24BIT:
                puts("24 bit\t");
                break;
            case CM_32BIT:
                puts("32 bit\t");
                break;
        }
        printf("\t%s", mode->type==VMT_GRAPHIC?"Graphic":"Text");

        if (id % 40 == 0 && id != 0)
            waitForKeyStroke(); // Slow down
    }
    textColor(TABLE_HEADING);
    puts("\n----------------------------------------------------------------------\n\n");
    textColor(TEXT);

    videoMode_t* mode = 0;

    while (true)
    {
        textColor(YELLOW);
        printf("Type in the ID of the mode: ");
        textColor(TEXT);
        char temp[20];
        gets(temp);

        if (strcmp(temp, "exit") == 0) return;

        uint16_t modenumber = atoi(temp);
        dlelement_t* e = list_getElement(modelist, modenumber);
        if (e != 0)
        {
            mode = e->data;
            break;
        }
    }

    printf("\n1. Start Graphical Tests\n");
    printf("2. Start GUI\n");
    printf("3. Start VBE-Shell\n\n");
    uint16_t whatToStart = 0;

    while (whatToStart == 0)
    {
        textColor(YELLOW);
        printf("Type in the number: ");
        textColor(TEXT);
        char num[3];
        gets(num);
        whatToStart = atoi(num);
    }

    video_setMode(mode);

    if (whatToStart == 1)
    {
        uint16_t width = video_currentMode->xRes;
        uint16_t height = video_currentMode->yRes;
        uint16_t radius = min(width, height)/2;
        for (uint16_t i = 0; i < radius; i++)
        {
            BGRA_t color = {i*64/radius, i*256/radius, 128-(i*128/radius), 0}; // Create gradient
            video_drawCartesianCircle(video_currentMode->device, width/2, height/2, radius-i, color); // FPU
            sleepMilliSeconds(5);
        }

        BGRA_t bright_blue = {255, 75, 75, 0};
        video_drawLine(video_currentMode->device, 0, height/2, width, height/2, bright_blue);
        video_drawLine(video_currentMode->device, 0, height/2 + 1, width, height/2 + 1, bright_blue);
        video_drawLine(video_currentMode->device, width/2, 0, width/2, height, bright_blue);
        video_drawLine(video_currentMode->device, width/2+1, 0, width/2+1, height, bright_blue);
        video_drawCartesianCircle(video_currentMode->device, width/2, height/2, height/2, bright_blue); // FPU
        video_drawCartesianCircle(video_currentMode->device, width/2, height/2, height/2-1, bright_blue); // FPU
        waitForKeyStroke();

        video_drawBitmap(video_currentMode->device, 0, 0, &bmp_start);
        waitForKeyStroke();

        video_printPalette(video_currentMode->device);

        video_drawString(video_currentMode->device, "PrettyOS started in March 2009.\nThis hobby OS tries to be a possible access for beginners in this area.", 0, 400);
        waitForKeyStroke();

        video_drawScaledBitmap(video_currentMode->device, width, height, &bmp_start);
        waitForKeyStroke();

        video_clearScreen(video_currentMode->device, black);
        waitForKeyStroke();
    }
    else if (whatToStart == 2)
    {
        StartGUI();
    }
    else if (whatToStart == 3)
    {
        startVBEShell();
    }

    video_setMode(0); // Return to 80x50 text mode
    video_freeModeList(modelist);
    for (dlelement_t* e = basicVideoDevices->head; e != 0; e = e->next)
    {
        video_freeDevice(e->data);
    }
    list_free(basicVideoDevices);
    basicVideoDevices = 0;
}