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.

%include "asm_io.inc"
segment .data
char_prompt db "Please input character(s): ",0
out_msg1 db "The equivalent of '",0
out_msg2 db "' in capital letter(s) is ",0

segment .text
global _asm_main
enter 0,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
call print_string
mov EAX, EBX
call print_char
mov EAX, out_msg2
call print_string
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
call print_char
sub AL, 20
loop process_char

mov EAX, 0

Hope it's not too much to ask...thanks in advance.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!