汇编问题!在线等待

lijixue 2002-12-11 10:28:31
怎样调用汇编语言。用什么语句。
...全文
25 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzrlover 2002-12-11
  • 打赏
  • 举报
回复
如果你是
mov al,True

改为
mov EAX,True
lijixue 2002-12-11
  • 打赏
  • 举报
回复
那是我的错误。应是mov al,true
可现在这里有错误。
wzrlover 2002-12-11
  • 打赏
  • 举报
回复
mov al,edx
al是存贮低8位地寄存器,EDX是存储32位地寄存器,

因此要改为
mov EAX,EDX

具体调用情况没试过。
不对之处还请指正!
xzgyb 2002-12-11
  • 打赏
  • 举报
回复
同意wzrlover(流光逝水)
lijixue 2002-12-11
  • 打赏
  • 举报
回复
to:流水逝光
现在还有一处错误请看代码
unit li2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

const
id_bit = $20000;


type
tcpuid = array[1..4] of longint;
tvendor = array[0..11] of char;
implementation

function iscpuid_available :boolean; register;
asm
pushfd {direct access to flags no possible, only via stack}
pop eax
mov edx,eax
xor eax,id_bit
push eax
popfd
pop eax
xor eax,edx
jz @exit
mov al,ture 此处有错误
@exit:
end;
function getcpuid :tcpuid; assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,1
dw $a20f
stosd
mov eax,ebx
stosd
mov eax,ecx
stosd
mov eax,edx
stosd
pop edi
pop ebx
end;
function getcpuvendor :tvendor ;assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,0
dw $a20f
mov eax,ebx
xchg ebx,ecx
mov ecx,4
@1:
stosb
shr eax,8
loop @1
mov eax,edx
mov ecx,4
@2:
stosb
shr eax,8
loop @2
mov eax,ebx
mov ecx,4
@3:
stosb
shr eax,8
loop @3
pop edi
pop ebx
end;
end.

[Error] li2.pas(29): Undeclared identifier: 'ture'
wzrlover 2002-12-11
  • 打赏
  • 举报
回复
编译通过,

unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

const
id_bit = $20000;

type
Tcpuid = array[1..4] of longint;
Tvendor = array[0..11] of char;

implementation

function iscpuid_available :boolean; register;
asm
pushfd {direct access to flags no possible, only via stack}
pop eax
mov edx,eax
xor eax,id_bit
push eax
popfd
pop eax
xor eax,edx
jz @exit
//mov al,edx
mov EAX,edx //<<------
@exit:
end;
function getcpuid :tcpuid; assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,1
dw $a20f
stosd
mov eax,ebx
stosd
mov eax,ecx
stosd
mov eax,edx
stosd
pop edi
pop ebx
end;
function getcpuvendor :tvendor ;assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,0
dw $a20f
mov eax,ebx
xchg ebx,ecx
mov ecx,4
@1:
stosb
shr eax,8
loop @1
mov eax,edx
mov ecx,4
@2:
stosb
shr eax,8
loop @2
mov eax,ebx
mov ecx,4
@3:
stosb
shr eax,8
loop @3
pop edi
pop ebx
end;
end.
lijixue 2002-12-11
  • 打赏
  • 举报
回复
你们看一下代码呀。老大们
wzrlover 2002-12-11
  • 打赏
  • 举报
回复
函数定义不要在接口部分!
type
tcpuid = array[1..4] of longint;
tvendor = array[0..11] of char;

implementation

function .....
begin
asm
...
end;
end;
......
macula55 2002-12-11
  • 打赏
  • 举报
回复
asm
汇编语句
...
end;
lijixue 2002-12-11
  • 打赏
  • 举报
回复
现在一到asm就有错误
[Error] Unit2.pas(18): Statements not allowed in interface part
请帮我解决一下。
lijixue 2002-12-11
  • 打赏
  • 举报
回复
上边的傻子。这个问题用你答呀。你看一下代码。在发言吧
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

const
id_bit = $20000;


type
tcpuid = array[1..4] of longint;
tvendor = array[0..11] of char;

function iscpuid_available :boolean; register;
asm
pushfd {direct access to flags no possible, only via stack}
pop eax
mov edx,eax
xor eax,id_bit
push eax
popfd
pop eax
xor eax,edx
jz @exit
mov al,edx
@exit:
end;
function getcpuid :tcpuid; assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,1
dw $a20f
stosd
mov eax,ebx
stosd
mov eax,ecx
stosd
mov eax,edx
stosd
pop edi
pop ebx
end;
function getcpuvendor :tvendor ;assembler;register;
asm
push ebx
push edi
mov edi,eax
mov eax,0
dw $a20f
mov eax,ebx
xchg ebx,ecx
mov ecx,4
@1:
stosb
shr eax,8
loop @1
mov eax,edx
mov ecx,4
@2:
stosb
shr eax,8
loop @2
mov eax,ebx
mov ecx,4
@3:
stosb
shr eax,8
loop @3
pop edi
pop ebx
edn;
end.
languageqq 2002-12-11
  • 打赏
  • 举报
回复
asm,你傻呀
phm 2002-12-11
  • 打赏
  • 举报
回复
up
xzgyb 2002-12-11
  • 打赏
  • 举报
回复
其实True就是1
可以
mov eax, 1
就行
lijixue 2002-12-11
  • 打赏
  • 举报
回复
还是那个错误

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧