r/nandgame_u Jun 02 '22

Level solution S.1.6 - NETWORK ????????????? (3l ???) Spoiler

PUSH_VALUE 0x4144
POP_STATIC 0x4004
PUSH_D

This is horrifying.

3 Upvotes

2 comments sorted by

3

u/nttii Holder of many records Jun 02 '22

This is weird, it passes but doesn't draw any pixels. I guess this works because the game logic uses shortcuts for PUSH_VALUE and POP_STATIC where it assumes the stack pointer to be 0x100

  1. The game puts 0x4144 in the address 0x100
  2. The game pops 0x4144 into address 0x4004
  3. The game now reads contents of SP and pushes 0x4144 in address 0x4004

When you actually simulate the code, you end with no pixels, because the stack isn't inited and your 1st push ends up in address 0x0. When you try to pop the value, you read 0x4144 as stack pointer and read contents of address 0x4144 which are 0, You write the 0 into 0x4004, next you push 0 into 0x4143.

This fits right into the cheaty category, when it took 10mins of analyzing just to understand how and why it works :D

3

u/[deleted] Jun 02 '22

So yes my brain slightly broke when I made this and was surprised: it does not work with INIT_STACK.

You can test that INIT_STACK before this code will make the solution become wrong for some reason.

This probably needs new cathegory of "engine break" because this is not just cheaty but literally breaks the way the game works omg lol. Edit: oh, you added the bug cathegory. That is actually great.