ZX80 comparators with negative ressults...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
bola_dor
Posts: 357
Joined: Wed Oct 02, 2019 5:32 am

Re: ZX80 comparators with negative ressults...

Post by bola_dor »

Good..
This is becoming a reference wiky 💪💪
Ernesto
ZX80, TK83, CZ1000, CZ1500, TK85, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, TK90X, CZ Spectrum Plus, ZX Spectrum, ZX Spectrum+, ZX Spectrum +2, Sinclair QL. And more to come :D
User avatar
1024MAK
Posts: 3916
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: ZX80 comparators with negative ressults...

Post by 1024MAK »

As expected, both a Radio Shack TRS-80 Model 100 Portable computer running Microsoft BASIC. And an Amstrad NC200 computer running Z80 BBC BASIC (by R.T.Russel), produce the same results as Microsoft BASIC on a Commodore 64 or PET and Acorn 6502 BASIC.

Mark
User avatar
mrtinb
Posts: 1472
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX80 comparators with negative ressults...

Post by mrtinb »

I assume it's because false is all bits zero #00000000 = 0.
And it's true if all bits are one #11111111 = -1.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
1024MAK
Posts: 3916
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: ZX80 comparators with negative ressults...

Post by 1024MAK »

mrtinb wrote: Sun Nov 21, 2021 11:00 am I assume it's because false is all bits zero #00000000 = 0.
And it's true if all bits are one #11111111 = -1.
When using Integer variables and where OR and AND are bit wise operators, yes.

Mark
Moggy
Posts: 2555
Joined: Wed Jun 18, 2008 2:00 pm

Re: ZX80 comparators with negative ressults...

Post by Moggy »

I know this is about BASIC comparators but just as pointer for anyone using older versions of Toddy Forth it should be noted that whilst true is represented by -1 in these versions, the new Toddy Forth 79 represents true as 1 as does FIF81 and is not an error on these Forths' part.
Post Reply