/******
 *
 *	M T A S K . C                by Jan Ceuleers, the Experimenter Board, 1992
 *	                                           part of the ISDN FOSSIL project
 *
 *	This module implements rudimentary multitasker support. Only DesqView is
 *	currently supported.
 *
 ******/

#include "fos_isdn.h"

int multitaskerInstalled()
{
	_asm
	{
		mov  ax,2b01h
		mov  cx,4445h
		mov  dx,5351h
		int  21h
		cmp  al,0ffh
		je   noDV
		mov  ax,1
		jmp  done
	noDV:
		mov  ax,0
	done:
	}
}

void beginCriticalSection()
{
	if (multitaskerInstalled())
	{
		_asm
		{
			mov  ax,0de1ch
			int  15h
		}
	}
}

void endCriticalSection()
{
	if (multitaskerInstalled())
	{
		_asm
		{
			mov  ax,0de1bh
			int  15h
		}
	}
}

void releaseTimeSlice()
{
	if (multitaskerInstalled())
	{
		_asm
		{
			mov  ax,1000h
			int  15h
		}
	}
	else
	{
		_asm sti
	}
}
