Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
x86 pentium NASM lowercase to uppercase !
Hi....i've been trying for days to complete a program that asks for a word input and prints it out in capitals.I searched in the forums but i only found TASM assembly...i need NASM...
Here is the program,i've managed to make it print out 1-the first- character (e.g. if i write "hello" it will print out "h"...i need it to print out "HELLO"):
; Objective: To print the capital equivalent of the entered character(s).
; Input: Requests the character(s) from keyboard.
; Output: Prints the ASCII character of the input in capital letters.
char_prompt db "Please input character(s): ",0
out_msg1 db "The equivalent of '",0
out_msg2 db "' in capital letter(s) is ",0
mov EAX, char_prompt ;EAX=please input characters %
call print_string ;print char_prompt
call read_char ;read character fro user input
mov EBX, EAX ;copy EAX to EBX
call print_nl ;print new line
mov EAX, out_msg1
mov EAX, EBX
mov EAX, out_msg2
mov EAX, EBX
cmp AL, 'a' ;
jl not_lowercase ; if lower than "a" jump to not_lowercase
cmp AL, 'z' ;
jg not_lowercase ; if greater than "z" jump to not_lowercase
add AL, 'A' - 'a' ; convert to uppercase
sub AL, 20
mov EAX, 0
Hope it's not too much to ask...thanks in advance.