1. Core Wars Update
Hi all,
Thanks to the digests Sitar sent, I 've been able to get
up-to-date about the Core Wars posts. Here's where I am
on the upgrade, along with a few other thoughts...
I've decided that I will not be integrating a compiler
into the program (sorry, Buddy.) Not that it would be
difficult, but I like the idea of everyone being able to
choose a compiler with the features they like... so as
long as your compiler spits out a compatible sequence of
atoms, it'll be valid for Core War to load. That way, you
can allow/disallow labels, expressions, etc.
I'm already implementing the SPL command (it'll be the
digit 8 and use the second operand as the address to
begin the new thread, for those wanting to put it into
their compilers). I'll also take some time cleaning things
up. I have found myself wanting some sort of "less-than"
or "greater-than" branch instruction before, so I'm
considering something like a Jump-if-Greater-Than (JGT)
instruction. Anyone know exactly how the CMP function
works?
I'm not planning on compliance to any standard. Letting
people write their own compilers should take care of some
of that. If anything, I'm hoping that eventual acceptance
(and sheer inertia) of whatever we come up here will
become a CW standard of sorts.
Oh, and I'm still trying to think of ways to do this all in
some text-based form; hopefully it'll be an option when this
is finished. I'll be somewhat busy this week though, so I
plan to be done by Monday of next week.
Rod
2. Re: Core Wars Update
>I've decided that I will not be integrating a compiler
>into the program (sorry, Buddy.) Not that it would be
>difficult, but I like the idea of everyone being able to
>choose a compiler with the features they like... so as
>long as your compiler spits out a compatible sequence of
>atoms, it'll be valid for Core War to load. That way, you
>can allow/disallow labels, expressions, etc.
Can you make it easy to plug in a compiler? That way, by adding an include
statement and modifying a little code, and the source files can be loaded up
directly with some command... I haven't tried it yet, but I understand that
it's pretty easy to do currently. Can you keep it that way? :)
>I'm already implementing the SPL command (it'll be the
>digit 8 and use the second operand as the address to
>begin the new thread, for those wanting to put it into
>their compilers). I'll also take some time cleaning things
>up. I have found myself wanting some sort of "less-than"
>or "greater-than" branch instruction before, so I'm
>considering something like a Jump-if-Greater-Than (JGT)
>instruction. Anyone know exactly how the CMP function
>works?
CMP has mostly been replaced with Skip If EQual (SEQ). Basically because
they are the exact same thing. :)
CMP compares the two addresses, if they are equal, the it does a JMP 2,
otherwise, it does the next statement. I think it compares the whole
instruction.
start CMP -10, 10 ; Compare two addresses
JMP found ; They are different, do something
JMP start ; They're the same, continue scanning
I think a JGT won't make much since. It would have to compare two addresses,
right? Then it'd have to jump somewhere. Umm, where? Both the A and B fields
are already used. :)
A Skip if Less Than (SLT) is standard, and if you reverse the values, it can
mimic a SGT (which doesn't exist).
start SLT 1, @test
JMP found ;@test = more than or equal to 1;
ADD #1, test
JMP start ; @test is less than 1. (In this case, it's 0)
test DAT 5
(I hope my code is correct!)
3. Re: Core Wars Update
Robert Pilkington wrote:
>>I've decided that I will not be integrating a compiler
>>into the program (sorry, Buddy.)
<snip>
>Can you make it easy to plug in a compiler? That way, by adding an include
>statement and modifying a little code, and the source files can be loaded up
>directly with some command... I haven't tried it yet, but I understand that
>it's pretty easy to do currently. Can you keep it that way? :)
Definitely.
>>or "greater-than" branch instruction before, so I'm
>>considering something like a Jump-if-Greater-Than (JGT)
>>instruction. Anyone know exactly how the CMP function
>>works?
>
>CMP has mostly been replaced with Skip If EQual (SEQ). Basically because
>they are the exact same thing. :)
I suspected as much. Then I'll bypass this; it's fairly easy
to emulate (just subtract the two values, and jump-if-zero).
>I think a JGT won't make much since. It would have to compare two addresses,
>right? Then it'd have to jump somewhere. Umm, where? Both the A and B fields
>are already used. :)
>
>A Skip if Less Than (SLT) is standard, and if you reverse the values, it can
>mimic a SGT (which doesn't exist).
Hmm, then I'll look into adding SLT as the final instruction.
No need to be different just to be different.
Rod