Corelife Addressing Examples ---------------------------- +------------+ |label: mnem | Here is a representation of a cell in corelife. |i(dX,Y) | |i(dX,Y) | +------------+ +-+-+-+- | | | | This represents a piece of the battlefield, with the top left +-+-+-+- square being the top left of your program. | | | | +-+-+-+- | | | | ============================================================================== Now on to examples of addressing... Indirect relative--Suppose we had a cell like this: +-----------+ |cellA: move| The move command takes the cell given by the first |^(0,0) | arguement, and moves it to the place given by the |^(1,0) | second. +-----------+ This would move itself to the location one step to the right. If you were to then have the program flow pointing to the right, it would proceed to the new cell, which would then move itself over, then proceed to the right, forming a little line that would continue until it was stopped by something else. +-+-+-+- +-+-+-+- | | | | | | | | +-+-+-+- +-+-+-+- | |A| | -> | |A|A| +-+-+-+- +-+-+-+- | | | | | | | | Indirect absolute: +-----------+ |cellA: move| |^(0,0) | |&(0,0) | +-----------+ This would move itself to the top lefthand corner of your program (Not to the top lefthand of the battlefield). +-+-+-+- +-+-+-+- | | | | |A| | | +-+-+-+- +-+-+-+- | |A| | -> | |A| | +-+-+-+- +-+-+-+- | | | | | | | | Indirect relative, Direct relative +-----------+ |cellA: move| |^(0,0) | |^(^1,0) | +-----------+ This would move itself to the location stored in a cell to the right of it. For instance, say we had a data cell to the right like this: +-----------+ |cellB: data| Note that you can simply write (0,1) instead, as "#" is |#(#0,1) | the default. +-----------+ Then it would write to the cell below it. Note that you can simply write (0,1) instead, as "#" is the default. +-+-+-+- +-+-+-+- | | | | | | | | +-+-+-+- +-+-+-+- | |A|B| -> | |A|B| +-+-+-+- +-+-+-+- | | | | | |A| | Indirect DATA relative, direct relative: +-----------+ |cellA: move| |^(0,0) | |@(^cellB) | +-----------+ This would move itself to the location stored in a cell to the right of it, offset from the DATA cell. The placement is the same as in the first. Note that the label can be used to replace it's location. If you need to perform some sort of operation the X and Y components, say, pre-increment one and post-decrement the other, it would be @(^>cellB,cellB<). +-----------+ |cellB: data| |(0,1) | +-----------+ Then it would write to the cell below cellB. +-+-+-+- +-+-+-+- | | | | | | | | +-+-+-+- +-+-+-+- | |A|B| -> | |A|B| +-+-+-+- +-+-+-+- | | | | | | |A| Indirect Absolute, direct relative: +-----------+ |cellA: move| |^(0,0) | |&(^1,0) | +-----------+ This would move itself to the location stored in a cell to the right of it absolutely. +-----------+ |cellB: data| |(0,1) | +-----------+ Then it would write to the cell relative to the top lefthand corner. +-+-+-+- +-+-+-+- | | | | | | | | +-+-+-+- +-+-+-+- | |A|B| -> |A|A|B| +-+-+-+- +-+-+-+- | | | | | | | | There are many more combinations possible, but hopefully these few examples will be helpful in playing Corelife. Jesse Chang Corelife addressing help v1.0 4/27/95