Exemple #1
0
// alokuje pamat
// size v bytoch
void *malloc(int size)
{
  int pc = 0;  // pocet stranok
  int i, start, end;

  if (!size) return NULL;
  // prepocita size na stranky
  pc = size / (PAGE_SIZE * 1024);
  if (!pc) pc++;

  if (!search_mem(pc,0,&start)) {
    textattr(atrERROR);
    cprintf("\n\tMAU: Out of memory");
    textattr(atrBORDER);
    return NULL;
  }
  
  // oznacenie pouzitosti
  end = start+pc;
  for (i = start; (i < max_items) && (i < end); i++) {
    memory[i].used = 1;
    memory[i].phy_addr = MK_FP(FP_SEG((long)(PAGE_SIZE * i * 1024)),
			       FP_OFF((long)(PAGE_SIZE * i * 1024)));
    memory[i].phy_addr += MemStart;
    memory[i].page_count = pc--;
  }

  cprintf("\naddr: %x", memory[start].phy_addr);
  return (memory[start].phy_addr);
}
Exemple #2
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);
}
Exemple #3
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]);
}
Exemple #4
0
void mauDESTROY()
{
  textattr(atrINIT);
  cprintf("\nFreeing memory...");
  clear_mem();
  cprintf("\nStopping Memory Allocation Unit...");
  textattr(atrBORDER);
  DisableA20();
  cprintf("\n\tLink A20 disabled...");
}
void main (void)
{
   int cor;

   for (cor = 1; cor < 16; cor++)
   {
       textattr (cor);
       cprintf ("Esta e a cor %d\r\n", cor);
   }
   textattr (128 + 15);
   cprintf ("Isto e piscante \r\n");
}
Exemple #6
0
 void con_ce( int attr )
 {
   if (attr != -1)
     {
     int ta = __ta;
     textattr( attr );
     clreol();
     textattr( ta );
     }
   else
     clreol();
 }
Exemple #7
0
void XBeamStop::Show(){
	gotoxy(56,4);
	switch(ShutOpenedStatus) {
		case TRUE:
			textattr(0x02);cprintf("Opend ");
			break;
		case FALSE:
			textattr(0x02);cprintf("Closed");
			break;
		default:
			textattr(0x02);cprintf("Unknow");
	}    
}
Exemple #8
0
void XInstrument::Show() {
	gotoxy(28,15);
	switch(m_status) {
	case Sampling:  //0
		textattr(0x02);cprintf("Sampling...         ");
		break;
	case TubeReady: //1
	    textattr(0x02);cprintf("XRayTube Ready      ");
		break;		
	case Idle:      //3
		textattr(0x01);cprintf("Idle                ");
		break;
	case SwitchToSampling: //4
		textattr(0x02);cprintf("Switching To Sample ");
		break;
	case SwitchToTubeReady://5
		textattr(0x82);cprintf("Switching To Ready  ");
		break;					
	case SwitchToIdle:     //7
		textattr(0x81);cprintf("Switching To Idle   ");
		break;	
}
	
	gotoxy(28,17);textattr(0x04);
	cprintf("PA=%2X PB=%2X PC=%2X",CurrDioPort[0],CurrDioPort[1],CurrDioPort[2]);
	textattr(0x07);
}
Exemple #9
0
void conDRAW_CHATT()
{
  asm {        // cls
    mov ax, 3
    int 0x10
  }
  comSENDNICK();
  textattr(atrBANNER);
  cprintf("\n\t\tWelcome to CHATT console\n");
  
  textattr(atrSUBBANNER);
  cprintf("\n\t\tLet's chatt... (Press F1 for system console)\n");

  textattr(atrBORDER);
}
Exemple #10
0
void cabecalho_pequeno(){
	
	gotoxy(1,1);printf(" _______________________________________");
	gotoxy(1,2);printf("|                IFPB CRUSH             |");
	gotoxy(18,2);textcolor(3);printf("I");
	gotoxy(19,2);textcolor(10);printf("F");
	gotoxy(20,2);textcolor(12);printf("P");
	gotoxy(21,2);textcolor(14);printf("B");
	textcolor(15);
	gotoxy(1,3);printf("|_______________________________________|");
	textattr(7);
	gotoxy(1,2);printf("| ESC: sair ");
	textattr(15);
	gotoxy(1,22);printf("-----------------------------------------");
}
Exemple #11
0
// funkcia vypise zoznam menu
void draw_items(char **it, int count, int X, int Y, int sel)
{
  int i;
  gotoxy(X, Y);
  textattr(NOR_ITEM);
  for (i = 0; i < count; i++) {
    gotoxy(X,Y+i);
    if (sel == i) {
      textattr(SEL_ITEM);
      cputs(it[i]);
      textattr(NOR_ITEM);
    }
    else
      cputs(it[i]);
  }
}
Exemple #12
0
/*----------------------------------------------------------------------
  MakeWindow
  ----------------------------------------------------------------------*/
void MakeWindow(int Boven,int Links,int Onder,int Rechts,
		int Stijl,unsigned int Attr)
{

  if (hWnd<MAXWINDOWS-1) {

    hWnd++;
    WindowStruc[hWnd]=(hbWindow *) malloc(sizeof(hbWindow));

	 WindowStruc[hWnd]->Clip=(char *)
	 malloc(((Onder-Boven+2)*(Rechts-Links+3))*2);

    gettextinfo(&WindowStruc[hWnd]->TextInfo);

	 gettext(Links,Boven,Rechts+2,Onder+1,WindowStruc[hWnd]->Clip);

    textattr(Attr);
    window(Links,Boven,Rechts,Onder);
    clrscr();
	 if (Stijl)
      Box(Boven,Links,Onder,Rechts,Stijl,Attr);
    Schaduw(Boven,Links,Onder,Rechts);

  }

}
void NormalText()
{
	TcclibInitialize();

	attrib = A_NORMAL;
	textattr( A_NORMAL );
}
Exemple #14
0
void init_menu (void)
{
	gotoxy(0,0);
	textattr(0x07);
	clrscr();
	ptr_data=NULL;
}
Exemple #15
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();
}
Exemple #16
0
int menu(int li,int ci,char *s[])
{ int i=0,pos=0,cont,cor;
  char *p,*o,ch;
  cor=getcolor();

  while(*s[i]!='\0')
  {
   outtextxy(ci,li+i,s[i]);
   cont++; i++;
   }
   i=0;
   while( (ch!=27) && (ch!=13)   )
   {ch=getch();
    if(ch==27) break;
    if(ch==13) break;
    if(pos>i)  textattr(cor+((cor+1)<<4));
    if(ch==80)i+=15;
    if(ch==72)i-=15;
    if((li+i)==cont) i=0;
    if(i<0)          i=cont;
    outtextxy(ci,li+i,s[i]);
    setcolor(cor);
    }
    closegraph();
    if(ch==27) return 0;
    if(ch==13) return pos;

}
void UnderlineText()
{
	TcclibInitialize();

	attrib = A_UNDERLINE;
	textattr( A_UNDERLINE );
}
Exemple #18
0
 void con_cs( int attr )
 {
   if (attr != -1)
     {
     int ta = __ta;
     textattr( attr );
     clrscr();
     gotoxy(1,1);
     textattr( ta );
     }
   else
     {
     clrscr();
     gotoxy(1,1);
     }
 }
Exemple #19
0
void XInstrument::ShowComStatus() {
	gotoxy(55,15);textattr(0x05);cprintf("LSR=%2X",lsr);
	gotoxy(55,16);textattr(0x06);cprintf("MSR=%2X",msr);
	gotoxy(55,17);
	if((msr&DSR)==0) {
		textattr(0x84);
		ResetSendBuffer();
		ResetCommandBuffer();
		//RenewError();
		cprintf("Disconnected!");
	}
	else {
		textattr(0x02);
		cprintf("Connected!   ");
	}
}
Exemple #20
0
void cabecalho(){
	
		gotoxy(1,1);printf("________________________________________________________________________________");
		gotoxy(1,2);printf("|                                        CRUSH                                 |");
		gotoxy(36,2);textcolor(3);printf("I");
		gotoxy(37,2);textcolor(10);printf("F");
		gotoxy(38,2);textcolor(12);printf("P");
		gotoxy(39,2);textcolor(14);printf("B");
		textcolor(15);
		gotoxy(1,3);printf("--------------------------------------------------------------------------------");
		textattr(7);
		gotoxy(1,2);printf("| ESC: sair ");
		textattr(15);
		gotoxy(1,22);printf("--------------------------------------------------------------------------------");

}
Exemple #21
0
void term_init(int screenheight)
{
   struct text_info dat;

   if (saved_lines <= 0) {
      gettextinfo(&dat);
      screen_h = saved_lines = dat.screenheight;
      screen_w = dat.screenwidth;
      norm_attrib = dat.normattr;
   }

   if (screen_h != screenheight) {
      _set_screen_lines(screenheight);
      gettextinfo(&dat);
      screen_h = dat.screenheight;
      screen_w = dat.screenwidth;
   }

   set_bright_backgrounds();

   n_vid();
   textattr(attrib);
   cls();

   mouse_init();

   errno = 0;
}
Exemple #22
0
Fichier : ui.c Projet : badcodes/c
void drawframe(int x, int y, int width, int height, int color)
{
  int i,j;
  
  textattr(color);
  gotoxy(x,y);
  
  _putch(ACS_ULCORNER);
  for (i=0;i<width+2;i++) 
	_putch(ACS_HLINE);
  _putch(ACS_URCORNER);
  
  for (i = 0;i<height;i++) {
	  gotoxy(x,y+i+1);
	  _putch(ACS_VLINE);
	  _putch(' ');
   
   for (j=0;j<width;j++) {
	    _putch(' ');
      }
          _putch(' ');
	  _putch(ACS_VLINE);
  }
 
  gotoxy(x,y+height+1);
  _putch(ACS_LLCORNER);
  for (i=0;i<width+2;i++) 
	_putch(ACS_HLINE);
  _putch(ACS_LRCORNER);
}
Exemple #23
0
static inline void D_Titlebar(char *title1, char *title2)
{
    // SRB2 banner
    clrscr();
    textattr((BLUE<<4)+WHITE);
    clreol();
    cputs(title1);

    // standard srb2 banner
    textattr((RED<<4)+WHITE);
    clreol();
    gotoxy((80-strlen(title2))/2, 2);
    cputs(title2);
    normvideo();
    gotoxy(1,3);
}
void SetAttrib( char attribute  )
{
	TcclibInitialize();

	attrib = attribute;
	textattr( attribute );
}
Exemple #25
0
void shutdown(void)
{
	/* this function restores the system upon application exit */

	ratoff();
	closegraph();

	textattr(original.attribute);
	window(original.winleft,
			original.wintop,
			original.winright,
			original.winbottom);

	/* shutdown fonts */
	rename("tscr.chr","ccslchr0.fnt");
	rename("goth.chr","ccslchr1.fnt");
	rename("litt.chr","ccslchr2.fnt");
	rename("sans.chr","ccslchr3.fnt");
	rename("trip.chr","ccslchr4.fnt");
	rename("bold.chr","ccslchr5.fnt");
	rename("euro.chr","ccslchr6.fnt");
	rename("lcom.chr","ccslchr7.fnt");
	rename("scri.chr","ccslchr8.fnt");
	rename("simp.chr","ccslchr9.fnt");

	/* shutdown graphics interface */
	rename("att.bgi","ccslgfx1.gri");
	rename("cga.bgi","ccslgfx2.gri");
	rename("egavga.bgi","ccslgfx3.gri");
	rename("herc.bgi","ccslgfx4.gri");
	rename("ibm8514.bgi","ccslgfx5.gri");
	rename("pc3270.bgi","ccslgfx6.gri");
    PXExit();
}
Exemple #26
0
int main()
{
int color;
textattr(128 + 10);
cprintf("This is blinking text\n");
return 0;
}
Exemple #27
0
void XInstrument::StartSample() {
	Running=FALSE;
	pCh->ResetAllChn();
	pCh->ReadyStart=(BOOL)!pCh->CollectFreeChs();
	SamplingStarted=TRUE;
	m_status=Sampling;
	gotoxy(70,1);textattr(0x17);cprintf("Sampling...");
}
Exemple #28
0
void mauINIT()
{
  textattr(atrINIT);
  cprintf("\nStarting Memory Allocation Unit...");
  textattr(atrBORDER);
  cprintf("\n\tMemory: ");
  textattr(atrIMPTEXT);
  cprintf("%ld", mem);
  textattr(atrBORDER);
  cprintf(" kB");

  // povolenie linky A20
  EnableA20();
  cprintf("\n\tLink A20 enabled...");
  
  // max. pocet poloziek
  if (mem < MAX_ITEMS)
    max_items = mem - 36;
  else
    max_items = MAX_ITEMS - 36;

  // cistenie tabulky pamate
  clear_mem();

  // zaciatok alokovania pamate
  MemStart = MK_FP(0x3400,0); //(fyzicka adresa)

  textattr(atrBORDER);
  cprintf("\n\tFree memory: ");
  textattr(atrIMPTEXT);
  cprintf("%ld", coreleft());
  textattr(atrBORDER);
  cputs(" kB");
}
Exemple #29
0
void XKey::Show(){
    gotoxy(28,4);
    if(Key1OnStatus){
        textattr(0x02);cprintf("Key1: ON ");
    }
    else{
        textattr(0x02);cprintf("Key1: OFF");
    }
    
    gotoxy(28,5);
    if(Key1OnStatus){
        textattr(0x02);cprintf("Key2: ON ");
    }
    else{
        textattr(0x02);cprintf("Key2: ON ");
    }    
    
}
Exemple #30
0
// funkcia je konzolou chattu
void conCHATT()
{
  char chatt_buff[80];
  int i;

  // init chatt console - draw
  conDRAW_CHATT();

  while (conACTIVE == 1) {
    textattr(atrCONSOLE);
    cprintf("\n(%s)->(%s): ", myNICK, strangerNICK);
    textattr(atrBORDER);
    cgets(chatt_buff);
    comSENDROW(chatt_buff);
    for (i = 0; i < 80; i++)
      chatt_buff[i] = '\0';
  }
}