News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Silly strings

Started by bcddd214, September 15, 2011, 09:59:13 PM

Previous topic - Next topic

bcddd214

Not a total n00b but I will sound like one with this question.
Just reviewing masm with Irvine32 when I realized I forgot how to display a string.

I get to this point and draw a blank.

Using the following code, how do I get masm to 'write' the inputted name and then convert to Uppercase and then output that?


INCLUDE Irvine32.inc

;################################################

.data
promptStr SBYTE ?
mes1 BYTE "Enter Your Name: ",0

;################################################

.code
   main PROC
   mov edx, offset mes1
   call writestring
    call readint
;   call convUpper
    call PromptI
   call dumpregs
   exit
main    ENDP

;################################################

PromptI PROC

      call    readint
      call   crlf
   ret
PromptI ENDP



;convUpper PROC
;   mov eax,0
;   call clrscr
;        ret
;InpProc ENDP


INVOKE  ExitProcess,0

END main

bcddd214

I know that converting to uppercase is subtracting 10 from the binary/hex value but how to flip it off the register just has me at a loss right now.

dedndave

to convert a character to lower case...
        or      al,20h

to convert a character to upper case...
        and     al,0DFh

the Irvine lirary has a few functions to display strings
some require the string to be in memory (zero-terminated)
some require the value to be in EAX
WriteBin ; write integer to output in binary format
WriteBinB ; write binary integer in byte, word,or doubleword format
WriteChar ; write single character to output
WriteDec ; write unsigned decimal integer to output
WriteFloat ; write ST(0) to console in floating-point format
WriteHex ; write hexadecimal integer to output
WriteHexB ; write hexadecimal integer in word or doubleword format
WriteInt ; write signed integer to output
WriteString ; write null-terminated string to output
WriteToFile ; write a buffer to an output file
WriteWindowsMsg ; write last error message generated by MS-Windows