View Single Post
Old January 6th, 2020, 12:21 PM   #18
Lifetime Supporting Member
United States

drbitboy is offline
drbitboy's Avatar
Join Date: Dec 2019
Location: Rochester, NY
Posts: 854
Originally Posted by JesperMP View Post
I am pretty sure that the emulator merely passes the arguments to the CPU (in this case an intel x86) which then returns the result. You might be right that it returns a "wrong value", but it would be the intel CPU, not the emulator that is in the wrong.
Actually, as Mike Nash suggested, it does probably pass the 16-bit INTEGER arguments to be multiplied, but
  • it passes them as 32-bit REALs,
  • the 32-bit REAL product result only keeps at most the upper 24 bits of precision,
  • so if the integer result would 25 or more significant bits (I think the maximum possible is 31),
  • then some bits at the lower end are lost
  • and if any of those lost bits are non-zero, then the final result MOVed into a 16-bit INTEGER will be "wrong"

So the error comes from passing the 16-bit INTEGER multiplicand and multiplier as REALs instead of LONGs; surely that is a mistake in the design of the emulator, not the CPU.
  Reply With Quote