0
TITLE tema1        
.model small
.stack 100h
.DATA
index1 DB 8
index2 DB 4
value DB 33h
array1 DB 01h, 02h, 03h, 04h, 05h, 06h, 07h, 08h, 09h, 0Ah
array2 DB 11h, 12h, 13h, 14h, 15h, 16h, 17h, 18h, 19h, 1Ah

.CODE
begin:
mov ax,@DATA
mov ds,ax

mov bx,0

mov al,value
mov si,index1
mov array1[bx+si],al


mov si,index2
mov array2[bx+si],al


mov ax,4c00h
int 21h
end begin

The compiler says that the operand types do not match. I don't know how to approach this code.

The register bx is incremented with 0 at the start and si register is incremented twice with the values of index1 and index2. When I try to change the value of bx+si in the array I get an error about operand types not matching.

  • `mov si,index2` is a 16-bit load, but you only put a `db` there in `.data`. Use `movzx si, byte ptr [index2]`, or keep your indices in registers in the first place, like `mov si, 4`. – Peter Cordes May 07 '22 at 15:12
  • As a third alternative, make your indices `dw` variables. Note that `movzx` is only available on an 80386 or newer, so check your requirements for whether you can use this instruction. – fuz May 07 '22 at 16:56

0 Answers0