News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Ramblings...

Started by sinsi, April 04, 2025, 02:56:26 PM

Previous topic - Next topic

sinsi

In the spirit of the Orphanage...


Thinking about boolean logic, specifically true or false.
As a programmer I think of it as one bit but it can also be a non-zero number or zero
which implies any non-zero number is true. Then I thought about infinity, which makes
true outweigh false by infinity-1. Ridiculous.

Then I thought about the internet and gave up.

NoCforMe

Maybe we should start thinking of it as "false" (which is always zero) and "not false"?

Of course, strictly speaking "NOT FALSE" would be 1s as far as the eye can see ...
Assembly language programming should be fun. That's why I do it.

sinsi

Quote from: NoCforMe on April 04, 2025, 03:32:17 PMMaybe we should start thinking of it as "false" (which is always zero) and "not false"?

Of course, strictly speaking "NOT FALSE" would be 1s as far as the eye can see ...
It's all semantics anyway, about opposites
  true or false
  black or white
  on or off
  apple or samsung
  them and us


I can barely acknowledge zero as a real number (I can have 0 of something) but minus numbers?
How can I have -2 of something? Nah, negative numbers are irrational.

So I have almost infinity of 0 things, which means that what I do have is either very precious or very trivial.
My mindset and upbringing makes me think precious.

NoCforMe

Quote from: sinsi on April 04, 2025, 04:16:13 PMI can barely acknowledge zero as a real number (I can have 0 of something) but minus numbers?
How can I have -2 of something? Nah, negative numbers are irrational.
Just be glad we're not using processors based on 1s complement instead of 2s, with both positive and negative zero ...
That would definitely make my head hurt.
Assembly language programming should be fun. That's why I do it.

jj2007

In GfaBasic, you had someflag! boolean variables, which could be zero or -1. You could use them e.g. as

Print Left$("You see the string?", someflag!)

So if someflag! was true, you would see the whole string, if it was false, you saw nothing. I used that quite a bit and was a bit p*ssed off when I found out that C & friends used 0 and +1 as boolean values.


jj2007

IMHO -1 as "true" makes much more sense.

include \masm32\MasmBasic\MasmBasic.inc
flag1 BOOL 1
flag2 BOOL -1
somevar dd 12345
  Init
  deb 4, "Flags in Masm", flag1, flag2
  mov eax, somevar
  and eax, flag2
  mov ecx, somevar
  and ecx, flag1
  deb 4, "somevar and flags", eax, ecx
EndOfCode

Flags in Masm
flag1           1
flag2           -1

somevar and flags
eax             12345
ecx             1

z

I just call them 1 and 0.  :tongue:

The label or name given them matters not, as long as there is consistency.   :biggrin:
:cool:

daydreamer

Jochen
In basic you could use alternative to if inkey=left then x=x-1
X=x+(inkey=right)-(inkey=left)
Y=y+(inkey+down)-(inkey=up)
Depending on basic version,it produced 1 and 0,other basics it produced -1 and 0

Good to take a look on the above when making simd packed compares

Older c version running on 16 bit system ,standard int= 16 bit ,later standard int 32 bit on 32 bit system
So non bit fiddling fast boolean can use bytesize,wordsize,dwordsize... Depending on system it runs on
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

Quote from: jj2007 on April 04, 2025, 09:07:27 PMIMHO -1 as "true" makes much more sense.

include \masm32\MasmBasic\MasmBasic.inc
flag1    BOOL 1
flag2    BOOL -1
somevar    dd 12345
  Init
  deb 4, "Flags in Masm", flag1, flag2
  mov eax, somevar
  and eax, flag2
  mov ecx, somevar
  and ecx, flag1
  deb 4, "somevar and flags", eax, ecx
EndOfCode

Flags in Masm
flag1          1
flag2          -1

somevar and flags
eax            12345
ecx            1
But that's only because you're using it (TRUE) as a bitwise operator.
I don't believe that was ever the intended usage of TRUE and FALSE.
Works out well in your case here, and could still be used for simple "yes/no" detection.
In other words, we could all live with it; it could be considered another variant of "zero = FALSE, anything non-zero = TRUE".
Assembly language programming should be fun. That's why I do it.

daydreamer

Str Db "pigs can fly!",0
Terminating zero = false
All ascii codes in characters in the above string = nonzero = true,despite it contains a lie  :badgrin:
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

Quote from: daydreamer on April 08, 2025, 03:21:30 AMStr Db "pigs can fly!",0
Terminating zero = false
All ascii codes in characters in the above string = nonzero = true,despite it contains a lie  :badgrin:
Please explain your rambling to us.
What you wrote makes no sense to me.

Obviously, in your example "Terminating zero" should equal TRUE, not FALSE.
Assembly language programming should be fun. That's why I do it.

z

Quote from: NoCforMe on April 08, 2025, 05:56:31 AMPlease explain your rambling to us.
What you wrote makes no sense to me.
Bbbut...
It is topic related, in any case: "Ramblings..."   :skrewy:  :joking:
:cool:

daydreamer

Quote from: zedd151 on April 08, 2025, 05:58:48 AM
Quote from: NoCforMe on April 08, 2025, 05:56:31 AMPlease explain your rambling to us.
What you wrote makes no sense to me.
Bbbut...
It is topic related, in any case: "Ramblings..."   :skrewy:  :joking:
:joking:  :badgrin:
does that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

z

Quote from: daydreamer on April 09, 2025, 02:25:36 AMdoes that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)

I really don't think he would want to go through all that trouble. There is a lot of 'rambling' going on throughout the forum.  :joking:  :rofl:

Such is life.  :tongue:
I like how sinsi put this topic back on the rails after this post.  :tongue:  :toothy:  :joking:
:cool: