delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/04/04:18:00

Date: Wed, 4 Apr 2001 10:14:59 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Mathias K <papewaio AT sunderbynskabel DOT bd DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: AST&T syntax
In-Reply-To: <001001c0bcd1$f39fd960$0b0510ac@astra.sunderbynskabel.bd.se>
Message-ID: <Pine.SUN.3.91.1010404100644.23448P@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 4 Apr 2001, Mathias K wrote:

> if video_buffer is a global pointer and data is a local pointer, could =
> you translate these 7 lines for me?
> 
> push ds
> les di, video_buffer
> lds si, data
> mov cx, 32000
> cld
> rep movsw
> pop ds

Untested:

	#include <sys/movedata.h>

	dosmemput (data, 32000*2, video_buffer_seg*16 + video_buffer_offs);

where video_buffer_seg and video_buffer_offs are the segment and the 
offset of the video buffer.  dosmemput is a library function which 
expands into the same assembly code that you were trying to use, except 
that it does that correctly for protected-mode programming, which 
disallows loading arbitrary values into segment registers such as DS and 
ES.

In other words, don't use assembly unless you really need to: it 
introduces a level of complexity into DJGPP programming that a new user 
doesn't need.

See chapter 18 in the DJGPP FAQ list for more about low-level programming 
with DJGPP.

- Raw text -


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