SHOW:
|
|
- or go back to the newest paste.
1 | - | '//asm |
1 | + | |
2 | ||
3 | const iLen = TestLen | |
4 | ||
5 | - | const iAT = asc("A") xor asc("T") |
5 | + | |
6 | - | const iCG = asc("C") xor asc("G") |
6 | + | |
7 | mov esi, [dna] 'input | |
8 | lea edi, [pOut] 'output | |
9 | mov ecx, iLen 'length | |
10 | sub edi, 4 | |
11 | - | mov ecx, iLen 'length |
11 | + | |
12 | mov edx, [esi] 'read 4 chars | |
13 | - | mov al, [esi] 'read char |
13 | + | add esi, 4 'point to next char |
14 | - | add esi, 1 'point to next char |
14 | + | mov eax, edx 'make a copy of those 4 chars |
15 | - | test al, 2 'char & 2? |
15 | + | and edx, 0x02020202 'isolate bit 1... (2) |
16 | - | mov dl, iAT 'dl = iAT (if true) |
16 | + | xor edx, 0x02020202 'invert so... 2 = CG , 0 = AT |
17 | - | je 1f 'skip if true |
17 | + | lea ebx, [edx*8] 'ebx = N*8 |
18 | - | mov dl, iCG 'dl = iCG (if false) |
18 | + | shr edx, 1 'edx = N\2 |
19 | - | 1: |
19 | + | add edx, ebx 'edx = N*8+N\2 |
20 | - | xor al, dl 'char ^ dl |
20 | + | or edx, &h04040404 'edx ^ 4 (21 or 4) |
21 | - | mov [edi], al 'store char |
21 | + | add edi, 4 'point to next out char |
22 | - | add edi, 1 'point to next out char |
22 | + | xor eax, edx 'chars ^ edx |
23 | - | sub ecx, 1 'decrement counter |
23 | + | sub ecx, 4 'decrement counter |
24 | - | jnz 0b |
24 | + | mov [edi], eax 'store char |
25 | jnz 0b | |
26 | end asm | |
27 | - | end function |
27 | + | |
28 | end function | |
29 |