{ LASTDRV.PAS -- uses only documented DOS }
{ Turbo Pascal: tpc lastdrv }

program LastDrv;
uses dos;
var
    r : Registers;
    lastdrive : Word;

begin
    with r do begin
        ah := $19;          { Get Current Disk }
        MsDos(r);
        dl := al;
        ah := $0E;          { Select Disk }
        MsDos(r);
        lastdrive := al;
    end;
    Writeln('LASTDRIVE=', Chr(Ord('A') - 1 + lastdrive));
    Halt(lastdrive);
end.
