delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/19/14:31:15

Xref: news2.mv.net comp.os.msdos.djgpp:6169
From: brennan AT mack DOT rt66 DOT com (Brennan "Reverend Bas" Underwood)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Embedded code: LES
Date: 19 Jul 1996 11:15:21 -0600
Organization: None, eh?
Lines: 43
Message-ID: <4sofr9$8tu@mack.rt66.com>
References: <philpri DOT 40 DOT 837639716 AT ee2 DOT ee DOT cit DOT ac DOT nz>
NNTP-Posting-Host: mack.rt66.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <philpri DOT 40 DOT 837639716 AT ee2 DOT ee DOT cit DOT ac DOT nz>,
Richard Philp <philpri AT ee2 DOT ee DOT cit DOT ac DOT nz> wrote:
>    I've been needing to do some embedded code in some of my programs latly, 
>but theres a problem with one of the opcodes: LES . I've try lesl, but the 
>assembler doesn't like it, and when I make the program a library, with this 
>command in it, it keeps on crashing, and coming up with a sigsev error (Or 
>something similer. I know I've misspelt it.). Anyone know why? Or can 
>someone give me a reason for why the assembler doesn't like les? 
>Or is there an equlivent?

les is a real-mode instruction used like so

les bx, _some_variable

It loads es with the segment of _some_variable, and bx with the offset.
You probably could do

movw %ds, %es		/* assuming it's not already equal */
movl $_some_variable, %ebx

but I'm not sure when you'd need this, unless you're calling a realmode
interrupt. Then you'd

__dpmi_regs regs;
memset(&regs, 0, sizeof regs);
regs.x.es = linear_address_of_some_variable / 16;
regs.x.bx = linear_address_of_some_variable & 0xf;
/* plus set up other regs */
__dpmi_int(whatever, &regs);


It's kinda hard to give advice on this without some more info as to
what you're trying to do.

If you need a reference of real-mode instructions get
ftp://x2ftp.oulu.fi/pub/msdos/programming/gpe/pcgpe10.zip

and extract intel.doc, or it might be intel.txt.


--Brennan
-- 
brennan AT rt66 DOT com  |  fsck /u

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019