1. Extended memory size

I am still trying to figure out how to get the Extended Memory Size.
A couple of people sent me code to compute *Expanded* Memory Size;
but I really need *Extended*.

My (old) DOS book says I should use interrupt 15 function 88.  That
always returns a zero.  I was wondering, Robert, if sometime when
you are talking to the Causeway Guy you could ask him if Causeway
is responsible for returning the zero; if so is there a way around
it.

To get my installer to work I have used the external DOS MEM
command and parsed the output.  That is a miserable solution
as the output of the MEM command changes in major ways from one
DOS release to another, the output changes in minor (but crippling)
ways from one DOS sub-release to another (someone forgot to
insert commas in the output in a subrelease of DOS 6 - I had to
make a revision to my installer after we discovered that, unfortunately
we had already cut 4,000 disks).

Thanks for the help

John Kinne

new topic     » topic index » view message » categorize

2. Re: Extended memory size

John Kinne wrote
>I am still trying to figure out how to get the Extended Memory Size.
>A couple of people sent me code to compute *Expanded* Memory Size;
>but I really need *Extended*.

You can read this information from CMOS memory. I paste here a demo
program to read
some informations from CMOS RAM.

******************       CmosInfo.ex *******************
--   Get some information about the computer from cmos ram
--   by Jacques Deschenes, Baie-Comeau, PQ. Canada

include machine.e

function Hex(integer i)
-- convert integer number to hexadecimal.
sequence HexDigit,HexStr
    HexDigit = "0123456789ABCDEF"
    HexStr = {}
    while i > 0 do
      HexStr=HexDigit[remainder(i,16)+1] & HexStr
      i = floor(i/16)
    end while
    if length(HexStr)=0  then
        return "#0"
    end if
    return '#' & HexStr
end function -- Hex()


sequence code

code = { -- binaray code to
#50,#53,        -- PUSH AX, PUSH BX
#BB,0,0,0,0,    -- MOV EBX, 0   -- poke here a pointer to result storage
#B0,#0,         -- MOV AL, 0    -- poke here register to read
#E6,#70,        -- OUT #70, AL   cmos register to be read
#E4,#71,        -- IN  AL, #71   read cmos data byte
#88,#03,        -- MOV [EBX], AL  store data byte at end of code segment
#5B,#58,#C3,    -- POP BX,  POP AX, RET  -- restore ax and bx and quit
#0}             -- DB ?  end of code where cmos byte read will be
stored.

atom AsmFct
AsmFct = allocate(length(code))
poke(AsmFct,code)

function ReadCmosRegister(integer Register)
    poke(AsmFct+8,Register)
    call(AsmFct)
    return  peek(AsmFct+length(code)-1)
end function -- ReadCmosRegister()

function HardDisk()
  integer C,D
  C = ReadCmosRegister(#19)
  D = ReadCmosRegister(#1A)
  return {C,D}
end function -- HardDisk()

function Floppies()
sequence FloppyType
integer FlopInfo
   FloppyType={"not installed","5.25\" 320KB","5.25\" 1.2MB","3.5\"
720KB","3.5\" 1.44MB"}
   FlopInfo = ReadCmosRegister(#10)
   return {FloppyType[floor(FlopInfo/16)+1],
            FloppyType[remainder(FlopInfo,16)+1]}
end function -- Floppies()

function GetConfig()
-- Read cmos register #14 to knowns configuration
-- it specify number of floppies, type of video adapter, coprocessor
-- return sequence {NbFloppies,Video, MathProc}
integer ConfigByte , NbFloppies,Video  sequence VideoAdapt
    VideoAdapt={"Unknown, possibly VGA","40x25 CGA",
                "80x25 CGA","MDA (MonoChrome)"}
    ConfigByte=ReadCmosRegister(#14)
    NbFloppies = floor(ConfigByte/64)+1
    ConfigByte = remainder(ConfigByte,64)
    Video = floor(ConfigByte/16)+1
    ConfigByte = floor(ConfigByte/2)
    return{NbFloppies,VideoAdapt[Video],remainder(ConfigByte,2)}
end function -- GetConfig()

clear_screen()
printf(1,"-------- INFORMATION READ FROM CMOS RAM -----------\n",{})
printf(1,"Memory\nbase memory size: %d Kbytes\n",{
       ReadCmosRegister(#15)+ReadCmosRegister(#16)*256})

printf(1,"Extended memory size: %d KBytes\n", {
       ReadCmosRegister(#30)+ReadCmosRegister(#31)*256})

sequence config
config = GetConfig()

printf(1,"\n%d floppies installed\n",config[1])
printf(1,"\nFloppies\nA: %s\nB:%s\n",Floppies())

printf(1,"\nHard disk type\nC:%d\nD:%d\n",HardDisk())

printf(1,"\nVideo adapter: %s\n",{config[2]})

if config[3] then
    printf(1,"\nMath co-processor installed.",{})
  else
    printf(1,"No math co-processor installed.",{})
end if
printf(1,"\n",{})

free(AsmFct)


********************************************************************************
Jacques Deschenes

new topic     » goto parent     » topic index » view message » categorize

3. Re: Extended memory size

Jacques Deschjnes

Thank You for the excellent code to detect Extended Memory Size.
It is beautiful!  I did not know that CMOS registers existed;
now I have searched the internet for more info on them & not yet
found anything.  I'd like to know what else they can tell me.

Thanks for the help

John Kinne

new topic     » goto parent     » topic index » view message » categorize

4. Re: Extended memory size

John Kinne writes:

> Jacques Deschjnes
> Thank You for the excellent code to detect Extended Memory Size.

I tried Jacques code on two machines here and it gave correct information
for extended memory size, floppies etc. The machines were:
   486 running either DOS 6.2 or win3.1 DOS box, 8 Mb RAM and 2 floppies
   Pentium running Win 95 (or restarted in DOS mode), 32 Mb RAM and 1 floppy

Rob Craig
Rapid Deployment Software

new topic     » goto parent     » topic index » view message » categorize

5. Re: Extended memory size

I have also tried Jacques' code on a couple of machines & found
it to work.  I assume the machine code is required b/c of the

    #E6,#70,        -- OUT #70, AL   cmos register to be read
    #E4,#71,        -- IN  AL, #71   read cmos data byte

instructions and that these can not be completed directly from
Euphoria.

Jacques, thanks again.

John Kinne

new topic     » goto parent     » topic index » view message » categorize

6. Re: Extended memory size

Hi John,

  the binary code is essential because, there is no input and output
to hardware port in euphoria. I wish there will be in next version.
for the moment one have to code it in binary (see ports.e, I posted a
few days ago. it give access to all hardware ports.)

about CMOS RAM:
CMOS RAM is a small memory (128 bytes) wich keep all bios setup
information. In fact it is in the real time clock chip and kept alive by
a rechargable ni-cad batterie.

There is much more information in that cmos than cmosdemo show.
From there you can get the spec of each installed hardisk (cylender,
head,sector)
You can read time and date too.

the information I got is from the following source.

              CMOS Memory Map v1.21 January, 1994

Compiled from multiple sources by Padgett Peterson
Corrections/additions/comments to: padgett at tccslr.dnet.mmc.com


Jacques Deschenes

new topic     » goto parent     » topic index » view message » categorize

7. Re: Extended memory size

Jacques,

Thanks again.  I found a CMOS Memory Map at

   http://www.brl.ntt.jp/people/takehiko/interrupt/CMOS.LST.txt

From a quick inspection, your program grabs alot of the
most interesting information.

I have done quite a bit of systems type programming on
mainframes, and just a tiny bit on PCs.  I don't have the
resources for the PC that I am used to.  I bet its all on
the web if I just know the right questions to ask.

John Kinne

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu