Copies in code from Day 23 with new out
command. This is a little rougher than Day 23 due to infinite
loop nature of the default program. Therefore, I recommend you enter i === 29
for the Break On conditional.
cpy x y
cpy x y
copies x
(either an integer or the value of a register) into register y
.
inc x
inc x
increases the value of register x
by one.
dec x
dec x
decreases the value of register x
by one.
jnz x y
jnz x y
jumps to an instruction y
away (positive means forward; negative means backward), but only if x
is not zero.
tgl x
tgl x
toggles the instruction x
away (pointing at instructions like jnz
does: positive means forward; negative means backward):
inc
becomes dec
, and all other one-argument instructions become inc
.jnz
becomes cpy
, and all other two-instructions become jnz
.cpy 1 2
) and an attempt is later made to execute that instruction, skip it instead
.tgl
toggles itself (for example, if a
is 0
, tgl a
would target itself and become inc a
), the resulting instruction is not executed until the next time it is reached.out x
out x
transmits x
(either an integer or the value of a register) as the next value for the clock signal.