home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / diskf / diskf.c next >
Text File  |  1990-06-14  |  6KB  |  229 lines

  1. /*    DISKF.C     PROGRAMMED BY MSどす 1989.08.27    */
  2. /*                last update 1989.08.27                 */
  3.  
  4. #include <msdos.cf>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <egb.h>
  8. #include <mos.h>
  9. #include <fmc.h>
  10. #include <ctype.h>
  11. #include <jctype.h>
  12. #include <string.h>
  13. #include <jstring.h>
  14. #include <mmi.h>
  15. #include <math.h>
  16.  
  17. /* マクロ定義 */
  18. #define D_MODE         4                /* 画面モード */
  19. #define D_XMAX       639            /* 画面最大Y座標 */
  20. #define D_YMAX       399            /* 画面最大X座標 */
  21.  
  22. #define C_HWHITE    15
  23. #define C_HYELLOW    14
  24. #define C_HLIGHTBLUE    13
  25. #define C_HGREEN    12
  26. #define C_HPURPLE    11
  27. #define C_HRED           10
  28. #define C_HBLUE           9
  29. #define C_HBLACK    8
  30. #define C_WHITE           7
  31. #define C_YELLOW    6
  32. #define C_LIGHTBLUE       5
  33. #define C_GREEN           4
  34. #define C_PURPLE    3
  35. #define C_RED        2
  36. #define C_BLUE        1
  37. #define C_BLACK           0
  38.  
  39. /* グローバル変数 */
  40. char work[2048];
  41. char mwork[4096];
  42.  
  43. char para[258];
  44. char outbuf[258];
  45.  
  46. int ypos=0;
  47. /* table */
  48. short int dsp_tbl[]={ 0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,
  49.         256,272,288,304,320,336,352,368,384,400,416,432,448,464,480,496};
  50. short int scr_tbl[]={ 128,144,160,176,192,208,224,240,256,272,288,304,320,336,
  51.         352,368,384,400,416,432,448,464,480,496,0,16,32,48,64,80,96,112};
  52. short int scr_wrk[]={    0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  53.                         0,0,0,0,0,0,0,0, 0,16,32,48,64,80,96,112};
  54.  
  55.  
  56. extern void initegb();
  57. extern void endegb();
  58. extern void wait_mouse();
  59. extern void dsp_text();
  60.  
  61.  
  62. main(){
  63.     int drv,c_size,endflg;
  64.  
  65.     initegb();
  66.     ypos=0;
  67.  
  68.     strcpy(outbuf,"DISKF  V1.0 L10  by MSどす");
  69.     dsp_text();
  70. /*    strcpy(outbuf,"     表示が停止した際は 'i'キーを押下してください");
  71.     dsp_text();*/
  72.     outbuf[0] = 0;
  73.     dsp_text();
  74.     strcpy (outbuf,"ドライブ  空き容量    全ディスク容量    クラスタサイズ");
  75.     dsp_text();
  76.  
  77.     for(drv=1;drv<3;drv++){                /* A: - B: */
  78.         Registers.AX.LH.H = 0x36;
  79.         Registers.DX.LH.L = drv;
  80.         calldos(); 
  81.         if((Registers.AX.R == 0xffff) || (Registers.Flags%2 == 1)){
  82.             sprintf(outbuf,"  %c:   (ドライブの準備が出来ていません)"
  83.                                 ,'A'+drv-1);
  84.         }
  85.         else{
  86.             c_size = Registers.AX.R * Registers.CX.R / 1024;
  87.             sprintf(outbuf,"  %c:    %6dKB       %6dKB    (%2dKB)"
  88.                         ,'A'+drv-1,c_size * Registers.BX.R,
  89.                         c_size * Registers.DX.R,c_size);
  90.         }
  91.         dsp_text();
  92.     }
  93.  
  94.     outbuf[0] = 0;
  95.     dsp_text();
  96.  
  97.     endflg = 0;
  98.     for(drv=4;drv<17 && !endflg;drv++){                /* D: - P: */
  99.         Registers.AX.LH.H = 0x36;
  100.         Registers.DX.LH.L = drv;
  101.         calldos(); 
  102.         if((Registers.AX.R == 0xffff) || (Registers.Flags%2 == 1)){
  103.         /*    sprintf(outbuf,"  %c:   (ドライブの準備が出来ていません)"
  104.                                 ,'A'+drv-1);*/
  105.             endflg = 1;
  106.         }
  107.         else{
  108.             c_size = Registers.AX.R * Registers.CX.R / 1024;
  109.             sprintf(outbuf,"  %c:    %6dKB       %6dKB    (%2dKB)"
  110.                         ,'A'+drv-1,c_size * Registers.BX.R,
  111.                         c_size * Registers.DX.R,c_size);
  112.             dsp_text();
  113.         }
  114.     }
  115.  
  116.     outbuf[0] = 0;
  117.     dsp_text();
  118.     strcpy(outbuf,"終了しました。マウスのボタンを押して下さい。");
  119.     dsp_text();
  120.     outbuf[0] = 0;
  121.     dsp_text();
  122.     wait_mouse();
  123.     
  124.     endegb();
  125.     return 0;
  126. }
  127.  
  128. void wait_mouse(){
  129.     int flg,mosbtn,moscnt,mosx,mosy;
  130.  
  131.     MOS_rdon(1,&mosbtn,&moscnt,&mosx,&mosy);
  132.     flg = 0;
  133.     
  134.     while(! flg){
  135.         MOS_rdon(0,&mosbtn,&moscnt,&mosx,&mosy);
  136.         if(moscnt)    flg = 1;
  137.         MOS_rdon(1,&mosbtn,&moscnt,&mosx,&mosy);
  138.         if(moscnt)    flg = 2;
  139.     }
  140.     if(flg == 2){
  141.         endegb();
  142.         exit(0);
  143.     }
  144. }
  145.  
  146. void dsp_text(){
  147.         int ret;
  148.         
  149.         WORD(para + 0) = 0;
  150.         WORD(para + 2) = dsp_tbl[ypos];
  151.         WORD(para + 4) = 639;
  152.         WORD(para + 6) = dsp_tbl[ypos] +16;
  153.         EGB_viewport(work,para);
  154.         EGB_partClearScreen(work);
  155.         WORD(para + 0) = 0;
  156.         WORD(para + 2) = 0;
  157.         WORD(para + 4) = 639;
  158.         WORD(para + 6) = 511;
  159.         EGB_viewport(work,para);
  160.  
  161.         strcpy(¶[6],outbuf);
  162.         WORD(para + 0) = 0;
  163.         WORD(para + 2) = dsp_tbl[ypos] +15;
  164.         WORD(para + 4) = strlen(¶[6]);    /* 文字列出力 */
  165.         ret=EGB_sjisString(work,para);
  166.  
  167.         EGB_displayStart(work,1,0,scr_wrk[ypos]);    /* 仮想画面中の移動 */
  168.                             /* スクロール */
  169.         scr_wrk[ypos] = scr_tbl[ypos];
  170.         ypos=(ypos+1)%32;
  171.  
  172. }
  173.  
  174.  
  175. void initegb()
  176. {
  177.  
  178.     EGB_init(work, 2048);         /* 初期化 */
  179.     EGB_resolution(work, 0, D_MODE); /* 仮想画面の設定(PAGE=0) */
  180.     EGB_resolution(work, 1, D_MODE); /* 同(PAGE=1) 1024*512 4bit/pixel */
  181.     EGB_displayStart(work,0,0,0);     /* 表示開始位置 *** */
  182.  
  183.     WORD(para + 0) = 0;
  184.     WORD(para + 2) = 0;
  185.     WORD(para + 4) = 639;
  186.     WORD(para + 6) = 511;
  187.     EGB_viewport(work,para);
  188. /*    EGB_palette(work,1,para);*/
  189.  
  190.     EGB_writePage(work, 1);                /* PAGE 1 write */
  191.  
  192.     EGB_displayPage(work, 1, 2);        /* PAGE 1 display */
  193.     EGB_color(work, 0, C_WHITE);            /* 前景色 */
  194.     EGB_color(work, 1, C_BLACK);            /* 背景色 */
  195.     EGB_color(work, 2, C_BLACK);            /* 面塗色 */
  196.     EGB_color(work, 3, C_BLACK);                /* 透過色 */
  197. /*  EGB_colorIGRB(work, 0, 0xffffffff);*/        /* 描画色設定1 */
  198. /*    EGB_pastel(work, 1, 128);*/            /* 混色比率の設定 */
  199.     EGB_writeMode(work, 0);                /* 描画MODE=pset */
  200.     EGB_pen(work, 0);                /* ペン設定 丸 */
  201.     EGB_penSize(work, 1);                /* ペンサイズ=1 */
  202.     EGB_paintMode(work, 0x22);            /* 面塗モード */
  203.  
  204.     EGB_textDirection(work,0);            /* 右 */
  205.     EGB_textDisplayDirection(work,0);        /* 右方向へ */
  206.     EGB_textSpace(work,0);                /* 文字間0 */
  207.     EGB_textZoom(work,0,8,16);            /* ANK 8*16dot */
  208.     EGB_textZoom(work,1,16,16);            /* 漢字 16*16dot */
  209.     EGB_fontStyle(work,0);                /* 字体標準 */
  210.     EGB_superImpose(work,0);    /* スーパーインポーズOFF(ON=128or129) */
  211.     EGB_dezitize(work,0);                /* デジタイズOFF(ON=1) */
  212.     
  213.     MOS_start(mwork,4096);
  214.     MOS_resolution(0,4);
  215.     MOS_disp(0);
  216.  
  217.     EGB_clearScreen(work);
  218. }
  219.  
  220. void endegb()
  221. {
  222.     MOS_end();                    /* mouse end */
  223.     EGB_resolution(work, 0, 1);    /* 仮想画面の設定(PAGE=0) */
  224.     EGB_resolution(work, 1, 1);    /* 同(PAGE=1) 1024*512 4bit/pixel */
  225.     EGB_displayStart(work,0,0,0);    /* 表示開始位置 *** */
  226.     EGB_displayPage(work, 1, 3);        /* PAGE 0&1 display */
  227.     EGB_clearScreen(work);
  228. }
  229.