zystudio
asked on
Assembly question
Why this failed?
data segment
data ends
mov ds,data <--fail ?
tks!
data segment
data ends
mov ds,data <--fail ?
tks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
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
zystudio , nietod's answer is better ,reject me ..
Regards to you both...
Eirnava
ASKER
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...
Thanks, although mine was insignificantly smaller and insignifcantly faster, but assembly programs tend to worry about those things...
MOV AX,DATA
MOV DS,AX
continues