home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / MISCTI10.ZIP / TI425.ASC < prev    next >
Encoding:
Text File  |  1988-05-02  |  1.5 KB  |  35 lines

  1. Turbo Pascal stores function results in a special area. In the case
  2. of a Boolean function result, it is stored in BP-0001. The exit
  3. code of a function then moves the value stored there to AL.
  4.  
  5. The code presented in function HercPresent computes the proper
  6. value for the function result, but never places it into BP-0001,
  7. and just keeps the value in AL. On some machines, this can cause a
  8. range check error on assignment of the function result. The
  9. following patch adds the inline code to the end of the function to
  10. move the result into BP-0001. After that, the exit code moves the
  11. value back into AL and the function terminates.
  12.  
  13. The old inline statement of the Function HercPresent was as
  14. follows:
  15.  
  16.          $26/$88/$0E/$FF/$3F/  {      MOV    ES:[3FFFH],CL        }
  17.          $C3/                  {      RET                         }
  18.          $30/$C0);             { L4:  XOR    AL,AL                }
  19.                                { L7:                              }
  20.  
  21. end; { HercPresent }
  22.  
  23. Adding the three inline commands ( /$88/$46/$FF ) before the end of
  24. the inline statement places the value in AL into the area where
  25. Turbo will look for the function result.
  26.  
  27. The new code should look as follows:
  28.  
  29.          $26/$88/$0E/$FF/$3F/  {      MOV    ES:[3FFFH],CL        }
  30.          $C3/                  {      RET                         }
  31.          $30/$C0/              { L4:  XOR    AL,AL                }
  32.          $88/$46/$FF);         { L7:  MOV    [BP-0001],AL         }
  33.  
  34. end; { HercPresent }
  35.