Assembly question

Why this failed?

data segment

data ends

mov ds,data <--fail ?

tks!
zystudioAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
WynConnect With a Mentor Commented:
Beause you can not move imme to ds directly ,change it to:

mov dx ,data
mov ds,dx

Regards
Eirnava...
0
 
nietodCommented:
try

MOV AX,DATA
MOV DS,AX

continues
0
 
nietodCommented:
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.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
nietodCommented:
Note using AX instead of DX will be 1 byte shorter and potentially a little faster.
0
 
zystudioAuthor Commented:
Thank you ,nietod and Wyn ...How can I give the points ??

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

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


0
 
nietodCommented:
>>  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...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.