Assembly 装配-更换箱
我在用AT&T的语法写作。 这个循环应该检查,如果大小写在61-7A ASCII范围内(它的意思是这个小写字母)-如果否,则将其转换为空格“”Assembly 装配-更换箱,assembly,att,i386,Assembly,Att,I386,我在用AT&T的语法写作。 这个循环应该检查,如果大小写在61-7A ASCII范围内(它的意思是这个小写字母)-如果否,则将其转换为空格“” change: movb (%esi), %bh #move case temporary to bh register cmp $0x61,%bh #compare 'a' ASCII and case from bh register jge nothing #if a
change:
movb (%esi), %bh #move case temporary to bh register
cmp $0x61,%bh #compare 'a' ASCII and case from bh register
jge nothing #if ascii from bh is greater than 'a', jump to nothing
cmp $0x7A,%bh
jle nothing #same, if is in range 61-7A jump to nothing
movb $0x20,%bh #if wasn't in range, change to 20 ASCII (space)
nothing:
movb %bh, (%esi) #put case back into string
addl $1,%esi #move pointer to the next case
loop change
这是我的循环。ESI是指向字符串的指针
我的问题很简单——这不起作用,我不知道为什么 第一个条件跳转错误
change:
movb (%esi), %bh #move case temporary to bh register
cmp $0x61,%bh #compare 'a' ASCII and case from bh register
jl space #if ascii from bh is greater than 'a', jump to nothing
cmp $0x7A,%bh
jle nothing #same, if is in range 61-7A jump to nothing
space:
movb $0x20,%bh #if wasn't in range, change to 20 ASCII (space)
nothing:
movb %bh, (%esi) #put case back into string
addl $1,%esi #move pointer to the next case
loop change
您的
nic
标签在哪里定义?您也可以只说inc%esi
而不是addl$1,%esi
。保存一些指令字节/周期。:)我的错误,抱歉-nic的意思是“没什么”,我把它从波兰语翻译过来,忘了更改。