0

I am trying to solve the following problem using Assembly Language with MASM:

Write a general-purpose program that correct an extra character in a string. For example, in “Excellent time too listen to music” program should remove the extra o. Here is a sample call:

.data

str1 BYTE “Excellent time too listen to music”,0

.code

I have the following code:

.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
str1 BYTE “Excellent time too listen to music”
.code
main proc
    mov al, char
    mov edi, offset str1
    mov ecx, length str1 
    cld 
    repne scasd            ; scan for the character 
    jnz end                ; if if no 'o'
    cmp [edi], al          ; check if next charater is 'o'
    jmpnz end 
    ; remainder of ecx
    mov esi, edi 
    mov edi, edi -1 
    rep movsd
main endp
end main

When I compile it on Visual Studio, I got the following errors:

enter image description here

Update: I updated the quotation mark on line 6 and remove errors for line 6, 10, and 11. Here is the update script and error log.

.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
str1 BYTE "Excellent time too listen to music" 
.code
main proc
    mov al, char
    mov edi, offset str1
    mov ecx, length str1 
    cld 
    repne scasd            ; scan for the character 
    jnz end                ; if if no 'o'
    cmp [edi], al          ; check if next charater is 'o'
    jmpnz end 
    ; remainder of ecx
    mov esi, edi 
    mov edi, edi -1 
    rep movsd
main endp
end main

enter image description here

hongkongbboy
  • 300
  • 1
  • 5
  • 14

0 Answers0