[comp.os.msdos.programmer] 386 and EGA-card

sverrehu@ifi.uio.no (Sverre H Huseby) (01/07/91)

I have tried clearing the EGA graphics screen (mode 10h)
in the following two ways:

    8086:
      xor ax, ax
      mov cx, NUM_BYTES / 2
      rep stosw

    80386:
      xor eax, eax
      mov cx, NUM_BYTES / 4
      rep stosd

The 386-routine takes almost the same amount of time as
does the 8086-routine.

Why???





Sverre.

----------------------------------------
Sverre H. Huseby   (sverrehu@ifi.uio.no)
Student   -   University of Oslo, Norway

c37189h@saha.hut.fi (Harri "Haba" Suomalainen) (01/08/91)

sverrehu@ifi.uio.no (Sverre H Huseby) writes:
>I have tried clearing the EGA graphics screen (mode 10h)
>in the following two ways:
>    8086:
>      xor ax, ax
>      mov cx, NUM_BYTES / 2
>      rep stosw
>    80386:
>      xor eax, eax
>      mov cx, NUM_BYTES / 4
>      rep stosd
>
>The 386-routine takes almost the same amount of time as
>does the 8086-routine.

If it were 32 bit memory 386 would be a lot faster. However, I doubt
you haveing a 32 bit EGA. Instead your EGA is 8 or 16 bit. As accessing
memory on EGA board is the speed limiting factor there shouldn't be big
differences in speed if both EGAs are the same type. (Of cource, higher 
clock speed with 386 speeds up things unless you gotta use waitstates 
for the EGA).

-hs

--
Harri Suomalainen         c37189h@saha.hut.fi         haba@otax.tky.hut.fi

mlord@bwdls58.bnr.ca (Mark Lord) (01/08/91)

In article <CMM.0.88.663249658.sverrehu@ome.ifi.uio.no> sverrehu@ifi.uio.no (Sverre H Huseby) writes:
<I have tried clearing the EGA graphics screen (mode 10h)
<in the following two ways:
<
<    8086:
<      xor ax, ax
<      mov cx, NUM_BYTES / 2
<      rep stosw
<
<    80386:
<      xor eax, eax
<      mov cx, NUM_BYTES / 4
<      rep stosd
<
<The 386-routine takes almost the same amount of time as
<does the 8086-routine.
<
<Why???

Because the hardware interface to your EGA card's memory is only 8-bits wide.
Thus, both of these loops generate exactly NUM_BYTES writes to the EGA memory,
with the cpu converting your 16/32 bit writes to multiple 8-bit writes.

The 386 loop will still be slightly faster, due to less overhead for the loop,
since it only runs half the count of the 8086 loop.  But since EGA memory tends
to involve wait states when accessing, and also since both processors lock
the loop code inside the pre-fetch queue, the slight savings in loop overhead
are not significant compared to the very slow access to the EGA memory.
-- 
 ___Mark S. Lord__________________________________________
| ..uunet!bnrgate!mlord%bmerh724 | Climb Free Or Die (NH) |
| MLORD@BNR.CA   Ottawa, Ontario | Personal views only.   |
|________________________________|________________________|

rschmidt@copper.ucs.indiana.edu (roy schmidt) (01/08/91)

In article <1991Jan7.165104.25541@santra.uucp> c37189h@saha.hut.fi (Harri "Haba" Suomalainen) writes:
>sverrehu@ifi.uio.no (Sverre H Huseby) writes:
>>I have tried clearing the EGA graphics screen (mode 10h)
                   ((16 and 32-bit code expunged))       
>>The 386-routine takes almost the same amount of time as
>>does the 8086-routine.
>
>If it were 32 bit memory 386 would be a lot faster. However, I doubt
>you haveing a 32 bit EGA. Instead your EGA is 8 or 16 bit. As accessing
>memory on EGA board is the speed limiting factor there shouldn't be big
>differences in speed if both EGAs are the same type. (Of cource, higher 
>clock speed with 386 speeds up things unless you gotta use waitstates 
>for the EGA).
>
     This is generally the case with 386 machines, aws they are often
built on an AT bus.  The 8- and 16-bit slots are on an 8 MHz bus,
regardless of processor speed, while the 32-bit RAM is on a faster bus
to yield zero wait-states for the RAM.  So it is likely that your EGA
card is on a two-wait-state bus, and the only difference in execution
speed is in the processor handling instructions in extended registers.

 
--
--------------------------------------------------------------------------
Roy Schmidt                 |  #include <disclaimer.h>     
Indiana University          |  /* They are _my_ thoughts, and you can't
Graduate School of Business |     have them, so there!  */