So, I'm in assembly class, and to keep things interesting, we have tournaments bi-weekly with Core Wars. I'm trying to make a simple application that copies an IMP further down in memory, then jumps back and has two IMPs going at the same time. The idea is once I get this part working to put it into a tight loop and make more than two.
Here's my code:
JMP START ; Jump to the starting point
ADDR DAT #1, #0 ; Remember the last address we dropped at
MOVE MOV 0, 1 ; The imp to be copied
START ; Starting point
ADD #-1, ADDR ; Take 1 off the address
ADD #80, ADDR ; Move 80 forward
ADD #1, ADDR ; Make that 81
MOV MOVE, ADDR ; Move the imp to the ADDR
SPL ADDR ; Split a new processes at the ADDR
JMP MOVE
However, what's happening is the first MOV
/SPL
doesn't work, and so only the first IMP is running. Where am I going wrong in this logic? It works if I remove ADDR
and just use a magic number.
Here's a screen snippet of the memory before it starts running.
Thanks.