home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c220 / 4.ddi / EXAMPLES / GFX_TEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-16  |  15.5 KB  |  550 lines

  1. /**************************  gfx_test.c ***************************/
  2.  
  3. #include "gfx_test.h"
  4.  
  5.  
  6. #pragma On(Prototype_override_warnings);
  7. #pragma On(Int_function_warnings);
  8. #pragma On(Warn);
  9. #pragma Off(Optimize_xjmp);
  10.  
  11. void line_sweep(), _arc(), test_with_views(), triangles(), test_xor(), delay();
  12. void draw_test(), restore_scrn(), graphics_suite(), move_block(), test_float();
  13. void draw_triangle(), paint_test(), spin(), test_big_pics(char *), exit();
  14. int atoi(char *);
  15.  
  16.  
  17. #define DELETE_FPIC_FILE(tp)            _gfx_delete_file(tp)
  18.  
  19. void main(n_args, argv)
  20.         INT n_args;
  21.         TEXT **argv;
  22. {
  23. INT c, cmnd_gfx_mode;
  24.  
  25. cmnd_gfx_mode = 1;
  26. if (n_args > 1) {
  27.         c = *argv[1];
  28.         if (inrange('1', c, '7')) then cmnd_gfx_mode = c - '0';
  29.         }
  30. _gfx.auto_scale = YES;
  31. _gfx.xlat_scale = 1;
  32. _gfx.err_number = NO;
  33. switch(cmnd_gfx_mode) {
  34.         case 4:
  35.                 _gfx.card_monitor = _HERC_CARD | _MONO_DISPLAY;
  36.                 cmnd_gfx_mode = 2;
  37.                 break;
  38.  
  39.         case 5:
  40.                 cmnd_gfx_mode = _OR_EGA_MED_RES | 1;
  41.                 break;
  42.  
  43.         case 6:
  44.                 cmnd_gfx_mode = _OR_EGA_HI_RES | 1;
  45.                 break;
  46.  
  47.      case 7:
  48.                 _gfx_set_video_resolution(atoi(argv[3]), atoi(argv[4]));
  49.         cmnd_gfx_mode = _FORCE_BIOS_MODE | atoi(argv[2]);
  50.                 break;
  51.         }
  52. if (!_gfx_screen(cmnd_gfx_mode)) {
  53.         _gfx.card_monitor &= ~_EGA_CARD;
  54.         _gfx_screen(cmnd_gfx_mode);
  55.         }
  56. _gfx_clearscreen();
  57. test_float();
  58. test_with_views();
  59. restore_scrn();
  60. exit(1);
  61. }
  62.  
  63. void restore_scrn()
  64. {
  65. _gfx_screen(0);
  66. /*** !!!!386  exit(1);   */
  67. }
  68.  
  69. void test_float()
  70. {
  71. INT j, view_n;
  72. double x, y;
  73. LOCAL INT pattern[] = {0xF0F0, 0xCCCC, 0xFFFF, 0xAAAA};
  74.  
  75. view_n = _gfx_open_view(0, 0, 319, 199, 0, NO);
  76. _gfx_scale_float_view(1.1, 1.1, 0.55, 0.55, 1, -1);
  77. for (j = 0; j < 25; j++) {
  78.         for (x = -0.53; x < 0.53; x += .03)
  79.                 _gfx_line(0.0, 0.0, x, 0.53, j|_PAT, 0, pattern[j & 0x3]);
  80.         for (y = 0.53; y > -0.53; y -= .03)
  81.                 _gfx_line(0.0, 0.0, 0.53, y, j|_PAT, 0, pattern[j & 0x3]);
  82.         for (x = 0.53; x > -0.53; x -= .03)
  83.                 _gfx_line(0.0, 0.0, x, -0.53, j|_PAT, 0, pattern[j & 0x3]);
  84.         for (y = -0.53; y < 0.53; y += .03)
  85.                 _gfx_line(0.0, 0.0, -0.53, y, j|_PAT, 0, pattern[j & 0x3]);
  86.         }
  87. _gfx_close_view(view_n, YES);
  88. }
  89.  
  90.  
  91. void test_with_views()
  92. {
  93. INT x1, y1, x2, y2;
  94. INT view_1, view_2, color;
  95.  
  96.  
  97. graphics_suite();
  98. _gfx_clearscreen();
  99. x1=10, y1=10, x2=110, y2=55;
  100. line_sweep();
  101. _gfx_create_view_file("GFXVIEW.DAT");
  102.  
  103. view_1 = _gfx_open_view(x1, y1, x2, y2, 2, YES);
  104. delay(40);
  105. _gfx_move_view(180, 20);
  106. _gfx_scale_int_view(_DFLT, _DFLT, 0, -45, 1, -1);
  107. line_sweep();
  108. delay(40);
  109. _gfx_clearscreen();
  110. _gfx_move_view(180, 130);
  111. _gfx_scale_int_view(_DFLT, _DFLT, -110, -72, 1, 1);
  112. line_sweep();
  113. delay(40);
  114. _gfx_clearscreen();
  115. _gfx_move_view(150, 30);
  116. _gfx_scale_int_view(_DFLT, _DFLT, 0, 0, 1, 1);
  117. line_sweep();
  118. delay(40);
  119. _gfx_close_view(view_1, 1);
  120. delay(40);
  121.  
  122. view_1 = _gfx_open_view(x1, y1, x2, y2, 2, YES);
  123. view_2 = _gfx_open_view(130, 90, 300, 180, 4, YES);
  124. delay(40);
  125. line_sweep();
  126. _gfx_clear_view(view_2, 8);
  127. _gfx_switch_view(view_1, 1);
  128. line_sweep();
  129. _gfx_clear_view(view_1, 6);
  130. delay(40);
  131. _gfx_switch_view(view_2, 1);
  132. _gfx_clear_view(view_2, 9);
  133. line_sweep();
  134. _gfx_switch_view(view_1, 0);
  135. line_sweep();
  136. _gfx_switch_view(0, 0);
  137. _gfx_clear_view(view_1, 14);
  138. _gfx_clear_view(view_2, 11);
  139. delay(40);
  140. _gfx_close_view(view_2, 1);
  141. _gfx_close_view(view_1, 1);
  142. delay(40);
  143.  
  144. color = (_gfx.gfx_mode & HIGH_RES) ? 0 : 4;
  145. view_1 = _gfx_open_view(10, 10, _STEP, 220, 130, color, YES);
  146. _gfx_scale_int_view(_DFLT, _DFLT, -60, -55, 1, 1);
  147. delay(40);
  148. graphics_suite();
  149. _gfx_clearscreen();
  150. delay(40);
  151. _gfx_screen(0);
  152. DELETE_FPIC_FILE("GFXVIEW.DAT");
  153. }
  154.  
  155. void graphics_suite()
  156. {
  157. INT fpic_handle;
  158.  
  159. _gfx_clearscreen();
  160. fpic_handle = _gfx_create_fpic("PIC.DAT", 40);
  161. line_sweep();
  162. test_xor();
  163. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  164. delay(40);
  165. _gfx_clearscreen();
  166. if (sizeof(TEXT *) == 4) {
  167.     spin();
  168.     _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  169.     delay(40);
  170.     _gfx_clearscreen();
  171.     }
  172.  
  173. paint_test();
  174. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  175. delay(40);
  176.  
  177. _gfx_clearscreen();
  178. _arc();
  179. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  180. delay(40);
  181. _gfx_clearscreen();
  182. draw_test();
  183. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  184. delay(40);
  185. _gfx_clearscreen();
  186. triangles();
  187. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  188. delay(40);
  189.  
  190.  
  191. _gfx_clearscreen();
  192. move_block();
  193. _gfx_get_fpic(0, 0, 319, 199, 0, fpic_handle);
  194. _gfx_clearscreen();
  195. _gfx_close_fpic(fpic_handle);
  196. test_big_pics("PIC.DAT");
  197. DELETE_FPIC_FILE("PIC.DAT");
  198. }
  199.  
  200.  
  201.  
  202. TINY dot_pat[] = {9, 9, 0xC4, 0x62, 0x31, 0x18, 0x8C, 0x46, 0x23, 0x11, 0x88,
  203.                                     0x88, 0xC4, 0x62, 0x31, 0x18, 0x8C, 0x46, 0x23, 0x11,
  204.                                     0x11, 0x88, 0xC4, 0x62, 0x31, 0x18, 0x8C, 0x46, 0x23,
  205.                                     0x23, 0x11, 0x88, 0xC4, 0x62, 0x31, 0x18, 0x8C, 0x46,
  206.                                     0x46, 0x23, 0x11, 0x88, 0xC4, 0x62, 0x31, 0x18, 0x8C,
  207.                                     0x8C, 0x46, 0x23, 0x11, 0x88, 0xC4, 0x62, 0x31, 0x18,
  208.                                     0x18, 0x8C, 0x46, 0x23, 0x11, 0x88, 0xC4, 0x62, 0x31,
  209.                                     0x31, 0x18, 0x8C, 0x46, 0x23, 0x11, 0x88, 0xC4, 0x62,
  210.                                     0x62, 0x31, 0x18, 0x8C, 0x46, 0x23, 0x11, 0x88, 0xC4
  211.                                     };
  212.  
  213. TINY xdot_pat[] = {1, 1, 0x88};
  214.  
  215. void triangles()
  216. {
  217. INT x, y, height, base, color, fill_color, n_reps, i, max_color, last_color;
  218.  
  219. max_color = 16;
  220. turn_on_ega();
  221. for (i = 0; i < 1; i++) {
  222.         x = 160;
  223.         y = 4;
  224.         height = 190;
  225.         base = 310;
  226.         color = i;
  227.         n_reps = 0;
  228.         while (y < 80) {
  229.                 if (++color == max_color) then color = 1;
  230.                 draw_triangle(x, y, base, height, color);
  231.                 height -= 5;
  232.                 base -= 20;
  233.                 y += 5;
  234.                 n_reps++;
  235.                 }
  236.         }
  237. y += 20;
  238. last_color = color;
  239. while (n_reps--) {
  240.         if ((fill_color = color+1) >= max_color) then fill_color = 1;
  241.         _gfx_fastfill(x, y, fill_color, color--);
  242.         if (color < 1) then color = max_color-1;
  243.         }
  244. delay(40);
  245. _gfx_fastfill(x, y, _PAT|5, last_color, xdot_pat);
  246. _gfx_fastfill(x, y, _PAT|4, last_color, dot_pat);
  247. delay(40);
  248. }
  249.  
  250.  
  251. void draw_triangle(x, y, base, height, color)
  252.         INT x, y, base, height, color;
  253. {
  254. INT y2, new_color;
  255.  
  256. base >>= 1;
  257. y2 = height;
  258. new_color = _gfx_get_color(color);
  259. _gfx_line(x, y, x-base, y2, new_color, 0);
  260. _gfx_line(x, y, x+base, y2, new_color, 0);
  261. _gfx_line(x-base, y2, x+base, y2, new_color, 0);
  262. }
  263.  
  264.  
  265. LOCAL INT pattern[] = {0xF0F0, 0xCCCC, 0xFFFF, 0xAAAA};
  266.  
  267. void line_sweep()
  268. {
  269. INT j,x,y;
  270.  
  271. for (j = 0; j < 25; j++) {
  272.         for (x = 6; x < 320; x += 14)
  273.                 _gfx_line(159, 99, x, 2, j|_PAT, 0, pattern[j & 0x3]);
  274.         for (y = 2; y < 200; y += 14)
  275.                 _gfx_line(159, 99, 314, y, j|_PAT, 0, pattern[j & 0x3]);
  276.         for (x = 314; x > 0; x -= 14)
  277.                 _gfx_line(159, 99, x, 197, j|_PAT, 0, pattern[j & 0x3]);
  278. Q4:     for (y = 197; y > 0; y -= 14)
  279.                 _gfx_line(159, 99, 6, y, j|_PAT, 0, pattern[j & 0x3]);
  280.         }
  281. }
  282.  
  283. void test_xor()
  284. {
  285. INT width, height;
  286. INT x, y, i, j;
  287.  
  288. x = 145;
  289. y =  90;
  290. width = 30;
  291. height = 20;
  292. for (i = 0; i < 40; i++) {
  293.         _gfx_line(x -= 3, y -= 2, _STEP, width, height, 3 | _XOR_PEL, _EMPTY_BOX);
  294.         delay(1);
  295.         _gfx_line(x, y, _STEP, width, height, 3 | _XOR_PEL, _EMPTY_BOX);
  296.         width += 6;
  297.         height += 4;
  298.         }
  299. _gfx_line(x -= 3, y -= 2, _STEP, width, height, 3 | _XOR_PEL, _EMPTY_BOX);
  300. width /= 2;
  301. height /= 2;
  302. x += width;
  303. for (j = 0; j < 4; j++) {
  304.         for (i = 0; i < 40; i++) {
  305.                 _gfx_line(x, y, _STEP, -width, height, 14 | _XOR_PEL, _DRAW_LINE);
  306.                 _gfx_line(x-width, y+height, _STEP, width, height, 14 | _XOR_PEL, _DRAW_LINE);
  307.                 _gfx_line(x, y+(height<<1), _STEP, width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  308.                 _gfx_line(x+width, y+height, _STEP, -width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  309.                 delay(1);
  310.                 _gfx_line(x, y, _STEP, -width, height, 14 | _XOR_PEL, _DRAW_LINE);
  311.                 _gfx_line(x-width, y+height, _STEP, width, height, 14 | _XOR_PEL, _DRAW_LINE);
  312.                 _gfx_line(x, y+(height<<1), _STEP, width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  313.                 _gfx_line(x+width, y+height, _STEP, -width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  314.                 width -= 3;
  315.                 }
  316.         for (i = 0; i < 40; i++) {
  317.                 _gfx_line(x, y, _STEP, -width, height, 14 | _XOR_PEL, _DRAW_LINE);
  318.                 _gfx_line(x-width, y+height, _STEP, width, height, 14 | _XOR_PEL, _DRAW_LINE);
  319.                 _gfx_line(x, y+(height<<1), _STEP, width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  320.                 _gfx_line(x+width, y+height, _STEP, -width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  321.                 delay(1);
  322.                 _gfx_line(x, y, _STEP, -width, height, 14 | _XOR_PEL, _DRAW_LINE);
  323.                 _gfx_line(x-width, y+height, _STEP, width, height, 14 | _XOR_PEL, _DRAW_LINE);
  324.                 _gfx_line(x, y+(height<<1), _STEP, width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  325.                 _gfx_line(x+width, y+height, _STEP, -width, -height, 14 | _XOR_PEL, _DRAW_LINE);
  326.                 width += 3;
  327.                 }
  328.         }
  329. _gfx_line(x-width, y, _STEP, width*2, height*2, 3 | _XOR_PEL, _EMPTY_BOX);
  330. }
  331.  
  332.  
  333.  
  334. void draw_test()
  335. {
  336. INT i, kolor;
  337.  
  338. _gfx_draw("BM160,70");
  339. _gfx_draw("S4");
  340. for (i = 0; i++ < 2; _gfx_draw("S8 BM100,190")) {
  341.         _gfx_draw("C1 U= R= D= L=",60,60,60,60);
  342.         _gfx_draw("BU30 C1 E= F= G= H=",30,30,30,30);
  343.         _gfx_draw("BR30 C1 NU10 NL10 ND10 NR10 NH10 NG10 NE10 NF10");
  344.         }
  345. _gfx_draw("BM160,100 S4");
  346. kolor = 1;
  347. ;
  348. for (i = 1; i < 14; i++) {
  349.         _gfx_draw("S= BM-30,+0 C= U= R= D= L= U= BM+30,+0", i, kolor, 30, 60, 60, 60, 31);
  350.         }
  351. }
  352.  
  353. int x[] = {180, 32, 129};
  354. int y[] = {130, 32, 146};
  355.  
  356. void paint_test()
  357. {
  358. INT j;
  359.  
  360. for (j = 0; j < 3; j++) {
  361.         _gfx_clearscreen();
  362.         _gfx_line(28, 28,262, 177, 1, _FILL_BOX);
  363.         _gfx_line(30, 30, 260, 175, 2, _FILL_BOX);
  364.         _gfx_line(40, 160, 240, 165, 1, _FILL_BOX);
  365.         _gfx_line(40, 60, 240, 65, 1, _FILL_BOX);
  366.         _gfx_line(40, 60, 45, 159, 1, _FILL_BOX);
  367.         _gfx_line(235, 64, 240, 157, 1, _FILL_BOX);
  368.         _gfx_line(47, 67, 55, 157, 1, _FILL_BOX);
  369.         _gfx_line(58, 100, 238, 110, 1, _FILL_BOX);
  370.         _gfx_line(230, 110, 235, 145, 1, _FILL_BOX);
  371.         _gfx_line(130, 110, 150, 145, 1, _FILL_BOX);
  372.         _gfx_line(100, 147, 235, 150, 1, _FILL_BOX);
  373.         delay(15);
  374.         _gfx_paint(x[j], y[j], 12, 1);
  375.         delay(15);
  376.         }
  377. }
  378.  
  379.  
  380.  
  381. void _arc()
  382. {
  383. INT i;
  384. DBL start, end, delta_angle, frac;
  385.  
  386. for (frac = 0.1; frac < 4.0; frac += 0.1) {
  387.         start = 0.0;
  388.         delta_angle = .0872638;
  389.         end = 6.283;
  390.         _gfx_ellipse(159,99,50,3, frac);
  391.         for (i = 0; i < 71; i++) {
  392.                 _gfx_arc(159,99,50,i&0xF, frac,start, end -= delta_angle);
  393.                 }
  394.         }
  395. for (i = 200; i > 0; i -= 5) {
  396.         _gfx_line(60,15,60+i,15,(i+1)&0xF,0);
  397.         }
  398. for (i = 170; i > 0; i -= 3) {
  399.         _gfx_line(260,15,260,15+i,(i+1)&0xF,0);
  400.         }
  401. for (i = 200; i > 0; i -= 5) {
  402.         _gfx_line(60,185,60+i,185,(i+1)&0xF,0);
  403.         }
  404. for (i = 170; i > 0; i -= 3) {
  405.         _gfx_line(60,15,60,15+i,(i+1)&0xF,0);
  406.         }
  407. }
  408.  
  409.                 /*   NOTE THAT THIS FUNCTION WILL ONLY EXECUTE IN
  410.                  *         PROGRAMS USING LARGE DATA MODEL
  411.            */
  412.  
  413. extern DBL cos(DBL);
  414. void spin()
  415. {
  416. INT i, j, x, y, radius, index, color, step, angle, pg;
  417. DBL aspect_ratio, conversion=0.0174527;
  418. _PIC *pic1[20];
  419.  
  420. if (sizeof(TEXT *) == 2) then return;
  421. color = 2;
  422. index = 0;
  423. step = 9;
  424. angle = 0;
  425. _gfx_set_video_pages(0, 1);
  426. for (j=0; j < 2; j++) {
  427.         for (i = 0; i < 10; i++) {
  428.                 _gfx_line(110,80,210,160,13, _FILL_BOX);
  429.                 _gfx_line(120,115,200, 125,0, _FILL_BOX);
  430.                 x =     160, y = 120, radius = 30;
  431.                 aspect_ratio = 1.1 / (cos((DBL)(angle * conversion)));
  432.                 _gfx_ellipse(x, y, radius, color, aspect_ratio);
  433.                 _gfx_fastfill(x, y+10, color, color);
  434.                 pic1[index] = _gfx_get_pic(128,88,190,150);
  435.                 if (pic1[index] == 0) {
  436.                         /*printf("MEMORY ALLOCATION FAILURE\n");*/
  437.                         goto THE_END;
  438.                         }
  439.  
  440.                 angle += step;
  441.                 index++;
  442.                 }
  443.         color = 9;
  444.         step = -9;
  445.         }
  446. _gfx_set_video_pages(0, 0);
  447. _gfx_line(110,80,210,160,13, _FILL_BOX);
  448. _gfx_line(120,115,200, 125,0, _FILL_BOX);
  449. _gfx_copy_video_pages(0,1);
  450. pg = 0;
  451. for (j = 0; j < 4; j++) {
  452.         for (i = 0; i < 20; i++) {
  453.              _gfx_set_video_pages(pg&1, (pg+1)&1);
  454.                 pg++;
  455.                 _gfx_put_pic(128,88,pic1[i],'P');
  456.                 delay(1);
  457.                 }
  458.         for (i = 19; --i > 0; ) {
  459.              _gfx_set_video_pages(pg&1, (pg+1)&1);
  460.                 pg++;
  461.                 _gfx_put_pic(128,88,pic1[i],'P');
  462.                 delay(1);
  463.                 }
  464.         }
  465.  
  466. THE_END:
  467. for (j = 0; j < 20; j++)
  468.         if (pic1[j] != 0) then free((char *)pic1[j]);
  469. _gfx_set_video_pages(0, 0);
  470. }
  471.  
  472.  
  473. void move_block()
  474. {
  475. int p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y, ch;
  476. int max_x, max_y;
  477. _PIC *pic1, *pic2, *pic3, *pic4;
  478.  
  479. _gfx_line(100, 60, 158, 98, 8, 2);
  480. _gfx_line(100, 102, 158, 140, 6, 2);
  481. _gfx_line(162, 60, 220, 98, 6, 2);
  482. _gfx_line(162, 102, 220, 140, 1, 2);
  483. _gfx_fastfill(101, 61, 9, 8);
  484. _gfx_fastfill(101, 103, 4, 6);
  485. _gfx_fastfill(163, 61, 7, 6);
  486. _gfx_fastfill(163, 103, 12, 1);
  487. pic1 = _gfx_get_pic(99, 59, 159, 99);         p1x = 99;  p1y = 59;
  488. pic2 = _gfx_get_pic(160, 59, 221, 100);       p2x = 160; p2y = 59;
  489. pic3 = _gfx_get_pic(99, 101, 159, 141);  p3x = 99;  p3y = 101;
  490. pic4 = _gfx_get_pic(160, 101, 221, 141); p4x = 160; p4y = 101;
  491. max_x = 320;
  492. max_y = 200;
  493. for (ch= 0; ch < 600; ch++) {
  494.         if (p1x < -60) then p1x = max_x+1;
  495.         _gfx_put_pic(p1x, p1y, pic1, 'P');
  496.         p1x--;
  497.         if (p4x > max_x) then p4x = -60;
  498.         _gfx_put_pic(p4x, p4y, pic4, 'P');
  499.         p4x++;
  500.         if (p2y < -40) then p2y = max_y+1;
  501.         _gfx_put_pic(p2x, p2y, pic2, 'P');
  502.         p2y--;
  503.         if (p3y > max_y) then p3y = -40;
  504.         _gfx_put_pic(p3x, p3y, pic3, 'P');
  505.         p3y++;
  506.         }
  507.  
  508. free((char *)pic1);
  509. free((char *)pic2);
  510. free((char *)pic3);
  511. free((char *)pic4);
  512. }
  513.  
  514. void test_big_pics(char *fpic_name)
  515. {
  516. INT i, fpic_handle;
  517.  
  518. fpic_handle = _gfx_open_fpic(fpic_name, 1);
  519. _gfx_clearscreen();
  520. _gfx.auto_scale = NO;
  521. for (i = 1; i < 8; i++) {
  522.         _gfx_put_fpic(0, 0, 'P', i, fpic_handle);
  523.         delay(40);
  524.         }
  525. _gfx.auto_scale = YES;
  526. _gfx_close_fpic(fpic_handle);
  527. }
  528.  
  529.  
  530. UINT bios_time()
  531. {
  532. REG_EX reg;
  533.  
  534. reg.eax = 0;
  535. _gfx_call_bios(0x1A, (char *)®, (char *)®);
  536. return (INT) reg.edx;
  537. }
  538.  
  539. void delay(n_ticks)
  540.         INT n_ticks;
  541. {
  542. UINT ct;
  543.  
  544. while (_gfx_call_dos(0xB, 0) & 0xFF) {
  545.         if ((_gfx_call_dos(7, 0) & 0xFF) == '*') then restore_scrn();
  546.         }
  547. ct = bios_time() + n_ticks;
  548. while (ct > bios_time());
  549. }
  550.