Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

copy string and convert to upper case

copy string and convert to upper case

copy string and convert to upper case

This is what I have and think it is correct but the result shows up as all spaces... Im lost... Any help would be great. Thanks

TITLE process_strings
.MODEL flat,stdcall
ExitProcess PROTO, ExitCode:DWORD

message     BYTE     "You cant always get what you want",0
result      BYTE     SIZEOF message DUP(" "),0

public      fini
loop4       PROC

            ;----------Copy the string message to result
            mov      ebx,0
            mov      ecx,LENGTHOF message
    mov    al,message[ebx]
    cmp    al,'a'
    jb    no_change
    cmp    al,'z'
    ja    no_change
    and    al,0DFh
    mov    result[ebx],al
    inc    ebx
    loop    next_char

fini::      push     0
            call     ExitProcess
loop4       ENDP
            END      loop4

RE: copy string and convert to upper case

is ds realy holding the data segment you intended?

succes, Tessa

RE: copy string and convert to upper case

i think the conversion routine is solid,
nothing wrong there.

like tessa said, maybe ds needs to be set up first.
put this code at the beginning of your loop4 routine
and see what happens:

  push cs
  pop ds

instead of using ebx as a pointer i would have used esi,
and let lodsb do the byte fetching. should be faster.

RE: copy string and convert to upper case

I got this running in Linux/NASM for IA-32 with no trouble.  I'd say watch the addressing syntax and know precisely what your macros are doing.

What compiler are you using?


section .text

        global _start

        xor     ebx, ebx
        mov     edx, $msg_len
        mov     al, [msg+ebx]
        cmp     al, 'a'
        jb      no_change
        cmp     al, 'z'
        ja      no_change
        and     al, 0xDF
        mov     [res+ebx], al
        inc     ebx
        cmp     ebx, edx
        jnz     next_char

        mov     ecx,$msg
        mov     ebx,1
        mov     eax,4
        int     80h

        mov     ecx,$res
        mov     ebx,1
        mov     eax,4
        int     80h

        mov     ebx,0
        mov     eax,1
        int     80h

section .data
msg     db      "You can't always get what you want", 0xa
msg_len equ     $ - msg
res     db      "                                  ", 0xa

ND smile

bigoldbulldog AT hotmail

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close