From news-rocq.inria.fr!jussieu.fr!esiee.fr!sgigate.sgi.com!rutgers!news.columbia.edu!news.new-york.net!news.stormking.com!morrell@math.utah.edu Thu Jun 27 18:27:21 1996
Article: 5523 of rec.games.corewar
Path: news-rocq.inria.fr!jussieu.fr!esiee.fr!sgigate.sgi.com!rutgers!news.columbia.edu!news.new-york.net!news.stormking.com!morrell@math.utah.edu
From: "Steven C. Morrell"
Newsgroups: rec.games.corewar
Subject: Using MOD.x to kill excess processes
Date: 27 Jun 1996 04:58:52 -0400
Organization: Storm King Ind. Inc.
Lines: 123
Sender: server@news.stormking.com
Distribution: world
Message-ID:
Reply-To: morrell@math.utah.edu
NNTP-Posting-Host: valhalla.stormking.com
Originator: corewar-l@stormking.com
Well, since Paul asked...
When you look at it,
MOD.x #a,#b
is a pretty cool instruction. Let's take
a close look. If a=0 or b=0, we get a divide by zero error that kills the
process that executes it, and (I think) the instruction doesn't change.
If a=b, then after one process executes it, we have
MOD.x #0,#0
which will kill all subsequent processes executing it.
If a>b and b!=0 then after a process executes this instruction, it becomes
MOD.x #b,#c
where c=a mod b. Note in this case, that b>c, and the next process that
executes this instruction will die if and only if c=0.
For completeness, if a**b.
mov.x data,data ;
done mod.x #0,#0
end
This would actually be useful for finding the "mod" value of any given
step-size if CORESIZE wasn't stored as 0. But, we can patch this by noting
that CORESIZE mod a = (CORESIZE-a) mod a (because a**