示例#1
0
/* This function is called repetitively from the main program */
void labwork( void )
{
  
  prime = nextprime ( prime );
  display_string ( 0, itoaconv( prime ));
  display_update();
}
示例#2
0
void exit_game()
{
    IEC(0) = ~0xFFFF;
    display_string(0, "                ");
    display_string(1, "   Game Over    ");

    char str[16] = "  Score: ";
    char *scr = itoaconv(score);
    for(int i = 9; *scr; str[i] = *scr++, i++);
    display_string(2, str);

    display_update_text();
    for(;;);
}
示例#3
0
/* This function is called repetitively from the main program */
void labwork( void ){
	prime = nextprime(prime);
	display_string(0, itoaconv(prime));
	display_update();
	int btns = getbtns();
	if(btns){
		int sw = getsw();
		//BTN2
		if(btns  & 0x4){
			mytime &= 0x0fff; //remove old digit
			mytime |= (sw<<12); //set new digit
		}
		//BTN3
		if(btns & 0x2){
			mytime &= 0xf0ff;
			mytime |= (sw<<8);
		}
		//BTN2
		if(btns & 0x1){
			mytime &= 0xff0f;
			mytime |= (sw<<4);
		}
	}
}
示例#4
0
void labwork( void )
{
  prime = nextprime( prime );
  display_string( 0, itoaconv( prime ) );
  display_update();

/*
    // If BTN2 & BTN3 is pressed at the same time a different binary number is returned.
    // If any button is pressed after getbtns() is called the status of button will not be used.
    unsigned int btns_status = getbtns();
    unsigned int sw_status = getsw();

    
    // BTN2 is pressed
    if (btns_status == 1) {
        mytime &= 0xff0f; //Remove third digit from my time.
        sw_status <<= 4;
        mytime += sw_status; // Add switched sw_status to third digit of mytime
        
    // BTN3 is pressed
    } else if (btns_status == 2) {
        mytime &= 0xf0ff;
        sw_status <<= 8;
        mytime += sw_status;
        
    // BTN4 is pressed
    } else if (btns_status == 4) {
        mytime &= 0x0fff;
        sw_status <<= 12;
        mytime += sw_status;
    }

    unsigned int overflow = IFS(0);
    overflow &= 0x000100;
    overflow >>= 8;

    
    if (overflow == 1) {
        if (timeoutcount == 10) { // Helps getting the 'delay' correct
            timeoutcount = 0;
            time2string( textstring, mytime );
            display_string( 3, textstring );
            display_update();
            tick( &mytime );
            if (first_tick == 1) {
                *porte = 0;
                first_tick = 0;
            } else {
                *porte += 1;
            }
            display_image(96, icon);
        } else {
            timeoutcount++;
        }
        IFS(0) = 0; // Set flag to 0 again. NOTE: MAY NEED CHANGING IN ASSIGNMENT 3
    }



	mytime &= 0x0000;
    unsigned int overflow = IFS(0);
    overflow &= 0x000100;
    overflow >>= 8;
    mytime += overflow;
time2string( textstring, mytime );
            display_string( 3, textstring );
            display_update();



*/
}