Stationeers

Stationeers

View Stats:
Bonny01 Jul 12, 2023 @ 12:23am
Problems with NOT in Mips
I got some Problems with "not r?a (r?/num)"
definition says Bitwise Flipping- 0 becomes 1 and 1 becomes0

However, if input is "0" i got "-1" and if Input is "1" i got "-2"

my testIC

move r0 0
not r2 r0
s db Setting r2


do i use it wrong or ist it not funktion properly?
< >
Showing 1-10 of 10 comments
JeanDeaux Jul 12, 2023 @ 7:33am 
definition says Bitwise Flipping- 0 becomes 1 and 1 becomes 0

I would argue it is not working as intended. And a NOT function is not a Two's Compliment

https://en.wikipedia.org/wiki/Bit_flipping
Last edited by JeanDeaux; Jul 12, 2023 @ 7:37am
evilshroud Jul 12, 2023 @ 8:14am 
I believe the Byte functions should require an 8 after the name or something (not8 r2 r0, as an idea)

In the meantime, or for a different option, you can use SEQZ (Set if EQual to Zero):
move r0 0 SEQZ r2 r0 s db Setting r2
This does the same thing as you're INTENDING to do, without all that mucking about in hyperspace.
z18pla Jul 12, 2023 @ 10:26am 
Originally posted by JeanDeaux:
And a NOT function is not a Two's Compliment
Sure. It is not. But internal representation of negative numbers is.
For example, 4bit integers:
0 -> 0000
not(0) -> 1111 -> 15(unsigned int) or -1 (signed int)

1 -> 0001
not(1) -> 1110 -> 14(unsigned int) or -2 (signed int)

The only problem is: there is no way to show result as 'unsigned int'. Result is always displayed as 'signed int'. It does not mean result is incorrect.
JeanDeaux Jul 12, 2023 @ 11:25am 
But you're adding scope to the function (in the form of additional bytes of data) and calling it correct. A NOT gate and function is binary, the Command (as listed & described in the game editor) is binary, not a byte or partial byte of data. So yes, if you want to change the conditions to fit your argument then you're in a field all to yourself and not on par with the discussion.

If the dev's intended to work it in this manner then they've completely messed up their instructions to the user, as they clearly outline that results should be 0 or 1, not 0 or -1 or -2.
Last edited by JeanDeaux; Jul 12, 2023 @ 11:31am
Bonny01 Jul 12, 2023 @ 4:53pm 
thank you all for the clarification.
I have no problem with "not" working differently in this game than in the rest of the world, but please use the correct ingame definition so that I as a user can use it correctly.
Bonny01 Jul 12, 2023 @ 10:37pm 
for the record

I got some UtilityIC around, these ICs have several different, mostly very simple tasks.i try to keep the programs short, like the tasks they have to fulfil. One of these tasks is to be able to open and close hangar doors using buttons.

And this is was i came up with

"
define Hangardoor -1351081801
define button 491845673
alias HD r9
sb Hangardoor On 1

loop:
yield
lb r0 button Setting 0
blez r0 loop
lb HD Hangardoor Open 0
not HD HD
sb Hangardoor Open HD
sleep 1
j loop
"
it took me about 1h to figure out that it is the "not" command which doesn't work as it says in the deffinition. That was very frustrating ! !


now i use
"select HD HD 0 1"
instead of not
z18pla Jul 13, 2023 @ 4:02am 
Originally posted by JeanDeaux:
So yes, if you want to change the conditions to fit your argument then you're in a field all to yourself and not on par with the discussion.

If the dev's intended to work it in this manner then they've completely messed up their instructions to the user, as they clearly outline that results should be 0 or 1, not 0 or -1 or -2.

Originally posted by Bonny01:
thank you all for the clarification.
I have no problem with "not" working differently in this game than in the rest of the world, but please use the correct ingame definition so that I as a user can use it correctly.

Wow. Okay. I'll try to explain last time.

If you look at any real architecture (x86, MIPS, ARM, etc) you will see chip with set of 'general purpose registers' (there are other registers but i'll skip them for simplicity).
Each general purpose register is ordered set of bits. The size of this set depends on architecture: x86-32 - 32bits, MIPS64 - 64 bits, etc.

In game those r* registers are like real general purpose registers (well, at least for bitwise operations like not,and,xor etc). And these operations (like real world operations) work with full set of bits in those registers. So 'NOT' operation will flip _all_ bits in register (like real 'NOT' operation) and not only bit you are interested in. If you need specific bit - you have to code it.

NOT(0) will give you set of '1' bits: 11...1111. Always. In real world and in game. The number of those '1' bits in register depends on architecture 'width'.

P.S. about program above. There are several ways to correct it. Shortest one is:
change 'not HD HD' to 'sub HD 1 HD'. If you prefer bitwise operations: add after 'not HD HD' 'and HD HD 1' (this 'and' will keep 'interesting' bit and zero all others)
Last edited by z18pla; Jul 13, 2023 @ 4:28am
JeanDeaux Jul 13, 2023 @ 6:07am 
Yep, I get what you're saying. Knew all about it from my college classes in digitial devices and Boolean Algebra where I built actual circuit boards 30 years ago. I totally get that 8, 16, 32, 64, 128, etc zeros in a register convert to all 1's, vice versa, and at the bit positions they are at if they're mixed. I get the signed and unsigned integers. Managing bits is a fantastic way of compressing data, converting the case of ANSI code text characters, etc.

The instructions in the game, however, state they are dealing with a single bit (well, more implied by the example they provide) and is confusing this OP, and plenty of other players, as a search for NOT functionality would reveal in these forums. So while you're correct in the points you are bringing up, they are not to the point made by this OP, but gotta admire your ability to stay focused on your point.

If the intent is to NOT the entire register for user management of data, then that needs to be part of the example provided in their instructions and not just a single bit.
Bonny01 Jul 13, 2023 @ 8:52am 
first of all, i dont blame any of u, sorry if that came across wrong, english is not my main language.
this is my first time trying something with a programming language.

I'm an electronics technician, I understand logic components very well. Everything about this programming revolves around zeros and ones, which suits me very well. If I want to solve a problem, I create a truth table and see which logic corresponds to it. In my case it was just "not" as I know it. Except for the registers, most of the commands qausie revolve around zeros or ones, nothing indicated that it is handled differently in case of "not", not even the ingame definition, and THAT is was is wrong in my opinion.
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Jul 12, 2023 @ 12:23am
Posts: 10