home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TIERRA40.ZIP / DOC / RND_INST.DOC < prev    next >
Text File  |  1992-09-11  |  5KB  |  136 lines

  1.                         TIERRA Opcode Map Scrambler 
  2.                               - RND_INST -
  3.                             by Daniel Pirone
  4.  
  5.  
  6. PURPOSE:
  7.  
  8.    This document describes a software tool that aids in the creation of 
  9.  pseudo-random opcode # to instruction mnemonic mappings for the Tierra 
  10.  Artificial Life Simulation (1). 
  11.  
  12. THE INTERFACE:
  13.  
  14.    The rnd_inst user interface is a simple command line driven system. 
  15.  All of the menu options are Case Sensative (Turn Caps Lock Off).
  16.  Running rnd_inst with no options will produce the following help message:
  17.    
  18. > syntax - rnd_inst infile outfile [op1 op2 hamm_dist] [op3 op4 hamm_dist]...
  19. >     infile, outfile can be '-' for stdin, stdout
  20. >     op1, op2 are mnemonics, 
  21. >     & hamm_dist is the desired Hamming distance between op1 and op2
  22.  
  23.  From this we see that you must provide at least 2 parameters:
  24.  
  25.    - infile , the first param, specifying an existing path and opcode filename 
  26.      ( eg opcode.map ).
  27.    - outfile , the second param, specifying the path and scrambled opcode 
  28.      filename ( eg mix1.map ).
  29.  
  30.  The most common use of rnd_inst might be the following:
  31.  
  32. > rnd_inst opcode.vir opcode.map nop_0 nop_1 1
  33.  
  34.  This will produce a randomized mapping of opcodes to mnemonics, but one in
  35.  which the two nops are separated by a single bit flip.  This command reads
  36.  the virgin map, and writes the randomized version to opcode.map, which is
  37.  file read by arg and other tools, and the default file read by tierra.
  38.  
  39.  Remeber to reassemble the genomes with arg, before you try to run tierra with
  40.  a new opcode map!
  41.  
  42.  In place of either the infile or outfile, you may specify a dash '-',
  43.  meaning to use the standard input ( keyboard, < ) and standard output
  44.  ( screen, > ).  An example where we take a normal Tierra map file and 
  45.  scramble it, printing to the screen is:
  46.  
  47. > rnd_inst opcode.map -
  48.  
  49.  Which produces:
  50.  
  51. >     {0x00, "sub_ac", math, psub_ac},
  52. >     {0x01, "adrb", adr, padrb},
  53. >     {0x02, "pop_ax", pop, ppop_ax},
  54. >     {0x03, "jmp", adr, ptjmp},
  55. >     {0x04, "ret", pop, pret},
  56. >     {0x05, "zero", movdd, pzero},
  57. >     {0x06, "inc_b", math, pinc_b},
  58. >     {0x07, "pop_bx", pop, ppop_bx},
  59. >     {0x08, "inc_a", math, pinc_a},
  60. >     {0x09, "shl", shl, pshl},
  61. >     {0x0a, "pushax", push, ppushax},
  62. >     {0x0b, "or1", or1, por1},
  63. >     {0x0c, "pop_cx", pop, ppop_cx},
  64. >     {0x0d, "pushdx", push, ppushdx},
  65. >     {0x0e, "call", tcall, ptcall},
  66. >     {0x0f, "divide", divide, pdivide}
  67. >     {0x10, "pushcx", push, ppushcx},
  68. >     {0x11, "nop_0", nop, pnop},
  69. >     {0x12, "moviab", movii, pmoviab},
  70. >     {0x13, "adrf", adr, padrf},
  71. >     {0x14, "pop_dx", pop, ppop_dx},
  72. >     {0x15, "nop_1", nop, pnop},
  73. >     {0x16, "dec_c", math, pdec_c},
  74. >     {0x17, "inc_c", math, pinc_c},
  75. >     {0x18, "mov_cd", movdd, pmov_dc},
  76. >     {0x19, "mov_ab", movdd, pmov_ba},
  77. >     {0x1a, "sub_ab", math, psub_ab},
  78. >     {0x1b, "pushbx", push, ppushbx},
  79. >     {0x1c, "if_cz", if_cz, pif_cz},
  80. >     {0x1d, "mal", malchm, pmal},
  81. >     {0x1e, "jmpb", adr, ptjmpb},
  82. >     {0x1f, "adr", adr, padr},
  83.  
  84.    Please note that Tierra has strict opcode map file syntax. All spacing
  85.  and punctuation are important. Tierra will accept partial map files though
  86.  ( less than 32 , or out of order op - inst maps).
  87.  
  88.    Following the infile and outfile parameters is an optional triplet.  
  89.  This triplet must have the form:
  90.  
  91.    - mnemonic_1 mnemonic_2 int_hamm_dist
  92.  
  93.  Where  mnemonic_1 & 2 are valid instruction names ( eg dec_c , mal ),
  94.  and int_hamm_dist is a non-negative integer in the range 1 - 5, usually 1
  95.  or 2, representing the desired Hamming distance between the two specified
  96.  instructions. ( Hamming distance = number of bits different )
  97.  A common use for this can be seen below:
  98.  
  99. >  rnd_inst opcode.map - nop_1 nop_0 2
  100.  
  101.  Producing ...
  102.  
  103. >     {0x00, "adr", adr, padr},
  104. >     {0x01, "jmp", adr, ptjmp},
  105. >     {0x02, "moviab", movii, pmoviab},
  106. >     {0x03, "shl", shl, pshl},
  107. >     {0x04, "nop_0", nop, pnop},
  108. >     {0x05, "pop_bx", pop, ppop_bx},
  109. >     {0x06, "adrb", adr, padrb},
  110. >     {0x07, "sub_ac", math, psub_ac},
  111. >     {0x08, "nop_1", nop, pnop},
  112. >     {0x09, "inc_b", math, pinc_b},
  113. >     {0x0a, "pushbx", push, ppushbx},
  114. >     {0x0b, "sub_ab", math, psub_ab},
  115. > ...
  116.  
  117.    Note that the instructions nop_0 and nop_1 are in fact 2 bits apart.
  118.  Normally it is desirable to have these template instructions close,
  119.  to take full advantage of mutation.  It is probably best that nop_0 and
  120.  nop_1 have a hamming distance of 1. 
  121.  
  122.    Please send bug reports to : tierra-bug@life.slhs.udel.edu
  123.  
  124. -----------------------------------------------------------------------------
  125.  
  126. (1) Tierra is available by anonymous ftp from:
  127.  
  128. tierra.slhs.udel.edu ( 128.175.41.33 )
  129.  
  130. or by mail on disk from Virtual Life, P.O. Box 625, Newark, DE 19715.
  131. Make check for $65 payable to Virtual Life, and specify 3.5" or 5.25" disks.
  132.  
  133. -----------------------------------------------------------------------------
  134.