bitGet problem
-
@xevdev So i am not good at maths so I am sorry for any wrong thing what I say now. Isnt % the modulo I dont know if you say modulo in english.
-
@petermeisenstein yes in fuze it is and I wrote my own mod function because I was expecting a function name not a symbol . So each language is different .
-
@xevdev
And you are dealing with binary stuff in fuze very cool. Back to the roots of codeing -
@petermeisenstein not if there's no way to put a binary number in to my code so I'll use
Bin = "10110010"
If bin [0] = "1" then print("true")
And because the first digit is 1 it will print true
I think ?
Got caught out again use
If bin [0] ==
Double equals -
@xevdev Yeah I would also say maybe it helps you there is strcontains and other string stuff in fuze. Are you programming a ROM for a cpu emulator ?
-
No I just want a binary number to use as a bitmask
And the code above doesn't work which is funny because I just wrote a whole program which uses something similar to that. -
For the OCR code generator I have a couple of user functions:
// convert a decimal number to a binary string function dec2bin(n,length_type) string byte="" if length_type > 0 then while int(n) > 0 loop nbit = (n % 2) byte = str(nbit) + byte n = n / 2 repeat //pad to length_type bits... while len(byte) < length_type loop byte = "0" + byte repeat endif return byte // convert a binary string to decimal function bin2dec( binaryString ) int result = 0 int i = 0 for i = 0 to len( binaryString ) loop result *= 2 result += int( binaryString[ i ] ) repeat return result
Credit to @faz808 for the first one
-
Thanks but
I simply want a binary number to be visible in my program that way I can easily change the bits
-
As far as I know there is no way to that currently
-
That's ok the above works in a roundabout way