I have this code, but it produces a type mismatch in a loop when I add an array to dl. How correctly, tell me please, tomorrow you need to hand over the lab ...

prg segment para public 'code' assume cs:prg,ss:prg,es:prg,ds:prg org 100h mas dw, 41h,4Dh,38h,32h start: jmp go go: mov ax, 0600h mov bh,07 mov cx, 0000 mov dx,184fh mov cx,5 Zero: mov dl,mas int 21h loop Zero ret prg ends end start 
  • I want to upset you, you and the program logic is not correct - Error
  • @Madnestranger, According to the rules of the forum, questions should not be limited to solving or completing student assignments. Please clarify what you have done yourself and what did not work out. - Nicolas Chabanovsky

1 answer 1

  1. After dw do not need a comma.
  2. If you enter an element of an array in dl (byte register), then the array should be byte, i.e. instead of dw should be db (of course, you can read from the array of words byte-by-byte, but I will not overload it with information).
  3. start: jmp go should be higher than mas db ... , because you need to "jump over" the array.
  4. mov dl, mas each time in the cycle enters the first element of the array into the register. The entire array in the register cannot be entered. Instead, something like mov dl, ds:[mas+di] , di must be initialized to zero before the loop, and increased by 1 in the loop.
  5. I'm not sure about the correct output to the screen using int 21h , but it's too lazy to understand.