Esempio n. 1
0
    void __interrupt newint24h(dword rgs, dword rfs, dword res, dword rds,
                               dword redi, dword resi, dword rebp, dword resp,
                               dword rebx, dword redx, dword recx,
                               dword volatile reax)
    {
      NW(redi); NW(redx); NW(recx); NW(rebx); NW(rebp); NW(resi);
      NW(resp); NW(rds); NW(res); NW(rfs); NW(rgs);

      if (reax & 0x8000)
      {
        cputs("Critical error ");

        cputs((reax & 0x0100) ? "writing " : "reading ");
        cputs("drive ");
        putch('A'+(char)(reax & 0xff));
        cputs(":\r\n");
      }
      else
      {
        cputs("Critical error accessing device\r\n");
      }

      reax=3; /* FAIL error code */
      return;
    }
/*************************СОРТИРОВКА ПА АЛФАВИТУ*************************/
void alf(void)
{
 FILE *f,*f1;
 char filename[14],nameoffile[14];
 char c;
 int i,n=0,j,k,fl;
 instr smass[100],old;

 window(1,1,80,25);
 textbackground(0);
 textcolor(3);
 clrscr();
 cputs("Введите имя файла-источника данных...");
 scanf("%s",filename);
 cputs("Введите имя файла,в который будут записаны данные...");
 scanf("%s",nameoffile);
 f=fopen(filename,"r");
 f1=fopen(nameoffile,"aw");
 fseek(f,0,SEEK_SET);
 while(!feof(f))
  {
   fread(&smass[n],sizeof(old),1,f);
   n++;
  }
 n--;
 for (i=n-1;i>0;i--)
   {
     for (j=0;j<i;j++)
       {
	 fl=TRUE;
	 k=0;
	 while ((k<10)AND(fl==TRUE))
	   {
	     if (smass[j].name[k]>smass[j+1].name[k])
		{
		  old=smass[j];
		  smass[j]=smass[j+1];
		  smass[j+1]=old;
		  fl=FALSE;
		}
	     if (smass[j].name[k]<smass[j+1].name[k])
		fl=FALSE;
	     k++;
	   }
       }
   }
 printf("Мнемокод    Длина  Машинный код\n");
 for (i=0;i<n;i++)
   {
   fwrite (&smass[i],sizeof(old),1,f1);
   printf("%s",&smass[i].name);
   gotoxy(15,wherey());
   printf("%s",&smass[i].size);
   gotoxy(18,wherey());
   printf("%s\n",&smass[i].hex);
   }
 fcloseall();
 cputs("Обработка завершена...");
 getch();
}
void draw_menu(struct ctk_menu *m, struct ctk_menu *open) {
#if CC_CONF_UNSIGNED_CHAR_BUGS
  unsigned char x2;
  unsigned int x, y;
#else
  unsigned char x2;
  unsigned char x, y;
#endif
  x = cursx;
  cputs(m->title);
  cputc(CH_SPACE);

  if (m == open) {
    x2 = cursx;
    if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) {
      x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH;
    }
  
    for(y = 0; y < m->nitems; y++) {
      if(y == m->active) {
	revers(0);
      }
      gotoxy(x, y + 1);
      if(m->items[y].title[0] == '-') {
	chline(CTK_CONF_MENUWIDTH);
      } else {
	cputs(m->items[y].title);
      }
      clearTo(x + CTK_CONF_MENUWIDTH);
      revers(1);
    }
    gotoxy(x2, 0);
  }
}
Esempio n. 4
0
void testcollisions()
{
  int i;

  clrscr();
  textattr(BACKGROUND+MENUITEM);
  gotoxy((78-24)/2,3);
  cputs("Test keyboard collisions");
  gotoxy((78-61)/2,5);
  cputs("Here you can test, if the keys you've choosen do not collide.");
  gotoxy((78-43)/2,6);
  cputs("(only few keyboards allow all combinations)");
  gotoxy((78-18)/2,8);
  cputs("Press ESC to exit.");
  for (i=0;i<256;i++) pressed[i]=0;
  key_init();
  do{
    showjoy(17,12,0);
    showjoy(29,12,1);
    showjoy(41,12,2);
    showjoy(53,12,3);
    while (hi==lo);
    pressed[buffer[lo]&0xff]=buffer[lo]<0x100;
    lo++;
    if (lo==100) lo=0;
  }while(!pressed[1]);
  /*wait until ESC is depressed*/
  do{
    while (hi==lo);
    pressed[buffer[lo]&0xff]=buffer[lo]<0x100;
    lo++;
    if (lo==100) lo=0;
  }while(pressed[1]);
  key_done();
}
Esempio n. 5
0
void renderMenu(uint8_t current) {
    uint8_t idx = 0;

    textcolor(1);
    revers(1);
    gotoxy(0, 0);
    for (idx = 0;  idx < menuSize;  idx++) {
        if (idx == current) {
            textcolor(3);
            cputs(menu[idx]);
            
            /*****************/
            cputsxy(0, 1, "\xf0\xc0\xc0\xc0\xc0\xee");
            gotoxy(0, 2);
            cprintf("\xdd%s\xdd", fileMenu[0]);
            gotoxy(0, 3);
            cprintf("\xdd%s\xdd", fileMenu[1]);
            gotoxy(0, 4);
            cprintf("\xdd%s\xdd", fileMenu[2]);
            gotoxy(0, 5);
            cprintf("\xdd%s\xdd", fileMenu[3]);
            cputsxy(0, 6, "\xed\xc0\xc0\xc0\xc0\xfd");
            /*****************/
            
        } else {
            cputs(menu[idx]);
        }
        textcolor(1);
        cputs("  ");
    }
    for (idx = wherex();  idx < 40;  idx++) {
        cputc(' ');
    }
}
Esempio n. 6
0
char *interactively_read_line(const char *prompt)
{
    const char DELETE = '\x7f';
    const char BACKSPACE = '\x08';
    bool line_is_complete = false;
    char c;
    size_t count = 0;

    cputs(prompt);

    while (! line_is_complete) {
        c = interactively_read_char();
        if (count > 0 && (c == DELETE || c == BACKSPACE)) {
            erase_backward(1);
            count--;
        }
        else if (c == '\r') {
            line[count] = '\0';
            line_is_complete = true;
        }
        else if (count < LINE_CAPACITY - 1) {
            cputc(c);
            line[count++] = c;
        }
        else {
            line[count] = '\0';
            line_is_complete = true;
        }
    }
    cputs("\r\n");
    return line;
}
Esempio n. 7
0
void mainmenu(int sel)
{
  int i;

  textattr(0x90);
  window(1,1,80,25);
  clrscr();
  textattr(BORDER);
  gotoxy(M_LX,M_UY);
  cputs("Ú");
  for (i = 1; i < (M_WIDTH-1); i++)
    cputs("Ä");
  cputs("¿");
  gotoxy(M_LX,M_UY+1);
  cputs("³                  ³");
  textattr(BANNER);
  gotoxy(M_LX+2,M_UY+1);
  cputs("   Main menu");
  textattr(BORDER);
  gotoxy(M_LX,M_UY+2);
  cputs("ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´");
  for (i = 3; i < (menu_count + M_HEIGHT-1); i++) {
    gotoxy(M_LX,M_UY+i);
    cputs("³                  ³");
  }
  gotoxy(M_LX,M_UY+i);
  cputs("À");
  for (i = 1; i < (M_WIDTH-1); i++)
    cputs("Ä");
  cputs("Ù");
  draw_items(menu_items,menu_count,M_LX+1,M_UY+3,sel);
}
Esempio n. 8
0
//--------------------------------------------------------------
void clear_line()                    //clear to end of line
   {                                 //80 spaces
   //.....1234567890123456789012345678901234567890
   //.....0........1.........2.........3.........4 
   cputs("                                        ");
   cputs("                                        ");
   }
Esempio n. 9
0
void dbg_printmem(void)
{ static unsigned nearLast = 0;
  static unsigned long farLast = 0;

  unsigned nearThis;
  unsigned long farThis;

  switch(heapcheck()) {
  case _HEAPCORRUPT:
    cputs("HEAP CORRUPTED. Cannot proceed!\r\n");
    abort();
  case _HEAPEMPTY:
    cputs("NO HEAP. Cannot proceed!\r\n");
    abort();
  default:
    cputs("Unknown heapcheck() error. Cannot proceed!\r\n");
    abort();
  case _HEAPOK:
    break;
  }

  nearThis = coreleft();
  farThis = farcoreleft();

  dprintf(("[free memory: near=%6u far=%13lu]\n", nearThis, farThis));
  if(nearLast)
    dprintf(("[changed    : near=%6d far=%13ld]\n"
     , nearThis - nearLast , farThis - farLast));

  nearLast = nearThis;
  farLast = farThis;
}
Esempio n. 10
0
File: rover.C Progetto: abbrev/xs
int 
main(int argc, 
     char **argv) 
{
  MotorPair m(Motor::A, Motor::C);

  for (int i = 0; i < 10 && !shutdown_requested(); ++i) {
    if (i % 2) {
      m.forward();
#ifdef CONF_DSOUND
      Sound::beep();
#endif // CONF_DSOUND
      cputs ("FWD");
    } else {
      m.reverse();
      cputs ("REV");
    }
    m.speed(m.max);
    sleep(5);
  }
  m.off();
  cls();
  
  return 0;
}
Esempio n. 11
0
/************************ ВВОД В ФАЙЛ *********************************/
void enter(void)
{
 instr com;
 FILE *f;
 int i,numm;
 char filename[14],k;

 window(1,1,80,25);
 textbackground(0);
 textcolor(3);
 clrscr();
 cputs("Введите название файла, в который будете делать запись...");
 gets(filename);
 cputs("Сколько будем делать записей...");
 scanf("%d",&numm);
 gets(com.name);
 for (i=0;i<numm;i++)
  {
   clrscr();
   printf("Запись номер %d\n",i);
   cputs("  Введите мнемокод команды...");
   gets(com.name);
   cputs("  Введите длину команды...");
   gets(com.size);
   cputs("  Введите шестнадцатиричный код команды...");
   gets(com.hex);
   if(access(filename,06)==-1)
     f=fopen(filename,"aw");
    else
     f=fopen(filename,"ar");
   fseek(f,0,SEEK_END);
   fwrite(&com,sizeof(com),1,f);
   fclose(f);
   }
}
Esempio n. 12
0
void funccall::colbox()
{
	int i;
	for(i=1;i<6;++i)
	{
		_setcursortype(_NOCURSOR);
		textbackground(BLACK);
		textcolor(i);
		clrscr();
		box(77,23,2,2);
		delay(500);
		box(73,19,4,4);
		delay(500);
		box(69,15,6,6);
		delay(500);
		box(65,11,8,8);
		delay(500);
		textcolor(WHITE);
		gotoxy(10,10);
		cputs("CREEPER");
		gotoxy(64,10);
		cputs("CREEPER");
		gotoxy(10,16);
		cputs("CREEPER");
		gotoxy(64,16);
		cputs("CREEPER");
		gotoxy(36,13);
		cputs("CREEPER");
		delay(1000);
	}
}
Esempio n. 13
0
void test_cheap(void) {
    cputs("C heap tests:\r\n");
    test_cheap_push();
    test_cheap_pop();
    test_cheap_sort();
    //test_cheap_benchmark();
    cputs("\r\n");
}
Esempio n. 14
0
void suppl_log_exit(suppl_log_csptr_t loginfo)
{	if(loginfo) {
		cputs("\r\n");
		cputs(loginfo);
		cputs("\r\n");
	}
	exit(DBG_EXIT_CODE);
}
Esempio n. 15
0
void main()
{
 int x,x2=1,y;
 for(int j=0,k=0; j<46;j++)
 {
   if(j%6==0) k++;
	y=0;x=x2++;
 for(int i=0;i<40;i++)
 {

 	if(i<8)
   	y++;
   else if(i<16)
   	y--;
   else if(i<24)
   	y++;
   else if(i<32)
   	y--;
   else if(i<40)
   	y++;
  /*  else if(i<48)
   	y--;
   else if(i<56)
   	y++;
  else if(i<64)
   	y--;
   else if(i<72)
   	y++;
   else if(i<80)
		y--;
   else if(i<88)
   	y++;
   else if(i<96)
   	y--;
   else if(i<104)
   	y++;
   else if(i<112)
   	y--;         */

   Sleep(3);
   x=x+3;
   if(j%2==0)
   {
   gotoxy(x,y+15);
   cputs("* * *");
   }

   else
   {
   gotoxy(x,y+15);
   cputs("     ");
   }

   }
}
getch();

}
Esempio n. 16
0
// funkcia oznaci danu funkciu
void sel_item(int sel, int old_sel)
{
  gotoxy(M_LX+1, M_UY+3+old_sel);
  textattr(NOR_ITEM);
  cputs(menu_items[old_sel]);
  gotoxy(M_LX+1, M_UY+3+sel);
  textattr(SEL_ITEM);
  cputs(menu_items[sel]);
}
Esempio n. 17
0
 void con_puts( const char *s )
 {
   #ifdef _TARGET_GO32_
   VString str = s;
   str_replace( str, "\n", "\r\n" );
   cputs( str );
   #else
   cputs( s );
   #endif
 }
Esempio n. 18
0
void myexit()
{
  system("del *.dbf");
  clrscr();
  textcolor(BLUE);
  cputs("Abhay Rana");NL cputs("XII-Sc");NL cputs("Templeton College");
  textcolor(WHITE);
  NL NL cputs("Thanks to all those who helped me complete the project in time. Your names do appear in the program"); NL cputs("S‚ Onr Sv‚rdar Sitja Hvass");
  GC
}
Esempio n. 19
0
void main()
{
    clrscr();
    cputs(get_machine_hardware_name());
    cputc(' ');
    cputs(get_cpu_name());
    cputs("\r\n");

    getchar();
}
Esempio n. 20
0
/*------------------------------------------------------------------------*
 * Simulator main.                                                        *
 *------------------------------------------------------------------------*/
int main(void) {
  EventListener sd1fel, sd2fel, tel;

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Serial ports (simulated) initialization.
   */
  sdStart(&SD1, NULL);
  sdStart(&SD2, NULL);

  /*
   * Shell manager initialization.
   */
  shellInit();
  chEvtRegister(&shell_terminated, &tel, 0);

  /*
   * Console thread started.
   */
  cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1,
                             console_thread, NULL);

  /*
   * Initializing connection/disconnection events.
   */
  cputs("Shell service started on SD1, SD2");
  cputs("  - Listening for connections on SD1");
  (void) chIOGetAndClearFlags(&SD1);
  chEvtRegister(chIOGetEventSource(&SD1), &sd1fel, 1);
  cputs("  - Listening for connections on SD2");
  (void) chIOGetAndClearFlags(&SD2);
  chEvtRegister(chIOGetEventSource(&SD2), &sd2fel, 2);

  /*
   * Events servicing loop.
   */
  while (!chThdShouldTerminate())
    chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));

  /*
   * Clean simulator exit.
   */
  chEvtUnregister(chIOGetEventSource(&SD1), &sd1fel);
  chEvtUnregister(chIOGetEventSource(&SD2), &sd2fel);
  return 0;
}
Esempio n. 21
0
/*------------------------------------------------------------------------*
 * Simulator main.                                                        *
 *------------------------------------------------------------------------*/
int main(void) {
  EventListener sd1fel, sd2fel, tel;

  /*
   * HAL initialization.
   */
  halInit();

  /*
   * ChibiOS/RT initialization.
   */
  chSysInit();

  /*
   * Serial ports (simulated) initialization.
   */
  sdStart(&SD1, NULL);
  sdStart(&SD2, NULL);

  /*
   * Shell manager initialization.
   */
  shellInit();
  chEvtRegister(&shell_terminated, &tel, 0);

  /*
   * Console thread started.
   */
  cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1,
                             console_thread, NULL);

  /*
   * Initializing connection/disconnection events.
   */
  cputs("Shell service started on SD1, SD2");
  cputs("  - Listening for connections on SD1");
  (void) sdGetAndClearFlags(&SD1);
  chEvtRegister(&SD1.sevent, &sd1fel, 1);
  cputs("  - Listening for connections on SD2");
  (void) sdGetAndClearFlags(&SD2);
  chEvtRegister(&SD2.sevent, &sd2fel, 2);

  /*
   * Events servicing loop.
   */
  while (!chThdShouldTerminate())
    chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));

  /*
   * Clean simulator exit.
   */
  chEvtUnregister(&SD1.sevent, &sd1fel);
  chEvtUnregister(&SD2.sevent, &sd2fel);
  return 0;
}
Esempio n. 22
0
void office::of_beg()
{
	int i, v;
	do{
	textbackground(BLUE);
	textcolor(CYAN);
	_setcursortype(_NORMALCURSOR);
	clrscr();
	for(i=0;i<10;++i)
	{
		box(1+7*i,1+2*i,4,4);
		delay(80);
		box(1+7*i,1+2*i,4,4,int(' '));
	}
	box(74,22,4,4);
	gotoxy(25,2);
	textcolor(GREEN);
	cputs("WELCOME TO CREEPER OFFICE...");
	gotoxy(6,6);
	textcolor(CYAN);
	cout<<"1. CALCULATOR";
	gotoxy(6,12);
	cout<<"0. MAIN MENU";
	gotoxy(6,8);
	cout<<"2. CREEPER FILE EXPERT ";
	gotoxy(6,10);
	cout<<"3. CALENDAR ";
	gotoxy(25,22);
	cout<<"ENTER THE CHOICE NUMBER : ";
	v=int(getche()-48);
	delay(100);
	if(v)
	{ switch(v)
	 {
		case 1:
			calc();
			break;
		case 2:
		      class	File a;
			break;
		case 3:
			calendar();
			break;
		default:
			gotoxy(55,22);
			cputs("INVALID ENTRY");
			delay(1000);
			break;
	 }
	}
       }while(v!=0);
}
Esempio n. 23
0
/*------------------------------------------------------------------------*
 * Simulator main.                                                        *
 *------------------------------------------------------------------------*/
int main(void) {

	initTestStream(&testStream);

	/*
	 * System initializations.
	 * - HAL initialization, this also initializes the configured device drivers
	 *   and performs the board-specific initializations.
	 * - Kernel initialization, the main() function becomes a thread and the
	 *   RTOS is active.
	 */
	halInit();
	chSysInit();

	/*
	 * Serial ports (simulated) initialization.
	 */
	sdStart(&SD1, NULL);
	sdStart(&SD2, NULL);

	/*
	 * Console thread started.
	 */
	cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, console_thread, NULL);

	/*
	 * Initializing connection/disconnection events.
	 */
	cputs("Shell service started on SD1, SD2");
	cputs("  - Listening for connections on SD1");
	chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1);
	cputs("  - Listening for connections on SD2");
	chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2);

	rusEfiFunctionalTest();

	/*
	 * Events servicing loop.
	 */
	while (!chThdShouldTerminate()) {
		chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
		printPendingMessages();
		chThdSleepMilliseconds(100);
	}

	/*
	 * Clean simulator exit.
	 */
	chEvtUnregister(chnGetEventSource(&SD1), &sd1fel);
	chEvtUnregister(chnGetEventSource(&SD2), &sd2fel);
	return 0;
}
Esempio n. 24
0
/*赢棋处理*/
void DoWin(int Order)
{
   textcolor(RED+BLINK);
   gotoxy(8,10);
   if(Order==CHESS_1)
     cputs("PLAYER1 WIN!");
   else
     cputs("PLAYER2 WIN!");
   gotoxy(8,11);
   cputs("  \\<^+^>/   ");
   gotoxy(gCursor.x+MAPX_O,gCursor.y+MAPY_O);
   getch();
}
Esempio n. 25
0
/* Display the high score table */
void print_highscores(HIGHSCORE *high_scores)
{
    UINT8 i;

    for (i=0; i<NUM_HIGH_SCORES; i++)
    {
        gotoxy(HIGHSC_X, HIGHSC_Y+2+(i<<1));
        print_uint16_5(high_scores[i].score);
        gotoxy(HIGHSC_X+5, HIGHSC_Y+2+(i<<1));
        cputs("0 ");
        cputs(high_scores[i].name);
    }
}
Esempio n. 26
0
void print_game_over(void)
{
    /* I had trouble defining PET graphics chars with \x?? within C strings,
       hence the binary array above. */
    gotoxy(GAMEOVER_X, GAMEOVER_Y);
    cputs(&gameover[0][0]);
    gotoxy(GAMEOVER_X, GAMEOVER_Y+1);
    cputs(&gameover[1][0]);
    gotoxy(GAMEOVER_X, GAMEOVER_Y+2);
    cputs(&gameover[2][0]);
    gotoxy(GAMEOVER_X, GAMEOVER_Y+3);
    cputs(&gameover[3][0]);
}
Esempio n. 27
0
/**********************СОРТИРОВКА ПО ДЛИНЕ***************************/
void length(void)
{
 FILE *f,*f1;
 char filename[14],nameoffile[14];
 char c;
 int i,n=0,k;
 instr com;

 window(1,1,80,25);
 textbackground(0);
 textcolor(2);
 clrscr();
 cputs("Введите имя файла-источника данных...");
 scanf("%s",filename);
 cputs("Введите имя файла,в который будут записаны данные...");
 scanf("%s",nameoffile);
 f=fopen(filename,"r");
 f1=fopen(nameoffile,"aw");
 fseek(f,0,SEEK_SET);
 while(!feof(f))
  {
   fread(&com,sizeof(com),1,f);
   n++;
  }
 printf("Мнемокод    Длина  Машинный код\n");
 n--;
 for(k=49;k<=57;k++)
  {
   fseek(f,0,SEEK_SET);
   for(i=0;i<n;i++)
	{
	 c=toascii(k);
	 fread(&com.name,sizeof(com.name),1,f);
	 fread(&com.size,sizeof(com.size),1,f);
	 fread(&com.hex,sizeof(com.hex),1,f);
	 if(com.size[0]==c)
            {
	    fwrite(&com,sizeof(com),1,f1);
	    printf("%s",&com.name);
	    gotoxy(15,wherey());
	    printf("%s",&com.size);
	    gotoxy(18,wherey());
	    printf("%s\n",com.hex);
            }
	}
  }
 fcloseall();
 cputs("Обработка завершена...");
 getch();
}
Esempio n. 28
0
void createwin(void)
{
   cputs("╔════════════════════════════╗");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("║                            ║");
   cputs("╚════════════════════════════╝");

}
Esempio n. 29
0
/**
 * Refresh the elapsed time value.
 */
void refreshElapsedTime(void)
{
    uint16_t t;

    t = timerGet();
    gotoxy(17, 13);
    leadingZero(t >> 8);
    utilAppendDecimal(t >> 8);
    cputs(utilStr);
    cputc(':');
    leadingZero(t & 0xff);
    utilAppendDecimal(t & 0xff);
    cputs(utilStr);
}
Esempio n. 30
0
int main(unsigned argl, const char far* args)
{
	STACK_DECL char arg[128];
	uint16 cmd;

	int_init();

	tsr_loaded = tsr_is_installed();

	/* Duplicate the command line locally */
	memcpy(arg, args, argl);
	arg[argl] = 0;

	/* Call the main TSR function */
	if (tsr_loaded)
		cmd = tsr(mem_remote, arg);
	else
		cmd = tsr(0, arg);

	if (cmd == TSR_LOAD) {
		if (tsr_loaded)
			return EXIT_FAILURE;
		if (!load())
			return EXIT_FAILURE;
		/* device driver hasn't the environment */
		if (!tsr_sys)
			freeenv();
		return EXIT_TSR;
	}

	if (cmd == TSR_UNLOAD) {
		if (!tsr_loaded)
			return EXIT_FAILURE;
		if (!mem_unload()) {
			cputs("Can't unload\n\r");
			return EXIT_FAILURE;
		}
		if (freemem(tsr_loaded->psp) != 0) {
			cputs("Can't release the memory\n\r");
			return EXIT_FAILURE;
		}
		return EXIT_SUCCESS;
	}

	if (cmd == TSR_SUCCESS)
		return EXIT_SUCCESS;
	else
		return EXIT_FAILURE;
}