Пример #1
0
static void Mint_CloseAudio(_THIS)
{
	void *oldpile;

	/* Stop replay */
	oldpile=(void *)Super(0);
	DMAAUDIO_IO.control=0;
	Super(oldpile);

	DEBUG_PRINT((DEBUG_NAME "closeaudio: replay stopped\n"));

	/* Disable interrupt */
	Jdisint(MFP_DMASOUND);

	DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n"));

	/* Wait if currently playing sound */
	while (SDL_MintAudio_mutex != 0) {
	}

	DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n"));

	/* Clear buffers */
	if (SDL_MintAudio_audiobuf[0]) {
		Mfree(SDL_MintAudio_audiobuf[0]);
		SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
	}

	DEBUG_PRINT((DEBUG_NAME "closeaudio: buffers freed\n"));
}
Пример #2
0
/* 
	Adds a key to the buffer based on the passed in scancode.
*/
void add_key( SCANCODE bCode )
{
	int old_ssp = Super( 1 );
	int old_ipl;
	
	if( USER_MODE == old_ssp )
		old_ssp = Super( 0 );
	
	old_ipl = set_ipl( KEYBOARD_INTERRUPT_MASK );
	
	if( cFill < MAX_BUFFER_SIZE )
	{
		cKYBDBuffer[ cBffrTail ].bScanCode 		= bCode;
		cKYBDBuffer[ cBffrTail ].bValid  		= true;
		cFill++;
		cBffrTail++;
		
		cMakeTable[ bCode ].bMakeReceived 	= true;
		cMakeTable[ bCode ].wDuration 		= STARTING_DURATION;
	}
	
	set_ipl( old_ipl );
	
	if( SUPER_MODE != old_ssp )
		Super( old_ssp );
}
Пример #3
0
/*
	Function for updating the keyboard buffer and pushing back codes that haven't
	received a break code yet.
*/
void update_input_buffer( UINT8 bTimeElapsed )
{
	UINT8 bIndex = 0;
	int old_ssp = Super( 1 );
	int old_ipl;
	
	if( USER_MODE == old_ssp )
		old_ssp = Super( 0 );
	
	old_ipl = set_ipl( KEYBOARD_INTERRUPT_MASK );
	
	for( bIndex; bIndex < cHotKeyCount; bIndex++ )
	{
		if( cMakeTable[ bHotKeys[ bIndex ] ].bMakeReceived )
		{
			cMakeTable[ bHotKeys[ bIndex ] ].wDuration -= bTimeElapsed;
			
			if( cMakeTable[ bHotKeys[ bIndex ] ].wDuration == 0 || 
				cMakeTable[ bHotKeys[ bIndex ] ].wDuration > STARTING_DURATION )
			{
				add_key( bHotKeys[ bIndex ] );
				cMakeTable[ bHotKeys[ bIndex ] ].wDuration = SUBSEQUENT_DURATION;
			}
		}
	}
	
	set_ipl( old_ipl );
	
	if( SUPER_MODE != old_ssp )
		Super( old_ssp );
}
Пример #4
0
/*---------------------------------------------------*/
void* get_tabele()
{
long old_stack;
cookie *keks;

old_stack=Super(0L);	/* Cookie holen im Supervisormode */
keks =(cookie*)(*(long*)0x5a0);
while ((keks->value!='BLOW') && (keks->value!=0))
{
/*	char str[6];
	
	memcpy(str,&(keks->value),4);
	str[4]=0;
	printf("%s \n",str);*/ 
	keks++;
}
if (keks->value=='BLOW')
{
	char *adr;
	
/*	puts("BlowBoot found!");*/
	adr = (char*)keks->param;
	Super((void *) old_stack); 
	return adr;
}
Super((void *) old_stack); 
return 0L;
}
Пример #5
0
/* --------------------
	 | Get cookie value |
	 -------------------- */
int get_cookie(unsigned long cookie, unsigned long *value)
{
long old_stack;
long *jar;

old_stack=Super(0L);
jar = *((long **)0x5a0L);
Super((void *)old_stack);

if (!jar)
	return 0;

do
	{
	if (*jar == cookie)
		{
		if (value)
			*value=jar[1];

		return 1;
		}
	else
		jar= &(jar[2]);

	}while(*jar);

return 0;
}
Пример #6
0
void SDL_AtariXbios_InstallVectors(int vectors_mask)
{
	void *oldpile;

	/* Clear variables */
	SDL_AtariXbios_mouseb =
		SDL_AtariXbios_mousex =
		SDL_AtariXbios_mousey =
		SDL_AtariXbios_joystick =
		atari_prevmouseb = 0;

	if (vectors_mask==0) {
		SDL_AtariXbios_enabled=0;
		return;
	}

	/* Read IKBD vectors base */
	kbdvecs=Kbdvbase();

	/* Go to supervisor mode */
	oldpile=(void *)Super(0);

	/* Install our vectors */
	SDL_AtariXbios_Install(
		kbdvecs,
		(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
		(vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? SDL_AtariXbios_JoystickVector : NULL
	);

	/* Back to user mode */
	Super(oldpile);

	SDL_AtariXbios_enabled=1;
}
Пример #7
0
static void
MINTSTFA_LockDevice(_THIS)
{
    /* Stop replay */
    void *oldpile = (void *) Super(0);
    cookie_stfa->sound_enable = STFA_PLAY_DISABLE;
    Super(oldpile);
}
Пример #8
0
static void
MINTSTFA_UnlockDevice(_THIS)
{
    /* Restart replay */
    void *oldpile = (void *) Super(0);
    cookie_stfa->sound_enable = STFA_PLAY_ENABLE | STFA_PLAY_REPEAT;
    Super(oldpile);
}
Пример #9
0
long get_time( )
{
    int old_ssp = Super( 0 );
    long lClockTick = *cc_ClockPtr;

    Super( old_ssp );

    return lClockTick;
}
Пример #10
0
static void Mint_LockAudio(_THIS)
{
	void *oldpile;

	/* Stop replay */
	oldpile=(void *)Super(0);
	DMAAUDIO_IO.control=0;
	Super(oldpile);
}
Пример #11
0
long timer( void )
{
  void * ssp;
  long ret;
  ssp = (void *)Super( NULL );
  ret = *((long *)0x4BA);
  Super( ssp );
  return ret;
}
Пример #12
0
static void Mint_UnlockAudio(_THIS)
{
	void *oldpile;

	/* Restart replay */
	oldpile=(void *)Super(0);
	DMAAUDIO_IO.control=3;
	Super(oldpile);
}
Пример #13
0
/*
	Purpose: write a value to a register on the sound chip
	Input  : number of the register (0-15) and the value to write (maximum 12 bit)
	Returns: nothing
	Assume : nothing
*/
void write_psg(int reg, char val)
{
	long old_ssp = Super(0);
	if (reg < 16 && val < MAX_12_BIT)
	{
		*PSG_reg_select = reg;
		*PSG_reg_write = val;
	}
	Super(old_ssp);
}
Пример #14
0
/* Restitution de l'ancienne palette
*/
void RestPalette(void)
{   int *Old=OldPalette,*Hard=(int *)(0xFFFF8240);
    int n=16;
    long OldSSP=Super(NULL);
    
    while (n--) *Hard++=*Old++;
    *(char *)(0xFFFF8260)=OldRes;
    
    Super((void *)OldSSP);
}
Пример #15
0
/*
 * Get a long value after switching to supervisor mode
 */
long get_protected_l(long addr)
{
   long oldstack, v;

   oldstack = (long)Super(0L);
   v = *(long *)addr;
   Super((void *)oldstack);

   return v;
}
Пример #16
0
/* Initialisation de l'adresse vid‚o
*/
void SetScreenPtr(void *ad)
{   longchar t;
    long OldSSP=Super(NULL);

    t.p=ad;
    HIGPTR=t.c[1];
    MEDPTR=t.c[2];
    LOWPTR=t.c[3];
    Super((void *)OldSSP);
}
Пример #17
0
/*
 * Top level;
 * we get control from the desktop.
 *
 */
main()
{
    long *cookptr;	/* pointer to AHDI cookie */

    running = TRUE;
    appl_init();
    phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle = wind_create(WI_KIND, xdesk, ydesk, wdesk, hdesk);
  
    hidden = FALSE;
    butdown = TRUE;
  
    if (!rsrc_load(RESOURCEFILE)) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    graf_mouse(ARROW, 0L);
  
    /* display menu bar */
    if (getalladdr() == ERROR) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    ostack = Super(NULL);	/* Superuser mode for low memory access */
    pun = (int *)(*(long *)PUNPTR);
    Super(ostack);		/* back to User mode */

    if (!pun || !(*pun)) {	/* if no unit exists */
	err(noavdrv);		/* return error */
	goto punt;
    }

    cookptr = (long *)((char *)pun + 2 + 16 + 16*4);
    if (*cookptr != AHDI || cookptr != *(long *)(cookptr + 1))
	vernum = 0L;
    else
	vernum = (int *)(cookptr + 2);

    menu_bar(menubar, 1);	/* put up menu bar */
  
    while (running)
	domulti();
    
    menu_bar(menubar, 0);	/* erase menu bar */
  
punt:
    wind_delete(wi_handle);	/* close window on screen */
    v_clsvwk(handle);		/* close virtual workstation */
    appl_exit();		/* exit application HDX */
    Pterm(0);			/* terminate process */
}
Пример #18
0
void SDL_SYS_TimerQuit(void)
{
	/* Uninstall RunTimer vbl vector */
	if (timer_installed) {
		void *old_stack = (void *)Super(0);
		SDL_AtariVblUninstall(SDL_ThreadedTimerCheck);
		Super(old_stack);
		timer_installed = SDL_FALSE;
	}
	read_hz200_from_vbl = SDL_FALSE;
}
Пример #19
0
void SDL_StartTicks(void)
{
	void *oldpile;

	/* Set first ticks value */
	oldpile=(void *)Super(0);
	start=*((volatile long *)_hz_200);
	Super(oldpile);

	start *= 5;	/* One _hz_200 tic is 5ms */
}
Пример #20
0
/*
 * Read or set the word at FLIPLOC
 * set - flag to signify whether we are setting or reading the bit.
 *     - 1 means setting the word with the given value.
 *     - 0 means reading the word and returning the value.
 */
void
flip(int set, int *val)
{
	long ostack;		/* old stack value */
	
	ostack = Super(0L);
	if (set)
		*FLIPLOC = *val;
	else
		*val = *FLIPLOC;
	Super(ostack);
}
Пример #21
0
void nf_shutdown(void)
{
	long id;
	if(nf_ok && (id = nf_id("NF_SHUTDOWN"))) {
		void *sup = (void*)Super(0);
		/* needs to be called in supervisor mode */
		nf_call(id);
		Super(sup);
	} else {
		Cconws("NF_SHUTDOWN unavailable!\r\n");
	}
}
Пример #22
0
Vector install_vector(int num, Vector vector){
	Vector orig;
	Vector *vectp = (Vector *)((long)num << 2);
	long old_sp = Super(0);
	
	orig = *vectp;
	*vectp = vector;
	
	Super(old_sp);
	
	return orig;
}
Пример #23
0
/*
	Purpose: reads the value of the register you choose
	Input  : register to read from
	Returns: value at the register that was read
	Assume : nothing
*/
char read_psg(int reg)
{
	char psg;
	long old_ssp = Super(0);
	if (reg < 16)
	{
		*PSG_reg_select = reg;
		psg = *PSG_reg_write;
	}
	Super(old_ssp);
	return psg;
}
Пример #24
0
/*
    Purpose: get the current time on the clock
    Input  : nothing
    Returns: current clock time
    Assume : nothing
*/
long clockGet()
{
    long *timer = 0x462;
    long c_time;
    long old_ssp;

    old_ssp = Super(0);
    c_time = *timer;
    Super(old_ssp);

    return c_time;
}
Пример #25
0
void SDL_SYS_TimerQuit(void)
{
	void *oldpile;

	if (timer_installed) {
		/* Uninstall RunTimer vbl vector */
		oldpile=(void *)Super(0);
		SDL_AtariVblUninstall(RunTimer);
		Super(oldpile);
		timer_installed = SDL_FALSE;
	}
}
Пример #26
0
void laser()
{
	volatile char *PSG_reg_select = 0xFF8800;
	volatile char *PSG_reg_write  = 0xFF8802;

	long old_ssp = Super(0);
    /*figure out how to have two channels playing at the same time.
	  Can't make channel b stop playing static. Channel b got stuck on forever 
	  after this function was called. 
	*/
	Super(old_ssp);
}
Пример #27
0
/* Lecture de l'adresse vid‚o
*/
void *GetScreenPtr(void)
{   longchar t;
    long OldSSP=Super(NULL);

    t.l=0;
    t.c[1]=HIGPTR;
    t.c[2]=MEDPTR;
    t.c[3]=LOWPTR;
    
    Super((void *)OldSSP);
    return t.p;
} 
Пример #28
0
void stop_music()
{
	long old_ssp = Super(0);
	*PSG_reg_select = A_VOLUME;		/* set channel A volume = 8 */
	*PSG_reg_write  = 0;
	*PSG_reg_select = B_VOLUME;		/* set channel B volume = 8 */
	*PSG_reg_write  = 0;
	*PSG_reg_select = C_VOLUME;		/* set channel C volume = 8 */
	*PSG_reg_write  = 0;
	
	Super(old_ssp);
}
Пример #29
0
void force_mediach(const char *path)
{
	int drive, p = *path;

	if (   p == 0
	    || !(isalnum(p) && path[1] == ':')		/* HR 271102: alnum */
	   )
		return;

	drive =   isalpha(p)
	        ? tolower(p) - 'a'			/* HR 271102 */
	        : p - '0' + 'z' - 'a'  + 2;

#if _MINT_			/* HR 151102 */
	if (mint)
	{
		if (Dlock(1, drive) == 0)
			Dlock(0, drive);
	}
	else
#endif
	{
		void *stack;
		static char fname[] = "X:\\X";
		long r;

		stack = (void *)Super(0L);

		chdrv = drive;
		Oldrwabs = *((Func *)0x476L);
		Oldgetbpb = *((Func *)0x472L);
		Oldmediach = *((Func *)0x47eL);

		*((Func *)0x476L) = Newrwabs;
		*((Func *)0x472L) = Newgetbpb;
		*((Func *)0x47eL) = Newmediach;

		fname[0] = drive + 'A';
		r = Fopen(fname, 0);
		if (r >= 0)
			Fclose((int)r);

		if (*((Func *)0x476L) == Newrwabs)
		{
			*((Func *)0x472L) = Oldgetbpb;
			*((Func *)0x476L) = Oldrwabs;
			*((Func *)0x47eL) = Oldmediach;
		}

		Super(stack);
	}
}
Пример #30
0
LONG
unhook_xbra( WORD vecnum, LONG app_id )
{
    XBRA *rx;
    LONG vecadr, *stepadr, savessp, lret = 0L;

    vecadr = (LONG)Setexc( vecnum, VEC_INQUIRE );
    rx = (XBRA *)(vecadr - sizeof( XBRA ));

    if( (vecadr >= 0x00E00000 && vecadr <= 0x00EFFFFF)
	|| (vecadr >= 0x00FA0000 && vecadr <= 0x00FEFFFF) )
    {
	/* It's a ROM vector */
	return 0L;
    }

    /* Set supervisor mode for search just in case. */
    savessp = Super( SUP_SET );

    /* do we have an XBRA-structure? */
    if( rx->xbra_id != 'XBRA' )
    {
    	Super( savessp );
    	return 0L;
    }

    /* Special Case: Vector to remove is first in chain. */
    if( rx->xbra_id == 'XBRA' && rx->app_id == app_id )
    {
	Super( savessp );
        (void)Setexc( vecnum, rx->oldvec );
        return vecadr;
    }

    stepadr = (LONG *)&rx->oldvec;

    rx = (XBRA *)((LONG)rx->oldvec - sizeof( XBRA ));
    while( rx!=0 && rx->oldvec!=0 && rx->xbra_id == 'XBRA' )
    {
        if( rx->app_id == app_id )
        {
            *stepadr = lret = (LONG)rx->oldvec;
            break;
        }

        stepadr = (LONG *)&rx->oldvec;
        rx = (XBRA *)((LONG)rx->oldvec - sizeof( XBRA ));
    }

    Super( savessp );
    return lret;
}