⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dos 6.22.c

📁 dos 6.22启动盘源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* App.H */
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <conio.h>
#include <string.h>
#include <dos.h>
#include <dir.h>
#include <bios.h>
#define UPKEY 0x4800
#define DOWNKEY 0x5000
#define ESC 0x011b
#define ENTER 0x1c0d
#define F1 0x3b00

void initDrv(void){
     int gdriver = DETECT, gmode, errorcode;
     initgraph(&gdriver, &gmode, "");
     errorcode = graphresult();
     if (errorcode != grOk)
     {
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
     }
} void closeDrv(void){
     closegraph();
} int ctextx(int x1,int x2,char * str){
    int x;
    x = ((x1 + x2) - strlen(str) * 8)/2;
    return x;
} int ctexty(int y1,int y2){
    int y;
    y = (y1 + y2 - 6) /2;
    return y;
} void fillbox_3D(int x1,int y1,int x2,int y2){
     setcolor(15);
     line(x1,y1,x2,y1);
     line(x1,y1+1,x2,y1+1);
     line(x1,y1,x1,y2);
     line(x1+1,y1,x1+1,y2);
     setcolor(8);
     line(x2,y1,x2,y2);
     line(x2-1,y1,x2-1,y2);
     line(x1,y2,x2,y2);
     line(x1,y2-1,x2,y2-1);
     setfillstyle(1,7);
     bar(x1+2,y1+2,x2-2,y2-2);
} void fillbox_3D_Down(int x1,int y1,int x2,int y2,int c){
     setcolor(8);
     line(x1,y1,x2,y1);
     line(x1,y1+1,x2,y1+1);
     line(x1,y1,x1,y2);
     line(x1+1,y1,x1+1,y2);
     setcolor(15);
     line(x2,y1,x2,y2);
     line(x2-1,y1,x2-1,y2);
     line(x1,y2,x2,y2);
     line(x1,y2-1,x2,y2-1);
     setfillstyle(1,c);
     bar(x1+2,y1+2,x2-2,y2-2);
}

void fillbox_2D(int x1,int y1,int x2,int y2,int fallpat,int fallc,int lc){
     setcolor(lc);
     line(x1,y1,x2,y1);
     line(x1,y1,x1,y2);
     line(x2,y1,x2,y2);
     line(x1,y2,x2,y2);
     setfillstyle(fallpat,fallc);
     bar(x1+1,y1+1,x2-1,y2-1);
} void draw_win_3D(int x1,int y1,int x2,int y2,int tc,char * title,int wc){
     fillbox_3D(x1,y1,x2,y2);
     setcolor(8);
     line(x1+3,y1+3,x2-3,y1+3);
     line(x1+3,y1+3,x1+3,y1+22);
     setcolor(15);
     line(x1+3,y1+22,x2-3,y1+22);
     line(x2-3,y1+3,x2-3,y1+22);
     setfillstyle(1,tc);
     bar(x1+4,y1+4,x2-4,y1+21);
     int x = ctextx(x1+3,x2-3,title);
     int y = ctexty(y1+3,y1+22);
     setcolor(wc);
     outtextxy(x,y,title);
} void auto_line(int x1,int y1,int x2,int y2){
     setcolor(8);
     line(x1,y1,x2,y2);
     setcolor(15);
     line(x1,y1+1,x2,y2+1);
} void buttonUp(int x1,int y1,int x2,int y2,char * Caption){
     setcolor(15);
     line(x1,y1,x2,y1);
     line(x1,y1,x1,y2);
     setcolor(8);
     line(x2,y1,x2,y2);
     line(x1,y2,x2,y2);
     setfillstyle(1,7);
     bar(x1+1,y1+1,x2-1,y2-1);
     int x = ctextx(x1,x2,Caption);
     int y = ctexty(y1,y2);
     setcolor(0);
     outtextxy(x,y,Caption);
} void buttonDown(int x1,int y1,int x2,int y2,char * Caption){
     setcolor(8);
     line(x1,y1,x2,y1);
     line(x1,y1,x1,y2);
     setcolor(15);
     line(x2,y1,x2,y2);
     line(x1,y2,x2,y2);
     setfillstyle(1,7);
     bar(x1+1,y1+1,x2-1,y2-1);
     int x = ctextx(x1,x2,Caption);
     int y = ctexty(y1,y2);
     setcolor(0);
     outtextxy(x,y,Caption);
} void buttonselect(int x1,int y1,int x2,int y2,char * Caption){
     setcolor(15);
     line(x1,y1,x2,y1);
     line(x1,y1,x1,y2);
     setcolor(8);
     line(x2,y1,x2,y2);
     line(x1,y2,x2,y2);
     int x = ctextx(x1,x2,Caption);
     int y = ctexty(y1,y2);
     setfillstyle(1,9);
     bar(x1 + 3,y1 + 3,x2 - 3,y2 - 3);
     setcolor(0);
     outtextxy(x,y,Caption);
} void kill_words(int x1,int y1,int x2,int y2){
     setfillstyle(1,7);
     bar(x1,y1,x2,y2);
} int cwinx(int x){
    int ox;
    ox = 640 - x;
    return ox;
} int cwiny(int y){
    int oy;
    oy = 480 - y;
    return oy;
} void textbox(int x1,int y1,int x2,int y2,int bcolor,int wc,char * Caption){
     fillbox_3D_Down(x1,y1,x2,y2,bcolor);
     setcolor(wc);
     int x = ctextx(x1,x2,Caption);
     int y = ctexty(y1,y2);
     outtextxy(x,y,Caption);
} void ProgressBar(int x1,int y1,int x2,int y2,int bcolor,int c
  ,int value){
     fillbox_3D_Down(x1,y1,x2,y2,bcolor);
     int howlong = (x2 - x1) / 100;
     setfillstyle(1,c);
     if(x1+3+howlong * value >= x2){
       bar(x1+3,y1+3,x1-3+howlong * value,y2-3);
     }
     else{
bar(x1+3,y1+3,x1+3+howlong * value,y2-3);
     }
} void copy(int x1,int y1,int x2,int y2,int c,char * file1, char * file2){
     FILE * oldfile, * newfile;
     struct ffblk ffblk;
     long howlong = 0;
     long flag = 0;
     long bytes = 0;
     int b = 0;
     oldfile = fopen(file1,"rb");
     newfile = fopen(file2,"wb");
     int done = findfirst(file1,&ffblk,0);
     while(!done){
   howlong = howlong + ffblk.ff_fsize;
   done = findnext(&ffblk);
     }
   bytes = howlong / 100;
   do {
      fputc(fgetc(oldfile),newfile);
      flag = flag + 1;
      if(flag / bytes == 1){
        flag = 0;
        b = b + 1;
        ProgressBar(x1,y1,x2,y2,7,c,b);
      }
   }while(!feof(oldfile));
   fclose(oldfile);
   fclose(newfile);
} 

/* Setup.Cpp */
#include "app1.h"
void mainmenu(void);
void findfile(char * fp);
void text(int flag);
void select(void);
void helpmessage(void);
void programemain(void);
void quittodos(void);
void fhd(void);
void fnf(void);
void searchDospath(void);
void searchToolspath(void);
void searchMyDospath(void);
void wautoexec(void);
void wconfig(void);
void installDos(void);
void installTools(void);
void installMyDos(void);
void enoughspace(void);

main(int argc,char * argv[]){
    if(argc == 1){
      initDrv();
      programemain();
    }
    else if(argc == 2 && !strcmp(argv[1],"/v")){
textmode(C80);
textcolor(15|128);
cprintf("BootDisk");
textcolor(9);
cprintf(" Version");
textcolor(2|128);
cprintf(" 2000 ");
textcolor(9);
cprintf("by GoodJob studio\n");
int y = wherey();
gotoxy(1,y);
cprintf("Writer : Yu Sheng");
textmode(-1);
exit(1);
    }
    else if(argc == 2 && !strcmp(argv[1],"/?")){
  printf("BootDisk Version 2000.\n");
  printf("/v      To see the BootDisk Version\n");
  printf("/fhd    To format HardDisk\n");
  printf("/id     To install Dos\n");
  printf("/it     To install Tools\n");
  printf("/imd    To install MyDos\n");
  printf("/?      To see Quick Help");
    }
    else if(argc == 2 && !strcmp(argv[1],"/fhd")){
  fhd();
    }
    else if(argc == 2 && !strcmp(argv[1],"/id")){
  initDrv();
  installDos();
    }
    else if(argc == 2 && !strcmp(argv[1],"/it")){
  initDrv();
  installTools();
    }
    else if(argc == 2 && !strcmp(argv[1],"/imd")){
  initDrv();
  installMyDos();
    }
    else{
initDrv();
programemain();
    }
return 0;
}

void mainmenu(void){
     draw_win_3D(50,50,cwinx(50),cwiny(50),1,"BootDisk Version 2000 Install Menu",2);
     textbox(55,400,585,425,7,6,"Welcome to use BootDisk Version 2000");
     setcolor(5);
     settextstyle(1,1,7);
     outtextxy(100,100,"BootDisk");
     setcolor(4);
     settextstyle(5,0,5);
     outtextxy(265,75,"Selected Menu");
     settextstyle(0,0,1);
     buttonselect(275,155,490,185,"Format HardDisk");
     buttonUp(275,190,490,220,"Install Dos");
     buttonUp(275,225,490,255,"Install Tools");
     buttonUp(275,260,490,290,"Install My Dos");
     buttonUp(275,295,490,325,"About BootDisk");
     buttonUp(275,330,490,360,"Exit");
} void text(int flag){
     if(flag == 1){
       textbox(55,400,585,425,7,6,"To format your HardDisk");
     }
     else if(flag == 2){
       textbox(55,400,585,425,7,6,"To install Microsoft Dos 6.22");
     }
     else if(flag == 3){
       textbox(55,400,585,425,7,6,"To install some tools");
     }
     else if(flag == 4){
       textbox(55,400,585,425,7,6,"We develop some tools for MS-DOS");
     }
     else if(flag == 5){
       textbox(55,400,585,425,7,6,"To see BootDisk about information");
     }
     else if(flag == 6){
       textbox(55,400,585,425,7,6,"Exit to Dos");
     }
} void select(void){
     int flag = 1;
     int key;
     char Redo = 'Y';
     while(Redo == 'Y'){
   Redo = 'N';
   key = bioskey(0);
   switch(key){
       case UPKEY: if(flag == 1){
       buttonUp(275,155,490,185,"Format HardDisk");
       buttonselect(275,330,490,360,"Exit");
       flag = 6;
       Redo = 'Y';

     }
     else if(flag == 2){
       buttonUp(275,190,490,220,"Install Dos");
       buttonselect(275,155,490,185,"Format HardDisk");
       flag = 1;
       Redo = 'Y';

     }
     else if(flag == 3){
       buttonUp(275,225,490,255,"Install Tools");
       buttonselect(275,190,490,220,"Install Dos");
       flag = 2;
       Redo = 'Y';

     }
     else if(flag == 4){
       buttonUp(275,260,490,290,"Install My Dos");
       buttonselect(275,225,490,255,"Install Tools");
       flag = 3;
       Redo = 'Y';

     }
     else if(flag == 5){
       buttonUp(275,295,490,325,"About BootDisk");
       buttonselect(275,260,490,290,"Install My Dos");
       flag = 4;
       Redo = 'Y';

     }
     else if(flag == 6){
       buttonUp(275,330,490,360,"Exit");
       buttonselect(275,295,490,325,"About BootDisk");
       flag = 5;
       Redo = 'Y';

     }
     text(flag);
     break;
       case DOWNKEY: if(flag == 1){
         buttonUp(275,155,490,185,"Format HardDisk");
         buttonselect(275,190,490,220,"Install Dos");
         flag = 2;
         Redo = 'Y';

       }
       else if(flag == 2){
         buttonUp(275,190,490,220,"Install Dos");
         buttonselect(275,225,490,255,"Install Tools");
         flag = 3;
         Redo = 'Y';

       }
       else if(flag == 3){
         buttonUp(275,225,490,255,"Install Tools");
         buttonselect(275,260,490,290,"Install My Dos");
         flag = 4;
         Redo = 'Y';

       }
       else if(flag == 4){
         buttonUp(275,260,490,290,"Install My Dos");
         buttonselect(275,295,490,325,"About BootDisk");
         flag = 5;
         Redo = 'Y';

       }
       else if(flag == 5){
         buttonUp(275,295,490,325,"About BootDisk");
         buttonselect(275,330,490,360,"Exit");
         flag = 6;
         Redo = 'Y';

       }
       else if(flag == 6){
         buttonUp(275,330,490,360,"Exit");
         buttonselect(275,155,490,185,"Format HardDisk");
         flag = 1;
         Redo = 'Y';

       }
       text(flag);
       break;
       case ENTER :  if(flag == 6){
         quittodos();
       }
       else if(flag == 5){
     buttonDown(275,295,490,325,"About BootDisk");
     delay(150);
     buttonUp(275,295,490,325,"About BootDisk");
     delay(150);
     helpmessage();
       }
       else if(flag == 1){
     buttonDown(275,155,490,185,"Format HardDisk");
     delay(150);
     buttonUp(275,155,490,185,"Format HardDisk");
     delay(150);
     fhd();
       }
       else if(flag == 2){
     buttonDown(275,190,490,220,"Install Dos");
     delay(150);
     buttonUp(275,190,490,220,"Install Dos");
     delay(150);
     installDos();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -