4.77 MHz

From DOSBoxWiki
Revision as of 06:08, 11 February 2014 by Slacka (Talk | contribs)

Jump to: navigation, search

The IBM PC XT ran at 4.77 MHz. This describes how to run DOSBox at XT-like speeds for programs that do not perform their own timing. Keep in mind that DOSBox cannot run at exactly 4.77 MHz. At least, not exactly the way an IBM PC XT did. You can, however, get pretty darn close by testing with some benchmark tools.

As you will see in the testing below, various types of computer instructions run at widely various speeds on the different types of computer chips out there. The most striking example is perhaps math instructions that involve real numbers such as: 1.1 x 2.2 = 2.42. This is called floating-point math. Floating-point instructions were extremely slow on the 8086 CPU unless you installed the optional 8087 co-processor. It wasn't until the Pentium age that floating-point hardware was built into all PC CPU's. Anyway, the point is that DOSBox has only one speed control, and it slows down all computer instructions by the same percentage (more or less). It is therefore not possible to tell DOSBox to slow integer math by X%, floating-point math by Y%, and non-math by Z%, etc. Near-perfect 4.77 MHz speed will not be possible until someone builds an XT emulator specifically for this purpose. This is not likely to happen because close enough will always be, quite frankly, good enough.

Searching for 4.77 MHz (XT)

Personally, I found the old DOS tool, MIPS, to be the most accurate and easiest-to-use tool thus far for use in the quest for 4.77 MHz. Look for MIPS.ZIP at the following FTP site (or click here or here to get it now):

ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/

The contents of MIPS.DOC:

   PROGRAM:    MIPS.COM    -   Version 1.10  1986
   PURPOSE:    CPU Benchmark and Performance Test
   USAGE:      MIPS [Enter]
   
   FUNCTIONS:  Measures Million(s) of Instructions Per Second
   
       (1)     General Instructions    -   random
       (2)     Integer Instructions    -   ADD SUB MUL DIV
       (3)     Memory to Memory        -   MOV RAM to RAM
       (4)     Register to Register    -   MOV REG to REG
       (5)     Register to Memory      -   MOV REG to RAM
   
       (6)     Performance Rating      -   average
   
   COPYRIGHT:  (C) 1986 Chips and Technologies, Inc.

Running MIPS produces a screen similar to this:

       +---------------------------------------------------+
       |   MIPS v1.10 CPU Benchmark and Performance Test   |
   +-----------------------------------------------------------+
   |          |   Million Instructions Per Second   | 10:10:00 |
   +-----------------------------------------------------------+
   |      BENCHMARK:      |  IBM/XT   IBM/AT   COMPAQ  |       |
   |                      |  4.7Mhz    8Mhz      386   |  MIPS |
   |----------------------|----------------------------|-------|
   | General Instructions |   25.83     7.51     3.79  |  4.29 |
   | Integer Instructions |   16.92     2.64     1.16  |  2.85 |
   | Memory to Memory     |    7.79     2.40     1.34  |  1.85 |
   | Register to Register |   18.07     2.35     0.98  |  3.25 |
   | Register to Memory   |   20.72     6.22     3.43  |  6.39 |
   |                      |                            |       |
   | Performance Rating   |   18.24     4.40     2.16  |  3.72 |
   +-----------------------------------------------------------+

Note: If you run MIPS at too high a speed, the numbers will get large enough to screw up the formatting and make the results mostly unreadable.

Steps to Find 4.77 MHz

  1. Download MIPS and place it in an easy-to-find folder. (I created a DOSTOOLS folder inside my DOSBOX folder.)
  2. Make these changes to your dosbox.conf file:
    [sdl]
    fullscreen=false
    [cpu]
    cycles=300
    cycleup=1
    cycledown=1
    [autoexec]
    mount C "C:\Program Files\DOSBox\DOSTools\"
    C:
    cd \
  3. Launch DOSBox. Then run MIPS from the command line.
  4. Your goal is to get the Performance Rating in the IBM/XT column to equal 1.00. To do this, press Ctrl-F11 (slow down) or Ctrl-F12 (speed up) several times while watching the CPU Cycles in DOXBox’s title bar change from 300 to your next test value.
  5. Run MIPS again. Repeat steps 4 and 5 until you get a Performance Rating of 1.00 (or as close as you need).
  6. Make a note of your final CPU Cycles value and set "cycles=xxx" to this value in your dosbox.conf whenever you need 4.77-MHz-like speed.

Hint: I use Ronald Blankendaal’s great DBGL (DOSBox Game Launcher) frontend to simplify many of the above tasks. Just point it to your MIPS.COM file and be sure to UNcheck the "Exit afterwards" box in the General tab to stay at the command line.

Notes

Some users may prefer a speed at which General Instructions equals 1.00 (instead of Performance Rating). This depends entirely upon what kinds of instructions you feel affect the program’s speed the most. 2D games should not be using any floating-point math so no worries there. But predicting whether a program is integer heavy, memory heavy, or whatever heavy, would be pure sorcery. [Anyone care to modify a debugger to analyze this? Didn’t think so.] Really, just choose what feels best to you (actually, I can hardly tell the difference between cycles=245 and cycles=290).

Some testing was done with other benchmark tools to somewhat validate the MIPS results:

  • SLOWDOWN 2.00 tends to agree with the MIPS Performance Rating but varies a bit depending on what speed you are slowing down from. (usage: slowdown /xt) (Not dynamic mode compatible.)
  • COMPTEST 2.60 tends to agree with the MIPS General Instructions rating and also offers some interesting floating-point benchmarks. Speed is determined by executing a block of FSQRT instructions. (Not dynamic mode compatible.)
  • CPUTEST (1989) will lead you towards setting CPU Cycles to about twice as high as these others and I have chosen to disregard these results due to “feel” of the XT programs at this higher speed.

My current DOSBox speed on a 1.3 GHz Athlon is cycles=245. At such low DOSBox speeds I am finding about a 1% difference between Normal CPU Mode and Dynamic CPU Mode. Therefore, you shouldn’t need to worry about benchmarking that setting. Interestingly, with dynamic mode versus normal mode, the Integer Instructions benchmark ~3% slower and Register to Register benchmarks ~10% faster (the other benchmarks are proportionately 1% faster). [No doubt, however, that dynamic mode plays a larger role at higher speeds.]

core=dynamic, cycles=243:

       +---------------------------------------------------+
       |   MIPS v1.10 CPU Benchmark and Performance Test   |
   +-----------------------------------------------------------+
   |          |   Million Instructions Per Second   | 10:10:00 |
   +-----------------------------------------------------------+
   |      BENCHMARK:      |  IBM/XT   IBM/AT   COMPAQ  |       |
   |                      |  4.7Mhz    8Mhz      386   |  MIPS |
   |----------------------|----------------------------|-------|
   | General Instructions |    0.85     0.25     0.12  |  0.14 |
   | Integer Instructions |    1.42     0.22     0.10  |  0.23 |
   | Memory to Memory     |    1.02     0.31     0.17  |  0.24 |
   | Register to Register |    1.48     0.19     0.08  |  0.26 |
   | Register to Memory   |    0.79     0.24     0.13  |  0.24 |
   |                      |                            |       |
   | Performance Rating   |    1.00     0.24     0.12  |  0.22 |
   +-----------------------------------------------------------+

core=normal, cycles=245:

       +---------------------------------------------------+
       |   MIPS v1.10 CPU Benchmark and Performance Test   |
   +-----------------------------------------------------------+
   |          |   Million Instructions Per Second   | 10:10:00 |
   +-----------------------------------------------------------+
   |      BENCHMARK:      |  IBM/XT   IBM/AT   COMPAQ  |       |
   |                      |  4.7Mhz    8Mhz      386   |  MIPS |
   |----------------------|----------------------------|-------|
   | General Instructions |    0.85     0.25     0.12  |  0.14 |
   | Integer Instructions |    1.48     0.23     0.10  |  0.24 |
   | Memory to Memory     |    1.02     0.31     0.18  |  0.24 |
   | Register to Register |    1.35     0.18     0.07  |  0.24 |
   | Register to Memory   |    0.79     0.24     0.13  |  0.24 |
   |                      |                            |       |
   | Performance Rating   |    1.00     0.24     0.12  |  0.22 |
   +-----------------------------------------------------------+

Searching for 8 MHz (AT)

Does anyone really need to tell you to follow the above instructions for 4.77 MHz and use the IBM/AT column in MIPS instead of the IBM/XT column. Oh yeah, you might also want to start with cycles=500.


Other Tools You May Find Useful

I tested several slowdown and benchmark tools and these are the ones that I have found so far to be useful/compatible in DOSBox:

MIPS 1.10
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/mips.zip
COMPTEST 2.60
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/ctest260.zip
CPUTEST
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/cputest.zip
SLOWDOWN 2.00
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysutl/slodn200.zip
PC Benchmark 6.0 – Not terribly useful—used for comparing benchmarks each other.
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/pcben60a.zip
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/pcben60b.zip
ftp://ftp.simtel.net/pub/simtelnet/msdos/sysinfo/pcben60c.zip