Re: Core Wars Update

new topic     » goto parent     » topic index » view thread      » older message » newer message

>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!)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu