Author: LaTeX (mail.ase2i.fr)
Date: 07-23-2001 13:03
/****************************************************************/
/* Fichier qui constitura par la suite la bibliotheque de */
/* fonctions pour commander le son sur STE. */
/* Frederic Dussin, 29 Juillet 1998. */
/****************************************************************/
# include "stesound.h"
# include <stdio.h>
# include <tos.h>
STESOUND_Frequency STESOUND_SetFrequency ( STESOUND_Frequency frequency )
{
int * adr_freq = (int*)0xff8920L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*adr_freq &= 0xfffc;
*adr_freq += frequency;
if ( !_super )
Super( (void*)super_stack );
return( frequency );
}
STESOUND_Frequency STESOUND_GetFrequency ( void )
{
int * adr_freq = (int*)0xff8920L;
int tmp;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
tmp = *adr_freq & 0x2;
if ( !_super )
Super( (void*)super_stack );
return( (STESOUND_Frequency)tmp );
}
void STESOUND_PlayLoop ( void )
{
int * adr_playmode = (int*)0xff8900L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*adr_playmode |= 0x3;
if ( !_super )
Super( (void*)super_stack );
}
void STESOUND_Play ( void )
{
int * adr_playmode = (int*)0xff8900L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*adr_playmode &= 0xfffc;
*adr_playmode += 0x1;
if ( !_super )
Super( (void*)super_stack );
}
void STESOUND_Stop ( void )
{
int * adr_playmode = (int*)0xff8900L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*adr_playmode &= 0xfffc;
if ( !_super )
Super( (void*)super_stack );
}
STESOUND_PlayMode STESOUND_SetPlayMode ( STESOUND_PlayMode mode )
{
int * adr_playmode = (int*)0xff8900L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*adr_playmode &= 0xfffc;
*adr_playmode += mode;
if ( !_super )
Super( (void*)super_stack );
return( mode );
}
STESOUND_PlayMode STESOUND_GetPlayMode( void )
{
int * adr_playmode = (int*)0xff8900L;
int tmp;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
tmp = *adr_playmode & 0x2;
if ( !_super )
Super( (void*)super_stack );
return( (STESOUND_PlayMode)tmp );
}
void* STESOUND_SetStart ( void* adress )
{
char * adr = NULL;
long start = (long)adress;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
adr = (char*)0xff8903L;
*adr = (char)(start>>16);
adr = (char*)0xff8905L;
*adr = (char)(start>>8);
adr = (char*)0xff8907L;
*adr = (char)start;
if ( !_super )
Super( (void*)super_stack );
return( adress );
}
void* STESOUND_GetStart ( void )
{
long adress = 0;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
(char)adress += (*(char*)0xff8907L);
(short)adress += (*( (short*)0xff8904L ))<<8;
adress += (*(long*)0xff8902L) & 0x00ff0000L;
if ( !_super )
Super( (void*)super_stack );
return( (void*)adress );
}
void* STESOUND_SetStop ( void* adress )
{
char * adr = NULL;
long super_stack;
long stop = (long)adress;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
adr = (char*)0xff890fL;
*adr = (char)(stop>>16);
adr = (char*)0xff8911L;
*adr = (char)(stop>>8);
adr = (char*)0xff8913L;
*adr = (char)stop;
if ( !_super )
Super( (void*)super_stack );
return( adress );
}
void* STESOUND_GetStop ( void )
{
long adress = 0;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
(char)adress += (*(char*)0xff8913L);
(short)adress += (*( (short*)0xff8910L ))<<8;
adress += (*(long*)0xff890eL) & 0x00ff0000L;
if ( !_super )
Super( (void*)super_stack );
return( (void*)adress );
}
void* STESOUND_SetCurrent ( void* position )
{
char * adr = NULL;
long super_stack;
long cur = (long)position;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
adr = (char*)0xff8909L;
*adr = (char)(cur>>16);
adr = (char*)0xff890bL;
*adr = (char)(cur>>8);
adr = (char*)0xff890dL;
*adr = (char)cur;
if ( !_super )
Super( (void*)super_stack );
return( position );
}
void* STESOUND_GetCurrent ( void )
{
long adress = 0;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
(char)adress += (*(char*)0xff890dL);
(short)adress += (*( (short*)0xff890aL ))<<8;
adress += (*(long*)0xff8908L) & 0x00ff0000L;
if ( !_super )
Super( (void*)super_stack );
return( (void*)adress );
}
STESOUND_Stereo STESOUND_SetStereo ( STESOUND_Stereo mode )
{
int * phone_adr = (int*)0xff8920L;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
*phone_adr = (*phone_adr & 3) + mode;
if ( !_super )
Super( (void*)super_stack );
return( mode );
}
STESOUND_Stereo STESOUND_GetStereo ( void )
{
int * phone_adr = (int*)0xff8920L;
int tmp;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
tmp = *phone_adr & 0x180;
/* prise en compte de spatial si sur bit suivant le bit stereo */
if ( !_super )
Super( (void*)super_stack );
return( tmp );
}
int STESOUND_SetRightFrontVolume ( int volume )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
volume = (volume % 41)>>1;
*lmc_data = volume + 0x500;
if ( !_super )
Super( (void*)super_stack );
return( volume );
}
int STESOUND_SetLeftFrontVolume ( int volume )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
volume = (volume % 41)>>1;
*lmc_data = volume + 0x540;
if ( !_super )
Super( (void*)super_stack );
return( volume );
}
int STESOUND_SetRightRearVolume ( int volume )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
volume = (volume % 41)>>1;
*lmc_data = volume + 0x580;
if ( !_super )
Super( (void*)super_stack );
return( volume );
}
int STESOUND_SetLeftRearVolume ( int volume )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
volume = (volume % 41)>>1;
*lmc_data = volume + 0x5c0;
if ( !_super )
Super( (void*)super_stack );
return( volume );
}
int STESOUND_SetMainVolume ( int volume )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
volume = volume % 41;
*lmc_data = volume + 0x4c0;
if ( !_super )
Super( (void*)super_stack );
return( volume );
}
int STESOUND_SetTreeble ( int treeble )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
treeble = ( (treeble / 2) + 6 ) % 13;
*lmc_data = treeble + 0x480;
if ( !_super )
Super( (void*)super_stack );
return( treeble );
}
int STESOUND_SetBass ( int bass )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
bass = ( (bass / 2) + 6 ) % 13;
*lmc_data = bass + 0x440;
if ( !_super )
Super( (void*)super_stack );
return( bass );
}
STESOUND_Chanel STESOUND_SetChanel ( STESOUND_Chanel chanel )
{
int * lmc_masque = (int*)0xff8924L;
int * lmc_data = (int*)0xff8922L;
int test, i;
long super_stack;
int _super = 1;
if ( !Super( (void*)1L ) )
{
super_stack = Super( (void*)0L );
_super = 0;
}
do
{
test = *lmc_masque;
for( i=0; i<500; i++ );
} while ( test != *lmc_masque );
*lmc_masque = 0x7ff;
*lmc_data = chanel + 0x400;
if ( !_super )
Super( (void*)super_stack );
return( chanel );
}
|