The program i'm coding can only use 286 instruction sets and the problem is that i can not use something like this to multiply a value by 10

ADD  BX , BX
LEA  BX ,

i am using TASM. can anybody help?
Posted on 2006-06-22 22:52:46 by XCHG
How about this? 10x = 8x + 2x
So,

ax contains original value
mov bx,ax
shl ax,3 ;don't remember if 286 allows this, if not just use three shl ax,1
shl bx,1
add ax,bx


Viola! ax = ax * 10

Does that help?
Posted on 2006-06-23 12:34:47 by shantanu_gadgil

ax contains original value
mov bx,ax
shl ax,3 ;don't remember if 286 allows this, if not just use three shl ax,1
shl bx,1
add ax,bx


you can do:

mov cl, 3
mov bx,ax
shl ax,cl
shl bx,1
add ax,bx

shifting by cl is allowed on 286 (iirc)
Posted on 2006-06-23 15:41:05 by ti_mo_n
The 286 can indeed shift by CL. So can the 8086/8088 !
Posted on 2006-06-23 23:40:11 by tenkey
I have a very limited amount of registers to use right now. CX is already being used as a counter and i dont think pushing and poping is a good idea. but i guess i have to use a local variable for the counter at least so that the CX will be free again. thanks guys i appreciate your help
Posted on 2006-06-24 00:09:34 by XCHG
SAL is also an option.

Paul
Posted on 2006-06-24 02:32:02 by PBrennick

SAL is also an option.

Paul

SAL and SHL are the same thing. The is a difference between SHR and SAR, only.

From Intel's manuals, Volume 1, chapter 7.3.6.1:
The SAL and SHL instructions perform the same operation(...)
Posted on 2006-06-25 01:25:19 by ti_mo_n