ZX80 comparators with negative ressults...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
bola_dor
Posts: 400
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 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
User avatar
1024MAK
Posts: 5332
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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Autumn is here. Bye bye summer 2024...
User avatar
mrtinb
Posts: 1979
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: 5332
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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Autumn is here. Bye bye summer 2024...
Moggy
Posts: 3411
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