home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 July / VPR9707B.ISO / DRIVER / IODATA / GA360 / DISK2.EXE / SAMPLE / SAMPLE.C < prev    next >
Text File  |  1993-04-01  |  15KB  |  688 lines

  1. /*************************************************************
  2.     GA-1024A / GA-1280A グラフィックライブラリ サンプルソース
  3.  
  4.         SAMPLE.C
  5.             
  6.                 アイ・オー・データ機器 Device Inc...
  7. **************************************************************/
  8. #include "gagraph.h"
  9. #include <math.h>
  10.  
  11. #ifndef TURBO
  12. #include <malloc.h>
  13. #else
  14. #include <alloc.h>
  15. #endif
  16.  
  17. #define    XO    256
  18. #define    YO    128
  19.  
  20. extern void far VWait(int);    /* 時間待ち */
  21. extern int    far GetMouse(int far *,int far *,int far *,int far *);
  22. extern int    far InitMouse();
  23.  
  24. void ball();
  25. void moveball();
  26. void line_box();
  27. void zukei();
  28. void gradation();
  29. void save_restore();
  30. void gacursor();
  31. void painttest();
  32. /****************************
  33.     マウスカーソルのデータ
  34. ****************************/
  35. static char andmask[] = {
  36.     0xff,0x80,0xff,0xff,
  37.     0xfe,0x00,0x3f,0xff,
  38.     0xfc,0x00,0x1f,0xff,
  39.     0xf8,0x00,0x0f,0xff,
  40.     0xf0,0x00,0x0f,0xff,
  41.     0xf0,0x00,0x07,0xff,
  42.     0xe0,0x00,0x07,0xff,
  43.     0xe0,0x00,0x07,0xff,
  44.     0xe0,0x00,0x07,0xff,
  45.     0xe0,0x00,0x07,0xff,
  46.     0xe0,0x00,0x03,0xff,
  47.     0xe0,0x00,0x03,0xff,
  48.     0xf0,0x00,0x03,0xff,
  49.     0xf0,0x00,0x03,0xff,
  50.     0xf8,0x00,0x07,0xff,
  51.     0xf8,0x00,0x07,0xff,
  52.     0xf8,0x00,0x03,0xff,
  53.     0xf0,0x00,0x01,0xff,
  54.     0xe0,0x00,0x01,0xff,
  55.     0xe0,0x00,0x00,0xff,
  56.     0xe0,0x00,0x07,0xff,
  57.     0xe0,0x00,0x07,0xff,
  58.     0xe3,0x00,0x07,0xff,
  59.     0xf7,0x00,0x07,0xff,
  60.     0xff,0x80,0x07,0xff,
  61.     0xff,0xc0,0x07,0xff,
  62.     0xff,0xe0,0x07,0xff,
  63.     0xff,0xf0,0x00,0x7f,
  64.     0xff,0xfc,0x00,0x3f,
  65.     0xff,0xff,0x80,0x7f,
  66.     0xff,0xff,0xc7,0xff,
  67.     0xff,0xff,0xe7,0xff,
  68. };
  69.  
  70.  
  71. static char xormask[] = {
  72.     0x00,0x00,0x00,0x00,
  73.     0x00,0x7f,0x00,0x00,
  74.     0x01,0xff,0xc0,0x00,
  75.     0x03,0xff,0xe0,0x00,
  76.     0x07,0xff,0x60,0x00,
  77.     0x07,0xef,0x90,0x00,
  78.     0x0f,0x9f,0xf0,0x00,
  79.     0x0f,0xff,0x10,0x00,
  80.     0x0f,0x8f,0x50,0x00,
  81.     0x0f,0xaf,0x18,0x00,
  82.     0x0f,0x8f,0xf8,0x00,
  83.     0x0f,0xff,0x78,0x00,
  84.     0x07,0xfe,0x18,0x00,
  85.     0x07,0xf8,0xf8,0x00,
  86.     0x03,0xff,0xf0,0x00,
  87.     0x03,0x9f,0xc0,0x00,
  88.     0x03,0xe0,0x38,0x00,
  89.     0x07,0xff,0xfc,0x00,
  90.     0x0f,0xff,0xec,0x00,
  91.     0x0f,0xff,0xf6,0x00,
  92.     0x0f,0xff,0xf0,0x00,
  93.     0x0e,0xff,0xf0,0x00,
  94.     0x08,0x7f,0xf0,0x00,
  95.     0x00,0x7f,0xf0,0x00,
  96.     0x00,0x3f,0xf0,0x00,
  97.     0x00,0x1f,0xf0,0x00,
  98.     0x00,0x0f,0xf0,0x00,
  99.     0x00,0x07,0xf8,0x00,
  100.     0x00,0x00,0xff,0x80,
  101.     0x00,0x00,0x38,0x00,
  102.     0x00,0x00,0x10,0x00,
  103.     0x00,0x00,0x00,0x00,
  104. };
  105.  
  106.  
  107.  
  108. /********************************
  109.     タイルパターンのデータ
  110. *********************************/
  111. static char tile[]={
  112.         0x00, 0x00, 0x66, 0x00, 0x00, 0x42, 0x3c, 0x00, 
  113.         0x00, 0x00, 0x66, 0x00, 0x00, 0x42, 0x3c, 0x00, 
  114.         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  115.         0x00, 0x00, 0x66, 0x00, 0x00, 0x42, 0x3c, 0x00, 
  116.         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  117.         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  118.         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  119.         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  120. };
  121. /*********************************
  122.     main()
  123. **********************************/
  124. void main()
  125. {
  126.     if ( GAinit( HRESO_256C ) ) {  /* 1024x768   256Color */
  127.         printf("\nGAINIT.EXEが常駐していません\n");
  128.         exit(1);
  129.     }
  130.     GAclrScreen();
  131.     GAcrtSel(CRT_GA);    /* CRT GA-1024Aに切換 */
  132.     VWait(50);
  133.  
  134.     line_box(200,200,824,568,-1);
  135.     zukei();
  136.     painttest();
  137.     scroll();
  138.     moveball();        /*  この関数はカラーパレットを変更する  */
  139.     save_restore();
  140.     gradation();    /*  この関数はカラーパレットを変更する  */
  141.     gacursor();
  142.  
  143.     GAcrtSel(CRT_PC);    /* CRT 本体に切換 */
  144.     GAterm( PAL_DEF );        /*    終了関数    */
  145.     exit(0);
  146. }
  147.  
  148.  
  149. /**********************************************************
  150.     立体球を描画 
  151. ***********************************************************/
  152. void ball( x, y, r)
  153. int        x;
  154. int        y;
  155. int        r;        /*  1 - 256  */
  156. {
  157.     int        i, j, c;
  158.     double  z,rr,zz,xx;
  159.  
  160.     z = 255.0 / r;
  161.     rr = (double)r * (double)r;
  162.     for (i = 0; i < r; i++) {
  163.         xx = r - i;
  164.         zz = sqrt( rr - xx * xx ) ;
  165.         c = zz * z;
  166.         GAcircleFill(x, y, r-i, c);
  167.     }
  168. }
  169.  
  170.  
  171.  
  172. /*******************************************************
  173.     GAcopyImage でボールで動かす
  174. ********************************************************/
  175. void moveball()
  176. {
  177.     int        x, y, c;
  178.     int        i, j;
  179.     struct    PALETTE pal;
  180.  
  181.  
  182.     x = 0;
  183.     y = 384;
  184.  
  185.  
  186.     for (i = 0; i < 256; i++){
  187.         c = i >> 4;
  188.         pal.red   = c*c;
  189.         pal.green = i;
  190.         pal.blue  = i;
  191.         GAsetPalette((void far *)&pal, i);
  192.     }
  193.     GAclrScreen();
  194.     GAputStr( 450,0,"コピ-",255,TRANSPARENT,BOLD);
  195.     ball(x+32,y+32,32);
  196.     for(j = 0; j < 1; j++){
  197.         for(i = 0; i < 1023-63-16; i+=16){
  198.             GAcopyImage(x, y, x+63+16, y+63, i, y);
  199.             x = i;
  200.         }
  201.         for(i = 1023-63-16; i > 0 ; i-=16){
  202.             GAcopyImage(x, y, x+63+16, y+63, i, y);
  203.             x = i;
  204.         }
  205.     }
  206.     for(j = 0; j < 2; j++){
  207.         for(i = 0; i < 1023-63-16; i+=16){
  208.             GAcopyImage(x, y, x+63+16, y+63, i, y);
  209.             x = i;
  210.         }
  211.         for(i = 1023-63-16; i > 0 ; i-=16){
  212.             GAcopyImage(x, y, x+63+16, y+63, i, y);
  213.             x = i;
  214.         }
  215.     }
  216.     x = 512;
  217.     y = 0;
  218.     ball(x+32,y+32,32);
  219.     for(j = 0; j < 3; j++){
  220.         for(i = 0; i < 766-64-16; i+=16){
  221.             GAcopyImage(x, y, x+63, y+63+16, x, i);
  222.             y = i;
  223.         }
  224.         for(i = 766-64-16; i > 0 ; i-=16){
  225.             GAcopyImage(x, y, x+63, y+63+16, x, i);
  226.             y = i;
  227.         }
  228.     }
  229.     VWait(100);
  230. }
  231.  
  232.  
  233.  
  234. /******************************************************
  235.     すべての方向にライン描画
  236. *******************************************************/
  237. void line_box(x0,y0,x1,y1, style)
  238. int        x0,y0,x1,y1;
  239. short    style;
  240. {
  241.     int        i;
  242.     int        x,y;
  243.  
  244.     x = (x1 - x0) / 2 + x0;
  245.     y = (y1 - y0) / 2 + y0;
  246.  
  247.     GAputStr( 450,0,"ライン描画",7,TRANSPARENT,BOLD );
  248.     for(i = x0; i <= x1; i++){
  249.         GAline(x, y, i, y0, 1, style);
  250.     }
  251.     for(i = y0; i <= y1; i++){
  252.         GAline(x, y, x1, i, 2, style);
  253.     }
  254.     for(i = x1; i >= x0; i--){
  255.         GAline(x, y, i, y1, 3, style);
  256.     }
  257.     for(i = y1; i >= y0; i--){
  258.         GAline(x, y, x0, i, 4, style);
  259.     }
  260.     VWait(100);
  261. }
  262.  
  263.  
  264.  
  265. /***********************************************************
  266.     円、三角、四角 
  267. ************************************************************/
  268. void zukei()
  269. {
  270.     int        i;
  271.     int        sx,sy;
  272.     long    size;
  273.  
  274.     GAclrScreen();
  275.     GAputStr( 450,0,"円、三角、四角",7,TRANSPARENT,BOLD );
  276.  
  277.     GAsetTile((void far *)tile);
  278.  
  279.     GAcircle(256,172,100, 1, 0xfccc);
  280.     GAcircleFill(256,384,100, 2);
  281.     GAtiledCircle(256,596,100);
  282.  
  283.     GAtriangle(512,72,412,272,612,272, 3, 0x5555);
  284.     GAtriangleFill(512,284,412,484,612,484, 4);
  285.     GAtiledTriangle(512,496,412,696,612,696);
  286.  
  287.     GAbox(668,72,868,272, 5, 0x0f0f);
  288.     GAboxFill(668,284,868,484, 6);
  289.     GAtiledBox(668,496,868,696);
  290.     VWait(100);
  291. }
  292.  
  293.  
  294. /***************************************************
  295.     パレットを変えて 256色グラデーションを表示
  296. ****************************************************/
  297. void gradation()
  298. {
  299.  
  300.     struct    PALETTE pal;
  301.  
  302.     int i;
  303.     int r,g,b,hol,ver;
  304.  
  305.     hol = 1024/16;
  306.     ver = 768/16;
  307.     GAclrScreen();
  308.  
  309.     GAsetVisualPlane(-1);
  310.     for (i=0;i<256;i++) {
  311.             GAboxFill( (i&15)*hol,(i/16)*ver,(i&15)*hol+(hol-2),(i/16)*ver+(ver-2),i);
  312.     }
  313.     GAputStr( 450,0,"グラデ-ション",255,TRANSPARENT,BOLD );
  314.     for (i=0;i<256;i++) {
  315.         r = (15 - (i&15) - (i/16))*16 ;
  316.         if (r < 0) r = -r;
  317.         g = (i / 16) * 16;
  318.         b = (i & 15) * 16;
  319.         pal.red   = r;
  320.         pal.green = g;
  321.         pal.blue  = b;
  322.         GAsetPalette((void far *)&pal, i);
  323.     }
  324.     GAsetVisualPlane(0);
  325.     VWait(100);
  326.  
  327.  
  328.     GAsetVisualPlane(-1);
  329.     for (i=0;i<256;i++) {
  330.         r = ((i&15) + (i/16)- 15)*16 ;
  331.         if (r < 0) r = 0;
  332.         b = ((i&15) - (i/16))*16 ;
  333.         if (b < 0) b = 0;
  334.         g = ((i/16)-(i&15))*16 ;
  335.         if (g < 0) g = 0;
  336.         pal.red   = r;
  337.         pal.green = g;
  338.         pal.blue  = b;
  339.         GAsetPalette((void far *)&pal, i);
  340.     }
  341.     GAsetVisualPlane(0);
  342.     VWait(100);
  343. }
  344.  
  345. /************************************************************
  346.     文字 スクロール
  347. *************************************************************/
  348. static char moji[]={ " GA-1024A (株)アイ・オー・データ機器 Device Inc...  "};
  349.  
  350. scroll()
  351. {
  352.     int        dy;
  353.     int        x,y;
  354.  
  355.     GAinit(1);
  356.     GAclrScreen();
  357.     GAputStr( 450,0,"文字 スクロール",7,TRANSPARENT,BOLD );
  358.  
  359.     GAbox(XO-1,YO-1,XO+504,YO+514,7,-1);
  360.     GAsetClipRgn(XO,YO,XO+503,YO+511);
  361.  
  362.     dy = 2;
  363.     for(y = 140; y; y-=dy){ 
  364.         GAcopyImage(XO, YO+dy, XO+511, YO+513, XO, YO);
  365.         GAputStr( XO, YO+y%20+495, moji, 7-(y/20), y > 60 ? 7-(y/20)+1 : -1 , (y/20)%4);
  366.     }
  367.     for(y = 560; y; y-=dy){
  368.         GAcopyImage(XO, YO+dy, XO+511, YO+513, XO, YO);
  369.     }
  370.     GAsetClipRgn(-1,0,0,0);
  371. }
  372.  
  373.  
  374.  
  375. /***************************************************************
  376.     セーブ、リストア
  377. *****************************************************************/
  378. void save_restore()
  379. {
  380.     int        x,y;
  381.     int        mode;
  382.     long    size;
  383. #ifndef TURBO
  384.     void huge    *savep;
  385. #else
  386.     void far    *savep;
  387. #endif
  388.  
  389.  
  390. /*    セーブ リストア     モード0  */
  391.     GAclrScreen();
  392.     GAputStr( 400,0,"セーブ リストア モード0 (プレ-ン)",255,TRANSPARENT,BOLD);
  393.  
  394.     ball(32,32,32);
  395.     size = GAsaveImage(0,0,63,63,PLANE_MODE,0L);
  396. #ifndef TURBO
  397.     savep = halloc(size,1);
  398. #else
  399.     savep = farmalloc(size);
  400. #endif
  401.     GAsaveImage(0,0,63,63,PLANE_MODE,savep);
  402.     GAsetClipRgn(80,83,1001,602);
  403.     for(y = 0; y < 768; y+=64){
  404.         for(x = 0; x < 1024; x+=64){
  405.             GArestoreImage(x,y,x+63,y+63,PLANE_MODE,savep);
  406.         }
  407.     }
  408. #ifndef TURBO
  409.     hfree(savep);
  410. #else
  411.     farfree(savep);
  412. #endif
  413.     VWait(100);
  414.     GAsetClipRgn(-1,0,0,0);
  415.  
  416.  
  417. /*    セーブ リストア     モード1  */
  418.     GAclrScreen();
  419.     GAputStr( 400,0,"セーブ リストア モード1 (ピクセル)",255,TRANSPARENT,BOLD);
  420.  
  421.     ball(32,32,32);
  422.     size = GAsaveImage(0,0,63,63,PIXEL_MODE,0L);
  423. #ifndef TURBO
  424.     savep = halloc(size,1);
  425. #else
  426.     savep = farmalloc(size);
  427. #endif
  428.     GAsaveImage(0,0,63,63,PIXEL_MODE,savep);
  429.     GAsetClipRgn(80,83,1001,602);
  430.     for(y = 0; y < 768; y+=64){
  431.         for(x = 0; x < 1024; x+=64){
  432.             GArestoreImage(x,y,x+63,y+63,PIXEL_MODE,savep);
  433.         }
  434.     }
  435. #ifndef TURBO
  436.     hfree(savep);
  437. #else
  438.     farfree(savep);
  439. #endif
  440.     VWait(100);
  441.     GAsetClipRgn(-1,0,0,0);
  442.  
  443.  
  444. /*    セーブ リストア     モード2  */
  445.     GAclrScreen();
  446.     GAputStr( 400,0,"セーブ リストア モード2 (プッシュ ポップ)",255,TRANSPARENT,BOLD);
  447.  
  448.     ball(32,32,32);
  449.     GAsetClipRgn(80,83,1001,602);
  450.     for(y = 0; y < 768; y+=64){
  451.         for(x = 0; x < 1024; x+=64){
  452.             GAsaveImage(0,0,63,63,PUSH_POP,0L);
  453.             GArestoreImage(x,y,x+63,y+63,PUSH_POP,0L);
  454.         }
  455.     }
  456.     VWait(100);
  457.     GAsetClipRgn(-1,0,0,0);
  458.  
  459.  
  460.  
  461.  
  462. /*    セーブ リストア    モード8  */
  463.     GAclrScreen();
  464.     GAputStr( 400,0,"セーブ リストア モード8 (バイト アライン)",255,TRANSPARENT,BOLD);
  465.     ball(32,32,32);
  466.     size = GAsaveImage(0,0,63,63,BYTE_ALIGN,0L);
  467. #ifndef TURBO
  468.     savep = halloc(size,1);
  469. #else
  470.     savep = farmalloc(size);
  471. #endif
  472.     GAsaveImage(0,0,63,63,BYTE_ALIGN,savep);
  473.     GAsetClipRgn(80,83,1001,602);
  474.     for(y = 0; y < 768; y+=64){
  475.         for(x = 0; x < 1024; x+=64){
  476.             GArestoreImage(x,y,x+63,y+63,BYTE_ALIGN,savep);
  477.         }
  478.     }
  479. #ifndef TURBO
  480.     hfree(savep);
  481. #else
  482.     farfree(savep);
  483. #endif
  484.     GAsetClipRgn(-1,0,0,0);
  485.     VWait(100);
  486. }
  487.  
  488. /******************************************************
  489.     カーソル表示
  490. ********************************************************/
  491. void gacursor()
  492. {
  493.     int     i,x,y;
  494.     struct    PALETTE pal;
  495.     int     wx=0,wy=0,left,right=0;
  496.  
  497.     pal.red   = 255;
  498.     pal.green = 255;
  499.     pal.blue  = 255;
  500.     GAsetPalette((void far *)&pal, 255);
  501.  
  502.     GAclipControl( 0,0,0,0,0,0);
  503.     GAputStr( 440,0,"カ ー ソ ル 表 示",255, 0,BOLD);
  504.     GAsetCursor((char far *)andmask,(char far *)xormask);
  505.     if (InitMouse()){ /* MOUSE.SYSが登録されていない場合 */
  506.         for(i = 0; i < 500; i+=8) {
  507.             GAdrawCursor(i,i);
  508.             VWait(5);
  509.         }
  510.         VWait(50);
  511.     } else { /* MOUSE.SYSを使用 */
  512.         GAputStr( 440,30,"右クリックで終了します",255, 0, 0);
  513.         while(!right){
  514.             GetMouse(&x, &y, &left, &right);
  515.             if (wx != x || wy != y){
  516.                 GAdrawCursor(x,y);
  517.             }
  518.             wx = x;
  519.             wy = y;
  520.         }
  521.     }
  522.     GAeraseCursor();
  523. }
  524.  
  525. /**************************************************
  526.   ペイント
  527. ****************************************************/
  528. void painttest()
  529. {
  530.     int        i;
  531.     int        sx,sy;
  532.     long    size;
  533.  
  534.     GAclrScreen();
  535.     GAputStr( 450,0,"ペイント",7,TRANSPARENT,BOLD);
  536.     GAsetTile((void far *)tile);
  537.  
  538.     GAcircle(256,272,200, 3, 0xffff);
  539.     GAtriangle(512,72,412,272,612,272, 3, 0xffff);
  540.     GAbox(368,572,868,760, 5, 0xffff);
  541.     VWait(20);
  542.     GApaint(256,272,3,6);
  543.     GAtiledPaint(512,172,3);
  544.     GApaint(700,600,5,1);
  545.     VWait(100);
  546.  
  547.  
  548. }
  549.  
  550.  
  551. #if 0
  552. /********************************************************************
  553.  
  554.     グラフィックメモリに直接描画する場合はこのソ-スを参考にして下さい
  555.     
  556.       TURBO C の場合は outp()を outportb()に、outpw()を outportw()に
  557.       変更してください
  558. *********************************************************************/
  559.  
  560. /* グラフィック コントロ-ル レジスタ ポ-ト */
  561. #define SRW_    0x0100
  562. #define SRR_    0x0200
  563. #define WPM     0x0300
  564. #define WBM_    0x0500
  565. #define RPS     0x0600
  566. #define RPE     0x0700
  567. #define COL     0x0900
  568. #define TILE_   0x0b00
  569. #define MOD1    0x0e00
  570. #define MOD2    0x0e01
  571. #define CRTC_AR 0x1e00
  572. #define CRTC_CR 0x1f00
  573.  
  574. direct()
  575. {
  576.     unsigned int  gaport;
  577.     volatile char far *ga_wind; /* グラフィックRAMのポインタは volatileを付ける */
  578.  
  579.     struct VDCONFIG vd;
  580.     int    x,y;
  581.     int    wpm_save;
  582.     char   a,b;
  583.  
  584.     GAgetVideoConfig((void far *)&vd);
  585.     gaport = vd.port    ;                           /* GA レジスタのポート番号 */
  586.     ga_wind = (void far *) ((long)vd.ga_seg    << 16); /*グラフィックボードウィンドウのセグメント*/
  587.  
  588.     x = 100;
  589.     y = 512;
  590.     a = 0xfc;
  591.     wpm_save = inp(WPM+gaport);  /* ライト プレ-ン マスク 保存   */
  592.     outp(MOD1+gaport,0);         /* グラフィック コントロ-ラのモ-ド */
  593.     outpw(WBM_+gaport,0x3f3f);   /* ライト ビットマスク           */
  594.     outpw(SRW_+gaport,y );       /* ライト スタ-トラスタ (Y)      */
  595.     outp(WPM+gaport,7);          /* ライト プレ-ン マスク        */
  596.     *(ga_wind + (x >> 3)) = a;   /* グラフィックメモリにライトアクセス   */
  597.  
  598.     outpw(SRR_+gaport,y);        /* リ-ド スタ-トラスタ */
  599.     outp(RPS+gaport,2);          /* リ-ド プレ-ン   */
  600.     b = *(ga_wind + (x >> 3));   /* グラフィックメモリにリ-ドアクセス   */
  601.  
  602. /* MOD1 WBM WPM をデフォルトにもどす */
  603.     outp(MOD1+gaport,1);          /* グラフィック コントロ-ラ モ-ド 1 */
  604.     outpw(WBM_+gaport,0xffff) ;   /* ライト ビットマスク           */
  605.     outp(WPM+gaport,wpm_save);    /* ライト プレ-ン マスク         */
  606. }
  607.  
  608. /*****************************************
  609.     ピクセル セットをc言語で行なう場合
  610. *****************************************/
  611. void setPixel(x1,y1,color)     
  612. int x1,y1,color;
  613. {
  614.  static unsigned char smask[8] = {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
  615.  
  616.     int j,bx;
  617.     volatile uchar far *p;
  618.  
  619.     outp(gaport+MOD1,1) ;
  620.     outpw(gaport+SRW_,y1);
  621.     outp(gaport+WPM,-1);
  622.     outp(gaport+COL,color);
  623.     j =  x1 & 7 ;
  624.     bx = x1 >> 3;
  625.     p = ga_wind + bx ;
  626.     *p = smask[j];
  627. }
  628.  
  629.  
  630. #endif
  631.  
  632. #if 0
  633. /****************************************************************************
  634.  
  635.     マウスカ-ソルを割り込みで処理する場合は以下のソ-スを参考にしてください
  636.  
  637.   MS-DOS添付のMOUSE.SYSが組み込まれていることが必要です
  638.  
  639.   CallMouse() を呼び出せばマウスカ-ソルを割り込みで処理されます
  640.   ReleaseMouse()で割り込みを解除する
  641.  
  642. *****************************************************************************/
  643.  
  644. /*マウスを移動するとこの関数が呼ばれる*/
  645. void far intMouse()
  646. {
  647.     struct    HWREG hw;
  648.     int    x,y,left,right;
  649.  
  650.     GAsaveHwRegister(&hw);
  651.     GetMouse(&x,&y,&left,&right);
  652.     if (disp_flag) GAdrawCursor(x,y);
  653.     GArestoreHwRegister(&hw);
  654. }
  655.  
  656.  
  657. /*  アセンブラ記述部 */
  658.  
  659. ;  割り込みの設定
  660. _CallMouse    proc    far
  661.         mov     ax,cs
  662.         mov     es,ax
  663.         mov     dx,offset mouse_move  ;下の関数
  664.         mov     ax,0ch        ; 
  665.         mov     cx,1        ; コール条件
  666.         int     33h
  667.         ret
  668. _CallMouse    endp
  669.  
  670. mouse_move        proc    far
  671.         push    ds
  672.         mov     ax,DGROUP
  673.         mov     ds,ax
  674.         call    far ptr _intMouse   ; cの関数
  675.         pop     ds
  676.         ret
  677. mouse_move        endp
  678.  
  679. _ReleaseMouse    proc    far
  680.         mov     cx,0    ;  コール条件
  681.         mov     ax,0ch
  682.         int     33h
  683.         ret
  684. _ReleaseMouse    endp
  685.  
  686. #endif
  687.  
  688.