delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/21/18:39:52

From: oak9755 AT silver DOT sdsmt DOT edu (Olav Kindt)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Far Pointers in Protected Mode
Date: 21 Oct 1996 08:12:25 GMT
Organization: South Dakota School of Mines and Technology
Lines: 41
Distribution: world
Message-ID: <54fb9a$1pp@news.sdsmt.edu>
References: <54bsg5$c6b AT news DOT stealth DOT net> <54draj$qs4 AT news DOT sdsmt DOT edu> <54e8n2$e8p AT news DOT stealth DOT net>
NNTP-Posting-Host: silver.sdsmt.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Mohan Khurana (mohan AT stealth DOT net) wrote:
: 
: I am not very good with ASM, can you show me some source?
: 
: What does rep stosl do?

Ok here's a short example for you

		__asm__ __volatile__ ("
			movw %0, %%es
			movl $0xA0000, %%edi
			movl %1, %%eax
			movl $0x4000, %%ecx
			rep
			stosl"
			:
			: "g" (_dos_ds), "g" (Packed)
		);
This code will fill one page of the screen when when in 256 color mode.
The packed varaible is the color byte (0-255) repeated four times in a
word. (0x3D => 0x3D3D3D3D). The stosl command simply stores the DWORD
located in the eax register, into the memory pointed at by es:edi. The rep
command means that this operation should be repeated however many times as
the ecx registers says. 

If you don't understand this, I recommend the ASM tutorials on the AT&T
syntax that are available on the web at:
	http://remus.rutgers.edu/~avly/djgfx.html

If assembly simply doesn't appeal to you at all, you can get around the
problem by using the dosmemput command, but that would be slower i guess.
It depends on what kind of operations you are dong. If it is graphics, and
videomemory access, i recommend you learn the assembly stuff

Have fun.. :-)


-- 
Olav Kindt		     | email:	oak9755 AT silver DOT sdsmt DOT edu
737 E. Anamosa Street #103   |		xedb_oak AT debet DOT nhh DOT no
Rapid City SD-57701	     | 		MAIL me man.......

- Raw text -


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