Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

8086 TASM: Illegal Indexing Mode [duplicate]

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.

like image 591
Roberek Avatar asked Jan 14 '23 14:01

Roberek


1 Answers

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]
like image 97
Stanley Avatar answered Jan 17 '23 15:01

Stanley