Virtual Pascal

Classic Object Pascal for free

I am slowly working my way through the changes made by Stefan and Veit, and have a few questions... I'll post here as I find more :)

In System.pas,
- Why have you changed LeaveHeap to {&Uses all}?
- In ChkResult, there is a line (fdiv st(1),st) that is commented out by "CandyMan". Why is this?

More later, I'm sure!

Views: 107

Reply to This

Replies to This Discussion

Hey Allan,
these 2 obviously are meant for me, so let me dive back into the RTL sources...

1) Looking at system.dif from Veits D32 package he did add this. Let's check for why...
Hm! I cannot think of why this was changed.
I will change it back to the original in my code too, so I can test this as well. :)

2) This is more tricky, I remember that I have verified this fix myself, but slap me for
not including any comment:
- on entering ChkResult() you get st(0) filled with a value, rest of stack is undefined
- fld loads pi*2 into st(0), former st(0) becomes st(1)
- fxch exchanges st(0) and st(1)
- fprem1 modifies st(0) using st(1), no stack order changes
- fstp copies the computed value from st(0) to st(1) and then pops st(0), making st(1) the new st(0)
- fdiv now tries to divide st(1) by st(0) -> this is of course invalid; I don't know why this never made
any problems before

Let me mention here that NDN contains a quite good 64-bit calculator, and CandyMan did quite
some tests and updates to it. This is probably the reason why he found the problem.
Would be interesting of course what exactly happens when doing this. :)
Also, remember that NDN has FPU exceptions turned off and doesn't show them if any occurs.
If this wouldn't be the case then the above fdiv would probably crash my program.

Now I will add some comment to this line. :)

Carry on,
Stefan / AH


© 2022   Created by Allan Mertner.   Powered by

Report an Issue  |  Terms of Service