0
VElist     dw 2,40;      
           dw 3,55;      
           dw 4,70;      
           dw 5,60;      
           dw 6,70;    
           dw 7,80;     
           dw 8,170;    
           dw 9,120;   
           dw 1,56;

I'm trying to add all this numbers that are the second number in this array of number pairs, ex:40,55,70 I typed

mov cx,des
sub cx,beg
mov ax,0
mov di,Beg
add ax,VElist[4*di-1]

where my program allowed us to enter the Variable "beg" and "des" between 1 to 0.

But the assembler keeps telling me the error information :invalid use of registers at add ax,VElist[4*di-1].

I can't see I did any where wrong, I'll be thankful if anyone can help me solve this question:))

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621

1 Answers1

1

The address mode VElist[4*di-1] is not valid.
There is no scale in any of the 16-bit addressing modes.


Here a list of the available 16-bit addressing modes:

[BX+SI]
[BX+DI]
[BP+SI]
[BP+DI]
[SI]
[DI]
disp16
[BX]
[BX+SI]+disp8
[BX+DI]+disp8
[BP+SI]+disp8
[BP+DI]+disp8
[SI]+disp8
[DI]+disp8
[BP]+disp8
[BX]+disp8
[BX+SI]+disp16
[BX+DI]+disp16
[BP+SI]+disp16
[BP+DI]+disp16
[SI]+disp16
[DI]+disp16
[BP]+disp16
[BX]+disp16

Refer to Intel manual 2 section 2.1 for further information.

Margaret Bloom
  • 41,768
  • 5
  • 78
  • 124