delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/04/11:36:56

From: ranla AT post DOT tau DOT ac DOT il (Tal Lavi)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Extended ASM (Was: misc questions)
Date: Fri, 4 Dec 1998 18:10:47 LOCAL
Organization: Tel-Aviv University Computation Center
Lines: 46
Message-ID: <ranla.148.0003E15E@post.tau.ac.il>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 981202164845 DOT 27255C-100000 AT is>
NNTP-Posting-Host: slip-102.tau.ac.il
X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #4]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>If you have already studied those, you will 
>have to ask further questions here.

Here's one.
I need a FlushPage routine(macro?) for a 640x480x16bpp mode written in asm.
Until now, I used a C(++) routine which uses _farsetsel & _farnspokel.
All my experiments in writing such a routine with the extended ASM failed.
Here's one that SEEM to be alright to me, the unexperienced ASM programer.
Please, show me a better one(that works).
And, PLEASE, mention what the not so obvious parts of your code does.

void FlushPage(unsigned short C)
{
  __asm__ __volatile__ ("
    movw %0,%%fs\n
    .byte 0x64\n
    movl $0,%%edi\n
    movl $153600, %%ecx\n
    rep\n
    stosl"
  :
  :"r"(LFBSelector[ScreenNum]),
   "a"((long(C)<<16)+C)
  :"ax","cx","di","memory"
  );
}

I also have a couple of questions:

1) Should I use a rep stos, or maybe movl with a branch?

2)
> The first are constraints again, and ".byte 0x64" causes the assembler to 
> emit 0x64 into the binary code.  0x64 is the op-code for FS: prefix 
> override (meaning the next instruction uses offsets into the segment 
> whose selector is in the FS register).  sys/farptr.h uses a byte constant 
> because early versions of Gas didn't support prefixes (I'm not sure how 
> the things are with Binutils 2.8.1).

Why should you write(and know) the opcode? Isn't there an ASM instruction for that purpose?
(movl %something, %%fs(%something))?


	Thanks in advance,

		Tal Lavi		ranla AT post DOT tau DOT ac DOT il

- Raw text -


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