Legion
Legion

Reputation: 3427

Invalid effective address error when providing offset into buffer

I get an invalid effective address from the below, but I don't understand why. I've included the variable/constant definitions for clarity.

TurnTreeBuff:   resb 455    ; TurnNum (1 byte) + MT (16 bytes) + PM (16 bytes)
                            ; + BoardState (2 bytes) = 35 bytes * 13 turns = 455 bytes

TURNTREEREC equ 35          ; Turn tree record length

mov byte [TurnTreeBuff+ebx*TURNTREEREC],bl  ; copy turn # to TurnTreeBuff <-error here

Upvotes: 0

Views: 74

Answers (1)

Michael
Michael

Reputation: 58437

The scale factor in the address can only be 2, 4 or 8 (or 1, which is what you get if you don't specify a scale factor). You're trying to use a scale factor of 35, which isn't supported, so you get an error.

You can read more about addressing in Intel's manuals. For example, the section named "Specifying an Offset" (section 3.7.5 in my copy of the manual).

Upvotes: 1

Related Questions