示例#1
0
int main()
{
    char input_line[256];
    int got;

    console_init(init_vga(VGA_MODE_640x480), 640, 480);
    console_set_colors(WHITE, BLACK);
    console_puts("\n !\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_`{|}~\n");
    console_puts(" ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
    console_puts(" abcdefghijklmnopqrstuvwxyz\n");
    console_puts(" AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz\n");
    console_puts(" The quick brown fox jumped over the lazy dog.\n");
    console_set_colors(BLACK, WHITE);
    console_puts(" Inverse text\n");
    console_set_colors(WHITE, BLACK);
    while (1)
    {
        console_puts("> ");
        got = console_read_line(input_line, sizeof(input_line));
        input_line[got] = '\0';
        printf("%s\n", input_line);
    }

    return 0;
}
示例#2
0
文件: main.c 项目: cl91/freq-relay
// Initialise all subsystems and start the scheduler
int main(void)
{
	init_timer();
	init_freq_irq();
	init_vga();
	init_state_machine();

	/* Finally start the scheduler. */
	vTaskStartScheduler();

	/* Will only reach here if there is insufficient heap available to start
	 the scheduler. */
	for (;;);
}
示例#3
0
void main(int argc, char **argv)
{
    progname = (progname = strrchr(argv[0],'/')) ? progname : argv[0];

#ifndef BOOT
    FILE *f1;
    if (argc != 2)
    {
        fprintf(stderr,"Format: %s testfile\n",progname);
        exit(1);
    }
#endif
    if (!(memory = (BYTE *)malloc(MEMORY_SIZE)))
    {
        fprintf(stderr,"Insufficient available memory\n");
        exit(1);
    }
#ifdef BOOT
    memset(memory,0, MEMORY_SIZE);
#else
    if (!(f1 = fopen(argv[1],"rb")))
    {
        fprintf(stderr,"Cannot open test file\n");
        exit(1);
    }


    fread(memory+0x800,1,MEMORY_SIZE-0x800,f1);
    fclose(f1);
#endif

    read_pcemurc();
    disable();

    start_X();
    init_cpu();
    init_bios();
    init_vga();
    init_timer();

    enable();

    execute();

    /* NOT REACHED */
}
int main()
{ 
    ret = init_vga(G320x200x256, VGA, PCI_DEVICE_ID_S3_TRIO64V2);            
    
    int i;
    for(i=0;i<64;i++){
        vga_setpalette(i, i, i, i);
    }
    
    for(i=0;i<64;i++){
        vga_setpalette(i+64, i, 0, 0);
    }
    
    for(i=0;i<64;i++){
        vga_setpalette(i+64+64, 0, i, 0);
    }
   
    buffer = (unsigned char *)malloc(VGA_WIDTH*VGA_HEIGHT);//virtual canvas
    memset(buffer, 0, VGA_WIDTH*VGA_HEIGHT);    
            
    set_raw_mode();

    unsigned int seed = (unsigned) time(NULL);
    srand(seed);
    /*srand(seed);rand();*/

    float period = 1.0/60.0;
    //period_ts = double_to_timespec(period);  //old versions of MaRTE OS
    double_to_timespec(period,&period_ts); //new versions of MaRTE OS
    
    while(1){
        
        DrawObjects();
        //flip
        vga_drawscansegment(buffer,0,0,VGA_WIDTH*VGA_HEIGHT); 
        nanosleep(&period_ts, NULL);

    }
    
    
    while(getchar()==-1);

    return 0;
}
示例#5
0
int main(int argc, char **argv) {

    FILE *faili;
    int c;

    printf("\n");
    printf(" Lvledit for Triplane   Copyright (c) 1996 Dodekaedron Software Creations, Inc.");
    printf("\n\r\n\r");

    if (argc != 2) {
        printf("Usage: LVLEDIT level_filename\n");
        exit(1);
    }

    printf("Loading directory structure\n\r");
    dksinit("fokker.dks");

    strcpy(filename, argv[1]);

    if ((faili = fopen(filename, "rb")) == NULL) {
        printf("Creating new level.\n\r");

        strcpy(leveldata.pb_name, "MAISDT");
        for (c = 0; c < MAX_STRUCTURES; c++) {
            leveldata.struct_x[c] = 0;
            leveldata.struct_y[c] = 0;
            leveldata.struct_hit[c] = 0;
            leveldata.pd_name[c][0] = 0;
            leveldata.struct_owner[c] = 4;
            leveldata.struct_type[c] = 0;



        }
        for (c = 0; c < 4; c++) {
            leveldata.airfield_x[c] = 0;
            leveldata.airfield_y[c] = 0;
            leveldata.airfield_lenght[c] = 110;
            leveldata.plane_direction[c] = 0;
        }

    } else {
        printf("Loading existing level.\n\r");
        fread(&leveldata, sizeof(leveldata), 1, faili);
        fclose(faili);

        for (c = 0; c < MAX_STRUCTURES; c++) {

            if (leveldata.struct_x[c]) {
                struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
                struct_picture[c]->info(&picture_width[c], &picture_height[c]);
            }
        }
    }

    printf("Loading font \"FROST\"\n\r");
    fontti = new Font("G2FONT");

    printf("Loading cursor\n\r");
    hiirik = new Bitmap("FONTT1");
    hiirikursori = hiirik;

    if (leveldata.pb_name[0]) {
        printf("Loading background picture\n\r");

        pb_picture = new Bitmap(leveldata.pb_name);

    }

    printf("Loading background papers\n\r");

    lappu1 = new Bitmap("LAPPU1");
    lappu2 = new Bitmap("LAPPU2");

    init_vga("PALET5");

    edit_level();

    swap_byte_order();
    faili = fopen(filename, "wb");
    fwrite(&leveldata, sizeof(leveldata), 1, faili);
    fclose(faili);
    swap_byte_order();

    delete pb_picture;
    delete lappu1;
    delete lappu2;
    delete hiirik;
    delete fontti;
    for (c = 0; c < MAX_STRUCTURES; c++)
        if (leveldata.struct_x[c])
            delete struct_picture[c];

    return 0;

}