[comp.sys.ibm.pc.hardware] hard 80386 questions

grossman@star-trek.bbn.com (Martin Grossman) (03/29/91)

On my 80386 (DX) I have 4 MB ram mem.  I assume its physicaly addressed
startin at 0 (ie 00000000:0000 ).

Theirs also some RAM chips (10 of them) for the cache and shaddow ram.

Their are 2 rom area that nortons SI tells me about in the whole system.
One is on the SVGA board and its address is at C000:0 L 8000 (ie 32K)
The other is on the system board (AMI bios) and is addressed at
F000:0000 L FFFF (ie 64K).


1) Where are those roms within the 80386 address space?  I know it can't
   be within the first 4MB since youd have memory conflicts.

2) When I run the extended CMOS setup and turn off shaddow ram then I can
   tell the system runs slowwer,  BUT after I turn it back on, I go into
   debug and that mem C000:0L8000 and F000:0LFFFF still looks like ROM
   (ie I use the 'e' command to change unused words but the original
   values are still their when I dump it)  (ie It looks like when
   shadow is enabled it copies the rom to fast ram, maps the ram in
   as the rom addresses but disables write accessing...is this right)

3) When I run a TSR that came with the SVGA that copies the VGA ROM
   (I've compared it byte for byte) into low ram (ie within the TSR)
   then video accesses are even faster that using shadow ram.  Why is
   this.  I assumed that shadow ram was some of that (10 chips fast
   ram used also for cache)

4) When cache/shadowram/etc..etc are all turned off SI gives and index
   of 39.9 (this is a 33MHZ system).....when cache.etc.etc are all turned
   on then SI reports 52.3......I don't remember the actual numbers
   but landmarks cpuspeed program show a high improvment BUT only when I
   switch (turbo) to lower 16MHZ setting (cpuspeed bombs out when run
   in high speed mode)


PS does anyone know where I can get ahold of (ANY) source code (assembler)
   of any 80386 BIOS (even one for a different system).  I want to use
   this (in congunction with reading the 80386 hardware manuals) to learn
   all about paging/segments/linear addressing/vitual 8086 mode/protected
   mode etc etc etc


						Please send via email
						grossman@bbn.com

onyx@loligo (Jeff Phillips) (03/29/91)

In article <5468@archive.BBN.COM> grossman@star-trek.bbn.com (Martin Grossman) writes:

>On my 80386 (DX) I have 4 MB ram mem.  I assume its physicaly addressed
>startin at 0 (ie 00000000:0000 ).

This is a proper assumption.

>Theirs also some RAM chips (10 of them) for the cache and shaddow ram.

The chips on the mainboard that you are speaking of are strictly Cache.  See
below for my description of Shadow RAM...

>Their are 2 rom area that nortons SI tells me about in the whole system.
>One is on the SVGA board and its address is at C000:0 L 8000 (ie 32K)
>The other is on the system board (AMI bios) and is addressed at
>F000:0000 L FFFF (ie 64K).
>
>
>1) Where are those roms within the 80386 address space?  I know it can't
>   be within the first 4MB since youd have memory conflicts.

They are located at the absolute addresses C000:0000 and F000:0000, which on
286 or better machines, is converted to a 20 bit segment and a 16 bit offset,
or 0C000:0000 and 0F000:0000.

>2) When I run the extended CMOS setup and turn off shaddow ram then I can
>   tell the system runs slowwer,  BUT after I turn it back on, I go into
>   debug and that mem C000:0L8000 and F000:0LFFFF still looks like ROM
>   (ie I use the 'e' command to change unused words but the original
>   values are still their when I dump it)  (ie It looks like when
>   shadow is enabled it copies the rom to fast ram, maps the ram in
>   as the rom addresses but disables write accessing...is this right)

This is much closer to the point... I will summarize at the bottom of this
followup...

>3) When I run a TSR that came with the SVGA that copies the VGA ROM
>   (I've compared it byte for byte) into low ram (ie within the TSR)
>   then video accesses are even faster that using shadow ram.  Why is
>   this.  I assumed that shadow ram was some of that (10 chips fast
>   ram used also for cache)
>
>4) When cache/shadowram/etc..etc are all turned off SI gives and index
>   of 39.9 (this is a 33MHZ system).....when cache.etc.etc are all turned
>   on then SI reports 52.3......I don't remember the actual numbers
>   but landmarks cpuspeed program show a high improvment BUT only when I
>   switch (turbo) to lower 16MHZ setting (cpuspeed bombs out when run
>   in high speed mode)
>
>PS does anyone know where I can get ahold of (ANY) source code (assembler)
>   of any 80386 BIOS (even one for a different system).  I want to use
>   this (in congunction with reading the 80386 hardware manuals) to learn
>   all about paging/segments/linear addressing/vitual 8086 mode/protected
>   mode etc etc etc

I am posting this reply in the newsgroup because I think it might help a few
more people understand the concepts of cache/shadow, etc...

The earliest computers in the IBM PC line were designed to address 1 megabyte 
of memory, specifically, a 20-bit address containing a 16 bit offset and a
16 bit segment, or "paragraph" number.  When an address is posted like
B800:0000, it can be converted in the following way to a simple hex absolute 
offset:
  0000 (offset)
+B800  (segment)
------
 B8000 (absolute address)

The area between 640k and one megabyte, however, was strictly reserved for the
computer's ROM, BIOS, and other critical operation memory, such as Video. When
the 286 came out, the addressable RAM jumped from 1 meg to 16 meg, having
added another hex digit to the address, making the total a 24-bit address.

Since people expanding their memory to 1 megabyte STILL couldn't use the RAM
between 640 and 1024k (384k of dead space), motherboards started to take ad-
vantage of this by using the "unusable" RAM to reflect the contents of ROM,
which are NOTICEABLE slower for this reason: RAM has 0-1 wait states, if the
proper chips are put in... ROM has 3-4!  Therefore, the ROM is copied into the
faster RAM at boot-up, and the RAM is made to emulate the ROM in write-protect
and addressing.

Therefore, the term SHADOW ram, is RAM in this "dead space" that is reallocated
to take the place of system ROMs and BIOS.  Current development on the 286/386
allows programs like QEMM by Quarterdeck to reassign the address of all remain-
ing memory in this area (Shadow only takes up 128k) for program use.

Cache memory, however, is a bank of *FAST* RAM chips, usually 20-25 nanoseconds,
(normal RAM is 60-80 at best) into which current RAM contents are copied, very
similar to a disk cache: when a new area of memory is requested, cache contents
are flushed back into the RAM from which it was taken, modifications included,
and the new area is read into the Cache.  From that point on, all memory read/
write is performed on the cache, making memory I/O much faster, and speeding
up the operation of the computer substantially.  The reason computers aren't
built with 20-25 nanosecond RAMs to begin with is simply cost and size... It
would be quite a feat to fit even 2 megabytes of fast DRAMs onto a babysize
motherboard!

So this is the how and why of your system... any questions? (grin)

As for 386 BIOS, the BIOS isn't what you need the code for, since only some
BIOSes have page-swapping etc... (this is handled by the software)
There are several 80386 assembly language books on the market, you might drop
into a bookstore sometime and look at the 80386 Microprocessor Handbook 
(Publisher: Osborne McGraw-Hill, Authors: Pappas & Murray) as well as the other
titles out there... I have found most of Osborne/MH books to be very good in 
these areas as well as high-mid level programming languages.

Good Luck!


=----------------------------------------------------------=
= Jeff Phillips    onyx@loligo.cc.fsu.edu                  =
=                  jeff!phillips@f100.n3605.z1.fidonet.org =
=----------------------------------------------------------=   

feg@moss.ATT.COM (Forrest Gehrke,2C-119,7239,ATTBL) (03/30/91)

In article <1991Mar29.091522.18681@mailer.cc.fsu.edu> you write:
>  [concerning bios address]
>They are located at the absolute addresses C000:0000 and F000:0000, which on
>286 or better machines, is converted to a 20 bit segment and a 16 bit offset,
>or 0C000:0000 and 0F000:0000.
>
>Since people expanding their memory to 1 megabyte STILL couldn't use the RAM
>between 640 and 1024k (384k of dead space), motherboards started to take ad-
>vantage of this by using the "unusable" RAM to reflect the contents of ROM,
>which are NOTICEABLE slower for this reason: RAM has 0-1 wait states, if the
>proper chips are put in... ROM has 3-4!  Therefore, the ROM is copied into the
>faster RAM at boot-up, and the RAM is made to emulate the ROM in write-protect
>and addressing.
>
>Therefore, the term SHADOW ram, is RAM in this "dead space" that is reallocated
>to take the place of system ROMs and BIOS.  Current development on the 286/386
>allows programs like QEMM by Quarterdeck to reassign the address of all remain-
>ing memory in this area (Shadow only takes up 128k) for program use.
>
Reassign where?

I am not sure--but your explanation sounds as though shadow ram is still
in the 384k upper memory.  But so is the ROM bios.  When using shadow ram,
is the address range of the bios still the same as the ROM?  How is
this address substitution trick accomplished?

You did not answer another question of the original poster which also
puzzles me: I happen to have a Micronics ascic motherboard and supplied
with it is their software called SETSYS.  With this I can set three
different bus speeds as well as turn on shadow ram of the bios.
Software tests with shadow ram show significantly higher write speed
to the screen.  However, with my Diamond controller of the 
non-interlaced monitor is supplied software called FASTBIOS.  The
manual explains that this is the same as shadow ram.  However,
tests show that crt write speed is nearly double the rate of
the SETSYS shadow ram bios.  Obviously, something is different and I
am wondering if somewhow the memory cache (I have 64kb of sram)
is now getting into the act?  But, this raises the question
why the SETSYS shadow ram doesn't.

BTW, in spite of all this speedup of write speed, I don't see 
this in real life with real programs.  Is this because most
programs are writing directly to the screen and not through
bios?  Also, can you name any popular applications which do
not write directly?  What about Windows?

Thanks for your time.

Forrest Gehrke feg@dodger.att.com

smsmith@hpuxa.acs.ohio-state.edu (Stephen M. Smith) (03/30/91)

feg@moss.ATT.COM (Forrest Gehrke) writes:
>
>You did not answer another question of the original poster which also
>puzzles me: I happen to have a Micronics ascic motherboard and supplied
>with it is their software called SETSYS.  With this I can set three
>different bus speeds as well as turn on shadow ram of the bios.
>Software tests with shadow ram show significantly higher write speed
>to the screen.  However, with my Diamond controller of the 
>non-interlaced monitor is supplied software called FASTBIOS.  The
>manual explains that this is the same as shadow ram.  However,
>tests show that crt write speed is nearly double the rate of
>the SETSYS shadow ram bios.  Obviously, something is different and I
>am wondering if somewhow the memory cache (I have 64kb of sram)
>is now getting into the act?  But, this raises the question
>why the SETSYS shadow ram doesn't.

I have the Micronics ASIC board too.  I'm posting this because if
there are any Micronics users out there I want to spare them some
headaches, especially if they are using SETSYS!!!  Please note
that I have the 386-33 MB, though I think all the 386 Micronics
motherboards have the same dip switch settings and SETSYS ustilities
(I suspect this to be the case because my MB manual is for all
the ASIC boards;  ASIC, BTW, simply means it has memory cache.)

First of all, when switch 4 is enabled, the system BIOS is shadowed
to F000-FFFF and the video BIOS is shadowed to C000-C800.  This
is the way most clones do it.  BUT, the motherboard manual when
talking about BIOS shadowing refers to 128k of ROM that is used
in the shadowing process.  THIS IS WRONG.  Only 64k gets shadowed.
This is important, because if you use an EMM like QEMM which puts
the 64k page frame at D000-DFFF, SETSYS will show "PAGE FRAME"
in its setup screen under SHADOW BIOS instead of saying "ENABLED",
and it will give a warning message saying something like "page
frame address cannot be in D000 segment; check your EMM manual
to switch the address of the page frame."

The solution is to move the page frame to C800-CFFF.  This makes
SETSYS happy, and you can then turn cache on and off, set the system
speed up or down, and turn the BIOS shadowing on and off with SETSYS
without any problems.

Another warning about SETSYS--I called my computer company, and they
said that Micronics discontinued using SETSYS because it had some
problems.  Instead of using SETSYS, the latest version of the BIOS
(Phoenix version M11) uses a hotkey combination on the keyboard to
disable/enable the memory cache, and to set the system speed up or
down.  Here's the combinations:

CTRL-ALT-ESC: enter CMOS setup
CTRL-ALT-minus sign (numeric keypad): lower system speed (turbo button
                                      needs to be OUT to do this)
CTRL-ALT-plus sign (numeric keypad): system speed set to fast
CTRL-ALT-SHFT-minus sign (numeric keypad): disable memory cache
CTRL-ALT-SHFT-plus sign (numeric keybad): enable memory cache

WARNING: These hotkey combinations do NOT work when an extended
memory manager like QEMM is in use!!!  (You don't know how many
hours I spent on the phone with Micronics and with my computer
company trying to figure all this out!)  Since these hotkeys don't
work with QEMM loaded, what I have to do is use SETSYS which works
fine--just as long as I have my HARDWARE doing the shadowing
(switch 4 enabled, in other words), instead of using the ROM 
parameter in QEMM.  Also, I have to put the parameters FR=C800
to move the page frame, and NRH so that the entire 64k of ROM
is untouched (otherwise QEMM blows it by using 16k for itself--
this also caused me problems!).

Now, as to your observations about various video speeds with
different configurations:

I too have noticed this.  The video shadowing file that came with
my Orchid II is called SPEED_UP.SYS.  When I load this file in
my config.sys file without QEMM loaded (hence, in low memory)
I get TWICE THE SPEED THAT I OTHERWISE GET!!!  And if I disable
my memory cache the speed is reduced to HALF of what it used to
be.  Here's a summary of different configurations:

QEMM loaded, hardware shadowing, cache on: ~15,000 CPS
QEMM loaded, hardware shadowing, cache off: ~8,000 CPS
QEMM loaded, hardware shadowing, SPEED_UP.SYS loaded high: ~19,000 CPS
QEMM loaded, hardware shadowing, SPEED_UP.SYS loaded low: ~19,000 CPS
QEMM not loaded, hardware shadowing, SPEED_UP.SYS loaded: ~32,000 CPS

I know it sounds redundant to have hardware shadowing on, and THEN
to load SPEED_UP.SYS on top of that, but it's kind of hard to
switch motherboard switches...  and anyway, I've tried ALL
configurations--both with the hardware shadowing on and with it off.
And yes... I've tried using QEMM's ROM parameter to shadow the
BIOS, and I still can't get more than ~19,000 CPS.

In summary: I can't get the video speed I would like with QEMM loaded.
When Microsoft's HIMEM.SYS is loaded I CAN get the amazing 32,000 CPS,
but only when SPEED_UP.SYS is loaded low.

So what's going on here? 


>Forrest Gehrke feg@dodger.att.com

Stephen M. Smith  \  +  /
<smsmith@hpuxa.   \+++++/    " #*&<-[89s]*(k#$@-_=//a2$]'+=.(2_&*%>,,@
 ircc.ohio-state. \  +  /      {7%*@,..":27g)-=,#*:.#,/6&1*.4-,l@#9:-)  "
 edu>             \  +  / 
 BTW, WYSInaWYG   \  +  /                              --witty.saying.ARC

phil@brahms.amd.com (Phil Ngai) (03/30/91)

In article <1991Mar29.182908.14124@cbnewsl.att.com> feg@moss.ATT.COM (Forrest Gehrke) writes:
|I am not sure--but your explanation sounds as though shadow ram is still
|in the 384k upper memory.  But so is the ROM bios.  When using shadow ram,
|is the address range of the bios still the same as the ROM?  How is
|this address substitution trick accomplished?

Simply put, there are (at least) two address spaces: the processor's
address space and the memory address space. In between the two is the
hardware which can do almost any mapping that can be thought of.
Logically, many motherboards map the first 640K straight through.  The
next 384K of the processor address space goes to ROM BIOS type things.
If shadow RAM is enabled, portions of that 384K are mapped to RAM
instead of ROM. The size of these portions are probably in the 4-16K
range.

If you do not have shadow RAM turned on, some motherboards will remap
the 384K of RAM up beyond the 1 meg boundary in the processor address
space. More and more motherboards simply waste the RAM if you don't
enable shadow RAM as the delay involed in the mapping process can make
it difficult to avoid wait states.

|tests show that crt write speed is nearly double the rate of
|the SETSYS shadow ram bios.  Obviously, something is different and I
|am wondering if somewhow the memory cache (I have 64kb of sram)
|is now getting into the act?  But, this raises the question
|why the SETSYS shadow ram doesn't.

I don't know why but I don't think the cache has anything to do with it.

|BTW, in spite of all this speedup of write speed, I don't see 
|this in real life with real programs.  Is this because most
|programs are writing directly to the screen and not through

Yes.

|bios?  Also, can you name any popular applications which do
|not write directly?  What about Windows?

Windows in particular likes to go straight to the hardware.

--
Gun control is elitist.

smsmith@hpuxa.acs.ohio-state.edu (Stephen M. Smith) (03/31/91)

I made a mistake in my previous posting:

(this concerns Micronics ASIC 386 motherboards)

>First of all, when switch 4 is enabled, the system BIOS is shadowed
>to F000-FFFF and the video BIOS is shadowed to C000-C800.  This
>is the way most clones do it.  BUT, the motherboard manual when
>talking about BIOS shadowing refers to 128k of ROM that is used
>in the shadowing process.  THIS IS WRONG.  Only 64k gets shadowed.
>This is important, because if you use an EMM like QEMM which puts
>the 64k page frame at D000-DFFF, SETSYS will show "PAGE FRAME"
                       ^^^^^^^^^
I meant to say E000-EFFF.

>in its setup screen under SHADOW BIOS instead of saying "ENABLED",
>and it will give a warning message saying something like "page
>frame address cannot be in D000 segment; check your EMM manual
                            ^^^^
I meant to say E000.

>to switch the address of the page frame."
>
>The solution is to move the page frame to C800-CFFF.  This makes...
                                           ^^^^^^^^^
I meant to say C800-D7FF.  Obviously, you need the full 64k for
a page frame, and C800-CFFF is only 32k.  I use C800-D7FF for my
page frame instead of D000-DFFF because it makes D800-EFFF
to be a 96k area of contiguous high ram available to QEMM for
other things.  Desqview, for example, can load itself into this
area with no (apparent) conflicts with SETSYS.

>...SETSYS happy, and you can then turn cache on and off, set the system
>speed up or down, and turn the BIOS shadowing on and off with SETSYS
>without any problems.

Sorry for these mistakes!

SS