char name[25];
int generated_int;
for(int i = 0; i<sizeof(name); i++)
{
name[i] = (char)0;
}
cout << "Name: ";
cin >> name;
int nameLen = strlen(name);
__asm
{
pusha;
mov esi, &name //I got error here, I cant use "&". How to move name address to esi?
mov ecx, nameLen
mov ebx, 45
start:
mov al, [esi]
and eax, 0xFF
mul ebx
inc esi
add edi, eax
inc ebx
dec ecx
jnz start
mov generated_serial, edi
popa
}
cout << endl << "Serial: " << generated_serial << endl << endl;
我不知道如何獲得我的chay數組在asm塊中的地址。 當我嘗試使用「&」時,例如&名字我得到錯誤,而編譯:inline asm in C++ in vs __asm
error C2400: inline assembler syntax error in 'second operand'; found 'AND'
UPDATE:
MOV ESI,名字給我這個編譯錯誤:C2443:操作數大小衝突
更新2: LEA工作正常。
mov esi,名稱給我這個編譯錯誤:C2443:操作數大小衝突 – Hooch 2011-05-18 12:59:46