Esempio n. 1
0
/*===========================================================================*/
void _main(void) {
#define bsize (100*20+4) // Size of a bitmap for a 160x100 screen.
    int i;
    LCD_BUFFER lcd;
    static const SCR_RECT theScreen = {{0,0,159,99}};
    unsigned char sscreen[bsize];
    unsigned char sscreen2[bsize];

    LCD_save(lcd);

    BitmapGet(&theScreen,sscreen);
    memset(sscreen2,0,bsize);
    ((BITMAP*)sscreen2)->NumRows=((BITMAP*)sscreen)->NumRows;
    ((BITMAP*)sscreen2)->NumCols=((BITMAP*)sscreen)->NumCols;
    GKeyFlush();
    for (i = 0; (i <= 360) && (!kbhit()); i++)
    {
        RotateSpriteX8_R(((BITMAP*)sscreen)->Data,((BITMAP*)sscreen2)->Data,160,100,80,50,i);
        ClrScr();
        FastCopyScreen160to240_R(100,((BITMAP*)sscreen2)->Data,LCD_MEM);
    }

    LCD_restore(lcd);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
#undef bsize
}
Esempio n. 2
0
/*===========================================================================*/
void _main(void) {
    short         i,j;
    unsigned long measure_val;
    char          tmpstr[50] = "Measuring, please wait ...";
    short         modes[6]   = { A_REPLACE,A_XOR,A_REVERSE,A_XOR,A_REPLACE,A_REVERSE};
    LCD_BUFFER    screen;

    LCD_save(screen);

    FontSetSys(F_4x6);

    OSFreeTimer(USER_TIMER);
    OSRegisterTimer(USER_TIMER,INITIAL_TIMER_VALUE);

    ClearScreen();
    DrawStr(0,0,tmpstr,A_REPLACE);

    do {
        //---------------------------------------------------------------------
        // built-in OS line drawing routine ...
        //---------------------------------------------------------------------
        OSTimerRestart(USER_TIMER);
        for (j=0;j<6 && !kbhit();j++) {
            short used_mode = modes[j];
            for (i=0;  i<160;i++) DrawLine(80,50,i,8,   used_mode);
            for (i=8;  i<100;i++) DrawLine(80,50,159,i, used_mode);
            for (i=159;i>=0; i--) DrawLine(80,50,i,99,  used_mode);
            for (i=99; i>=8; i--) DrawLine(80,50,0,i,   used_mode);
        }
        measure_val = OSTimerCurVal(USER_TIMER);
        sprintf(tmpstr,"OS Routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
        memset(LCD_MEM,0,30*8);
        DrawStr(0,0,tmpstr,A_REPLACE);

        if (kbhit()) break;

        //---------------------------------------------------------------------
        // new line drawing routine ...
        //---------------------------------------------------------------------
        OSTimerRestart(USER_TIMER);
        for (j=0;j<6 && !kbhit();j++) {
            short used_mode = modes[j];
            for (i=0;  i<160;i++) FastDrawLine_R(LCD_MEM,80,50,i,8,   used_mode);
            for (i=8;  i<100;i++) FastDrawLine_R(LCD_MEM,80,50,159,i, used_mode);
            for (i=159;i>=0; i--) FastDrawLine_R(LCD_MEM,80,50,i,99,  used_mode);
            for (i=99; i>=8; i--) FastDrawLine_R(LCD_MEM,80,50,0,i,   used_mode);
        }
        measure_val = OSTimerCurVal(USER_TIMER);
        sprintf(tmpstr,"Own Routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
        memset(LCD_MEM,0,30*8);
        DrawStr(0,0,tmpstr,A_REPLACE);
    }
    while (!kbhit());

    ngetchx();
    OSFreeTimer(USER_TIMER);
    LCD_restore(screen);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 3
0
void _main(void) {
	short int font = FontGetSys(), speed = AVERAGE, difficulty = NORMAL;

	// create the hiscore file, if it doesn't exist
	if (needScoreFile()) {
		createHiScoreTable();
	}

	// Make sure there are no keystrokes left in the buffer
	GKeyFlush();

	// setup medium size font
	FontSetSys(F_6x8);

	// seed the random number generator
	randomize();

	// disable interrupts
	OSSetSR(0x0700);

	// keep playing until doIntro returns FALSE (exit)
	while (doIntro(&speed,&difficulty)) {
		play(speed,difficulty);
	}

	// reenable interrupts before exit
	OSSetSR(0x0000);

	// restore the standard font
	FontSetSys(font);
}
Esempio n. 4
0
void _main(void)
{
  OldInt5 = GetIntVec (AUTO_INT_5);
  SetIntVec (AUTO_INT_5, MyInt5);
  while (!kbhit()) printf_xy (50, 50, "Counter = %d  ", Counter);
  SetIntVec (AUTO_INT_5, OldInt5);
  GKeyFlush ();
}
Esempio n. 5
0
void _main(void) {
    LCD_BUFFER backbuffer;
    unsigned char buffer[100*5*4];
    unsigned short i,j;

    LCD_save(backbuffer);

    ST_helpMsg("Sprite8Get() Demo - Press Key");
    ngetchx();

    for (j=0;j<64;j++) {
        for (i=0;i<20;i++) {
            Sprite8Get_R(j+(i<<3),0,100,backbuffer,((unsigned char*)buffer)+100*i);
        }
        ClrScr();
        for (i=0;i<20;i++) {
            Sprite8_OR_R(i<<3,0,100,((unsigned char*)buffer)+100*i,LCD_MEM);
        }
    }

    ST_helpMsg("Sprite16Get() Demo - Press Key");
    ngetchx();

    for (j=0;j<64;j++) {
        for (i=0;i<10;i++) {
            Sprite16Get_R(j+(i<<4),0,100,backbuffer,((unsigned short*)buffer)+100*i);
        }
        ClrScr();
        for (i=0;i<10;i++) {
            Sprite16_OR_R(i<<4,0,100,((unsigned short*)buffer)+100*i,LCD_MEM);
        }
    }

    ST_helpMsg("Sprite32Get() Demo - Press Key");
    ngetchx();

    for (j=0;j<64;j++) {
        for (i=0;i<5;i++) {
            Sprite32Get_R(j+(i<<5),0,100,backbuffer,((unsigned long*)buffer)+100*i);
        }
        ClrScr();
        for (i=0;i<5;i++) {
            Sprite32_OR_R(i<<5,0,100,((unsigned long*)buffer)+100*i,LCD_MEM);
        }
    }

    LCD_restore(backbuffer);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 6
0
/*===========================================================================*/
void _main(void) {
    LCD_BUFFER screen;
    short      retval;

    LCD_save(screen);
    OSFreeTimer(USER_TIMER);
    OSRegisterTimer(USER_TIMER,INITIAL_TIMER_VALUE);

    retval = Test8();
    if (retval != KEY_ESC) retval=Test16();
    if (retval != KEY_ESC) retval=Test32();

    OSFreeTimer(USER_TIMER);
    LCD_restore(screen);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 7
0
// draws the shop screen
void shop(unsigned int *money, int *cannon_level, int *missile_level) {
    int key = 0;
    while (key != KEY_ENTER) {
        clrscr();
        printf("You have $%d\n", *money);
        if (*cannon_level < 4) printf("Your cannons are level %d\n", *cannon_level);
        if (*cannon_level == 1) printf("Upgrade cannon - $%d\n", CANNON_UPGRADE_2);
        if (*cannon_level == 2) printf("Upgrade cannon - $%d\n", CANNON_UPGRADE_3);
        if (*cannon_level == 3) printf("Upgrade cannon - $%d\n", CANNON_UPGRADE_4);
        if (*missile_level == 0 || *missile_level == 2) printf("Down missiles  - $%d\n", MISSILES_COST);
        if (*missile_level == 0 || *missile_level == 1) printf("Up Missiles    - $%d\n", MISSILES_COST);
        if (*cannon_level < 4 ) printf("Press F1 to buy cannon\n");
        if (*missile_level < 3) printf("Up/down to buy missile\n");
        if (*cannon_level >= 4 && *missile_level >= 3) printf("You have it all!!\n");
        printf("Press enter to leave\n");
        key = ngetchx();
        if (key == KEY_F1 && *cannon_level == 1 && *money >= CANNON_UPGRADE_2) {
            *cannon_level+=1;
            *money -= CANNON_UPGRADE_2;
        } else if (key == KEY_F1 && *cannon_level == 2 && *money >= CANNON_UPGRADE_3) {
            *cannon_level+=1;
            *money -= CANNON_UPGRADE_3;
        } else if (key == KEY_F1 && *cannon_level == 3 && *money >= CANNON_UPGRADE_4) {
            *cannon_level+=1;
            *money -= CANNON_UPGRADE_4;
        }
        if (key == KEY_DOWN && *money >= MISSILES_COST) {
            if (*missile_level == 0 || *missile_level == 2) {
                *missile_level+=1;
                *money -= MISSILES_COST;
            }
        } else if (key == KEY_UP && *money >= MISSILES_COST) {
            if (*missile_level == 0 || *missile_level == 1) {
                *missile_level+=2;
                *money -= MISSILES_COST;
            }
        }
        //if (key == KEY_F5) *money+=1000;
    }
    GKeyFlush();
}
Esempio n. 8
0
void _main(void)
{
  short l,c,k;
  void *vecran;
  LCD_BUFFER backbuffer;

  LCD_save(backbuffer);

  if(!(vecran=malloc(LCD_SIZE)))
    return;

  l=c=0;

  do
  {
    DrawTiles16B(MAP_WIDTH,&map[l][c],vecran,sprts);

    FastCopyScreen_R(vecran,LCD_MEM);
/*
    memcpy(LCD_MEM,vecran,LCD_SIZE);
*/

    k=ngetchx();
    if(k==KEY_RIGHT && c<MAP_WIDTH-15)
      c++;
    if(k==KEY_LEFT && c>0)
      c--;
    if(k==KEY_DOWN && l<MAP_HEIGHT-8)
      l++;
    if(k==KEY_UP && l>0)
      l--;

  } while(k!=KEY_ESC);

  free(vecran);
  LCD_restore(backbuffer);
  GKeyFlush();
  ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 9
0
void _main(void)
{
  INT_HANDLER ai1,ai5;
  void *bloc=malloc(BIG_VSCREEN_SIZE*2+LCD_SIZE*2); // 1 big_vscreen et 1 écran virtuel
  void *vecran,*big_vscreen;
  LCD_BUFFER backbuffer;

  LCD_save(backbuffer);

  if(!bloc)
    return;

// Initialisations
  vecran=bloc;

  big_vscreen=bloc+LCD_SIZE*2;

  ai1=GetIntVec(AUTO_INT_1);
  ai5=GetIntVec(AUTO_INT_5);
  SetIntVec(AUTO_INT_1,DUMMY_HANDLER);
  SetIntVec(AUTO_INT_5,DUMMY_HANDLER);

  if(GrayOn())
  {
    RenderMaps(big_vscreen,vecran);
    GrayOff();
  }

  SetIntVec(AUTO_INT_1,ai1);
  SetIntVec(AUTO_INT_5,ai5);

  free(bloc);
  LCD_restore(backbuffer);
  GKeyFlush();
  ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 10
0
//=============================================================================
// as usual our main function ...
//=============================================================================
void _main(void) {
    LCD_BUFFER  lcd;
    LCD_BUFFER  doublebuffer;
    short       i;
    short       ball_to_update;
    INT_HANDLER oldint1        = GetIntVec(AUTO_INT_1);  // fetch default interrupt handler
    INT_HANDLER oldint5        = GetIntVec(AUTO_INT_5);  // fetch default interrupt handler

    // save screen
    LCD_save(lcd);

    // install dummy interrupt handlers for AUTO_INT1 and AUTO_INT5
    SetIntVec(AUTO_INT_1,DUMMY_HANDLER);
    SetIntVec(AUTO_INT_5,DUMMY_HANDLER);

    do {
        // clear doublebuffer
        memset(doublebuffer,0,LCD_SIZE);
        for (i=0;i<NR_BALLS;i++) {
            // NOTE: DRAWSPRITE is a macro defined at the beginning of this file!
            DRAWSPRITE(balls[i].x,balls[i].y);
        }


        // copy double buffer to visible screen
        FastCopyScreen_R(doublebuffer,LCD_MEM);

        for (ball_to_update=0;ball_to_update<NR_BALLS;ball_to_update++) {
            // calculate new position of ball which should get updated
            CalcNewPosition(&balls[ball_to_update],max_x,max_y);


            // loop over all possible combinations and check for collision ...
            for (i=0;i<NR_BALLS;i++) {
                if (i==ball_to_update) continue; // don't check against myself

                // NOTE: TESTCOLLIDE is a macro defined at the beginning of this file!
                if (TESTCOLLIDE(balls[ball_to_update].newx,balls[ball_to_update].newy,balls[i].newx,balls[i].newy)) {
                    // collision detected -> exchange dirx/diry of involved balls
                    ExchangeDirections(&balls[ball_to_update],&balls[i]);

                    // recalculate new position of ball which should get updated
                    CalcNewPosition(&balls[ball_to_update],max_x,max_y);

                    // if we still stick together than this opponent then this
                    // is not the right target to change my direction ...
                    if (TESTCOLLIDE(balls[ball_to_update].newx,balls[ball_to_update].newy,balls[i].newx,balls[i].newy)) {
                        ExchangeDirections(&balls[ball_to_update],&balls[i]);
                        CalcNewPosition(&balls[ball_to_update],max_x,max_y);
                    }
                }
            }

            // NOTE: this demo is somewhat sloppy. Normally we should not
            //       proceed if a collision is detected AND we shouldn't do the
            //       VERY simple collision detection routine above.
            //       But I don't care about this. It seems to be good enough
            //       to demonstrate the bouncing balls ...
            balls[ball_to_update].x = balls[ball_to_update].newx;
            balls[ball_to_update].y = balls[ball_to_update].newy;
        }
    }
    while (!EscapePressed());

    // restore old interrupt handlers
    SetIntVec(AUTO_INT_1,oldint1);
    SetIntVec(AUTO_INT_5,oldint5);

    // restore screen
    LCD_restore(lcd);

    // empty the keyboard buffer and write "powered by ..." string
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);

}
Esempio n. 11
0
// Main Function
void _main(void)
{
signed char STATUS, a;
int plinkos;
unsigned char *Home = malloc(LCD_SIZE); // Allocate the SAVE_SCREEN buffer
if (Home == NULL) {
	Error_Memory();
	return;
}
LCD_save(Home);  // Save LCD HomeScreen Contents

virtual_dark = malloc ( LCD_SIZE );  // Allocate the dark buffer
if (virtual_dark == NULL) {Error_Memory(); return; }
virtual_light=malloc ( LCD_SIZE );  // Allocate the light buffer
if (virtual_light == NULL)	{
	free(virtual_dark);
	Error_Memory();
	return;
}

randomize();

if (Gray_prep() == QUIT) {
	Error_Memory();
	goto end;
}

if (makefile() == QUIT)  // Tests whether or not we need a default save file and installs one if the 
// user doesn't already have one on their calc
	goto end;

for(a = 10; a--;)
	FADE_LIGHTER();
// Clears both Hidden Gray planes
ClearGrayScreen2B(Hiddenl, Hiddend);

GraySpriteX8_OR(52, 37, 27, titlel, titled, 7, Hiddenl, Hiddend);

FontSetSys (F_4x6);
GrayDBufSetHiddenAMSPlane (DARK_PLANE); 
	DrawStr(122, 94, "-- By Fisch", A_NORMAL);
GrayDBufSetHiddenAMSPlane (LIGHT_PLANE); 
	DrawStr(123, 95, "-- By Fisch", A_NORMAL);
GrayDBufToggleSync(); // switches two sets of planes

for(a = 10; a--;)
	FADE_DARKER();
Waitkey();

NEW_GAME:

if ((STATUS = MENU()) == QUIT)
	goto end;

if ((plinkos = PRODUCTS()) == QUIT)
	goto end;

if ((STATUS = INTRO()) == QUIT)
	goto end;

if ((STATUS = main_game(plinkos)) == QUIT)
	goto end;

goto NEW_GAME;

end:
// Clean up at end of Program
Cleanup();
if (Home) {
	LCD_restore(Home);
	free(Home);
	
	GKeyFlush();
	ST_helpMsg("Plinko  --By Travis Fischer");
}
}
Esempio n. 12
0
/*===========================================================================*/
void _main(void) {
    short         i,j;
    unsigned long measure_val;
    char          tmpstr[50] = "Measuring, please wait ...";
    static const short modes[4] = {COLOR_LIGHTGRAY,COLOR_DARKGRAY,COLOR_BLACK,COLOR_WHITE};
    unsigned short clippedcoord[4];
    LCD_BUFFER    screen;

    LCD_save(screen);

    OSFreeTimer(USER_TIMER);
    OSRegisterTimer(USER_TIMER,INITIAL_TIMER_VALUE);

    if (!GrayOn()) goto end;

    //---------------------------------------------------------------------
    // built-in OS line drawing routine ...
    //---------------------------------------------------------------------
    GrayClearScreen_R();
    OSTimerRestart(USER_TIMER);
    for (j=0;j<4;j++) {
        short used_color = modes[j];
        for (i=-40;  i<280;i++) GrayDrawClipLine(120,64,i,-40,used_color);
        for (i=-40;  i<168;i++) GrayDrawClipLine(120,64,280,i,used_color);
        for (i=280;i>=-40; i--) GrayDrawClipLine(120,64,i,168,used_color);
        for (i=168;i>=-40; i--) GrayDrawClipLine(120,64,-40,i,used_color);
    }
    measure_val = OSTimerCurVal(USER_TIMER);
    sprintf(tmpstr,"OS routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
    GrayDrawRect(0,0,239,7,COLOR_WHITE,RECT_FILLED);
    GrayDrawStrExt(0,0,tmpstr,A_NORMAL | A_CENTERED | A_SHADOWED,F_4x6);

    if (ngetchx() == KEY_ESC) goto end;

    
    //---------------------------------------------------------------------
    // new line drawing routine ...
    //---------------------------------------------------------------------
    GrayClearScreen_R();
    OSTimerRestart(USER_TIMER);
    for (j=0;j<4;j++) {
        short used_color = modes[j];
        for (i=-40;  i<280;i++) GrayClipDrawLine_R(120,64,i,-40,clippedcoord,used_color,GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),GrayFastDrawLine2B_R);
        for (i=-40;  i<280;i++) GrayClipDrawLine_R(120,64,280,i,clippedcoord,used_color,GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),GrayFastDrawLine2B_R);
        for (i=280;i>=-40; i--) GrayClipDrawLine_R(120,64,i,168,clippedcoord,used_color,GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),GrayFastDrawLine2B_R);
        for (i=168;i>=-40; i--) GrayClipDrawLine_R(120,64,-40,i,clippedcoord,used_color,GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),GrayFastDrawLine2B_R);
    }
    measure_val = OSTimerCurVal(USER_TIMER);
    sprintf(tmpstr,"Own routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
    GrayDrawRect(0,0,239,7,COLOR_WHITE,RECT_FILLED);
    GrayDrawStrExt(0,0,tmpstr,A_NORMAL | A_CENTERED | A_SHADOWED,F_4x6);

    if (ngetchx() == KEY_ESC) goto end;


    GrayOff();
    ClrScr();
    //---------------------------------------------------------------------
    // built-in OS line drawing routine ...
    //---------------------------------------------------------------------
    OSTimerRestart(USER_TIMER);
    for (j=0;j<4;j++) {
        WIN_RECT rect = {120, 64, 0, -40};
        for (i=-40;  i<280;i++) {rect.x1 = i; DrawClipLine(&rect,&(SCR_RECT){{0, 0, 239, 127}},A_XOR); }
        for (i=-40;  i<168;i++) {rect.y1 = i; DrawClipLine(&rect,&(SCR_RECT){{0, 0, 239, 127}},A_XOR); }
        for (i=280;i>=-40; i--) {rect.x1 = i; DrawClipLine(&rect,&(SCR_RECT){{0, 0, 239, 127}},A_XOR); }
        for (i=168;i>=-40; i--) {rect.y1 = i; DrawClipLine(&rect,&(SCR_RECT){{0, 0, 239, 127}},A_XOR); }
    }
    measure_val = OSTimerCurVal(USER_TIMER);
    sprintf(tmpstr,"OS routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
    GrayDrawRect2B(0,0,239,7,COLOR_WHITE,RECT_FILLED,LCD_MEM,LCD_MEM);
    GrayDrawStrExt2B(0,0,tmpstr,A_NORMAL | A_CENTERED,F_4x6,LCD_MEM,LCD_MEM);

    if (ngetchx() == KEY_ESC) goto end;

    //---------------------------------------------------------------------
    // new line drawing routine ...
    //---------------------------------------------------------------------
    ClrScr();
    OSTimerRestart(USER_TIMER);
    for (j=0;j<4;j++) {
        for (i=-40;  i<280;i++) ClipDrawLine_R(120,64,i,-40,clippedcoord,A_XOR,LCD_MEM,FastDrawLine_R);
        for (i=-40;  i<280;i++) ClipDrawLine_R(120,64,280,i,clippedcoord,A_XOR,LCD_MEM,FastDrawLine_R);
        for (i=280;i>=-40; i--) ClipDrawLine_R(120,64,i,168,clippedcoord,A_XOR,LCD_MEM,FastDrawLine_R);
        for (i=168;i>=-40; i--) ClipDrawLine_R(120,64,-40,i,clippedcoord,A_XOR,LCD_MEM,FastDrawLine_R);
    }
    measure_val = OSTimerCurVal(USER_TIMER);
    sprintf(tmpstr,"Own routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
    GrayDrawRect2B(0,0,239,7,COLOR_WHITE,RECT_FILLED,LCD_MEM,LCD_MEM);
    GrayDrawStrExt2B(0,0,tmpstr,A_NORMAL | A_CENTERED,F_4x6,LCD_MEM,LCD_MEM);

    ngetchx();

    end:
    OSFreeTimer(USER_TIMER);
    GrayOff();
    LCD_restore(screen);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}
Esempio n. 13
0
/*===========================================================================*/
void _main(void) {
    short         i,j;
    unsigned long measure_val;
    char          tmpstr[50] = "Measuring, please wait ...";
    short         modes[4]   = {COLOR_LIGHTGRAY,COLOR_DARKGRAY,COLOR_BLACK,COLOR_WHITE};
    LCD_BUFFER    screen;

    LCD_save(screen);
    if (!GrayOn()) return;

    OSFreeTimer(USER_TIMER);
    OSRegisterTimer(USER_TIMER,INITIAL_TIMER_VALUE);

    GrayClearScreen_R();

    GrayDrawStrExt(0,0,tmpstr,A_REPLACE|A_CENTERED|A_SHADOWED,F_4x6);

    do {
        //---------------------------------------------------------------------
        // built-in OS line drawing routine ...
        //---------------------------------------------------------------------
        OSTimerRestart(USER_TIMER);
        for (j=0;j<4 && !kbhit();j++) {
            short used_color = modes[j];
            for (i=0;  i<160;i++) GrayDrawLine(80,50,i,8,   used_color);
            for (i=8;  i<100;i++) GrayDrawLine(80,50,159,i, used_color);
            for (i=159;i>=0; i--) GrayDrawLine(80,50,i,99,  used_color);
            for (i=99; i>=8; i--) GrayDrawLine(80,50,0,i,   used_color);
        }
        measure_val = OSTimerCurVal(USER_TIMER);
        sprintf(tmpstr,"OS routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);

        GrayDrawRect(0,0,239,7,COLOR_WHITE,RECT_FILLED);
        GrayDrawStrExt(0,0,tmpstr,A_REPLACE | A_CENTERED | A_SHADOWED,F_4x6);

        if (kbhit()) break;

        //---------------------------------------------------------------------
        // new line drawing routine ...
        //---------------------------------------------------------------------
        OSTimerRestart(USER_TIMER);
        for (j=0;j<4 && !kbhit();j++) {
            short used_color = modes[j];
            for (i=0;  i<160;i++) GrayFastDrawLine2B_R(GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),80,50,i,8,   used_color);
            for (i=8;  i<100;i++) GrayFastDrawLine2B_R(GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),80,50,159,i, used_color);
            for (i=159;i>=0; i--) GrayFastDrawLine2B_R(GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),80,50,i,99,  used_color);
            for (i=99; i>=8; i--) GrayFastDrawLine2B_R(GrayGetPlane(LIGHT_PLANE),GrayGetPlane(DARK_PLANE),80,50,0,i,   used_color);
        }
        measure_val = OSTimerCurVal(USER_TIMER);
        sprintf(tmpstr,"Own routine took %lu ticks",INITIAL_TIMER_VALUE-measure_val);
        GrayDrawRect(0,0,239,8,COLOR_WHITE,RECT_FILLED);
        GrayDrawStrExt(0,0,tmpstr,A_REPLACE | A_CENTERED | A_SHADOWED,F_4x6);
    }
    while (!kbhit());

    ngetchx();
    OSFreeTimer(USER_TIMER);

    GrayOff();
    LCD_restore(screen);
    GKeyFlush();
    ST_helpMsg(EXTGRAPH_VERSION_PWDSTR);
}