Class | Zx81 |
In: |
lib/host_systems/Zx81.rb
|
Parent: | HostSystem |
decode 5 bytes as a number A number is stored in the ZX81 in floating point binary with one exponent byte e (1 <=e <=255), & four mantissa bytes m (½ <= m <= 1). This represents the number m * 2**(e-128.)
Since ½<= m<=1, the most significant bit of the mantissa m is always 1. Therefore in actual fact we can replace it with a bit to show the sign - 0 for positive numbers, 1 for negative.
Zero has a special representation in which all 5 bytes are 0. this is a conversion of code originally posted by Darren Salt to groups.google.com.au/group/comp.sys.sinclair/browse_frm/thread/37966a7bb023670d/690f27c27f48a036