I was writing some programs, using questions in a book by Kip Irvine, for practice. I'd already done conversion from lower case to upper case using AND. Now, I figured I'd do it the other way round, upper case to lower case. Here is my program:
.386 .model flat, stdcall option casemap:none CR EQU 13 LF EQU 10 include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data prompt BYTE "Please Enter A String:", CR,LF, 0 prompt1 BYTE "OutPut:", 0 .data? inp BYTE 120 DUP(?) .code main PROC INVOKE StdOut, ADDR prompt INVOKE StdIn, ADDR inp, 120 pushad INVOKE StripLF, ADDR inp popad CALL rev INVOKE StdOut, ADDR prompt1 INVOKE StdOut, ADDR inp INVOKE ExitProcess,0 main ENDP rev PROC mov ecx, SIZEOF inp mov esi, OFFSET inp L1: or BYTE PTR [esi], 00100000b inc esi loop L1 RET rev ENDP END mainSorry, I didn't write any comments. I basically used a procedure for the case conversion and masm32 library for input and output.
Here is the sample IO:
Quote
C:\masm32\CODE>toLowerCase.exe
Please Enter A String:
HELLO
OutPut:hello *
C:\masm32\CODE>toLowerCase.exe
Please Enter A String:
HELLO WORLD
OutPut:hello world *
Please Enter A String:
HELLO
OutPut:hello *
C:\masm32\CODE>toLowerCase.exe
Please Enter A String:
HELLO WORLD
OutPut:hello world *
I am fixed about the '*' character at the end of the string and cant seem to get it out. I also used the StripLF procedure to remove Carriage Return and Line Feed characters. The only time the '*' disappeared was when i changed the length of 'inp', corresponding to the exact length of the string entered by the user. Please help me out!
Thanks!
Devjeet


Sign In
Create Account

Back to top









