1

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.

Screen Snippet of Memory

Thanks.

4

1 回答 1

2

改变:

MOV MOVE, ADDR   ; Move the imp to the ADDR
SPL ADDR         ; Split a new processes at the ADDR

至:

MOV MOVE, @ADDR   ; Move the imp to the ADDR
SPL @ADDR         ; Split a new processes at the ADDR

如果您希望循环工作,请更改JMP MOVE为。JMP START

另外,您应该将第一行更改ORG STARTJMP START


我想我误解了你的部分问题,看起来你只是想创建两个 imp 进程,而我说要创建一个循环,如果你让它像这样,你只有 2 个 imps 运行:

org start

addr dat #0, #1

start
    add #80, addr
    mov imp, @addr
    spl @addr

imp mov $0, $1

但它不会跳回到开头并覆盖原始指令。

于 2015-04-25T09:11:50.103 回答