home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / SYSUTL / TOAD8253.ARC / TOAD8253.ASM next >
Encoding:
Assembly Source File  |  1988-09-01  |  3.8 KB  |  100 lines

  1.     title    Toad8253
  2. ;
  3. ;Author: David Kirschbaum 31 Aug 88
  4. ;From "DMA Control on the PC"
  5. ;by Larry Fogg, Micro Cornucopia #37, Sep-Oct 87
  6. ;
  7. ;The article suggests a way to tweak the 8253 timer to slow down the RAM
  8. ;refresh rate.  Author suggests you can slow the normal DREQ0 interrupt
  9. ;from its normal 15-microsecond interval to up to a full second before RAM
  10. ;will start failing.
  11. ;
  12. ;Extract from the article's text:
  13. ;     "It was right at one refresh every second that my RAM faded away.
  14. ;A count of 900H loaded into the 8253's Timer 1 gives the one second
  15. ;period.
  16. ;     "The BIOS loads the count with 12H and the point of diminishing returns
  17. ;comes around 30H or 40H.  After 40H refresh happens so infrequently as to
  18. ;have no effect on system performance.  Benchmarks show no difference between
  19. ;40H and 900H.
  20. ;     "A value of 40H gives a 2.6% speed increase on my Holliston 186 board
  21. ;and a 5.8% increase on a standard 4.77 MHz 8088.  I haven't had any problems
  22. ;using this speedup.  But don't blame me if your machine dissolves into a
  23. ;puddle of blue slime.  After all, we've gone beyond the limits of computer
  24. ;decency."
  25. ;
  26. ;Toad Hall Notes:
  27. ;The author provided some assembler code to be used via DEBUG.
  28. ;I rewrote it into a proper MASM-compatible .ASM format so you can compile
  29. ;to REFRESH.COM (or whatever you wanna name it).  Run it on startup.
  30. ;Returns the LSB as the DOS ERRORLEVEL (for what that's worth).
  31. ;
  32. ;Sure, I could write this to take the LSB from the DOS command line,
  33. ;but that would only be for experimental use.  Better for you to determine
  34. ;the "magic number" that's best for your system and just leave it hard-
  35. ;coded.  That way no user will accidentally enter some weird number!
  36. ;
  37. ;I used the public domain MIPS.COM v1.10 CPU speed utility as a benchmark.
  38. ;I also ran Norton's SYSINFO.COM (SI) utility just for comparisons.
  39. ;The SI values vary irregularly on sequential runs (e.g., the 40H lsb
  40. ;value produced SI ratings of 7.0 to 7.1).
  41.  
  42. ;Following are MIPS and SI results after running TOAD8253 with various
  43. ;LSB values (and in the most extreme, a new MSB value).
  44. ;
  45. ;                    Counter 1 values
  46. ;            12H    40H    80H    0A0H    0100H
  47. ;General Instructions    0.48    0.50    0.51    0.51    0.51
  48. ;Integer Instructions    0.87    0.90    0.90    0.91    0.91
  49. ;Memory to Memory    0.69    0.74    0.75    0.76    0.76
  50. ;Register to Register    1.13    1.14    1.15    1.15    1.15
  51. ;Register to Memory    0.89    0.94    0.96    0.96    0.96
  52. ;Performance Rating    0.81    0.85    0.85    0.86    0.86
  53. ;Norton's SI rating    7.0    7.1    7.1    7.1    7.1
  54. ;
  55. ;So, no significant changes after bumping the lsb to 0A0H or beyond.
  56. ;(No, I did NOT push the timer to RAM memory failure!)
  57. ;
  58. ;Now, if you want to slow your system DOWN (not the original intention,
  59. ;but some users need to slow down fast clones for games, etc.), here are
  60. ;some slowdown stats:
  61. ;
  62. ;                    Counter 1 values
  63. ;            10H    0AH    07H    05H    03H    02H    01H
  64. ;General Instructions    0.47    0.44    0.39    0.38    0.26    0.23    LOCKUP!
  65. ;Integer Instructions    0.87    0.84    0.83    0.77    0.63    0.57
  66. ;Memory to Memory    0.68    0.63    0.59    0.54    0.33    0.35
  67. ;Register to Register    1.11    1.09    1.01    1.01    0.81    0.81
  68. ;Register to Memory    0.87    0.81    0.75    0.66    0.47    0.50
  69. ;Performance Rating    0.80    0.76    0.71    0.67    0.50    0.49
  70. ;Norton's SI rating:    6.6    6.6    6.3    6.2    4.4    4.6
  71. ;
  72. ;My system is an older GulfStream 8MHz 80286 (XT-compatible, Phoenix ROM)
  73. ;running PC-DOS 3.1.  Your mileage may vary.
  74. ;
  75. ;David Kirschbaum
  76. ;Toad Hall
  77. ;kirsch@braggvax.ARPA
  78.  
  79. CodeSeg    SEGMENT PUBLIC PARA 'Code'
  80.     ASSUME    CS:CodeSeg, DS:CodeSeg, ES:CodeSeg
  81.  
  82. VALUE    EQU    00A0H        ;TH optimum value, LSB=0AH, MSB=0
  83.  
  84.     org    100H
  85.  
  86. Toad8253    proc    near
  87.     mov    al,74H        ;configure 8253 (see Micro C #35, p.30)
  88.     out    43H,al
  89.     mov    ax,VALUE
  90.     out    41H,al        ;change counter 1 lsb to alter refresh rate
  91.     xchg    al,ah        ;msb for counter 1
  92.     out    41H,al
  93.     xchg    al,ah        ;lsb back in AL as ERRORLEVEL
  94.     mov    ah,4CH        ;DOS terminate process
  95.     int    21H
  96.  
  97. Toad8253    endp
  98. CodeSeg    ends
  99.     end    Toad8253
  100.