Solved

Assembly question

Posted on 2000-05-15
8
201 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

679 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