write a Program that converts uppercase character to lower case letter character.
Declare function
char toLower( char ch);
to do the conversion.if ch is not an uppercase character the function should return ch unchanged.
if it is an uppercase character ,add the difference of 'a' and 'A' to ch as the return value.
Write your program with a global variable for the actual parameter.
Translate to Pep/9 assembly language. Pep/9 assembly language Only please
main:
push rbp
mov rbp, rsp
sub rsp, 16
nop
call getchar
mov DWORD PTR [rbp-4], eax
cmp DWORD PTR [rbp-4], -1
je .L3
mov eax, DWORD PTR [rbp-4]
mov edi, eax
call chartolower
mov edi, eax
call putchar
nop
.L3:
mov eax, 0
leave
ret
chartolower:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
cmp DWORD PTR [rbp-4], 64
jle .L7
cmp DWORD PTR [rbp-4], 90
jg .L7
mov eax, DWORD PTR [rbp-4]
add eax, 32
jmp .L9
.L7:
mov eax, DWORD PTR [rbp-4]
.L9:
pop rbp
ret
Get Answers For Free
Most questions answered within 1 hours.