#i386 code for upper(char* str) convert string to upper case .globl upper upper: movl 4(%esp), %ebx #string pointer from stack xorl %eax, %eax #count=0 (customary trick to zero a register) uloop: movb (%ebx), %ch # while (next Char) cmpb $0, %ch jz udone cmpb $'a', %ch # if char >= 'a' jl endif andb $0xdf, %ch # zero case bit movb %ch, (%ebx) endif: incl %ebx # str++ incl %eax #count++ jmp uloop udone: ret # count is in eax