Reputation: 1
I have this safe1:
START:
PUSH AX
MOV word [0D5h], 0
MOV CX, 2
looper:
add [0D5h], AX
MOV AX, [0D5h]
MUL CX
INC CX
cmp word [0D5h], 0D287h
jne looper
POP AX
JMP START
and I'm stuck on how to find AX, because I can set [0D5h]
to 0D287h
whenever to break the inner loop so I know that the framework will probably be something like:
start:
;... get ax
mov word [0D5h], 0D287h
jmp start
At least that's what I understand, so does anyone have any ideas?
Footnote 1: safe challenges
For those unfamiliar with the safe challenge, I'll give a basic explanation first:
You get a safe which is a NASM compiled assembly 8086 code that does arithmetic actions and also loops forever, for a key to win it needs to run more than the safe, which means it has to also loop forever but also stop the safe's loop. How you may ask well, the key and safe are separate in everything but the memory so for example if you wanted to stop this safe:
start:
mov [0DAh], ax
jmp start
the key for this safe is:
start:
mov bx, [0DAh]
mov byte [bx], 0cch
jmp start
Upvotes: 0
Views: 92
Reputation: 39471
I have never understood what these 'safe challenges' are about, but I immediately saw next 2 solutions that stop the safe's inner loop, and then repeat ad infinitum:
jne looper
is never takenjne looper
is taken 1 timeThe word value at [0D5h]
successively becomes x, 3x, 12x, 60x, 360x, ...
and D287h happens to be divisible by 1 and 3.
Upvotes: 1