Message Board


Message Board > C/C++ > Using C symbols in Dev-CPP inline asm?

October 13, 2006, 21:19
Eckolin
Quite Whiskered
388 posts

I'm attempting to improve SGL's speed by using asm for the drawing parts. However, the linker complains about not knowing the symbols I use (TEX, TEXWIDTH and the like).

The symbols are private variables of the drawing function.

Lastly, I'm using Intel syntax, because the AT&T doesn't look as neat.

How do I link things correctly?

P.S. Making all variables global is a last resort solution, I'd rather have something neat.

[Edited on October 13, 2006 by Eckolin]
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
October 15, 2006, 20:52
OScoder
None
1338 posts
Hi. How is it you are trying to use them (could you post the code of what you are doing)?

This works for me (AT&T syntax, but it might give the idea):
Code:
asm volatile("outw %%ax,%%dx \n\t" :: "a"(data), "d"(port))


edit:
- ah. Just realised this is gcc inline asm, is it different?

[Edited on October 15, 2006 by OScoder]
____________
om
#
October 15, 2006, 23:25
Eckolin
Quite Whiskered
388 posts

It looked something like:
Code:
asm("MOV si,scount;" // scount here is a local variable.
    "starttpolyscanlineuz:;"
);

The actual code was about 80 lines long.
It didn't use extended asm, so no clobbering. :P

I tested it by turning all variables global, but that didn't work. (Crash when at drawing)

Then I noticed that compiling with the -masm=intel tag caused the dll not to work anyway, even without the inline code. Since I didn't want to write it using AT&T style, the inline code is now removed.

If necessary, I can post the relevant sgl.c code for someone more experienced to look at.

Edit: Cosmetic change.

[Edited on October 16, 2006 by Eckolin]
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#

Message Board > C/C++ > Using C symbols in Dev-CPP inline asm?

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!