Redcode

Redcode

"This article is about the abstract programming language. For the video codec used in the Red One camera, see Red Digital Cinema Camera Company."

Redcode is the name of the programming language used in the game Core War. It is executed by a virtual machine known as a "Memory Array Redcode Simulator", or "MARS". The design of Redcode is loosely based on actual CISC assembly languages of the early 1980s era, but contains several features not usually found in actual computer systems.

Key Language Features

;No numeric instruction values: The Redcode standard leaves the underlying representation of instruction codes undefined, and provides no means for programs to directly access it. Arithmetic operations may only be done on the two address fields contained in each instruction. The only operations supported on the instruction codes themselves are copying and comparison for equality.;No absolute addressing: All addresses are interpreted as offsets relative to the instruction containing them. Since the address space wraps around, it is in fact impossible for a Redcode program to determine its absolute address.;Low level multiprocessing: Instead of a single instruction pointer a Redcode simulator has a number of "process queues", each containing a variable number of instruction pointers which the simulator cycles through. New processes may be added to the queue using the SPL instruction.

Other notable features of Redcode include:

;No external access: Redcode and the MARS architecture provide no input or output functions. The simulator is a closed system, with the only input being the initial values of the memory and the process queues, and the only output being the outcome of the battle, i.e. which programs had surviving processes. Of course, the simulator may still allow external inspection and modification of the memory while the simulation is running. ;Constant instruction length and time: Each Redcode instruction occupies exactly one memory slot and takes exactly one cycle to execute. The rate at which a process executes instructions, however, depends on the number of other processes in the queue, as processing time is shared equally.;Relatively few instructions: The earliest published version Redcode had only eight instructions, while the currently used version has eighteen. However, it should be noted that Redcode supports a number of different addressing modes and (in later versions) instruction modifiers which increase the actual number of possible opcodes to several thousand.;All addresses are valid: All numbers in Redcode are treated as unsigned integers, and the maximum integer value is set to equal the number of memory locations minus one. Thus each integer is a valid address, and each memory location has exactly one valid address. Numbers that would fall outside the valid range are wrapped around according to the usual rules of modulo arithmetic.;Circular memory: As a consequence of the above and the lack of absolute addressing, the memory space (or "core") appears to the programs in it as a circle with no definite start or end. A process that encounters no invalid or jump instructions can continue executing successive instructions endlessly, eventually returning to the instruction where it started.

A number of variants of Redcode exist. The earliest versions described by A. K. Dewdney differ in many respects from the later standards established by the International Core War Society, and could be considered a different, albeit related, language. The form of Redcode most commonly used today is based on a draft standard submitted to the ICWS in 1994 that was never formally accepted, as the ICWS had become effectively defunct around that time. Development of Redcode, however, has continued in an informal manner, chiefly via online forums such as the " [news:rec.games.corewar rec.games.corewar] " newsgroup.

Earliest versions

The earliest published description of Redcode is found in the [http://www.ociw.edu/~birk/COREWAR/DOCS/guide2red.txt "Core War Guidelines"] published in March 1984 by A. K. Dewdney and D. G. Jones. The language as described here differs significantly from the later variants, being in many ways closer to actual assembly languages of the era.

The Guidelines describe a set of only eight instructions, but it is stated that the earliest implementations of Redcode by Dewdney and Jones had a larger instruction set. Indeed, the language described in the Guidelines is best seen more as a basis for other developers to expand on than as an actual standard.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Redcode — Saltar a navegación, búsqueda Redcode es un lenguaje que se asemeja al lenguaje ensamblador, creado específicamente para ser interpretado por un MARS (ver Core War) y más simplificado que un lenguaje ensamblador convencional. Redcode posee… …   Wikipedia Español

  • Redcode — Redcode  язык программирования, созданный специально для игры «Бой в памяти». Авторство языка принадлежит Александру К. Дьюдни, который разместил список команд в своей статье. Язык похож на ассемблер, но не до конца. Вот код к языку: MOV A B …   Википедия

  • Redcode — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • Memory Array Redcode Simulator — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • Core War — A game of Core War running under the pMARS simulator Original author(s) D. G. Jones A. K. Dewdney Initial release 1984 Type Pro …   Wikipedia

  • Red Digital Cinema Camera Company — Red Digital Cinema Camera Company …   Википедия

  • CoreWar — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • Core War — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • Corewar — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • ICWS — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”