How to assign an address to registers ES:DI 
Author Message
 How to assign an address to registers ES:DI

Hi, Ive tried to work this one out myself, but I'm stumped. Can anyone
help?
Thanks,
Matthew Fors



Thu, 04 May 2000 03:00:00 GMT  
 How to assign an address to registers ES:DI

Quote:

> Hi, Ive tried to work this one out myself, but I'm stumped. Can anyone
> help?
> Thanks,
> Matthew Fors

Sorry for my English.

If your c compiler use inline assembly language, you can write thie:

-> asm les di, dword ptr variablename

In C syntaxe, you can write this

#ifndef FP_SEG  /* Get the segment value of pointer */
 #define FP_SEG(fp)     ((unsigned)(void _seg *)(void __far *)(fp))
#endif

#ifndef FP_OFF /* Get the offset value */
 #define FP_OFF(fp)     ((unsigned)(fp))
#endif

_DI = FP_OFF(ptrvariablename);
_ES = FP_SEG(ptrvariablename);

N.B. macro FP_OFF ans FP_SEG are defined in dos.h

If you programmind in windows, you can write this

#include <windows.h>

_DI = OFFSETOF(ptrvariablename);
_ES = SELECTOROF(ptrvariablename);



Fri, 05 May 2000 03:00:00 GMT  
 How to assign an address to registers ES:DI


comp.lang.c:

=> >
=> > Hi, Ive tried to work this one out myself, but I'm stumped. Can anyone
=> > help?

=> Sorry for my English.
=>
=> If your c compiler use inline assembly language, you can write thie:
=>
----SNIP----
=>
=> In C syntaxe, you can write this
=>
----SNIP----

No, you can't. What you wrote was not C. It was something some compiler vendor
came up with to allow you to do hardware specific things using their compiler.
It will not work with ANY other compiler, even for the same hardware.

The proper answer is - you need to look in a platform specific newsgroup.
  comp.os.msdos.programmer
  comp.os.ms-windows.*
  comp.os.linux.*
may be better.

comp.lang.c is for discussion of the C programming language as defined by
ANSI/ISO. System/platform specific issues do not belong here, as the
readership probably doesn't use whatever platform you think they do.

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Amaze Your Friends! Confound Your Neighbors! Stupefy Your Enemies!

THINK!

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

http://mroot.home.mindspring.com



Sat, 06 May 2000 03:00:00 GMT  
 How to assign an address to registers ES:DI


Quote:


> comp.lang.c:


> => >
> => > Hi, Ive tried to work this one out myself, but I'm stumped. Can anyone
> => > help?

> => Sorry for my English.
> =>
> => If your c compiler use inline assembly language, you can write thie:
> =>
> ----SNIP----
> =>
> => In C syntaxe, you can write this
> =>
> ----SNIP----
> No, you can't. What you wrote was not C. It was something some compiler vendor
> came up with to allow you to do hardware specific things using their compiler.
> It will not work with ANY other compiler, even for the same hardware.

Interesting, If I write a new function, put it in a library for my use,
it's C, but if a programmer working for a compiler publisher writes a
function puts it in a library for the use of programmers who purchase
the compiler, it's not C.  Am I missing something, or is this actually
as ridiculus as it sounds.

Of course it is C, it is just not ANSI/ISO C, and as such you are quite
correct in stating that it is off topic.

Quote:
> The proper answer is - you need to look in a platform specific newsgroup.
>   comp.os.msdos.programmer
>   comp.os.ms-windows.*
>   comp.os.linux.*
> may be better.

No, if he knew the answer and wanted to impart it he should, by e:mail.
The only thing he did wrong was to waste comp.lang.c bandwidth with an
off-topic answer.  We do not want to discourage people from answering
questions, we do however want to keep off-topic material off comp.lang.c

comp.lang.c is for discussion of the part of the C programming language
defined by ANSI/ISO. System/platform specific issues do not belong here,
as the readership probably doesn't use whatever platform you think they
do.

You got that almost right.

--
*****************************************************************
When everything's coming your way, you're in the wrong lane.
Who is General Failure and why is he reading my hard disk?
I couldn't afford to repair my brakes, so I turned up the radio.
I'm not cheap, but I am on special this week
=========================================

=========================================
READ THE FAQ for more information:
   C-FAQ ftp sites: ftp://ftp.eskimo.com or ftp://rtfm.mit.edu
   Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html



Sat, 06 May 2000 03:00:00 GMT  
 How to assign an address to registers ES:DI

Quote:

>Hi, Ive tried to work this one out myself, but I'm stumped. Can anyone
>help?


would the group to try.

--
Craig

Manchester, NH
I try to take one day at a time, but sometimes several
days attack me at once. -- Ashleigh Brilliant



Sun, 07 May 2000 03:00:00 GMT  
 How to assign an address to registers ES:DI

Quote:

> Interesting, If I write a new function, put it in a library for my use,
> it's C, but if a programmer working for a compiler publisher writes a
> function puts it in a library for the use of programmers who purchase
> the compiler, it's not C.  Am I missing something, or is this actually
> as ridiculus as it sounds.

You intentionally make it sound rediculous, but you are missing a
point or two here. The sample code in question did not simply call
"a function". It used compiler specific language extensions, like
"_seg" and "__far". You would not be able to write a function
using these things (and put it in a library) on an ANSI-C compiler.
Therefore it is *not* C. It might be Microsoft-C or Borland-C, but
definitely not C in general.

Stephan
(initiator of the campaign against grumpiness in c.l.c)



Tue, 09 May 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. assign address to pointer array

2. bind: Can't assign requested address

3. Assigning an address to a pointer

4. Assigning an address to an integer

5. How to determine assigned IP address

6. Assign Ip address with RAS

7. Assign IP address with RAS

8. Assigning IP address woth RAS

9. Flushing the IP address assign by DHCP on Windows 95

10. inline asm on VC6 (loading the address of a member var in a register)

11. The & (address) operator and register allocation

12. XScale GPIO registers Address

 

 
Powered by phpBB® Forum Software