怎样调用汇编语言。用什么语句。
解决方案 »
- dbgrid 父子表 一个删除按钮
- timer 如何让时间复位
- 文件保护驱动
- 如何取时间格式为200501010809呢。
- 关于DELPHI中EXE的调用?
- 拜托了各位老大,我的rave报表里,为什么老是就一页?????????
- 如何使adotable中的数据按照某个字段排序呢?
- delphi的电子图书馆
- 我用QUERY,DATASOURE,TABLE 三个控件实现对表的查找过滤! 那有没有办法让我把它做成activex控件!然后导入到VB中使用,提供一个表输出结果!
- 谁能让这个程序可以传参数??急急!!(源码见内)
- 菜鸟求救…………………………在线等候!!!!
- 一个菜鸟简单的delphi 问题
unit Unit2;interfaceuses
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.
[Error] Unit2.pas(18): Statements not allowed in interface part
请帮我解决一下。
汇编语句
...
end;
type
tcpuid = array[1..4] of longint;
tvendor = array[0..11] of char;implementationfunction .....
begin
asm
...
end;
end;
......
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;implementationfunction 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.
现在还有一处错误请看代码
unit li2;interfaceuses
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;
implementationfunction 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'
al是存贮低8位地寄存器,EDX是存储32位地寄存器,因此要改为
mov EAX,EDX具体调用情况没试过。
不对之处还请指正!
可现在这里有错误。
mov al,True改为
mov EAX,True
可以
mov eax, 1
就行