Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How to detect FreeDOS kernel from Turbo Pascal program? (Developers)

posted by rosegondon, C:\DOS, 15.01.2022, 16:20
(edited by rosegondon on 15.01.2022, 16:39)

> > I am looking for a method of detection of running FreeDOS kernel
>
> set ax=0x3000 and call int 0x21, check whether the returned bh is 0xfd.
>
> if yes, set ax=0x33ff and call int 0x21, it returns a pointer dx:ax to a
> version string.
>
> how to express this in the programming language of your choice is up to
> you, please share an example implementation code snippet here :-)

Success! It works even when FreeCOM is not used at all.

Uses Dos;

Function IsFreeDos : Boolean;
        VAR Regs : Registers;
        begin
           With Regs do
              begin
                 ax := $3000;
                 bx := $00;
              end;
           Intr ($21, Regs);
           if Regs.bh = $FD then IsFreeDOS := TRUE else IsFreeDOS := FALSE
        end;


Begin
WriteLn(IsFreeDos);
End.

---
echo g=ffff:0|debug>nul

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 253 users online (0 registered, 253 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum