/* move cursor up */ void cursor_up(int rows) { if (_isatty(_fileno(stdout))) { disp_open(); disp_move(disp_cursorrow - rows, 0); disp_close(); } }
void newline_bugfix(void) { msm_hidecursor(); if (!in_graphics_mode) { if (disp_cursorrow+1 < disp_numrows) new_line(stdout); else disp_move(disp_numrows-1,0); disp_flush(); } msm_showcursor(); y_coord--; }
void ibm_clear_text(void) { if (in_graphics_mode) { if (in_splitscreen) erase_graphics_top(); } else { disp_move(0,0); disp_eeop(); msm_hidecursor(); disp_flush(); msm_showcursor(); } }
void drawbox(uchar x,uchar y,uchar length,uchar width) { uint loop; disp_move(y,x); disp_putc(201); for(loop=0;loop<=(width-3);loop++) disp_putc(205); disp_putc(187); for(loop=y+1;loop<=(length+y-1);loop++) { disp_move(loop,x+width-1); disp_putc(186); } disp_move(loop,x+width-2) disp_putc(188); for(loop=(x+width);loop>=x+1;loop--) { disp_move(y+length,loop); disp_putc(205); } disp_putc(200); for(loop=(y+length);loop>=y+1;loop--) { disp_move(loop,x); disp_putc(186); } }
void ibm_gotoxy(int x, int y) { if (in_graphics_mode) { if (!in_splitscreen) lsplitscreen(NIL); if (y >= 4) y = 3; ztc_graph_texty = texth*(3-y); fg_adjustxy(FG_ROT0, x, &ztc_graph_textx, &ztc_graph_texty, fg.charbox); } else { disp_move(y, x); msm_hidecursor(); disp_flush(); msm_showcursor(); } }
void main(void) { int i; FILE *log = stdout, *nulfile; #ifdef __ZTC__ disp_open(); #endif nulfile = fopen("NUL", "w"); time1 = *bios_time; for(i = 1; i < 1000; i++) { gotoxy(10,5); puts("puts test."); puts("this is the second line.\n"); } time1 = *bios_time - time1; time2 = *bios_time; for(i = 1; i < 1000; i++) { gotoxy(10,5); printf("printf test.\n"); printf("this is the second line.\n"); } time2 = *bios_time - time2; time3 = *bios_time; for(i = 1; i < 1000; i++) { #ifdef __ZTC__ disp_move(4,9); cputs("d_puts test."); #else gotoxy(10,5); #if defined(M_I86) && !defined(__WATCOMC__) cputs("_outtext test.\r\n"); #else cputs("cputs test.\r\n"); #endif #endif cputs("this is the second line."); } time3 = *bios_time - time3; time4 = *bios_time; for(i = 1; i < 1000; i++) { #ifdef __ZTC__ disp_move(4,9); cprintf("d_printf test."); #else gotoxy(10,5); cprintf("cprintf test.\r\n"); #endif cprintf("this is the second line."); } time4 = *bios_time - time4; time5 = *bios_time; for(i = 1; i < 1000; i++) { fputs("fputs test.\n", nulfile); fputs("this is the second line.\n", nulfile); } time5 = *bios_time - time5; time6 = *bios_time; for(i = 1; i < 1000; i++) { fprintf(nulfile, "fprintf test.\n"); fprintf(nulfile, "this is the second line.\n"); } time6 = *bios_time - time6; #ifdef __ZTC__ disp_close(); #endif log = fopen(LOGFILE, "w"); fputs("Times for 1000 iterations:\n\n", log); fprintf(log, "puts %10.3f seconds\n", (double)time1 * .054945); fprintf(log, "printf %10.3f seconds\n", (double)time2 * .054945); #ifndef __ZTC__ #if defined(M_I86) && !defined(__WATCOMC__) fprintf(log, "_outtext %10.3f seconds\n", (double)time3 * .054945); #else fprintf(log, "cputs %10.3f seconds\n", (double)time3 * .054945); #endif fprintf(log, "cprintf %10.3f seconds\n", (double)time4 * .054945); #else fprintf(log, "d_puts %10.3f seconds\n", (double)time3 * .054945); fprintf(log, "d_printf %10.3f seconds\n", (double)time4 * .054945); #endif fprintf(log, "fputs %10.3f seconds\n", (double)time5 * .054945); fprintf(log, "fprintf %10.3f seconds\n", (double)time6 * .054945); fclose(log); }