Source: Safe Cracking
Part 1: Take the assembunny interpreter from day 12 and add an instruction (tgl
X
) that modifies the code at an offset ofX
instructions.
inc
becomesdec
; any other one argument instruction (includingtgl
) becomesinc
jnz
becomescpy
; any other two argument instructions becomejnz
- Toggling an instruction outside of the program does nothing (it does not halt execution)
- If toggling produces an invalid instruction, ignore it
Run the given program with the initial register of
a = 7
. What is the final value in registera
?