The task sounds like: "Enter the s1 string at least 10 characters in length. Copy the last but one character three times and the first from string s1 to string s2. Display the lines s1 and s2."
I've tormented with this code for two days and still can't achieve the result, as well can't understand how to fix it. We've learnt for now only 0Ah, 02h, 09h and 40h functions besides int21h / 4ch. For the code below compilation doesn't allow me to enter anything and prints 3 symbols which are pretty similar to the 6.
.model small
.stack
.data
m1 db "Enter the string:", 10, 13, "$"
maxlength db 11
clength db ?
s1 db 11 dup(?)
s2 db 5 dup(?)
nline db 10,13,"$"
.code
mov ax, @data
mov ds, ax
mov ah, 9
lea dx, m1
int 21h
mov ah, 0Ah
lea dx, s1
int 21h
mov bl, clength
mov bh, 0
mov AL, s1[BX-2]
mov s2+1, AL
mov AL, s1[BX-2]
mov s2+2, AL
mov AL, s1[BX-2]
mov s2+3, AL
mov AL, s1[BX+1]
mov s2+4, AL
mov s2+5, "$"
mov s1[bx], "$"
mov ah, 9
lea dx, s1
int 21h
mov ah, 9
lea dx, nline
int 21h
mov ah, 9
lea dx, s2
int 21h
mov ah, 9
lea dx, nline
int 21h
mov ah, 4ch
int 21h
end
I expect the output to be: Enter the string (the string I print)
(symbols copied from s1)