Assembler code for the central copy loop of the ancestor of instruction set one (80aaa) and a descendant after fifteen billion instructions (72etq). Within the loop, the ancestor does each of the following operations once: copy instruction (51), decrement CX (52), increment AX (59) and increment BX (60). The descendant performs each of the following operations three times within the loop: copy instruction (15, 22, 26), increment AX (20, 24, 31) and increment BX (21, 25, 32). The decrement CX operation occurs five times within the loop (16, 17, 19, 23, 27). Instruction 28 flips the low order bit of the CX register. Whenever this latter instruction is reached, the value of the low order bit is one, so this amounts to a sixth instance of decrement CX. This means that there are two decrements for every increment. The reason for this is related to another adaptation of this creature. When it calculates its size, it shifts left (12) before allocating space for the daughter (13). This has the effect of allocating twice as much space as is actually needed to accommodate the genome. The genome of the creature is 36 instructions long, but it allocates a space of 72 instructions. This occurred in an environment where the CPU time slice size was set equal to the size of the cell. In this way the creatures were able to garner twice as much energy. However, they had to compliment this change by doubling the number of decrements in the loop.
COPY LOOP OF 80AAA
nop1 ; 01 47 copy loop template nop0 ; 00 48 copy loop template nop1 ; 01 49 copy loop template nop0 ; 00 50 copy loop template movii ; 1a 51 move contents of [BX] to [AX] (copy instruction) dec_c ; 0a 52 decrement CX ifz ; 05 53 if CX = 0 perform next instruction, otherwise skip it jmp ; 14 54 jump to template below (copy procedure exit) nop0 ; 00 55 copy procedure exit compliment nop1 ; 01 56 copy procedure exit compliment nop0 ; 00 57 copy procedure exit compliment nop0 ; 00 58 copy procedure exit compliment inc_a ; 08 59 increment AX (point to next instruction of daughter) inc_b ; 09 60 increment BX (point to next instruction of mother) jmp ; 14 61 jump to template below (copy loop) nop0 ; 00 62 copy loop compliment nop1 ; 01 63 copy loop compliment nop0 ; 00 64 copy loop compliment nop1 ; 01 65 copy loop compliment (10 instructions executed per loop)
COPY LOOP OF 72ETQ
shl ; 03 12 shift left CX mal ; 1e 13 allocate daughter cell nop0 ; 00 14 top of loop movii ; 1a 15 copy instruction dec_c ; 0a 16 decrement CX dec_c ; 0a 17 decrement CX jmpb ; 15 18 junk dec_c ; 0a 19 decrement CX inc_a ; 08 20 increment AX inc_b ; 09 21 increment BX movii ; 1a 22 copy instruction dec_c ; 0a 23 decrement CX inc_a ; 08 24 increment AX inc_b ; 09 25 increment BX movii ; 1a 26 copy instruction dec_c ; 0a 27 decrement CX not0 ; 02 28 flip low order bit of CX, equivalent to dec_c ifz ; 05 29 if CX == 0 do next instruction ret ; 17 30 exit loop inc_a ; 08 31 increment AX inc_b ; 09 32 increment BX jmpb ; 15 33 go to top of loop (6 instructions per copy) nop1 ; 01 34 bottom of loop (18 instructions executed per loop)