Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
sevobal
Member
Posts: 63 Joined: Sun Oct 22, 2006 7:11 am
Post
by sevobal » Thu Feb 05, 2009 3:33 am
Hi,
I've tried to use the inline assembler of g++ to access the x64 register r8:
Code: Select all
void Video::clear()
{
asm("movl $0,%%r8"); /* Clear Screen */
asm("int $0x30"); /* Call Video driver (text mode) */
}
But when I try to compile the whole code with g++ I got the following error message: "Video.cpp:26: Error: Bad register name '%%r8'"
What's my mistake?
Thanks for your help
01000101
Member
Posts: 1599 Joined: Fri Jun 22, 2007 12:47 pm
Contact:
Post
by 01000101 » Thu Feb 05, 2009 4:07 am
because you're not using extended inline assembly (using asm(" "): out:in:clobber), you only need one % for register references.
So it should be %r8 instead of %%r8.
Last edited by
01000101 on Thu Feb 05, 2009 4:13 am, edited 1 time in total.
sevobal
Member
Posts: 63 Joined: Sun Oct 22, 2006 7:11 am
Post
by sevobal » Thu Feb 05, 2009 4:10 am
Thank you very much!
Here's the working code:
Code: Select all
void Video::clear()
{
asm("movq $0, %r8"); /* Clear Screen */
asm("int $0x30"); /* Call Video driver (text mode) */
}