Esempio n. 1
0
/*!
 * The following logic is used to select the next process:
 *
 * 1. Increment the score of each runnable process. The greater a process's
 *    priority, the greater the increment.
 * 2. Select the process with the highest score. If multiple processes have the
 *    same score, select the first process after the "current" process, where
 *    the "current" process is the process pointed to by the ringbuffer index.
 * 3. Make the selected process the "current" process, set it's score to zero
 *    and run it.
 *
 * Note that only runnable processes are given points. If non-runnable processs
 * are given points, they will attain insane scores. This could be problematic
 * if numerous non-runnable processes all became runnable at the same time
 *
 * This function is inefficient: the score of *every* process is bumped whenever
 * the function is called. As MAX_THREADS grows, the problem will only get
 * worse. Better solutions should be considered. One possible solution is to
 * examine only a limited number of processes each time this interrupt occurs,
 * rather than examining all processes.
 */
word far *Schedule( word far *p )
{
    process * const current = get_current( );
    process * candidate = get_current( ); // Candidate for next runnable process
    process * choice; // Choice for next runnable process
    processID idle; // Used to find the idle thread

    if( NULL == current ) {
        print_at( count++, col, "thread pointing to NULL", 0x04 );
        print_at( count++, col, "(has add_process() been called?)", 0x04 );
        return p;
    }
    // What does this do? It is necessary for test program 1 to function.
    current->stack = p;

    // Make a default choice...
    idle.pid = IDLE;
    choice = get_process( idle );
    // ... then see if any other suitable candidates exist.
    do {
        candidate = get_next( candidate->pid );
        if( true == candidate->runnable ) {
            // Bump score before considering a process. This ensures that
            // `candidate` will always out-score the idle thread.
            candidate->score += candidate->priority;
            if( candidate->score > choice->score ) {
                choice = candidate;
            }
        }
    } while( candidate->pid.pid != current->pid.pid );

    choice->score = 0;
    set_current( choice->pid ); // update ringbuffer index
    return choice->stack;
}
Esempio n. 2
0
void bsod_init()
{
    // init palette
    palette[0]=RGB(0,255,255)<<16|RGB(0,0,128); // cyan on blue
    palette[1]=RGB(255,150,0)<<16|RGB(255,255,0); // orange fg, yellow bg
    palette[2]=RGB(255,0,0)<<16|RGB(255,255,0); // red FG, yellow BG
    palette[3]=RGB(0,180,0)<<16|RGB(0,0,128); // green on blue
    // now a little gradient
    for (int i=0;i<16;i++) 
      palette[4+i] = RGB(0,255-i*15,i*15)<<16| RGB(0,0,128);
    palette[20]=RGB(255,255,255)<<16|RGB(0,0,128);


    // make a window with attribute 1 (orange/yellow)
    text_color=1;
    window(0,0,17,17);
    print_at(5,0,"[Ascii]");

    //  draw ascii set with attribute 2 (red/yellow)
    for (int i=0;i<256;i++) 
    {
        vram[1+i/16][1+i%16]=i;
        vram_attr[1+i/16][1+i%16]=2;
    }
    
    text_color=20;
    window(23,1,64,10);
    //print_at(37,1,"[savestate info]");
    //print_at(24,2,a_game_buffer[0]);
    //print_at(24,3,a_game_buffer[1]);
    //sprintf(a_game_buffer[0], "  was at game %u", current_a_game);
    //print_at(24,4,a_game_buffer[0]);
    //sprintf(a_game_buffer[0], "  was attempting %u", attempting_a_game);
    //print_at(24,5,a_game_buffer[0]);

    text_color=0;
    print_at(31,SCREEN_H-14, "Sorry Bitbox...");
    for (int i=0;i<4;i++) 
    {
      text_color=4+i*4;
      print_at(31+4*i,SCREEN_H-13,"####");
    }

    // print text with a gradient 
    const char *bsod_text = "You just encountered the blue screen of death.";
    for (int i=0;i<10;i++) 
    {
      text_color=4+i;
      print_at(16-i,20+i,bsod_text);
    }

    cursor.attr = 2;
    place_cursor(0, SCREEN_H-1);
}
Esempio n. 3
0
void display( void )
{
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glColor4f(0,0,0,1);
    print_at( 100, 100, L"Hello World !" );
    glutSwapBuffers( );
}
Esempio n. 4
0
static void display_monster(const Monster *m, Coords &pos)
{
	++pos.y;
	if (cursor == m->pos || (cursor.x >= pos.x && cursor.y == pos.y))
		printf(REVERSE);
	print_at(m->pos, WHITE "%s", monster_glyphs[m->type]);
	if (m->type == SHOPKEEPER && g.current_beat % 2)
		printf("♪");
	print_at(pos, "%s ", monster_glyphs[m->type]);
	printf("%s", m->aggro ? ORANGE "!" : " ");
	printf("%s", m->delay ? BLACK "◔" : " ");
	printf("%s", m->confusion ? YELLOW "?" : " ");
	printf("%s", m->freeze ? CYAN "=" : " ");
	printf(WHITE "%s ", dir_to_arrow(m->dir));
	display_hearts(m);
	printf("%s\033[K" CLEAR, additional_info(m));
}
Esempio n. 5
0
int main(void){
	LCD_init();
	LCD_clr();

	receiver_init();

	while(1){
		print_at(0, 0,0);
		print_at(5, 0,1);
		print_at(10,0,2);
		print_at(0, 1,3);
		print_at(10,1,4);
		_delay_ms(100);
	}

	return 0;
}
Esempio n. 6
0
// Picks an appropriate box-drawing glyph for a wall by looking at adjacent tiles.
// For example, when tiles to the bottom and right are walls too, use '┌'.
static void display_wall(Coords pos)
{
	i64 glyph = 0;
	for (i64 i = 0; i < 4; ++i) {
		Tile &tile = TILE(pos + plus_shape[i]);
		glyph |= (tile.revealed && tile.type >= EDGE) << i;
	}
	print_at(pos, "%3.3s", &"──│┘│┐│┤──└┴┌┬├┼"[3 * glyph]);
}
Esempio n. 7
0
static void display_wire(Coords pos)
{
	i64 glyph = 0;
	for (i64 i = 0; i < 4; ++i) {
		Tile &tile = TILE(pos + plus_shape[i]);
		glyph |= (tile.revealed && tile.wired) << i;
	}
	print_at(pos, YELLOW "%3.3s", &"⋅╴╵╯╷╮│┤╶─╰┴╭┬├┼"[3 * glyph]);
}
Esempio n. 8
0
void update_host_status(void)
{

	#ifdef USE_USB_OTG_HS 
	/*const USB_OTG_GOTGCTL_TypeDef *gotgctl_hs = (USB_OTG_GOTGCTL_TypeDef*) \
		&USB_OTG_Core.regs.GREGS->GOTGCTL;*/
	const USB_OTG_HPRT0_TypeDef *hprt_hs = (USB_OTG_HPRT0_TypeDef*) \
		USB_OTG_Core.regs.HPRT0;

	//print_at(23,30,0,gotgctl_hs->b.asesvld ? "Yes":"No ");
	print_at(23,30,0,hprt_hs->b.prtena ? "Yes":"No ");
	print_at(23,31,0,hprt_hs->b.prtconnsts ? "Yes":"No ");
	print_at(23,32,0,host_speeds[hprt_hs->b.prtspd]);
	print_at(23,33,0,host_state_str[USB_Host.gState]);
	print_at(23,34,0,host_ctrl_state_str[USB_Host.Control.state]);

	printhex16(23,35,USB_OTG_Core.nbpackets_in);
	printhex16(28,35,USB_OTG_Core.nbpackets_out);
	printhex16(23,36,USB_OTG_Core.nbbytes_in);
	printhex16(28,36,USB_OTG_Core.nbbytes_out);

	#endif 

	#ifdef USE_USB_OTG_FS 
	/*const USB_OTG_GOTGCTL_TypeDef *gotgctl_fs = (USB_OTG_GOTGCTL_TypeDef*) \
		&USB_OTG_FS_Core.regs.GREGS->GOTGCTL;*/
	const USB_OTG_HPRT0_TypeDef *hprt_fs = (USB_OTG_HPRT0_TypeDef*) \
		USB_OTG_FS_Core.regs.HPRT0;

	//print_at(32,30,0,gotgctl_fs->b.asesvld ? "Yes":"No ");
	print_at(33,30,0,hprt_fs->b.prtena ? "Yes":"No ");
	print_at(33,31,0,hprt_fs->b.prtconnsts ? "Yes":"No "); 
	print_at(33,32,0,host_speeds[hprt_fs->b.prtspd]);
	print_at(33,33,0,host_state_str[USB_FS_Host.gState]);
	print_at(33,34,0,host_ctrl_state_str[USB_FS_Host.Control.state]);

	printhex16(33,35,USB_OTG_FS_Core.nbpackets_in);
	printhex16(38,35,USB_OTG_FS_Core.nbpackets_out);
	printhex16(33,36,USB_OTG_FS_Core.nbbytes_in);
	printhex16(38,36,USB_OTG_FS_Core.nbbytes_out);

	#endif 

}
Esempio n. 9
0
// Pretty-prints the tile at the given position.
static void display_tile(Coords pos)
{
	Tile *tile = &TILE(pos);

	int light = shadowed(pos) ? 0 :
		L2(pos - player.pos) <= player.radius ? 7777 :
		min(tile->light, 7777);
	printf("\033[38;5;%dm", 232 + light / 338);
	print_at(pos, tile_glyphs[tile->type]);

	if (IS_DIGGABLE(pos) && !IS_DOOR(pos))
		display_wall(pos);
	if (IS_WIRE(pos) && !IS_DOOR(pos))
		display_wire(pos);
	if (tile->item)
		print_at(pos, item_glyphs[tile->item]);
	if (!tile->revealed)
		print_at(pos, " ");
}
Esempio n. 10
0
void p_s_top(void)
	{
	s_long=2;
	z_long=0;
	do
		{
		if(even(s_long))
			{
			print_at(s_long-1,72);
			printf(" %s ",z_char);
			}
		else
			{
			print_at(s_long,72);
			printf("%cp%s%cq",*chr(27),z_char,*chr(27));
			}
		pause( 10);
		if(gemdos(11) != 0)
			{
			z_long=gemdos(1);
			}
		if(z_long==0)
			{
			++s_long;
			z_long=d_iv(s_long,65);
			}
		else if(z_long==1)
			{
			--s_long;
			if(s_long==2)
				{
				z_long=0;
				}
			}
		pause( 10);
		if(bios(1,2) != 0)
			{
			z_long=inp(2);
			}
		}
	while(!(z_long>1));
	}
Esempio n. 11
0
// Clears and redraws the entire interface.
static void display_all(void)
{
	for (i8 y = 1; y < ARRAY_SIZE(g.board) - 1; ++y)
		for (i8 x = 1; x < ARRAY_SIZE(*g.board) - 1; ++x)
			display_tile({x, y});

	for (Trap *t = g.traps; t->pos.x; ++t)
		if (TILE(t->pos).revealed && !TILE(t->pos).destroyed)
			display_trap(t);

	Coords pos = {64, 1};
	for (Monster *m = &g.monsters[g.last_monster]; m != &player; --m)
		if (m->hp && (m->aggro || TILE(m->pos).revealed || g.head == HEAD_CIRCLET))
			display_monster(m, pos);
	for (++pos.y; pos.y < 50; ++pos.y)
		print_at(pos, "\033[K");

	display_player();
	print_at({0, 0}, "%s\033[K", g.game_over? player.hp ? "You won!" : "You died..." : "");
}
Esempio n. 12
0
void p_schleifen(void)
	{
	print_at(2,12);
	printf("1. DEMO: Schleifen\n");
	print_at(1,14);
	printf("    FOR - NEXT\n");
	for(i_long=2;i_long<=79;i_long++)
		{
		print_at(i_long,15);
		printf("%c\n",*chr(41+i_long));
		}
	print_at(1,17);
	printf("    REPEAT - UNTIL\n");
	i_long=2;
	do
		{
		print_at(i_long,18);
		printf("%c\n",*chr(123-i_long));
		++i_long;
		}
	while(!(i_long==80));
	print_at(1,20);
	printf("    WHILE - WEND\n");
	i_long=2;
	while(i_long <= 79)
		{
		print_at(i_long,21);
		printf("%c\n",*chr(64+(fmod((i_long-1) ,26))));
		++i_long;
		}
	print_at(1,23);
	printf("    DO - LOOP\n");
	i_long=2;
	do
		{
		print_at(i_long,24);
		printf("%c",*chr(96+(fmod((i_long-1) ,26))));
		++i_long;
		if(i_long==80)
			goto M1;
		}
	while(1);
	M1:
	p_s_top();
	printf("\33E");
	}
Esempio n. 13
0
void print_kbd_flag(char flag){
  if(flag & 0x80){
    /* parity bit set */
    unsigned char strparity[] = "Parity set\n";
    print_at(strparity, 1, 0);
  }

  if(flag & 0x40){
    /*time out*/
    unsigned char strtimeout[] = "Time Out\n";
    print_at(strtimeout,2,0);
  }

  if(flag & 0x20){
    /*aux data*/
    unsigned char straux[] = "Aux Data set\n";
    print_at(straux,3,0);
  }

  if (flag & 0x10){
    /* keyboard free (not locked) */
    unsigned char strfree[] = "Keyboard not locked\n";
    print_at(strfree,4,0);
  }

  if (flag & 0x8){
    /*command byte written (not data)*/
    unsigned char strcmd[] = "Command byre written\n";
    print_at(strcmd,5,0);
  }

  if (flag & 0x4){
    /*self test successful*/
    unsigned char strtest[] = "Self test successful\n";
    print_at(strtest,6,0);
  }

  if (flag & 0x2){
    /* cpu data in input buffer */
    unsigned char strcpu[] = "CPU data in input buffer\n";
    print_at(strcpu,7,0);
  }

  if (flag & 0x1){
    /*output buffer not empty*/
    unsigned char strready[] = "output buffer ready \n";
    print_at(strready,8,0);
  }
}
Esempio n. 14
0
int main( void )
{
    vidid.pid  = VIDEO;
    mainid.pid = MAIN;
    hackid.pid = 4;
	
    clear_screen( );
    disable_interrupts( );
  
    //initialize_timer_frequency( );
    initialize_keyboardISR( );
    initialize_timerISR( );
    print_at( trace_counter++, TRACE_COLUMN, "Timer initialized", COLOR );
  
    message_init( );
    print_at( trace_counter++, TRACE_COLUMN, "Messages initialized", COLOR );
 
    if( xthread_create( vidid, run_video ) ) {
        print_at( trace_counter++, TRACE_COLUMN, "Failed to create video thread", COLOR );
    }
    else {
        print_at( trace_counter++, TRACE_COLUMN, "Created video thread", COLOR );
    }
  
    if( xthread_create( mainid, main_thread ) ) {
        print_at( trace_counter++, TRACE_COLUMN, "Failed to create main thread", COLOR );
    }
    else {
        print_at( trace_counter++, TRACE_COLUMN, "Created test thread", COLOR );
    }
  
    enable_interrupts( );
  
    print_at( trace_counter++, TRACE_COLUMN, "Looping in main", COLOR );
    for ( ;; ) { }
    print_at( trace_counter++, TRACE_COLUMN, "SHOULD NEVER SEE THIS!", COLOR );
    return 0;
}
Esempio n. 15
0
void animation(Animation id, Coords pos, Coords dir)
{
	if (!run_animations)
		return;
	static Coords targets[32];
	i64 target_count = 0;

	display_all();

	switch (id) {
	case EXPLOSION:
		for (Coords d: square_shape)
			targets[target_count++] = pos + d;
		break;
	case FIREBALL:
		for (Coords p = pos + dir; !BLOCKS_LOS(p); p += dir)
			targets[target_count++] = p;
		break;
	case CONE_OF_COLD:
		for (Coords d: cone_shape)
			targets[target_count++] = pos + d * dir.x;
		break;
	case SPORES:
		for (Coords d: square_shape)
			if (L1(d))
				targets[target_count++] = pos + d;
		break;
	case ELECTRICITY:
		for (Monster *m = &player; m->type; ++m) {
			targets[target_count] = m->pos;
			target_count += m->electrified;
			m->electrified = false;
		}
		break;
	case BOUNCE_TRAP:
		break;
	}

	for (const char **step = animation_steps[(i64) id]; **step; ++step) {
		for (i64 i = 0; i < target_count; ++i)
			if (TILE(pos).revealed && TILE(targets[i]).revealed)
				print_at(targets[i], *step);
		fflush(stdout);
		struct timeval timeout = { .tv_usec = 42000 };
		fd_set in_fds;
		FD_SET(0, &in_fds);
		select(1, &in_fds, NULL, NULL, &timeout);
	}
}

// `play` entry point: an interactive interface to the simulation.
int main(i32 argc, char **argv)
{
	g.seed = (u32) time(NULL);
	xml_parse(argc, argv);
	run_animations = true;

	system("stty -echo -icanon eol \1");
	printf("\033[?25l\033[?1003;1049h");
	atexit([]() { printf("\033[?25h\033[?1003;1049l"); });

	GameState timeline[32] = {[0 ... 31] = g};

	for (;;) {
		timeline[g.current_beat & 31] = g;
		display_all();
		i32 c = getchar();
		if (c == 't')
			execv(*argv, argv);
		else if (c == 'u')
			g = timeline[(g.current_beat - 1) & 31];
		else if (c == '\033' && scanf("[M%*c%c%c", &cursor.x, &cursor.y))
			cursor += {-33, -33};
		else if (c == EOF || c == 4 || c == 'q')
			break;
		else if (!g.game_over)
			g.game_over = do_beat((char) c);
	}
}
Esempio n. 16
0
static void display_player(void)
{
	i8 x = 32, y = 0;
	print_at({x, ++y}, CLEAR "Bard ");
	display_hearts(&player);
	print_at({x, ++y}, "%32s" REVERSE, "");
	print_at({x, y}, "");
	printf("%s", g.monkeyed ? PURPLE "Monkeyed " : "");
	printf("%s", player.confusion ? YELLOW "Confused " : "");
	printf("%s", player.freeze ? CYAN "Frozen " : "");
	printf("%s", g.sliding_on_ice ? CYAN "Sliding" : "");
	printf("%s", g.iframes > g.current_beat ? PINK "I-framed " : "");
	print_at({x, ++y}, CLEAR);
	print_at({x, ++y}, "Bombs:  %-2d",  g.bombs);
	print_at({x, ++y}, "Shovel: %-20s", item_names[g.shovel]);
	print_at({x, ++y}, "Weapon: %-20s", item_names[g.weapon]);
	print_at({x, ++y}, "Body:   %-20s", item_names[g.body]);
	print_at({x, ++y}, "Head:   %-20s", item_names[g.head]);
	print_at({x, ++y}, "Boots:  %s%-20s" CLEAR, g.boots_on ? BOLD : "", item_names[g.feet]);
	print_at({x, ++y}, "Ring:   %-20s", item_names[g.ring]);
	print_at({x, ++y}, "Usable: %-20s", item_names[g.usable]);
	if (!player.untrapped)
		print_at(player.pos, "%s", tile_glyphs[TILE(player.pos).type]);
	print_at(player.pos, REVERSE "@" CLEAR);
}
Esempio n. 17
0
void p_benchmarks(void)
	{
	print_at(2,2);
	printf("2. DEMO: Einige Benchmarks\n");
	print_at(2,4);
	printf("1. Integerberechnung:\n");
	print_at(5,6);
	printf("10000 Schleifen zur Erh�hung eines Integerwertes\n");
	i_long=0;
	print_at(5,7);
	printf("... rechne\n");
	c_doub=timer();
	while(i_long<10000)
		{
		++i_long;
		}
	zeit_doub_f[(int)(1)]=(timer()-c_doub)/200;
	print_at(5,8);
	printf("%ld Schleifen gerechnet 	und ... %G s ben�tigt\n",i_long,zeit_doub_f[(int)(1)]);
	print_at(2,10);
	printf("2. Integer- und Floatberechnung:\n");
	print_at(5,12);
	printf("10000 Schleifen zur Erh�hung eines Integerwertes\n");
	print_at(5,13);
	printf("und Berechnung einer Floatvariablen\n");
	i_long=0;
	a_doub=0;
	print_at(5,14);
	printf("... rechne\n");
	c_doub=timer();
	while(i_long<10000)
		{
		++i_long;
		a_doub=a_doub+1;
		}
	zeit_doub_f[(int)(2)]=(timer()-c_doub)/200;
	print_at(5,16);
	printf("%ld Schleifen gerechnet 	und ... %G s ben�tigt\n",i_long,zeit_doub_f[(int)(2)]);
	msprintf(datei_char,"A:\\GFA_TEST\\TEST.DAT");
	print_at(5,18);
	printf("Speichere die Ergebnisse in der Datei >>%s<< ab ...\n",datei_char);
	if((FP[1] = fopen(datei_char,"w")) == NULL)
		{
		printf("\nFehler beim �ffnen der Datei !");
		getchar();
		r_aus(-1);
		}
	for(i_long=0;i_long<=5;i_long++)
		{
		fprintf(FP[1],"%G\n",zeit_doub_f[(int)(i_long)]);
		}
	fclose(FP[1]);
	print_at(5,20);
	printf("Lade zur Kontrolle die Daten wieder aus der Datei >>%s<<\n",datei_char);
	if((FP[1] = fopen(datei_char,"r")) == NULL)
		{
		printf("\nFehler beim �ffnen der Datei !");
		getchar();
		r_aus(-1);
		}
	for(i_long=0;i_long<=5;i_long++)
		{
		fscanf(FP[1],"%lg",&zeit_doub_f[(int)(i_long)]);
		}
	fclose(FP[1]);
	print_at(5,22);
	printf("Benchmark f�r die Integerberechnung                 : %G s\n",zeit_doub_f[(int)(1)]);
	print_at(5,23);
	printf("Benchmark f�r die Integerberechnung/Floatberechnung : %G s\n",zeit_doub_f[(int)(2)]);
	p_s_top();
	printf("\33E");
	}
Esempio n. 18
0
static void display_trap(const Trap *t)
{
	const char *glyph = t->type == BOUNCE ? dir_to_arrow(t->dir) : trap_glyphs[t->type];
	print_at(t->pos, WHITE "%s", glyph);
}
Esempio n. 19
0
void bsod_frame()
{
    static const char *HEX_Digits = "0123456789ABCDEF";
    struct event e;
    e=event_get();
    while (e.type != no_event) 
    {
        switch(e.type)
        {
        case evt_keyboard_press: 
            switch (e.kbd.key)
            {
            case 0x52:
                move_cursor_up();
                break;
            case 0x51:
                move_cursor_down();
                break;
            case 0x50:
                move_cursor_left();
                break;
            case 0x4F:
                move_cursor_right();
                break;
            default:
                if (e.kbd.key < 100)
                {
                    if (e.kbd.key == 42) // backspace
                    {
                        move_cursor_left();
                        vram[cursor.y][cursor.x] = 32;
                    }
                    else if (e.kbd.key == 40) // enter
                    {
                        //move_cursor_return();
                        // special behavior here...
                    }
                    else
                    {
                        vram[cursor.y][cursor.x] = e.kbd.sym;
                        move_cursor_right();
                    }
                }
                message("pressed %d with mod %d\n", e.kbd.key, e.kbd.mod);
                print_at(31,18,"KB pressed      ");
                vram[18][45]=HEX_Digits[(e.kbd.key>>4) & 0xF];
                vram[18][46]=HEX_Digits[e.kbd.key&0xf];
            }
            break;

        case evt_keyboard_release: 
            print_at(31,18,"KB released     ");
            vram[18][45]=HEX_Digits[(e.kbd.key>>4) & 0xF];
            vram[18][46]=HEX_Digits[e.kbd.key&0xf];
            break;

        case evt_device_change:
            // It seems the disconnect event is not sent currently...
            if (e.device.type == device_unconnected)
                print_at(31, 18, "dev. unconnected");
            else if (e.device.type == device_keyboard)
                print_at(31, 18, "keyboard found! ");
            break;

        case evt_user:
            print_at(31, 18, "user event      ");
            break;
        
        default:
            print_at(31, 18, "UNHANDLED       ");
        }
        e=event_get();
    }
}
Esempio n. 20
0
// draw "graphical" controller frame
void draw_controller(int x, int y)
{
	window(0,x, y, x+17, y+4);
	print_at(x+2 ,y,0,"[ ]");
	print_at(x+13,y,0,"[ ]");
}
Esempio n. 21
0
void game_init() {
	clear(); 
	set_palette(1,RGB(255,255,160),0); // light yellow on black

	// testing vga bits on micro
	for (int i=0;i<8;i++) {
		set_palette(2+i,1<<(7-i),0);
		print_at(20+i,0,2+i,"\x7");
	}

	
	window(0,2,1,45,4);
	print_at(14,2,1, " \xf9\xfa\xfb USB TEST ");
	print_at(5,3,0,  " \x01 Hi ! Plug some usb device...");
	print_at(2, 6, 1,"Mouse:");
	print_at(9, 6, 0,"X=   Y=   lmr");

	print_at(2,PAD_Y-2,1, "Gamepads:");
	draw_controller(PAD_X, PAD_Y);
	draw_controller(PAD_X, PAD_Y2);

	// analog values
	print_at(27,PAD_Y-2,1,"Analog pad0:");
	window (0,27, PAD_Y, 27+17, PAD_Y+9);

	// keyboard 
	print_at(2,KB_Y,1,"Keyboard:");

	// lowlevel
	print_at( 2,28,1,"USB Low level:");
	print_at(22,29,0,"[0-HS]   [1-FS]");
	print_at( 2,30,0,"      Port enabled");
	print_at( 2,31,0,"  Device connected");
	print_at( 2,32,0,"      Device speed");
	print_at( 2,33,0,"       Host status");
	print_at( 2,34,0,"   Host Ctrl State");
	print_at( 2,35,0,"  Transfers In/Out");
	print_at( 2,36,0,"  Data Size In/Out");


	cx = cy = 0;
}
Esempio n. 22
0
void p_intro(void)
	{
	print_at(1,2);
	printf("\n");
	printf("              %cp<<< ES IST SOWEIT !!!  %c B_NACH_C %c IST DA !!! >>>%cq\n",*chr(27),*chr(42),*chr(42),*chr(27));
	print_at(8,5);
	printf("%cp<<< DAS TRANSFORMATIONSPROGRAMM 'GFA-BASIC-KONVERTER-NACH-C' >>>%cq\n",*chr(27),*chr(27));
	print_at(1,8);
	printf("\n");
	printf("  Mit Hilfe dieses Programms k�nnen folgende Aufgaben optimal gel�st werden :\n");
	printf("\n");
	printf("  1. Entwicklung eines Programms im kompfortablen GFA-BASIC,\n");
	printf("  2. Austesten des Programms in einem Interpreter (Turn-Around-Zeit !),\n");
	printf("  3. Programmtransformation in die weltweit verbreitete Computersprache 'C',\n");
	printf("  4. Portierung auf unterschiedlichste Rechner und Betriebssysteme,\n");
	printf("  5. Programmierung auf einem ATARI und Anwendung auf einer UNIX-Workstation,\n");
	printf("  6. M�gliche Steigerung der Geschwindigkeiten durch deren C-Compiler.\n");
	print_at(3,20);
	printf("�-1989: O. VINZENT und PROF. DR. H.-J. PATT,   Universit�t des Saarlandes,\n");
	print_at(11,21);
	printf("Fachbereich Physik, Geb.8,  D-6600 Saarbr�cken, Tel. 0681/302-3773\n");
	print_at(11,22);
	printf("GFA-Systemtechnik GmbH, Heerdter Sandberg 30, D-4000 D�sseldorf 11\n");
	p_s_top();
	printf("\33E");
	msprintf(a_char," DEMO-PROGRAMM F�R 'B_NACH_C.PRG' ");
	msprintf(b_char,"B_NACH_C WANDELT GFA-BASIC IM ASCII-FORMAT  IN EINEN C-QUELLTEXT");
	msprintf(c_char,"Ein GFA-BASIC-Listing wird nach 'C' gewandelt und ist ");
	msprintf(d_char,"sofort compilierbar !");
	msprintf(e_char,"%s%s",c_char,d_char);
	msprintf(f_char,"%s",right(a_char,16));
	print_at(24,2);
	printf("%cp%s%cq\n",*chr(27),a_char,*chr(27));
	print_at(9,4);
	printf("%s\n",b_char);
	print_at(3,6);
	printf("%s\n",e_char);
	print_at(33,8);
	printf("%cp%s%cq\n",*chr(27),f_char,*chr(27));
	print_at(26,10);
	printf("transformiert GFA-BASIC nach C\n");
	}
Esempio n. 23
0
void print(char* pMsg)
{
	print_at(pMsg, -1, -1);
}
Esempio n. 24
0
void p_f_iles(void)
	{
	print_at(2,2);
	printf("3. DEMO: Filehandling\n");
	print_at(2,4);
	printf("   Fileselectorbox, Alertbox, Auslesen eines Files, RELSEEK, SEEK, LOF, LOC ..\n");
	bild_char = sget(bild_char);
	chdrive(1);
	msprintf(a_char,"*.LST");
	msprintf(b_char,"A:\\GFA_TEST\\");
	chdir( b_char);
	fileselect(mstrcat( b_char,a_char),a_char,c_char);
	sput( bild_char);
	if(strcmp(c_char,""))
		{
		if((FP[1] = fopen(c_char,"r")) == NULL)
			{
			printf("\nFehler beim �ffnen der Datei !");
			getchar();
			r_aus(-1);
			}
		c_long=lof(FP[1]);
		msprintf(c_char,"%s",mid(c_char,rinstr(c_char,"\\")+1,-1));
		print_at(5,6);
		printf("L�nge der Datei %c%s%c%s: %ld\n",*chr(34),c_char,*chr(34),space(15-strlen(c_char)),c_long);
		relseek(FP[1],10);
		print_at(5,7);
		printf("Suche Position                   : %ld\n",loc(FP[1]));
		relseek(FP[1],10);
		print_at(5,8);
		printf("Erh�he den Filepointer um 10 Byte: %ld\n",loc(FP[1]));
		seek(FP[1],10);
		print_at(5,9);
		printf("Stelle den Pointer auf Position  : %ld\n",loc(FP[1]));
		print_at(5,11);
		printf("Auslesen und Anzeigen der Datei >>%s<< (Stop/Abbruch: Taste)\n",c_char);
		p_s_top();
		printf("\33E");
		do
			{
			printf("%c", *chr(fgetc(FP[1])));
			if(strcmp(inkey(),""))
				{
				a_lert( 2,"Abbruch",2,"JA|NEIN",back_long);
				if(back_long==1)
					{
					goto raus;
					}
				}
			if(feof(FP[1]))
				goto M2;
			}
		while(1);
		M2:
		raus:

		print_at(5,25);
		printf("Ausgelesen bis Position: %ld%s\n",loc(FP[1]),space(54-strlen(ltoab(loc(FP[1]),-1,-1))));
		fclose(FP[1]);
		}
	else
		{
		print_at(5,6);
		printf("Sie haben keine Datei ausgew�hlt!\n");
		}
	p_s_top();
	printf("\33E");
	}
Esempio n. 25
0
void print(const char *message) { print_at(message, -1, -1); }
Esempio n. 26
0
/*-----------------------------------------------------------------------------------*/
void
cputs(char *str)
{
  cursx += print_at(cursx, cursy, color, str);
}