问题:Delphi内联汇编取随机数
描述:

function GetNumber(Min, Max: Integer): Integer;
begin
  asm
    push ecx
    push edx
    rdtsc
    mov ecx, $17
    mul ecx
    add eax, $7
    mov ecx, dword ptr ss:[ebp+$C]
    sub ecx, dword ptr ss:[ebp+$8]
    inc ecx
    xor edx, edx
    div ecx
    add edx, dword ptr ss:[ebp+$8]
    mov eax, edx
    pop edx
    pop ecx
    leave
    retn $8
  end;
  Result := 0;
end;

编译报错:[dcc32 Error] utMain.pas(133): E2116 Invalid combination of opcode and operands
在VC2012里编译通过
解决方案1:

function GetNumber(Min, Max: Integer): Integer; stdcall;
asm
  push ecx
  push edx
  rdtsc
  mov ecx, $17
  mul ecx
  add eax, $7
  mov ecx, dword ptr ss:[ebp+$C]
  sub ecx, dword ptr ss:[ebp+$8]
  inc ecx
  xor edx, edx
  div ecx
  add edx, dword ptr ss:[ebp+$8]
  mov eax, edx
  pop edx
  pop ecx
  leave
  ret $8
end;

上一篇从通达信day文件读出股票数据,然后增加若干条记录怎么重新写入day文件中呢
下一篇如何修改这种情况的txt?
明星图片
相关文章
《Delphi内联汇编取随机数》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)