avevo questo esercizio da svolgere: stampare un vettore di stringhe, definito nei dati. sempre nei dati definire la variabile "ricercato", come una delle lettere che ci sono nella stringa. L'esercizio richiedeva poi di inserire un carattere da tastiera, e sostituire questo carattere in tutte le occorrenze di "ricercato"


ho provato a farlo varie volte, ma non riesco a scambiarlo, avrò sbagliato qualcosa nel ciclo sostituisci ma non riesco a capire cosa..questo è il codice:

codice:
data segment   
    vetst db 'p','o','s','t','o'
    ricercato db 'o'
    newc db ? 
    msg1 db "Inserisci carattere: $"
    ; add your data here!
    pkey db "press any key...$"
ends

stack segment
    dw   128  dup(0)
ends

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax
    mov es, ax
    
    
    mov ax, 0
    mov cx, 5
    mov si, 0
   ciclo_stampa: mov dl, vetst[si]  
                 mov ah, 2 
                 int 21h  
                 inc si
                 loop ciclo_stampa
   
   mov dl,13
   mov ah, 2
   int 21h 
   mov dl,10
   mov ah, 2
   int 21h  
   
   lea dx, msg1
   mov ah, 9
   int 21h
   mov ah, 1
   int 21h
   
   mov newc, al
   mov dl, ricercato
   mov bl, newc           
             mov cx, 5
             mov ax, 0
             mov si, 0
             mov dx, 0 
             mov bx, 0
              
   ciclo_sost: cmp dl, vetst[si]
               je sost2
               inc si
               loop ciclo_sost
               sost2: mov vetst[si], bl
               
   
    mov ax, 0
    mov cx, 5
    mov si, 0  
    mov dx, 0
   ciclo_stampa2: mov dl, vetst[si]  
                 mov ah, 2 
                 int 21h  
                 inc si
                 loop ciclo_stampa2   


    ; add your code here
            
    lea dx, pkey
    mov ah, 9
    int 21h        ; output string at ds:dx
    
    ; wait for any key....    
    mov ah, 1
    int 21h
    
    mov ax, 4c00h ; exit to operating system.
    int 21h    
ends

end start ; set entry point and stop the assembler.