First commit ~0,10
This commit is contained in:
BIN
MODS/DONTYOU.MOD
Normal file
BIN
MODS/DONTYOU.MOD
Normal file
Binary file not shown.
24
MODS/EXAMPLE1.C
Normal file
24
MODS/EXAMPLE1.C
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <process.h>
|
||||
#include "modplay.inc"
|
||||
|
||||
unsigned int _stklen = 0x1000; /* set stack size to 4kB */
|
||||
unsigned int _heaplen = 0x0000; /* no heap required */
|
||||
|
||||
unsigned char Mod_File[128];
|
||||
unsigned char *DOS_Shell="C:\\COMMAND.COM";
|
||||
|
||||
void main(int argc, char *argv[])
|
||||
{
|
||||
if (argc>1) {
|
||||
strcpy(Mod_File, argv[1]);
|
||||
Mod_Init(Detection,0,0,0);
|
||||
Mod_Load(Mod_File);
|
||||
if (Channels!=0) {
|
||||
Mod_Play(1);
|
||||
DOS_Shell=getenv("COMSPEC");
|
||||
if (spawnl(P_WAIT, DOS_Shell, NULL)!=-1) printf("\nReturned... Music output stopped.\n");
|
||||
}
|
||||
}
|
||||
else printf("\nPlease specify a modulefile on the commandline !\n");
|
||||
}
|
BIN
MODS/EXAMPLE1.DSK
Normal file
BIN
MODS/EXAMPLE1.DSK
Normal file
Binary file not shown.
BIN
MODS/EXAMPLE1.EXE
Normal file
BIN
MODS/EXAMPLE1.EXE
Normal file
Binary file not shown.
BIN
MODS/EXAMPLE1.PRJ
Normal file
BIN
MODS/EXAMPLE1.PRJ
Normal file
Binary file not shown.
100
MODS/EXAMPLE2.C
Normal file
100
MODS/EXAMPLE2.C
Normal file
@ -0,0 +1,100 @@
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include "modplay.inc"
|
||||
|
||||
unsigned int _stklen = 0x1000; /* set stack size to 4kB */
|
||||
unsigned int _heaplen = 0x0000; /* no heap required */
|
||||
|
||||
unsigned char Key, Main_Volume;
|
||||
unsigned int Cursor_Shape;
|
||||
|
||||
void Init_Cursor(void)
|
||||
{
|
||||
asm {
|
||||
mov ah,3
|
||||
xor bh,bh
|
||||
int 10h
|
||||
mov [Cursor_Shape],cx
|
||||
mov ah,1
|
||||
mov cx,2020h
|
||||
int 10h
|
||||
}
|
||||
}
|
||||
|
||||
void Restore_Cursor(void)
|
||||
{
|
||||
asm {
|
||||
mov ah,1
|
||||
mov cx,[Cursor_Shape]
|
||||
int 10h
|
||||
}
|
||||
}
|
||||
|
||||
void Update_Screen(void)
|
||||
{
|
||||
unsigned int i,j;
|
||||
unsigned char Bar[32];
|
||||
unsigned int SongPos;
|
||||
|
||||
gotoxy(1,7);
|
||||
Mod_Peak();
|
||||
for(i=0; i<Channels; i++) {
|
||||
strcpy(Bar,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
if (Peak[i]>1) for(j=0; j<(Peak[i]>>1); j++) Bar[j]='<EFBFBD>';
|
||||
gotoxy(2,4+i); cprintf("%s", Bar);
|
||||
}
|
||||
SongPos=Mod_Position();
|
||||
gotoxy(3,6+Channels); cprintf("Playing pattern #%d, line #%d ", SongPos>>8, SongPos&0x00ff);
|
||||
gotoxy(62,wherey()); cprintf("Main volume: %3d%%", div(Main_Volume*100,64));
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Mod_Init(Detection,0,0,0);
|
||||
if (Soundcard!=0) {
|
||||
Mod_Load("DONTYOU.MOD");
|
||||
if (Channels!=0) {
|
||||
Init_Cursor();
|
||||
Main_Volume=58;
|
||||
Mod_Volume(Main_Volume);
|
||||
Mod_Play(0);
|
||||
textcolor(WHITE); textbackground(BLACK);
|
||||
clrscr();
|
||||
textbackground(BLUE); gotoxy(1,1); clreol();
|
||||
gotoxy(22,1); cprintf("SOUND WIZARDS MODULE PLAYER 'C' DEMO");
|
||||
gotoxy(1,6+Channels); clreol();
|
||||
textbackground(BLACK);
|
||||
gotoxy(36,1+Channels); cprintf("Press up,down: to adjust volume ");
|
||||
gotoxy(36,2+Channels); cprintf(" left,right: to change position");
|
||||
gotoxy(36,3+Channels); cprintf("or escape to quit this little program......");
|
||||
textbackground(BLUE);
|
||||
do {
|
||||
Update_Screen();
|
||||
Key=' ';
|
||||
if (kbhit()) Key=getch();
|
||||
if (Key==0) { /* only allow function keys */
|
||||
Key=getch();
|
||||
switch(Key) {
|
||||
case 0x48: if (Main_Volume<64) {
|
||||
Main_Volume+=2;
|
||||
Mod_Volume(Main_Volume);
|
||||
}
|
||||
break;
|
||||
case 0x50: if (Main_Volume>0) {
|
||||
Main_Volume-=2;
|
||||
Mod_Volume(Main_Volume);
|
||||
}
|
||||
break;
|
||||
case 0x4d: Mod_Forward();
|
||||
break;
|
||||
case 0x4b: Mod_Rewind();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while((Mod_Status()!=0) && (Key!=27));
|
||||
gotoxy(1,9+Channels);
|
||||
Restore_Cursor();
|
||||
} else printf("\nCould not load song DONTYOU.MOD...\n");
|
||||
} else printf("\nCould not initialize hardware...");
|
||||
}
|
BIN
MODS/EXAMPLE2.DSK
Normal file
BIN
MODS/EXAMPLE2.DSK
Normal file
Binary file not shown.
BIN
MODS/EXAMPLE2.EXE
Normal file
BIN
MODS/EXAMPLE2.EXE
Normal file
Binary file not shown.
BIN
MODS/EXAMPLE2.PRJ
Normal file
BIN
MODS/EXAMPLE2.PRJ
Normal file
Binary file not shown.
185
MODS/MODPLAY.INC
Normal file
185
MODS/MODPLAY.INC
Normal file
@ -0,0 +1,185 @@
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ */
|
||||
/* <20> SOUND WIZARDS MODULE PLAYER V1.3 BY LORD EXCESS <20> */
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Detection 0
|
||||
#define SoundBlaster 1
|
||||
#define SoundBlaster_Pro 2
|
||||
#define Gravis_UltraSound 3
|
||||
|
||||
unsigned int Soundcard, Channels;
|
||||
void *Mod_Driver;
|
||||
unsigned char Peak[8];
|
||||
|
||||
extern void far Detect_Hardware(void);
|
||||
extern void far Driver_SB(void);
|
||||
extern void far Driver_SBP(void);
|
||||
extern void far Driver_GUS(void);
|
||||
|
||||
void Mod_Close(void)
|
||||
{
|
||||
asm {
|
||||
mov bx,1
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Init(unsigned int Driver, unsigned int Port, unsigned char IRQ, unsigned char DMA)
|
||||
{
|
||||
asm {
|
||||
mov ax,[Driver]
|
||||
or ax,ax
|
||||
jz l_1
|
||||
cmp ax,Gravis_UltraSound
|
||||
ja l_Error
|
||||
mov cl,BYTE PTR [IRQ]
|
||||
mov ch,BYTE PTR [DMA]
|
||||
mov dx,[Port]
|
||||
jmp l_2
|
||||
}
|
||||
l_1:
|
||||
Detect_Hardware();
|
||||
asm {
|
||||
or ax,ax
|
||||
jz l_Error
|
||||
cmp ax,Gravis_UltraSound
|
||||
ja l_Error
|
||||
}
|
||||
l_2:
|
||||
asm {
|
||||
mov [Soundcard],ax
|
||||
mov WORD PTR [Mod_Driver],0
|
||||
cmp ax,SoundBlaster
|
||||
jnz l_3
|
||||
mov WORD PTR [Mod_Driver+2],SEG Driver_SB
|
||||
jmp l_Test
|
||||
}
|
||||
l_3:
|
||||
asm {
|
||||
cmp ax,SoundBlaster_Pro
|
||||
jnz l_4
|
||||
mov WORD PTR [Mod_Driver+2],SEG Driver_SBP
|
||||
jmp l_Test
|
||||
}
|
||||
l_4:
|
||||
asm {
|
||||
mov WORD PTR [Mod_Driver+2],SEG Driver_GUS
|
||||
}
|
||||
l_Test:
|
||||
asm {
|
||||
xor bx,bx
|
||||
call DWORD PTR [Mod_Driver]
|
||||
or ax,ax
|
||||
jz l_Error
|
||||
}
|
||||
if (atexit(Mod_Close)) {
|
||||
Mod_Close();
|
||||
l_Error:
|
||||
asm {
|
||||
mov [Soundcard],0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Load(char *File_Name)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,2
|
||||
mov dx,WORD PTR [File_Name]
|
||||
call DWORD PTR [Mod_Driver]
|
||||
mov [Channels],ax
|
||||
}
|
||||
else Channels=0;
|
||||
}
|
||||
|
||||
void Mod_Play(unsigned int Looping)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,3
|
||||
mov ax,[Looping]
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Stop(void)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,4
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Volume(unsigned char Volume)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,5
|
||||
mov al,[Volume]
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Mod_Status(void)
|
||||
{
|
||||
if (Soundcard) {
|
||||
asm {
|
||||
mov bx,6
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
return(_AX);
|
||||
}
|
||||
else return(0);
|
||||
}
|
||||
|
||||
unsigned int Mod_Position(void)
|
||||
{
|
||||
if (Soundcard) {
|
||||
asm {
|
||||
mov bx,7
|
||||
xor al,al
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
return(_AX);
|
||||
}
|
||||
else return(0);
|
||||
}
|
||||
|
||||
void Mod_Rewind(void)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,7
|
||||
mov al,-1
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Forward(void)
|
||||
{
|
||||
if (Soundcard) asm {
|
||||
mov bx,7
|
||||
mov al,1
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_Peak(void)
|
||||
{
|
||||
asm {
|
||||
push es
|
||||
mov ax,ds
|
||||
mov es,ax
|
||||
mov di,OFFSET Peak
|
||||
}
|
||||
if (Soundcard) asm {
|
||||
mov bx,8
|
||||
call DWORD PTR [Mod_Driver]
|
||||
}
|
||||
else asm {
|
||||
cld
|
||||
mov cx,4
|
||||
xor ax,ax
|
||||
rep stosw
|
||||
}
|
||||
asm pop es;
|
||||
}
|
BIN
MODS/MOD_DRV.OBJ
Normal file
BIN
MODS/MOD_DRV.OBJ
Normal file
Binary file not shown.
Reference in New Issue
Block a user