hi i just wonder how to limit an input when a user types a certain number.
for example:
Input: 5
Input: abacd
Output: dcaba
here my problem is when a user inputs 5, then the allowed number for inputting characters is 5 only. and then it reverses the string.
I only have the code for reversing the string but not the limiting of #s to input.
I had an idea to fix this but it failed
i hope you would help me fix this one. thanks
.model small
.stack 100h
.data
m1 db 13, 10, "Enter string: $"
m2 db 13, 10, "Reverse string is: $"
.code
mov ax, @data
mov ds, ax
lea dx, m1
mov ah, 09h
int 21h
mov cx, 0
read:
mov ah, 01
int 21h
cmp al, 0dh
je ahead
push ax
inc cx
jmp read
ahead:
lea dx, m2
mov ah, 09h
int 21h
display1:
mov ah, 02h
pop dx
int 21h
loop display1
mov ah, 4ch
int 21h
end