home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
- #include <fcntl.h>
- #include <io.h>
- #include <stdio.h>
- #include <conio.h>
- #include <process.h>
-
- /*
- This was compiled with TurboC. Other C is similar
- Module must be a 31 instrument one
- */
-
- /* The data definitions */
-
- typedef unsigned int UWORD;
- typedef unsigned char BYTE;
-
- typedef struct {
- char firstbyte;
- char secndbyte;
- BYTE thirdbyte;
- UWORD samp0,samp1,samp2,samp3,samp4,samp5,samp6,samp7;
- UWORD samp8,samp9,samp10,samp11,samp12,samp13,samp14,samp15;
- UWORD samp16,samp17,samp18,samp19,samp20,samp21,samp22,samp23;
- UWORD samp24,samp25,samp26,samp27,samp28,samp29,samp30,samp31;
- BYTE trailer1,trailer2,trailer3,trailer4;
- } MPSTRUCT;
-
- MPSTRUCT mppat = { 'M','P',
- 0, /* 0 = speaker, 7 = S Blaster etc.. etc..*/
- 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,
- 0, /* Start with pattern 0 */
- 0, /* Play whole song */
- 1, /* 1 = 12Mhz+, 0 = 10Mhz+ */
- 0 /* All samples in Module are <64k (0x80 otherwise) */
- };
-
-
-
- main ()
- {
- union REGS inregs,outregs;
- int i,fd;
-
- if ((fd = open("themodel.mod", (O_RDONLY | O_BINARY) )) == -1 )
- {
- printf("Module not found!\n");
- exit(1);
- }
-
- allocmem(0x2840/16+1,&mppat.samp0); /* Samples start at 0x2840 */
- read(fd,MK_FP(mppat.samp0,0),0x2840);
-
- allocmem(6700/16+1,&mppat.samp1);
- read(fd,MK_FP(mppat.samp1,0),6700);
-
- allocmem(7000/16+1,&mppat.samp2);
- read(fd,MK_FP(mppat.samp2,0),7000);
-
- allocmem(5900/16+1,&mppat.samp3);
- read(fd,MK_FP(mppat.samp3,0),5900);
-
- allocmem(8000/16+1,&mppat.samp4);
- read(fd,MK_FP(mppat.samp4,0),8000);
-
- allocmem(20230/16+1,&mppat.samp5);
- read(fd,MK_FP(mppat.samp5,0),20230);
-
- allocmem(2300/16+1,&mppat.samp6);
- read(fd,MK_FP(mppat.samp6,0),2300);
-
- allocmem(9900/16+1,&mppat.samp7);
- read(fd,MK_FP(mppat.samp7,0),9900);
-
- allocmem(6200/16+1,&mppat.samp8);
- read(fd,MK_FP(mppat.samp8,0),6200);
-
-
- close(fd);
- inregs.x.dx = FP_SEG(&mppat);
- inregs.x.cx = FP_OFF(&mppat);
- inregs.x.ax = 0x8220;
- int86(0x2f,&inregs,&outregs);
-
- switch (outregs.x.ax)
- {
- case 0x5722: break;
-
- case 0x2000:
- printf("Error: Modres doesn't like something about the structure\n");
- exit(2);
-
- default:
- printf("Modres not installed!\n");
- exit(1);
- }
-
- /** DO SOMETHING INTERESTING HERE ** AS LONG AS IT DOESN'T INVOLVE DISKS ***/
-
- inregs.x.ax = 0;
- int86(0x16,&inregs,&outregs); /* Wait for a key */
-
- inregs.x.ax = 0x8227;
- inregs.x.bx = 0x0003;
- int86(0x2f,&inregs,&outregs);
- exit(0);
- }
-