Read this, and the other intro threads.
http://www.daniweb.com/forums/announcement125-2.html

> i write "hello" and program write "olleh".
Try.
- printing hello from a string already initialised in your program
- printing a string as the user types is (letter for letter)
- printing a whole string as entered by the user
- as step 3, but backwards.

Where exactly are you stuck on this process?

If nothing else, doing the simpler steps first will give you something to develop with.

user entered word and program printing backwards word. This is all that need for me :)
with other programing language i can do it self but assembly is very hard for me.

Comments
Frankly, that answer SUCKS - you have no interest above "gimmetehcodez"

user entered word and program printing backwards word. This is all that need for me :)
with other programing language i can do it self but assembly is very hard for me.

try this one...:).

data segment           [I];used for storing our variables[/I]
temp db 20               [I];20 bytes for our string[/I]
data ends
;*****************************
code segment
assume cs:code, ds:data
start:	mov ax, seg data
		mov ds, ax
		mov bx, offset temp   [I];store poiter on temp to bx[/I]
		mov ah, 01h
		xor CX, CX    [I] ;erase CX(used for loaded chars countings)[/I]
loa:	        int 21h        [I];dos int-load a char(because ah==01h)[/I]
		cmp al, 13 [I] ;is it enter??[/I]
		je fin          [I];if it's enter, jump to end of chars input[/I]
		mov [bx], al [I] ;store loaded char to pointed memory by bx[/I]
		inc bx   [I] ;pointer increment[/I]
		inc cl
		jmp loa  [I] ;next char[/I]
		
fin:   	mov ah, 02h
		dec bx

wr:		mov dl, [bx]   [I] ;load char from memory[/I]
		dec bx           [I] ;move pointer to the left[/I]
		int 21h          [I];interrupt-write char(ah==02h)[/I]
		loop wr      [I];decrement cx, compare to 0, if it's not jump to wr[/I]
		
		mov ax, 4c00h
		int 21h   [I];interrupt-end of exe program with 00 return code(ah == 4c)[/I]
code ends
end start

Edited 6 Years Ago by mivalko: n/a

Comments
Do you want them to learn, or just show how clever you are by spoon-feeding answers on demand

mm, now i realized what is a purpose of this page..so..i shouldn't write a code here..mm..don't look at it and after you finish, just compare it to mine.. :)..i'm new here, i clicked at first link and ..you know..sorry.. :)

> user entered word and program printing backwards word. This is all that need for me
Do you want to learn?

Or are you just hoping to get a spoon-fed answer (congrats, you've already won).

Because if you've no interest at all in learning, then just tell us and we will not try to help you at all.
Then you'll just be at the mercy of the drive-by spoon-feeders.

i want to learn but it is very hard. so then i analize example i learn. it is the best way to learn for me.

Reading the book would be a great place to start. If you don't have a book there are plenty of tutorials available online.

Another method of approaching this would be using push and pop. See, if you could get the access the string byte by byte, you could push the single bytes onto the stack and pop them off after, and you'd receive them in reverse order. Of course, this method might be more complicated, and you'd need a way of counting how many bytes to push if you planned on using a string which the user input and not "hello" everytime.

This article has been dead for over six months. Start a new discussion instead.