HDWCFG


HDWCFG , BIOS. , :

HDWCFG (C)A. Frolov, 1997

Configuration word: C823

HDD present

NPU present

RAM banks: 0

Video Mode: 2

Nubber of FDD: 1

Nubber of COM ports: 2

Number of LPT ports: 3

RAM istalled: 640 Kbytes

Extended RAM istalled: 0

HDWCFG 1.1.



1.1. hdwcfg\hdwcfg.c

// =====================================================

//

// BIOS

//

// (C) ., 1997

//

// E-mail: frolov@glas.apc.org

// WWW: http://www.glasnet.ru/~frolov

//

// http://www.dials.ccas.ru/frolov

// =====================================================

#include <stdio.h>

#include <conio.h>

#include <memory.h>

#include <dos.h>

//

typedef struct _HDWCFG

{

unsigned HddPresent: 1; // 0

unsigned NpuPresent: 1; // 1

unsigned AmountOfRAM: 2; // 2-3

unsigned VideoMode: 2; // 4-5

unsigned NumberOfFdd: 2; // 6-7

unsigned DmaPresent: 1; // 8

unsigned NumberOfCom: 3; // 9-11

unsigned GamePresent: 1; // 12

unsigned JrComPresent: 1; // 13

unsigned NumberOfLpt: 2; // 14-15

} HDWCFG;

int main(void)

{

union REGS rg;

HDWCFG HdwCfg;

unsigned uword;

printf("\nHDWCFG (C)A. Frolov, 1997");

// INT 11h

//

rg.h.ah = 0x0;

int86(0x11, &rg, &rg);

//

// HdwCfg

uword = (unsigned int)rg.x.ax;

memcpy(&HdwCfg, &uword, 2);

//

printf("\n\nConfiguration word: %04.4X", HdwCfg);

if(HdwCfg.HddPresent)


printf("\nHDD present");

if(HdwCfg.NpuPresent)

printf("\nNPU present");

printf("\nRAM banks: %d", HdwCfg.AmountOfRAM);

printf("\nVideo Mode: %d", HdwCfg.VideoMode);

printf("\nNubber of FDD: %d", HdwCfg.NumberOfFdd + 1);



if(HdwCfg.DmaPresent)

printf("\nDMA present");

printf("\nNubber of COM ports: %d", HdwCfg.NumberOfCom);



if(HdwCfg.GamePresent)

printf("\nGame adapter present");

if(HdwCfg.JrComPresent)

printf("\nPCjr Com present");

printf("\nNumber of LPT ports: %d", HdwCfg.NumberOfLpt);

// INT 12h

//

rg.h.ah = 0x0;

int86(0x12, &rg, &rg);

//

printf("\nRAM istalled: %d Kbytes",

(unsigned int)rg.x.ax);

// ,

// INT 15h

rg.h.ah = 0x88;

int86(0x15, &rg, &rg);

//

printf("\nExtended RAM istalled: %ld Kbytes",

(unsigned int)rg.x.ax);

getch();

return 0;

}