home *** CD-ROM | disk | FTP | other *** search
/ Gambler 29 B / GAMBLERCD29B.BIN / Tech / TPpatch / BP7PATCH.ZIP / CRTASM.FIX next >
Text File  |  1996-10-14  |  2KB  |  70 lines

  1.  
  2.   Subject:  DPMI and Pentium Pro - Msg Number: 710628
  3.      From:  Rob Henningsgard 76470,3165
  4.        To:  Simon Page 100407,2171
  5.     Forum:  DELPHI   Sec: 06-Delphi Database
  6.      Date:  17-Sep-96 18:09
  7.  
  8.   Jamie (and Simon):
  9.  
  10.   I spent the afternoon writing a change to CRT.ASM which solves the
  11.   problem of super-hot machines (like Pentium Pro-200's) crashing the
  12.   CRT unit's init code with a DIV 0.  Here is my solution:
  13.  
  14.   In \BP\RTL\CRT\CRT.ASM, make the following changes:
  15.  
  16.   DelayCnt        DD      ?
  17.   ;Before 6.0a    ^-- this was DW (16 bits) which was inadequate.
  18.  
  19.   In the Initialize procedure, replace the lines:
  20.  
  21.   ;6.0a   DIV     CX
  22.   ;6.0a   MOV     DelayCnt,AX
  23.  
  24.   with the new code:
  25.  
  26.   ;
  27.   ; start new code 6.0a
  28.   ;
  29.           xor     bx,bx
  30.           xchg    ax,bx
  31.           xchg    ax,dx
  32.           div     cx
  33.           xchg    ax,bx
  34.           div     cx
  35.           mov     DelayCnt.w0,ax
  36.           mov     DelayCnt.w2,bx
  37.   ;
  38.   ; end new code
  39.   ;
  40.  
  41.   And finally, in the Delay procedure, replace these:
  42.  
  43.   ;6.0a   @@1: MOV     AX,DelayCnt
  44.   ;6.0a        XOR     DX,DX
  45.  
  46.   with this new code:
  47.   ;
  48.   ; start new code 6.0a
  49.   ;
  50.   @@1:    mov     ax,DelayCnt.w0
  51.           mov     dx,DelayCnt.w2
  52.   ;
  53.   ; end new code 6.0a
  54.   ;
  55.  
  56.   These changes allow the countdown in the initialization code to
  57.   exceed 3,604,479, which presently causes the DIV by 55 to exceed
  58.   a result of $FFFF, causing the DIV 0 error.  The fix alters the
  59.   size of the DelayCnt variable to 32 bits, which should allow the
  60.   Delay() call to deal with machines about 700 times faster than a
  61.   Pentium Pro 200.
  62.  
  63.   I've just coded this today, and I've not beat the living daylights
  64.   out of it, but I'm quite sure the change will hold up under further
  65.   testing.  My company is recompiling all BP7/TP7 applications with
  66.   it tomorrow.
  67.  
  68.   Rob---
  69.  
  70.