Example #1
0
/*---------------------------------------------------------------------*

Name            keep - exits and remains resident

Usage           void keep(unsigned char status, unsigned size);

Prototype in    dos.h

Description     keep returns to MS-DOS with the exit status in
                status. The current program remains resident, however. The
                program is set to size paragraphs in length, and the
                remainder of the memory of the program is freed.

                keep can be used when installing a TSR program. keep uses DOS
                function 0x31.

Return value    None

*---------------------------------------------------------------------*/
void keep(unsigned char status, unsigned size)
{
        _restorezero();
        _DX = size;
        _AL = status;
        _AH = 0x31;
        geninterrupt(0x21);
}
Example #2
0
File: tsr.c Project: hirataya/tsr
/* tsr_stay
 * 
 * 解説: プログラムを常駐します
 * 宣言: BOOL tsr_stay(BYTE retcode, WORD idofs, const char *idstr, WORD size);
 * 引数: BYTE retcode --- プログラム終了コード
 *       WORD idofs --- 常駐id文字列の開始オフセット
 *       const char *idstr --- 常駐id文字列
 *       WORD size --- 常駐サイズ(パラグラフ単位)
 * 戻値: BOOL --- TRUE: (成功)  FALSE: 失敗
 * 備考: 常駐に成功するとプログラムに制御が戻ってこないので常にFALSEを返します
 *       idofs+strlen(idstr)<0xFFの条件をプログラマーの責任で満足させる必要
 *       があります
 *       内部で非公開ライブラリー関数_restorezeroを呼び出しています
 *       idofsの推奨値は0x0080または0x0081です
 */
BOOL tsr_stay(BYTE retcode, WORD idofs, const char *idstr, WORD size)
{
	_restorezero();
	
	if(tsr_is_stayed(idofs, idstr))
		return FALSE;
	
	_fstrcpy(MK_FP(_psp, idofs), idstr);
	
	dos_keep(retcode, size);
	
	return FALSE;
}