home *** CD-ROM | disk | FTP | other *** search
- Turbo Pascal stores function results in a special area. In the case
- of a Boolean function result, it is stored in BP-0001. The exit
- code of a function then moves the value stored there to AL.
-
- The code presented in function HercPresent computes the proper
- value for the function result, but never places it into BP-0001,
- and just keeps the value in AL. On some machines, this can cause a
- range check error on assignment of the function result. The
- following patch adds the inline code to the end of the function to
- move the result into BP-0001. After that, the exit code moves the
- value back into AL and the function terminates.
-
- The old inline statement of the Function HercPresent was as
- follows:
-
- $26/$88/$0E/$FF/$3F/ { MOV ES:[3FFFH],CL }
- $C3/ { RET }
- $30/$C0); { L4: XOR AL,AL }
- { L7: }
-
- end; { HercPresent }
-
- Adding the three inline commands ( /$88/$46/$FF ) before the end of
- the inline statement places the value in AL into the area where
- Turbo will look for the function result.
-
- The new code should look as follows:
-
- $26/$88/$0E/$FF/$3F/ { MOV ES:[3FFFH],CL }
- $C3/ { RET }
- $30/$C0/ { L4: XOR AL,AL }
- $88/$46/$FF); { L7: MOV [BP-0001],AL }
-
- end; { HercPresent }
-