I'm supposed to fix this assembly code so that it prints the string 'string' but I'm getting all kinds of errors

Question!
.model tiny
.code 
Start:
CLEAR:
mov cx, 80*25
mov ax, 7120h
sub bx,bx
l: mov es:[bx],ax
add bx, 2
loop l
str db 'string', 0 ; reserved word used as symbol : str 
mov DI, ? ; position y*160 + x*2
mov aH, 03
sub Si, Si; index
L: mov al, STR[SI] ; symbol already defined elsewhere: l
   mov es, [DI], ax ; extra characters on line
oR aL, AL
JZ done ; undefined symbol: done
ADD DI, 2
JMP L
end start 

I put in the errors as comments



Answers
Then use a different name than str. By the way, you can't place data in the middle of code like this. If you do, you'll have to jump past it so that the processor doesn't try to execute your data as if it was instructions.

L: mov al, STR[SI] ; symbol already defined elsewhere: l

You already have a label named l, and your assembler apparently is case-insensitive when it comes to symbol names. Pick a different name, preferably one that is more descriptive than L.

mov es, [DI], ax ; extra characters on line

It should be es:[, not es, [.

JZ done ; undefined symbol: done

Means exactly what it says: you haven't defined any symbol with the name done (there's no such label in your code).

By : Michael


This video can help you solving your question :)
By: admin