N
newyj
Unregistered / Unconfirmed
GUEST, unregistred user!
谁能帮我把下面的 汇编转为delphi
unit pcm;
interface
function ALowtoLinear(code:byte):word;
function LinearToALow(code:word):byte;
implementation
var
return :word;
function ALowtoLinear(code:byte):word;
begin
asm
mov al,
unit pcm;
interface
function ALowtoLinear(code:byte):word;
function LinearToALow(code:word):byte;
implementation
var
return :word;
function ALowtoLinear(code:byte):word;
begin
asm
mov al,
代码:
xor al,0d5h //invert even bit
mov cl,al
and ax,0fh
shl al,1
inc al
shl cx,1 //ch=sign
shr cl,5 //cl=seg
dec cl
js @NoSeg
or al,20h
shl ax,cl
@NoSeg:
shl ax,3
shr ch,1
jnc @Positive
neg ax
@Positive:
mov [return],ax
end;
result := return;
end;
function LinearToALow(code:word):byte;
begin
asm
mov ax,[code]
cmp ax,8000h
jne @Normal
mov al,0ffh
jmp @Finally
@Normal:
xor cl,cl
mov ch,ah
and ch,80h //ch=sign
jz @Positive
neg ax
@Positive:
cmp ax,100h
jnb @Seg
shr al,4
or al,ch
jmp @Finally
@Seg:
cmp ax,4000h
jnb @NoSHL
inc cl //cl=seg
shl ax,1
jmp @Seg
@NoSHL:
and ax,3fffh
shr ax,10
sub cl,7
neg cl
shl cl,4
or al,cl
or al,ch
@Finally:
xor al,0d5h //invert even bit
mov byte ptr [return],al
end;
result := byte(return);
end;
end.