Professional Documents
Culture Documents
Icws 88
Icws 88
----------------------------
[Note: This text is reproduced from the article "Core War '88 - A Proposed
Standard" by Thomas Gettys which appeared in the Summer 1988 edition of The Core
War Newsletter, Copyright (c) 1988 by AMRAN. It appears here by the permission
of AMRAN and the International Core War Society, both of which retain the
aforementioned copyright. Although the original appears in several different
proportional fonts, every effort has been made to maintain pagination, columns,
and paragraphs as in the original document. Therefore, references to either
document should be the same. Additional information is available by contacting
the ICWS at 5712 Kern Drive, Huntington Beach, CA 92649-4535. A $1.00 donation
for this document is requested.]
URL: ftp://ftp.csua.berkeley.edu/pub/corewar/documents/standards/redcode-icws-88.Z
SLT A B: if A is less than B then For the most part, the Redcode
skip next instruction instruction set presents no unusual
problems, and the implementation is
DJN A B: decrement B; if B is not straight-forward. Some additional
zero then jump to A definition and clarification is
required however to insure that it is
SPL A B: place A in the process implemented correctly.
queue
DAT A B : This instruction actually
Figure 1. Instruction set ofthe serves two functions, one utilitarian,
proposed Core War Standard of 1988. and the other quite destructive. On
the one hand, it is used for the
storage of data to be used as a
counter, pointer, etc. If executed
however, the process is halted! This,
then, is the mechanism by which one
obtains victory in a Core War: cause
every process associated with the
opponent's program to execute a DAT
instruction.
Page 8
location specified by the A operand is Blank lines are used solely for
placed at the back of the process queue cosmetic purposes in the source and
associated with the executing program. listing files. Blank lines enhance
readability by allowing groups of
SPL A B : After a process has caused an related instructions to be easily
SPL instruction to be fetched, the separated.
program counter is incremented and
placed at the back of its process All comments are introduced by a
queue. The address ot the spawned semicolon, (;). Comments may be placed
process is then placed at the back of anywhere within the source file. All
the same queue, providing the queue is characters following the semicolon are
not full. The B operand does not ignored.
necessarily participate in the
execution of this instruction. A Redcode instruction consists of five
components (fields) : an optional
Effective Address Calculations. label, the instruction mnemonic, the
A and B operands, and an optional
The fetch-decode phase of Redcode comment. Fields are separated by one
instruction execution is complicated or more space and/or tab characters.
somewhat by the predecrement-indirect
addressing mode. After the instruction Labels begin in the first column and
to be executed has been fetched, the are composed of alpha-numeric
operands must be "normalised" before characters. Only the first eight
the opcode is processed. That is, the characters of a label are significant.
operands are processed so as to remove If a label is present, it will take
any indirection. Because this may the current value of the program
involve the modification of memory, the counter.
order of evaluation must be specified
exactly. An operand consists of the addressing
mode symbol followed by an expression
First the A addressing mode is that is composed of labels, number,
examined. If immediate, we are done. and operator symbols. The valid
Otherwise, the program counter is added operators are addition (+),
to the value in the A-field, yielding subtraction (-), multiplication (*),
an absolute address. If direct, we are and integer division (/).
done. Otherwise, the B-field of this
direct memory location is read into the A pseudo-instruction is adirective to
A-field. If predecrement is indicated, the assembler; object code is not
the value just read is decremented and generated by a pseudo instruction. The
written back to the memory location mnemonic and definition of each pseudo
from whence it came. Finally, the instruction follows.
program counter is added to the value
in the A-field. EQU : The EQU pseudo-instruction must
be preceded by a label, and foloowed
At this point the A-field either by an expression which is consistent
contains immediate data or else it with the rules governing operand
contains the absolute address of the A expressions. The value of the
operand. The same procedure is now expression is the value associated
performed to normalise the B operand. with the label. The expression may
With bother operands now normalised, contain such other labels as a priorly
the operation code is examined and the defined.
specified operation performed.
END : The END pseudo-instruction
One final aspect of instruction follows the last line to be assembled.
execution remains to be resolved. All lines following the END statement
Because of the process queue FIFO's are ignored. Additionally, if an
implied by the SPL instruction, the operand is provided, it will be used
updating of the program counter as the program entry point. If no
associated with the current process operand appears, the entry point is
must be delayed until the opcode is assumed to be the first instruction
processed. If the instruction does not line in the file.
require a branch to be taken and the
instruction is not a DAT, the program Appendix A
counter is incremented and placed at
the back ot the process queue The following is a complete list of
associated with the executing program all legal Redcode instructions under
before the instruction is executed. this proposed standard.
Page 9
ADD # A B JMP A # B
ADD # A @ B JMP A B DAT # A # B
ADD # A < B JMP A @ B DAT # A < B
ADD A B JMP A < B DAT < A # B
ADD A @ B JMP @ A # B DAT < A < B
ADD A < B JMP @ A B
ADD @ A B JMP @ A @ B
ADD @ A @ B JMP @ A < B
ADD @ A < B JMP < A # B
ADD < A B JMP < A B
ADD < A @ B JMP < A @ B
ADD < A < B JMP < A < B
SUB # A B JMZ A # B
SUB # A @ B JMZ A B
SUB # A < B JMZ A @ B
SUB A B JMZ A < B
SUB A @ B JMZ @ A # B
SUB A < B JMZ @ A B
SUB @ A B JMZ @ A @ B
SUB @ A @ B JMZ @ A < B
SUB @ A < B JMZ < A # B
SUB < A B JMZ < A B
SUB < A @ B JMZ < A @ B
SUB < A < B JMZ < A < B
CMP # A B JMN A # B
CMP # A @ B JMN A B
CMP # A < B JMN A @ B
CMP A B JMN A < B
CMP A @ B JMN @ A # B
CMP A < B JMN @ A B
CMP @ A B JMN @ A @ B
CMP @ A @ B JMN @ A < B
CMP @ A < B JMN < A # B
CMP < A B JMN < A B
CMP < A @ B JMN < A @ B
CMP < A < B JMN < A < B
Page 13