i want to copy a string from a register (SI), into another register (DI). But, before copying i need to scan the string for blanc space. If there is more than 1 blanc spaces (SI), i need to replace all blanc spaces with one space and put in DI.
I don't have experience with assembly, but all what i do is:
.model small .data sir1 db 'String with more spaces', '$' sir2 db ? .code s: mov ax,@data mov ds,ax mov es,ax mov si,offset sir1 mov di,offset sir2 mov bx,0 mov cx,30 e1: cmp [si],20h ;comparing with blanc character inc bx cmp bx,2 ;if here is more than one blan je tru ;if it's equal, jump tu "tru" label. tru: mov di,[si]-1 ;substract one blanc mov di,[si] inc si inc di loop e1 mov dx,offset sir2 mov ah,09 int 21h exit: mov ah,4ch int 21h end s
Where is my mistake?
Please provide me with some advice or help.