Solved

Assembly question

Posted on 2000-05-15
8
197 Views
Last Modified: 2010-04-02
Why this failed?

data segment

data ends

mov ds,data <--fail ?

tks!
0
Comment
Question by:zystudio
  • 4
  • 2
  • 2
8 Comments
 
LVL 5

Accepted Solution

by:
Wyn earned 200 total points
ID: 2812053
Beause you can not move imme to ds directly ,change it to:

mov dx ,data
mov ds,dx

Regards
Eirnava...
0
 
LVL 22

Expert Comment

by:nietod
ID: 2812058
try

MOV AX,DATA
MOV DS,AX

continues
0
 
LVL 22

Expert Comment

by:nietod
ID: 2812062
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
 
LVL 22

Expert Comment

by:nietod
ID: 2812068
Note using AX instead of DX will be 1 byte shorter and potentially a little faster.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:zystudio
ID: 2812072
Thank you ,nietod and Wyn ...How can I give the points ??

0
 
LVL 5

Expert Comment

by:Wyn
ID: 2812085
oh, sorry ,nietod ...
zystudio , nietod's answer is better ,reject me ..

Regards to you both...
Eirnava
0
 

Author Comment

by:zystudio
ID: 2812116
Nietod , I  post another question for you ,thank you and Wyn!!


0
 
LVL 22

Expert Comment

by:nietod
ID: 2812507
>>  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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MSVCR80.dll crash 2 134
GUI: DIalog Stacking and Popping in MS C++ 4 65
Unable to start eclipse ? 17 128
What is sub-make ? 2 37
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now