Advertisement
Mysoft

Untitled

Oct 8th, 2020
2,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dna_strand4(dna as const zstring ptr) as zstring ptr
  2.  
  3.   const iLen = TestLen
  4.    
  5.   static as zstring*(TestLen+1) pOut
  6.   asm
  7.     mov esi, [dna]    'input
  8.     lea edi, [pOut]   'output
  9.     mov ecx, iLen     'length    
  10.     sub edi, 4    
  11.     0:
  12.       mov edx, [esi]      'read 4 chars
  13.       add esi, 4          'point to next char      
  14.       mov eax, edx        'make a copy of those 4 chars
  15.       and edx, 0x02020202 'isolate bit 1... (2)
  16.       xor edx, 0x02020202 'invert so... 2 = CG , 0 = AT
  17.       lea ebx, [edx*8]    'ebx = N*8
  18.       shr edx, 1          'edx = N\2
  19.       add edx, ebx        'edx = N*8+N\2
  20.       or edx, &h04040404  'edx ^ 4 (21 or 4)
  21.       add edi, 4          'point to next out char
  22.       xor eax, edx        'chars ^ edx
  23.       sub ecx, 4          'decrement counter
  24.       mov [edi], eax      'store char
  25.     jnz 0b  
  26.   end asm  
  27.   return @pOut
  28. end function
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement