{__$CALLING OLDFPCCALL}
Procedure Get_FreeDOS_version_string_asm(var s,o:word);assembler;
asm
{$IFDEF FPC}
   push esi
   push edi
   mov esi,s
   mov edi,o
   mov ax,33ffh
   mov dx,0
   int 21h
   mov [esi],dx
   mov [edi],ax
   pop edi
   pop esi
{$ELSE}
push si
push ds
mov ax,33ffh
mov dx,0
Tint 21h
lds si,s
mov [si],dx
lds si,o
mov [si],ax
pop ds
pop si
{$ENDIF}
end;


Function Get_FreeDOS_version_string:string;
var t:string;
    s,o:word;
    a,b:byte;
begin
Get_FreeDOS_version_string_asm(s,o);
t:='';
if s<>0 then
   for a:=0 to 254 do
       begin
       b:=Mem[s:o+a];
       if b=0 then break else
       if b>=32 then t:=t+char(b);
       end;
Get_FreeDOS_version_string:=t;
end;


begin
writeln(Get_freedos_version_string);
end.
