> i write "hello" and program write "olleh".
- 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.
try this one...:).
data segment [I];used for storing our variables[/I]
temp db 20 [I];20 bytes for our string[/I]
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]
jmp loa [I] ;next char[/I]
fin: mov ah, 02h
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]
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.. :)
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.