I'm trying to learn redcode, because it looks fun to make a warrior.
Introduction
For those who don't know what redcode is, here's a short explenation. It's an ASM-like language, but far more easy an stripped. It is used to write little programs that need to shut down other programs in a virtual memory. (See for more info here: http://vyznev.net/corewar/guide.html)
Here's a piece of code:
;redcode
;name Mice
;author Chip Wendell
;strategy paper (replicator)
;history Winner of the 1986 ICWS tournament
Top dat #0, #0
Start mov #12, Top
Loop mov @Top, <Target
djn Loop, Top
spl @Target,0
Spacer equ 653
add #Spacer,Target
jmz Start, Top
Target dat #0, #833
end Start
Problem
The basic stratgy is to replicate itself to another place, and the fork the process. What i don't understand is this rule:
Loop mov @Top, <Target
I understand the meaning of this line. It says, move the B-Field of target to the line where the B-Field of top points, and decrease the value of the B-Field of target.
When loop is executed for the first time, the first line will be:
Top dat #0, #12
As far as i get, the line with Loop thus means: Move the instruction 12 lines ahead (filled with dat #0, #0) to line 833.
But when this code is executed, the line of code is placed at line 839.
Does someone understand what is happening really?