Skip to content

Commit

Permalink
Move core and warrior articles to guide to corewar
Browse files Browse the repository at this point in the history
  • Loading branch information
gareththegeek committed Jul 2, 2018
1 parent 64b464b commit eeeabaa
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
5 changes: 5 additions & 0 deletions docs/corewar/core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Core

TODO not sure if this belong here or in corewar guide

##Addresses
6 changes: 3 additions & 3 deletions docs/redcode/warriors.md → docs/corewar/warriors.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Warriors

##Processes
#Warriors

##Processes
3 changes: 0 additions & 3 deletions docs/redcode/core.md

This file was deleted.

6 changes: 3 additions & 3 deletions docs/redcode/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ The following notional registers are used:

The first step in execution is fetch. During this step the `simulator` determines the instruction to be executed by populating the `Instruction Register`.

First, the current [warrior](warriors) is determined (see [warriors](warriors) for details).
First, the current [warrior](../corewar/warriors) is determined (see [warriors](../corewar/warriors) for details).

Next the current [process](warriors#processes) is determined for the current warrior (see [processes](processes) for details).
Next the current [process](../corewar/warriors#processes) is determined for the current warrior (see [processes](processes) for details).

The `instruction pointer` for the current process is determined.

Expand All @@ -44,7 +44,7 @@ The evaluated address from the `B` operand is used to retrieve and store an inst

The final step in execution is execute.

First the current [process's](warriors#processes) `instruction pointer` is incremented (so that the process will execute the next instruction in core when it is next executed).
First the current [process's](../corewar/warriors#processes) `instruction pointer` is incremented (so that the process will execute the next instruction in core when it is next executed).

Next the `Instruction Register` instruction's [opcode](opcodes) and [modifier](modifiers) are used to determine the operation to perform.

Expand Down
4 changes: 2 additions & 2 deletions docs/redcode/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Redcode Reference
=================

Redcode is the languaged used to write [warriors](warriors) for the game Corewar.
Redcode is the languaged used to write [warriors](../corewar/warriors) for the game Corewar.

Redcode resembles assembly language, with each instruction being composed of an [opcode](opcodes) and two [operands](operands).

Expand All @@ -21,7 +21,7 @@ MOV.I $0, $1

In addition to the opcode and operands from the input instruction, the parsed output contains the [modifier](modifiers) `.I` and the [addressing mode](addressing_modes) used for each operand (`$`).

You can (but don't have to) specify the modifier and addressing modes in your source redcode.
You can (but don't have to) specify the modifier and addressing modes in your source redcode. Using different modifiers and addressing modes allow you to change the behaviour of opcodes in interesting ways.

## Standards

Expand Down
16 changes: 8 additions & 8 deletions docs/redcode/opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following `opcodes` can be used in Corewar

##Dat - Data

If one of a warrior's [processes](warriors#processes) executes a `dat` instruction it is removed from the process queue i.e. terminated. This is the main way that [warriors](warriors) are killed within the game of Corewar.
If one of a warrior's [processes](../corewar/warriors#processes) executes a `dat` instruction it is removed from the process queue i.e. terminated. This is the main way that [warriors](../corewar/warriors) are killed within the game of Corewar.

Note that termination of the warrior's process happens after the [operand](operands) [addressing modes](addressing_modes) are evaluated. See [execution](execution) for details.

Expand Down Expand Up @@ -104,7 +104,7 @@ The [.i](modifiers#i) modifier has the same effect as the [.f](modifiers#f) modi

The default modifier for the `div` opcode is [.ab](modifiers#ab).

Dividing by zero is considered an illegal instruction in Corewar. The executing warrior's [process](warriors#processes) is removed from the process queue (terminated).
Dividing by zero is considered an illegal instruction in Corewar. The executing warrior's [process](../corewar/warriors#processes) is removed from the process queue (terminated).

Note that termination of the warrior's process happens after the [operand](operands) [addressing modes](addressing_modes) are evaluated. See [execution](execution) for details.

Expand All @@ -120,13 +120,13 @@ The [.i](modifiers#i) modifier has the same effect as the [.f](modifiers#f) modi

The default modifier for the `mod` opcode is [.ab](modifiers#ab).

Dividing by zero is considered an illegal instruction in Corewar. The executing warrior's [process](warriors#processes) is removed from the process queue (terminated).
Dividing by zero is considered an illegal instruction in Corewar. The executing warrior's [process](../corewar/warriors#processes) is removed from the process queue (terminated).

Note that termination of the warrior's process happens after the [operand](operands) [addressing modes](addressing_modes) are evaluated. See [execution](execution) for details.

##Jmp - Jump

The `jmp` instruction changes the address of the next instruction which will be executed by the currently executing [process](warriors#processes). The most common usages of this opcode are to create a loop or to skip over a section of code.
The `jmp` instruction changes the address of the next instruction which will be executed by the currently executing [process](../corewar/warriors#processes). The most common usages of this opcode are to create a loop or to skip over a section of code.

The `jmp` instruction will jump execution to the address given by the instruction's A [operand](operands). The B operand has no purpose within the `jmp` instruction. However the B operand will still be evaluated, see [addressing_modes](addressing_modes).

Expand Down Expand Up @@ -202,7 +202,7 @@ The default modifier for the `djn` opcode is [.b](modifiers#b).

The `cmp` opcode is an alias for `seq` used to support legacy [corewar standards](./#standards). `cmp` and `seq` work in exactly the same way within Corewar.

The `seq` instruction compares the number(s) at the addresses specified by its source and destination [operands](operands) and if they are equal, increments the next address to be executed by the current [process](warriors#processes) by one - in effect skipping the next instruction. Skip instructions are commonly used to develop scanners which scan the [core](core) looking for other [warriors](warriors).
The `seq` instruction compares the number(s) at the addresses specified by its source and destination [operands](operands) and if they are equal, increments the next address to be executed by the current [process](../corewar/warriors#processes) by one - in effect skipping the next instruction. Skip instructions are commonly used to develop scanners which scan the [core](core) looking for other [warriors](../corewar/warriors).

The instruction's [modifier](modifiers) determines what at the two addresses is compared for equality. Importantly, using a modifier of [.i](modifiers#i) will compare the entire source and destination instructions. This means even if the instructions differ only by opcode, modifier or [addressing mode](addressing_modes), the next instruction will be skipped.

Expand All @@ -216,7 +216,7 @@ The default modifier for the 'sne' opcode is [.i](modifiers#i).

##Slt - Skip if Less Than

The `slt` instruction compares the number(s) at the addresses specified by its source and destination [operands](operands). If the source number(s) are less than than the destination number(s), the next address to be executed by the current [process](warriors#processes) is incremented by one - in effect skipping the next instruction.
The `slt` instruction compares the number(s) at the addresses specified by its source and destination [operands](operands). If the source number(s) are less than than the destination number(s), the next address to be executed by the current [process](../corewar/warriors#processes) is incremented by one - in effect skipping the next instruction.

The instruction's [modifier](modifiers) controls which operands are compared at the source and destination addresses according to the following table:

Expand All @@ -238,7 +238,7 @@ The default modifier for the 'slt' opcode is [.b](modifiers#b).

##Spl - Split

The `spl` instruction spawns a new [process](warriors#processes) for the current [warrior](warriors) at the address specified by the A [operand](operands).
The `spl` instruction spawns a new [process](../corewar/warriors#processes) for the current [warrior](../corewar/warriors) at the address specified by the A [operand](operands).

The newly created process is added to the process queue **after** the currently executing process.

Expand All @@ -260,7 +260,7 @@ For example `spl 3` will be parsed as `SPL.B $3, $0`.

##Nop - No Operation

The `nop` instruction does not perform any operation. The instruction takes a single cycle to execute as normal, and [addressing modes](addressing_modes) are evaluated as normal. One potential use of the `nop` instruction is to introduce a delay in execution when working on a [multi-process](warriors#processes) warrior.
The `nop` instruction does not perform any operation. The instruction takes a single cycle to execute as normal, and [addressing modes](addressing_modes) are evaluated as normal. One potential use of the `nop` instruction is to introduce a delay in execution when working on a [multi-process](../corewar/warriors#processes) warrior.

[Modifiers](modifiers) have no effect on the `nop` instruction.

Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ repo_url: https://github.com/gareththegeek/corewar
pages:
- Home: index.md
- Guide to Corewar: corewar/index.md
- Core: corewar/core.md
- Warriors: corewar/warriors.md
- Redcode Reference:
- Intro: redcode/index.md
- Execution: redcode/execution.md
- Core: redcode/core.md
- Warriors: redcode/warriors.md
- Operands: redcode/operands.md
- Opcodes: redcode/opcodes.md
- Modifiers: redcode/modifiers.md
Expand Down

0 comments on commit eeeabaa

Please sign in to comment.