DarwinBotsManual
Open the app EspañolES

*

Reads memory at a computed address: pops an address from the stack and pushes what is in that cell.

Facts

Word
*
Family
Basic
Integer stack
pops 1, pushes 1
What it does
Pops an address and pushes what is in that cell. Outside 1 to 1000 the sign is dropped and the remainder of dividing by 1000 is taken; 0 reads 1000. With an empty stack it reads 1000.
Cost
Basic command
Runs
inside a gene: in the condition (cond) and in the body (start or else)

address * does the same as the read with the asterisk attached, but with the address taken from the stack: 60 * pushes the same as *60. The difference is that the address can come out of a calculation, and that lets you walk through memory as if it were a table.

For example, the eyes .eye1 to .eye9 occupy cells 501 to 509. This bot stores in cell 50 which eye it wants to look at (1 to 9) and copies what that eye sees to cell 60:

cond
start
  ' the address is 500 + the eye number
  500 *50 add * 60 store
stop

As in any read, the address goes through the same rule: its sign is removed and the remainder of dividing by 1000 is taken, and a 0 reads cell 1000 (0 * reads 1000, 1050 * reads 50). There is no way to read outside the bot's memory.