4

I am writing an 8086 assembly program that needs to compile through TASM v3.1. I am running into an error I can not seem to fix.

My data segment has the following set up for the purposes of keyboard input:

paraO Label Byte
  maxO DB 5
  actO DB ?
  dataO DB 5 dup('$')

What I am trying to do is get the first character entered, so the first byte of dataO:

lea dx, dataO
mov bl, [dx]

However, when I attempt to compile, I get this error:

**Error** h5.asm(152) Illegal indexing mode

Line 152 is "mov bl, [dx]"

Any help would be greatly appreciated. If it matters, I am running TASM through DOSBox (My laptop is running 64-bit Win7) Google hasn't come up with any helpful answers. I can post the entirety of my code if necessary.

Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
Roberek
  • 43
  • 1
  • 3
  • Get official documentation from intel.com or amd.com. See the operand addressing modes. – Alexey Frunze Apr 19 '13 at 23:06
  • [Wikipedia](http://en.wikipedia.org/wiki/X86#Addressing_modes) has a useful summary of x86 & x86-64 addressing modes. – nrz Apr 19 '13 at 23:57
  • 1
    See also http://stackoverflow.com/questions/15353616/illegal-use-of-register-in-indirect-addressing/15355230#15355230 – Aki Suihkonen Apr 20 '13 at 06:21

1 Answers1

9

pretty sure the reason is that you can't use the DX register as a pointer.

try instead using [si], [di] or [bx]:

 lea bx, data0
 mov al, [bx]
Stanley
  • 1,421
  • 5
  • 19
  • 36