Application Examples
{-----------------------------------------------}
{ The upper four bits of AH are the integer
}
{ portion of the version number, the lower four }
{ bits are the fractional portion.
Convert the }
{ integer value to ASCII by adding 48.
}
{-----------------------------------------------}
Integer_Part
:= Char (AL shr 4
+ 48);
Fractional_Part := Char (AL and $F + 48);
Version_String
:= Intege ’.’ +
Fractional_Part;
end; { If AH=STATUS_OK}
{---------------------------------------------------}
{ Unload the pseudo-registers after invoking EMM.
}
{
AH = status
}
{---------------------------------------------------}
Get_Version_Number := AH;
end; { with Regs do }
end; { Function Get_Version_Number }
{-----------------------------------------------------------}
{ This procedure prints an error message passed by the
}
{ caller, prints the error code passed by the caller in
}
{ hex, and then terminates the program with an error
}
{ level of 1.
}
{-----------------------------------------------------------}
Procedure Error (Error_Message: ST80; Error_Number: Integer);
Begin
Writeln (Error_Message);
Writeln (’
Error_Number = ’,Hex_String (Error_Number));
Writeln (’EMM test program aborting.’);
Halt (1);
end; { Procedure Error_Message}
{-------------------------------------------------------------}
{ This program is an example of the basic EMM functions that
}
{ you need in order to use EMM memory with Turbo Pascal.
}
{-------------------------------------------------------------}
Begin
Clrscr;
Window (5,2,77,22);
{-----------------------------------------------------------}
{ Determine if the Expanded Memory Manager is installed; if }
{ not, then terminate ’main’ with an error level code of 1. }
{-----------------------------------------------------------}
If not (Emm_Installed) then
Begin
Writeln (’The LIM EMM is not installed.’);
Halt (1);
end
else
Begin
{ Get the version number and display it}
Error_Code := Get_Version_Number (Version_Number);
If Error_Code <> STATUS_OK then
Error (’Error getting EMM version number ’, Error_code)
else
Writeln (’LIM Expanded Memory Manager, version ’,
Version_Number,’ is ready for use.’);
end;
Writeln;
4-18
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com