The code Should work like this: read a character from the input and look if it is a uppercase Letter repeat the reading until a non uppercase character is read in print out all the uppercase characters starting with the newest read in letter for example: A B C E f
E C B A .... my question would be how do i use the stack to find out if every letter has been printed when is the end reached. and if the first read in char is a non uppercase char it should print out an error message
Start:
call read_char ;reading a char and comparing if it is a uppercase letter
mov ebx,eax
call read_char ;if a non uppercase letter is read in jump to print label
cmp ebx,65
jb PrintChar
cmp ebx,90
ja PrintChar
push ebx ;pushing the char onto the stack and repeating the process
jmp Start
PrintChar:
loop:
pop eax ;pop the char from the stack to the eax register and print it
call print_char
jmp loop ;repeat this process until all char are printed out (this code is not written)
MessageFail:
mov eax,msg_fail ;if the stack was empty (the first input a lovercase letter) print a fail message
call print_string
call print_nl
jmp Ende
Ende: