delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/20/04:31:37

From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: segment overrides
Date: Mon, 20 Apr 1998 10:16:26 +0200
Organization: University of Ghent, Belgium
Lines: 32
Message-ID: <353B045A.7662@rug.ac.be>
References: <28A3AF71AD2 AT fharga DOT sun DOT ac DOT za>
NNTP-Posting-Host: eduserv1.rug.ac.be
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

lou smith wrote:
> 
> hi
> 
> i dont quite understand how segment overrides work..
> does one have call ".byte 0x64" before EVERY SINGLE memory access..
> Does that mean a instruction like  "rep
>                                                 stosl"
> is impossible - because each of those stores should have been
> preceded by a "byte 0x64" bytecode -- requiring an explicit  ecx-type
> loop ???

In addition to what John M. Aldrich wrote:

you can write:
	rep
	.byte 0x64
	movsl
And it will work as you would want it to (moving %ecx bytes from
%fs:%esi to %es:%edi), because ".byte 0x64" and "rep" are both prefix
bytes (that's how the CPU sees them) and not instructions of their own.
However, when the default segment register to be used is %es instead,
you cannot override, and therefore your above "rep; stosl" was a bad
example because stos[bwl] use %es. If you would want to use a different
segment register with stos[bwl] (or scas[bwl] or ins[bwl]) for some
reason, you need to rewrite it as an explicit ecx-type loop after all
indeed.

-- 
 \ Vik /-_-_-_-_-_-_/   
  \___/ Heyndrickx /          
   \ /-_-_-_-_-_-_/

- Raw text -


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