可能重复:
x86 转换为小写程序集
在我的问题中,我有一个二维字符数组,我需要将所有内容都更改为小写。
char list[100][20] = {{"ArtUro"}, {"Bryan"}, {"chris"}, {"David"}, {"Jon"}, {"Mark"}, {"shane"}, {"SIMON"}, {"Thomas"}, {"TONY"}};
我有
int b_search (char list[100][20], int count, char* token)
{
__asm
{
mov eax, 0 ; zero out the result
mov esi, list ; move the list pointer to ESI
mov ebx, count ; move the count into EBX
mov edi, token ; move the token to search for into EDI
MOV ecx, 0
LOWERCASE_ARRAY: ;for(ecx = 0, ecx<ebx; ecx++), loops through each name
CMP ecx, ebx
JGE GET_OUT
INC ecx ;ecx++
MOV edx, 0; ;edx = 0
LOWERCASE_STRING: ;while next char != 0, loop through each byte to convert to lower case
OR [esi+edx],20h ;change to lower case
INC edx
CMP [esi+edx],0 ;if [esi+edx] not zero, loop again
JNZ LOWERCASE_STRING
JMP LOWERCASE_ARRAY ;jump back to start case change of next name
GET_OUT:
我成功地将 ArtUro 转换为小写,但我无法弄清楚如何将数组遍历到 Bryan 的地址,因为我无法按 20 进行缩放,而添加 20 会导致我ESI
到另一个地方。