On Mon, 7 Sep 2009, Mary Robi wrote:

> Hello, sorry if this is obivious but:
>
> I programming a OS that uses FreeDOS as the bootloader and I want to know
> how to get kernel version.

Something like this.  (This is stripped down from one of my own programs.)

void ver (void)
{
  unsigned char osmajor, osminor, oemno, ushi;
  unsigned int uslo;

  regs.h.al=0;
  regs.h.ah=0x30;
  int86 (0x21, &regs, &regs);
  osmajor=regs.h.al;
  osminor=regs.h.ah;
  oemno=regs.h.bh;
  ushi=regs.h.bl;
  uslo=regs.x.cx;

  switch (oemno)
  {
   case 0:
    if (_osmajor < 4)
     printf ("\nPC-");
    else if ((_osmajor < 6) || ((osmajor==6) && (osminor < 30)))
     printf ("\nIBM ");
    else
     printf ("\nPC ");
    break;
   case 0xFF:
    printf ("\nMS-");
    break;
   case 0xFD:
    printf ("\nFreeDOS kernel %d.%d.%d\nB", regs.h.ch, uslo % 256,
            ushi);
    break;
   default: /* (say nothing) */
    printf ("\n");
  };

  printf ("DOS Version %2d.%02d\n", _osmajor, _osminor);
}

-uso.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to