Position of the last non-zero byte in the original program
Of course, trailing zeros can't be counted, otherwise all programs would be the same size. But empty lines within the program should be counted, because how wide the spacing between certain cells is is actually relevant information that needs to be encoded.
Hence, we simply count how many cells there are until the last non-zero cell, treating all four bytes in a nibble equally. Note that cells 2 to 4 in each nibble can contain *
and @
modifiers beyond the byte their actually storing. However, Box-256 encodes this information into the first byte in addition to the OP code on that line, hence we don't need to count these separately. The -
on the other hand is just syntactic sugar for 2's complement, i.e. -01
is completely equivalent to FF
.
If we take the example solution for the first problem (and modify it slightly, which breaks it, but this is just an example):
MOV 022 @80 000
MOV 030 @C0 000
PIX @80 001 000
ADD @80 *C0 @80
ADD @81 001 @81
JGR 00B @81 -0C
MOV 000 @81 000
ADD @C0 001 @C0
JMP @08 000 000
000 000 000 000
000 000 000 000
000 000 000 000
-01 -10 000 000
That would be 50 bytes of code (up to the -10
).