Mail Archives: djgpp/1998/12/04/11:36:56
>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 -