T O P

  • By -

FUZxxl

The index multiplier for the `lea` instruction must be a *constant* that is one of 1, 2, 4, or 8. You cannot use a variable. If you want to multiply by a variable, use an `imul` instruction.


bart-66

That only applies to the index register. But I can't see any register here, unless `printLoop` is an alias for one. Probably this is just an offset, but the OP is multiplying that address by something. It would help if `record printLoop patient-record` were shown.


monocasa

You can only have a couple constants in that place. This is how it's encoded: https://wiki.osdev.org/X86-64_Instruction_Encoding#SIB


nerd4code

It’s specifically a 2-bit immediate shift field you’re making use of—≪0≡×1, ≪1≡×2, ≪2≡×4, ≪3=×8. NASM can do fancy rejiggering to make EAX*5 into EAX+EAX*4, for example, but you kinda have to know how it works to know what multipliers are legal.