diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-01-28 17:11:34 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-01-28 17:11:34 +0000 |
commit | 25850807e2bf868845cc35ab8ea14487eae1b66d (patch) | |
tree | e619449e0e01bed8316329890bce057ecbbcd8c7 /packages | |
parent | 6cc7d841c0f230f39bb54ede821e756f3511bbb4 (diff) | |
download | fpc-25850807e2bf868845cc35ab8ea14487eae1b66d.tar.gz |
* converted seg_xorword, seg_orword and seg_andword to pure asm routines
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@41097 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages')
-rw-r--r-- | packages/graph/src/go32v2/graph.pp | 201 |
1 files changed, 102 insertions, 99 deletions
diff --git a/packages/graph/src/go32v2/graph.pp b/packages/graph/src/go32v2/graph.pp index 13ba75ffa8..ac6e49ff0a 100644 --- a/packages/graph/src/go32v2/graph.pp +++ b/packages/graph/src/go32v2/graph.pp @@ -198,112 +198,115 @@ const CallInt10(mode); end; - procedure seg_xorword(segment : word;ofs : longint;count : longint;w : word); - begin - asm - push edi - mov edi, [ofs] - mov ecx, [count] - movzx edx, word ptr [w] - { load segment } - push es - mov ax, [segment] - mov es, ax - { fill eax } - mov eax, edx - shl eax, 16 - or eax, edx - test edi, 3 - jz @@aligned - xor word ptr es:[edi], ax - add edi, 2 - dec ecx - jz @@done + procedure seg_xorword(segment : word;ofs : longint;count : longint;w : word); assembler; + asm + {# Var segment located in register ax + # Var ofs located in register edx + # Var count located in register ecx + # Var w located at ebp+8, size=OS_16 } + push edi + mov edi, edx + { load segment } + push es + mov es, ax + { fill eax } + movzx edx, word ptr [w] + mov eax, edx + shl eax, 16 + or eax, edx + test edi, 3 + jz @@aligned + xor word ptr es:[edi], ax + add edi, 2 + dec ecx + jz @@done @@aligned: - mov edx, ecx - shr ecx, 1 -@@lp: xor dword ptr es:[edi], eax - add edi, 4 - dec ecx - jnz @@lp - test edx, 1 - jz @@done - xor word ptr es:[edi], ax -@@done: pop es - pop edi - end; + mov edx, ecx + shr ecx, 1 +@@lp: xor dword ptr es:[edi], eax + add edi, 4 + dec ecx + jnz @@lp + test edx, 1 + jz @@done + xor word ptr es:[edi], ax +@@done: + pop es + pop edi end; - procedure seg_orword(segment : word;ofs : longint;count : longint;w : word); - begin - asm - push edi - mov edi, [ofs] - mov ecx, [count] - movzx edx, word ptr [w] - { load segment } - push es - mov ax, [segment] - mov es, ax - { fill eax } - mov eax, edx - shl eax, 16 - or eax, edx - test edi, 3 - jz @@aligned - or word ptr es:[edi], ax - add edi, 2 - dec ecx - jz @@done + procedure seg_orword(segment : word;ofs : longint;count : longint;w : word); assembler; + asm + {# Var segment located in register ax + # Var ofs located in register edx + # Var count located in register ecx + # Var w located at ebp+8, size=OS_16 } + push edi + mov edi, edx + { load segment } + push es + mov es, ax + { fill eax } + movzx edx, word ptr [w] + mov eax, edx + shl eax, 16 + or eax, edx + test edi, 3 + jz @@aligned + or word ptr es:[edi], ax + add edi, 2 + dec ecx + jz @@done @@aligned: - mov edx, ecx - shr ecx, 1 -@@lp: or dword ptr es:[edi], eax - add edi, 4 - dec ecx - jnz @@lp - test edx, 1 - jz @@done - or word ptr es:[edi], ax -@@done: pop es - pop edi - end; + mov edx, ecx + shr ecx, 1 +@@lp: or dword ptr es:[edi], eax + add edi, 4 + dec ecx + jnz @@lp + test edx, 1 + jz @@done + or word ptr es:[edi], ax +@@done: + pop es + pop edi end; - procedure seg_andword(segment : word;ofs : longint;count : longint;w : word); - begin - asm - push edi - mov edi, [ofs] - mov ecx, [count] - movzx edx, word ptr [w] - { load segment } - push es - mov ax, [segment] - mov es, ax - { fill eax } - mov eax, edx - shl eax, 16 - or eax, edx - test edi, 3 - jz @@aligned - and word ptr es:[edi], ax - add edi, 2 - dec ecx - jz @@done + procedure seg_andword(segment : word;ofs : longint;count : longint;w : word); assembler; + asm + {# Var segment located in register ax + # Var ofs located in register edx + # Var count located in register ecx + # Var w located at ebp+8, size=OS_16 } + push edi + mov edi, edx + { load segment } + push es + mov es, ax + { fill eax } + movzx edx, word ptr [w] + mov eax, edx + shl eax, 16 + or eax, edx + test edi, 3 + jz @@aligned + and word ptr es:[edi], ax + add edi, 2 + dec ecx + jz @@done @@aligned: - mov edx, ecx - shr ecx, 1 -@@lp: and dword ptr es:[edi], eax - add edi, 4 - dec ecx - jnz @@lp - test edx, 1 - jz @@done - and word ptr es:[edi], ax -@@done: pop es - pop edi - end; + mov edx, ecx + shr ecx, 1 +@@lp: and dword ptr es:[edi], eax + add edi, 4 + dec ecx + jnz @@lp + test edx, 1 + jz @@done + and word ptr es:[edi], ax +@@done: + pop es + pop edi end; {************************************************************************} |