This appendix contains the assembler source code for the 82 instruction ancestor written for instruction set four, and three descendant organisms that evolved from the ancestor. The three descendants are derived from different runs, and represent forms found after optimization was apparently complete in each run. The three evolved forms illustrate three levels of loop unrolling: 1) no unrolling, level 1, 2) unrolling to level 2, and 3) unrolling to level 3.
GENOTYPE: 0082aaa ancestor for instruction set 4
nop1 ; 01 0 beginning marker nop1 ; 01 1 beginning marker nop1 ; 01 2 beginning marker nop1 ; 01 3 beginning marker zero ; 13 4 CX = 0, offset for search adrb ; 1c 5 find start, AX = start + 4, DX = templ size nop0 ; 00 6 complement to beginning marker nop0 ; 00 7 complement to beginning marker nop0 ; 00 8 complement to beginning marker nop0 ; 00 9 complement to beginning marker pushax ; 05 10 push start + 4 on stack popcx ; 0b 11 pop start + 4 into CX sub ; 12 12 CX = CX - DX, CX = start pushcx ; 07 13 push start on stack zero ; 13 14 CX = 0, offset for search adrf ; 1d 15 find end, AX = end, CX = offset, DX = templ size nop0 ; 00 16 complement to end marker nop0 ; 00 17 complement to end marker nop0 ; 00 18 complement to end marker nop1 ; 01 19 complement to end marker pushax ; 05 20 push end on stack popcx ; 0b 21 pop end into CX inc ; 0f 22 increment to include dummy instruction at end popdx ; 0c 23 pop start into DX sub ; 12 24 CX = CX - DX, AX = end, CX = size, DX = start nop1 ; 01 25 reproduction loop marker nop1 ; 01 26 reproduction loop marker nop0 ; 00 27 reproduction loop marker nop1 ; 01 28 reproduction loop marker mal ; 1e 29 AX = daughter, CX = size, DX = mom call ; 1a 30 call copy procedure nop0 ; 00 31 copy procedure complement nop0 ; 00 32 copy procedure complement nop1 ; 01 33 copy procedure complement nop1 ; 01 34 copy procedure complement divide ; 1f 35 create daughter cell jmpb ; 19 36 jump back to top of reproduction loop nop0 ; 00 37 reproduction loop complement nop0 ; 00 38 reproduction loop complement nop1 ; 01 39 reproduction loop complement nop0 ; 00 40 reproduction loop complement ifz ; 16 41 dummy instruction to separate templates nop1 ; 01 42 copy procedure template nop1 ; 01 43 copy procedure template nop0 ; 00 44 copy procedure template nop0 ; 00 45 copy procedure template pushcx ; 07 46 push size on stack pushdx ; 08 47 push start on stack pushdx ; 08 48 push start on stack popbx ; 0a 49 pop start into BX nop1 ; 01 50 copy loop template nop0 ; 00 51 copy loop template nop1 ; 01 52 copy loop template nop0 ; 00 53 copy loop template dec ; 10 54 decrement size movii ; 04 55 move from [BX + CX] to [AX + CX] ifz ; 16 56 test when to exit loop jmp ; 18 57 exit loop nop0 ; 00 58 copy procedure exit complement nop1 ; 01 59 copy procedure exit complement nop0 ; 00 60 copy procedure exit complement nop0 ; 00 61 copy procedure exit complement jmpb ; 19 62 jump to top of copy loop nop0 ; 00 63 copy loop complement nop1 ; 01 64 copy loop complement nop0 ; 00 65 copy loop complement nop1 ; 01 66 copy loop complement ifz ; 16 67 dummy instruction to separate jmp from template nop1 ; 01 68 copy procedure exit template nop0 ; 00 69 copy procedure exit template nop1 ; 01 70 copy procedure exit template nop1 ; 01 71 copy procedure exit template popdx ; 0c 72 pop start into DX popcx ; 0b 73 pop size into CX popax ; 09 74 pop call IP into AX jmp ; 18 75 jump to call (return) ifz ; 16 76 dummy instruction to separate jmp from template nop1 ; 01 77 end marker nop1 ; 01 78 end marker nop1 ; 01 79 end marker nop0 ; 00 80 end marker ifz ; 16 81 dummy instruction to separate creatures
GENOTYPE: 0023awn
call ; 1a 0 push ip + 1 on stack popcx ; 0b 1 pop ip + 1 into CX dec ; 10 2 CX = start pushcx ; 07 3 save start on stack zero ; 13 4 CX = 0 divide ; 1f 5 cell division, will fail first time adrf ; 1d 6 AX = end + 1 nop0 ; 00 7 pushax ; 05 8 push end address on stack popcx ; 0b 9 CX = end address + 1 popdx ; 0c 10 DX = start address sub ; 12 11 (CX = CX - DX) CX = size adr ; 1b 12 this instruction will fail pushdx ; 08 13 put start address on stack mal ; 1e 14 allocate daughter, AX = start of daughter popbx ; 0a 15 BX = start address nop0 ; 00 16 top of copy loop dec ; 10 17 decrement size movii ; 04 18 copy byte to daughter ifz ; 16 19 if CX == 0 jump to address in AX (start of daughter) jmp ; 18 20 jmpb ; 19 21 jump back to line 17 (top of copy loop) nop1 ; 01 22
GENOTYPE: 0024aah
call ; 1a 0 push ip + 1 on stack popcx ; 0b 1 pop ip + 1 into CX dec ; 10 2 CX = start pushcx ; 07 3 save start on stack zero ; 13 4 CX = 0 adrf ; 1d 5 AX = end + 1 nop1 ; 01 6 pushax ; 05 7 push end address on stack divide ; 1f 8 cell division, will fail first time popcx ; 0b 9 CX = end address + 1 popdx ; 0c 10 DX = start address sub ; 12 11 (CX = CX - DX) CX = size pushdx ; 08 12 put start address on stack popbx ; 0a 13 BX = start address mal ; 1e 14 allocate daughter, AX = start of daughter nop1 ; 01 15 top of copy loop dec ; 10 16 decrement size movii ; 04 17 copy byte to daughter dec ; 10 18 decrement size movii ; 04 19 copy byte to daughter ifz ; 16 20 if CX == 0 jump to address in AX (start of daughter) jmp ; 18 21 jmpb ; 19 22 jump back to line 16 (top of copy loop) nop0 ; 00 23
GENOTYPE: 0035bfj
call ; 1a 0 push ip + 1 on stack popcx ; 0b 1 pop ip + 1 into CX dec ; 10 2 CX = start pushcx ; 07 3 save start on stack adrf ; 1d 4 dummy instruction divide ; 1f 5 cell division, will fail first time movid ; 03 6 dummy instruction (AX = 0x1a, call instruction) zero ; 13 7 CX = 0 adrf ; 1d 8 AX = end + 1 nop1 ; 01 9 pushax ; 05 10 push end address on stack popcx ; 0b 11 CX = end address + 1 adrf ; 1d 12 dummy instruction popdx ; 0c 13 DX = start address pushdx ; 08 14 push start address on stack pushdx ; 08 15 push start address on stack sub ; 12 16 (CX = CX - DX) CX = size mal ; 1e 17 allocate daughter, AX = start of daughter pushdx ; 08 18 push start address on stack popbx ; 0a 19 BX = start address pushbx ; 06 20 push start address on stack mal ; 1e 21 allocate daughter, AX = start of daughter (fails) put ; 0d 22 dummy instruction (write to get buffer of other creature) nop1 ; 01 23 nop1 ; 01 24 top of copy loop dec ; 10 25 decrement size movii ; 04 26 copy byte to daughter dec ; 10 27 decrement size movii ; 04 28 copy byte to daughter ifz ; 16 29 if CX == 0 jump to address in AX (start of daughter) jmpb ; 19 30 dec ; 10 31 decrement size movii ; 04 32 copy byte to daughter jmpb ; 19 33 jump back to line 25 (top of copy loop) nop0 ; 00 34