我用的是MASM615~後來看了一下
原來是我放錯地方了@@
寫的差不多了~只是有點小BUG~
大轉小是OK的~小轉大有點問題~例如我輸入kinco 他會出現KiNcO
~小弟看了很久~找不到問題在哪~
請大大~有發現問題所在的話~告知小弟一下~謝謝~
語法:
INCLUDE Irvine32.inc
.data
prompt BYTE "Enter your name: ",0Dh,0Ah,0 ;定義對話串
MAX = 80 ;max chars to read
stringIn BYTE MAX+1 DUP (?) ;room for null
.code
main PROC
mov edx, OFFSET prompt ;顯示對話
call WriteString ;印出edx裡面的字串
call crlf ;空一行
mov edx, OFFSET stringIn
mov ecx, MAX ;buffer size - 1
call ReadString
mov ecx, 0
mov esi, 0
mov ecx, LENGTHOF stringIn
mov esi, OFFSET stringIn
L1:
mov al,byte ptr[esi]
OR al, 11011111b
cmp al, 11111111b ;判斷是不是小寫
je L2 ;如果是小寫就跳到L2
jmp L3 ;如果不是就跳到L3
L2:
AND byte ptr[esi], 11011111b ;小->大
inc esi
L3:
OR byte ptr[esi], 00100000b ;大->小
inc esi
next:
loop L1
call Writestring
call Crlf ;空一行
exit
main ENDP
END main