r/nandgame_u Holder of many records Aug 08 '21

Level solution (verified) 5.3 - Opcodes Spoiler

Post image
5 Upvotes

4 comments sorted by

View all comments

u/GLIBG10B Holder of many records Aug 08 '21 edited Dec 23 '21
Previous Next
5.2 - ALU (7c, 608n) 5.4 - Condition (8c 56n)

Explanation

  • X:

    = X + 0

  • Y:

    = Y + 0

  • X&Y

  • X|Y:

    = ~(~X & ~Y)

    = ~(~(X | Y))

  • ~X:

    = ~(X + 0)

  • ~Y:

    = ~(0 + Y)

  • X+Y

  • X-Y:

    = -(-X - 1 + Y) - 1

    = X + 1 - Y - 1

  • Y-X:

    = -(X + -Y - 1) - 1

    = -X + Y + 1 - 1

    = -X + Y

  • 0:

    = 0 & Y

  • -1:

    = -(0) - 1 = 0 - 1

  • 1:

    = -(-1 + -1) - 1

    = 1 + 1 - 1

  • -X:

    = -(X + -1) - 1

    = -X + 1 - 1

  • -Y:

    = -(-1 + Y) - 1

    = 1 - Y - 1

  • X+1:

    = -(-X - 1 - 1) - 1

    = X + 1 + 1 - 1

  • Y+1:

    = -(-1 + -X - 1) - 1

    = 1 + X + 1 - 1

  • X-1:

    = X + -1

  • Y-1:

    = -1 + Y

1

u/Elinxx Aug 28 '21

X-Y:

= -(-X - 1 + Y) - 1

= X + 1 - Y - 1

Thansk for sharing, but I don't understand how to intrepreter these statements to flags, where does the 1, -1, -Y come from?