Page 1 of 1

Smallest Number ZX80

Posted: Mon Nov 28, 2011 11:14 am
by Paul
Hi,
I used the search of this forum and couldn't any ZX80 related entries about this. This is not a question, I just wanted to share what I saw.
In theory a 16 bit integer normally has a range from -32768 to 32767. I wanted to test if this is the same on a ZX80. So I tried to enter
10 LET A=-32768 which I cannot as the number is seen to be invalid (Syntaxerrorcursor)
10 LET A=-32767 works fine. Even if you want to enter the smallest possible number in a INPUT statement you cannot. But you can calculate this ;)
Just use -32767-1 8-)
10 LET A=-32767-1 works.
Funny that Sinclair Basic does a test on the size of the number during entry, but doesn't recognize negative numbers ;)
(Used EO to test, not real machine. No difference expected)

Re: Smallest Number ZX80

Posted: Mon Nov 28, 2011 12:17 pm
by Moggy
Hi Paul

Will try this on My 80 and get back to You.

moggy

Re: Smallest Number ZX80

Posted: Mon Nov 28, 2011 4:24 pm
by PokeMon
Paul wrote: Funny that Sinclair Basic does a test on the size of the number during entry, but doesn't recognize negative numbers ;)
(Used EO to test, not real machine. No difference expected)
This is simply to assymmetric values for plus and minus because of the zero which cuts "one".
In general for signed integers 8 bit is defined = positive range 0 to 127, negative range -1 to -128. For 16 bit 0 to 32767 and -1 to -32768.
I think this is caused by simplifying conversion in ZX80 rom.
I think they simply interprete the value and do a NEG (2's complement) when detecting a minus in front.
But not checked the code for it. ;)

Re: Smallest Number ZX80

Posted: Mon Nov 28, 2011 5:59 pm
by Moggy
@ Paul same result on real ZX80.


Regards
Moggy