作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Possible Duplicate:
x86 convert to lower case assembly
在我的问题中,我有一个二维字符数组,我需要将所有内容更改为小写。
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
到另一个地方。
最佳答案
LEA esi, [esi+20]
我把它放在第二个循环中的两个跳转指令之间。感谢那些阅读我的问题的人。
关于c - 在 Assembly x86 中遍历二维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11660291/
我是一名优秀的程序员,十分优秀!