Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

REVERSING A STRING...

I'm new in assembly language. I have to come up with a complete TASM code for this problem:

Code a program for the following requirements. Define NAME1 with the string "SalesClerk" and NAME2 with 15 blanks. Use LODSB to access each character in NAME1 from left to right. Then use STOSB to store each accessed character into NAME2 from right to left so that NAME2 contains the string in reverse sequence. You have to clear and set the Direction Flag for this procedure. Assemble and Test.

Please Help me... Thank You. This is urgent.[size=3][/size][color=Blue][/color]

this is the code that I tried, but it doesn't reverse a string.



.model small
.code
org 100h

start:

first proc near

lea si, a1
mov cx, 15
mov ah, 0Eh


a:

LODSB
int 10h
loop a

ret

a1 db,'SalesClerk$'

first endp

second proc near

lea di, a2
mov al, 12h
mov cx, 15

rep STOSB

ret

a2 db, 15 dup(0)

second endp

end start

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : I'm new in assembly language. I have to come up with a complete TASM
    : code for this problem:
    :
    : Code a program for the following requirements. Define NAME1 with the
    : string "SalesClerk" and NAME2 with 15 blanks. Use LODSB to access
    : each character in NAME1 from left to right. Then use STOSB to store
    : each accessed character into NAME2 from right to left so that NAME2
    : contains the string in reverse sequence. You have to clear and set
    : the Direction Flag for this procedure. Assemble and Test.
    :
    : Please Help me... Thank You. This is
    : urgent.[size=3][/size][color=Blue][/color]
    :

    This would qualify as a homework question and you haven't given it a try yet. Post what you have so far, and ask questions where you're stuck and then we can help out
    Good luck, and try to have fun coding :P
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.