could someone help me how to reverse a string in a86 ...the program will goes like this.user will input a string of 4 characters or less than 4 for ex..whin then it will output nihw..but if the user will input 5 or more than, for ex. whinz the output would be whinzznihw...
i have a code here but it has some error in reversing..
begin:
call erase
call display_remark
call get_data
call comparator
int 20h
erase:
mov ax,03h
int 10h
ret
display_remark:
mov ah,09h
lea dx,string_remarks
int 21h
ret
get_data:
mov ah,0ah
lea dx,store_string
int 21h
ret
comparator:
mov bx,2
Xor dx,dx
Xor si,si
Xor di,di
Xor ax,ax
mov si,b[store_password]
mov cx,5
goto_end_string:
mov al,b[si]
mov ah,b[store_password + bx]
inc si,1
inc bx,1
loop goto_end_string
jmp reverse
reverse:
mov b[store_password + bx], ah
dec si,1
dec bx,1
loop reverse
mov ah,09h
lea dx, string_reverse
int 21h
again:
mov dx,offset msg
mov ah, 9
int 21h
mov ah, 1
int 21h
mov char1,al
cmp al,'y'
je begin
cmp al,'Y'
je begin
int 21h
ret
msg db 0ah,0dh, "Try Again [y/n] : $"
char1 db ?
store_store db 10 dup()
string_remarks db 0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d, "Enter a string: $"
string_reverse db 0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d,0d, "String in reverse order is: $"