|
Have you ever wondered what drive the last machine boot up was from? Here is a little routine in
Pascal, to show you how.
{ Display drive machine booted from }
{ Requires DOS 4.0 or higher }
program BootDrive;
{ Returns boot drive letter in ascii form }
function GetBootDrive : Char; Assembler;
asm
push bx
push es
mov ah,52h { get DOS list of lists }
int 21h
mov al,es:[bx+43h] { boot drive at offset 43h }
add al,64 { convert to letter }
pop es
pop bx
end;
{ Return major DOS version number }
function DosMajor : Byte; Assembler;
asm
mov ah,30h { get DOS version number }
int 21h
end;
begin
if DosMajor < 4 then
WriteLn('This util requires DOS 4 or greater.')
else
WriteLn('This machine booted from drive ', GetBootDrive, ':');
end.
This routine only works with DOS 4.0 and higher.
¥
|