我需要将“h4ppy c0d1ng”转换为“H4PPY C0D1NG”。我是这种语言的初学者,但这是我的尝试(ubuntu i386 VirtualBox Mac)。我认为 int 21h 是错误的,除了程序在执行时不会完成也不会打印字符串:
section .text
GLOBAL _start
_start:
mov ecx, string
mov edx, length
call toUpper
call print
mov eax, 1
mov ebx, 0
int 80h
;String in ecx and length in edx?
;-------------------------
toUpper:
mov eax,ecx
cmp al,0x0 ;check it's not the null terminating character?
je done
cmp al,'a'
jb next_please
cmp al,'z'
ja next_please
sub cl,0x20
ret
next_please:
inc al
jmp toUpper
done: int 21h ; just leave toUpper (not working)
print:
mov ebx, 1
mov eax, 4
int 80h
ret
section .data
string db "h4ppy c0d1ng", 10
length equ $-string