i know this is a bit of a maths question but how to i find the decimal opposite of an 8 bit binary number? like inverting all the bits? so say 255 becomes 0 and 0 becomes 255.
like 11111111
00000000
a bit of a maths question
Re: a bit of a maths question
In machinecode with XOR 255
This will swap all 1 to 0 and 0 to 1.
This will swap all 1 to 0 and 0 to 1.
Re: a bit of a maths question
Code: Select all
5 input x
10 LET 255-x
Code: Select all
5 REM XOR 255
10 LET A$="HELLO WORLD"
20 FOR A=1 TO LEN A$
30 LET A$(A)=CHR$(255-CODE A$(A))
40 NEXT A
45 PRINT A$
50 FOR A=1 TO LEN A$
60 LET A$(A)=CHR$(255-CODE A$(A))
70 NEXT A
80 PRINT A$
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: a bit of a maths question
ok, ty
and what about mirroring?
and what about mirroring?