Beispiel #1
0
void printrating(void)
{
    unsigned long allresult, allcycles;
    unsigned char n;
    unsigned long r, c;
    unsigned int a,b;

    allresult = 0;
    allcycles = 0;

    n = 0;
    while (testinfo[n].generator) {
        if (testinfo[n].weight > 0) {
            allresult += testinfo[n].result / testinfo[n].weight;
            allcycles += (testinfo[n].cycles * 2) / testinfo[n].weight;
        }
        ++n;
    }

    c = ((unsigned long)allcycles) * 100L;
    r = ((unsigned long)allresult);

    a = (c / r) / 100;
    b = (c / r) % 100;

    revers(1);
    gotoxy(0,24); cclear(40);
    gotoxy(0,24); cprintf("Accumulated weighted rating: %2d.%02dx", a, b);
    revers(0);
}
Beispiel #2
0
uint8_t display_control_line(uint8_t line_count)
{
    char c;

    revers(true);
    cputs("--More--");
    revers(false);
    c = tolower(cgetc());
    erase_backward(8);
    switch (c) {
        case 'b':
            /* Go back one page.*/
            break;
        case ' ':
            /* Print the next page.*/
            line_count = 0;
            break;
        case 'q':
            /* Quit.*/
            exit(EXIT_SUCCESS);
        case CARRIAGE_RETURN:
            /* Display one more line. */
            line_count -= 1;
            break;
    }
    return line_count;
}
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);
  }
}
Beispiel #4
0
static unsigned UpdateAsm (void)
/* Update the assembler window starting at the given address */
{
    char buf [MAX_X];
    unsigned char len;
    unsigned char y;
    unsigned char width = AsmFrame.fd_width;
    unsigned char x = AsmFrame.fd_x1 + 1;
    unsigned      m = AsmBack (AsmAddr, 2);

    for (y = AsmFrame.fd_y1+1; y < AsmFrame.fd_y2; ++y) {
        len = DbgDisAsm (m, buf, width);
        if (m == brk_pc) {
            buf [4] = '-';
            buf [5] = '>';
        }
        if (DbgIsBreak (m)) {
            buf [5] = '*';
        }
        if (m == AsmAddr) {
            revers (1);
            cputsxy (1, y, buf);
            revers (0);
        } else {
            cputsxy (1, y, buf);
        }
        m += len;
    }
    return m;
}
Beispiel #5
0
void process_checkbox(tgui_Window *win, tgui_Obj *obj){
int x, y;
char key;

    x=win->x1 + 1 + obj->x;
    y=win->y1 + 2 + obj->y;

	gotoxy(x+1,y);
	cursor(1);
	revers(1);
	if (obj->state==0) cputc(' ');
	else cputc('X');

	do {
		gotoxy(x+1,y);
	    revers(1);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	    gotoxy(x+1, y);
	    key=cgetc();

	    if (key==' ') {
	        if(obj->state == 0 ) obj->state =1;
			else obj->state = 0;
		}

	} while (key != CH_ENTER);

		gotoxy(x+1,y);
	    revers(0);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	cursor(0);

}  // process_checkbox
Beispiel #6
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;

  /* Draw menus */
  (void)textcolor(MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, m == menus->open);
  }

  /* Draw desktopmenu */
  if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) {
    gotoxy(sizex - (unsigned char)strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   (unsigned char)strlen(menus->desktopmenu->title) - 1);
  }
  draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open);

  revers(0);
}
Beispiel #7
0
void __fastcall writePanel(
	unsigned drawBorder,
	unsigned reverse,
	unsigned char color,
	unsigned char x, unsigned char y,
	unsigned char h, unsigned char w,
	unsigned char *title,
	unsigned char *cancel,
	unsigned char *ok)
{
	unsigned int i = 0, okLeft = 0, cancelLeft = 0;
	unsigned char titleBuffer[81];

	saveScreen();

	//textcolor(color);
	revers(reverse);

	if(drawBorder)
	{
		drawBox(x, y, w, h, color, reverse);
	}
	else
	{
		for(i=0; i<h; ++i)
		{
			cclearxy(x,y+i,w);
		}
	}

	if(title != NULL)
	{
		strcpy(titleBuffer, title);
		if(strlen(titleBuffer) > w-4)
		{
			titleBuffer[w-4]='\0';
		}

		gotoxy(x+2, y);
		cprintf("[%s]", titleBuffer);
	}

	revers(false);

	okLeft = x + w - 2;

	if(ok != NULL)
	{
		okLeft -= 4;
		cputsxy(okLeft, y + h - 1, ok);
	}

	cancelLeft = okLeft - 2;
	if(cancel != NULL)
	{
		cancelLeft -= 8;
		cputsxy(cancelLeft, y + h - 1, cancel);
	}
}
Beispiel #8
0
void showbutton(tgui_Obj *obj, int x, int y, int focus) {

	revers(1);
	cputcxy(x,y,'(');
	if (focus==1)revers(0);

	cputs(obj->caption);
	revers(1);
	cputc(')');
	revers(0);

}  // end of showbutton
Beispiel #9
0
void updateStatus(uint8_t c) {
    uint8_t xpos = wherex();
    uint8_t ypos = wherey();

    gotoxy(0, 24);
    textcolor(1);
    revers(1);
    cprintf("Ln: %-2d Col: %-2d  %3d   INS               ", ypos, xpos, c);

    textcolor(7);
    revers(0);
    gotoxy(xpos, ypos);
}
void str_words_in_rev(char *input, int len){
	int start = 0, end, i = 0;
	while (i <= len)
	{
		if (input[i] == ' ' || input[i] == '\0'){
			end = i - 1;
			revers(input, start, end);
			start = i + 1;
		}

		i++;
	}
	revers(input, 0, len - 1);
	
}
Beispiel #11
0
void __fastcall drawBox(
	unsigned char x,
	unsigned char y,
	unsigned char w,
	unsigned char h,
	unsigned char color,
	unsigned reverse)
{
	unsigned char i;
	
	//textcolor(color);
	revers(reverse);

	// draw frame
#ifdef __APPLE2ENH__	
	textframexy(x, y, w + 1, h + 1, TEXTFRAME_TALL);
#else
	for(i=x+w-1; i>x; i--)
	{
		gotoxy(i, y); cputc('-');
		gotoxy(i, y+h); cputc('-');
	}
	for(i=y+h-1; i>y; i--)
	{
		gotoxy(x, i); cputc('!');
		if(x+w < size_x)
			gotoxy(x+w, i); cputc('!');
	}
#endif
        // draw body
	for(i=y+1; i<y+h; ++i)
	{
		cclearxy(x + 1, i, w - 1);
	}
}
Beispiel #12
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(' ');
    }
}
Beispiel #13
0
void processMenu() {
    uint8_t c = 0;
    uint8_t current = 0;

    cursor(0);
    while(1) {
        renderMenu(current);

        c = cgetc();
        if (c == 157) {
            // Left
            if (current == 0) {
                current = menuSize - 1;
            } else {
                current--;
            }
        } else if (c == 29) {
            // Right
            current++;
            if (current >= menuSize) {
                current = 0;
            }
        } else if (c == 3) {
            break;
        }
    }

    renderMenu(100);
    cursor(1);
    revers(0);
}
Beispiel #14
0
char interactively_read_char()
{
    unsigned char x;
    char c;

    x = wherex();

    revers(true);
    cputc(' ');
    gotox(x);
    c = cgetc();

    revers(false);
    cputc(' ');
    gotox(x);
    return c;
}
Beispiel #15
0
void tests (void)
{
    unsigned int res;
    unsigned char n;
    clrscr();
    revers(1);
           //0123456789012345678901234567890123456789
    cprintf("testing... press any key to abort.      ");
    revers(0);
    n = 0;
    while (testinfo[n].generator) {
        testinfo[n].result = 0;
        if (((cpu_type == testinfo[n].cpu_type) || (testinfo[n].cpu_type == CPU_6502)) && (ram_banks >= testinfo[n].ram_banks)) {
            printinfo(n, 0);
        }
        ++n;
    }

    while(1) {
        n = 0;
        while (testinfo[n].generator) {
            if (((cpu_type == testinfo[n].cpu_type) || (testinfo[n].cpu_type == CPU_6502)) && (ram_banks >= testinfo[n].ram_banks)) {
                gotoxy(39,n + 1); cputc('*');
                teststart();
                testinfo[n].generator();
                testend();
                res = (0xffff - 29) - dotest();
                testinfo[n].result = res;
                printrating();
                printinfo(n, res);
            }
            ++n;
            if (kbhit()) {
                break;
            }
        }
        delay_200ms();
        if (kbhit()) {
            break;
        }
    }
    while (kbhit()) {
        cgetc();
    }
}
Beispiel #16
0
void menu (void)
{
    unsigned char ch;
    clrscr();
    revers(1);          //1234567890123456789012345678901234567890
    gotoxy(0,0); cprintf("                        SynthMark64 v0.2");
    gotoxy(0,24); cprintf("CPU %s, RAM %5d KB (%3d BANKS) %s",
        cpu_type == CPU_65816 ? "65816" : cpu_type == CPU_65C02 ? "65C02" : "6502 ",
        ram_banks * 64, ram_banks, vic_pal ? "PAL " : "NTSC");
    revers(0);
    while (1) {
        gotoxy(1,2); cprintf("[F1] disable screen during tests: %s", screenoff ? "yes" : "no ");
        gotoxy(1,4); cprintf("[F3] use C128 fast mode: %s", c128turbo ? "yes" : "no ");
        gotoxy(1,6); cprintf("[F5] use DTV fast mode(s): %s", dtvturbo ? "yes" : "no ");
        gotoxy(1,8); cprintf("[F7] use SCPU optimization: %s", scpumode == 0 ? "default" : scpumode == 1 ? "none   " : "full   ");
        gotoxy(1,10); cprintf("[RETURN] start benchmark");
        ch = cgetc();
        if (ch == 0x0d) {
            break;
        }
#ifdef DEBUG
        gotoxy (0,0); cprintf("%02x", ch);
#endif
        switch (ch) {
            case 0x85:
                screenoff ^= 1;
                break;
            case 0x86:
                c128turbo ^= 1;
                break;
            case 0x87:
                dtvturbo ^= 1;
                break;
            case 0x88:
                scpumode++;
                if (scpumode > 2) {
                    scpumode = 0;
                }
                break;
        }
    }
    while (kbhit()) {
        cgetc();
    }
}
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;  

  
  /* Draw menus */
  textcolor(VNC_OUT_MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    if(m != menus->open) {
      update_area(wherex(), 0, strlen(m->title) + 1, 1);
      cputs(m->title);
      cputc(' ');
    } else {
      draw_menu(m);
    }
  }


  if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) {
    gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   strlen(menus->desktopmenu->title) - 1);
    update_area(wherex(), 0, sizex - wherex() -
		strlen(menus->desktopmenu->title) - 1, 1);
  }
  
  /* Draw desktopmenu */
  if(menus->desktopmenu != menus->open) {
    update_area(wherex(), 0, strlen(menus->desktopmenu->title) + 1, 1);
    cputs(menus->desktopmenu->title);
    cputc(' ');
  } else {
    draw_menu(menus->desktopmenu);
  }

  revers(0);



}
/*---------------------------------------------------------------------------*/
void ctk_draw_menus(struct ctk_menus *menus) {
  struct ctk_menu *m;  
  
  clip(0, SCREEN_HEIGHT);
  /* Draw menus */
  gotoxy(0, 0);
  revers(1);
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, menus->open);
  }

  clearTo(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1);

  /* Draw desktopmenu */
  draw_menu(menus->desktopmenu, menus->open);

  revers(0);
}
Beispiel #19
0
void __fastcall writeStatusBar(const char message[])
{
	unsigned char oldX, oldY;

	oldX = wherex();
	oldY = wherey();

	//textcolor(color_text_status);
	revers(true);

	cclearxy(0, 0, size_x);

	cputsxy(0, 0, message);
	
	revers(false);

	gotoxy(oldY, oldY);
}
Beispiel #20
0
static void ProgressMeter (unsigned Val)
/* Print the progress bar. */
{
    gotoxy (X, Y);
    cprintf (" %5lu/65536\r\n", (unsigned long) Val);
    revers (1);
    cclear (Val / (unsigned)(65536U / BAR_ELEMENTS));

/* Commodore and Atari computers can show eight times greater precision. */
#if defined(__CBM__)
    Val = (Val / (unsigned)(65536U / BAR_ELEMENTS / 8)) % 8;
    revers (revers_bar[Val]);
    cputc (small_bar[Val]);

#elif defined(__ATARI__)
#endif

    revers (0);
}
Beispiel #21
0
void showlistbox(tgui_Obj *obj, int x, int y, int color, int startid){
tgui_Listitem *item;
int i;

    //textcolor(color);
    cputsxy(x,y-1,obj->caption);
    drawbox(x, y, x+obj->width, y + obj->height);
    item = obj->firstitem;
    i=0;
	obj->topid=startid;


    while (item->li_id != startid){
		item=item-> next;
	}


    if (startid != 0 ) cputcxy(x+obj->width-1, y, '+');


	    if (item!=NULL ) {
	        do {
	            if (obj->state == item->li_id ) revers(1);
				cputsxy(x+1,y+i+1,item->caption);
				cclearxy(x+strlen(item->caption)+1 ,y+i+1, obj->width - strlen(item->caption)-1);
				if (obj->state == item->li_id){
					//cclearxy(x+strlen(item->caption)+1 ,y+i+1, obj->width - strlen(item->caption)-1);
					revers(0);
                }
					++i;
	            item=item->next;
			} while (item != obj->firstitem && i+1 < obj->height);
	        if (item != obj->firstitem ) {
				cputcxy(x+obj->width-1, y+obj->height, '+');
			}
			else cputcxy(x+obj->width-1, y+obj->height, ' ');

        }



}   // end of showlistbox
Beispiel #22
0
int main() {
size_t number;
scanf("%zd", &number);
int mass[number];
for(size_t i = 0; i < number; i++)
scanf("%d", &mass[i]);
revers(number, mass);
for(size_t i = 0; i < number; i++)
printf("%d ", mass[i]);
return 0;
}
Beispiel #23
0
/* The main code inits the screen for the tests and sets revers flag.
** Then it calls testCPeekC for every char within 0..255.
** On failure the failed char+1000 is returned to the system 
*/
int main()
{
    int i = 0;

    clrscr();
    revers(0);
    for (;i<256;++i){
        if (EXIT_FAILURE == testCPeekC(i)) return i+1000;
    }
    return 0;
}   
int main()
{
	char s[MAX];
	int len = 0;

	while ( (len = (getnextline(s, MAX)) > 0 ) )
	{
		revers(s);
		printf(" %s \n", s );
	}
	return 0;
}
Beispiel #25
0
static void
draw_menu(struct ctk_menu *m, unsigned char open)
{
  unsigned char x, x2, y;

  if(open) {
    x = x2 = wherex();
    if(x2 + CTK_CONF_MENUWIDTH > sizex) {
      x2 = sizex - CTK_CONF_MENUWIDTH;
    }

    for(y = 0; y < m->nitems; ++y) {
      if(y == m->active) {
	(void)textcolor(ACTIVEMENUITEMCOLOR);
	revers(0);
      } else {
	(void)textcolor(MENUCOLOR);	  
	revers(1);
      }
      gotoxy(x2, y + 1);
      if(m->items[y].title[0] == '-') {
	chline(CTK_CONF_MENUWIDTH);
      } else {
	cputs(m->items[y].title);
      }
      if(x2 + CTK_CONF_MENUWIDTH > wherex()) {
	cclear(x2 + CTK_CONF_MENUWIDTH - wherex());
      }
    }

    gotoxy(x, 0);
    (void)textcolor(OPENMENUCOLOR);
    revers(0);
  }

  cputs(m->title);
  cputc(' ');
  (void)textcolor(MENUCOLOR);
  revers(1);
}
Beispiel #26
0
void reversewords(char * str)
{
    char *beg = str;
    char *end = str;

    while(*end)
    {
        end++;

        if(*(end) == '\0')
            revers(beg,end-1);

        if(*(end) == ' ')
        {
            revers(beg , end-1);
            beg=end+1;
        }

    }
    beg = str;
    revers(beg , end-1);
}
/*-----------------------------------------------------------------------------------*/
static void
draw_menu(struct ctk_menu *m)
{
  unsigned char x, x2, y;

  textcolor(VNC_OUT_MENUCOLOR);
  x = wherex();
  cputs(m->title);
  cputc(' ');
  x2 = wherex();
  if(x + CTK_CONF_MENUWIDTH > sizex) {
    x = sizex - CTK_CONF_MENUWIDTH;
  }
  
  
  for(y = 0; y < m->nitems; ++y) {
    if(y == m->active) {
      textcolor(VNC_OUT_ACTIVEMENUCOLOR);
      revers(0);
    } else {
      textcolor(VNC_OUT_MENUCOLOR);	  
    }
    gotoxy(x, y + 1);
    if(m->items[y].title[0] == '-') {
      chline(CTK_CONF_MENUWIDTH);
    } else {
      cputs(m->items[y].title);
    }
    if(x + CTK_CONF_MENUWIDTH > wherex()) {
      cclear(x + CTK_CONF_MENUWIDTH - wherex());
    }
    revers(1);
  }
  
  gotoxy(x2, 0);
  textcolor(VNC_OUT_MENUCOLOR);  

  update_area(x, 0, CTK_CONF_MENUWIDTH, m->nitems + 1);
}
int main()
{
	char s[MAX];
	int d = 0;

	while ( (len = getnextline(s, MAX) )> 1  )
	{
//		printf("len equals: %d", len);
		revers(s);
//		for ( d = 0; d <= len ; d++ )
	//		printf("s[%c] equals %c \n", d, s[d]); 
		printf("%s\n", s);
	}
	return 0;
}
Beispiel #29
0
/*-----------------------------------------------------------------------------------*/
void
console_exit(void)
{
  static unsigned char done;

  if(done) {
    return;
  }
  done = 1;

  revers(0);
  clrscr();
  gotoxy(0, 0);

  endwin();
}
Beispiel #30
0
static void prepareprocinform(void)
{int ndel, ncalc, nrest;
 long recpos;
 char        txt[STRSIZ];
 int     i, k;
 csdiagram   csd;
 char * mass;
 int        nn;
 int nsubs;

   inf = NULL;
   fseek(menuq,0,SEEK_SET);
   for (nsubs=1;nsubs<=subproc_sq;nsubs++)
   {
      inftmp = inf;
      inf = (procinfptr)getmem_((unsigned)sizeof(procinfrec));
      inf->next = inftmp;
      rd_menu(2,nsubs,txt,&ndel,&ncalc,&nrest,&recpos);
      inf->firstdiagpos = recpos;
      getprtcls(txt,inf->p_name);
      for (i = 0; i < nin + nout; i++)
      {
         locateinbase(inf->p_name[i],&nn);
         mass=prtclbase[nn-1].massidnt; 
         if (strcmp(mass,"0")) {for(k=1; k<=nmodelvar; k++) if(strcmp(modelvars[k].varname,mass)==0) break;} 
         else k=0;
         if(k>nmodelvar){ printf("mass %s is not defined\n",mass); exit(125);} 
         inf->p_masspos[i] = k;
         inf->p_code[i]=prtclbase1[nn].N; 
      }
      for (i = nin + nout; i < MAXINOUT; i++)
      {
         strcpy(inf->p_name[i],"***");
         inf->p_masspos[i] = 0;
      }
      fseek(diagrq,recpos*sizeof(csdiagram),SEEK_SET);
      inf->tot = 0;
      for (i = 1; i <= ndel + ncalc + nrest; i++)
      {
         FREAD1(csd,diagrq);
         if (csd.status == 1) ++(inf->tot);
      }
      if(inf->tot==0) for (i = 0; i < nin + nout; i++) inf->p_masspos[i]=0;
   }
   nsubs--;
   revers((void **)&inf);
}