NOR in BASIC

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

NOR in BASIC

Post by Jeff-20 »

Can someone help me out with a simple BASIC formula for logical NOR? I tried OR then AND255. What would you use?

If you're up for the challenge, what about NAND? XNOR?
High Scores, Links, and Jeff's Basic Games page.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: NOR in BASIC

Post by groepaz »

what about NOT (A OR B)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: NOR in BASIC

Post by Mike »

what groepaz wrote, plus:

NAND(A,B) -> NOT(A AND B)
XNOR(A,B) -> A=B ("=" as relational operator, as in IF A=B THEN ...) provided A and B are -1 for true and 0 for false.

NOT(A AND B) also works for bitwise operations (where A and B are not necessarily 0 or -1). XNOR(A,B) would need to be expressed as (A AND B) OR (NOT A AND NOT B) in that case.
User avatar
TRIANGULAR OS
Vic 20 Dabbler
Posts: 87
Joined: Wed Mar 09, 2022 4:53 am
Website: https://www.youtube.com/@triangular_uos
Location: Cracow, Poland

Re: NOR in BASIC

Post by TRIANGULAR OS »

If you want have this in 0 or 1 form use ABS() function in BASIC. So for example XNOR(A,B) would be ABS(A=B), if you want 0,1 answer.
TRIANGULAR μOS for VIC-20:
http://www.sleepingelephant.com/ipw-web ... =2&t=10352

TRIANGULAR μOS YouTube channel:
https://www.youtube.com/@triangular_uos
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Re: NOR in BASIC

Post by Jeff-20 »

Great info! Thank you!
High Scores, Links, and Jeff's Basic Games page.
Post Reply