Link to home
Start Free TrialLog in
Avatar of zystudio
zystudio

asked on

Assembly question

Why this failed?

data segment

data ends

mov ds,data <--fail ?

tks!
ASKER CERTIFIED SOLUTION
Avatar of Wyn
Wyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

try

MOV AX,DATA
MOV DS,AX

continues
Opps, 1 minute too late

The reason is that there is no instruction for moving an immediate value to a segment register.  There is one for moving an immediate to a GP register, like AX (or DC in Wyn's case), so you move the segment value (which is an immediate or constant value) to the GP register and then move the value in the GP register to the segment register.
Note using AX instead of DX will be 1 byte shorter and potentially a little faster.
Avatar of zystudio

ASKER

Thank you ,nietod and Wyn ...How can I give the points ??

oh, sorry ,nietod ...
zystudio , nietod's answer is better ,reject me ..

Regards to you both...
Eirnava
Nietod , I  post another question for you ,thank you and Wyn!!


>>  nietod's answer is better ,reject me ..
Thanks, although mine was insignificantly smaller and insignifcantly faster, but assembly programs tend to worry about those things...